Move -webkit-tap-highlight-color / -webkit-overflow-scrolling / -webkit-touch-callout...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Jan 2015 07:55:44 +0000 (07:55 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Jan 2015 07:55:44 +0000 (07:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=140219

Reviewed by Darin Adler.

Move -webkit-tap-highlight-color / -webkit-overflow-scrolling /
-webkit-touch-callout to the new StyleBuilder.

* css/CSSGradientValue.cpp:
(WebCore::CSSGradientValue::gradientWithStylesResolved):
* css/CSSPropertyNames.in:
* css/SVGCSSStyleSelector.cpp:
(WebCore::StyleResolver::applySVGProperty):
* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertTouchCallout):
(WebCore::StyleBuilderConverter::convertTapHighlightColor):
(WebCore::StyleBuilderConverter::convertOverflowScrolling):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::applyProperty):
(WebCore::StyleResolver::colorFromPrimitiveValueIsDerivedFromElement):
(WebCore::StyleResolver::colorFromPrimitiveValue):
(WebCore::StyleResolver::createFilterOperations):
* css/StyleResolver.h:

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

Source/WebCore/ChangeLog
Source/WebCore/css/CSSGradientValue.cpp
Source/WebCore/css/CSSPropertyNames.in
Source/WebCore/css/SVGCSSStyleSelector.cpp
Source/WebCore/css/StyleBuilderConverter.h
Source/WebCore/css/StyleBuilderCustom.h
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/css/StyleResolver.h
Source/WebCore/css/makeprop.pl

index 7dee6d9..c6aa7f6 100644 (file)
@@ -1,3 +1,29 @@
+2015-01-07  Chris Dumez  <cdumez@apple.com>
+
+        Move -webkit-tap-highlight-color / -webkit-overflow-scrolling / -webkit-touch-callout to the new StyleBuilder
+        https://bugs.webkit.org/show_bug.cgi?id=140219
+
+        Reviewed by Darin Adler.
+
+        Move -webkit-tap-highlight-color / -webkit-overflow-scrolling /
+        -webkit-touch-callout to the new StyleBuilder.
+
+        * css/CSSGradientValue.cpp:
+        (WebCore::CSSGradientValue::gradientWithStylesResolved):
+        * css/CSSPropertyNames.in:
+        * css/SVGCSSStyleSelector.cpp:
+        (WebCore::StyleResolver::applySVGProperty):
+        * css/StyleBuilderConverter.h:
+        (WebCore::StyleBuilderConverter::convertTouchCallout):
+        (WebCore::StyleBuilderConverter::convertTapHighlightColor):
+        (WebCore::StyleBuilderConverter::convertOverflowScrolling):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::applyProperty):
+        (WebCore::StyleResolver::colorFromPrimitiveValueIsDerivedFromElement):
+        (WebCore::StyleResolver::colorFromPrimitiveValue):
+        (WebCore::StyleResolver::createFilterOperations):
+        * css/StyleResolver.h:
+
 2015-01-07  Brian J. Burg  <burg@cs.washington.edu>
 
         Web Inspector: Editing Inline Styles Not Working
index 3026759..5b431ef 100644 (file)
@@ -108,7 +108,7 @@ PassRefPtr<CSSGradientValue> CSSGradientValue::gradientWithStylesResolved(StyleR
 {
     bool derived = false;
     for (auto& stop : m_stops) {
-        if (!stop.isMidpoint && styleResolver->colorFromPrimitiveValueIsDerivedFromElement(stop.m_color.get())) {
+        if (!stop.isMidpoint && styleResolver->colorFromPrimitiveValueIsDerivedFromElement(*stop.m_color)) {
             stop.m_colorIsDerivedFromElement = true;
             derived = true;
             break;
@@ -129,7 +129,7 @@ PassRefPtr<CSSGradientValue> CSSGradientValue::gradientWithStylesResolved(StyleR
 
     for (auto& stop : result->m_stops) {
         if (!stop.isMidpoint)
-            stop.m_resolvedColor = styleResolver->colorFromPrimitiveValue(stop.m_color.get());
+            stop.m_resolvedColor = styleResolver->colorFromPrimitiveValue(*stop.m_color);
     }
 
     return result.release();
index 6be1770..c6c91f3 100644 (file)
@@ -579,14 +579,14 @@ orientation [LegacyStyleBuilder]
 user-zoom [LegacyStyleBuilder]
 #endif
 #if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS
--webkit-tap-highlight-color [Inherited, LegacyStyleBuilder]
+-webkit-tap-highlight-color [Inherited, Converter=TapHighlightColor]
 #endif
 #if defined(ENABLE_DASHBOARD_SUPPORT) && ENABLE_DASHBOARD_SUPPORT
 -webkit-dashboard-region [NameForMethods=DashboardRegions, Custom=Value]
 #endif
 #if defined(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) && ENABLE_ACCELERATED_OVERFLOW_SCROLLING
--webkit-overflow-scrolling [Inherited, LegacyStyleBuilder]
+-webkit-overflow-scrolling [Inherited, NameForMethods=UseTouchOverflowScrolling, Converter=OverflowScrolling]
 #endif
 #if defined(WTF_PLATFORM_IOS) && WTF_PLATFORM_IOS
--webkit-touch-callout [Inherited, LegacyStyleBuilder]
+-webkit-touch-callout [Inherited, NameForMethods=TouchCalloutEnabled, Converter=TouchCallout]
 #endif
index 6854945..319f530 100644 (file)
@@ -587,7 +587,7 @@ void StyleResolver::applySVGProperty(CSSPropertyID id, CSSValue* value)
             int blur = item.blur ? item.blur->computeLength<int>(state.cssToLengthConversionData().copyWithAdjustedZoom(1.0f)) : 0;
             Color color;
             if (item.color)
-                color = colorFromPrimitiveValue(item.color.get());
+                color = colorFromPrimitiveValue(*item.color);
 
             // -webkit-svg-shadow does should not have a spread or style
             ASSERT(!item.spread);
index 18320f2..5489cc8 100644 (file)
@@ -101,6 +101,15 @@ public:
     static bool convertMarqueeIncrement(StyleResolver&, CSSValue&, Length&);
     static bool convertFilterOperations(StyleResolver&, CSSValue&, FilterOperations&);
     static bool convertMaskImageOperations(StyleResolver&, CSSValue&, Vector<RefPtr<MaskImageOperation>>&);
+#if PLATFORM(IOS)
+    static bool convertTouchCallout(StyleResolver&, CSSValue&);
+#endif
+#if ENABLE(TOUCH_EVENTS)
+    static Color convertTapHighlightColor(StyleResolver&, CSSValue&);
+#endif
+#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
+    static bool convertOverflowScrolling(StyleResolver&, CSSValue&);
+#endif
 
 private:
     friend class StyleBuilderCustom;
@@ -1046,6 +1055,27 @@ inline bool StyleBuilderConverter::convertMaskImageOperations(StyleResolver& sty
     return true;
 }
 
+#if PLATFORM(IOS)
+inline bool StyleBuilderConverter::convertTouchCallout(StyleResolver&, CSSValue& value)
+{
+    return !equalIgnoringCase(downcast<CSSPrimitiveValue>(value).getStringValue(), "none");
+}
+#endif
+
+#if ENABLE(TOUCH_EVENTS)
+inline Color StyleBuilderConverter::convertTapHighlightColor(StyleResolver& styleResolver, CSSValue& value)
+{
+    return styleResolver.colorFromPrimitiveValue(downcast<CSSPrimitiveValue>(value));
+}
+#endif
+
+#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
+inline bool StyleBuilderConverter::convertOverflowScrolling(StyleResolver&, CSSValue& value)
+{
+    return downcast<CSSPrimitiveValue>(value).getValueID() == CSSValueTouch;
+}
+#endif
+
 } // namespace WebCore
 
 #endif // StyleBuilderConverter_h
index 0bfc0f7..a57c0c8 100644 (file)
@@ -794,7 +794,7 @@ inline void StyleBuilderCustom::applyTextOrBoxShadowValue(StyleResolver& styleRe
         ShadowStyle shadowStyle = shadowValue.style && shadowValue.style->getValueID() == CSSValueInset ? Inset : Normal;
         Color color;
         if (shadowValue.color)
-            color = styleResolver.colorFromPrimitiveValue(shadowValue.color.get());
+            color = styleResolver.colorFromPrimitiveValue(*shadowValue.color);
         else
             color = styleResolver.style()->color();
         auto shadowData = std::make_unique<ShadowData>(IntPoint(x, y), blur, spread, shadowStyle, id == CSSPropertyWebkitBoxShadow, color.isValid() ? color : Color::transparent);
index 4f27e9f..4cf3077 100644 (file)
@@ -2031,36 +2031,6 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
         return;
     case CSSPropertyUnicodeRange: // Only used in @font-face rules.
         return;
-#if PLATFORM(IOS)
-    case CSSPropertyWebkitTouchCallout: {
-        HANDLE_INHERIT_AND_INITIAL(touchCalloutEnabled, TouchCalloutEnabled);
-        if (!primitiveValue)
-            break;
-
-        state.style()->setTouchCalloutEnabled(primitiveValue->getStringValue().lower() != "none");
-        return;
-    }
-#endif
-#if ENABLE(TOUCH_EVENTS)
-    case CSSPropertyWebkitTapHighlightColor: {
-        HANDLE_INHERIT_AND_INITIAL(tapHighlightColor, TapHighlightColor);
-        if (!primitiveValue)
-            break;
-
-        Color col = colorFromPrimitiveValue(primitiveValue);
-        state.style()->setTapHighlightColor(col);
-        return;
-    }
-#endif
-#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
-    case CSSPropertyWebkitOverflowScrolling: {
-        HANDLE_INHERIT_AND_INITIAL(useTouchOverflowScrolling, UseTouchOverflowScrolling);
-        if (!primitiveValue)
-            break;
-        state.style()->setUseTouchOverflowScrolling(primitiveValue->getValueID() == CSSValueTouch);
-        return;
-    }
-#endif
     case CSSPropertyInvalid:
         return;
     case CSSPropertyFontStretch:
@@ -2295,6 +2265,15 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
 #if ENABLE(CURSOR_VISIBILITY)
     case CSSPropertyWebkitCursorVisibility:
 #endif
+#if PLATFORM(IOS)
+    case CSSPropertyWebkitTouchCallout:
+#endif
+#if ENABLE(TOUCH_EVENTS)
+    case CSSPropertyWebkitTapHighlightColor:
+#endif
+#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
+    case CSSPropertyWebkitOverflowScrolling:
+#endif
     case CSSPropertyAlignContent:
     case CSSPropertyAlignItems:
     case CSSPropertyAlignSelf:
@@ -2617,9 +2596,9 @@ static Color colorForCSSValue(CSSValueID cssValueId)
     return RenderTheme::defaultTheme()->systemColor(cssValueId);
 }
 
-bool StyleResolver::colorFromPrimitiveValueIsDerivedFromElement(CSSPrimitiveValue* value)
+bool StyleResolver::colorFromPrimitiveValueIsDerivedFromElement(CSSPrimitiveValue& value)
 {
-    int ident = value->getValueID();
+    int ident = value.getValueID();
     switch (ident) {
     case CSSValueWebkitText:
     case CSSValueWebkitLink:
@@ -2631,13 +2610,13 @@ bool StyleResolver::colorFromPrimitiveValueIsDerivedFromElement(CSSPrimitiveValu
     }
 }
 
-Color StyleResolver::colorFromPrimitiveValue(CSSPrimitiveValue* value, bool forVisitedLink) const
+Color StyleResolver::colorFromPrimitiveValue(CSSPrimitiveValue& value, bool forVisitedLink) const
 {
-    if (value->isRGBColor())
-        return Color(value->getRGBA32Value());
+    if (value.isRGBColor())
+        return Color(value.getRGBA32Value());
 
     const State& state = m_state;
-    CSSValueID ident = value->getValueID();
+    CSSValueID ident = value.getValueID();
     switch (ident) {
     case 0:
         return Color();
@@ -2856,7 +2835,7 @@ bool StyleResolver::createFilterOperations(CSSValue& inValue, FilterOperations&
             int blur = item.blur ? item.blur->computeLength<int>(state.cssToLengthConversionData()) : 0;
             Color color;
             if (item.color)
-                color = colorFromPrimitiveValue(item.color.get());
+                color = colorFromPrimitiveValue(*item.color);
 
             operations.operations().append(DropShadowFilterOperation::create(location, blur, color.isValid() ? color : Color::transparent));
             break;
index 68c44db..51c9d9e 100644 (file)
@@ -209,8 +209,8 @@ public:
     bool useSVGZoomRules();
     bool useSVGZoomRulesForLength();
 
-    static bool colorFromPrimitiveValueIsDerivedFromElement(CSSPrimitiveValue*);
-    Color colorFromPrimitiveValue(CSSPrimitiveValue*, bool forVisitedLink = false) const;
+    static bool colorFromPrimitiveValueIsDerivedFromElement(CSSPrimitiveValue&);
+    Color colorFromPrimitiveValue(CSSPrimitiveValue&, bool forVisitedLink = false) const;
 
     bool hasSelectorForId(const AtomicString&) const;
     bool hasSelectorForClass(const AtomicString&) const;
index 60d6804..178677d 100755 (executable)
@@ -484,7 +484,7 @@ sub colorFromPrimitiveValue {
   my $primitiveValue = shift;
   my $forVisitedLink = @_ ? shift : NOT_FOR_VISITED_LINK;
 
-  return "styleResolver.colorFromPrimitiveValue(&" . $primitiveValue . ", /* forVisitedLink */ " . ($forVisitedLink ? "true" : "false") . ")";
+  return "styleResolver.colorFromPrimitiveValue(" . $primitiveValue . ", /* forVisitedLink */ " . ($forVisitedLink ? "true" : "false") . ")";
 }
 
 use constant {