Changeset 148070 in webkit


Ignore:
Timestamp:
Apr 9, 2013 5:32:39 PM (11 years ago)
Author:
dw.im@samsung.com
Message:

[CSS3] Parsing the property, text-justify.
https://bugs.webkit.org/show_bug.cgi?id=100058

Reviewed by Andreas Kling.

This patch implements the parsing side of the "text-justify" property specified
in CSS3 working draft, with "-webkit-" prefix, under ENABLE_CSS3_TEXT flag.
Specification link : http://www.w3.org/TR/css3-text/#text-justify

Source/WebCore:

Tests: fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify-inherited.html

fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify.html

  • css/CSSComputedStyleDeclaration.cpp:

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

  • css/CSSParser.cpp:

(WebCore::isValidKeywordPropertyAndValue):
(WebCore::isKeywordPropertyID):
(WebCore::CSSParser::parseValue):

  • css/CSSPrimitiveValueMappings.h:

(WebCore):
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator TextJustify):

  • css/CSSProperty.cpp:

(WebCore::CSSProperty::isInheritedProperty):

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

(WebCore::StyleBuilder::StyleBuilder):

  • css/StylePropertySet.cpp:

(WebCore):

  • css/StyleResolver.cpp:

(WebCore::StyleResolver::applyProperty):

  • rendering/style/RenderStyle.h:
  • rendering/style/RenderStyleConstants.h:
  • rendering/style/StyleRareInheritedData.cpp:

(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator==):

  • rendering/style/StyleRareInheritedData.h:

(StyleRareInheritedData):

LayoutTests:

  • fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify-expected.txt: Added.
  • fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify-inherited-expected.txt: Added.
  • fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify-inherited.html: Added.
  • fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify.html: Added.
  • fast/css3-text/css3-text-justify/getComputedStyle/script-tests/getComputedStyle-text-justify-inherited.js: Added.

(testComputedStyle):
(ownValueTest):
(inheritanceTest):

  • fast/css3-text/css3-text-justify/getComputedStyle/script-tests/getComputedStyle-text-justify.js: Added.

(testElementStyle):
(testComputedStyle):
(valueSettingTest):
(invalidValueSettingTest):

  • platform/mac/TestExpectations: ditto
  • platform/qt-4.8/TestExpectations: ditto
  • platform/qt-mac/TestExpectations: ditto
  • platform/qt/TestExpectations: ditto
Location:
trunk
Files:
9 added
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r148066 r148070  
     12013-04-09  Dongwoo Joshua Im  <dw.im@samsung.com>
     2
     3        [CSS3] Parsing the property, text-justify.
     4        https://bugs.webkit.org/show_bug.cgi?id=100058
     5
     6        Reviewed by Andreas Kling.
     7
     8        This patch implements the parsing side of the "text-justify" property specified
     9        in CSS3 working draft, with "-webkit-" prefix, under ENABLE_CSS3_TEXT flag.
     10        Specification link : http://www.w3.org/TR/css3-text/#text-justify
     11
     12        * fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify-expected.txt: Added.
     13        * fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify-inherited-expected.txt: Added.
     14        * fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify-inherited.html: Added.
     15        * fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify.html: Added.
     16        * fast/css3-text/css3-text-justify/getComputedStyle/script-tests/getComputedStyle-text-justify-inherited.js: Added.
     17        (testComputedStyle):
     18        (ownValueTest):
     19        (inheritanceTest):
     20        * fast/css3-text/css3-text-justify/getComputedStyle/script-tests/getComputedStyle-text-justify.js: Added.
     21        (testElementStyle):
     22        (testComputedStyle):
     23        (valueSettingTest):
     24        (invalidValueSettingTest):
     25        * platform/mac/TestExpectations: ditto
     26        * platform/qt-4.8/TestExpectations: ditto
     27        * platform/qt-mac/TestExpectations: ditto
     28        * platform/qt/TestExpectations: ditto
     29
    1302013-04-09  Simon Fraser  <simon.fraser@apple.com>
    231
  • trunk/LayoutTests/platform/mac/TestExpectations

    r148066 r148070  
    11661166webkit.org/b/58491 fast/css3-text/css3-text-decoration
    11671167webkit.org/b/76173 fast/css3-text/css3-text-align-last
     1168webkit.org/b/99945 fast/css3-text/css3-text-justify [ Failure ]
    11681169webkit.org/b/112755 fast/css3-text/css3-text-indent [ Failure ImageOnlyFailure ]
    11691170
  • trunk/LayoutTests/platform/qt-mac/TestExpectations

    r147956 r148070  
    57985798webkit.org/b/58491 fast/css3-text/css3-text-decoration
    57995799webkit.org/b/76173 fast/css3-text/css3-text-align-last
     5800webkit.org/b/99945 fast/css3-text/css3-text-justify [ Failure ]
    58005801webkit.org/b/112755 fast/css3-text/css3-text-indent [ Failure ImageOnlyFailure ]
    58015802
  • trunk/LayoutTests/platform/qt/TestExpectations

    r148009 r148070  
    352352webkit.org/b/58491 fast/css3-text/css3-text-decoration
    353353webkit.org/b/76173 fast/css3-text/css3-text-align-last
     354webkit.org/b/99945 fast/css3-text/css3-text-justify [ Failure ]
    354355webkit.org/b/112755 fast/css3-text/css3-text-indent [ Failure ImageOnlyFailure ]
    355356
  • trunk/Source/WebCore/ChangeLog

    r148069 r148070  
     12013-04-09  Dongwoo Joshua Im  <dw.im@samsung.com>
     2
     3        [CSS3] Parsing the property, text-justify.
     4        https://bugs.webkit.org/show_bug.cgi?id=100058
     5
     6        Reviewed by Andreas Kling.
     7
     8        This patch implements the parsing side of the "text-justify" property specified
     9        in CSS3 working draft, with "-webkit-" prefix, under ENABLE_CSS3_TEXT flag.
     10        Specification link : http://www.w3.org/TR/css3-text/#text-justify
     11
     12        Tests: fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify-inherited.html
     13               fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify.html
     14
     15        * css/CSSComputedStyleDeclaration.cpp:
     16        (WebCore):
     17        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
     18        * css/CSSParser.cpp:
     19        (WebCore::isValidKeywordPropertyAndValue):
     20        (WebCore::isKeywordPropertyID):
     21        (WebCore::CSSParser::parseValue):
     22        * css/CSSPrimitiveValueMappings.h:
     23        (WebCore):
     24        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
     25        (WebCore::CSSPrimitiveValue::operator TextJustify):
     26        * css/CSSProperty.cpp:
     27        (WebCore::CSSProperty::isInheritedProperty):
     28        * css/CSSPropertyNames.in:
     29        * css/CSSValueKeywords.in:
     30        * css/StyleBuilder.cpp:
     31        (WebCore::StyleBuilder::StyleBuilder):
     32        * css/StylePropertySet.cpp:
     33        (WebCore):
     34        * css/StyleResolver.cpp:
     35        (WebCore::StyleResolver::applyProperty):
     36        * rendering/style/RenderStyle.h:
     37        * rendering/style/RenderStyleConstants.h:
     38        * rendering/style/StyleRareInheritedData.cpp:
     39        (WebCore::StyleRareInheritedData::StyleRareInheritedData):
     40        (WebCore::StyleRareInheritedData::operator==):
     41        * rendering/style/StyleRareInheritedData.h:
     42        (StyleRareInheritedData):
     43
    1442013-04-09  Joone Hur  <joone.hur@intel.com>
    245
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r148049 r148070  
    193193    CSSPropertyWebkitTextDecorationColor,
    194194    CSSPropertyWebkitTextAlignLast,
     195    CSSPropertyWebkitTextJustify,
    195196    CSSPropertyWebkitTextUnderlinePosition,
    196197#endif // CSS3_TEXT
     
    21622163        case CSSPropertyWebkitTextAlignLast:
    21632164            return cssValuePool().createValue(style->textAlignLast());
     2165        case CSSPropertyWebkitTextJustify:
     2166            return cssValuePool().createValue(style->textJustify());
    21642167        case CSSPropertyWebkitTextUnderlinePosition:
    21652168            return cssValuePool().createValue(style->textUnderlinePosition());
  • trunk/Source/WebCore/css/CSSParser.cpp

    r147430 r148070  
    998998            return true;
    999999        break;
     1000#if ENABLE(CSS3_TEXT)
     1001    case CSSPropertyWebkitTextJustify:
     1002        // auto | none | inter-word | inter-ideograph | inter-cluster | distribute | kashida
     1003        if ((valueID >= CSSValueInterWord && valueID <= CSSValueKashida) || valueID == CSSValueAuto || valueID == CSSValueNone)
     1004            return true;
     1005        break;
     1006#endif // CSS3_TEXT
    10001007    case CSSPropertyWebkitTextSecurity:
    10011008        // disc | circle | square | none | inherit
     
    11531160    case CSSPropertyWebkitTextCombine:
    11541161    case CSSPropertyWebkitTextEmphasisPosition:
     1162#if ENABLE(CSS3_TEXT)
     1163    case CSSPropertyWebkitTextJustify:
     1164#endif // CSS3_TEXT
    11551165    case CSSPropertyWebkitTextSecurity:
    11561166    case CSSPropertyWebkitTransformStyle:
     
    30623072    case CSSPropertyWebkitTextCombine:
    30633073    case CSSPropertyWebkitTextEmphasisPosition:
     3074#if ENABLE(CSS3_TEXT)
     3075    case CSSPropertyWebkitTextJustify:
     3076#endif // CSS3_TEXT
    30643077    case CSSPropertyWebkitTextSecurity:
    30653078    case CSSPropertyWebkitTransformStyle:
  • trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h

    r147348 r148070  
    23572357    ASSERT_NOT_REACHED();
    23582358    return TextAlignLastAuto;
     2359}
     2360
     2361template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextJustify e)
     2362    : CSSValue(PrimitiveClass)
     2363{
     2364    m_primitiveUnitType = CSS_IDENT;
     2365    switch (e) {
     2366    case TextJustifyAuto:
     2367        m_value.ident = CSSValueAuto;
     2368        break;
     2369    case TextJustifyNone:
     2370        m_value.ident = CSSValueNone;
     2371        break;
     2372    case TextJustifyInterWord:
     2373        m_value.ident = CSSValueInterWord;
     2374        break;
     2375    case TextJustifyInterIdeograph:
     2376        m_value.ident = CSSValueInterIdeograph;
     2377        break;
     2378    case TextJustifyInterCluster:
     2379        m_value.ident = CSSValueInterCluster;
     2380        break;
     2381    case TextJustifyDistribute:
     2382        m_value.ident = CSSValueDistribute;
     2383        break;
     2384    case TextJustifyKashida:
     2385        m_value.ident = CSSValueKashida;
     2386        break;
     2387    }
     2388}
     2389
     2390template<> inline CSSPrimitiveValue::operator TextJustify() const
     2391{
     2392    switch (m_value.ident) {
     2393    case CSSValueAuto:
     2394        return TextJustifyAuto;
     2395    case CSSValueNone:
     2396        return TextJustifyNone;
     2397    case CSSValueInterWord:
     2398        return TextJustifyInterWord;
     2399    case CSSValueInterIdeograph:
     2400        return TextJustifyInterIdeograph;
     2401    case CSSValueInterCluster:
     2402        return TextJustifyInterCluster;
     2403    case CSSValueDistribute:
     2404        return TextJustifyDistribute;
     2405    case CSSValueKashida:
     2406        return TextJustifyKashida;
     2407    }
     2408
     2409    ASSERT_NOT_REACHED();
     2410    return TextJustifyAuto;
    23592411}
    23602412#endif // CSS3_TEXT
  • trunk/Source/WebCore/css/CSSProperty.cpp

    r147348 r148070  
    333333    case CSSPropertyWebkitTextDecorationLine:
    334334    case CSSPropertyWebkitTextAlignLast:
     335    case CSSPropertyWebkitTextJustify:
    335336    case CSSPropertyWebkitTextUnderlinePosition:
    336337#endif // CSS3_TEXT
  • trunk/Source/WebCore/css/CSSPropertyNames.in

    r146274 r148070  
    376376-webkit-text-decoration-color
    377377-webkit-text-align-last
     378-webkit-text-justify
    378379-webkit-text-underline-position
    379380#endif
  • trunk/Source/WebCore/css/CSSValueKeywords.in

    r146408 r148070  
    220220-webkit-center
    221221-webkit-match-parent
     222//
     223// CSS_PROP_TEXT_JUSTIFY:
     224//
     225//auto
     226//none
     227inter-word
     228inter-ideograph
     229inter-cluster
     230distribute
     231kashida
    222232//
    223233// CSS_PROP_LIST_STYLE_POSITION:
  • trunk/Source/WebCore/css/StyleBuilder.cpp

    r148059 r148070  
    21882188    setPropertyHandler(CSSPropertyWebkitTextDecorationColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textDecorationColor, &RenderStyle::setTextDecorationColor, &RenderStyle::setVisitedLinkTextDecorationColor, &RenderStyle::color>::createHandler());
    21892189    setPropertyHandler(CSSPropertyWebkitTextAlignLast, ApplyPropertyDefault<TextAlignLast, &RenderStyle::textAlignLast, TextAlignLast, &RenderStyle::setTextAlignLast, TextAlignLast, &RenderStyle::initialTextAlignLast>::createHandler());
     2190    setPropertyHandler(CSSPropertyWebkitTextJustify, ApplyPropertyDefault<TextJustify, &RenderStyle::textJustify, TextJustify, &RenderStyle::setTextJustify, TextJustify, &RenderStyle::initialTextJustify>::createHandler());
    21902191    setPropertyHandler(CSSPropertyWebkitTextUnderlinePosition, ApplyPropertyTextUnderlinePosition::createHandler());
    21912192#endif // CSS3_TEXT
  • trunk/Source/WebCore/css/StylePropertySet.cpp

    r147962 r148070  
    10981098#if ENABLE(CSS3_TEXT)
    10991099    CSSPropertyWebkitTextAlignLast,
     1100    CSSPropertyWebkitTextJustify,
    11001101#endif // CSS3_TEXT
    11011102    CSSPropertyTextIndent,
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r147350 r148070  
    31193119    case CSSPropertyWebkitTextDecorationColor:
    31203120    case CSSPropertyWebkitTextAlignLast:
     3121    case CSSPropertyWebkitTextJustify:
    31213122    case CSSPropertyWebkitTextUnderlinePosition:
    31223123#endif // CSS3_TEXT
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r147350 r148070  
    579579    TextDecorationStyle textDecorationStyle() const { return static_cast<TextDecorationStyle>(rareNonInheritedData->m_textDecorationStyle); }
    580580    TextAlignLast textAlignLast() const { return static_cast<TextAlignLast>(rareInheritedData->m_textAlignLast); }
     581    TextJustify textJustify() const { return static_cast<TextJustify>(rareInheritedData->m_textJustify); }
    581582    TextUnderlinePosition textUnderlinePosition() const { return static_cast<TextUnderlinePosition>(rareInheritedData->m_textUnderlinePosition); }
    582583#else
     
    11471148    void setTextDecorationStyle(TextDecorationStyle v) { SET_VAR(rareNonInheritedData, m_textDecorationStyle, v); }
    11481149    void setTextAlignLast(TextAlignLast v) { SET_VAR(rareInheritedData, m_textAlignLast, v); }
     1150    void setTextJustify(TextJustify v) { SET_VAR(rareInheritedData, m_textJustify, v); }
    11491151    void setTextUnderlinePosition(TextUnderlinePosition v) { SET_VAR(rareInheritedData, m_textUnderlinePosition, v); }
    11501152#endif // CSS3_TEXT
     
    16301632    static TextDecorationStyle initialTextDecorationStyle() { return TextDecorationStyleSolid; }
    16311633    static TextAlignLast initialTextAlignLast() { return TextAlignLastAuto; }
     1634    static TextJustify initialTextJustify() { return TextJustifyAuto; }
    16321635    static TextUnderlinePosition initialTextUnderlinePosition() { return TextUnderlinePositionAuto; }
    16331636#endif // CSS3_TEXT
  • trunk/Source/WebCore/rendering/style/RenderStyleConstants.h

    r146408 r148070  
    364364    TextUnderlinePositionAuto = 0x1, TextUnderlinePositionAlphabetic = 0x2, TextUnderlinePositionUnder = 0x4
    365365};
     366
     367enum TextJustify {
     368    TextJustifyAuto, TextJustifyNone, TextJustifyInterWord, TextJustifyInterIdeograph, TextJustifyInterCluster, TextJustifyDistribute, TextJustifyKashida
     369};
    366370#endif // CSS3_TEXT
    367371
  • trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp

    r146408 r148070  
    107107#if ENABLE(CSS3_TEXT)
    108108    , m_textAlignLast(RenderStyle::initialTextAlignLast())
     109    , m_textJustify(RenderStyle::initialTextJustify())
    109110    , m_textUnderlinePosition(RenderStyle::initialTextUnderlinePosition())
    110111#endif // CSS3_TEXT
     
    180181#if ENABLE(CSS3_TEXT)
    181182    , m_textAlignLast(o.m_textAlignLast)
     183    , m_textJustify(o.m_textJustify)
    182184    , m_textUnderlinePosition(o.m_textUnderlinePosition)
    183185#endif // CSS3_TEXT
     
    279281#if ENABLE(CSS3_TEXT)
    280282        && m_textAlignLast == o.m_textAlignLast
     283        && m_textJustify == o.m_textJustify
    281284        && m_textUnderlinePosition == o.m_textUnderlinePosition
    282285#endif // CSS3_TEXT
  • trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h

    r146408 r148070  
    121121#if ENABLE(CSS3_TEXT)
    122122    unsigned m_textAlignLast : 3; // TextAlignLast
     123    unsigned m_textJustify : 3; // TextJustify
    123124    unsigned m_textUnderlinePosition : 3; // TextUnderlinePosition
    124125#endif // CSS3_TEXT
Note: See TracChangeset for help on using the changeset viewer.