Title: [126072] trunk
Revision
126072
Author
[email protected]
Date
2012-08-20 14:34:11 -0700 (Mon, 20 Aug 2012)

Log Message

Replace isolate || bidi-override by isolate-override
https://bugs.webkit.org/show_bug.cgi?id=89746

Reviewed by Levi Weintraub.

Source/WebCore: 

The combination of bidi-isolate and isolate was replaced by a single isolate-override in
http://lists.w3.org/Archives/Public/www-style/2012May/0541.html. The spec. has been updated accordingly:
http://dev.w3.org/csswg/css3-writing-modes/#unicode-bidi

To follow the specification change, added -webkit-isolate-override and removed the support for
isolate || bidi-override, simplifying the CSS parser and serializer.

Test: fast/text/bidi-override-isolate.html

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Removed. We can just new a CSSPrimitiveValue
constructor now.
* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue):
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Added now that unicode-bidi always creates a signle
primitive value instead of a primitive value of css value list.
(WebCore::CSSPrimitiveValue::operator EUnicodeBidi):
* css/CSSValueKeywords.in: Added -webkit-isolate-override
* css/StyleBuilder.cpp:
(WebCore): Removed ApplyPropertyUnicodeBidi since we can use ApplyPropertyDefault now.
(WebCore::StyleBuilder::StyleBuilder): Use ApplyPropertyDefault.
* platform/text/UnicodeBidi.h: Renamed OverrideIsolate to IsolateOverride to match the spec.
(WebCore::isIsolated):
(WebCore::isOverride):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::constructBidiRuns):

LayoutTests: 

Rebaseline test expectations. These tests test the new behavior and new property value -webkit-isolate-override.

* fast/css/unicode-bidi-computed-value-expected.txt:
* fast/css/unicode-bidi-computed-value.html:
* fast/text/bidi-override-isolate.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (126071 => 126072)


--- trunk/LayoutTests/ChangeLog	2012-08-20 21:32:03 UTC (rev 126071)
+++ trunk/LayoutTests/ChangeLog	2012-08-20 21:34:11 UTC (rev 126072)
@@ -1,3 +1,16 @@
+2012-08-20  Ryosuke Niwa  <[email protected]>
+
+        Replace isolate || bidi-override by isolate-override
+        https://bugs.webkit.org/show_bug.cgi?id=89746
+
+        Reviewed by Levi Weintraub.
+
+        Rebaseline test expectations. These tests test the new behavior and new property value -webkit-isolate-override.
+
+        * fast/css/unicode-bidi-computed-value-expected.txt:
+        * fast/css/unicode-bidi-computed-value.html:
+        * fast/text/bidi-override-isolate.html:
+
 2012-08-20  Tony Chang  <[email protected]>
 
         RenderGrid children should always be RenderBoxes

Modified: trunk/LayoutTests/fast/css/unicode-bidi-computed-value-expected.txt (126071 => 126072)


--- trunk/LayoutTests/fast/css/unicode-bidi-computed-value-expected.txt	2012-08-20 21:32:03 UTC (rev 126071)
+++ trunk/LayoutTests/fast/css/unicode-bidi-computed-value-expected.txt	2012-08-20 21:34:11 UTC (rev 126072)
@@ -8,10 +8,11 @@
 PASS styleOf("span", {"style":"unicode-bidi: bad-value;"}).unicodeBidi is "normal"
 PASS styleOf("span", {"style":"unicode-bidi: embed embed;"}).unicodeBidi is "normal"
 PASS styleOf("span", {"style":"unicode-bidi: embed -webkit-plain-text;"}).unicodeBidi is "normal"
-PASS styleOf("span", {"style":"unicode-bidi: bidi-override -webkit-isolate;"}).unicodeBidi is "bidi-override -webkit-isolate"
-PASS styleOf("span", {"style":"unicode-bidi: -webkit-isolate bidi-override;"}).unicodeBidi is "bidi-override -webkit-isolate"
-PASS styleOf("span", {"style":"unicode-bidi: bidi-override -webkit-isolate bidi-override;"}).unicodeBidi is "bidi-override -webkit-isolate"
-PASS styleOf("span", {"style":"unicode-bidi: bidi-override -webkit-isolate -webkit-isolate;"}).unicodeBidi is "bidi-override -webkit-isolate"
+PASS styleOf("span", {"style":"unicode-bidi: bidi-override -webkit-isolate;"}).unicodeBidi is "normal"
+PASS styleOf("span", {"style":"unicode-bidi: -webkit-isolate bidi-override;"}).unicodeBidi is "normal"
+PASS styleOf("span", {"style":"unicode-bidi: -webkit-isolate-override;"}).unicodeBidi is "-webkit-isolate-override"
+PASS styleOf("span", {"style":"unicode-bidi: bidi-override -webkit-isolate bidi-override;"}).unicodeBidi is "normal"
+PASS styleOf("span", {"style":"unicode-bidi: bidi-override -webkit-isolate -webkit-isolate;"}).unicodeBidi is "normal"
 PASS styleOf("span", {"style":"unicode-bidi: bidi-override bad-value;"}).unicodeBidi is "normal"
 PASS styleOf("span", {"style":"unicode-bidi: bidi-override embed;"}).unicodeBidi is "normal"
 

Modified: trunk/LayoutTests/fast/css/unicode-bidi-computed-value.html (126071 => 126072)


--- trunk/LayoutTests/fast/css/unicode-bidi-computed-value.html	2012-08-20 21:32:03 UTC (rev 126071)
+++ trunk/LayoutTests/fast/css/unicode-bidi-computed-value.html	2012-08-20 21:34:11 UTC (rev 126072)
@@ -28,10 +28,11 @@
     ['span', {'style': 'unicode-bidi: bad-value;'}, 'normal'],
     ['span', {'style': 'unicode-bidi: embed embed;'}, 'normal'],
     ['span', {'style': 'unicode-bidi: embed -webkit-plain-text;'}, 'normal'],
-    ['span', {'style': 'unicode-bidi: bidi-override -webkit-isolate;'}, 'bidi-override -webkit-isolate'],
-    ['span', {'style': 'unicode-bidi: -webkit-isolate bidi-override;'}, 'bidi-override -webkit-isolate'],
-    ['span', {'style': 'unicode-bidi: bidi-override -webkit-isolate bidi-override;'}, 'bidi-override -webkit-isolate'],
-    ['span', {'style': 'unicode-bidi: bidi-override -webkit-isolate -webkit-isolate;'}, 'bidi-override -webkit-isolate'],
+    ['span', {'style': 'unicode-bidi: bidi-override -webkit-isolate;'}, 'normal'],
+    ['span', {'style': 'unicode-bidi: -webkit-isolate bidi-override;'}, 'normal'],
+    ['span', {'style': 'unicode-bidi: -webkit-isolate-override;'}, '-webkit-isolate-override'],
+    ['span', {'style': 'unicode-bidi: bidi-override -webkit-isolate bidi-override;'}, 'normal'],
+    ['span', {'style': 'unicode-bidi: bidi-override -webkit-isolate -webkit-isolate;'}, 'normal'],
     ['span', {'style': 'unicode-bidi: bidi-override bad-value;'}, 'normal'],
     ['span', {'style': 'unicode-bidi: bidi-override embed;'}, 'normal'],
 ].forEach(function (test) {

Modified: trunk/LayoutTests/fast/text/bidi-override-isolate.html (126071 => 126072)


--- trunk/LayoutTests/fast/text/bidi-override-isolate.html	2012-08-20 21:32:03 UTC (rev 126071)
+++ trunk/LayoutTests/fast/text/bidi-override-isolate.html	2012-08-20 21:34:11 UTC (rev 126072)
@@ -6,11 +6,11 @@
 <div style="font-size: 3em;">
 <div><span style="direction: rtl; unicode-bidi: -webkit-isolate isolate;">abc</span> 1</div>
 <div><span style="direction: rtl; unicode-bidi: bidi-override;">abc</span> 1</div>
-<div><span style="direction: rtl; unicode-bidi: bidi-override -webkit-isolate; unicode-bidi: bidi-override isolate;">abc</span> 1</div>
-<div><span style="direction: rtl; unicode-bidi: -webkit-isolate bidi-override; unicode-bidi: isolate bidi-override;">abc</span> 1</div>
-<div><span style="direction: rtl; unicode-bidi: bidi-override bidi-override;
+<div><span style="direction: rtl; unicode-bidi: -webkit-isolate-override; unicode-bidi: isolate-override;">abc</span> 1</div>
+<div><span style="direction: rtl; unicode-bidi: -webkit-isolate-override; unicode-bidi: isolate-override;">abc</span> 1</div>
+<div><span style="direction: rtl; unicode-bidi: bidi-override;
 unicode-bidi: -webkit-bad-value -webkit-isolate; unicode-bidi: -bad-value isolate;">abc</span> 1</div>
-<div><span style="direction: rtl; unicode-bidi: -webkit-isolate -webkit-isolate; unicode-bidi: isolate isolate;
+<div><span style="direction: rtl; unicode-bidi: -webkit-isolate; unicode-bidi: isolate;
 unicode-bidi: -bad-value bidi-override;">abc</span> 1</div>
 </div>
 

Modified: trunk/Source/WebCore/ChangeLog (126071 => 126072)


--- trunk/Source/WebCore/ChangeLog	2012-08-20 21:32:03 UTC (rev 126071)
+++ trunk/Source/WebCore/ChangeLog	2012-08-20 21:34:11 UTC (rev 126072)
@@ -1,3 +1,38 @@
+2012-08-20  Ryosuke Niwa  <[email protected]>
+
+        Replace isolate || bidi-override by isolate-override
+        https://bugs.webkit.org/show_bug.cgi?id=89746
+
+        Reviewed by Levi Weintraub.
+
+        The combination of bidi-isolate and isolate was replaced by a single isolate-override in
+        http://lists.w3.org/Archives/Public/www-style/2012May/0541.html. The spec. has been updated accordingly:
+        http://dev.w3.org/csswg/css3-writing-modes/#unicode-bidi
+
+        To follow the specification change, added -webkit-isolate-override and removed the support for
+        isolate || bidi-override, simplifying the CSS parser and serializer.
+
+        Test: fast/text/bidi-override-isolate.html
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Removed. We can just new a CSSPrimitiveValue
+        constructor now.
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseValue):
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Added now that unicode-bidi always creates a signle
+        primitive value instead of a primitive value of css value list.
+        (WebCore::CSSPrimitiveValue::operator EUnicodeBidi):
+        * css/CSSValueKeywords.in: Added -webkit-isolate-override
+        * css/StyleBuilder.cpp:
+        (WebCore): Removed ApplyPropertyUnicodeBidi since we can use ApplyPropertyDefault now.
+        (WebCore::StyleBuilder::StyleBuilder): Use ApplyPropertyDefault.
+        * platform/text/UnicodeBidi.h: Renamed OverrideIsolate to IsolateOverride to match the spec.
+        (WebCore::isIsolated):
+        (WebCore::isOverride):
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::constructBidiRuns):
+
 2012-08-20  Tony Chang  <[email protected]>
 
         RenderGrid children should always be RenderBoxes

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (126071 => 126072)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2012-08-20 21:32:03 UTC (rev 126071)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2012-08-20 21:34:11 UTC (rev 126072)
@@ -1177,31 +1177,6 @@
     return cssValuePool().createValue(family.string(), CSSPrimitiveValue::CSS_STRING);
 }
 
-static PassRefPtr<CSSValue> renderUnicodeBidiFlagsToCSSValue(EUnicodeBidi unicodeBidi)
-{
-    switch (unicodeBidi) {
-    case UBNormal:
-        return cssValuePool().createIdentifierValue(CSSValueNormal);
-    case Embed:
-        return cssValuePool().createIdentifierValue(CSSValueEmbed);
-    case Plaintext:
-        return cssValuePool().createIdentifierValue(CSSValueWebkitPlaintext);
-    case Override:
-        return cssValuePool().createIdentifierValue(CSSValueBidiOverride);
-    case Isolate:
-        return cssValuePool().createIdentifierValue(CSSValueWebkitIsolate);
-    case OverrideIsolate:
-    {
-        RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
-        list->append(cssValuePool().createIdentifierValue(CSSValueBidiOverride));
-        list->append(cssValuePool().createIdentifierValue(CSSValueWebkitIsolate));
-        return list;
-    }
-    }
-    ASSERT_NOT_REACHED();
-    return 0;
-}
-
 static PassRefPtr<CSSValue> renderTextDecorationFlagsToCSSValue(int textDecoration)
 {
     // Blink value is ignored.
@@ -2042,7 +2017,7 @@
         case CSSPropertyTop:
             return getPositionOffsetValue(style.get(), CSSPropertyTop, m_node->document()->renderView());
         case CSSPropertyUnicodeBidi:
-            return renderUnicodeBidiFlagsToCSSValue(style->unicodeBidi());
+            return cssValuePool().createValue(style->unicodeBidi());
         case CSSPropertyVerticalAlign:
             switch (style->verticalAlign()) {
                 case BASELINE:

Modified: trunk/Source/WebCore/css/CSSParser.cpp (126071 => 126072)


--- trunk/Source/WebCore/css/CSSParser.cpp	2012-08-20 21:32:03 UTC (rev 126071)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2012-08-20 21:34:11 UTC (rev 126072)
@@ -1719,30 +1719,14 @@
         else
             return parseQuotes(propId, important);
         break;
-    case CSSPropertyUnicodeBidi: // normal | embed | (bidi-override || isolate) | plaintext | inherit
+    case CSSPropertyUnicodeBidi: // normal | embed | bidi-override | isolate | isolate-override | plaintext | inherit
         if (id == CSSValueNormal
             || id == CSSValueEmbed
+            || id == CSSValueBidiOverride
+            || id == CSSValueWebkitIsolate
+            || id == CSSValueWebkitIsolateOverride
             || id == CSSValueWebkitPlaintext)
             validPrimitive = true;
-        else {
-            RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
-            bool isValid = true;
-            while (isValid && value) {
-                switch (value->id) {
-                case CSSValueBidiOverride:
-                case CSSValueWebkitIsolate:
-                    list->append(cssValuePool().createIdentifierValue(value->id));
-                    break;
-                default:
-                    isValid = false;
-                }
-                value = m_valueList->next();
-            }
-            if (list->length() && isValid) {
-                parsedValue = list.release();
-                m_valueList->next();
-            }
-        }
         break;
 
     case CSSPropertyContent:              // [ <string> | <uri> | <counter> | attr(X) | open-quote |

Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (126071 => 126072)


--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2012-08-20 21:32:03 UTC (rev 126071)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2012-08-20 21:34:11 UTC (rev 126072)
@@ -2293,6 +2293,32 @@
     return TTNONE;
 }
 
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUnicodeBidi e)
+    : CSSValue(PrimitiveClass)
+{
+    m_primitiveUnitType = CSS_IDENT;
+    switch (e) {
+    case UBNormal:
+        m_value.ident = CSSValueNormal;
+        break;
+    case Embed:
+        m_value.ident = CSSValueEmbed;
+        break;
+    case Override:
+        m_value.ident = CSSValueBidiOverride;
+        break;
+    case Isolate:
+        m_value.ident = CSSValueWebkitIsolate;
+        break;
+    case IsolateOverride:
+        m_value.ident = CSSValueWebkitIsolateOverride;
+        break;
+    case Plaintext:
+        m_value.ident = CSSValueWebkitPlaintext;
+        break;
+    }
+}
+
 template<> inline CSSPrimitiveValue::operator EUnicodeBidi() const
 {
     switch (m_value.ident) {
@@ -2304,6 +2330,8 @@
         return Override;
     case CSSValueWebkitIsolate:
         return Isolate;
+    case CSSValueWebkitIsolateOverride:
+        return IsolateOverride;
     case CSSValueWebkitPlaintext:
         return Plaintext;
     }

Modified: trunk/Source/WebCore/css/CSSValueKeywords.in (126071 => 126072)


--- trunk/Source/WebCore/css/CSSValueKeywords.in	2012-08-20 21:32:03 UTC (rev 126071)
+++ trunk/Source/WebCore/css/CSSValueKeywords.in	2012-08-20 21:34:11 UTC (rev 126072)
@@ -422,6 +422,7 @@
 higher
 invert
 -webkit-isolate
+-webkit-isolate-override
 -webkit-plaintext
 landscape
 ledger

Modified: trunk/Source/WebCore/css/StyleBuilder.cpp (126071 => 126072)


--- trunk/Source/WebCore/css/StyleBuilder.cpp	2012-08-20 21:32:03 UTC (rev 126071)
+++ trunk/Source/WebCore/css/StyleBuilder.cpp	2012-08-20 21:34:11 UTC (rev 126072)
@@ -1170,36 +1170,6 @@
     }
 };
 
-class ApplyPropertyUnicodeBidi {
-public:
-    static void applyValue(StyleResolver* styleResolver, CSSValue* value)
-    {
-        if (value->isValueList()) {
-            EUnicodeBidi rendererUnicodeBidi = RenderStyle::initialUnicodeBidi();
-            for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
-                CSSValue* item = i.value();
-                ASSERT(item->isPrimitiveValue());
-                EUnicodeBidi currentValue = *static_cast<CSSPrimitiveValue*>(item);
-                ASSERT(currentValue == Override || currentValue == Isolate);
-                if (currentValue != rendererUnicodeBidi && rendererUnicodeBidi != RenderStyle::initialUnicodeBidi())
-                    rendererUnicodeBidi = OverrideIsolate;
-                else
-                    rendererUnicodeBidi = currentValue;
-            }
-            styleResolver->style()->setUnicodeBidi(rendererUnicodeBidi);
-        }
-        if (!value->isPrimitiveValue())
-            return;
-        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
-        styleResolver->style()->setUnicodeBidi(*primitiveValue);
-    }
-    static PropertyHandler createHandler()
-    {
-        PropertyHandler handler = ApplyPropertyDefaultBase<EUnicodeBidi, &RenderStyle::unicodeBidi, EUnicodeBidi, &RenderStyle::setUnicodeBidi, EUnicodeBidi, &RenderStyle::initialUnicodeBidi>::createHandler();
-        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
-    }
-};
-
 class ApplyPropertyLineHeight {
 public:
     static void applyValue(StyleResolver* styleResolver, CSSValue* value)
@@ -1941,7 +1911,7 @@
     setPropertyHandler(CSSPropertyTextRendering, ApplyPropertyFont<TextRenderingMode, &FontDescription::textRenderingMode, &FontDescription::setTextRenderingMode, AutoTextRendering>::createHandler());
     setPropertyHandler(CSSPropertyTextTransform, ApplyPropertyDefault<ETextTransform, &RenderStyle::textTransform, ETextTransform, &RenderStyle::setTextTransform, ETextTransform, &RenderStyle::initialTextTransform>::createHandler());
     setPropertyHandler(CSSPropertyTop, ApplyPropertyLength<&RenderStyle::top, &RenderStyle::setTop, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
-    setPropertyHandler(CSSPropertyUnicodeBidi, ApplyPropertyUnicodeBidi::createHandler());
+    setPropertyHandler(CSSPropertyUnicodeBidi, ApplyPropertyDefault<EUnicodeBidi, &RenderStyle::unicodeBidi, EUnicodeBidi, &RenderStyle::setUnicodeBidi, EUnicodeBidi, &RenderStyle::initialUnicodeBidi>::createHandler());
     setPropertyHandler(CSSPropertyVerticalAlign, ApplyPropertyVerticalAlign::createHandler());
     setPropertyHandler(CSSPropertyVisibility, ApplyPropertyDefault<EVisibility, &RenderStyle::visibility, EVisibility, &RenderStyle::setVisibility, EVisibility, &RenderStyle::initialVisibility>::createHandler());
     setPropertyHandler(CSSPropertyWebkitAnimationDelay, ApplyPropertyAnimation<double, &Animation::delay, &Animation::setDelay, &Animation::isDelaySet, &Animation::clearDelay, &Animation::initialAnimationDelay, &CSSToStyleMap::mapAnimationDelay, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());

Modified: trunk/Source/WebCore/platform/text/UnicodeBidi.h (126071 => 126072)


--- trunk/Source/WebCore/platform/text/UnicodeBidi.h	2012-08-20 21:32:03 UTC (rev 126071)
+++ trunk/Source/WebCore/platform/text/UnicodeBidi.h	2012-08-20 21:34:11 UTC (rev 126072)
@@ -34,17 +34,17 @@
     Override,
     Isolate,
     Plaintext,
-    OverrideIsolate,
+    IsolateOverride,
 }; 
 
 inline bool isIsolated(const EUnicodeBidi& unicodeBidi)
 {
-    return unicodeBidi == Isolate || unicodeBidi == OverrideIsolate || unicodeBidi == Plaintext;
+    return unicodeBidi == Isolate || unicodeBidi == IsolateOverride || unicodeBidi == Plaintext;
 }
 
 inline bool isOverride(EUnicodeBidi unicodeBidi)
 {
-    return unicodeBidi == Override || unicodeBidi == OverrideIsolate;
+    return unicodeBidi == Override || unicodeBidi == IsolateOverride;
 }
 
 }

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (126071 => 126072)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2012-08-20 21:32:03 UTC (rev 126071)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2012-08-20 21:34:11 UTC (rev 126072)
@@ -997,7 +997,7 @@
         if (unicodeBidi == Plaintext)
             determineDirectionality(direction, InlineIterator(isolatedInline, isolatedRun->object(), 0));
         else {
-            ASSERT(unicodeBidi == Isolate || unicodeBidi == OverrideIsolate);
+            ASSERT(unicodeBidi == Isolate || unicodeBidi == IsolateOverride);
             direction = isolatedInline->style()->direction();
         }
         isolatedResolver.setStatus(statusWithDirection(direction, isOverride(unicodeBidi)));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to