[CSS3] Parsing the property, text-align-last.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Nov 2012 06:37:55 +0000 (06:37 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Nov 2012 06:37:55 +0000 (06:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=99439

Patch by Dongwoo Joshua Im <dw.im@samsung.com> on 2012-11-11
Reviewed by Julien Chaffraix.

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

Source/WebCore:

Tests: fast/css3-text/css3-text-align-last/getComputedStyle/getComputedStyle-text-align-last-inherited.html
       fast/css3-text/css3-text-align-last/getComputedStyle/getComputedStyle-text-align-last.html

* css/CSSComputedStyleDeclaration.cpp:
(WebCore):
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Get the value of the text-align-last property.
* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue): Parse the value, and check whether it is a proper value which text-align-last can have.
* css/CSSPrimitiveValueMappings.h:
(WebCore):
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator ETextAlignLast):
* css/CSSProperty.cpp:
(WebCore::CSSProperty::isInheritedProperty):
* css/CSSPropertyNames.in: Add '-webkit-text-align-last' property.
* 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): Add m_textAlignLast.

LayoutTests:

* fast/css3-text/css3-text-align-last/getComputedStyle/getComputedStyle-text-align-last-inherited.html: Added.
* fast/css3-text/css3-text-align-last/getComputedStyle/getComputedStyle-text-align-last.html: Added.
* fast/css3-text/css3-text-align-last/getComputedStyle/script-tests/getComputedStyle-text-align-last-inherited.js: Added.
(testComputedStyle):
* fast/css3-text/css3-text-align-last/getComputedStyle/script-tests/getComputedStyle-text-align-last.js: Added.
(testElementStyle):
(testComputedStyle):
* platform/chromium/TestExpectations:
* fast/css3-text/css3-text-align-last/getComputedStyle/getComputedStyle-text-align-last-expected.txt: Added.
* fast/css3-text/css3-text-align-last/getComputedStyle/getComputedStyle-text-align-last-inherited-expected.txt: Added.
* platform/mac/TestExpectations:
* platform/qt-4.8/TestExpectations:
* platform/qt-mac/TestExpectations:
* platform/qt/TestExpectations:

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

25 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css3-text/css3-text-align-last/getComputedStyle/getComputedStyle-text-align-last-expected.txt [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-align-last/getComputedStyle/getComputedStyle-text-align-last-inherited-expected.txt [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-align-last/getComputedStyle/getComputedStyle-text-align-last-inherited.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-align-last/getComputedStyle/getComputedStyle-text-align-last.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-align-last/getComputedStyle/script-tests/getComputedStyle-text-align-last-inherited.js [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-align-last/getComputedStyle/script-tests/getComputedStyle-text-align-last.js [new file with mode: 0644]
LayoutTests/platform/chromium/TestExpectations
LayoutTests/platform/mac/TestExpectations
LayoutTests/platform/qt-4.8/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/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 ba50d19..0d2d78b 100644 (file)
@@ -1,3 +1,29 @@
+2012-11-11  Dongwoo Joshua Im  <dw.im@samsung.com>
+
+        [CSS3] Parsing the property, text-align-last.
+        https://bugs.webkit.org/show_bug.cgi?id=99439
+
+        Reviewed by Julien Chaffraix.
+
+        This patch implements the parsing side of the "text-align-last" property specified
+        in CSS3 working draft, with "-webkit-" prefix, under ENABLE_CSS3_TEXT flag.
+        Specification link : http://www.w3.org/TR/css3-text/#text-align-last
+
+        * fast/css3-text/css3-text-align-last/getComputedStyle/getComputedStyle-text-align-last-inherited.html: Added.
+        * fast/css3-text/css3-text-align-last/getComputedStyle/getComputedStyle-text-align-last.html: Added.
+        * fast/css3-text/css3-text-align-last/getComputedStyle/script-tests/getComputedStyle-text-align-last-inherited.js: Added.
+        (testComputedStyle):
+        * fast/css3-text/css3-text-align-last/getComputedStyle/script-tests/getComputedStyle-text-align-last.js: Added.
+        (testElementStyle):
+        (testComputedStyle):
+        * platform/chromium/TestExpectations:
+        * fast/css3-text/css3-text-align-last/getComputedStyle/getComputedStyle-text-align-last-expected.txt: Added.
+        * fast/css3-text/css3-text-align-last/getComputedStyle/getComputedStyle-text-align-last-inherited-expected.txt: Added.
+        * platform/mac/TestExpectations:
+        * platform/qt-4.8/TestExpectations:
+        * platform/qt-mac/TestExpectations:
+        * platform/qt/TestExpectations:
+
 2012-11-11  Keishi Hattori  <keishi@webkit.org>
 
         Rebaseline month/week appearance tests
diff --git a/LayoutTests/fast/css3-text/css3-text-align-last/getComputedStyle/getComputedStyle-text-align-last-expected.txt b/LayoutTests/fast/css3-text/css3-text-align-last/getComputedStyle/getComputedStyle-text-align-last-expected.txt
new file mode 100644 (file)
index 0000000..8127a95
--- /dev/null
@@ -0,0 +1,85 @@
+This test checks that -webkit-text-align-last 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.webkitTextAlignLast is 'auto'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-align-last').cssText is 'auto'
+
+Value 'start':
+PASS e.style.webkitTextAlignLast is 'start'
+PASS e.style.getPropertyCSSValue('-webkit-text-align-last').cssText is 'start'
+PASS computedStyle.webkitTextAlignLast is 'start'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-align-last').cssText is 'start'
+
+Value 'end':
+PASS e.style.webkitTextAlignLast is 'end'
+PASS e.style.getPropertyCSSValue('-webkit-text-align-last').cssText is 'end'
+PASS computedStyle.webkitTextAlignLast is 'end'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-align-last').cssText is 'end'
+
+Value 'left':
+PASS e.style.webkitTextAlignLast is 'left'
+PASS e.style.getPropertyCSSValue('-webkit-text-align-last').cssText is 'left'
+PASS computedStyle.webkitTextAlignLast is 'left'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-align-last').cssText is 'left'
+
+Value 'right':
+PASS e.style.webkitTextAlignLast is 'right'
+PASS e.style.getPropertyCSSValue('-webkit-text-align-last').cssText is 'right'
+PASS computedStyle.webkitTextAlignLast is 'right'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-align-last').cssText is 'right'
+
+Value 'center':
+PASS e.style.webkitTextAlignLast is 'center'
+PASS e.style.getPropertyCSSValue('-webkit-text-align-last').cssText is 'center'
+PASS computedStyle.webkitTextAlignLast is 'center'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-align-last').cssText is 'center'
+
+Value 'justify':
+PASS e.style.webkitTextAlignLast is 'justify'
+PASS e.style.getPropertyCSSValue('-webkit-text-align-last').cssText is 'justify'
+PASS computedStyle.webkitTextAlignLast is 'justify'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-align-last').cssText is 'justify'
+
+Value 'auto':
+PASS e.style.webkitTextAlignLast is 'auto'
+PASS e.style.getPropertyCSSValue('-webkit-text-align-last').cssText is 'auto'
+PASS computedStyle.webkitTextAlignLast is 'auto'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-align-last').cssText is 'auto'
+
+Invalid value test - '-webkit-left':
+PASS e.style.webkitTextAlignLast is 'auto'
+PASS e.style.getPropertyCSSValue('-webkit-text-align-last').cssText is 'auto'
+PASS computedStyle.webkitTextAlignLast is 'auto'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-align-last').cssText is 'auto'
+
+Invalid value test - '-webkit-right':
+PASS e.style.webkitTextAlignLast is 'auto'
+PASS e.style.getPropertyCSSValue('-webkit-text-align-last').cssText is 'auto'
+PASS computedStyle.webkitTextAlignLast is 'auto'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-align-last').cssText is 'auto'
+
+Invalid value test - '-webkit-center':
+PASS e.style.webkitTextAlignLast is 'auto'
+PASS e.style.getPropertyCSSValue('-webkit-text-align-last').cssText is 'auto'
+PASS computedStyle.webkitTextAlignLast is 'auto'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-align-last').cssText is 'auto'
+
+Invalid value test - '-webkit-match-parent':
+PASS e.style.webkitTextAlignLast is 'auto'
+PASS e.style.getPropertyCSSValue('-webkit-text-align-last').cssText is 'auto'
+PASS computedStyle.webkitTextAlignLast is 'auto'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-align-last').cssText is 'auto'
+
+Invalid value test - '-webkit-auto':
+PASS e.style.webkitTextAlignLast is 'auto'
+PASS e.style.getPropertyCSSValue('-webkit-text-align-last').cssText is 'auto'
+PASS computedStyle.webkitTextAlignLast is 'auto'
+PASS computedStyle.getPropertyCSSValue('-webkit-text-align-last').cssText is 'auto'
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+hello world
diff --git a/LayoutTests/fast/css3-text/css3-text-align-last/getComputedStyle/getComputedStyle-text-align-last-inherited-expected.txt b/LayoutTests/fast/css3-text/css3-text-align-last/getComputedStyle/getComputedStyle-text-align-last-inherited-expected.txt
new file mode 100644 (file)
index 0000000..12239e1
--- /dev/null
@@ -0,0 +1,45 @@
+This test checks that the value of -webkit-text-align-last is properly inherited to the child.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Value of ancestor is 'start':
+PASS window.getComputedStyle(ancestor).getPropertyCSSValue('-webkit-text-align-last').cssText is 'start'
+PASS window.getComputedStyle(child).getPropertyCSSValue('-webkit-text-align-last').cssText is 'start'
+
+Value of ancestor is 'end':
+PASS window.getComputedStyle(ancestor).getPropertyCSSValue('-webkit-text-align-last').cssText is 'end'
+PASS window.getComputedStyle(child).getPropertyCSSValue('-webkit-text-align-last').cssText is 'end'
+
+Value of ancestor is 'left':
+PASS window.getComputedStyle(ancestor).getPropertyCSSValue('-webkit-text-align-last').cssText is 'left'
+PASS window.getComputedStyle(child).getPropertyCSSValue('-webkit-text-align-last').cssText is 'left'
+
+Value of ancestor is 'right':
+PASS window.getComputedStyle(ancestor).getPropertyCSSValue('-webkit-text-align-last').cssText is 'right'
+PASS window.getComputedStyle(child).getPropertyCSSValue('-webkit-text-align-last').cssText is 'right'
+
+Value of ancestor is 'center':
+PASS window.getComputedStyle(ancestor).getPropertyCSSValue('-webkit-text-align-last').cssText is 'center'
+PASS window.getComputedStyle(child).getPropertyCSSValue('-webkit-text-align-last').cssText is 'center'
+
+Value of ancestor is 'justify':
+PASS window.getComputedStyle(ancestor).getPropertyCSSValue('-webkit-text-align-last').cssText is 'justify'
+PASS window.getComputedStyle(child).getPropertyCSSValue('-webkit-text-align-last').cssText is 'justify'
+
+Value of ancestor is 'auto':
+PASS window.getComputedStyle(ancestor).getPropertyCSSValue('-webkit-text-align-last').cssText is 'auto'
+PASS window.getComputedStyle(child).getPropertyCSSValue('-webkit-text-align-last').cssText is 'auto'
+
+Value of ancestor is 'start, while child is 'end':
+PASS window.getComputedStyle(ancestor).getPropertyCSSValue('-webkit-text-align-last').cssText is 'start'
+PASS window.getComputedStyle(child).getPropertyCSSValue('-webkit-text-align-last').cssText is 'end'
+
+Value of ancestor is 'left, while child is 'right':
+PASS window.getComputedStyle(ancestor).getPropertyCSSValue('-webkit-text-align-last').cssText is 'left'
+PASS window.getComputedStyle(child).getPropertyCSSValue('-webkit-text-align-last').cssText is 'right'
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+hello world
diff --git a/LayoutTests/fast/css3-text/css3-text-align-last/getComputedStyle/getComputedStyle-text-align-last-inherited.html b/LayoutTests/fast/css3-text/css3-text-align-last/getComputedStyle/getComputedStyle-text-align-last-inherited.html
new file mode 100644 (file)
index 0000000..9139881
--- /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-align-last-inherited.js"></script>
+  <script src="../../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/css3-text/css3-text-align-last/getComputedStyle/getComputedStyle-text-align-last.html b/LayoutTests/fast/css3-text/css3-text-align-last/getComputedStyle/getComputedStyle-text-align-last.html
new file mode 100644 (file)
index 0000000..0f6f87d
--- /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-align-last.js"></script>
+  <script src="../../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/css3-text/css3-text-align-last/getComputedStyle/script-tests/getComputedStyle-text-align-last-inherited.js b/LayoutTests/fast/css3-text/css3-text-align-last/getComputedStyle/script-tests/getComputedStyle-text-align-last-inherited.js
new file mode 100644 (file)
index 0000000..b51243d
--- /dev/null
@@ -0,0 +1,37 @@
+function testComputedStyle(a_value, c_value)
+{
+    shouldBe("window.getComputedStyle(ancestor).getPropertyCSSValue('-webkit-text-align-last').cssText",  "'" + a_value + "'");
+    shouldBe("window.getComputedStyle(child).getPropertyCSSValue('-webkit-text-align-last').cssText",  "'" + c_value + "'");
+    debug('');
+}
+
+function ownValueTest(a_value, c_value)
+{
+    debug("Value of ancestor is '" + a_value + ", while child is '" + c_value + "':");
+    ancestor.style.webkitTextAlignLast = a_value;
+    child.style.webkitTextAlignLast = c_value;
+    testComputedStyle(a_value, c_value);
+}
+
+function inheritanceTest(a_value)
+{
+    debug("Value of ancestor is '" + a_value + "':");
+    ancestor.style.webkitTextAlignLast = a_value;
+    testComputedStyle(a_value, a_value);
+}
+
+description("This test checks that the value of -webkit-text-align-last is properly inherited to the child.");
+
+ancestor = document.getElementById('ancestor');
+child = document.getElementById('child');
+
+inheritanceTest("start");
+inheritanceTest("end");
+inheritanceTest("left");
+inheritanceTest("right");
+inheritanceTest("center");
+inheritanceTest("justify");
+inheritanceTest("auto");
+
+ownValueTest("start", "end");
+ownValueTest("left", "right");
diff --git a/LayoutTests/fast/css3-text/css3-text-align-last/getComputedStyle/script-tests/getComputedStyle-text-align-last.js b/LayoutTests/fast/css3-text/css3-text-align-last/getComputedStyle/script-tests/getComputedStyle-text-align-last.js
new file mode 100644 (file)
index 0000000..9521a0c
--- /dev/null
@@ -0,0 +1,54 @@
+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.webkitTextAlignLast = value;
+    testElementStyle("webkitTextAlignLast", "-webkit-text-align-last", "[object CSSPrimitiveValue]", value);
+    testComputedStyle("webkitTextAlignLast", "-webkit-text-align-last", "[object CSSPrimitiveValue]", value);
+    debug('');
+}
+
+function invalidValueSettingTest(value, defaultValue)
+{
+    debug("Invalid value test - '" + value + "':");
+    e.style.webkitTextAlignLast = value;
+    testElementStyle("webkitTextAlignLast", "-webkit-text-align-last", "[object CSSPrimitiveValue]", defaultValue);
+    testComputedStyle("webkitTextAlignLast", "-webkit-text-align-last", "[object CSSPrimitiveValue]", defaultValue);
+    debug('');
+}
+
+description("This test checks that -webkit-text-align-last parses properly the properties from CSS 3 Text.");
+
+e = document.getElementById('test');
+
+debug("Test the initial value:");
+testComputedStyle("webkitTextAlignLast", "-webkit-text-align-last", "[object CSSPrimitiveValue]", 'auto');
+debug('');
+
+valueSettingTest('start');
+valueSettingTest('end');
+valueSettingTest('left');
+valueSettingTest('right');
+valueSettingTest('center');
+valueSettingTest('justify');
+valueSettingTest('auto');
+
+defaultValue = 'auto'
+e.style.webkitTextAlignLast = defaultValue;
+invalidValueSettingTest('-webkit-left', defaultValue);
+invalidValueSettingTest('-webkit-right', defaultValue);
+invalidValueSettingTest('-webkit-center', defaultValue);
+invalidValueSettingTest('-webkit-match-parent', defaultValue);
+invalidValueSettingTest('-webkit-auto', defaultValue);
index 23fab07..ee40bd3 100644 (file)
@@ -201,6 +201,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
 
 # Chromium does not support smart pasting in text controls yet.
 webkit.org/b/60830 editing/pasteboard/smart-paste-in-text-control.html
index e6775bd..bf8acff 100644 (file)
@@ -985,6 +985,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
 
 # Our slow tests, in alphabetical order.
 webkit.org/b/57672 http/tests/local/fileapi/send-sliced-dragged-file.html [ Failure Pass ]
index d90f421..e0b2975 100644 (file)
@@ -707,6 +707,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
 
 # Needs rebaseline after bug 86441
 # failing new tests
index c51def7..e8fa342 100644 (file)
@@ -5806,6 +5806,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
 
 # Needs rebaseline after bug 86441
 # failing new tests
index 1c35376..5ae5dd4 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
 
 # Web Inspector: Implement support for InspectorClient::overrideDeviceMetrics() in platforms other than Chromium
 # https://bugs.webkit.org/show_bug.cgi?id=82886
index 0859789..bda796a 100644 (file)
@@ -1,3 +1,43 @@
+2012-11-11  Dongwoo Joshua Im  <dw.im@samsung.com>
+
+        [CSS3] Parsing the property, text-align-last.
+        https://bugs.webkit.org/show_bug.cgi?id=99439
+
+        Reviewed by Julien Chaffraix.
+
+        This patch implements the parsing side of the "text-align-last" property specified
+        in CSS3 working draft, with "-webkit-" prefix, under ENABLE_CSS3_TEXT flag.
+        Specification link : http://www.w3.org/TR/css3-text/#text-align-last
+
+        Tests: fast/css3-text/css3-text-align-last/getComputedStyle/getComputedStyle-text-align-last-inherited.html
+               fast/css3-text/css3-text-align-last/getComputedStyle/getComputedStyle-text-align-last.html
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore):
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Get the value of the text-align-last property.
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseValue): Parse the value, and check whether it is a proper value which text-align-last can have.
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore):
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+        (WebCore::CSSPrimitiveValue::operator ETextAlignLast):
+        * css/CSSProperty.cpp:
+        (WebCore::CSSProperty::isInheritedProperty):
+        * css/CSSPropertyNames.in: Add '-webkit-text-align-last' property.
+        * 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): Add m_textAlignLast.
+
 2012-11-11  Shinya Kawanaka  <shinyak@chromium.org>
 
         [Refactoring] Remove shadowPseudoId() and use setPseudo() in HTMLKeygenElement
index 1e6d207..f575d6c 100644 (file)
@@ -183,6 +183,7 @@ static const CSSPropertyID computedProperties[] = {
 #if ENABLE(CSS3_TEXT)
     CSSPropertyWebkitTextDecorationLine,
     CSSPropertyWebkitTextDecorationStyle,
+    CSSPropertyWebkitTextAlignLast,
 #endif // CSS3_TEXT
     CSSPropertyTextIndent,
     CSSPropertyTextRendering,
@@ -2036,6 +2037,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
             return renderTextDecorationFlagsToCSSValue(style->textDecoration());
         case CSSPropertyWebkitTextDecorationStyle:
             return renderTextDecorationStyleFlagsToCSSValue(style->textDecorationStyle());
+        case CSSPropertyWebkitTextAlignLast:
+            return cssValuePool().createValue(style->textAlignLast());
 #endif // CSS3_TEXT
         case CSSPropertyWebkitTextDecorationsInEffect:
             return renderTextDecorationFlagsToCSSValue(style->textDecorationsInEffect());
index 7ab7387..708fb6c 100644 (file)
@@ -1865,6 +1865,14 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important)
         }
         break;
 
+#if ENABLE(CSS3_TEXT)
+    case CSSPropertyWebkitTextAlignLast:
+        // auto | start | end | left | right | center | justify
+        if ((id >= CSSValueLeft && id <= CSSValueJustify) || id == CSSValueStart || id == CSSValueEnd || id == CSSValueAuto)
+            validPrimitive = true;
+        break;
+#endif // CSS3_TEXT
+
     case CSSPropertyCursor: {
         // [<uri>,]*  [ auto | crosshair | default | pointer | progress | move | e-resize | ne-resize |
         // nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize | ew-resize |
index 9b198aa..22f9fb7 100644 (file)
@@ -2199,6 +2199,60 @@ template<> inline CSSPrimitiveValue::operator ETextAlign() const
     }
 }
 
+#if ENABLE(CSS3_TEXT)
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextAlignLast e)
+    : CSSValue(PrimitiveClass)
+{
+    m_primitiveUnitType = CSS_IDENT;
+    switch (e) {
+    case TextAlignLastStart:
+        m_value.ident = CSSValueStart;
+        break;
+    case TextAlignLastEnd:
+        m_value.ident = CSSValueEnd;
+        break;
+    case TextAlignLastLeft:
+        m_value.ident = CSSValueLeft;
+        break;
+    case TextAlignLastRight:
+        m_value.ident = CSSValueRight;
+        break;
+    case TextAlignLastCenter:
+        m_value.ident = CSSValueCenter;
+        break;
+    case TextAlignLastJustify:
+        m_value.ident = CSSValueJustify;
+        break;
+    case TextAlignLastAuto:
+        m_value.ident = CSSValueAuto;
+        break;
+    }
+}
+
+template<> inline CSSPrimitiveValue::operator ETextAlignLast() const
+{
+    switch (m_value.ident) {
+    case CSSValueAuto:
+        return TextAlignLastAuto;
+    case CSSValueStart:
+        return TextAlignLastStart;
+    case CSSValueEnd:
+        return TextAlignLastEnd;
+    case CSSValueLeft:
+        return TextAlignLastLeft;
+    case CSSValueRight:
+        return TextAlignLastRight;
+    case CSSValueCenter:
+        return TextAlignLastCenter;
+    case CSSValueJustify:
+        return TextAlignLastJustify;
+    }
+
+    ASSERT_NOT_REACHED();
+    return TextAlignLastAuto;
+}
+#endif // CSS3_TEXT
+
 template<> inline CSSPrimitiveValue::operator ETextDecoration() const
 {
     switch (m_value.ident) {
index 79be67b..1f12187 100644 (file)
@@ -327,6 +327,7 @@ bool CSSProperty::isInheritedProperty(CSSPropertyID propertyID)
     case CSSPropertyWebkitTextCombine:
 #if ENABLE(CSS3_TEXT)
     case CSSPropertyWebkitTextDecorationLine:
+    case CSSPropertyWebkitTextAlignLast:
 #endif // CSS3_TEXT
     case CSSPropertyWebkitTextDecorationsInEffect:
     case CSSPropertyWebkitTextEmphasis:
index 7f699e3..3fdbbb8 100644 (file)
@@ -357,6 +357,7 @@ z-index
 #if defined(ENABLE_CSS3_TEXT) && ENABLE_CSS3_TEXT
 -webkit-text-decoration-line
 -webkit-text-decoration-style
+-webkit-text-align-last
 #endif
 -webkit-text-decorations-in-effect
 -webkit-text-emphasis
index 0501dc9..a42a1b1 100644 (file)
@@ -1919,6 +1919,7 @@ StyleBuilder::StyleBuilder()
 #if ENABLE(CSS3_TEXT)
     setPropertyHandler(CSSPropertyWebkitTextDecorationLine, ApplyPropertyTextDecoration::createHandler());
     setPropertyHandler(CSSPropertyWebkitTextDecorationStyle, ApplyPropertyDefault<TextDecorationStyle, &RenderStyle::textDecorationStyle, TextDecorationStyle, &RenderStyle::setTextDecorationStyle, TextDecorationStyle, &RenderStyle::initialTextDecorationStyle>::createHandler());
+    setPropertyHandler(CSSPropertyWebkitTextAlignLast, ApplyPropertyDefault<ETextAlignLast, &RenderStyle::textAlignLast, ETextAlignLast, &RenderStyle::setTextAlignLast, ETextAlignLast, &RenderStyle::initialTextAlignLast>::createHandler());
 #endif // CSS3_TEXT
     setPropertyHandler(CSSPropertyTextIndent, ApplyPropertyLength<&RenderStyle::textIndent, &RenderStyle::setTextIndent, &RenderStyle::initialTextIndent>::createHandler());
     setPropertyHandler(CSSPropertyTextOverflow, ApplyPropertyDefault<TextOverflow, &RenderStyle::textOverflow, TextOverflow, &RenderStyle::setTextOverflow, TextOverflow, &RenderStyle::initialTextOverflow>::createHandler());
index 110b802..76dd612 100644 (file)
@@ -974,6 +974,9 @@ static const CSSPropertyID blockProperties[] = {
     CSSPropertyWebkitRegionBreakInside,
 #endif
     CSSPropertyTextAlign,
+#if ENABLE(CSS3_TEXT)
+    CSSPropertyWebkitTextAlignLast,
+#endif // CSS3_TEXT
     CSSPropertyTextIndent,
     CSSPropertyWidows
 };
index 4d7822f..f18fd6a 100644 (file)
@@ -3852,6 +3852,7 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
 #if ENABLE(CSS3_TEXT)
     case CSSPropertyWebkitTextDecorationLine:
     case CSSPropertyWebkitTextDecorationStyle:
+    case CSSPropertyWebkitTextAlignLast:
 #endif // CSS3_TEXT
     case CSSPropertyWebkitTextEmphasisColor:
     case CSSPropertyWebkitTextEmphasisPosition:
index a1db870..65dcfd8 100644 (file)
@@ -619,6 +619,7 @@ public:
     ETextDecoration textDecoration() const { return static_cast<ETextDecoration>(visual->textDecoration); }
 #if ENABLE(CSS3_TEXT)
     TextDecorationStyle textDecorationStyle() const { return static_cast<TextDecorationStyle>(rareNonInheritedData->m_textDecorationStyle); }
+    ETextAlignLast textAlignLast() const { return static_cast<ETextAlignLast>(rareInheritedData->m_textAlignLast); }
 #else
     TextDecorationStyle textDecorationStyle() const { return TextDecorationStyleSolid; }
 #endif // CSS3_TEXT
@@ -1152,6 +1153,7 @@ public:
     void setTextDecoration(ETextDecoration v) { SET_VAR(visual, textDecoration, v); }
 #if ENABLE(CSS3_TEXT)
     void setTextDecorationStyle(TextDecorationStyle v) { SET_VAR(rareNonInheritedData, m_textDecorationStyle, v); }
+    void setTextAlignLast(ETextAlignLast v) { SET_VAR(rareInheritedData, m_textAlignLast, v) }
 #endif // CSS3_TEXT
     void setDirection(TextDirection v) { inherited_flags._direction = v; }
     void setLineHeight(Length specifiedLineHeight);
@@ -1611,6 +1613,7 @@ public:
     static ETextDecoration initialTextDecoration() { return TDNONE; }
 #if ENABLE(CSS3_TEXT)
     static TextDecorationStyle initialTextDecorationStyle() { return TextDecorationStyleSolid; }
+    static ETextAlignLast initialTextAlignLast() { return TextAlignLastAuto; }
 #endif // CSS3_TEXT
     static float initialZoom() { return 1.0f; }
     static int initialOutlineOffset() { return 0; }
index f9f3209..72e0c4c 100644 (file)
@@ -346,6 +346,12 @@ enum TextDecorationStyle {
 #endif // CSS3_TEXT
 };
 
+#if ENABLE(CSS3_TEXT)
+enum ETextAlignLast {
+    TextAlignLastAuto, TextAlignLastStart, TextAlignLastEnd, TextAlignLastLeft, TextAlignLastRight, TextAlignLastCenter, TextAlignLastJustify
+};
+#endif // CSS3_TEXT
+
 enum EPageBreak {
     PBAUTO, PBALWAYS, PBAVOID
 };
index 1680221..b1ba598 100644 (file)
@@ -95,6 +95,9 @@ StyleRareInheritedData::StyleRareInheritedData()
     , m_imageResolutionSource(RenderStyle::initialImageResolutionSource())
     , m_imageResolutionSnap(RenderStyle::initialImageResolutionSnap())
 #endif
+#if ENABLE(CSS3_TEXT)
+    , m_textAlignLast(RenderStyle::initialTextAlignLast())
+#endif // CSS3_TEXT
     , hyphenationLimitBefore(-1)
     , hyphenationLimitAfter(-1)
     , hyphenationLimitLines(-1)
@@ -157,6 +160,9 @@ StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedData& o)
     , m_imageResolutionSource(o.m_imageResolutionSource)
     , m_imageResolutionSnap(o.m_imageResolutionSnap)
 #endif
+#if ENABLE(CSS3_TEXT)
+    , m_textAlignLast(o.m_textAlignLast)
+#endif // CSS3_TEXT
     , hyphenationString(o.hyphenationString)
     , hyphenationLimitBefore(o.hyphenationLimitBefore)
     , hyphenationLimitAfter(o.hyphenationLimitAfter)
@@ -246,6 +252,9 @@ bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const
         && m_imageResolutionSnap == o.m_imageResolutionSnap
         && m_imageResolution == o.m_imageResolution
 #endif
+#if ENABLE(CSS3_TEXT)
+        && m_textAlignLast == o.m_textAlignLast
+#endif // CSS3_TEXT
         && m_lineSnap == o.m_lineSnap
 #if ENABLE(CSS_VARIABLES)
         && m_variables == o.m_variables
index a34dfb2..d07e04c 100644 (file)
@@ -110,6 +110,9 @@ public:
     unsigned m_imageResolutionSource : 1; // ImageResolutionSource
     unsigned m_imageResolutionSnap : 1; // ImageResolutionSnap
 #endif
+#if ENABLE(CSS3_TEXT)
+    unsigned m_textAlignLast : 3; // ETextAlignLast
+#endif // CSS3_TEXT
 
     AtomicString hyphenationString;
     short hyphenationLimitBefore;