Changeset 126054 in webkit


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

[css3-text] Add parsing support for -webkit-text-decoration-style
https://bugs.webkit.org/show_bug.cgi?id=94093

Patch by Bruno de Oliveira Abinader <Bruno de Oliveira Abinader> on 2012-08-20
Reviewed by Julien Chaffraix.

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

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

This is an individual task for bug 90958. Rendering support will be handled on a
different bug.

Source/WebCore:

Test: fast/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-style.html

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::renderTextDecorationStyleFlagsToCSSValue):
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):

  • css/CSSParser.cpp:

(WebCore::CSSParser::parseValue):

  • css/CSSPrimitiveValueMappings.h:

(WebCore::CSSPrimitiveValue::operator TextDecorationStyle):

  • css/CSSProperty.cpp:

(WebCore::CSSProperty::isInheritedProperty):

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

(WebCore::StyleBuilder::StyleBuilder):

  • css/StyleResolver.cpp:

(WebCore::StyleResolver::collectMatchingRulesForList):

  • rendering/style/RenderStyle.cpp:

(WebCore::RenderStyle::diff):

  • rendering/style/RenderStyle.h:
  • rendering/style/RenderStyleConstants.h: Added non-bitwise TextDecorationStyle enum.
  • rendering/style/StyleRareNonInheritedData.cpp:

(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): Added m_textDecorationStyle to default and copy constructors.
(WebCore::StyleRareNonInheritedData::operator==): Include m_textDecorationStyle in comparison.

  • rendering/style/StyleRareNonInheritedData.h:

(StyleRareNonInheritedData):
Added m_textDecorationStyle here as it won't be used regularly.

LayoutTests:

  • fast/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-style-expected.txt: Added.
  • fast/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-style.html: Added.
  • fast/css3-text-decoration/getComputedStyle/script-tests/getComputedStyle-text-decoration-style.js: Added.
Location:
trunk
Files:
5 added
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r126051 r126054  
     12012-08-20  Bruno de Oliveira Abinader  <bruno.abinader@basyskom.com>
     2
     3        [css3-text] Add parsing support for -webkit-text-decoration-style
     4        https://bugs.webkit.org/show_bug.cgi?id=94093
     5
     6        Reviewed by Julien Chaffraix.
     7
     8        This patch implements the "text-decoration-style" property parsing as specified
     9        in CSS3 working draft, with "-webkit-" prefix. The specification can be found
     10        here: http://dev.w3.org/csswg/css3-text/#text-decoration-style
     11
     12        Additionally, Mozilla implementation details can be found here:
     13        https://developer.mozilla.org/en-US/docs/CSS/text-decoration-style
     14
     15        This is an individual task for bug 90958. Rendering support will be handled on a
     16        different bug.
     17
     18        * fast/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-style-expected.txt: Added.
     19        * fast/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-style.html: Added.
     20        * fast/css3-text-decoration/getComputedStyle/script-tests/getComputedStyle-text-decoration-style.js: Added.
     21
    1222012-08-20  Kenneth Russell  <kbr@google.com>
    223
  • trunk/Source/WebCore/ChangeLog

    r126053 r126054  
     12012-08-20  Bruno de Oliveira Abinader  <bruno.abinader@basyskom.com>
     2
     3        [css3-text] Add parsing support for -webkit-text-decoration-style
     4        https://bugs.webkit.org/show_bug.cgi?id=94093
     5
     6        Reviewed by Julien Chaffraix.
     7
     8        This patch implements the "text-decoration-style" property parsing as specified
     9        in CSS3 working draft, with "-webkit-" prefix. The specification can be found
     10        here: http://dev.w3.org/csswg/css3-text/#text-decoration-style
     11
     12        Additionally, Mozilla implementation details can be found here:
     13        https://developer.mozilla.org/en-US/docs/CSS/text-decoration-style
     14
     15        This is an individual task for bug 90958. Rendering support will be handled on a
     16        different bug.
     17
     18        Test: fast/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-style.html
     19
     20        * css/CSSComputedStyleDeclaration.cpp:
     21        (WebCore::renderTextDecorationStyleFlagsToCSSValue):
     22        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
     23        * css/CSSParser.cpp:
     24        (WebCore::CSSParser::parseValue):
     25        * css/CSSPrimitiveValueMappings.h:
     26        (WebCore::CSSPrimitiveValue::operator TextDecorationStyle):
     27        * css/CSSProperty.cpp:
     28        (WebCore::CSSProperty::isInheritedProperty):
     29        * css/CSSPropertyNames.in:
     30        * css/CSSValueKeywords.in:
     31        * css/StyleBuilder.cpp:
     32        (WebCore::StyleBuilder::StyleBuilder):
     33        * css/StyleResolver.cpp:
     34        (WebCore::StyleResolver::collectMatchingRulesForList):
     35        * rendering/style/RenderStyle.cpp:
     36        (WebCore::RenderStyle::diff):
     37        * rendering/style/RenderStyle.h:
     38        * rendering/style/RenderStyleConstants.h: Added non-bitwise TextDecorationStyle enum.
     39        * rendering/style/StyleRareNonInheritedData.cpp:
     40        (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): Added m_textDecorationStyle to default and copy constructors.
     41        (WebCore::StyleRareNonInheritedData::operator==): Include m_textDecorationStyle in comparison.
     42        * rendering/style/StyleRareNonInheritedData.h:
     43        (StyleRareNonInheritedData):
     44        Added m_textDecorationStyle here as it won't be used regularly.
     45
    1462012-08-20  Jakob Petsovits  <jpetsovits@rim.com>
    247
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r126032 r126054  
    180180#if ENABLE(CSS3_TEXT_DECORATION)
    181181    CSSPropertyWebkitTextDecorationLine,
     182    CSSPropertyWebkitTextDecorationStyle,
    182183#endif // CSS3_TEXT_DECORATION
    183184    CSSPropertyTextIndent,
     
    12171218    return list;
    12181219}
     1220
     1221#if ENABLE(CSS3_TEXT_DECORATION)
     1222static PassRefPtr<CSSValue> renderTextDecorationStyleFlagsToCSSValue(TextDecorationStyle textDecorationStyle)
     1223{
     1224    switch (textDecorationStyle) {
     1225    case TextDecorationStyleSolid:
     1226        return cssValuePool().createIdentifierValue(CSSValueSolid);
     1227    case TextDecorationStyleDouble:
     1228        return cssValuePool().createIdentifierValue(CSSValueDouble);
     1229    case TextDecorationStyleDotted:
     1230        return cssValuePool().createIdentifierValue(CSSValueDotted);
     1231    case TextDecorationStyleDashed:
     1232        return cssValuePool().createIdentifierValue(CSSValueDashed);
     1233    case TextDecorationStyleWavy:
     1234        return cssValuePool().createIdentifierValue(CSSValueWavy);
     1235    }
     1236
     1237    ASSERT_NOT_REACHED();
     1238    return cssValuePool().createExplicitInitialValue();
     1239}
     1240#endif // CSS3_TEXT_DECORATION
    12191241
    12201242static PassRefPtr<CSSValue> fillRepeatToCSSValue(EFillRepeat xRepeat, EFillRepeat yRepeat)
     
    19611983            return cssValuePool().createValue(style->textAlign());
    19621984        case CSSPropertyTextDecoration:
     1985            return renderTextDecorationFlagsToCSSValue(style->textDecoration());
    19631986#if ENABLE(CSS3_TEXT_DECORATION)
    19641987        case CSSPropertyWebkitTextDecorationLine:
     1988            return renderTextDecorationFlagsToCSSValue(style->textDecoration());
     1989        case CSSPropertyWebkitTextDecorationStyle:
     1990            return renderTextDecorationStyleFlagsToCSSValue(style->textDecorationStyle());
    19651991#endif // CSS3_TEXT_DECORATION
    1966             return renderTextDecorationFlagsToCSSValue(style->textDecoration());
    19671992        case CSSPropertyWebkitTextDecorationsInEffect:
    19681993            return renderTextDecorationFlagsToCSSValue(style->textDecorationsInEffect());
  • trunk/Source/WebCore/css/CSSParser.cpp

    r126032 r126054  
    21092109        // none | [ underline || overline || line-through ] | inherit
    21102110        return parseTextDecoration(propId, important);
     2111
     2112    case CSSPropertyWebkitTextDecorationStyle:
     2113        // solid | double | dotted | dashed | wavy
     2114        if (id == CSSValueSolid || id == CSSValueDouble || id == CSSValueDotted || id == CSSValueDashed || id == CSSValueWavy)
     2115            validPrimitive = true;
     2116        break;
    21112117#endif // CSS3_TEXT_DECORATION
    21122118
  • trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h

    r125425 r126054  
    21982198    return TDNONE;
    21992199}
     2200
     2201#if ENABLE(CSS3_TEXT_DECORATION)
     2202template<> inline CSSPrimitiveValue::operator TextDecorationStyle() const
     2203{
     2204    switch (m_value.ident) {
     2205    case CSSValueSolid:
     2206        return TextDecorationStyleSolid;
     2207    case CSSValueDouble:
     2208        return TextDecorationStyleDouble;
     2209    case CSSValueDotted:
     2210        return TextDecorationStyleDotted;
     2211    case CSSValueDashed:
     2212        return TextDecorationStyleDashed;
     2213    case CSSValueWavy:
     2214        return TextDecorationStyleWavy;
     2215    }
     2216
     2217    ASSERT_NOT_REACHED();
     2218    return TextDecorationStyleSolid;
     2219}
     2220#endif // CSS3_TEXT_DECORATION
    22002221
    22012222template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextSecurity e)
  • trunk/Source/WebCore/css/CSSProperty.cpp

    r126032 r126054  
    638638    case CSSPropertyWebkitPerspectiveOriginX:
    639639    case CSSPropertyWebkitPerspectiveOriginY:
     640#if ENABLE(CSS3_TEXT_DECORATION)
     641    case CSSPropertyWebkitTextDecorationStyle:
     642#endif // CSS3_TEXT_DECORATION
    640643    case CSSPropertyWebkitTransform:
    641644    case CSSPropertyWebkitTransformOrigin:
  • trunk/Source/WebCore/css/CSSPropertyNames.in

    r126032 r126054  
    354354#if defined(ENABLE_CSS3_TEXT_DECORATION) && ENABLE_CSS3_TEXT_DECORATION
    355355-webkit-text-decoration-line
     356-webkit-text-decoration-style
    356357#endif
    357358-webkit-text-decorations-in-effect
  • trunk/Source/WebCore/css/CSSValueKeywords.in

    r126032 r126054  
    453453thin
    454454underline
     455#if defined(ENABLE_CSS3_TEXT_DECORATION) && ENABLE_CSS3_TEXT_DECORATION
     456wavy
     457#endif
    455458-webkit-nowrap
    456459
  • trunk/Source/WebCore/css/StyleBuilder.cpp

    r126032 r126054  
    19351935#if ENABLE(CSS3_TEXT_DECORATION)
    19361936    setPropertyHandler(CSSPropertyWebkitTextDecorationLine, ApplyPropertyTextDecoration::createHandler());
     1937    setPropertyHandler(CSSPropertyWebkitTextDecorationStyle, ApplyPropertyDefault<TextDecorationStyle, &RenderStyle::textDecorationStyle, TextDecorationStyle, &RenderStyle::setTextDecorationStyle, TextDecorationStyle, &RenderStyle::initialTextDecorationStyle>::createHandler());
    19371938#endif // CSS3_TEXT_DECORATION
    19381939    setPropertyHandler(CSSPropertyTextIndent, ApplyPropertyLength<&RenderStyle::textIndent, &RenderStyle::setTextIndent, &RenderStyle::initialTextIndent>::createHandler());
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r125925 r126054  
    44164416#if ENABLE(CSS3_TEXT_DECORATION)
    44174417    case CSSPropertyWebkitTextDecorationLine:
     4418    case CSSPropertyWebkitTextDecorationStyle:
    44184419#endif // CSS3_TEXT_DECORATION
    44194420    case CSSPropertyWebkitTextEmphasisColor:
  • trunk/Source/WebCore/rendering/style/RenderStyle.cpp

    r126032 r126054  
    651651        || rareNonInheritedData->userDrag != other->rareNonInheritedData->userDrag
    652652        || rareNonInheritedData->m_borderFit != other->rareNonInheritedData->m_borderFit
     653#if ENABLE(CSS3_TEXT_DECORATION)
     654        || rareNonInheritedData->m_textDecorationStyle != other->rareNonInheritedData->m_textDecorationStyle
     655#endif // CSS3_TEXT_DECORATION
    653656        || rareInheritedData->textFillColor != other->rareInheritedData->textFillColor
    654657        || rareInheritedData->textStrokeColor != other->rareInheritedData->textStrokeColor
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r126032 r126054  
    611611    ETextDecoration textDecorationsInEffect() const { return static_cast<ETextDecoration>(inherited_flags._text_decorations); }
    612612    ETextDecoration textDecoration() const { return static_cast<ETextDecoration>(visual->textDecoration); }
     613#if ENABLE(CSS3_TEXT_DECORATION)
     614    TextDecorationStyle textDecorationStyle() const { return static_cast<TextDecorationStyle>(rareNonInheritedData->m_textDecorationStyle); }
     615#endif // CSS3_TEXT_DECORATION
    613616    int wordSpacing() const;
    614617    int letterSpacing() const;
     
    11281131    void setTextDecorationsInEffect(ETextDecoration v) { inherited_flags._text_decorations = v; }
    11291132    void setTextDecoration(ETextDecoration v) { SET_VAR(visual, textDecoration, v); }
     1133#if ENABLE(CSS3_TEXT_DECORATION)
     1134    void setTextDecorationStyle(TextDecorationStyle v) { SET_VAR(rareNonInheritedData, m_textDecorationStyle, v); }
     1135#endif // CSS3_TEXT_DECORATION
    11301136    void setDirection(TextDirection v) { inherited_flags._direction = v; }
    11311137    void setLineHeight(Length specifiedLineHeight);
     
    15761582    static ETextAlign initialTextAlign() { return TASTART; }
    15771583    static ETextDecoration initialTextDecoration() { return TDNONE; }
     1584#if ENABLE(CSS3_TEXT_DECORATION)
     1585    static TextDecorationStyle initialTextDecorationStyle() { return TextDecorationStyleSolid; }
     1586#endif // CSS3_TEXT_DECORATION
    15781587    static float initialZoom() { return 1.0f; }
    15791588    static int initialOutlineOffset() { return 0; }
  • trunk/Source/WebCore/rendering/style/RenderStyleConstants.h

    r125330 r126054  
    346346inline ETextDecoration& operator|=(ETextDecoration& a, ETextDecoration b) { return a = a | b; }
    347347
     348#if ENABLE(CSS3_TEXT_DECORATION)
     349enum TextDecorationStyle {
     350    TextDecorationStyleSolid,
     351    TextDecorationStyleDouble,
     352    TextDecorationStyleDotted,
     353    TextDecorationStyleDashed,
     354    TextDecorationStyleWavy
     355};
     356#endif // CSS3_TEXT_DECORATION
     357
    348358enum EPageBreak {
    349359    PBAUTO, PBALWAYS, PBAVOID
  • trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp

    r126032 r126054  
    7373    , m_borderFit(RenderStyle::initialBorderFit())
    7474    , m_textCombine(RenderStyle::initialTextCombine())
     75#if ENABLE(CSS3_TEXT_DECORATION)
     76    , m_textDecorationStyle(RenderStyle::initialTextDecorationStyle())
     77#endif // CSS3_TEXT_DECORATION
    7578    , m_wrapFlow(RenderStyle::initialWrapFlow())
    7679    , m_wrapThrough(RenderStyle::initialWrapThrough())
     
    144147    , m_borderFit(o.m_borderFit)
    145148    , m_textCombine(o.m_textCombine)
     149#if ENABLE(CSS3_TEXT_DECORATION)
     150    , m_textDecorationStyle(o.m_textDecorationStyle)
     151#endif // CSS3_TEXT_DECORATION
    146152    , m_wrapFlow(o.m_wrapFlow)
    147153    , m_wrapThrough(o.m_wrapThrough)
     
    221227        && m_borderFit == o.m_borderFit
    222228        && m_textCombine == o.m_textCombine
     229#if ENABLE(CSS3_TEXT_DECORATION)
     230        && m_textDecorationStyle == o.m_textDecorationStyle
     231#endif // CSS3_TEXT_DECORATION
    223232        && m_wrapFlow == o.m_wrapFlow
    224233        && m_wrapThrough == o.m_wrapThrough
  • trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h

    r126032 r126054  
    177177    unsigned m_textCombine : 1; // CSS3 text-combine properties
    178178
     179#if ENABLE(CSS3_TEXT_DECORATION)
     180    unsigned m_textDecorationStyle : 3; // TextDecorationStyle
     181#endif // CSS3_TEXT_DECORATION
    179182    unsigned m_wrapFlow: 3; // WrapFlow
    180183    unsigned m_wrapThrough: 1; // WrapThrough
Note: See TracChangeset for help on using the changeset viewer.