unicode-bidi should support isolate override and override isolate
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Mar 2012 23:09:22 +0000 (23:09 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Mar 2012 23:09:22 +0000 (23:09 +0000)
commit3d18d49f35d7c47e5a13cc86c9c8f381cca35c0b
tree5cd9c1909645e2d92a20de9ffa6fb84c16b98d31
parent12f107b3e7d5aa8b90073e4a78f6a5e55e252f04
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@109806 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css/unicode-bidi-computed-value-expected.txt [new file with mode: 0644]
LayoutTests/fast/css/unicode-bidi-computed-value.html [new file with mode: 0644]
LayoutTests/fast/text/bidi-override-isolate-expected.html [new file with mode: 0644]
LayoutTests/fast/text/bidi-override-isolate.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSPrimitiveValueMappings.h
Source/WebCore/css/CSSStyleApplyProperty.cpp
Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
Source/WebCore/platform/text/UnicodeBidi.h
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBlockLineLayout.cpp
Source/WebCore/rendering/RenderListBox.cpp
Source/WebCore/rendering/RenderMenuList.cpp
Source/WebCore/rendering/RenderTextControlSingleLine.cpp
Source/WebCore/rendering/svg/SVGTextMetrics.cpp