WebKit Bugzilla
Attachment 339018 Details for
Bug 185087
: Refactor filter list checking code
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185087-20180427133523.patch (text/plain), 6.17 KB, created by
Simon Fraser (smfr)
on 2018-04-27 13:35:24 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Simon Fraser (smfr)
Created:
2018-04-27 13:35:24 PDT
Size:
6.17 KB
patch
obsolete
>Subversion Revision: 231108 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 7d99846b09e828719ba00103ca32dcaf8aa80cd2..aff096286b20ce5c36433303993a3d257b65e214 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,22 @@ >+2018-04-27 Simon Fraser <simon.fraser@apple.com> >+ >+ Refactor filter list checking code >+ https://bugs.webkit.org/show_bug.cgi?id=185087 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Deduplicate code between filter and backdrop-filter for checking whether function lists >+ match, by making a shared function that takes a std::function. >+ >+ The call sites have to declare the return type (-> const FilterOperations&) to avoid std::function >+ converting the return type into a value. >+ >+ * animation/KeyframeEffectReadOnly.cpp: >+ (WebCore::KeyframeEffectReadOnly::checkForMatchingFilterFunctionLists const): >+ (WebCore::KeyframeEffectReadOnly::checkForMatchingFilterFunctionLists): >+ (WebCore::KeyframeEffectReadOnly::checkForMatchingBackdropFilterFunctionLists): >+ * animation/KeyframeEffectReadOnly.h: >+ > 2018-04-27 Zalan Bujtas <zalan@apple.com> > > [LFC] Implement BlockFormattingContext::layout logic and its dependencies >diff --git a/Source/WebCore/animation/KeyframeEffectReadOnly.cpp b/Source/WebCore/animation/KeyframeEffectReadOnly.cpp >index 843bab6511bd2b091f030b6becda5765adb0e685..efad647bbd8841ee76aa46439d3c7bc5b4ad55c7 100644 >--- a/Source/WebCore/animation/KeyframeEffectReadOnly.cpp >+++ b/Source/WebCore/animation/KeyframeEffectReadOnly.cpp >@@ -764,77 +764,53 @@ void KeyframeEffectReadOnly::checkForMatchingTransformFunctionLists() > m_transformFunctionListsMatch = true; > } > >-void KeyframeEffectReadOnly::checkForMatchingFilterFunctionLists() >+bool KeyframeEffectReadOnly::checkForMatchingFilterFunctionLists(CSSPropertyID propertyID, const std::function<const FilterOperations& (const RenderStyle&)>& filtersGetter) const > { >- m_filterFunctionListsMatch = false; >- >- if (m_blendingKeyframes.size() < 2 || !m_blendingKeyframes.containsProperty(CSSPropertyFilter)) >- return; >+ if (m_blendingKeyframes.size() < 2 || !m_blendingKeyframes.containsProperty(propertyID)) >+ return false; > > // Empty filters match anything, so find the first non-empty entry as the reference. > size_t numKeyframes = m_blendingKeyframes.size(); >- size_t firstNonEmptyFilterKeyframeIndex = numKeyframes; >+ size_t firstNonEmptyKeyframeIndex = numKeyframes; > > for (size_t i = 0; i < numKeyframes; ++i) { >- if (m_blendingKeyframes[i].style()->filter().operations().size()) { >- firstNonEmptyFilterKeyframeIndex = i; >+ if (filtersGetter(*m_blendingKeyframes[i].style()).operations().size()) { >+ firstNonEmptyKeyframeIndex = i; > break; > } > } > >- if (firstNonEmptyFilterKeyframeIndex == numKeyframes) >- return; >+ if (firstNonEmptyKeyframeIndex == numKeyframes) >+ return false; > >- auto& firstVal = m_blendingKeyframes[firstNonEmptyFilterKeyframeIndex].style()->filter(); >- for (size_t i = firstNonEmptyFilterKeyframeIndex + 1; i < numKeyframes; ++i) { >- auto& value = m_blendingKeyframes[i].style()->filter(); >+ auto& firstVal = filtersGetter(*m_blendingKeyframes[firstNonEmptyKeyframeIndex].style()); >+ for (size_t i = firstNonEmptyKeyframeIndex + 1; i < numKeyframes; ++i) { >+ auto& value = filtersGetter(*m_blendingKeyframes[i].style()); > > // An empty filter list matches anything. > if (value.operations().isEmpty()) > continue; > > if (!firstVal.operationsMatch(value)) >- return; >+ return false; > } > >- m_filterFunctionListsMatch = true; >+ return true; >+} >+ >+void KeyframeEffectReadOnly::checkForMatchingFilterFunctionLists() >+{ >+ m_filterFunctionListsMatch = checkForMatchingFilterFunctionLists(CSSPropertyFilter, [] (const RenderStyle& style) -> const FilterOperations& { >+ return style.filter(); >+ }); > } > > #if ENABLE(FILTERS_LEVEL_2) > void KeyframeEffectReadOnly::checkForMatchingBackdropFilterFunctionLists() > { >- m_backdropFilterFunctionListsMatch = false; >- >- if (m_blendingKeyframes.size() < 2 || !m_blendingKeyframes.containsProperty(CSSPropertyWebkitBackdropFilter)) >- return; >- >- // Empty filters match anything, so find the first non-empty entry as the reference. >- size_t numKeyframes = m_blendingKeyframes.size(); >- size_t firstNonEmptyFilterKeyframeIndex = numKeyframes; >- >- for (size_t i = 0; i < numKeyframes; ++i) { >- if (m_blendingKeyframes[i].style()->backdropFilter().operations().size()) { >- firstNonEmptyFilterKeyframeIndex = i; >- break; >- } >- } >- >- if (firstNonEmptyFilterKeyframeIndex == numKeyframes) >- return; >- >- auto& firstVal = m_blendingKeyframes[firstNonEmptyFilterKeyframeIndex].style()->backdropFilter(); >- for (size_t i = firstNonEmptyFilterKeyframeIndex + 1; i < numKeyframes; ++i) { >- auto& value = m_blendingKeyframes[i].style()->backdropFilter(); >- >- // An empty filter list matches anything. >- if (value.operations().isEmpty()) >- continue; >- >- if (!firstVal.operationsMatch(value)) >- return; >- } >- >- m_backdropFilterFunctionListsMatch = true; >+ m_backdropFilterFunctionListsMatch = checkForMatchingFilterFunctionLists(CSSPropertyWebkitBackdropFilter, [] (const RenderStyle& style) -> const FilterOperations& { >+ return style.backdropFilter(); >+ }); > } > #endif > >diff --git a/Source/WebCore/animation/KeyframeEffectReadOnly.h b/Source/WebCore/animation/KeyframeEffectReadOnly.h >index ce4404061613f2a6d61d9c6267fe08d0bc5296a1..59d222938b23fc9639612397fa78ece50a3c3e8f 100644 >--- a/Source/WebCore/animation/KeyframeEffectReadOnly.h >+++ b/Source/WebCore/animation/KeyframeEffectReadOnly.h >@@ -150,6 +150,8 @@ private: > void checkForMatchingBackdropFilterFunctionLists(); > #endif > >+ bool checkForMatchingFilterFunctionLists(CSSPropertyID, const std::function<const FilterOperations& (const RenderStyle&)>&) const; >+ > bool m_shouldRunAccelerated { false }; > bool m_needsForcedLayout { false }; > bool m_triggersStackingContext { false };
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185087
: 339018 |
349173
|
349392
|
349552