[CSS3] Parsing the property, text-justify.
authordw.im@samsung.com <dw.im@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Apr 2013 00:32:39 +0000 (00:32 +0000)
committerdw.im@samsung.com <dw.im@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Apr 2013 00:32:39 +0000 (00:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=100058

Reviewed by Andreas Kling.

This patch implements the parsing side of the "text-justify" property specified
in CSS3 working draft, with "-webkit-" prefix, under ENABLE_CSS3_TEXT flag.
Specification link : http://www.w3.org/TR/css3-text/#text-justify

Source/WebCore:

Tests: fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify-inherited.html
       fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify.html

* css/CSSComputedStyleDeclaration.cpp:
(WebCore):
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
* css/CSSParser.cpp:
(WebCore::isValidKeywordPropertyAndValue):
(WebCore::isKeywordPropertyID):
(WebCore::CSSParser::parseValue):
* css/CSSPrimitiveValueMappings.h:
(WebCore):
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator TextJustify):
* css/CSSProperty.cpp:
(WebCore::CSSProperty::isInheritedProperty):
* css/CSSPropertyNames.in:
* css/CSSValueKeywords.in:
* css/StyleBuilder.cpp:
(WebCore::StyleBuilder::StyleBuilder):
* css/StylePropertySet.cpp:
(WebCore):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::applyProperty):
* rendering/style/RenderStyle.h:
* rendering/style/RenderStyleConstants.h:
* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator==):
* rendering/style/StyleRareInheritedData.h:
(StyleRareInheritedData):

LayoutTests:

* fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify-expected.txt: Added.
* fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify-inherited-expected.txt: Added.
* fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify-inherited.html: Added.
* fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify.html: Added.
* fast/css3-text/css3-text-justify/getComputedStyle/script-tests/getComputedStyle-text-justify-inherited.js: Added.
(testComputedStyle):
(ownValueTest):
(inheritanceTest):
* fast/css3-text/css3-text-justify/getComputedStyle/script-tests/getComputedStyle-text-justify.js: Added.
(testElementStyle):
(testComputedStyle):
(valueSettingTest):
(invalidValueSettingTest):
* platform/mac/TestExpectations: ditto
* platform/qt-4.8/TestExpectations: ditto
* platform/qt-mac/TestExpectations: ditto
* platform/qt/TestExpectations: ditto

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@148070 268f45cc-cd09-0410-ab3c-d52691b4dbfc

24 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify-expected.txt [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify-inherited-expected.txt [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify-inherited.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-justify/getComputedStyle/script-tests/getComputedStyle-text-justify-inherited.js [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-justify/getComputedStyle/script-tests/getComputedStyle-text-justify.js [new file with mode: 0644]
LayoutTests/platform/mac/TestExpectations
LayoutTests/platform/qt-mac/TestExpectations
LayoutTests/platform/qt/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSPrimitiveValueMappings.h
Source/WebCore/css/CSSProperty.cpp
Source/WebCore/css/CSSPropertyNames.in
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/css/StyleBuilder.cpp
Source/WebCore/css/StylePropertySet.cpp
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/RenderStyleConstants.h
Source/WebCore/rendering/style/StyleRareInheritedData.cpp
Source/WebCore/rendering/style/StyleRareInheritedData.h

index 294fc8e..291a2ab 100644 (file)
@@ -1,3 +1,32 @@
+2013-04-09  Dongwoo Joshua Im  <dw.im@samsung.com>
+
+        [CSS3] Parsing the property, text-justify.
+        https://bugs.webkit.org/show_bug.cgi?id=100058
+
+        Reviewed by Andreas Kling.
+
+        This patch implements the parsing side of the "text-justify" property specified
+        in CSS3 working draft, with "-webkit-" prefix, under ENABLE_CSS3_TEXT flag.
+        Specification link : http://www.w3.org/TR/css3-text/#text-justify
+
+        * fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify-expected.txt: Added.
+        * fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify-inherited-expected.txt: Added.
+        * fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify-inherited.html: Added.
+        * fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify.html: Added.
+        * fast/css3-text/css3-text-justify/getComputedStyle/script-tests/getComputedStyle-text-justify-inherited.js: Added.
+        (testComputedStyle):
+        (ownValueTest):
+        (inheritanceTest):
+        * fast/css3-text/css3-text-justify/getComputedStyle/script-tests/getComputedStyle-text-justify.js: Added.
+        (testElementStyle):
+        (testComputedStyle):
+        (valueSettingTest):
+        (invalidValueSettingTest):
+        * platform/mac/TestExpectations: ditto
+        * platform/qt-4.8/TestExpectations: ditto
+        * platform/qt-mac/TestExpectations: ditto
+        * platform/qt/TestExpectations: ditto
+
 2013-04-09  Simon Fraser  <simon.fraser@apple.com>
 
         r148048 revealed that compositing/plugins/invalidate_rect.html was
diff --git a/LayoutTests/fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify-expected.txt b/LayoutTests/fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify-expected.txt
new file mode 100644 (file)
index 0000000..1aaf950
--- /dev/null
@@ -0,0 +1,127 @@
+This test checks that -webkit-text-justify parses properly the properties from CSS 3 Text.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Test the initial value:
+PASS computedStyle.webkitTextJustify is 'auto'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-justify').cssText is 'auto'
+
+Value 'auto':
+PASS e.style.webkitTextJustify is 'auto'
+PASS e.style.getPropertyCSSValue('-webkit-text-justify').cssText is 'auto'
+PASS computedStyle.webkitTextJustify is 'auto'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-justify').cssText is 'auto'
+
+Value 'none':
+PASS e.style.webkitTextJustify is 'none'
+PASS e.style.getPropertyCSSValue('-webkit-text-justify').cssText is 'none'
+PASS computedStyle.webkitTextJustify is 'none'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-justify').cssText is 'none'
+
+Value 'inter-word':
+PASS e.style.webkitTextJustify is 'inter-word'
+PASS e.style.getPropertyCSSValue('-webkit-text-justify').cssText is 'inter-word'
+PASS computedStyle.webkitTextJustify is 'inter-word'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-justify').cssText is 'inter-word'
+
+Value 'inter-ideograph':
+PASS e.style.webkitTextJustify is 'inter-ideograph'
+PASS e.style.getPropertyCSSValue('-webkit-text-justify').cssText is 'inter-ideograph'
+PASS computedStyle.webkitTextJustify is 'inter-ideograph'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-justify').cssText is 'inter-ideograph'
+
+Value 'inter-cluster':
+PASS e.style.webkitTextJustify is 'inter-cluster'
+PASS e.style.getPropertyCSSValue('-webkit-text-justify').cssText is 'inter-cluster'
+PASS computedStyle.webkitTextJustify is 'inter-cluster'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-justify').cssText is 'inter-cluster'
+
+Value 'distribute':
+PASS e.style.webkitTextJustify is 'distribute'
+PASS e.style.getPropertyCSSValue('-webkit-text-justify').cssText is 'distribute'
+PASS computedStyle.webkitTextJustify is 'distribute'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-justify').cssText is 'distribute'
+
+Value 'kashida':
+PASS e.style.webkitTextJustify is 'kashida'
+PASS e.style.getPropertyCSSValue('-webkit-text-justify').cssText is 'kashida'
+PASS computedStyle.webkitTextJustify is 'kashida'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-justify').cssText is 'kashida'
+
+Invalid value test - '-webkit-left':
+PASS e.style.webkitTextJustify is 'auto'
+PASS e.style.getPropertyCSSValue('-webkit-text-justify').cssText is 'auto'
+PASS computedStyle.webkitTextJustify is 'auto'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-justify').cssText is 'auto'
+
+Invalid value test - '-webkit-right':
+PASS e.style.webkitTextJustify is 'auto'
+PASS e.style.getPropertyCSSValue('-webkit-text-justify').cssText is 'auto'
+PASS computedStyle.webkitTextJustify is 'auto'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-justify').cssText is 'auto'
+
+Invalid value test - '-webkit-center':
+PASS e.style.webkitTextJustify is 'auto'
+PASS e.style.getPropertyCSSValue('-webkit-text-justify').cssText is 'auto'
+PASS computedStyle.webkitTextJustify is 'auto'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-justify').cssText is 'auto'
+
+Invalid value test - '-webkit-match-parent':
+PASS e.style.webkitTextJustify is 'auto'
+PASS e.style.getPropertyCSSValue('-webkit-text-justify').cssText is 'auto'
+PASS computedStyle.webkitTextJustify is 'auto'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-justify').cssText is 'auto'
+
+Invalid value test - '-webkit-auto':
+PASS e.style.webkitTextJustify is 'auto'
+PASS e.style.getPropertyCSSValue('-webkit-text-justify').cssText is 'auto'
+PASS computedStyle.webkitTextJustify is 'auto'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-justify').cssText is 'auto'
+
+Invalid value test - 'solid':
+PASS e.style.webkitTextJustify is 'auto'
+PASS e.style.getPropertyCSSValue('-webkit-text-justify').cssText is 'auto'
+PASS computedStyle.webkitTextJustify is 'auto'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-justify').cssText is 'auto'
+
+Invalid value test - 'normal':
+PASS e.style.webkitTextJustify is 'auto'
+PASS e.style.getPropertyCSSValue('-webkit-text-justify').cssText is 'auto'
+PASS computedStyle.webkitTextJustify is 'auto'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-justify').cssText is 'auto'
+
+Invalid value test - 'bold':
+PASS e.style.webkitTextJustify is 'auto'
+PASS e.style.getPropertyCSSValue('-webkit-text-justify').cssText is 'auto'
+PASS computedStyle.webkitTextJustify is 'auto'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-justify').cssText is 'auto'
+
+Invalid value test - 'background':
+PASS e.style.webkitTextJustify is 'auto'
+PASS e.style.getPropertyCSSValue('-webkit-text-justify').cssText is 'auto'
+PASS computedStyle.webkitTextJustify is 'auto'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-justify').cssText is 'auto'
+
+Invalid value test - 'ltr':
+PASS e.style.webkitTextJustify is 'auto'
+PASS e.style.getPropertyCSSValue('-webkit-text-justify').cssText is 'auto'
+PASS computedStyle.webkitTextJustify is 'auto'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-justify').cssText is 'auto'
+
+Computed value test - 'inherit':
+PASS e.style.webkitTextJustify is 'inherit'
+PASS e.style.getPropertyCSSValue('-webkit-text-justify').cssText is 'inherit'
+PASS computedStyle.webkitTextJustify is 'auto'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-justify').cssText is 'auto'
+
+Computed value test - 'initial':
+PASS e.style.webkitTextJustify is 'initial'
+PASS e.style.getPropertyCSSValue('-webkit-text-justify').cssText is 'initial'
+PASS computedStyle.webkitTextJustify is 'auto'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-justify').cssText is 'auto'
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+hello world
diff --git a/LayoutTests/fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify-inherited-expected.txt b/LayoutTests/fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify-inherited-expected.txt
new file mode 100644 (file)
index 0000000..b1926b3
--- /dev/null
@@ -0,0 +1,45 @@
+This test checks that the value of -webkit-text-justify is properly inherited to the child.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Value of ancestor is 'auto':
+PASS window.getComputedStyle(ancestor).getPropertyCSSValue('-webkit-text-justify').cssText is 'auto'
+PASS window.getComputedStyle(child).getPropertyCSSValue('-webkit-text-justify').cssText is 'auto'
+
+Value of ancestor is 'none':
+PASS window.getComputedStyle(ancestor).getPropertyCSSValue('-webkit-text-justify').cssText is 'none'
+PASS window.getComputedStyle(child).getPropertyCSSValue('-webkit-text-justify').cssText is 'none'
+
+Value of ancestor is 'inter-word':
+PASS window.getComputedStyle(ancestor).getPropertyCSSValue('-webkit-text-justify').cssText is 'inter-word'
+PASS window.getComputedStyle(child).getPropertyCSSValue('-webkit-text-justify').cssText is 'inter-word'
+
+Value of ancestor is 'inter-ideograph':
+PASS window.getComputedStyle(ancestor).getPropertyCSSValue('-webkit-text-justify').cssText is 'inter-ideograph'
+PASS window.getComputedStyle(child).getPropertyCSSValue('-webkit-text-justify').cssText is 'inter-ideograph'
+
+Value of ancestor is 'inter-cluster':
+PASS window.getComputedStyle(ancestor).getPropertyCSSValue('-webkit-text-justify').cssText is 'inter-cluster'
+PASS window.getComputedStyle(child).getPropertyCSSValue('-webkit-text-justify').cssText is 'inter-cluster'
+
+Value of ancestor is 'distribute':
+PASS window.getComputedStyle(ancestor).getPropertyCSSValue('-webkit-text-justify').cssText is 'distribute'
+PASS window.getComputedStyle(child).getPropertyCSSValue('-webkit-text-justify').cssText is 'distribute'
+
+Value of ancestor is 'kashida':
+PASS window.getComputedStyle(ancestor).getPropertyCSSValue('-webkit-text-justify').cssText is 'kashida'
+PASS window.getComputedStyle(child).getPropertyCSSValue('-webkit-text-justify').cssText is 'kashida'
+
+Value of ancestor is 'inter-word, while child is 'inter-cluster':
+PASS window.getComputedStyle(ancestor).getPropertyCSSValue('-webkit-text-justify').cssText is 'inter-word'
+PASS window.getComputedStyle(child).getPropertyCSSValue('-webkit-text-justify').cssText is 'inter-cluster'
+
+Value of ancestor is 'inter-ideograph, while child is 'distribute':
+PASS window.getComputedStyle(ancestor).getPropertyCSSValue('-webkit-text-justify').cssText is 'inter-ideograph'
+PASS window.getComputedStyle(child).getPropertyCSSValue('-webkit-text-justify').cssText is 'distribute'
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+hello world
diff --git a/LayoutTests/fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify-inherited.html b/LayoutTests/fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify-inherited.html
new file mode 100644 (file)
index 0000000..841a93a
--- /dev/null
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <script src="../../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+  <div id="ancestor"><div id="child">hello world</div></div>
+  <script src="script-tests/getComputedStyle-text-justify-inherited.js"></script>
+  <script src="../../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify.html b/LayoutTests/fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify.html
new file mode 100644 (file)
index 0000000..0f06334
--- /dev/null
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <script src="../../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+  <div id="test">hello world</div>
+  <script src="script-tests/getComputedStyle-text-justify.js"></script>
+  <script src="../../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/css3-text/css3-text-justify/getComputedStyle/script-tests/getComputedStyle-text-justify-inherited.js b/LayoutTests/fast/css3-text/css3-text-justify/getComputedStyle/script-tests/getComputedStyle-text-justify-inherited.js
new file mode 100644 (file)
index 0000000..c50b31f
--- /dev/null
@@ -0,0 +1,37 @@
+function testComputedStyle(a_value, c_value)
+{
+    shouldBe("window.getComputedStyle(ancestor).getPropertyCSSValue('-webkit-text-justify').cssText",  "'" + a_value + "'");
+    shouldBe("window.getComputedStyle(child).getPropertyCSSValue('-webkit-text-justify').cssText",  "'" + c_value + "'");
+    debug('');
+}
+
+function ownValueTest(a_value, c_value)
+{
+    debug("Value of ancestor is '" + a_value + ", while child is '" + c_value + "':");
+    ancestor.style.webkitTextJustify = a_value;
+    child.style.webkitTextJustify = c_value;
+    testComputedStyle(a_value, c_value);
+}
+
+function inheritanceTest(a_value)
+{
+    debug("Value of ancestor is '" + a_value + "':");
+    ancestor.style.webkitTextJustify = a_value;
+    testComputedStyle(a_value, a_value);
+}
+
+description("This test checks that the value of -webkit-text-justify is properly inherited to the child.");
+
+ancestor = document.getElementById('ancestor');
+child = document.getElementById('child');
+
+inheritanceTest("auto");
+inheritanceTest("none");
+inheritanceTest("inter-word");
+inheritanceTest("inter-ideograph");
+inheritanceTest("inter-cluster");
+inheritanceTest("distribute");
+inheritanceTest("kashida");
+
+ownValueTest("inter-word", "inter-cluster");
+ownValueTest("inter-ideograph", "distribute");
diff --git a/LayoutTests/fast/css3-text/css3-text-justify/getComputedStyle/script-tests/getComputedStyle-text-justify.js b/LayoutTests/fast/css3-text/css3-text-justify/getComputedStyle/script-tests/getComputedStyle-text-justify.js
new file mode 100644 (file)
index 0000000..e3bda5d
--- /dev/null
@@ -0,0 +1,71 @@
+function testElementStyle(propertyJS, propertyCSS, type, value)
+{
+    shouldBe("e.style." + propertyJS, "'" + value + "'");
+    shouldBe("e.style.getPropertyCSSValue('" + propertyCSS + "').cssText", "'" + value + "'");
+}
+
+function testComputedStyle(propertyJS, propertyCSS, type, value)
+{
+    computedStyle = window.getComputedStyle(e, null);
+    shouldBe("computedStyle." + propertyJS, "'" + value + "'");
+    shouldBe("computedStyle.getPropertyCSSValue('" + propertyCSS + "').cssText", "'" + value + "'");
+}
+
+function valueSettingTest(value)
+{
+    debug("Value '" + value + "':");
+    e.style.webkitTextJustify = value;
+    testElementStyle("webkitTextJustify", "-webkit-text-justify", "[object CSSPrimitiveValue]", value);
+    testComputedStyle("webkitTextJustify", "-webkit-text-justify", "[object CSSPrimitiveValue]", value);
+    debug('');
+}
+
+function invalidValueSettingTest(value, defaultValue)
+{
+    debug("Invalid value test - '" + value + "':");
+    e.style.webkitTextJustify = value;
+    testElementStyle("webkitTextJustify", "-webkit-text-justify", "[object CSSPrimitiveValue]", defaultValue);
+    testComputedStyle("webkitTextJustify", "-webkit-text-justify", "[object CSSPrimitiveValue]", defaultValue);
+    debug('');
+}
+
+function computedValueSettingTest(value, defaultValue)
+{
+    debug("Computed value test - '" + value + "':");
+    e.style.webkitTextJustify = value;
+    testElementStyle("webkitTextJustify", "-webkit-text-justify", "[object CSSPrimitiveValue]", value);
+    testComputedStyle("webkitTextJustify", "-webkit-text-justify", "[object CSSPrimitiveValue]", defaultValue);
+    debug('');
+}
+
+description("This test checks that -webkit-text-justify parses properly the properties from CSS 3 Text.");
+
+e = document.getElementById('test');
+
+debug("Test the initial value:");
+testComputedStyle("webkitTextJustify", "-webkit-text-justify", "[object CSSPrimitiveValue]", 'auto');
+debug('');
+
+valueSettingTest('auto');
+valueSettingTest('none');
+valueSettingTest('inter-word');
+valueSettingTest('inter-ideograph');
+valueSettingTest('inter-cluster');
+valueSettingTest('distribute');
+valueSettingTest('kashida');
+
+defaultValue = 'auto'
+e.style.webkitTextJustify = defaultValue;
+invalidValueSettingTest('-webkit-left', defaultValue);
+invalidValueSettingTest('-webkit-right', defaultValue);
+invalidValueSettingTest('-webkit-center', defaultValue);
+invalidValueSettingTest('-webkit-match-parent', defaultValue);
+invalidValueSettingTest('-webkit-auto', defaultValue);
+invalidValueSettingTest('solid', defaultValue);
+invalidValueSettingTest('normal', defaultValue);
+invalidValueSettingTest('bold', defaultValue);
+invalidValueSettingTest('background', defaultValue);
+invalidValueSettingTest('ltr', defaultValue);
+
+computedValueSettingTest('inherit', 'auto');
+computedValueSettingTest('initial', 'auto');
index 713ee66..20d5bce 100644 (file)
@@ -1165,6 +1165,7 @@ webkit.org/b/89052 fast/css/image-orientation
 # CSS3 Text support is not yet enabled (needs ENABLE_CSS3_TEXT).
 webkit.org/b/58491 fast/css3-text/css3-text-decoration
 webkit.org/b/76173 fast/css3-text/css3-text-align-last
+webkit.org/b/99945 fast/css3-text/css3-text-justify [ Failure ]
 webkit.org/b/112755 fast/css3-text/css3-text-indent [ Failure ImageOnlyFailure ]
 
 # Our slow tests, in alphabetical order.
index 514d085..75660b7 100644 (file)
@@ -5797,6 +5797,7 @@ webkit.org/b/89052 fast/css/image-orientation
 # CSS3 Text support is not yet enabled (needs ENABLE_CSS3_TEXT).
 webkit.org/b/58491 fast/css3-text/css3-text-decoration
 webkit.org/b/76173 fast/css3-text/css3-text-align-last
+webkit.org/b/99945 fast/css3-text/css3-text-justify [ Failure ]
 webkit.org/b/112755 fast/css3-text/css3-text-indent [ Failure ImageOnlyFailure ]
 
 # Needs rebaseline after bug 86441
index 2b5af9b..2ec13ce 100644 (file)
@@ -351,6 +351,7 @@ webkit.org/b/89052 fast/css/image-orientation
 # CSS3 Text support is not yet enabled (needs ENABLE_CSS3_TEXT).
 webkit.org/b/58491 fast/css3-text/css3-text-decoration
 webkit.org/b/76173 fast/css3-text/css3-text-align-last
+webkit.org/b/99945 fast/css3-text/css3-text-justify [ Failure ]
 webkit.org/b/112755 fast/css3-text/css3-text-indent [ Failure ImageOnlyFailure ]
 
 # Web Inspector: Implement support for InspectorClient::overrideDeviceMetrics() in platforms other than Chromium
index b1ced36..ee78fbf 100644 (file)
@@ -1,3 +1,46 @@
+2013-04-09  Dongwoo Joshua Im  <dw.im@samsung.com>
+
+        [CSS3] Parsing the property, text-justify.
+        https://bugs.webkit.org/show_bug.cgi?id=100058
+
+        Reviewed by Andreas Kling.
+
+        This patch implements the parsing side of the "text-justify" property specified
+        in CSS3 working draft, with "-webkit-" prefix, under ENABLE_CSS3_TEXT flag.
+        Specification link : http://www.w3.org/TR/css3-text/#text-justify
+
+        Tests: fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify-inherited.html
+               fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify.html
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore):
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+        * css/CSSParser.cpp:
+        (WebCore::isValidKeywordPropertyAndValue):
+        (WebCore::isKeywordPropertyID):
+        (WebCore::CSSParser::parseValue):
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore):
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+        (WebCore::CSSPrimitiveValue::operator TextJustify):
+        * css/CSSProperty.cpp:
+        (WebCore::CSSProperty::isInheritedProperty):
+        * css/CSSPropertyNames.in:
+        * css/CSSValueKeywords.in:
+        * css/StyleBuilder.cpp:
+        (WebCore::StyleBuilder::StyleBuilder):
+        * css/StylePropertySet.cpp:
+        (WebCore):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::applyProperty):
+        * rendering/style/RenderStyle.h:
+        * rendering/style/RenderStyleConstants.h:
+        * rendering/style/StyleRareInheritedData.cpp:
+        (WebCore::StyleRareInheritedData::StyleRareInheritedData):
+        (WebCore::StyleRareInheritedData::operator==):
+        * rendering/style/StyleRareInheritedData.h:
+        (StyleRareInheritedData):
+
 2013-04-09  Joone Hur  <joone.hur@intel.com>
 
         [GTK][AC] Adding contentsLayer for image and video
index 77be659..f2066b0 100644 (file)
@@ -192,6 +192,7 @@ static const CSSPropertyID computedProperties[] = {
     CSSPropertyWebkitTextDecorationStyle,
     CSSPropertyWebkitTextDecorationColor,
     CSSPropertyWebkitTextAlignLast,
+    CSSPropertyWebkitTextJustify,
     CSSPropertyWebkitTextUnderlinePosition,
 #endif // CSS3_TEXT
     CSSPropertyTextIndent,
@@ -2161,6 +2162,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
             return currentColorOrValidColor(style.get(), style->textDecorationColor());
         case CSSPropertyWebkitTextAlignLast:
             return cssValuePool().createValue(style->textAlignLast());
+        case CSSPropertyWebkitTextJustify:
+            return cssValuePool().createValue(style->textJustify());
         case CSSPropertyWebkitTextUnderlinePosition:
             return cssValuePool().createValue(style->textUnderlinePosition());
 #endif // CSS3_TEXT
index 7289672..144d956 100644 (file)
@@ -997,6 +997,13 @@ static inline bool isValidKeywordPropertyAndValue(CSSPropertyID propertyId, int
         if (valueID == CSSValueOver || valueID == CSSValueUnder)
             return true;
         break;
+#if ENABLE(CSS3_TEXT)
+    case CSSPropertyWebkitTextJustify:
+        // auto | none | inter-word | inter-ideograph | inter-cluster | distribute | kashida
+        if ((valueID >= CSSValueInterWord && valueID <= CSSValueKashida) || valueID == CSSValueAuto || valueID == CSSValueNone)
+            return true;
+        break;
+#endif // CSS3_TEXT
     case CSSPropertyWebkitTextSecurity:
         // disc | circle | square | none | inherit
         if (valueID == CSSValueDisc || valueID == CSSValueCircle || valueID == CSSValueSquare || valueID == CSSValueNone)
@@ -1152,6 +1159,9 @@ static inline bool isKeywordPropertyID(CSSPropertyID propertyId)
 #endif // CSS3_TEXT
     case CSSPropertyWebkitTextCombine:
     case CSSPropertyWebkitTextEmphasisPosition:
+#if ENABLE(CSS3_TEXT)
+    case CSSPropertyWebkitTextJustify:
+#endif // CSS3_TEXT
     case CSSPropertyWebkitTextSecurity:
     case CSSPropertyWebkitTransformStyle:
     case CSSPropertyWebkitUserDrag:
@@ -3061,6 +3071,9 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important)
 #endif // CSS3_TEXT
     case CSSPropertyWebkitTextCombine:
     case CSSPropertyWebkitTextEmphasisPosition:
+#if ENABLE(CSS3_TEXT)
+    case CSSPropertyWebkitTextJustify:
+#endif // CSS3_TEXT
     case CSSPropertyWebkitTextSecurity:
     case CSSPropertyWebkitTransformStyle:
     case CSSPropertyWebkitUserDrag:
index 66c0082..b79a4e7 100644 (file)
@@ -2357,6 +2357,58 @@ template<> inline CSSPrimitiveValue::operator TextAlignLast() const
     ASSERT_NOT_REACHED();
     return TextAlignLastAuto;
 }
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextJustify e)
+    : CSSValue(PrimitiveClass)
+{
+    m_primitiveUnitType = CSS_IDENT;
+    switch (e) {
+    case TextJustifyAuto:
+        m_value.ident = CSSValueAuto;
+        break;
+    case TextJustifyNone:
+        m_value.ident = CSSValueNone;
+        break;
+    case TextJustifyInterWord:
+        m_value.ident = CSSValueInterWord;
+        break;
+    case TextJustifyInterIdeograph:
+        m_value.ident = CSSValueInterIdeograph;
+        break;
+    case TextJustifyInterCluster:
+        m_value.ident = CSSValueInterCluster;
+        break;
+    case TextJustifyDistribute:
+        m_value.ident = CSSValueDistribute;
+        break;
+    case TextJustifyKashida:
+        m_value.ident = CSSValueKashida;
+        break;
+    }
+}
+
+template<> inline CSSPrimitiveValue::operator TextJustify() const
+{
+    switch (m_value.ident) {
+    case CSSValueAuto:
+        return TextJustifyAuto;
+    case CSSValueNone:
+        return TextJustifyNone;
+    case CSSValueInterWord:
+        return TextJustifyInterWord;
+    case CSSValueInterIdeograph:
+        return TextJustifyInterIdeograph;
+    case CSSValueInterCluster:
+        return TextJustifyInterCluster;
+    case CSSValueDistribute:
+        return TextJustifyDistribute;
+    case CSSValueKashida:
+        return TextJustifyKashida;
+    }
+
+    ASSERT_NOT_REACHED();
+    return TextJustifyAuto;
+}
 #endif // CSS3_TEXT
 
 template<> inline CSSPrimitiveValue::operator ETextDecoration() const
index 77735c4..8a6b7ea 100644 (file)
@@ -332,6 +332,7 @@ bool CSSProperty::isInheritedProperty(CSSPropertyID propertyID)
 #if ENABLE(CSS3_TEXT)
     case CSSPropertyWebkitTextDecorationLine:
     case CSSPropertyWebkitTextAlignLast:
+    case CSSPropertyWebkitTextJustify:
     case CSSPropertyWebkitTextUnderlinePosition:
 #endif // CSS3_TEXT
     case CSSPropertyWebkitTextDecorationsInEffect:
index 85aacd9..23907e1 100644 (file)
@@ -375,6 +375,7 @@ z-index
 -webkit-text-decoration-style
 -webkit-text-decoration-color
 -webkit-text-align-last
+-webkit-text-justify
 -webkit-text-underline-position
 #endif
 -webkit-text-decorations-in-effect
index de8930f..25e0277 100644 (file)
@@ -220,6 +220,16 @@ justify
 -webkit-center
 -webkit-match-parent
 //
+// CSS_PROP_TEXT_JUSTIFY:
+//
+//auto
+//none
+inter-word
+inter-ideograph
+inter-cluster
+distribute
+kashida
+//
 // CSS_PROP_LIST_STYLE_POSITION:
 //
 outside
index 4758b3c..1c3a07b 100644 (file)
@@ -2187,6 +2187,7 @@ StyleBuilder::StyleBuilder()
     setPropertyHandler(CSSPropertyWebkitTextDecorationStyle, ApplyPropertyDefault<TextDecorationStyle, &RenderStyle::textDecorationStyle, TextDecorationStyle, &RenderStyle::setTextDecorationStyle, TextDecorationStyle, &RenderStyle::initialTextDecorationStyle>::createHandler());
     setPropertyHandler(CSSPropertyWebkitTextDecorationColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textDecorationColor, &RenderStyle::setTextDecorationColor, &RenderStyle::setVisitedLinkTextDecorationColor, &RenderStyle::color>::createHandler());
     setPropertyHandler(CSSPropertyWebkitTextAlignLast, ApplyPropertyDefault<TextAlignLast, &RenderStyle::textAlignLast, TextAlignLast, &RenderStyle::setTextAlignLast, TextAlignLast, &RenderStyle::initialTextAlignLast>::createHandler());
+    setPropertyHandler(CSSPropertyWebkitTextJustify, ApplyPropertyDefault<TextJustify, &RenderStyle::textJustify, TextJustify, &RenderStyle::setTextJustify, TextJustify, &RenderStyle::initialTextJustify>::createHandler());
     setPropertyHandler(CSSPropertyWebkitTextUnderlinePosition, ApplyPropertyTextUnderlinePosition::createHandler());
 #endif // CSS3_TEXT
     setPropertyHandler(CSSPropertyTextIndent, ApplyPropertyTextIndent::createHandler());
index 60a9b57..460a37f 100644 (file)
@@ -1097,6 +1097,7 @@ static const CSSPropertyID blockProperties[] = {
     CSSPropertyTextAlign,
 #if ENABLE(CSS3_TEXT)
     CSSPropertyWebkitTextAlignLast,
+    CSSPropertyWebkitTextJustify,
 #endif // CSS3_TEXT
     CSSPropertyTextIndent,
     CSSPropertyWidows
index 20231cd..ae876be 100644 (file)
@@ -3118,6 +3118,7 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
     case CSSPropertyWebkitTextDecorationStyle:
     case CSSPropertyWebkitTextDecorationColor:
     case CSSPropertyWebkitTextAlignLast:
+    case CSSPropertyWebkitTextJustify:
     case CSSPropertyWebkitTextUnderlinePosition:
 #endif // CSS3_TEXT
     case CSSPropertyWebkitTextEmphasisColor:
index a8df7f0..14b6352 100644 (file)
@@ -578,6 +578,7 @@ public:
 #if ENABLE(CSS3_TEXT)
     TextDecorationStyle textDecorationStyle() const { return static_cast<TextDecorationStyle>(rareNonInheritedData->m_textDecorationStyle); }
     TextAlignLast textAlignLast() const { return static_cast<TextAlignLast>(rareInheritedData->m_textAlignLast); }
+    TextJustify textJustify() const { return static_cast<TextJustify>(rareInheritedData->m_textJustify); }
     TextUnderlinePosition textUnderlinePosition() const { return static_cast<TextUnderlinePosition>(rareInheritedData->m_textUnderlinePosition); }
 #else
     TextDecorationStyle textDecorationStyle() const { return TextDecorationStyleSolid; }
@@ -1146,6 +1147,7 @@ public:
 #if ENABLE(CSS3_TEXT)
     void setTextDecorationStyle(TextDecorationStyle v) { SET_VAR(rareNonInheritedData, m_textDecorationStyle, v); }
     void setTextAlignLast(TextAlignLast v) { SET_VAR(rareInheritedData, m_textAlignLast, v); }
+    void setTextJustify(TextJustify v) { SET_VAR(rareInheritedData, m_textJustify, v); }
     void setTextUnderlinePosition(TextUnderlinePosition v) { SET_VAR(rareInheritedData, m_textUnderlinePosition, v); }
 #endif // CSS3_TEXT
     void setDirection(TextDirection v) { inherited_flags._direction = v; }
@@ -1629,6 +1631,7 @@ public:
 #if ENABLE(CSS3_TEXT)
     static TextDecorationStyle initialTextDecorationStyle() { return TextDecorationStyleSolid; }
     static TextAlignLast initialTextAlignLast() { return TextAlignLastAuto; }
+    static TextJustify initialTextJustify() { return TextJustifyAuto; }
     static TextUnderlinePosition initialTextUnderlinePosition() { return TextUnderlinePositionAuto; }
 #endif // CSS3_TEXT
     static float initialZoom() { return 1.0f; }
index eaf7511..ce932dd 100644 (file)
@@ -363,6 +363,10 @@ enum TextUnderlinePosition {
     // FIXME: Implement support for 'under left' and 'under right' values.
     TextUnderlinePositionAuto = 0x1, TextUnderlinePositionAlphabetic = 0x2, TextUnderlinePositionUnder = 0x4
 };
+
+enum TextJustify {
+    TextJustifyAuto, TextJustifyNone, TextJustifyInterWord, TextJustifyInterIdeograph, TextJustifyInterCluster, TextJustifyDistribute, TextJustifyKashida
+};
 #endif // CSS3_TEXT
 
 enum EPageBreak {
index 8310844..992f834 100644 (file)
@@ -106,6 +106,7 @@ StyleRareInheritedData::StyleRareInheritedData()
 #endif
 #if ENABLE(CSS3_TEXT)
     , m_textAlignLast(RenderStyle::initialTextAlignLast())
+    , m_textJustify(RenderStyle::initialTextJustify())
     , m_textUnderlinePosition(RenderStyle::initialTextUnderlinePosition())
 #endif // CSS3_TEXT
     , m_rubyPosition(RenderStyle::initialRubyPosition())
@@ -179,6 +180,7 @@ StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedData& o)
 #endif
 #if ENABLE(CSS3_TEXT)
     , m_textAlignLast(o.m_textAlignLast)
+    , m_textJustify(o.m_textJustify)
     , m_textUnderlinePosition(o.m_textUnderlinePosition)
 #endif // CSS3_TEXT
     , m_rubyPosition(o.m_rubyPosition)
@@ -278,6 +280,7 @@ bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const
 #endif
 #if ENABLE(CSS3_TEXT)
         && m_textAlignLast == o.m_textAlignLast
+        && m_textJustify == o.m_textJustify
         && m_textUnderlinePosition == o.m_textUnderlinePosition
 #endif // CSS3_TEXT
         && m_rubyPosition == o.m_rubyPosition
index 2566de9..50c3c44 100644 (file)
@@ -120,6 +120,7 @@ public:
 #endif
 #if ENABLE(CSS3_TEXT)
     unsigned m_textAlignLast : 3; // TextAlignLast
+    unsigned m_textJustify : 3; // TextJustify
     unsigned m_textUnderlinePosition : 3; // TextUnderlinePosition
 #endif // CSS3_TEXT
     unsigned m_rubyPosition : 1; // RubyPosition