Changeset 164061 in webkit


Ignore:
Timestamp:
Feb 13, 2014 3:02:31 PM (10 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Yuki Sekiguchi <yuki.sekiguchi@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:
Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r164053 r164061  
     12014-02-13  Yuki Sekiguchi  <yuki.sekiguchi@access-company.com>
     2
     3        [css3-text] Support -webkit-text-decoration-skip: objects
     4        https://bugs.webkit.org/show_bug.cgi?id=128723
     5
     6        Reviewed by Dean Jackson.
     7
     8        Added 'objects' value to the current test case.
     9        Added getComputedStyle() test to test renderTextDecorationSkipFlagsToCSSValue() code.
     10
     11        * fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-roundtrip-expected.txt:
     12        * fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-roundtrip.html:
     13
    1142014-02-13  Myles C. Maxfield  <mmaxfield@apple.com>
    215
  • trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-roundtrip-expected.txt

    r158127 r164061  
     1PASS cssRule.type is cssRule.STYLE_RULE
     2PASS declaration.length is 0
     3PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is null
     4PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "objects"
     5PASS cssRule.type is cssRule.STYLE_RULE
     6PASS declaration.length is 1
     7PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "initial"
     8PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "objects"
    19PASS cssRule.type is cssRule.STYLE_RULE
    210PASS declaration.length is 1
    311PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "ink"
     12PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "ink"
    413PASS cssRule.type is cssRule.STYLE_RULE
    514PASS declaration.length is 1
    615PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "ink"
     16PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "ink"
    717PASS cssRule.type is cssRule.STYLE_RULE
    818PASS declaration.length is 0
     19PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "objects"
    920PASS cssRule.type is cssRule.STYLE_RULE
    1021PASS declaration.length is 1
    1122PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "ink"
     23PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "ink"
    1224PASS cssRule.type is cssRule.STYLE_RULE
    1325PASS declaration.length is 1
    1426PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "ink"
     27PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "ink"
    1528PASS cssRule.type is cssRule.STYLE_RULE
    1629PASS declaration.length is 1
    1730PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "ink"
     31PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "ink"
    1832PASS cssRule.type is cssRule.STYLE_RULE
    1933PASS declaration.length is 1
    2034PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "ink"
     35PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "ink"
     36PASS cssRule.type is cssRule.STYLE_RULE
     37PASS declaration.length is 1
     38PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "objects"
     39PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "objects"
     40PASS cssRule.type is cssRule.STYLE_RULE
     41PASS declaration.length is 1
     42PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "objects"
     43PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "objects"
     44PASS cssRule.type is cssRule.STYLE_RULE
     45PASS declaration.length is 1
     46PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "objects"
     47PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "objects"
     48PASS cssRule.type is cssRule.STYLE_RULE
     49PASS declaration.length is 1
     50PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "objects"
     51PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "objects"
     52PASS cssRule.type is cssRule.STYLE_RULE
     53PASS declaration.length is 1
     54PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "objects"
     55PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "objects"
     56PASS cssRule.type is cssRule.STYLE_RULE
     57PASS declaration.length is 1
     58PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "objects"
     59PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "objects"
    2160PASS cssRule.type is cssRule.STYLE_RULE
    2261PASS declaration.length is 1
    2362PASS declaration.getPropertyValue('-webkit-text-decoration-skip') is "none"
     63PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "none"
    2464PASS cssRule.type is cssRule.STYLE_RULE
    2565PASS declaration.length is 0
     66PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText is "objects"
    2667
  • trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-roundtrip.html

    r158127 r164061  
    55</head>
    66<body>
     7  <div class="p"></div>
    78  <script type="text/javascript">
    8     function testInkIsValid(stylesheet) {
     9    function testInkIsValid(stylesheet, target) {
    910      cssRule = stylesheet.cssRules.item(0);
    1011      shouldBe("cssRule.type", "cssRule.STYLE_RULE");
     
    1213      shouldBe("declaration.length", "1");
    1314      shouldBe("declaration.getPropertyValue('-webkit-text-decoration-skip')", "\"ink\"");
     15      computedStyle = window.getComputedStyle(target, null);
     16      shouldBe("computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText", "\"ink\"");
    1417      stylesheet.deleteRule(0);
    1518    }
    1619
    17     function testInvalidRule(stylesheet) {
     20    function testObjectsIsValid(stylesheet, target) {
     21      cssRule = stylesheet.cssRules.item(0);
     22      shouldBe("cssRule.type", "cssRule.STYLE_RULE");
     23      declaration = cssRule.style;
     24      shouldBe("declaration.length", "1");
     25      shouldBe("declaration.getPropertyValue('-webkit-text-decoration-skip')", "\"objects\"");
     26      computedStyle = window.getComputedStyle(target, null);
     27      shouldBe("computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText", "\"objects\"");
     28      stylesheet.deleteRule(0);
     29    }
     30
     31    function testEmptyIsObjects(stylesheet, target) {
    1832      cssRule = stylesheet.cssRules.item(0);
    1933      shouldBe("cssRule.type", "cssRule.STYLE_RULE");
    2034      declaration = cssRule.style;
    2135      shouldBe("declaration.length", "0");
     36      shouldBe("declaration.getPropertyValue('-webkit-text-decoration-skip')", "null");
     37      computedStyle = window.getComputedStyle(target, null);
     38      shouldBe("computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText", "\"objects\"");
    2239      stylesheet.deleteRule(0);
    2340    }
    2441
    25     function testNoneIsValid(stylesheet) {
     42    function testInitialIsObjects(stylesheet, target) {
     43      cssRule = stylesheet.cssRules.item(0);
     44      shouldBe("cssRule.type", "cssRule.STYLE_RULE");
     45      declaration = cssRule.style;
     46      shouldBe("declaration.length", "1");
     47      shouldBe("declaration.getPropertyValue('-webkit-text-decoration-skip')",  "\"initial\"");
     48      computedStyle = window.getComputedStyle(target, null);
     49      shouldBe("computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText", "\"objects\"");
     50      stylesheet.deleteRule(0);
     51    }
     52
     53    function testInvalidRule(stylesheet, target) {
     54      cssRule = stylesheet.cssRules.item(0);
     55      shouldBe("cssRule.type", "cssRule.STYLE_RULE");
     56      declaration = cssRule.style;
     57      shouldBe("declaration.length", "0");
     58      computedStyle = window.getComputedStyle(target, null);
     59      shouldBe("computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText", "\"objects\"");
     60      stylesheet.deleteRule(0);
     61    }
     62
     63    function testNoneIsValid(stylesheet, target) {
    2664      cssRule = stylesheet.cssRules.item(0);
    2765      shouldBe("cssRule.type", "cssRule.STYLE_RULE");
     
    2967      shouldBe("declaration.length", "1");
    3068      shouldBe("declaration.getPropertyValue('-webkit-text-decoration-skip')", "\"none\"");
     69      computedStyle = window.getComputedStyle(target, null);
     70      shouldBe("computedStyle.getPropertyCSSValue('-webkit-text-decoration-skip').cssText", "\"none\"");
    3171      stylesheet.deleteRule(0);
    3272    }
     
    3575    document.head.appendChild(styleElement);
    3676    stylesheet = styleElement.sheet;
     77    var target = document.getElementsByClassName("p")[0];
     78
     79    stylesheet.insertRule(".p { }", 0);
     80    testEmptyIsObjects(stylesheet, target);
     81
     82    stylesheet.insertRule(".p { -webkit-text-decoration-skip: initial; }", 0);
     83    testInitialIsObjects(stylesheet, target);
    3784
    3885    stylesheet.insertRule(".p { -webkit-text-decoration-skip: ink; }", 0);
    39     testInkIsValid(stylesheet);
     86    testInkIsValid(stylesheet, target);
    4087
    4188    stylesheet.insertRule(".p { -webkit-text-decoration-skip: ink ink ink ink ink; }", 0);
    42     testInkIsValid(stylesheet);
     89    testInkIsValid(stylesheet, target);
    4390
    4491    stylesheet.insertRule(".p { -webkit-text-decoration-skip: garbage; }", 0);
    45     testInvalidRule(stylesheet);
     92    testInvalidRule(stylesheet, target);
    4693
    4794    stylesheet.insertRule(".p { -webkit-text-decoration-skip: garbage ink; }", 0);
    48     testInkIsValid(stylesheet);
     95    testInkIsValid(stylesheet, target);
    4996
    5097    stylesheet.insertRule(".p { -webkit-text-decoration-skip: ink garbage; }", 0);
    51     testInkIsValid(stylesheet);
     98    testInkIsValid(stylesheet, target);
    5299   
    53100    stylesheet.insertRule(".p { -webkit-text-decoration-skip: garbage ink garbage; }", 0);
    54     testInkIsValid(stylesheet);
     101    testInkIsValid(stylesheet, target);
    55102   
    56103    stylesheet.insertRule(".p { -webkit-text-decoration-skip: ink garbage ink; }", 0);
    57     testInkIsValid(stylesheet);
     104    testInkIsValid(stylesheet, target);
    58105   
     106    stylesheet.insertRule(".p { -webkit-text-decoration-skip: objects; }", 0);
     107    testObjectsIsValid(stylesheet, target);
     108
     109    stylesheet.insertRule(".p { -webkit-text-decoration-skip: objects objects objects objects objects; }", 0);
     110    testObjectsIsValid(stylesheet, target);
     111
     112    stylesheet.insertRule(".p { -webkit-text-decoration-skip: garbage objects; }", 0);
     113    testObjectsIsValid(stylesheet, target);
     114
     115    stylesheet.insertRule(".p { -webkit-text-decoration-skip: objects garbage; }", 0);
     116    testObjectsIsValid(stylesheet, target);
     117
     118    stylesheet.insertRule(".p { -webkit-text-decoration-skip: garbage objects garbage; }", 0);
     119    testObjectsIsValid(stylesheet, target);
     120
     121    stylesheet.insertRule(".p { -webkit-text-decoration-skip: objects garbage objects; }", 0);
     122    testObjectsIsValid(stylesheet, target);
     123
    59124    stylesheet.insertRule(".p { -webkit-text-decoration-skip: none; }", 0);
    60     testNoneIsValid(stylesheet);
     125    testNoneIsValid(stylesheet, target);
    61126   
    62127    stylesheet.insertRule(".p { -webkit-text-decoration-skip: ; }", 0);
    63     testInvalidRule(stylesheet);
     128    testInvalidRule(stylesheet, target);
    64129  </script>
    65130<script src="../../resources/js-test-post.js"></script>
  • trunk/Source/WebCore/ChangeLog

    r164060 r164061  
     12014-02-13  Yuki Sekiguchi  <yuki.sekiguchi@access-company.com>
     2
     3        [css3-text] Support -webkit-text-decoration-skip: objects
     4        https://bugs.webkit.org/show_bug.cgi?id=128723
     5
     6        Reviewed by Dean Jackson.
     7
     8        Implemented 'objects' value of text-decoration-skip.
     9        http://www.w3.org/TR/2013/CR-css-text-decor-3-20130801/#text-decoration-skip
     10
     11        This is initial value and same behavior without
     12        ENABLE_CSS3_TEXT_DECORATION_SKIP_INK flag. Threfore, this patch only
     13        added parser code and constant for 'objects'.
     14
     15        Changed the initial value of text-decoration-skip.
     16
     17        The current implementation parses 'none', but the rendering code is
     18        not match the spec, so this patch added FIXME to the rendering code.
     19
     20        * css/CSSComputedStyleDeclaration.cpp:
     21        (WebCore::renderTextDecorationSkipFlagsToCSSValue):
     22        * css/CSSParser.cpp:
     23        (WebCore::CSSParser::parseTextDecorationSkip):
     24        * css/CSSValueKeywords.in:
     25        * css/DeprecatedStyleBuilder.cpp:
     26        (WebCore::valueToDecorationSkip):
     27        * rendering/InlineTextBox.cpp:
     28        (WebCore::InlineTextBox::paintDecoration):
     29        * rendering/style/RenderStyle.h:
     30        * rendering/style/RenderStyleConstants.h:
     31
    1322014-02-13  Daniel Bates  <dabates@apple.com>
    233
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r164035 r164061  
    13201320    switch (textDecorationSkip) {
    13211321    case TextDecorationSkipNone:
    1322         return cssValuePool().createExplicitInitialValue();
     1322        return cssValuePool().createIdentifierValue(CSSValueNone);
    13231323    case TextDecorationSkipInk:
    13241324        return cssValuePool().createIdentifierValue(CSSValueInk);
     1325    case TextDecorationSkipObjects:
     1326        return cssValuePool().createIdentifierValue(CSSValueObjects);
    13251327    }
    13261328
  • trunk/Source/WebCore/css/CSSParser.cpp

    r164035 r164061  
    94619461        case CSSValueNone:
    94629462        case CSSValueInk:
     9463        case CSSValueObjects:
    94639464            addProperty(CSSPropertyWebkitTextDecorationSkip, cssValuePool().createIdentifierValue(value->id), important);
    94649465            return true;
  • trunk/Source/WebCore/css/CSSValueKeywords.in

    r163840 r164061  
    486486wavy
    487487ink
     488objects
    488489-webkit-nowrap
    489490
  • trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp

    r163840 r164061  
    12921292    case CSSValueInk:
    12931293        return TextDecorationSkipInk;
     1294    case CSSValueObjects:
     1295        return TextDecorationSkipObjects;
    12941296    default:
    12951297        break;
  • trunk/Source/WebCore/rendering/InlineTextBox.cpp

    r164046 r164061  
    11711171                    }
    11721172                } else {
     1173                    // FIXME: Need to support text-decoration-skip: none.
    11731174#endif // CSS3_TEXT_DECORATION_SKIP_INK
    11741175                    context.drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + underlineOffset), width, isPrinting);
     
    12001201                    }
    12011202                } else {
     1203                    // FIXME: Need to support text-decoration-skip: none.
    12021204#endif // CSS3_TEXT_DECORATION_SKIP_INK
    12031205                    context.drawLineForText(localOrigin, width, isPrinting);
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r163840 r164061  
    16721672#endif // CSS3_TEXT
    16731673    static TextDecorationStyle initialTextDecorationStyle() { return TextDecorationStyleSolid; }
    1674     static TextDecorationSkip initialTextDecorationSkip() { return TextDecorationSkipInk; }
     1674    static TextDecorationSkip initialTextDecorationSkip() { return TextDecorationSkipObjects; }
    16751675    static TextUnderlinePosition initialTextUnderlinePosition() { return TextUnderlinePositionAuto; }
    16761676    static float initialZoom() { return 1.0f; }
  • trunk/Source/WebCore/rendering/style/RenderStyleConstants.h

    r163840 r164061  
    390390enum TextDecorationSkipItems {
    391391    TextDecorationSkipNone = 0,
    392     TextDecorationSkipInk = 1 << 0
     392    TextDecorationSkipInk = 1 << 0,
     393    TextDecorationSkipObjects = 1 << 1
    393394};
    394395typedef unsigned TextDecorationSkip;
Note: See TracChangeset for help on using the changeset viewer.