Title: [176584] trunk/Source/WebCore
Revision
176584
Author
[email protected]
Date
2014-11-29 16:39:14 -0800 (Sat, 29 Nov 2014)

Log Message

Move the '-webkit-locale', '-webkit-text-orientation', '-webkit-writing-mode', '-webkit-justify-self' and '-webkit-perspective' CSS properties to the new StyleBuilder
https://bugs.webkit.org/show_bug.cgi?id=139104

Patch by Sam Weinig <[email protected]> on 2014-11-29
Reviewed by Anders Carlsson.

* css/CSSPropertyNames.in:
* css/StyleBuilderCustom.h:
(WebCore::StyleBuilderFunctions::applyValueWebkitLocale):
(WebCore::StyleBuilderFunctions::applyValueWebkitWritingMode):
(WebCore::StyleBuilderFunctions::applyValueWebkitTextOrientation):
(WebCore::StyleBuilderFunctions::applyValueWebkitJustifySelf):
(WebCore::StyleBuilderFunctions::applyValueWebkitPerspective):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::applyProperty):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (176583 => 176584)


--- trunk/Source/WebCore/ChangeLog	2014-11-30 00:06:58 UTC (rev 176583)
+++ trunk/Source/WebCore/ChangeLog	2014-11-30 00:39:14 UTC (rev 176584)
@@ -1,3 +1,20 @@
+2014-11-29  Sam Weinig  <[email protected]>
+
+        Move the '-webkit-locale', '-webkit-text-orientation', '-webkit-writing-mode', '-webkit-justify-self' and '-webkit-perspective' CSS properties to the new StyleBuilder
+        https://bugs.webkit.org/show_bug.cgi?id=139104
+
+        Reviewed by Anders Carlsson.
+
+        * css/CSSPropertyNames.in:
+        * css/StyleBuilderCustom.h:
+        (WebCore::StyleBuilderFunctions::applyValueWebkitLocale):
+        (WebCore::StyleBuilderFunctions::applyValueWebkitWritingMode):
+        (WebCore::StyleBuilderFunctions::applyValueWebkitTextOrientation):
+        (WebCore::StyleBuilderFunctions::applyValueWebkitJustifySelf):
+        (WebCore::StyleBuilderFunctions::applyValueWebkitPerspective):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::applyProperty):
+
 2014-11-29  Anders Carlsson  <[email protected]>
 
         Add an EmptyVisitedLinkStore implementation

Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (176583 => 176584)


--- trunk/Source/WebCore/css/CSSPropertyNames.in	2014-11-30 00:06:58 UTC (rev 176583)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in	2014-11-30 00:39:14 UTC (rev 176584)
@@ -69,13 +69,13 @@
 -webkit-font-kerning [Inherited, LegacyStyleBuilder]
 -webkit-font-smoothing [Inherited, LegacyStyleBuilder]
 -webkit-font-variant-ligatures [Inherited, LegacyStyleBuilder]
--webkit-locale [Inherited, LegacyStyleBuilder]
--webkit-text-orientation [Inherited, LegacyStyleBuilder]
+-webkit-locale [Inherited, Custom=Value]
+-webkit-text-orientation [Inherited, Custom=Value]
 -epub-text-orientation = -webkit-text-orientation
 #if defined(ENABLE_IOS_TEXT_AUTOSIZING) && ENABLE_IOS_TEXT_AUTOSIZING
 -webkit-text-size-adjust [Inherited, LegacyStyleBuilder]
 #endif
--webkit-writing-mode [Inherited, LegacyStyleBuilder]
+-webkit-writing-mode [Inherited, Custom=Value]
 -epub-writing-mode = -webkit-writing-mode
 zoom [Custom=All]
 
@@ -387,7 +387,7 @@
 #if defined(ENABLE_FILTERS_LEVEL_2) && ENABLE_FILTERS_LEVEL_2
 -webkit-backdrop-filter [LegacyStyleBuilder]
 #endif
--webkit-justify-self [LegacyStyleBuilder]
+-webkit-justify-self [Custom=Value]
 -webkit-font-size-delta [LegacyStyleBuilder]
 #if defined(ENABLE_CSS_GRID_LAYOUT) && ENABLE_CSS_GRID_LAYOUT
 -webkit-grid [LegacyStyleBuilder]
@@ -466,7 +466,7 @@
 -webkit-padding-before [LegacyStyleBuilder]
 -webkit-padding-end [LegacyStyleBuilder]
 -webkit-padding-start [LegacyStyleBuilder]
--webkit-perspective [LegacyStyleBuilder]
+-webkit-perspective [Custom=Value]
 -webkit-perspective-origin [LegacyStyleBuilder]
 -webkit-perspective-origin-x [Converter=Length]
 -webkit-perspective-origin-y [Converter=Length]

Modified: trunk/Source/WebCore/css/StyleBuilderCustom.h (176583 => 176584)


--- trunk/Source/WebCore/css/StyleBuilderCustom.h	2014-11-30 00:06:58 UTC (rev 176583)
+++ trunk/Source/WebCore/css/StyleBuilderCustom.h	2014-11-30 00:39:14 UTC (rev 176584)
@@ -32,6 +32,7 @@
 #include "CSSImageSetValue.h"
 #include "CSSImageValue.h"
 #include "Frame.h"
+#include "LocaleToScriptMapping.h"
 #include "Rect.h"
 #include "StyleResolver.h"
 
@@ -647,6 +648,71 @@
     }
 }
 
+inline void applyValueWebkitLocale(StyleResolver& styleResolver, CSSValue& value)
+{
+    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
+
+    if (primitiveValue.getValueID() == CSSValueAuto)
+        styleResolver.style()->setLocale(nullAtom);
+    else
+        styleResolver.style()->setLocale(primitiveValue.getStringValue());
+    
+    FontDescription fontDescription = styleResolver.style()->fontDescription();
+    fontDescription.setScript(localeToScriptCodeForFontSelection(styleResolver.style()->locale()));
+    styleResolver.setFontDescription(fontDescription);
+}
+
+inline void applyValueWebkitWritingMode(StyleResolver& styleResolver, CSSValue& value)
+{
+    styleResolver.setWritingMode(downcast<CSSPrimitiveValue>(value));
+
+    // FIXME: It is not ok to modify document state while applying style.
+    auto& state = styleResolver.state();
+    if (state.element() && state.element() == state.document().documentElement())
+        state.document().setWritingModeSetOnDocumentElement(true);
+}
+
+inline void applyValueWebkitTextOrientation(StyleResolver& styleResolver, CSSValue& value)
+{
+    styleResolver.setTextOrientation(downcast<CSSPrimitiveValue>(value));
+}
+
+inline void applyValueWebkitJustifySelf(StyleResolver& styleResolver, CSSValue& value)
+{
+    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
+
+    if (Pair* pairValue = primitiveValue.getPairValue()) {
+        styleResolver.style()->setJustifySelf(*pairValue->first());
+        styleResolver.style()->setJustifySelfOverflowAlignment(*pairValue->second());
+    } else
+        styleResolver.style()->setJustifySelf(primitiveValue);
+}
+
+inline void applyValueWebkitPerspective(StyleResolver& styleResolver, CSSValue& value)
+{
+    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
+
+    if (primitiveValue.getValueID() == CSSValueNone) {
+        styleResolver.style()->setPerspective(0);
+        return;
+    }
+
+    float perspectiveValue;
+    if (primitiveValue.isLength())
+        perspectiveValue = primitiveValue.computeLength<float>(styleResolver.state().cssToLengthConversionData());
+    else if (primitiveValue.isNumber()) {
+        // For backward compatibility, treat valueless numbers as px.
+        Ref<CSSPrimitiveValue> value(CSSPrimitiveValue::create(primitiveValue.getDoubleValue(), CSSPrimitiveValue::CSS_PX));
+        perspectiveValue = value.get().computeLength<float>(styleResolver.state().cssToLengthConversionData());
+    } else {
+        ASSERT_NOT_REACHED();
+        return;
+    }
+
+    if (perspectiveValue >= 0.0f)
+        styleResolver.style()->setPerspective(perspectiveValue);
+}
+
 } // namespace StyleBuilderFunctions
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (176583 => 176584)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2014-11-30 00:06:58 UTC (rev 176583)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2014-11-30 00:39:14 UTC (rev 176584)
@@ -2415,19 +2415,6 @@
         return;
     case CSSPropertyUnicodeRange: // Only used in @font-face rules.
         return;
-    case CSSPropertyWebkitLocale: {
-        HANDLE_INHERIT_AND_INITIAL(locale, Locale);
-        if (!primitiveValue)
-            return;
-        if (primitiveValue->getValueID() == CSSValueAuto)
-            state.style()->setLocale(nullAtom);
-        else
-            state.style()->setLocale(primitiveValue->getStringValue());
-        FontDescription fontDescription = state.style()->fontDescription();
-        fontDescription.setScript(localeToScriptCodeForFontSelection(state.style()->locale()));
-        setFontDescription(fontDescription);
-        return;
-    }
 #if ENABLE(IOS_TEXT_AUTOSIZING)
     case CSSPropertyWebkitTextSizeAdjust: {
         HANDLE_INHERIT_AND_INITIAL(textSizeAdjust, TextSizeAdjust)
@@ -2489,31 +2476,6 @@
         return;
     }
 #endif
-    case CSSPropertyWebkitPerspective: {
-        HANDLE_INHERIT_AND_INITIAL(perspective, Perspective)
-
-        if (!primitiveValue)
-            return;
-
-        if (primitiveValue->getValueID() == CSSValueNone) {
-            state.style()->setPerspective(0);
-            return;
-        }
-
-        float perspectiveValue;
-        if (primitiveValue->isLength())
-            perspectiveValue = primitiveValue->computeLength<float>(state.cssToLengthConversionData());
-        else if (primitiveValue->isNumber()) {
-            // For backward compatibility, treat valueless numbers as px.
-            Ref<CSSPrimitiveValue> value(CSSPrimitiveValue::create(primitiveValue->getDoubleValue(), CSSPrimitiveValue::CSS_PX));
-            perspectiveValue = value.get().computeLength<float>(state.cssToLengthConversionData());
-        } else
-            return;
-
-        if (perspectiveValue >= 0.0f)
-            state.style()->setPerspective(perspectiveValue);
-        return;
-    }
 #if PLATFORM(IOS)
     case CSSPropertyWebkitTouchCallout: {
         HANDLE_INHERIT_AND_INITIAL(touchCalloutEnabled, TouchCalloutEnabled);
@@ -2567,28 +2529,6 @@
     case CSSPropertyWebkitTextDecorationsInEffect:
         return;
 
-    // CSS Text Layout Module Level 3: Vertical writing support
-    case CSSPropertyWebkitWritingMode: {
-        HANDLE_INHERIT_AND_INITIAL(writingMode, WritingMode);
-        
-        if (primitiveValue)
-            setWritingMode(*primitiveValue);
-
-        // FIXME: It is not ok to modify document state while applying style.
-        if (state.element() && state.element() == state.document().documentElement())
-            state.document().setWritingModeSetOnDocumentElement(true);
-        return;
-    }
-
-    case CSSPropertyWebkitTextOrientation: {
-        HANDLE_INHERIT_AND_INITIAL(textOrientation, TextOrientation);
-
-        if (primitiveValue)
-            setTextOrientation(*primitiveValue);
-
-        return;
-    }
-
     // CSS Fonts Module Level 3
     case CSSPropertyWebkitFontFeatureSettings: {
         if (primitiveValue && primitiveValue->getValueID() == CSSValueNormal) {
@@ -2809,16 +2749,6 @@
         return;
     }
 #endif /* ENABLE(CSS_GRID_LAYOUT) */
-
-    case CSSPropertyWebkitJustifySelf:
-        HANDLE_INHERIT_AND_INITIAL(justifySelf, JustifySelf);
-        if (Pair* pairValue = primitiveValue->getPairValue()) {
-            state.style()->setJustifySelf(*pairValue->first());
-            state.style()->setJustifySelfOverflowAlignment(*pairValue->second());
-        } else
-            state.style()->setJustifySelf(*primitiveValue);
-        return;
-
 #if ENABLE(CSS_SCROLL_SNAP)
     case CSSPropertyWebkitScrollSnapType:
         HANDLE_INHERIT_AND_INITIAL(scrollSnapType, ScrollSnapType);
@@ -3009,6 +2939,10 @@
     case CSSPropertyWebkitColumnBreakAfter:
     case CSSPropertyWebkitColumnBreakBefore:
     case CSSPropertyWebkitColumnBreakInside:
+    case CSSPropertyWebkitJustifySelf:
+    case CSSPropertyWebkitLocale:
+    case CSSPropertyWebkitTextOrientation:
+    case CSSPropertyWebkitWritingMode:
     case CSSPropertyColumnCount:
     case CSSPropertyColumnGap:
     case CSSPropertyColumnProgression:
@@ -3071,6 +3005,7 @@
     case CSSPropertyWebkitMaskSize:
     case CSSPropertyWebkitMaskSourceType:
     case CSSPropertyWebkitNbspMode:
+    case CSSPropertyWebkitPerspective:
     case CSSPropertyWebkitPerspectiveOrigin:
     case CSSPropertyWebkitPerspectiveOriginX:
     case CSSPropertyWebkitPerspectiveOriginY:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to