Title: [164061] trunk
Revision
164061
Author
commit-qu...@webkit.org
Date
2014-02-13 15:02:31 -0800 (Thu, 13 Feb 2014)

Log Message

[css3-text] Support -webkit-text-decoration-skip: objects
https://bugs.webkit.org/show_bug.cgi?id=128723

Patch by Yuki Sekiguchi <yuki.sekigu...@access-company.com> on 2014-02-13
Reviewed by Dean Jackson.

Source/WebCore:

Implemented 'objects' value of text-decoration-skip.
http://www.w3.org/TR/2013/CR-css-text-decor-3-20130801/#text-decoration-skip

This is initial value and same behavior without
ENABLE_CSS3_TEXT_DECORATION_SKIP_INK flag. Threfore, this patch only
added parser code and constant for 'objects'.

Changed the initial value of text-decoration-skip.

The current implementation parses 'none', but the rendering code is
not match the spec, so this patch added FIXME to the rendering code.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::renderTextDecorationSkipFlagsToCSSValue):
* css/CSSParser.cpp:
(WebCore::CSSParser::parseTextDecorationSkip):
* css/CSSValueKeywords.in:
* css/DeprecatedStyleBuilder.cpp:
(WebCore::valueToDecorationSkip):
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paintDecoration):
* rendering/style/RenderStyle.h:
* rendering/style/RenderStyleConstants.h:

LayoutTests:

Added 'objects' value to the current test case.
Added getComputedStyle() test to test renderTextDecorationSkipFlagsToCSSValue() code.

* fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-roundtrip-expected.txt:
* fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-roundtrip.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (164060 => 164061)


--- trunk/LayoutTests/ChangeLog	2014-02-13 22:59:40 UTC (rev 164060)
+++ trunk/LayoutTests/ChangeLog	2014-02-13 23:02:31 UTC (rev 164061)
@@ -1,3 +1,16 @@
+2014-02-13  Yuki Sekiguchi  <yuki.sekigu...@access-company.com>
+
+        [css3-text] Support -webkit-text-decoration-skip: objects
+        https://bugs.webkit.org/show_bug.cgi?id=128723
+
+        Reviewed by Dean Jackson.
+
+        Added 'objects' value to the current test case.
+        Added getComputedStyle() test to test renderTextDecorationSkipFlagsToCSSValue() code.
+
+        * fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-roundtrip-expected.txt:
+        * fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-roundtrip.html:
+
 2014-02-13  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         During a copy, position:fixed gets converted to position:absolute even if only part of the document is selected

Modified: trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-roundtrip-expected.txt (164060 => 164061)


--- trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-roundtrip-expected.txt	2014-02-13 22:59:40 UTC (rev 164060)
+++ trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-roundtrip-expected.txt	2014-02-13 23:02:31 UTC (rev 164061)
@@ -1,26 +1,67 @@
 PASS cssRule.type is cssRule.STYLE_RULE
+PASS declaration.length is 0
+PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is null
+PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "objects"
+PASS cssRule.type is cssRule.STYLE_RULE
 PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "initial"
+PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "objects"
+PASS cssRule.type is cssRule.STYLE_RULE
+PASS declaration.length is 1
 PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "ink"
+PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "ink"
 PASS cssRule.type is cssRule.STYLE_RULE
 PASS declaration.length is 1
 PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "ink"
+PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "ink"
 PASS cssRule.type is cssRule.STYLE_RULE
 PASS declaration.length is 0
+PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "objects"
 PASS cssRule.type is cssRule.STYLE_RULE
 PASS declaration.length is 1
 PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "ink"
+PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "ink"
 PASS cssRule.type is cssRule.STYLE_RULE
 PASS declaration.length is 1
 PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "ink"
+PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "ink"
 PASS cssRule.type is cssRule.STYLE_RULE
 PASS declaration.length is 1
 PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "ink"
+PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "ink"
 PASS cssRule.type is cssRule.STYLE_RULE
 PASS declaration.length is 1
 PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "ink"
+PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "ink"
 PASS cssRule.type is cssRule.STYLE_RULE
 PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "objects"
+PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "objects"
+PASS cssRule.type is cssRule.STYLE_RULE
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "objects"
+PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "objects"
+PASS cssRule.type is cssRule.STYLE_RULE
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "objects"
+PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "objects"
+PASS cssRule.type is cssRule.STYLE_RULE
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "objects"
+PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "objects"
+PASS cssRule.type is cssRule.STYLE_RULE
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "objects"
+PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "objects"
+PASS cssRule.type is cssRule.STYLE_RULE
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "objects"
+PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "objects"
+PASS cssRule.type is cssRule.STYLE_RULE
+PASS declaration.length is 1
 PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "none"
+PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "none"
 PASS cssRule.type is cssRule.STYLE_RULE
 PASS declaration.length is 0
+PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "objects"
 

Modified: trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-roundtrip.html (164060 => 164061)


--- trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-roundtrip.html	2014-02-13 22:59:40 UTC (rev 164060)
+++ trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-roundtrip.html	2014-02-13 23:02:31 UTC (rev 164061)
@@ -4,63 +4,128 @@
 <script src=""
 </head>
 <body>
+  <div class="p"></div>
   <script type="text/_javascript_">
-    function testInkIsValid(stylesheet) {
+    function testInkIsValid(stylesheet, target) {
       cssRule = stylesheet.cssRules.item(0);
       shouldBe("cssRule.type", "cssRule.STYLE_RULE");
       declaration = cssRule.style;
       shouldBe("declaration.length", "1");
       shouldBe("declaration.getPropertyValue('-webkit-text-decoration-skip')", "\"ink\"");
+      computedStyle = window.getComputedStyle(target, null);
+      shouldBe("computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText", "\"ink\"");
       stylesheet.deleteRule(0);
     }
 
-    function testInvalidRule(stylesheet) {
+    function testObjectsIsValid(stylesheet, target) {
       cssRule = stylesheet.cssRules.item(0);
       shouldBe("cssRule.type", "cssRule.STYLE_RULE");
       declaration = cssRule.style;
+      shouldBe("declaration.length", "1");
+      shouldBe("declaration.getPropertyValue('-webkit-text-decoration-skip')", "\"objects\"");
+      computedStyle = window.getComputedStyle(target, null);
+      shouldBe("computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText", "\"objects\"");
+      stylesheet.deleteRule(0);
+    }
+
+    function testEmptyIsObjects(stylesheet, target) {
+      cssRule = stylesheet.cssRules.item(0);
+      shouldBe("cssRule.type", "cssRule.STYLE_RULE");
+      declaration = cssRule.style;
       shouldBe("declaration.length", "0");
+      shouldBe("declaration.getPropertyValue('-webkit-text-decoration-skip')", "null");
+      computedStyle = window.getComputedStyle(target, null);
+      shouldBe("computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText", "\"objects\"");
       stylesheet.deleteRule(0);
     }
 
-    function testNoneIsValid(stylesheet) {
+    function testInitialIsObjects(stylesheet, target) {
       cssRule = stylesheet.cssRules.item(0);
       shouldBe("cssRule.type", "cssRule.STYLE_RULE");
       declaration = cssRule.style;
       shouldBe("declaration.length", "1");
+      shouldBe("declaration.getPropertyValue('-webkit-text-decoration-skip')",  "\"initial\"");
+      computedStyle = window.getComputedStyle(target, null);
+      shouldBe("computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText", "\"objects\"");
+      stylesheet.deleteRule(0);
+    }
+
+    function testInvalidRule(stylesheet, target) {
+      cssRule = stylesheet.cssRules.item(0);
+      shouldBe("cssRule.type", "cssRule.STYLE_RULE");
+      declaration = cssRule.style;
+      shouldBe("declaration.length", "0");
+      computedStyle = window.getComputedStyle(target, null);
+      shouldBe("computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText", "\"objects\"");
+      stylesheet.deleteRule(0);
+    }
+
+    function testNoneIsValid(stylesheet, target) {
+      cssRule = stylesheet.cssRules.item(0);
+      shouldBe("cssRule.type", "cssRule.STYLE_RULE");
+      declaration = cssRule.style;
+      shouldBe("declaration.length", "1");
       shouldBe("declaration.getPropertyValue('-webkit-text-decoration-skip')", "\"none\"");
+      computedStyle = window.getComputedStyle(target, null);
+      shouldBe("computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText", "\"none\"");
       stylesheet.deleteRule(0);
     }
 
     var styleElement = document.createElement("style");
     document.head.appendChild(styleElement);
     stylesheet = styleElement.sheet;
+    var target = document.getElementsByClassName("p")[0];
 
+    stylesheet.insertRule(".p { }", 0);
+    testEmptyIsObjects(stylesheet, target);
+
+    stylesheet.insertRule(".p { -webkit-text-decoration-skip: initial; }", 0);
+    testInitialIsObjects(stylesheet, target);
+
     stylesheet.insertRule(".p { -webkit-text-decoration-skip: ink; }", 0);
-    testInkIsValid(stylesheet);
+    testInkIsValid(stylesheet, target);
 
     stylesheet.insertRule(".p { -webkit-text-decoration-skip: ink ink ink ink ink; }", 0);
-    testInkIsValid(stylesheet);
+    testInkIsValid(stylesheet, target);
 
     stylesheet.insertRule(".p { -webkit-text-decoration-skip: garbage; }", 0);
-    testInvalidRule(stylesheet);
+    testInvalidRule(stylesheet, target);
 
     stylesheet.insertRule(".p { -webkit-text-decoration-skip: garbage ink; }", 0);
-    testInkIsValid(stylesheet);
+    testInkIsValid(stylesheet, target);
 
     stylesheet.insertRule(".p { -webkit-text-decoration-skip: ink garbage; }", 0);
-    testInkIsValid(stylesheet);
+    testInkIsValid(stylesheet, target);
     
     stylesheet.insertRule(".p { -webkit-text-decoration-skip: garbage ink garbage; }", 0);
-    testInkIsValid(stylesheet);
+    testInkIsValid(stylesheet, target);
     
     stylesheet.insertRule(".p { -webkit-text-decoration-skip: ink garbage ink; }", 0);
-    testInkIsValid(stylesheet);
+    testInkIsValid(stylesheet, target);
     
+    stylesheet.insertRule(".p { -webkit-text-decoration-skip: objects; }", 0);
+    testObjectsIsValid(stylesheet, target);
+
+    stylesheet.insertRule(".p { -webkit-text-decoration-skip: objects objects objects objects objects; }", 0);
+    testObjectsIsValid(stylesheet, target);
+
+    stylesheet.insertRule(".p { -webkit-text-decoration-skip: garbage objects; }", 0);
+    testObjectsIsValid(stylesheet, target);
+
+    stylesheet.insertRule(".p { -webkit-text-decoration-skip: objects garbage; }", 0);
+    testObjectsIsValid(stylesheet, target);
+
+    stylesheet.insertRule(".p { -webkit-text-decoration-skip: garbage objects garbage; }", 0);
+    testObjectsIsValid(stylesheet, target);
+
+    stylesheet.insertRule(".p { -webkit-text-decoration-skip: objects garbage objects; }", 0);
+    testObjectsIsValid(stylesheet, target);
+
     stylesheet.insertRule(".p { -webkit-text-decoration-skip: none; }", 0);
-    testNoneIsValid(stylesheet);
+    testNoneIsValid(stylesheet, target);
     
     stylesheet.insertRule(".p { -webkit-text-decoration-skip: ; }", 0);
-    testInvalidRule(stylesheet);
+    testInvalidRule(stylesheet, target);
   </script>
 <script src=""
 </body>

Modified: trunk/Source/WebCore/ChangeLog (164060 => 164061)


--- trunk/Source/WebCore/ChangeLog	2014-02-13 22:59:40 UTC (rev 164060)
+++ trunk/Source/WebCore/ChangeLog	2014-02-13 23:02:31 UTC (rev 164061)
@@ -1,3 +1,34 @@
+2014-02-13  Yuki Sekiguchi  <yuki.sekigu...@access-company.com>
+
+        [css3-text] Support -webkit-text-decoration-skip: objects
+        https://bugs.webkit.org/show_bug.cgi?id=128723
+
+        Reviewed by Dean Jackson.
+
+        Implemented 'objects' value of text-decoration-skip.
+        http://www.w3.org/TR/2013/CR-css-text-decor-3-20130801/#text-decoration-skip
+
+        This is initial value and same behavior without
+        ENABLE_CSS3_TEXT_DECORATION_SKIP_INK flag. Threfore, this patch only
+        added parser code and constant for 'objects'.
+
+        Changed the initial value of text-decoration-skip.
+
+        The current implementation parses 'none', but the rendering code is
+        not match the spec, so this patch added FIXME to the rendering code.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::renderTextDecorationSkipFlagsToCSSValue):
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseTextDecorationSkip):
+        * css/CSSValueKeywords.in:
+        * css/DeprecatedStyleBuilder.cpp:
+        (WebCore::valueToDecorationSkip):
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::paintDecoration):
+        * rendering/style/RenderStyle.h:
+        * rendering/style/RenderStyleConstants.h:
+
 2014-02-13  Daniel Bates  <daba...@apple.com>
 
         Fix ARM NEON build following <http://trac.webkit.org/changeset/164058>

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (164060 => 164061)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2014-02-13 22:59:40 UTC (rev 164060)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2014-02-13 23:02:31 UTC (rev 164061)
@@ -1319,9 +1319,11 @@
 {
     switch (textDecorationSkip) {
     case TextDecorationSkipNone:
-        return cssValuePool().createExplicitInitialValue();
+        return cssValuePool().createIdentifierValue(CSSValueNone);
     case TextDecorationSkipInk:
         return cssValuePool().createIdentifierValue(CSSValueInk);
+    case TextDecorationSkipObjects:
+        return cssValuePool().createIdentifierValue(CSSValueObjects);
     }
 
     ASSERT_NOT_REACHED();

Modified: trunk/Source/WebCore/css/CSSParser.cpp (164060 => 164061)


--- trunk/Source/WebCore/css/CSSParser.cpp	2014-02-13 22:59:40 UTC (rev 164060)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2014-02-13 23:02:31 UTC (rev 164061)
@@ -9460,6 +9460,7 @@
         switch (value->id) {
         case CSSValueNone:
         case CSSValueInk:
+        case CSSValueObjects:
             addProperty(CSSPropertyWebkitTextDecorationSkip, cssValuePool().createIdentifierValue(value->id), important);
             return true;
         default:

Modified: trunk/Source/WebCore/css/CSSValueKeywords.in (164060 => 164061)


--- trunk/Source/WebCore/css/CSSValueKeywords.in	2014-02-13 22:59:40 UTC (rev 164060)
+++ trunk/Source/WebCore/css/CSSValueKeywords.in	2014-02-13 23:02:31 UTC (rev 164061)
@@ -485,6 +485,7 @@
 underline
 wavy
 ink
+objects
 -webkit-nowrap
 
 // CSS3 Values

Modified: trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp (164060 => 164061)


--- trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp	2014-02-13 22:59:40 UTC (rev 164060)
+++ trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp	2014-02-13 23:02:31 UTC (rev 164061)
@@ -1291,6 +1291,8 @@
         return TextDecorationSkipNone;
     case CSSValueInk:
         return TextDecorationSkipInk;
+    case CSSValueObjects:
+        return TextDecorationSkipObjects;
     default:
         break;
     }

Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (164060 => 164061)


--- trunk/Source/WebCore/rendering/InlineTextBox.cpp	2014-02-13 22:59:40 UTC (rev 164060)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp	2014-02-13 23:02:31 UTC (rev 164061)
@@ -1170,6 +1170,7 @@
                             drawSkipInkUnderline(textPainter, context, localOrigin, underlineOffset + doubleOffset, width, isPrinting);
                     }
                 } else {
+                    // FIXME: Need to support text-decoration-skip: none.
 #endif // CSS3_TEXT_DECORATION_SKIP_INK
                     context.drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + underlineOffset), width, isPrinting);
 
@@ -1199,6 +1200,7 @@
                             drawSkipInkUnderline(textPainter, context, localOrigin, -doubleOffset, width, isPrinting);
                     }
                 } else {
+                    // FIXME: Need to support text-decoration-skip: none.
 #endif // CSS3_TEXT_DECORATION_SKIP_INK
                     context.drawLineForText(localOrigin, width, isPrinting);
                     if (decorationStyle == TextDecorationStyleDouble)

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (164060 => 164061)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2014-02-13 22:59:40 UTC (rev 164060)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2014-02-13 23:02:31 UTC (rev 164061)
@@ -1671,7 +1671,7 @@
     static TextJustify initialTextJustify() { return TextJustifyAuto; }
 #endif // CSS3_TEXT
     static TextDecorationStyle initialTextDecorationStyle() { return TextDecorationStyleSolid; }
-    static TextDecorationSkip initialTextDecorationSkip() { return TextDecorationSkipInk; }
+    static TextDecorationSkip initialTextDecorationSkip() { return TextDecorationSkipObjects; }
     static TextUnderlinePosition initialTextUnderlinePosition() { return TextUnderlinePositionAuto; }
     static float initialZoom() { return 1.0f; }
     static int initialOutlineOffset() { return 0; }

Modified: trunk/Source/WebCore/rendering/style/RenderStyleConstants.h (164060 => 164061)


--- trunk/Source/WebCore/rendering/style/RenderStyleConstants.h	2014-02-13 22:59:40 UTC (rev 164060)
+++ trunk/Source/WebCore/rendering/style/RenderStyleConstants.h	2014-02-13 23:02:31 UTC (rev 164061)
@@ -389,7 +389,8 @@
 
 enum TextDecorationSkipItems {
     TextDecorationSkipNone = 0,
-    TextDecorationSkipInk = 1 << 0
+    TextDecorationSkipInk = 1 << 0,
+    TextDecorationSkipObjects = 1 << 1
 };
 typedef unsigned TextDecorationSkip;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to