Changeset 125205 in webkit


Ignore:
Timestamp:
Aug 9, 2012 2:49:36 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[css3-text] Add suport for -webkit-text-decoration-line
https://bugs.webkit.org/show_bug.cgi?id=90959

Patch by Bruno de Oliveira Abinader <Bruno de Oliveira Abinader> on 2012-08-09
Reviewed by Kenneth Rohde Christiansen.

This patch implements the "text-decoration-line" property specified in CSS3
working draft, with "-webkit-" prefix. The specification can be found below:
http://dev.w3.org/csswg/css3-text/#text-decoration-line

Additionally, Mozilla implementation details can be found here:
https://developer-dev.allizom.org/en-US/docs/CSS/text-decoration-line

It is important to notice that "-webkit-text-decoration-line" and
"text-decoration" properties shares the same property handlers, however, the
former resets the latter if value from latter doesn't have "important" value
set (same behavior as Firefox). In a rare case where both properties have
"important" value set, the text decoration gets value from the last parsed
property.

Source/WebCore:

Test: fast/css/text-decoration-line.html

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::renderTextDecorationFlagsToCSSValue):
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):

  • css/CSSParser.cpp:

(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::addTextDecorationProperty):
(WebCore::CSSParser::parseTextDecoration):

  • css/CSSParser.h:
  • css/CSSProperty.cpp:

(WebCore::CSSProperty::isInheritedProperty):

  • css/CSSPropertyNames.in:
  • css/StyleBuilder.cpp:

(WebCore::StyleBuilder::StyleBuilder):

  • css/StyleResolver.cpp:

(WebCore::StyleResolver::collectMatchingRulesForList):

LayoutTests:

  • fast/css/getComputedStyle/computed-style-expected.txt:
  • fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
  • fast/css/getComputedStyle/resources/property-names.js:
  • fast/css/text-decoration-line-expected.html: Added.
  • fast/css/text-decoration-line.html: Added.
  • svg/css/getComputedStyle-basic-expected.txt:
Location:
trunk
Files:
2 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r125202 r125205  
     12012-08-09  Bruno de Oliveira Abinader  <bruno.abinader@basyskom.com>
     2
     3        [css3-text] Add suport for -webkit-text-decoration-line
     4        https://bugs.webkit.org/show_bug.cgi?id=90959
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        This patch implements the "text-decoration-line" property specified in CSS3
     9        working draft, with "-webkit-" prefix. The specification can be found below:
     10        http://dev.w3.org/csswg/css3-text/#text-decoration-line
     11
     12        Additionally, Mozilla implementation details can be found here:
     13        https://developer-dev.allizom.org/en-US/docs/CSS/text-decoration-line
     14
     15        It is important to notice that "-webkit-text-decoration-line" and
     16        "text-decoration" properties shares the same property handlers, however, the
     17        former resets the latter if value from latter doesn't have "important" value
     18        set (same behavior as Firefox). In a rare case where both properties have
     19        "important" value set, the text decoration gets value from the last parsed
     20        property.
     21
     22        * fast/css/getComputedStyle/computed-style-expected.txt:
     23        * fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
     24        * fast/css/getComputedStyle/resources/property-names.js:
     25        * fast/css/text-decoration-line-expected.html: Added.
     26        * fast/css/text-decoration-line.html: Added.
     27        * svg/css/getComputedStyle-basic-expected.txt:
     28
    1292012-08-09  Robert Hogan  <robert@webkit.org>
    230
  • trunk/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt

    r121442 r125205  
    8686text-align: start;
    8787text-decoration: none;
     88-webkit-text-decoration-line: none;
    8889text-indent: 0px;
    8990text-rendering: auto;
  • trunk/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt

    r121442 r125205  
    8585text-align: start
    8686text-decoration: none
     87-webkit-text-decoration-line: none
    8788text-indent: 0px
    8889text-rendering: auto
  • trunk/LayoutTests/fast/css/getComputedStyle/resources/property-names.js

    r121442 r125205  
    233233    "text-anchor": true,
    234234    "text-decoration": true,
     235    "-webkit-text-decoration-line": true,
    235236    "text-indent": true,
    236237    "text-overflow": true,
  • trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt

    r121442 r125205  
    169169rect: style.getPropertyValue(text-decoration) : none
    170170rect: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue]
     171rect: style.getPropertyValue(-webkit-text-decoration-line) : none
     172rect: style.getPropertyCSSValue(-webkit-text-decoration-line) : [object CSSPrimitiveValue]
    171173rect: style.getPropertyValue(text-indent) : 0px
    172174rect: style.getPropertyCSSValue(text-indent) : [object CSSPrimitiveValue]
     
    671673g: style.getPropertyValue(text-decoration) : none
    672674g: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue]
     675g: style.getPropertyValue(-webkit-text-decoration-line) : none
     676g: style.getPropertyCSSValue(-webkit-text-decoration-line) : [object CSSPrimitiveValue]
    673677g: style.getPropertyValue(text-indent) : 0px
    674678g: style.getPropertyCSSValue(text-indent) : [object CSSPrimitiveValue]
  • trunk/Source/WebCore/ChangeLog

    r125203 r125205  
     12012-08-09  Bruno de Oliveira Abinader  <bruno.abinader@basyskom.com>
     2
     3        [css3-text] Add suport for -webkit-text-decoration-line
     4        https://bugs.webkit.org/show_bug.cgi?id=90959
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        This patch implements the "text-decoration-line" property specified in CSS3
     9        working draft, with "-webkit-" prefix. The specification can be found below:
     10        http://dev.w3.org/csswg/css3-text/#text-decoration-line
     11
     12        Additionally, Mozilla implementation details can be found here:
     13        https://developer-dev.allizom.org/en-US/docs/CSS/text-decoration-line
     14
     15        It is important to notice that "-webkit-text-decoration-line" and
     16        "text-decoration" properties shares the same property handlers, however, the
     17        former resets the latter if value from latter doesn't have "important" value
     18        set (same behavior as Firefox). In a rare case where both properties have
     19        "important" value set, the text decoration gets value from the last parsed
     20        property.
     21
     22        Test: fast/css/text-decoration-line.html
     23
     24        * css/CSSComputedStyleDeclaration.cpp:
     25        (WebCore::renderTextDecorationFlagsToCSSValue):
     26        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
     27        * css/CSSParser.cpp:
     28        (WebCore::CSSParser::parseValue):
     29        (WebCore::CSSParser::addTextDecorationProperty):
     30        (WebCore::CSSParser::parseTextDecoration):
     31        * css/CSSParser.h:
     32        * css/CSSProperty.cpp:
     33        (WebCore::CSSProperty::isInheritedProperty):
     34        * css/CSSPropertyNames.in:
     35        * css/StyleBuilder.cpp:
     36        (WebCore::StyleBuilder::StyleBuilder):
     37        * css/StyleResolver.cpp:
     38        (WebCore::StyleResolver::collectMatchingRulesForList):
     39
    1402012-08-09  Huang Dongsung  <luxtella@company100.net>
    241
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r124884 r125205  
    177177    CSSPropertyTextAlign,
    178178    CSSPropertyTextDecoration,
     179    CSSPropertyWebkitTextDecorationLine,
    179180    CSSPropertyTextIndent,
    180181    CSSPropertyTextRendering,
     
    11911192static PassRefPtr<CSSValue> renderTextDecorationFlagsToCSSValue(int textDecoration)
    11921193{
     1194    // Blink value is ignored.
    11931195    RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
    11941196    if (textDecoration & UNDERLINE)
     
    11981200    if (textDecoration & LINE_THROUGH)
    11991201        list->append(cssValuePool().createIdentifierValue(CSSValueLineThrough));
    1200     if (textDecoration & BLINK)
    1201         list->append(cssValuePool().createIdentifierValue(CSSValueBlink));
    12021202
    12031203    if (!list->length())
     
    19491949            return cssValuePool().createValue(style->textAlign());
    19501950        case CSSPropertyTextDecoration:
     1951        case CSSPropertyWebkitTextDecorationLine:
    19511952            return renderTextDecorationFlagsToCSSValue(style->textDecoration());
    19521953        case CSSPropertyWebkitTextDecorationsInEffect:
  • trunk/Source/WebCore/css/CSSParser.cpp

    r125118 r125205  
    21012101    case CSSPropertyWebkitTextDecorationsInEffect:
    21022102        // none | [ underline || overline || line-through || blink ] | inherit
    2103         if (id == CSSValueNone) {
    2104             validPrimitive = true;
    2105         } else {
    2106             RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
    2107             bool isValid = true;
    2108             while (isValid && value) {
    2109                 switch (value->id) {
    2110                 case CSSValueBlink:
    2111                     break;
    2112                 case CSSValueUnderline:
    2113                 case CSSValueOverline:
    2114                 case CSSValueLineThrough:
    2115                     list->append(cssValuePool().createIdentifierValue(value->id));
    2116                     break;
    2117                 default:
    2118                     isValid = false;
    2119                 }
    2120                 value = m_valueList->next();
    2121             }
    2122             if (list->length() && isValid) {
    2123                 parsedValue = list.release();
    2124                 m_valueList->next();
    2125             }
    2126         }
    2127         break;
     2103        return parseTextDecoration(propId, important);
     2104
     2105    case CSSPropertyWebkitTextDecorationLine:
     2106        // none | [ underline || overline || line-through ] | inherit
     2107        return parseTextDecoration(propId, important);
    21282108
    21292109    case CSSPropertyZoom:          // normal | reset | document | <number> | <percentage> | inherit
     
    79317911
    79327912    return value;
     7913}
     7914
     7915void CSSParser::addTextDecorationProperty(CSSPropertyID propId, PassRefPtr<CSSValue> value, bool important)
     7916{
     7917    // The text-decoration-line property takes priority over text-decoration, unless the latter has important priority set.
     7918    if (propId == CSSPropertyTextDecoration && !important && m_currentShorthand == CSSPropertyInvalid) {
     7919        for (unsigned i = 0; i < m_parsedProperties.size(); ++i) {
     7920            if (m_parsedProperties[i].id() == CSSPropertyWebkitTextDecorationLine)
     7921                return;
     7922        }
     7923    }
     7924    addProperty(propId, value, important);
     7925}
     7926
     7927bool CSSParser::parseTextDecoration(CSSPropertyID propId, bool important)
     7928{
     7929    CSSParserValue* value = m_valueList->current();
     7930    if (value->id == CSSValueNone) {
     7931        addTextDecorationProperty(propId, cssValuePool().createExplicitInitialValue(), important);
     7932        m_valueList->next();
     7933        return true;
     7934    }
     7935
     7936    RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
     7937    bool isValid = true;
     7938    while (isValid && value) {
     7939        switch (value->id) {
     7940        case CSSValueBlink:
     7941            // Blink value is not accepted by -webkit-text-decoration-line.
     7942            isValid = propId != CSSPropertyWebkitTextDecorationLine;
     7943            break;
     7944        case CSSValueUnderline:
     7945        case CSSValueOverline:
     7946        case CSSValueLineThrough:
     7947            list->append(cssValuePool().createIdentifierValue(value->id));
     7948            break;
     7949        default:
     7950            isValid = false;
     7951            break;
     7952        }
     7953        if (isValid)
     7954            value = m_valueList->next();
     7955    }
     7956
     7957    if (list->length() && isValid) {
     7958        addTextDecorationProperty(propId, list.release(), important);
     7959        return true;
     7960    }
     7961
     7962    return false;
    79337963}
    79347964
  • trunk/Source/WebCore/css/CSSParser.h

    r124970 r125205  
    232232    bool parseTextEmphasisStyle(bool important);
    233233
     234    void addTextDecorationProperty(CSSPropertyID, PassRefPtr<CSSValue>, bool important);
     235    bool parseTextDecoration(CSSPropertyID propId, bool important);
     236
    234237    bool parseLineBoxContain(bool important);
    235238    bool parseCalculation(CSSParserValue*, CalculationPermittedValueRange);
  • trunk/Source/WebCore/css/CSSProperty.cpp

    r124884 r125205  
    341341    case CSSPropertyWebkitRtlOrdering:
    342342    case CSSPropertyWebkitTextCombine:
     343    case CSSPropertyWebkitTextDecorationLine:
    343344    case CSSPropertyWebkitTextDecorationsInEffect:
    344345    case CSSPropertyWebkitTextEmphasis:
  • trunk/Source/WebCore/css/CSSPropertyNames.in

    r124389 r125205  
    352352-webkit-text-combine
    353353-epub-text-combine = -webkit-text-combine
     354-webkit-text-decoration-line
    354355-webkit-text-decorations-in-effect
    355356-webkit-text-emphasis
  • trunk/Source/WebCore/css/StyleBuilder.cpp

    r124297 r125205  
    19341934    setPropertyHandler(CSSPropertyTextAlign, ApplyPropertyTextAlign::createHandler());
    19351935    setPropertyHandler(CSSPropertyTextDecoration, ApplyPropertyTextDecoration::createHandler());
     1936    setPropertyHandler(CSSPropertyWebkitTextDecorationLine, ApplyPropertyTextDecoration::createHandler());
    19361937    setPropertyHandler(CSSPropertyTextIndent, ApplyPropertyLength<&RenderStyle::textIndent, &RenderStyle::setTextIndent, &RenderStyle::initialTextIndent>::createHandler());
    19371938    setPropertyHandler(CSSPropertyTextOverflow, ApplyPropertyDefault<TextOverflow, &RenderStyle::textOverflow, TextOverflow, &RenderStyle::setTextOverflow, TextOverflow, &RenderStyle::initialTextOverflow>::createHandler());
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r124884 r125205  
    44004400    case CSSPropertyWebkitRtlOrdering:
    44014401    case CSSPropertyWebkitTextCombine:
     4402    case CSSPropertyWebkitTextDecorationLine:
    44024403    case CSSPropertyWebkitTextEmphasisColor:
    44034404    case CSSPropertyWebkitTextEmphasisPosition:
Note: See TracChangeset for help on using the changeset viewer.