Changeset 84380 in webkit
- Timestamp:
- Apr 20, 2011 9:14:37 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r84374 r84380 1 2011-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 1 19 2011-04-19 Stephen White <senorblanco@chromium.org> 2 20 -
trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h
r82828 r84380 2643 2643 } 2644 2644 2645 template<> 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 2659 template<> 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 2645 2672 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EColorInterpolation e) 2646 2673 : m_type(CSS_IDENT) -
trunk/Source/WebCore/css/CSSStyleSelector.cpp
r83986 r84380 3587 3587 // ident only properties 3588 3588 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) 3602 3590 return; 3603 3591 case CSSPropertyOutlineStyle: -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r84273 r84380 194 194 unsigned _cursor_style : 6; // ECursor 195 195 unsigned _direction : 1; // TextDirection 196 bool _border_collapse : 1 ;196 unsigned _border_collapse : 1; // EBorderCollapse 197 197 unsigned _white_space : 3; // EWhiteSpace 198 198 unsigned _box_direction : 1; // EBoxDirection (CSS3 box_direction property, flexible box layout module) … … 593 593 const NinePieceImage& maskBoxImage() const { return rareNonInheritedData->m_maskBoxImage; } 594 594 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); } 597 596 short horizontalBorderSpacing() const { return inherited->horizontal_border_spacing; } 598 597 short verticalBorderSpacing() const { return inherited->vertical_border_spacing; } … … 969 968 void setMaskSize(LengthSize l) { SET_VAR(rareNonInheritedData, m_mask.m_sizeLength, l) } 970 969 971 void setBorderCollapse( boolcollapse) { inherited_flags._border_collapse = collapse; }970 void setBorderCollapse(EBorderCollapse collapse) { inherited_flags._border_collapse = collapse; } 972 971 void setHorizontalBorderSpacing(short v) { SET_VAR(inherited, horizontal_border_spacing, v) } 973 972 void setVerticalBorderSpacing(short v) { SET_VAR(inherited, vertical_border_spacing, v) } … … 1211 1210 1212 1211 // Initial values for all the properties 1213 static bool initialBorderCollapse() { return false; }1212 static EBorderCollapse initialBorderCollapse() { return BSEPARATE; } 1214 1213 static EBorderStyle initialBorderStyle() { return BNONE; } 1215 1214 static NinePieceImage initialNinePieceImage() { return NinePieceImage(); } -
trunk/Source/WebCore/rendering/style/RenderStyleConstants.h
r82828 r84380 80 80 PUBLIC_PSEUDOID_MASK = ((1 << FIRST_INTERNAL_PSEUDOID) - 1) & ~((1 << FIRST_PUBLIC_PSEUDOID) - 1) 81 81 }; 82 83 enum EBorderCollapse { BSEPARATE = 0, BCOLLAPSE = 1 }; 82 84 83 85 // These have been defined in the order of their precedence for border-collapsing. Do
Note: See TracChangeset
for help on using the changeset viewer.