Title: [109806] trunk
Revision
109806
Author
rn...@webkit.org
Date
2012-03-05 15:09:22 -0800 (Mon, 05 Mar 2012)

Log Message

unicode-bidi should support isolate override and override isolate
https://bugs.webkit.org/show_bug.cgi?id=73164

Reviewed by Eric Seidel.

Source/WebCore: 

Updated CSS parser and CSS style selector to support the union of bidi-override and isolate in
unicode-bidi property. Added OverrideIsolate to EUnicodeBidi instead of turning Override and Isolate
into bit flags to avoid increasing the number of bits required to store the unicodeBidi flag.

Also fixed a bug in RenderBlock::constructTextRun to actually check whether an isolated run's direction
is overridden or not when constructing one.

Tests: fast/css/unicode-bidi-computed-value.html
       fast/text/bidi-override-isolate.html

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::renderUnicodeBidiFlagsToCSSValue): Added; Create a CSSValueList when unicode-bidi has both
isolate and bidi-override specified.
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):  Calls renderUnicodeBidiFlagsToCSSValue.
* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue): Support parsing combinations of -webkit-isolate and bidi-override;
Create a CSSValueList in such cases.
* css/CSSPrimitiveValueMappings.h:
(WebCore):
* css/CSSStyleApplyProperty.cpp:
(ApplyPropertyUnicodeBidi):
(WebCore::ApplyPropertyUnicodeBidi::applyValue): Support combinations of -webkit-isolate and
bidi-override. Set the unicodeBidi flag to OverrideIsolate in such cases.
(WebCore::ApplyPropertyUnicodeBidi::createHandler):
(WebCore):
(WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty):
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::drawTextInternal):
* platform/text/UnicodeBidi.h: Added OverrideIsolate. We don't use bit flags to avoid increasing the
number of bits required to store flags especially because isolate and bidi-override are only values
that can be combined.
(WebCore::isIsolated):
(WebCore):
(WebCore::isOverride):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::constructTextRun):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::statusWithDirection): Takes isOverride; we used to assume it's always false.
(WebCore::constructBidiRuns): Instantiate isolatedResolver with a proper value of isOverride.
(WebCore::RenderBlock::layoutRunsAndFloatsInRange):
(WebCore::RenderBlock::determineStartPosition):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::paintItemForeground):
* rendering/RenderMenuList.cpp:
(WebCore::RenderMenuList::itemStyle):
(WebCore::RenderMenuList::menuStyle):
* rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::menuStyle):
* rendering/svg/SVGTextMetrics.cpp:
(WebCore::SVGTextMetrics::constructTextRun):

LayoutTests: 

Added a test for retrieving computed value of unicode-bidi property
and also added a test to render "unicode-bidi: -webkit-isolate bidi-override".

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

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (109805 => 109806)


--- trunk/LayoutTests/ChangeLog	2012-03-05 22:58:55 UTC (rev 109805)
+++ trunk/LayoutTests/ChangeLog	2012-03-05 23:09:22 UTC (rev 109806)
@@ -1,3 +1,18 @@
+2012-03-02  Ryosuke Niwa  <rn...@webkit.org>
+
+        unicode-bidi should support isolate override and override isolate
+        https://bugs.webkit.org/show_bug.cgi?id=73164
+
+        Reviewed by Eric Seidel.
+
+        Added a test for retrieving computed value of unicode-bidi property
+        and also added a test to render "unicode-bidi: -webkit-isolate bidi-override".
+
+        * fast/css/unicode-bidi-computed-value-expected.txt: Added.
+        * fast/css/unicode-bidi-computed-value.html: Added.
+        * fast/text/bidi-override-isolate-expected.html: Added.
+        * fast/text/bidi-override-isolate.html: Added.
+
 2012-03-05  Tony Chang  <t...@chromium.org>
 
         Implement flex-wrap: wrap

Added: trunk/LayoutTests/fast/css/unicode-bidi-computed-value-expected.txt (0 => 109806)


--- trunk/LayoutTests/fast/css/unicode-bidi-computed-value-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/unicode-bidi-computed-value-expected.txt	2012-03-05 23:09:22 UTC (rev 109806)
@@ -0,0 +1,17 @@
+This tests the computed value of unicode-bidi property.
+
+PASS styleOf("span", {}).unicodeBidi is "normal"
+PASS styleOf("span", {"style":"unicode-bidi: embed;"}).unicodeBidi is "embed"
+PASS styleOf("span", {"style":"unicode-bidi: -webkit-isolate;"}).unicodeBidi is "-webkit-isolate"
+PASS styleOf("span", {"style":"unicode-bidi: bidi-override;"}).unicodeBidi is "bidi-override"
+PASS styleOf("span", {"style":"unicode-bidi: -webkit-plaintext;"}).unicodeBidi is "-webkit-plaintext"
+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 bad-value;"}).unicodeBidi is "normal"
+PASS styleOf("span", {"style":"unicode-bidi: bidi-override embed;"}).unicodeBidi is "normal"
+

Added: trunk/LayoutTests/fast/css/unicode-bidi-computed-value.html (0 => 109806)


--- trunk/LayoutTests/fast/css/unicode-bidi-computed-value.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/unicode-bidi-computed-value.html	2012-03-05 23:09:22 UTC (rev 109806)
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<p id="description">This tests the computed value of unicode-bidi property.</p>
+<div id="container"></div>
+<div id="console"></div>
+<script>
+
+var container = document.getElementById('container');
+
+function styleOf(name, attributes) {
+    var element = document.createElement('div');
+    for (var name in attributes) {
+        var value = attributes[name];
+        element.setAttribute(name, value);
+    }
+    container.appendChild(element);
+    return getComputedStyle(element);
+}
+
+var tests = [
+    ['span', {}, 'normal'],
+    ['span', {'style': 'unicode-bidi: embed;'}, 'embed'],
+    ['span', {'style': 'unicode-bidi: -webkit-isolate;'}, '-webkit-isolate'],
+    ['span', {'style': 'unicode-bidi: bidi-override;'}, 'bidi-override'],
+    ['span', {'style': 'unicode-bidi: -webkit-plaintext;'}, '-webkit-plaintext'],
+    ['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 bad-value;'}, 'normal'],
+    ['span', {'style': 'unicode-bidi: bidi-override embed;'}, 'normal'],
+].forEach(function (test) {
+    shouldBe('styleOf("' + test[0] + '", ' + JSON.stringify(test[1]) + ').unicodeBidi', '"' + test[2] + '"');
+});
+
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/fast/text/bidi-override-isolate-expected.html (0 => 109806)


--- trunk/LayoutTests/fast/text/bidi-override-isolate-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/bidi-override-isolate-expected.html	2012-03-05 23:09:22 UTC (rev 109806)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>Tests for "unicode-bidi: bidi-override isolate".</p>
+
+<div style="font-size: 3em;">
+<div>abc 1</div>
+<div>1 cba</div>
+<div>cba 1</div>
+<div>cba 1</div>
+<div>1 cba</div>
+<div>abc 1</div>
+</div>
+
+</body>
+</html>

Added: trunk/LayoutTests/fast/text/bidi-override-isolate.html (0 => 109806)


--- trunk/LayoutTests/fast/text/bidi-override-isolate.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/bidi-override-isolate.html	2012-03-05 23:09:22 UTC (rev 109806)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>Tests for "unicode-bidi: bidi-override isolate".</p>
+
+<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;
+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;
+unicode-bidi: -bad-value bidi-override;">abc</span> 1</div>
+</div>
+
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (109805 => 109806)


--- trunk/Source/WebCore/ChangeLog	2012-03-05 22:58:55 UTC (rev 109805)
+++ trunk/Source/WebCore/ChangeLog	2012-03-05 23:09:22 UTC (rev 109806)
@@ -1,3 +1,61 @@
+2012-03-05  Ryosuke Niwa  <rn...@webkit.org>
+
+        unicode-bidi should support isolate override and override isolate
+        https://bugs.webkit.org/show_bug.cgi?id=73164
+
+        Reviewed by Eric Seidel.
+
+        Updated CSS parser and CSS style selector to support the union of bidi-override and isolate in
+        unicode-bidi property. Added OverrideIsolate to EUnicodeBidi instead of turning Override and Isolate
+        into bit flags to avoid increasing the number of bits required to store the unicodeBidi flag.
+
+        Also fixed a bug in RenderBlock::constructTextRun to actually check whether an isolated run's direction
+        is overridden or not when constructing one.
+
+        Tests: fast/css/unicode-bidi-computed-value.html
+               fast/text/bidi-override-isolate.html
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::renderUnicodeBidiFlagsToCSSValue): Added; Create a CSSValueList when unicode-bidi has both
+        isolate and bidi-override specified.
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):  Calls renderUnicodeBidiFlagsToCSSValue.
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseValue): Support parsing combinations of -webkit-isolate and bidi-override;
+        Create a CSSValueList in such cases.
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore):
+        * css/CSSStyleApplyProperty.cpp:
+        (ApplyPropertyUnicodeBidi):
+        (WebCore::ApplyPropertyUnicodeBidi::applyValue): Support combinations of -webkit-isolate and
+        bidi-override. Set the unicodeBidi flag to OverrideIsolate in such cases.
+        (WebCore::ApplyPropertyUnicodeBidi::createHandler):
+        (WebCore):
+        (WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty):
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::drawTextInternal):
+        * platform/text/UnicodeBidi.h: Added OverrideIsolate. We don't use bit flags to avoid increasing the
+        number of bits required to store flags especially because isolate and bidi-override are only values
+        that can be combined.
+        (WebCore::isIsolated):
+        (WebCore):
+        (WebCore::isOverride):
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::constructTextRun):
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::statusWithDirection): Takes isOverride; we used to assume it's always false.
+        (WebCore::constructBidiRuns): Instantiate isolatedResolver with a proper value of isOverride.
+        (WebCore::RenderBlock::layoutRunsAndFloatsInRange):
+        (WebCore::RenderBlock::determineStartPosition):
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::paintItemForeground):
+        * rendering/RenderMenuList.cpp:
+        (WebCore::RenderMenuList::itemStyle):
+        (WebCore::RenderMenuList::menuStyle):
+        * rendering/RenderTextControlSingleLine.cpp:
+        (WebCore::RenderTextControlSingleLine::menuStyle):
+        * rendering/svg/SVGTextMetrics.cpp:
+        (WebCore::SVGTextMetrics::constructTextRun):
+
 2012-03-05  Emil A Eklund  <e...@chromium.org>
 
         Replace uses of x(), y() and width(), height() pairs with locationOffset and size()

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (109805 => 109806)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2012-03-05 22:58:55 UTC (rev 109805)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2012-03-05 23:09:22 UTC (rev 109806)
@@ -1128,6 +1128,31 @@
     return cssValuePool->createValue(family.string(), CSSPrimitiveValue::CSS_STRING);
 }
 
+static PassRefPtr<CSSValue> renderUnicodeBidiFlagsToCSSValue(EUnicodeBidi unicodeBidi, CSSValuePool* cssValuePool)
+{
+    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, CSSValuePool* cssValuePool)
 {
     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
@@ -1897,7 +1922,7 @@
         case CSSPropertyTop:
             return getPositionOffsetValue(style.get(), CSSPropertyTop, cssValuePool);
         case CSSPropertyUnicodeBidi:
-            return cssValuePool->createValue(style->unicodeBidi());
+            return renderUnicodeBidiFlagsToCSSValue(style->unicodeBidi(), cssValuePool);
         case CSSPropertyVerticalAlign:
             switch (style->verticalAlign()) {
                 case BASELINE:

Modified: trunk/Source/WebCore/css/CSSParser.cpp (109805 => 109806)


--- trunk/Source/WebCore/css/CSSParser.cpp	2012-03-05 22:58:55 UTC (rev 109805)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2012-03-05 23:09:22 UTC (rev 109806)
@@ -968,13 +968,30 @@
         else
             return parseQuotes(propId, important);
         break;
-    case CSSPropertyUnicodeBidi: // normal | embed | bidi-override | isolate | plaintext | inherit
+    case CSSPropertyUnicodeBidi: // normal | embed | (bidi-override || isolate) | plaintext | inherit
         if (id == CSSValueNormal
             || id == CSSValueEmbed
-            || id == CSSValueBidiOverride
-            || id == CSSValueWebkitIsolate
             || 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 CSSPropertyPosition:             // static | relative | absolute | fixed | inherit

Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (109805 => 109806)


--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2012-03-05 22:58:55 UTC (rev 109805)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2012-03-05 23:09:22 UTC (rev 109806)
@@ -2206,29 +2206,6 @@
     }
 }
 
-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 Plaintext:
-        m_value.ident = CSSValueWebkitPlaintext;
-        break;
-    }
-}
-
 template<> inline CSSPrimitiveValue::operator EUnicodeBidi() const
 {
     switch (m_value.ident) {

Modified: trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp (109805 => 109806)


--- trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp	2012-03-05 22:58:55 UTC (rev 109805)
+++ trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp	2012-03-05 23:09:22 UTC (rev 109806)
@@ -1144,6 +1144,36 @@
     }
 };
 
+class ApplyPropertyUnicodeBidi {
+public:
+    static void applyValue(CSSStyleSelector* selector, 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;
+            }
+            selector->style()->setUnicodeBidi(rendererUnicodeBidi);
+        }
+        if (!value->isPrimitiveValue())
+            return;
+        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+        selector->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(CSSStyleSelector* selector, CSSValue* value)
@@ -1794,7 +1824,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, ApplyPropertyDefault<EUnicodeBidi, &RenderStyle::unicodeBidi, EUnicodeBidi, &RenderStyle::setUnicodeBidi, EUnicodeBidi, &RenderStyle::initialUnicodeBidi>::createHandler());
+    setPropertyHandler(CSSPropertyUnicodeBidi, ApplyPropertyUnicodeBidi::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, &CSSStyleSelector::mapAnimationDelay, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());

Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (109805 => 109806)


--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp	2012-03-05 22:58:55 UTC (rev 109805)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp	2012-03-05 23:09:22 UTC (rev 109806)
@@ -2028,7 +2028,7 @@
     RenderStyle* computedStyle = canvas()->computedStyle();
     TextDirection direction = computedStyle ? computedStyle->direction() : LTR;
     bool isRTL = direction == RTL;
-    bool override = computedStyle ? computedStyle->unicodeBidi() == Override : false;
+    bool override = computedStyle ? isOverride(computedStyle->unicodeBidi()) : false;
 
     unsigned length = text.length();
     const UChar* string = text.characters();

Modified: trunk/Source/WebCore/platform/text/UnicodeBidi.h (109805 => 109806)


--- trunk/Source/WebCore/platform/text/UnicodeBidi.h	2012-03-05 22:58:55 UTC (rev 109805)
+++ trunk/Source/WebCore/platform/text/UnicodeBidi.h	2012-03-05 23:09:22 UTC (rev 109806)
@@ -33,14 +33,20 @@
     Embed,
     Override,
     Isolate,
-    Plaintext
+    Plaintext,
+    OverrideIsolate,
 }; 
 
 inline bool isIsolated(const EUnicodeBidi& unicodeBidi)
 {
-    return unicodeBidi == Isolate || unicodeBidi == Plaintext;
+    return unicodeBidi == Isolate || unicodeBidi == OverrideIsolate || unicodeBidi == Plaintext;
 }
 
+inline bool isOverride(EUnicodeBidi unicodeBidi)
+{
+    return unicodeBidi == Override || unicodeBidi == OverrideIsolate;
 }
 
+}
+
 #endif

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (109805 => 109806)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-03-05 22:58:55 UTC (rev 109805)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-03-05 23:09:22 UTC (rev 109806)
@@ -7344,7 +7344,7 @@
         if (flags & RespectDirection)
             textDirection = style->direction();
         if (flags & RespectDirectionOverride)
-            directionalOverride |= style->unicodeBidi() == Override;
+            directionalOverride |= isOverride(style->unicodeBidi());
     }
 
     TextRun run(characters, length, false, 0, 0, expansion, textDirection, directionalOverride);

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (109805 => 109806)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2012-03-05 22:58:55 UTC (rev 109805)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2012-03-05 23:09:22 UTC (rev 109806)
@@ -943,10 +943,10 @@
 }
 
 // FIXME: This should be a BidiStatus constructor or create method.
-static inline BidiStatus statusWithDirection(TextDirection textDirection)
+static inline BidiStatus statusWithDirection(TextDirection textDirection, bool isOverride)
 {
     WTF::Unicode::Direction direction = textDirection == LTR ? LeftToRight : RightToLeft;
-    RefPtr<BidiContext> context = BidiContext::create(textDirection == LTR ? 0 : 1, direction, false, FromStyleOrDOM);
+    RefPtr<BidiContext> context = BidiContext::create(textDirection == LTR ? 0 : 1, direction, isOverride, FromStyleOrDOM);
 
     // This copies BidiStatus and may churn the ref on BidiContext. I doubt it matters.
     return BidiStatus(direction, direction, direction, context.release());
@@ -980,10 +980,10 @@
         if (unicodeBidi == Plaintext)
             determineDirectionality(direction, InlineIterator(isolatedInline, isolatedRun->object(), 0));
         else {
-            ASSERT(unicodeBidi == Isolate);
+            ASSERT(unicodeBidi == Isolate || unicodeBidi == OverrideIsolate);
             direction = isolatedInline->style()->direction();
         }
-        isolatedResolver.setStatus(statusWithDirection(direction));
+        isolatedResolver.setStatus(statusWithDirection(direction, isOverride(unicodeBidi)));
 
         // FIXME: The fact that we have to construct an Iterator here
         // currently prevents this code from moving into BidiResolver.
@@ -1272,7 +1272,7 @@
             if (isNewUBAParagraph && styleToUse->unicodeBidi() == Plaintext && !resolver.context()->parent()) {
                 TextDirection direction = styleToUse->direction();
                 determineDirectionality(direction, resolver.position());
-                resolver.setStatus(BidiStatus(direction, styleToUse->unicodeBidi() == Override));
+                resolver.setStatus(BidiStatus(direction, isOverride(styleToUse->unicodeBidi())));
             }
             // FIXME: This ownership is reversed. We should own the BidiRunList and pass it to createBidiRunsForLine.
             BidiRunList<BidiRun>& bidiRuns = resolver.runs();
@@ -1682,7 +1682,7 @@
         TextDirection direction = style()->direction();
         if (style()->unicodeBidi() == Plaintext)
             determineDirectionality(direction, InlineIterator(this, bidiFirstSkippingEmptyInlines(this), 0));
-        resolver.setStatus(BidiStatus(direction, style()->unicodeBidi() == Override));
+        resolver.setStatus(BidiStatus(direction, isOverride(style()->unicodeBidi())));
         InlineIterator iter = InlineIterator(this, bidiFirstSkippingEmptyInlines(this, &resolver), 0);
         resolver.setPosition(iter, numberOfIsolateAncestors(iter));
     }

Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (109805 => 109806)


--- trunk/Source/WebCore/rendering/RenderListBox.cpp	2012-03-05 22:58:55 UTC (rev 109805)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp	2012-03-05 23:09:22 UTC (rev 109806)
@@ -409,7 +409,7 @@
 
     unsigned length = itemText.length();
     const UChar* string = itemText.characters();
-    TextRun textRun(string, length, false, 0, 0, TextRun::AllowTrailingExpansion, itemStyle->direction(), itemStyle->unicodeBidi() == Override, TextRun::NoRounding);
+    TextRun textRun(string, length, false, 0, 0, TextRun::AllowTrailingExpansion, itemStyle->direction(), isOverride(itemStyle->unicodeBidi()), TextRun::NoRounding);
     Font itemFont = style()->font();
     LayoutRect r = itemBoundingBoxRect(paintOffset, listIndex);
     r.move(itemOffsetForAlignment(textRun, itemStyle, itemFont, r));

Modified: trunk/Source/WebCore/rendering/RenderMenuList.cpp (109805 => 109806)


--- trunk/Source/WebCore/rendering/RenderMenuList.cpp	2012-03-05 22:58:55 UTC (rev 109805)
+++ trunk/Source/WebCore/rendering/RenderMenuList.cpp	2012-03-05 23:09:22 UTC (rev 109806)
@@ -447,7 +447,8 @@
     HTMLElement* element = listItems[listIndex];
     
     RenderStyle* style = element->renderStyle() ? element->renderStyle() : element->computedStyle();
-    return style ? PopupMenuStyle(style->visitedDependentColor(CSSPropertyColor), itemBackgroundColor(listIndex), style->font(), style->visibility() == VISIBLE, style->display() == NONE, style->textIndent(), style->direction(), style->unicodeBidi() == Override) : menuStyle();
+    return style ? PopupMenuStyle(style->visitedDependentColor(CSSPropertyColor), itemBackgroundColor(listIndex), style->font(), style->visibility() == VISIBLE,
+        style->display() == NONE, style->textIndent(), style->direction(), isOverride(style->unicodeBidi())) : menuStyle();
 }
 
 Color RenderMenuList::itemBackgroundColor(unsigned listIndex) const
@@ -476,7 +477,8 @@
 PopupMenuStyle RenderMenuList::menuStyle() const
 {
     RenderStyle* s = m_innerBlock ? m_innerBlock->style() : style();
-    return PopupMenuStyle(s->visitedDependentColor(CSSPropertyColor), s->visitedDependentColor(CSSPropertyBackgroundColor), s->font(), s->visibility() == VISIBLE, s->display() == NONE, s->textIndent(), style()->direction(), style()->unicodeBidi() == Override);
+    return PopupMenuStyle(s->visitedDependentColor(CSSPropertyColor), s->visitedDependentColor(CSSPropertyBackgroundColor), s->font(), s->visibility() == VISIBLE,
+        s->display() == NONE, s->textIndent(), style()->direction(), isOverride(style()->unicodeBidi()));
 }
 
 HostWindow* RenderMenuList::hostWindow() const

Modified: trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp (109805 => 109806)


--- trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp	2012-03-05 22:58:55 UTC (rev 109805)
+++ trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp	2012-03-05 23:09:22 UTC (rev 109806)
@@ -621,7 +621,8 @@
 
 PopupMenuStyle RenderTextControlSingleLine::menuStyle() const
 {
-    return PopupMenuStyle(style()->visitedDependentColor(CSSPropertyColor), style()->visitedDependentColor(CSSPropertyBackgroundColor), style()->font(), style()->visibility() == VISIBLE, style()->display() == NONE, style()->textIndent(), style()->direction(), style()->unicodeBidi() == Override);
+    return PopupMenuStyle(style()->visitedDependentColor(CSSPropertyColor), style()->visitedDependentColor(CSSPropertyBackgroundColor), style()->font(), style()->visibility() == VISIBLE,
+        style()->display() == NONE, style()->textIndent(), style()->direction(), isOverride(style()->unicodeBidi()));
 }
 
 int RenderTextControlSingleLine::clientInsetLeft() const

Modified: trunk/Source/WebCore/rendering/svg/SVGTextMetrics.cpp (109805 => 109806)


--- trunk/Source/WebCore/rendering/svg/SVGTextMetrics.cpp	2012-03-05 22:58:55 UTC (rev 109805)
+++ trunk/Source/WebCore/rendering/svg/SVGTextMetrics.cpp	2012-03-05 23:09:22 UTC (rev 109806)
@@ -75,7 +75,7 @@
                 , 0 /* padding, only relevant for justified text, not relevant for SVG */
                 , TextRun::AllowTrailingExpansion
                 , style->direction()
-                , style->unicodeBidi() == Override /* directionalOverride */);
+                , isOverride(style->unicodeBidi()) /* directionalOverride */);
 
     if (textRunNeedsRenderingContext(style->font()))
         run.setRenderingContext(SVGTextRunRenderingContext::create(text));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to