Changeset 154338 in webkit


Ignore:
Timestamp:
Aug 20, 2013 10:17:12 AM (11 years ago)
Author:
Bruno de Oliveira Abinader
Message:

[css3-text] Implement CSS3 text-decoration shorthand
https://bugs.webkit.org/show_bug.cgi?id=92000

Implements the text-decoration shorthand (with -webkit- prefix), as specified by the CSS3 Text Decoration specification:
http://dev.w3.org/csswg/css-text-decor-3/#text-decoration-property

Backported from Blink:
https://src.chromium.org/viewvc/blink?revision=156266&view=revision

Location:
trunk
Files:
4 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r154332 r154338  
     12013-08-20  Bruno de Oliveira Abinader  <bruno.d@partner.samsung.com>
     2
     3        [css3-text] Implement CSS3 text-decoration shorthand
     4        https://bugs.webkit.org/show_bug.cgi?id=92000
     5
     6        Reviewed by Darin Adler.
     7
     8        Added computed style tests for text-decoration shorthand.
     9
     10        * fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-shorthand-expected.txt: Added.
     11        * fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-shorthand-ordering-expected.txt: Added.
     12        * fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-shorthand-ordering.html: Added.
     13        * fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-shorthand.html: Added.
     14
    1152013-08-20  Daniel Bates  <dabates@apple.com>
    216
  • trunk/Source/WebCore/ChangeLog

    r154336 r154338  
     12013-08-20  Bruno de Oliveira Abinader  <bruno.d@partner.samsung.com>
     2
     3        [css3-text] Implement CSS3 text-decoration shorthand
     4        https://bugs.webkit.org/show_bug.cgi?id=92000
     5
     6        Reviewed by Darin Adler.
     7
     8        Implements the text-decoration shorthand (with -webkit- prefix), as specified by the CSS3 Text Decoration specification:
     9        http://dev.w3.org/csswg/css-text-decor-3/#text-decoration-property
     10
     11        Backported from Blink:
     12        https://src.chromium.org/viewvc/blink?revision=156266&view=revision
     13
     14        Tests: fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-shorthand-ordering.html
     15               fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-shorthand.html
     16
     17        * css/CSSComputedStyleDeclaration.cpp:
     18        (WebCore::ComputedStyleExtractor::propertyValue):
     19        * css/CSSParser.cpp:
     20        (WebCore::CSSParser::parseValue):
     21        (WebCore::CSSParser::addTextDecorationProperty):
     22        (WebCore::CSSParser::parseTextDecoration):
     23        * css/CSSProperty.cpp:
     24        (WebCore::CSSProperty::isInheritedProperty):
     25        * css/CSSPropertyNames.in:
     26        * css/StylePropertyShorthand.cpp:
     27        (WebCore::webkitTextDecorationShorthand):
     28        (WebCore::shorthandForProperty):
     29        (WebCore::matchingShorthandsForLonghand):
     30        * css/StylePropertyShorthand.h:
     31
    1322013-08-20  Gavin Barraclough  <barraclough@apple.com>
    233
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r154174 r154338  
    22942294            return renderTextDecorationFlagsToCSSValue(style->textDecoration());
    22952295#if ENABLE(CSS3_TEXT)
     2296        case CSSPropertyWebkitTextDecoration:
     2297            return getCSSPropertyValuesForShorthandProperties(webkitTextDecorationShorthand());
    22962298        case CSSPropertyWebkitTextDecorationLine:
    22972299            return renderTextDecorationFlagsToCSSValue(style->textDecoration());
  • trunk/Source/WebCore/css/CSSParser.cpp

    r154174 r154338  
    23352335        break;
    23362336    }
     2337
     2338#if ENABLE(CSS3_TEXT)
     2339    case CSSPropertyWebkitTextDecoration:
     2340        // [ <text-decoration-line> || <text-decoration-style> || <text-decoration-color> ] | inherit
     2341        return parseShorthand(CSSPropertyWebkitTextDecoration, webkitTextDecorationShorthand(), important);
     2342#endif
    23372343
    23382344    case CSSPropertyTextDecoration:
     
    95239529#if ENABLE(CSS3_TEXT)
    95249530    // The text-decoration-line property takes priority over text-decoration, unless the latter has important priority set.
    9525     if (propId == CSSPropertyTextDecoration && !important && m_currentShorthand == CSSPropertyInvalid) {
     9531    if (propId == CSSPropertyTextDecoration && !important && !inShorthand()) {
    95269532        for (unsigned i = 0; i < m_parsedProperties.size(); ++i) {
    95279533            if (m_parsedProperties[i].id() == CSSPropertyWebkitTextDecorationLine)
     
    95369542{
    95379543    CSSParserValue* value = m_valueList->current();
    9538     if (value->id == CSSValueNone) {
     9544    if (value && value->id == CSSValueNone) {
    95399545        addTextDecorationProperty(propId, cssValuePool().createIdentifierValue(CSSValueNone), important);
    95409546        m_valueList->next();
     
    95609566    }
    95619567
    9562     if (list->length() && isValid) {
     9568    // Values are either valid or in shorthand scope.
     9569    if (list->length() && (isValid || inShorthand())) {
    95639570        addTextDecorationProperty(propId, list.release(), important);
    95649571        return true;
  • trunk/Source/WebCore/css/CSSProperty.cpp

    r154174 r154338  
    657657    case CSSPropertyWebkitPerspectiveOriginY:
    658658#if ENABLE(CSS3_TEXT)
     659    case CSSPropertyWebkitTextDecoration:
    659660    case CSSPropertyWebkitTextDecorationLine:
    660661    case CSSPropertyWebkitTextDecorationStyle:
  • trunk/Source/WebCore/css/CSSPropertyNames.in

    r154174 r154338  
    381381-epub-text-combine = -webkit-text-combine
    382382#if defined(ENABLE_CSS3_TEXT) && ENABLE_CSS3_TEXT
     383-webkit-text-decoration
    383384-webkit-text-decoration-line
    384385-webkit-text-decoration-style
  • trunk/Source/WebCore/css/StylePropertyShorthand.cpp

    r153746 r154338  
    457457    return webkitMaskRepeatLonghands;
    458458}
     459
     460#if ENABLE(CSS3_TEXT)
     461const StylePropertyShorthand& webkitTextDecorationShorthand()
     462{
     463    static const CSSPropertyID textDecorationProperties[] = {
     464        CSSPropertyWebkitTextDecorationLine,
     465        CSSPropertyWebkitTextDecorationStyle,
     466        CSSPropertyWebkitTextDecorationColor
     467    };
     468    DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitTextDecorationLonghands, (CSSPropertyWebkitTextDecoration, textDecorationProperties, WTF_ARRAY_LENGTH(textDecorationProperties)));
     469    return webkitTextDecorationLonghands;
     470}
     471#endif
    459472
    460473const StylePropertyShorthand& webkitTextEmphasisShorthand()
     
    598611    case CSSPropertyWebkitMaskRepeat:
    599612        return webkitMaskRepeatShorthand();
     613#if ENABLE(CSS3_TEXT)
     614    case CSSPropertyWebkitTextDecoration:
     615        return webkitTextDecorationShorthand();
     616#endif
    600617    case CSSPropertyWebkitTextEmphasis:
    601618        return webkitTextEmphasisShorthand();
     
    896913        map.set(CSSPropertyWebkitMaskRepeatY, maskRepeat);
    897914
     915#if ENABLE(CSS3_TEXT)
     916        Vector<const StylePropertyShorthand*, 3> textDecoration;
     917        textDecoration.uncheckedAppend(&webkitTextDecorationShorthand());
     918        map.set(CSSPropertyWebkitTextDecorationLine, textDecoration);
     919        map.set(CSSPropertyWebkitTextDecorationStyle, textDecoration);
     920        map.set(CSSPropertyWebkitTextDecorationColor, textDecoration);
     921#endif
     922
    898923        Vector<const StylePropertyShorthand*, 1> textEmphasis;
    899924        textEmphasis.uncheckedAppend(&webkitTextEmphasisShorthand());
  • trunk/Source/WebCore/css/StylePropertyShorthand.h

    r153650 r154338  
    117117const StylePropertyShorthand& widthShorthand();
    118118
     119#if ENABLE(CSS3_TEXT)
     120const StylePropertyShorthand& webkitTextDecorationShorthand();
     121#endif
     122
    119123// Returns an empty list if the property is not a shorthand.
    120124const StylePropertyShorthand& shorthandForProperty(CSSPropertyID);
Note: See TracChangeset for help on using the changeset viewer.