⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 98748 in webkit


Ignore:
Timestamp:
Oct 28, 2011, 12:15:26 PM (15 years ago)
Author:
macpherson@chromium.org
Message:

Use enum instead of bool to represent -webkit-column-span property.
https://bugs.webkit.org/show_bug.cgi?id=70867

Reviewed by Darin Adler.

Covered by existing tests.

  • css/CSSPrimitiveValueMappings.h:

(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator ColumnSpan):

  • css/CSSStyleSelector.cpp:

(WebCore::CSSStyleSelector::applyProperty):

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::createAnonymousColumnSpanBlock):

  • rendering/RenderObject.cpp:

(WebCore::RenderObject::propagateStyleToAnonymousChildren):

  • rendering/style/RenderStyle.h:

(WebCore::InheritedFlags::columnSpan):
(WebCore::InheritedFlags::setColumnSpan):
(WebCore::InheritedFlags::initialColumnSpan):

  • rendering/style/RenderStyleConstants.h:
  • rendering/style/StyleMultiColData.h:
Location:
trunk/Source/WebCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r98747 r98748  
     12011-10-28  Luke Macpherson   <macpherson@chromium.org>
     2
     3        Use enum instead of bool to represent -webkit-column-span property.
     4        https://bugs.webkit.org/show_bug.cgi?id=70867
     5
     6        Reviewed by Darin Adler.
     7
     8        Covered by existing tests.
     9
     10        * css/CSSPrimitiveValueMappings.h:
     11        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
     12        (WebCore::CSSPrimitiveValue::operator ColumnSpan):
     13        * css/CSSStyleSelector.cpp:
     14        (WebCore::CSSStyleSelector::applyProperty):
     15        * rendering/RenderBlock.cpp:
     16        (WebCore::RenderBlock::createAnonymousColumnSpanBlock):
     17        * rendering/RenderObject.cpp:
     18        (WebCore::RenderObject::propagateStyleToAnonymousChildren):
     19        * rendering/style/RenderStyle.h:
     20        (WebCore::InheritedFlags::columnSpan):
     21        (WebCore::InheritedFlags::setColumnSpan):
     22        (WebCore::InheritedFlags::initialColumnSpan):
     23        * rendering/style/RenderStyleConstants.h:
     24        * rendering/style/StyleMultiColData.h:
     25
    1262011-10-28  Mark Hahnenberg  <mhahnenberg@apple.com>
    227
  • trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h

    r98608 r98748  
    131131}
    132132
     133template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColumnSpan columnSpan)
     134    : m_hasCachedCSSText(false)
     135{
     136    switch (columnSpan) {
     137    case ColumnSpanAll:
     138        m_type = CSS_IDENT;
     139        m_value.ident = CSSValueAll;
     140        break;
     141    case ColumnSpanOne:
     142        m_type = CSS_NUMBER;
     143        m_value.num = 1;
     144        break;
     145    }
     146}
     147
     148template<> inline CSSPrimitiveValue::operator ColumnSpan() const
     149{
     150    if (m_type == CSS_IDENT && m_value.ident == CSSValueAll)
     151        return ColumnSpanAll;
     152    if (m_type == CSS_NUMBER && m_value.num == 1)
     153        return ColumnSpanOne;
     154    ASSERT_NOT_REACHED();
     155    return ColumnSpanOne;
     156}
     157
    133158template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBorderStyle e)
    134159    : m_type(CSS_IDENT)
  • trunk/Source/WebCore/css/CSSStyleSelector.cpp

    r98675 r98748  
    24782478    bool isInitial = valueType == CSSValue::CSS_INITIAL || (!m_parentNode && valueType == CSSValue::CSS_INHERIT);
    24792479
     2480    ASSERT(!isInherit || !isInitial); // isInherit -> !isInitial && isInitial -> !isInherit
     2481
    24802482    if (!applyPropertyToRegularStyle() && (!applyPropertyToVisitedLinkStyle() || !isValidVisitedLinkProperty(id))) {
    24812483        // Limit the properties that can be applied to only the ones honored by :visited.
     
    33573359        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(boxSizing, BoxSizing);
    33583360        return;
    3359     case CSSPropertyWebkitColumnSpan: {
    3360         HANDLE_INHERIT_AND_INITIAL(columnSpan, ColumnSpan)
    3361         m_style->setColumnSpan(primitiveValue->getIdent() == CSSValueAll);
    3362         return;
    3363     }
     3361    case CSSPropertyWebkitColumnSpan:
     3362        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(columnSpan, ColumnSpan)
     3363        return;
    33643364    case CSSPropertyWebkitColumnRuleStyle:
    33653365        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE_WITH_VALUE(columnRuleStyle, ColumnRuleStyle, BorderStyle)
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r98608 r98748  
    62236223{
    62246224    RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyle(style());
    6225     newStyle->setColumnSpan(true);
     6225    newStyle->setColumnSpan(ColumnSpanAll);
    62266226    newStyle->setDisplay(BLOCK);
    62276227
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r97448 r98748  
    19071907                newStyle->inheritColumnPropertiesFrom(style());
    19081908            if (child->style()->columnSpan())
    1909                 newStyle->setColumnSpan(true);
     1909                newStyle->setColumnSpan(ColumnSpanAll);
    19101910        }
    19111911        newStyle->setDisplay(child->style()->display());
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r98638 r98748  
    774774    unsigned short columnRuleWidth() const { return rareNonInheritedData->m_multiCol->ruleWidth(); }
    775775    bool columnRuleIsTransparent() const { return rareNonInheritedData->m_multiCol->m_rule.isTransparent(); }
    776     bool columnSpan() const { return rareNonInheritedData->m_multiCol->m_columnSpan; }
     776    ColumnSpan columnSpan() const { return static_cast<ColumnSpan>(rareNonInheritedData->m_multiCol->m_columnSpan); }
    777777    EPageBreak columnBreakBefore() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakBefore); }
    778778    EPageBreak columnBreakInside() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakInside); }
     
    11651165    void setColumnRuleWidth(unsigned short w) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_width, w); }
    11661166    void resetColumnRule() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule, BorderValue()) }
    1167     void setColumnSpan(bool b) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_columnSpan, b); }
     1167    void setColumnSpan(ColumnSpan columnSpan) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_columnSpan, columnSpan); }
    11681168    void setColumnBreakBefore(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakBefore, p); }
    11691169    // For valid values of column-break-inside see http://www.w3.org/TR/css3-multicol/#break-before-break-after-break-inside
     
    14521452    static float initialTextStrokeWidth() { return 0; }
    14531453    static unsigned short initialColumnCount() { return 1; }
    1454     static bool initialColumnSpan() { return false; }
     1454    static ColumnSpan initialColumnSpan() { return ColumnSpanOne; }
    14551455    static const TransformOperations& initialTransform() { DEFINE_STATIC_LOCAL(TransformOperations, ops, ()); return ops; }
    14561456    static Length initialTransformOriginX() { return Length(50.0, Percent); }
  • trunk/Source/WebCore/rendering/style/RenderStyleConstants.h

    r98608 r98748  
    8383    PUBLIC_PSEUDOID_MASK = ((1 << FIRST_INTERNAL_PSEUDOID) - 1) & ~((1 << FIRST_PUBLIC_PSEUDOID) - 1)
    8484};
     85
     86enum ColumnSpan { ColumnSpanOne = 0, ColumnSpanAll};
    8587
    8688enum EBorderCollapse { BSEPARATE = 0, BCOLLAPSE = 1 };
  • trunk/Source/WebCore/rendering/style/StyleMultiColData.h

    r98608 r98748  
    6363    bool m_autoCount : 1;
    6464    bool m_normalGap : 1;
    65     bool m_columnSpan : 1;
     65    unsigned m_columnSpan : 1;
    6666    unsigned m_breakBefore : 2; // EPageBreak
    6767    unsigned m_breakAfter : 2; // EPageBreak
Note: See TracChangeset for help on using the changeset viewer.