Implement text-decoration-skip: auto
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Feb 2014 20:08:33 +0000 (20:08 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Feb 2014 20:08:33 +0000 (20:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=128786

Reviewed by Dean Jackson.

http://lists.w3.org/Archives/Public/www-style/2014Feb/0485.html
We are updating the initial value of text-decoration-skip to a new value, "auto".
On Mac + iOS, this will have the same behavior as "skip".

Source/WebCore:

Test: fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-default.html

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

LayoutTests:

* fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-default-expected.txt: Added.
* fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-default.html: Added.
* 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:

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

12 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-default-expected.txt [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-default.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-roundtrip-expected.txt
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-roundtrip.html
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/DeprecatedStyleBuilder.cpp
Source/WebCore/rendering/InlineTextBox.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/RenderStyleConstants.h

index 05af942356e4ef2b6f0d2696316c676c3ff6bb8d..6499054c339c55253302686857e8c99b7a019c12 100644 (file)
@@ -1,3 +1,19 @@
+2014-02-14  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Implement text-decoration-skip: auto
+        https://bugs.webkit.org/show_bug.cgi?id=128786
+
+        Reviewed by Dean Jackson.
+
+        http://lists.w3.org/Archives/Public/www-style/2014Feb/0485.html
+        We are updating the initial value of text-decoration-skip to a new value, "auto".
+        On Mac + iOS, this will have the same behavior as "skip".
+
+        * fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-default-expected.txt: Added.
+        * fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-default.html: Added.
+        * 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-14  Brent Fulgham  <bfulgham@apple.com>
 
         Unreviewed test correction to get bots green.
diff --git a/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-default-expected.txt b/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-default-expected.txt
new file mode 100644 (file)
index 0000000..865faf1
--- /dev/null
@@ -0,0 +1 @@
+auto
diff --git a/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-default.html b/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-default.html
new file mode 100644 (file)
index 0000000..c231dcf
--- /dev/null
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div id="a"></div>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+var d = document.getElementById("a");
+var s = window.getComputedStyle(d);
+var p = s.getPropertyValue("-webkit-text-decoration-skip");
+d.innerHTML = p;
+</script>
+</body>
+</html>
index 47def81359971974945c0a8a9e6d4f8040f2fa3b..b15c5dcde03233840b190e7f3caeeb101fcde81c 100644 (file)
@@ -1,11 +1,11 @@
 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 computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "auto"
 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 computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "auto"
 PASS cssRule.type is cssRule.STYLE_RULE
 PASS declaration.length is 1
 PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "ink"
@@ -16,7 +16,7 @@ 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 computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "auto"
 PASS cssRule.type is cssRule.STYLE_RULE
 PASS declaration.length is 1
 PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "ink"
@@ -63,5 +63,5 @@ 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"
+PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "auto"
 
index 4e6fd0c7115e70d2d61d9c88123c94080941d394..aa67713292a1db26bbffed40f5bb009112f4a087 100644 (file)
       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\"");
+      shouldBe("computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText", "\"auto\"");
       stylesheet.deleteRule(0);
     }
 
-    function testInitialIsObjects(stylesheet, target) {
+    function testInitialIsAuto(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\"");
+      shouldBe("computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText", "\"auto\"");
       stylesheet.deleteRule(0);
     }
 
@@ -56,7 +56,7 @@
       declaration = cssRule.style;
       shouldBe("declaration.length", "0");
       computedStyle = window.getComputedStyle(target, null);
-      shouldBe("computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText", "\"objects\"");
+      shouldBe("computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText", "\"auto\"");
       stylesheet.deleteRule(0);
     }
 
@@ -80,7 +80,7 @@
     testEmptyIsObjects(stylesheet, target);
 
     stylesheet.insertRule(".p { -webkit-text-decoration-skip: initial; }", 0);
-    testInitialIsObjects(stylesheet, target);
+    testInitialIsAuto(stylesheet, target);
 
     stylesheet.insertRule(".p { -webkit-text-decoration-skip: ink; }", 0);
     testInkIsValid(stylesheet, target);
index ceea4efc6a5f6d8dba242e89c21aeef49a6c2631..2307d71d63cd08d0eee16d477af39ab7989e9c44 100644 (file)
@@ -1,3 +1,27 @@
+2014-02-14  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Implement text-decoration-skip: auto
+        https://bugs.webkit.org/show_bug.cgi?id=128786
+
+        Reviewed by Dean Jackson.
+
+        http://lists.w3.org/Archives/Public/www-style/2014Feb/0485.html
+        We are updating the initial value of text-decoration-skip to a new value, "auto".
+        On Mac + iOS, this will have the same behavior as "skip".
+
+        Test: fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-default.html
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::renderTextDecorationSkipFlagsToCSSValue):
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseTextDecorationSkip):
+        * css/DeprecatedStyleBuilder.cpp:
+        (WebCore::valueToDecorationSkip):
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::paintDecoration):
+        * rendering/style/RenderStyle.h:
+        * rendering/style/RenderStyleConstants.h:
+
 2014-02-13  Simon Fraser  <simon.fraser@apple.com>
 
         Give ScrollingTree(State)Nodes a reference to another layer, which is used for moving overflow:scroll contents around
index 9091ebc8477367e6c7b1e226833f4356444e986b..51a79bf2526fc592d46cda00f640cfba268104b8 100644 (file)
@@ -1318,6 +1318,8 @@ static PassRef<CSSValue> renderTextDecorationStyleFlagsToCSSValue(TextDecoration
 static PassRef<CSSValue> renderTextDecorationSkipFlagsToCSSValue(TextDecorationSkip textDecorationSkip)
 {
     switch (textDecorationSkip) {
+    case TextDecorationSkipAuto:
+        return cssValuePool().createIdentifierValue(CSSValueAuto);
     case TextDecorationSkipNone:
         return cssValuePool().createIdentifierValue(CSSValueNone);
     case TextDecorationSkipInk:
index 40d976d41b3f5cb4947aa5d214c673b7b109aeed..66e0e21cb50bf86b9caac07bdc96b97339dcffdc 100644 (file)
@@ -9456,6 +9456,7 @@ bool CSSParser::parseTextDecorationSkip(bool important)
     do {
         switch (value->id) {
         case CSSValueNone:
+        case CSSValueAuto:
         case CSSValueInk:
         case CSSValueObjects:
             addProperty(CSSPropertyWebkitTextDecorationSkip, cssValuePool().createIdentifierValue(value->id), important);
index 87953b55b16238c074845fbf7f3fa61d27c28199..583a5db78e4a50c28897d9e1cad45ae93dd28c3e 100644 (file)
@@ -1287,6 +1287,8 @@ static TextDecorationSkip valueToDecorationSkip(CSSPrimitiveValue& primitiveValu
     ASSERT(primitiveValue.isValueID());
 
     switch (primitiveValue.getValueID()) {
+    case CSSValueAuto:
+        return TextDecorationSkipAuto;
     case CSSValueNone:
         return TextDecorationSkipNone;
     case CSSValueInk:
index 7246fd12de3db317ec95d5fe0077f0bde1f2e144..d41488bcdc34e5bfae0657d68e1ad3ec08dea641 100644 (file)
@@ -1162,7 +1162,7 @@ void InlineTextBox::paintDecoration(GraphicsContext& context, const FloatPoint&
             }
             default:
 #if ENABLE(CSS3_TEXT_DECORATION_SKIP_INK)
-                if (lineStyle.textDecorationSkip() == TextDecorationSkipInk && isHorizontal()) {
+                if ((lineStyle.textDecorationSkip() == TextDecorationSkipInk || lineStyle.textDecorationSkip() == TextDecorationSkipAuto) && isHorizontal()) {
                     if (!context.paintingDisabled()) {
                         drawSkipInkUnderline(textPainter, context, localOrigin, underlineOffset, width, isPrinting);
 
@@ -1192,7 +1192,7 @@ void InlineTextBox::paintDecoration(GraphicsContext& context, const FloatPoint&
             }
             default:
 #if ENABLE(CSS3_TEXT_DECORATION_SKIP_INK)
-                if (lineStyle.textDecorationSkip() == TextDecorationSkipInk) {
+                if ((lineStyle.textDecorationSkip() == TextDecorationSkipInk || lineStyle.textDecorationSkip() == TextDecorationSkipAuto) && isHorizontal()) {
                     if (!context.paintingDisabled()) {
                         drawSkipInkUnderline(textPainter, context, localOrigin, 0, width, isPrinting);
 
index ad2050dc3fe8a089e9189c466b34f1e53a79a7cc..f6c43e63f98e4e0d3a2d96a7b432ddfd9e177478 100644 (file)
@@ -1671,7 +1671,7 @@ public:
     static TextJustify initialTextJustify() { return TextJustifyAuto; }
 #endif // CSS3_TEXT
     static TextDecorationStyle initialTextDecorationStyle() { return TextDecorationStyleSolid; }
-    static TextDecorationSkip initialTextDecorationSkip() { return TextDecorationSkipObjects; }
+    static TextDecorationSkip initialTextDecorationSkip() { return TextDecorationSkipAuto; }
     static TextUnderlinePosition initialTextUnderlinePosition() { return TextUnderlinePositionAuto; }
     static float initialZoom() { return 1.0f; }
     static int initialOutlineOffset() { return 0; }
index 9f8d165bfb821b0477b0258c5796d03e93bc0c7a..704ade06a305a8f80b9ef688b0b837a1ccf4ab3e 100644 (file)
@@ -390,7 +390,8 @@ enum TextJustify {
 enum TextDecorationSkipItems {
     TextDecorationSkipNone = 0,
     TextDecorationSkipInk = 1 << 0,
-    TextDecorationSkipObjects = 1 << 1
+    TextDecorationSkipObjects = 1 << 1,
+    TextDecorationSkipAuto = 1 << 2
 };
 typedef unsigned TextDecorationSkip;