Title: [176571] trunk/Source/WebCore
Revision
176571
Author
[email protected]
Date
2014-11-28 22:20:25 -0800 (Fri, 28 Nov 2014)

Log Message

Move the '-webkit-initial-letter', '-webkit-line-box-contain' and '-webkit-text-stroke-width' CSS properties to the new StyleBuilder
https://bugs.webkit.org/show_bug.cgi?id=139053

Patch by Sam Weinig <[email protected]> on 2014-11-28
Reviewed by Andreas Kling.

* css/CSSPropertyNames.in:
* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertInitialLetter):
(WebCore::StyleBuilderConverter::convertTextStrokeWidth):
(WebCore::StyleBuilderConverter::convertLineBoxContain):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::applyProperty):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (176570 => 176571)


--- trunk/Source/WebCore/ChangeLog	2014-11-28 22:10:24 UTC (rev 176570)
+++ trunk/Source/WebCore/ChangeLog	2014-11-29 06:20:25 UTC (rev 176571)
@@ -1,3 +1,18 @@
+2014-11-28  Sam Weinig  <[email protected]>
+
+        Move the '-webkit-initial-letter', '-webkit-line-box-contain' and '-webkit-text-stroke-width' CSS properties to the new StyleBuilder
+        https://bugs.webkit.org/show_bug.cgi?id=139053
+
+        Reviewed by Andreas Kling.
+
+        * css/CSSPropertyNames.in:
+        * css/StyleBuilderConverter.h:
+        (WebCore::StyleBuilderConverter::convertInitialLetter):
+        (WebCore::StyleBuilderConverter::convertTextStrokeWidth):
+        (WebCore::StyleBuilderConverter::convertLineBoxContain):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::applyProperty):
+
 2014-11-26  Philippe Normand  <[email protected]>
 
         [GStreamer] HTTP source element lacks SCHEDULING query support

Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (176570 => 176571)


--- trunk/Source/WebCore/css/CSSPropertyNames.in	2014-11-28 22:10:24 UTC (rev 176570)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in	2014-11-29 06:20:25 UTC (rev 176571)
@@ -412,8 +412,8 @@
 -webkit-hyphenate-limit-lines [Inherited, NameForMethods=HyphenationLimitLines, Converter=WebkitHyphenateLimitLines]
 -webkit-hyphens [Inherited, TypeName=Hyphens]
 -epub-hyphens = -webkit-hyphens
--webkit-initial-letter [LegacyStyleBuilder]
--webkit-line-box-contain [Inherited, LegacyStyleBuilder]
+-webkit-initial-letter [Converter=InitialLetter]
+-webkit-line-box-contain [Inherited, Converter=LineBoxContain]
 -webkit-line-align [Inherited, TypeName=LineAlign]
 -webkit-line-break [Inherited, TypeName=LineBreak]
 -webkit-line-clamp [TypeName=LineClampValue]
@@ -507,7 +507,7 @@
 -webkit-text-security [Inherited]
 -webkit-text-stroke [Inherited, LegacyStyleBuilder]
 -webkit-text-stroke-color [Inherited, LegacyStyleBuilder]
--webkit-text-stroke-width [Inherited, LegacyStyleBuilder]
+-webkit-text-stroke-width [Inherited, Converter=TextStrokeWidth]
 -webkit-transform [Converter=Transform]
 -webkit-transform-origin [LegacyStyleBuilder]
 -webkit-transform-origin-x [Converter=Length]

Modified: trunk/Source/WebCore/css/StyleBuilderConverter.h (176570 => 176571)


--- trunk/Source/WebCore/css/StyleBuilderConverter.h	2014-11-28 22:10:24 UTC (rev 176570)
+++ trunk/Source/WebCore/css/StyleBuilderConverter.h	2014-11-29 06:20:25 UTC (rev 176571)
@@ -70,6 +70,9 @@
     static PassRefPtr<QuotesData> convertQuotes(StyleResolver&, CSSValue&);
     static TextUnderlinePosition convertTextUnderlinePosition(StyleResolver&, CSSValue&);
     static PassRefPtr<StyleReflection> convertReflection(StyleResolver&, CSSValue&);
+    static IntSize convertInitialLetter(StyleResolver&, CSSValue&);
+    static float convertTextStrokeWidth(StyleResolver&, CSSValue&);
+    static LineBoxContain convertLineBoxContain(StyleResolver&, CSSValue&);
 
 private:
     static Length convertToRadiusLength(CSSToLengthConversionData&, CSSPrimitiveValue&);
@@ -494,6 +497,62 @@
     return reflection.release();
 }
 
+inline IntSize StyleBuilderConverter::convertInitialLetter(StyleResolver&, CSSValue& value)
+{
+    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
+
+    if (primitiveValue.getValueID() == CSSValueNormal)
+        return IntSize();
+
+    Pair* pair = primitiveValue.getPairValue();
+    ASSERT(pair);
+    ASSERT(pair->first());
+    ASSERT(pair->second());
+
+    return IntSize(pair->first()->getIntValue(), pair->second()->getIntValue());
+}
+
+inline float StyleBuilderConverter::convertTextStrokeWidth(StyleResolver& styleResolver, CSSValue& value)
+{
+    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
+
+    float width = 0;
+    switch (primitiveValue.getValueID()) {
+    case CSSValueThin:
+    case CSSValueMedium:
+    case CSSValueThick: {
+        double result = 1.0 / 48;
+        if (primitiveValue.getValueID() == CSSValueMedium)
+            result *= 3;
+        else if (primitiveValue.getValueID() == CSSValueThick)
+            result *= 5;
+        Ref<CSSPrimitiveValue> emsValue(CSSPrimitiveValue::create(result, CSSPrimitiveValue::CSS_EMS));
+        width = convertComputedLength<float>(styleResolver, emsValue);
+        break;
+    }
+    case CSSValueInvalid: {
+        width = convertComputedLength<float>(styleResolver, primitiveValue);
+        break;
+    }
+    default:
+        ASSERT_NOT_REACHED();
+        return 0;
+    }
+
+    return width;
+}
+
+inline LineBoxContain StyleBuilderConverter::convertLineBoxContain(StyleResolver&, CSSValue& value)
+{
+    if (is<CSSPrimitiveValue>(value)) {
+        ASSERT(downcast<CSSPrimitiveValue>(value).getValueID() == CSSValueNone);
+        return LineBoxContainNone;
+    }
+
+    return downcast<CSSLineBoxContainValue>(value).value();
+}
+
+
 } // namespace WebCore
 
 #endif // StyleBuilderConverter_h

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (176570 => 176571)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2014-11-28 22:10:24 UTC (rev 176570)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2014-11-29 06:20:25 UTC (rev 176571)
@@ -2489,29 +2489,6 @@
         return;
     }
 #endif
-    case CSSPropertyWebkitTextStrokeWidth: {
-        HANDLE_INHERIT_AND_INITIAL(textStrokeWidth, TextStrokeWidth)
-        float width = 0;
-        switch (primitiveValue->getValueID()) {
-        case CSSValueThin:
-        case CSSValueMedium:
-        case CSSValueThick: {
-            double result = 1.0 / 48;
-            if (primitiveValue->getValueID() == CSSValueMedium)
-                result *= 3;
-            else if (primitiveValue->getValueID() == CSSValueThick)
-                result *= 5;
-            Ref<CSSPrimitiveValue> value(CSSPrimitiveValue::create(result, CSSPrimitiveValue::CSS_EMS));
-            width = value.get().computeLength<float>(state.cssToLengthConversionData());
-            break;
-        }
-        default:
-            width = primitiveValue->computeLength<float>(state.cssToLengthConversionData());
-            break;
-        }
-        state.style()->setTextStrokeWidth(width);
-        return;
-    }
     case CSSPropertyWebkitPerspective: {
         HANDLE_INHERIT_AND_INITIAL(perspective, Perspective)
 
@@ -2612,20 +2589,6 @@
         return;
     }
 
-    case CSSPropertyWebkitLineBoxContain: {
-        HANDLE_INHERIT_AND_INITIAL(lineBoxContain, LineBoxContain)
-        if (primitiveValue && primitiveValue->getValueID() == CSSValueNone) {
-            state.style()->setLineBoxContain(LineBoxContainNone);
-            return;
-        }
-
-        if (!is<CSSLineBoxContainValue>(*value))
-            return;
-
-        state.style()->setLineBoxContain(downcast<CSSLineBoxContainValue>(*value).value());
-        return;
-    }
-
     // CSS Fonts Module Level 3
     case CSSPropertyWebkitFontFeatureSettings: {
         if (primitiveValue && primitiveValue->getValueID() == CSSValueNormal) {
@@ -2887,24 +2850,6 @@
         return;
     }
 #endif
-
-    case CSSPropertyWebkitInitialLetter: {
-        HANDLE_INHERIT_AND_INITIAL(initialLetter, InitialLetter)
-        if (!value->isPrimitiveValue())
-            return;
-        
-        if (primitiveValue->getValueID() == CSSValueNormal) {
-            state.style()->setInitialLetter(IntSize());
-            return;
-        }
-            
-        Pair* pair = primitiveValue->getPairValue();
-        if (!pair || !pair->first() || !pair->second())
-            return;
-
-        state.style()->setInitialLetter(IntSize(pair->first()->getIntValue(), pair->second()->getIntValue()));
-        return;
-    }
     
     // These properties are aliased and DeprecatedStyleBuilder already applied the property on the prefixed version.
     case CSSPropertyAnimationDelay:
@@ -3097,7 +3042,9 @@
     case CSSPropertyWebkitHyphenateLimitBefore:
     case CSSPropertyWebkitHyphenateLimitLines:
     case CSSPropertyWebkitHyphens:
+    case CSSPropertyWebkitInitialLetter:
     case CSSPropertyWebkitLineAlign:
+    case CSSPropertyWebkitLineBoxContain:
     case CSSPropertyWebkitLineBreak:
     case CSSPropertyWebkitLineClamp:
     case CSSPropertyWebkitLineGrid:
@@ -3152,6 +3099,7 @@
     case CSSPropertyWebkitTextFillColor:
     case CSSPropertyWebkitTextSecurity:
     case CSSPropertyWebkitTextStrokeColor:
+    case CSSPropertyWebkitTextStrokeWidth:
     case CSSPropertyWebkitTransformOriginX:
     case CSSPropertyWebkitTransformOriginY:
     case CSSPropertyWebkitTransformOriginZ:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to