Move '-webkit-filter' / '-webkit-backdrop-filter' to the new StyleBuilder
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Jan 2015 10:25:16 +0000 (10:25 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Jan 2015 10:25:16 +0000 (10:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=140111

Reviewed by Darin Adler.

Move '-webkit-filter' / '-webkit-backdrop-filter' to the new
StyleBuilder.

* css/CSSFilterImageValue.cpp:
(WebCore::CSSFilterImageValue::createFilterOperations):
* css/CSSPropertyNames.in:
* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertFilterOperations):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::applyProperty):
(WebCore::StyleResolver::createFilterOperations):
* css/StyleResolver.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@177953 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/css/CSSFilterImageValue.cpp
Source/WebCore/css/CSSPropertyNames.in
Source/WebCore/css/StyleBuilderConverter.h
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/css/StyleResolver.h

index 2378191..e3b0467 100644 (file)
@@ -1,3 +1,23 @@
+2015-01-06  Chris Dumez  <cdumez@apple.com>
+
+        Move '-webkit-filter' / '-webkit-backdrop-filter' to the new StyleBuilder
+        https://bugs.webkit.org/show_bug.cgi?id=140111
+
+        Reviewed by Darin Adler.
+
+        Move '-webkit-filter' / '-webkit-backdrop-filter' to the new
+        StyleBuilder.
+
+        * css/CSSFilterImageValue.cpp:
+        (WebCore::CSSFilterImageValue::createFilterOperations):
+        * css/CSSPropertyNames.in:
+        * css/StyleBuilderConverter.h:
+        (WebCore::StyleBuilderConverter::convertFilterOperations):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::applyProperty):
+        (WebCore::StyleResolver::createFilterOperations):
+        * css/StyleResolver.h:
+
 2015-01-05  Darin Adler  <darin@apple.com>
 
         Modernize and streamline HTMLToken and AtomicHTMLToken
index 2f986fd..a690abd 100644 (file)
@@ -139,7 +139,8 @@ void CSSFilterImageValue::filterImageChanged(const IntRect&)
 void CSSFilterImageValue::createFilterOperations(StyleResolver* resolver)
 {
     m_filterOperations.clear();
-    resolver->createFilterOperations(m_filterValue.get(), m_filterOperations);
+    if (m_filterValue)
+        resolver->createFilterOperations(*m_filterValue, m_filterOperations);
 }
 
 void CSSFilterImageValue::FilterSubimageObserverProxy::imageChanged(CachedImage*, const IntRect* rect)
index 19305bb..173e966 100644 (file)
@@ -398,7 +398,7 @@ columns [LegacyStyleBuilder]
 mix-blend-mode [TypeName=BlendMode, NameForMethods=BlendMode]
 isolation [TypeName=Isolation]
 #endif
--webkit-filter [LegacyStyleBuilder]
+-webkit-filter [ConditionalConverter=FilterOperations, TypeName=FilterOperations]
 align-content
 -webkit-align-content = align-content
 align-items
@@ -422,7 +422,7 @@ flex-wrap
 justify-content
 -webkit-justify-content = justify-content
 #if defined(ENABLE_FILTERS_LEVEL_2) && ENABLE_FILTERS_LEVEL_2
--webkit-backdrop-filter [LegacyStyleBuilder]
+-webkit-backdrop-filter [ConditionalConverter=FilterOperations, TypeName=FilterOperations]
 #endif
 -webkit-justify-self [Custom=Value]
 -webkit-font-size-delta [LegacyStyleBuilder]
index b5070d5..cc93dd7 100644 (file)
@@ -90,6 +90,7 @@ public:
     static bool convertWordSpacing(StyleResolver&, CSSValue&, Length&);
     static bool convertPerspective(StyleResolver&, CSSValue&, float&);
     static bool convertMarqueeIncrement(StyleResolver&, CSSValue&, Length&);
+    static bool convertFilterOperations(StyleResolver&, CSSValue&, FilterOperations&);
 
 private:
     friend class StyleBuilderCustom;
@@ -924,6 +925,11 @@ inline bool StyleBuilderConverter::convertMarqueeIncrement(StyleResolver& styleR
     return false;
 }
 
+inline bool StyleBuilderConverter::convertFilterOperations(StyleResolver& styleResolver, CSSValue& value, FilterOperations& operations)
+{
+    return styleResolver.createFilterOperations(value, operations);
+}
+
 } // namespace WebCore
 
 #endif // StyleBuilderConverter_h
index 7593fc4..c6f8977 100644 (file)
@@ -2405,24 +2405,6 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
         return;
     }
 
-    case CSSPropertyWebkitFilter: {
-        HANDLE_INHERIT_AND_INITIAL(filter, Filter);
-        FilterOperations operations;
-        if (createFilterOperations(value, operations))
-            state.style()->setFilter(operations);
-        return;
-    }
-
-#if ENABLE(FILTERS_LEVEL_2)
-    case CSSPropertyWebkitBackdropFilter: {
-        HANDLE_INHERIT_AND_INITIAL(backdropFilter, BackdropFilter);
-        FilterOperations operations;
-        if (createFilterOperations(value, operations))
-            state.style()->setBackdropFilter(operations);
-        return;
-    }
-#endif
-
     case CSSPropertyWebkitMaskImage: {
         Vector<RefPtr<MaskImageOperation>> operations;
         if (createMaskImageOperations(value, operations))
@@ -2761,6 +2743,10 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
     case CSSPropertyWebkitGridTemplateAreas:
     case CSSPropertyWebkitGridAutoFlow:
 #endif // ENABLE(CSS_GRID_LAYOUT)
+    case CSSPropertyWebkitFilter:
+#if ENABLE(FILTERS_LEVEL_2)
+    case CSSPropertyWebkitBackdropFilter:
+#endif
         ASSERT_NOT_REACHED();
         return;
     default:
@@ -3068,25 +3054,22 @@ void StyleResolver::loadPendingSVGDocuments()
     }
 }
 
-bool StyleResolver::createFilterOperations(CSSValue* inValue, FilterOperations& outOperations)
+bool StyleResolver::createFilterOperations(CSSValue& inValue, FilterOperations& outOperations)
 {
     State& state = m_state;
     ASSERT(outOperations.isEmpty());
     
-    if (!inValue)
-        return false;
-    
-    if (is<CSSPrimitiveValue>(*inValue)) {
-        CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*inValue);
+    if (is<CSSPrimitiveValue>(inValue)) {
+        CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(inValue);
         if (primitiveValue.getValueID() == CSSValueNone)
             return true;
     }
     
-    if (!is<CSSValueList>(*inValue))
+    if (!is<CSSValueList>(inValue))
         return false;
 
     FilterOperations operations;
-    for (auto& currentValue : downcast<CSSValueList>(*inValue)) {
+    for (auto& currentValue : downcast<CSSValueList>(inValue)) {
         if (!is<WebKitCSSFilterValue>(currentValue.get()))
             continue;
 
index 0d6a577..02ae516 100644 (file)
@@ -236,7 +236,7 @@ public:
 
     void clearCachedPropertiesAffectedByViewportUnits();
 
-    bool createFilterOperations(CSSValue* inValue, FilterOperations& outOperations);
+    bool createFilterOperations(CSSValue& inValue, FilterOperations& outOperations);
     bool createMaskImageOperations(CSSValue* inValue, Vector<RefPtr<MaskImageOperation>>& outOperations);
     void loadPendingSVGDocuments();