Changeset 67667 in webkit


Ignore:
Timestamp:
Sep 16, 2010 2:37:06 PM (14 years ago)
Author:
hyatt@apple.com
Message:

https://bugs.webkit.org/show_bug.cgi?id=45020
Support "block-flow" and "writing-mode": interpret properties into RenderStyle

Patch by takano takumi <takano1@asia.apple.com> on 2010-09-16
Reviewed by Dave Hyatt.

Added code that interprets "block-flow" property and "writing-mode" property settings
into a RenderStyle object.

WebCore:

Test: fast/text/international/block-flow-parser-test.html

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):

  • css/CSSParser.cpp:

(WebCore::CSSParser::parseValue):

  • css/CSSPrimitiveValueMappings.h:

(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator EBlockFlowDirection):

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

(WebCore::CSSStyleSelector::applyProperty):

  • css/CSSValueKeywords.in:
  • css/SVGCSSValueKeywords.in:
  • rendering/style/RenderStyle.cpp:

(WebCore::RenderStyle::diff):

  • rendering/style/RenderStyle.h:

(WebCore::InheritedFlags::setBitDefaults):
(WebCore::InheritedFlags::blockFlow):
(WebCore::InheritedFlags::setBlockFlow):
(WebCore::InheritedFlags::initialBlockFlow):

  • rendering/style/RenderStyleConstants.h:

LayoutTests:

  • fast/css/getComputedStyle/computed-style-expected.txt:
  • fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
  • fast/text/international/block-flow-parser-test-expected.txt: Added.
  • fast/text/international/block-flow-parser-test.html: Added.
  • svg/css/getComputedStyle-basic-expected.txt:
Location:
trunk
Files:
2 added
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r67660 r67667  
     12010-09-16  takano takumi  <takano1@asia.apple.com>
     2
     3        Reviewed by Dave Hyatt.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=45020
     6        Support "block-flow" and "writing-mode": interpret properties into RenderStyle
     7 
     8        Added code that interprets "block-flow" property and "writing-mode" property settings
     9        into a RenderStyle object.
     10
     11        * fast/css/getComputedStyle/computed-style-expected.txt:
     12        * fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
     13        * fast/text/international/block-flow-parser-test-expected.txt: Added.
     14        * fast/text/international/block-flow-parser-test.html: Added.
     15        * svg/css/getComputedStyle-basic-expected.txt:
     16
    1172010-09-15  David Hyatt  <hyatt@apple.com>
    218
  • trunk/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt

    r66585 r67667  
    9797-webkit-background-origin: padding-box;
    9898-webkit-background-size: auto auto;
     99-webkit-block-flow: tb;
    99100-webkit-border-fit: border;
    100101-webkit-border-image: none;
  • trunk/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt

    r66585 r67667  
    9696    -webkit-background-origin: padding-box
    9797    -webkit-background-size: auto auto
     98    -webkit-block-flow: tb
    9899    -webkit-border-fit: border
    99100    -webkit-border-image: none
  • trunk/LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-expected.txt

    r66591 r67667  
    108108-webkit-background-origin: padding-box;
    109109-webkit-background-size: auto auto;
     110-webkit-block-flow: tb;
    110111-webkit-border-fit: border;
    111112-webkit-border-horizontal-spacing: 0px;
  • trunk/LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt

    r66591 r67667  
    107107    -webkit-background-origin: padding-box
    108108    -webkit-background-size: auto auto
     109    -webkit-block-flow: tb
    109110    -webkit-border-fit: border
    110111    -webkit-border-horizontal-spacing: 0px
  • trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt

    r66585 r67667  
    213213rect: style.getPropertyValue(-webkit-background-size) : auto auto
    214214rect: style.getPropertyCSSValue(-webkit-background-size) : [object CSSValueList]
     215rect: style.getPropertyValue(-webkit-block-flow) : tb
     216rect: style.getPropertyCSSValue(-webkit-block-flow) : [object CSSPrimitiveValue]
    215217rect: style.getPropertyValue(-webkit-border-fit) : border
    216218rect: style.getPropertyCSSValue(-webkit-border-fit) : [object CSSPrimitiveValue]
     
    633635g: style.getPropertyValue(-webkit-background-size) : auto auto
    634636g: style.getPropertyCSSValue(-webkit-background-size) : [object CSSValueList]
     637g: style.getPropertyValue(-webkit-block-flow) : tb
     638g: style.getPropertyCSSValue(-webkit-block-flow) : [object CSSPrimitiveValue]
    635639g: style.getPropertyValue(-webkit-border-fit) : border
    636640g: style.getPropertyCSSValue(-webkit-border-fit) : [object CSSPrimitiveValue]
  • trunk/WebCore/ChangeLog

    r67664 r67667  
     12010-09-16  takano takumi  <takano1@asia.apple.com>
     2
     3        Reviewed by Dave Hyatt.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=45020
     6        Support "block-flow" and "writing-mode": interpret properties into RenderStyle
     7 
     8        Added code that interprets "block-flow" property and "writing-mode" property settings
     9        into a RenderStyle object.
     10
     11        Test: fast/text/international/block-flow-parser-test.html
     12
     13        * css/CSSComputedStyleDeclaration.cpp:
     14        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
     15        * css/CSSParser.cpp:
     16        (WebCore::CSSParser::parseValue):
     17        * css/CSSPrimitiveValueMappings.h:
     18        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
     19        (WebCore::CSSPrimitiveValue::operator EBlockFlowDirection):
     20        * css/CSSPropertyNames.in:
     21        * css/CSSStyleSelector.cpp:
     22        (WebCore::CSSStyleSelector::applyProperty):
     23        * css/CSSValueKeywords.in:
     24        * css/SVGCSSValueKeywords.in:
     25        * rendering/style/RenderStyle.cpp:
     26        (WebCore::RenderStyle::diff):
     27        * rendering/style/RenderStyle.h:
     28        (WebCore::InheritedFlags::setBitDefaults):
     29        (WebCore::InheritedFlags::blockFlow):
     30        (WebCore::InheritedFlags::setBlockFlow):
     31        (WebCore::InheritedFlags::initialBlockFlow):
     32        * rendering/style/RenderStyleConstants.h:
     33
    1342010-09-16  Martin Robinson  <mrobinson@igalia.com>
    235
  • trunk/WebCore/css/CSSComputedStyleDeclaration.cpp

    r67634 r67667  
    159159    CSSPropertyWebkitBackgroundOrigin,
    160160    CSSPropertyWebkitBackgroundSize,
     161    CSSPropertyWebkitBlockFlow,
    161162    CSSPropertyWebkitBorderFit,
    162163    CSSPropertyWebkitBorderHorizontalSpacing,
     
    13531354        case CSSPropertyWebkitBackfaceVisibility:
    13541355            return CSSPrimitiveValue::createIdentifier((style->backfaceVisibility() == BackfaceVisibilityHidden) ? CSSValueHidden : CSSValueVisible);
     1356        case CSSPropertyWebkitBlockFlow:
     1357            return CSSPrimitiveValue::create(style->blockFlow());
    13551358        case CSSPropertyWebkitBorderImage:
    13561359            return valueForNinePieceImage(style->borderImage());
     
    14721475        case CSSPropertyMargin:
    14731476        case CSSPropertyPadding:
     1477        case CSSPropertyWebkitWritingMode:
    14741478            break;
    14751479
  • trunk/WebCore/css/CSSParser.cpp

    r67574 r67667  
    17201720        break;
    17211721#endif
     1722
     1723    // CSS Text Layout Module Level 3: Vertical writing support
     1724    case CSSPropertyWebkitBlockFlow:
     1725        // [ "tb" | "rl" | "lr" | "bt" ]
     1726        if (id == CSSValueTb || id == CSSValueRl || id == CSSValueLr || id == CSSValueBt)
     1727            validPrimitive = true;
     1728        break;
     1729
     1730    case CSSPropertyWebkitWritingMode:
     1731        // [ "lr-tb" | "rl-tb" | "tb-rl" | "bt-rl" | "tb-lr" | "bt-lr" ]
     1732        if (id == CSSValueLrTb || id == CSSValueRlTb || id == CSSValueTbRl || id == CSSValueBtRl || id == CSSValueTbLr || id == CSSValueBtLr)
     1733            validPrimitive = true;
     1734        break;
    17221735
    17231736#if ENABLE(SVG)
  • trunk/WebCore/css/CSSPrimitiveValueMappings.h

    r66581 r67667  
    20042004}
    20052005
     2006template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBlockFlowDirection e)
     2007    : m_type(CSS_IDENT)
     2008    , m_hasCachedCSSText(false)
     2009{
     2010    switch (e) {
     2011    case TopToBottomBlockFlow:
     2012        m_value.ident = CSSValueTb;
     2013        break;
     2014    case RightToLeftBlockFlow:
     2015        m_value.ident = CSSValueRl;
     2016        break;
     2017    case LeftToRightBlockFlow:
     2018        m_value.ident = CSSValueLr;
     2019        break;
     2020    case BottomToTopBlockFlow:
     2021        m_value.ident = CSSValueBt;
     2022        break;
     2023    }
     2024}
     2025
     2026template<> inline CSSPrimitiveValue::operator EBlockFlowDirection() const
     2027{
     2028    switch (m_value.ident) {
     2029    case CSSValueTb:
     2030        return TopToBottomBlockFlow;
     2031    case CSSValueRl:
     2032        return RightToLeftBlockFlow;
     2033    case CSSValueLr:
     2034        return LeftToRightBlockFlow;
     2035    case CSSValueBt:
     2036        return BottomToTopBlockFlow;
     2037    default:
     2038        ASSERT_NOT_REACHED();
     2039        return TopToBottomBlockFlow;
     2040    }
     2041}
     2042
    20062043template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPointerEvents e)
    20072044    : m_type(CSS_IDENT)
  • trunk/WebCore/css/CSSPropertyNames.in

    r66109 r67667  
    174174# whereas background-size: l; is equivalent to background-size: l auto;
    175175-webkit-background-size
     176# CSS Text Layout Module Level 3: Vertical writing support
     177-webkit-block-flow
    176178-webkit-border-end
    177179-webkit-border-end-color
     
    276278-webkit-user-select
    277279-webkit-variable-declaration-block
     280# CSS Text Layout Module Level 3: Vertical writing support
     281-webkit-writing-mode
  • trunk/WebCore/css/CSSStyleSelector.cpp

    r67653 r67667  
    55215521        return;
    55225522#endif
     5523
     5524    // CSS Text Layout Module Level 3: Vertical writing support
     5525    case CSSPropertyWebkitBlockFlow:
     5526        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(blockFlow, BlockFlow)
     5527        return;
     5528
     5529    case CSSPropertyWebkitWritingMode:
     5530        // The 'writing-mode' property is a shorthand property for the 'direction' property and the 'block-flow' property.
     5531        if (isInherit) {
     5532            m_style->setDirection(m_parentStyle->direction());
     5533            m_style->setBlockFlow(m_parentStyle->blockFlow());
     5534        } else if (isInitial) {
     5535            m_style->setDirection(m_style->initialDirection());
     5536            m_style->setBlockFlow(m_style->initialBlockFlow());
     5537        } else {
     5538            if (!primitiveValue)
     5539                return;
     5540            switch (primitiveValue->getIdent()) {
     5541            case CSSValueLrTb:
     5542                m_style->setDirection(LTR);
     5543                m_style->setBlockFlow(TopToBottomBlockFlow);
     5544                break;
     5545            case CSSValueRlTb:
     5546                m_style->setDirection(RTL);
     5547                m_style->setBlockFlow(TopToBottomBlockFlow);
     5548                break;
     5549            case CSSValueTbRl:
     5550                m_style->setDirection(LTR);
     5551                m_style->setBlockFlow(RightToLeftBlockFlow);
     5552                break;
     5553            case CSSValueBtRl:
     5554                m_style->setDirection(RTL);
     5555                m_style->setBlockFlow(RightToLeftBlockFlow);
     5556                break;
     5557            case CSSValueTbLr:
     5558                m_style->setDirection(LTR);
     5559                m_style->setBlockFlow(LeftToRightBlockFlow);
     5560                break;
     5561            case CSSValueBtLr:
     5562                m_style->setDirection(RTL);
     5563                m_style->setBlockFlow(LeftToRightBlockFlow);
     5564                break;
     5565            default:
     5566                break;
     5567            }
     5568        }
     5569        return;
    55235570
    55245571#if ENABLE(SVG)
  • trunk/WebCore/css/CSSValueKeywords.in

    r67032 r67667  
    743743manual
    744744# auto
     745
     746# -webkit-block-flow
     747tb
     748rl
     749lr
     750bt
     751
     752# -webkit-writing-mode
     753lr-tb
     754rl-tb
     755tb-rl
     756bt-rl
     757tb-lr
     758bt-lr
  • trunk/WebCore/css/SVGCSSValueKeywords.in

    r60885 r67667  
    277277# none
    278278non-scaling-stroke
    279 
    280 
    281 # CSS_PROP_WRITING_MODE
    282 lr-tb
    283 rl-tb
    284 tb-rl
    285 lr
    286 rl
    287 tb
  • trunk/WebCore/rendering/style/RenderStyle.cpp

    r66615 r67667  
    440440        inherited_flags._white_space != other->inherited_flags._white_space ||
    441441        noninherited_flags._clear != other->noninherited_flags._clear)
     442        return StyleDifferenceLayout;
     443
     444    // Check block flow direction.
     445    if (inherited_flags._blockFlow != other->inherited_flags._blockFlow)
    442446        return StyleDifferenceLayout;
    443447
  • trunk/WebCore/rendering/style/RenderStyle.h

    r67568 r67667  
    179179                   (_force_backgrounds_to_white == other._force_backgrounds_to_white) &&
    180180                   (_pointerEvents == other._pointerEvents) &&
    181                    (_insideLink == other._insideLink);
     181                   (_insideLink == other._insideLink) &&
     182                   (_blockFlow == other._blockFlow);
    182183        }
    183184
     
    205206        unsigned _insideLink : 2; // EInsideLink
    206207        // 43 bits
     208
     209        // CSS Text Layout Module Level 3: Vertical writing support
     210        unsigned _blockFlow : 2; // EBlockFlowDirection
     211        // 45 bits
    207212    } inherited_flags;
    208213
     
    280285        inherited_flags._pointerEvents = initialPointerEvents();
    281286        inherited_flags._insideLink = NotInsideLink;
     287        inherited_flags._blockFlow = initialBlockFlow();
    282288
    283289        noninherited_flags._effectiveDisplay = noninherited_flags._originalDisplay = initialDisplay();
     
    712718    bool textSizeAdjust() const { return rareInheritedData->textSizeAdjust; }
    713719    ETextSecurity textSecurity() const { return static_cast<ETextSecurity>(rareInheritedData->textSecurity); }
     720
     721    EBlockFlowDirection blockFlow() const { return static_cast<EBlockFlowDirection>(inherited_flags._blockFlow); }
    714722
    715723// attribute setter methods
     
    10881096    }
    10891097
     1098    void setBlockFlow(EBlockFlowDirection v) { inherited_flags._blockFlow = v; }
     1099
    10901100    // To tell if this style matched attribute selectors. This makes it impossible to share.
    10911101    bool affectedByAttributeSelectors() const { return m_affectedByAttributeSelectors; }
     
    11271137    static EClear initialClear() { return CNONE; }
    11281138    static TextDirection initialDirection() { return LTR; }
     1139    static EBlockFlowDirection initialBlockFlow() { return TopToBottomBlockFlow; }
    11291140    static EDisplay initialDisplay() { return INLINE; }
    11301141    static EEmptyCell initialEmptyCells() { return SHOW; }
  • trunk/WebCore/rendering/style/RenderStyleConstants.h

    r67032 r67667  
    127127enum EUnicodeBidi {
    128128    UBNormal, Embed, Override
     129};
     130
     131// CSS Text Layout Module Level 3: Vertical writing support
     132enum EBlockFlowDirection {
     133    TopToBottomBlockFlow, RightToLeftBlockFlow, LeftToRightBlockFlow, BottomToTopBlockFlow
    129134};
    130135
Note: See TracChangeset for help on using the changeset viewer.