Changeset 84380 in webkit


Ignore:
Timestamp:
Apr 20, 2011 9:14:37 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-04-20 Luke Macpherson <macpherson@chromium.org>

Reviewed by Dimitri Glazkov.

Allow casting between CSSPrimitiveValue and EBorderCollapse to remove special-case logic from CSSStyleSelector.
https://bugs.webkit.org/show_bug.cgi?id=58964

No new tests as no new functionality added.

  • css/CSSPrimitiveValueMappings.h: Support casting to/from EBorderCollapse.
  • css/CSSStyleSelector.cpp: Use new casting ability to simplify code.
  • rendering/style/RenderStyle.h: Use EBorderCollapse instead of a bool for representing border collapse member variable.
  • rendering/style/RenderStyleConstants.h: Added EBorderCollapse enum.
Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r84374 r84380  
     12011-04-20  Luke Macpherson   <macpherson@chromium.org>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        Allow casting between CSSPrimitiveValue and EBorderCollapse to remove special-case logic from CSSStyleSelector.
     6        https://bugs.webkit.org/show_bug.cgi?id=58964
     7
     8        No new tests as no new functionality added.
     9
     10        * css/CSSPrimitiveValueMappings.h:
     11        Support casting to/from EBorderCollapse.
     12        * css/CSSStyleSelector.cpp:
     13        Use new casting ability to simplify code.
     14        * rendering/style/RenderStyle.h:
     15        Use EBorderCollapse instead of a bool for representing border collapse member variable.
     16        * rendering/style/RenderStyleConstants.h:
     17        Added EBorderCollapse enum.
     18
    1192011-04-19  Stephen White  <senorblanco@chromium.org>
    220
  • trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h

    r82828 r84380  
    26432643}
    26442644
     2645template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBorderCollapse e)
     2646    : m_type(CSS_IDENT)
     2647    , m_hasCachedCSSText(false)
     2648{
     2649    switch (e) {
     2650    case BSEPARATE:
     2651        m_value.ident = CSSValueSeparate;
     2652        break;
     2653    case BCOLLAPSE:
     2654        m_value.ident = CSSValueCollapse;
     2655        break;
     2656    }
     2657}
     2658
     2659template<> inline CSSPrimitiveValue::operator EBorderCollapse() const
     2660{
     2661    switch (m_value.ident) {
     2662    case CSSValueSeparate:
     2663        return BSEPARATE;
     2664    case CSSValueCollapse:
     2665        return BCOLLAPSE;
     2666    default:
     2667        ASSERT_NOT_REACHED();
     2668        return BSEPARATE;
     2669    }
     2670}
     2671
    26452672template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EColorInterpolation e)
    26462673    : m_type(CSS_IDENT)
  • trunk/Source/WebCore/css/CSSStyleSelector.cpp

    r83986 r84380  
    35873587// ident only properties
    35883588    case CSSPropertyBorderCollapse:
    3589         HANDLE_INHERIT_AND_INITIAL(borderCollapse, BorderCollapse)
    3590         if (!primitiveValue)
    3591             return;
    3592         switch (primitiveValue->getIdent()) {
    3593             case CSSValueCollapse:
    3594                 m_style->setBorderCollapse(true);
    3595                 break;
    3596             case CSSValueSeparate:
    3597                 m_style->setBorderCollapse(false);
    3598                 break;
    3599             default:
    3600                 return;
    3601         }
     3589        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(borderCollapse, BorderCollapse)
    36023590        return;
    36033591    case CSSPropertyOutlineStyle:
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r84273 r84380  
    194194        unsigned _cursor_style : 6; // ECursor
    195195        unsigned _direction : 1; // TextDirection
    196         bool _border_collapse : 1 ;
     196        unsigned _border_collapse : 1; // EBorderCollapse
    197197        unsigned _white_space : 3; // EWhiteSpace
    198198        unsigned _box_direction : 1; // EBoxDirection (CSS3 box_direction property, flexible box layout module)
     
    593593    const NinePieceImage& maskBoxImage() const { return rareNonInheritedData->m_maskBoxImage; }
    594594
    595     // returns true for collapsing borders, false for separate borders
    596     bool borderCollapse() const { return inherited_flags._border_collapse; }
     595    EBorderCollapse borderCollapse() const { return static_cast<EBorderCollapse>(inherited_flags._border_collapse); }
    597596    short horizontalBorderSpacing() const { return inherited->horizontal_border_spacing; }
    598597    short verticalBorderSpacing() const { return inherited->vertical_border_spacing; }
     
    969968    void setMaskSize(LengthSize l) { SET_VAR(rareNonInheritedData, m_mask.m_sizeLength, l) }
    970969
    971     void setBorderCollapse(bool collapse) { inherited_flags._border_collapse = collapse; }
     970    void setBorderCollapse(EBorderCollapse collapse) { inherited_flags._border_collapse = collapse; }
    972971    void setHorizontalBorderSpacing(short v) { SET_VAR(inherited, horizontal_border_spacing, v) }
    973972    void setVerticalBorderSpacing(short v) { SET_VAR(inherited, vertical_border_spacing, v) }
     
    12111210
    12121211    // Initial values for all the properties
    1213     static bool initialBorderCollapse() { return false; }
     1212    static EBorderCollapse initialBorderCollapse() { return BSEPARATE; }
    12141213    static EBorderStyle initialBorderStyle() { return BNONE; }
    12151214    static NinePieceImage initialNinePieceImage() { return NinePieceImage(); }
  • trunk/Source/WebCore/rendering/style/RenderStyleConstants.h

    r82828 r84380  
    8080    PUBLIC_PSEUDOID_MASK = ((1 << FIRST_INTERNAL_PSEUDOID) - 1) & ~((1 << FIRST_PUBLIC_PSEUDOID) - 1)
    8181};
     82
     83enum EBorderCollapse { BSEPARATE = 0, BCOLLAPSE = 1 };
    8284
    8385// These have been defined in the order of their precedence for border-collapsing. Do
Note: See TracChangeset for help on using the changeset viewer.