Title: [97712] trunk/Source/WebCore
- Revision
- 97712
- Author
- [email protected]
- Date
- 2011-10-17 21:08:53 -0700 (Mon, 17 Oct 2011)
Log Message
Add compile-time asserts for RenderStyle::(Non)InheritedFlags size.
https://bugs.webkit.org/show_bug.cgi?id=69803
Reviewed by Darin Adler.
No new tests.
Adds COMPILE_ASSERTs for the size of RenderStyle::InheritedFlags and
RenderStyle::NonInheritedFlags to ensure that they are not accidentally
grown in future changes.
Change types of unsigned bitfields to unsigned char to ensure that the
above assertions remain true when building on windows.
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle):
Adds assertions to ensure struct sizes do not change.
* rendering/style/RenderStyle.h:
Changes unsigned to unsigned char as outlined above.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (97711 => 97712)
--- trunk/Source/WebCore/ChangeLog 2011-10-18 04:08:05 UTC (rev 97711)
+++ trunk/Source/WebCore/ChangeLog 2011-10-18 04:08:53 UTC (rev 97712)
@@ -1,3 +1,24 @@
+2011-10-17 Luke Macpherson <[email protected]>
+
+ Add compile-time asserts for RenderStyle::(Non)InheritedFlags size.
+ https://bugs.webkit.org/show_bug.cgi?id=69803
+
+ Reviewed by Darin Adler.
+
+ No new tests.
+
+ Adds COMPILE_ASSERTs for the size of RenderStyle::InheritedFlags and
+ RenderStyle::NonInheritedFlags to ensure that they are not accidentally
+ grown in future changes.
+ Change types of unsigned bitfields to unsigned char to ensure that the
+ above assertions remain true when building on windows.
+
+ * rendering/style/RenderStyle.cpp:
+ (WebCore::RenderStyle):
+ Adds assertions to ensure struct sizes do not change.
+ * rendering/style/RenderStyle.h:
+ Changes unsigned to unsigned char as outlined above.
+
2011-10-17 Ojan Vafai <[email protected]>
Unreviewed, rolling out r97662.
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (97711 => 97712)
--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2011-10-18 04:08:05 UTC (rev 97711)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2011-10-18 04:08:53 UTC (rev 97712)
@@ -98,6 +98,8 @@
#endif
{
setBitDefaults(); // Would it be faster to copy this from the default style?
+ COMPILE_ASSERT((sizeof(InheritedFlags) <= 8), InheritedFlags_does_not_grow);
+ COMPILE_ASSERT((sizeof(NonInheritedFlags) <= 8), NonInheritedFlags_does_not_grow);
}
ALWAYS_INLINE RenderStyle::RenderStyle(bool)
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (97711 => 97712)
--- trunk/Source/WebCore/rendering/style/RenderStyle.h 2011-10-18 04:08:05 UTC (rev 97711)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h 2011-10-18 04:08:53 UTC (rev 97712)
@@ -191,30 +191,30 @@
bool operator!=(const InheritedFlags& other) const { return !(*this == other); }
- unsigned _empty_cells : 1; // EEmptyCell
- unsigned _caption_side : 2; // ECaptionSide
- unsigned _list_style_type : 7; // EListStyleType
- unsigned _list_style_position : 1; // EListStylePosition
- unsigned _visibility : 2; // EVisibility
- unsigned _text_align : 4; // ETextAlign
- unsigned _text_transform : 2; // ETextTransform
- unsigned _text_decorations : ETextDecorationBits;
- unsigned _cursor_style : 6; // ECursor
- unsigned _direction : 1; // TextDirection
- unsigned _border_collapse : 1; // EBorderCollapse
- unsigned _white_space : 3; // EWhiteSpace
- unsigned _box_direction : 1; // EBoxDirection (CSS3 box_direction property, flexible box layout module)
+ unsigned char _empty_cells : 1; // EEmptyCell
+ unsigned char _caption_side : 2; // ECaptionSide
+ unsigned char _list_style_type : 7; // EListStyleType
+ unsigned char _list_style_position : 1; // EListStylePosition
+ unsigned char _visibility : 2; // EVisibility
+ unsigned char _text_align : 4; // ETextAlign
+ unsigned char _text_transform : 2; // ETextTransform
+ unsigned char _text_decorations : ETextDecorationBits;
+ unsigned char _cursor_style : 6; // ECursor
+ unsigned char _direction : 1; // TextDirection
+ unsigned char _border_collapse : 1; // EBorderCollapse
+ unsigned char _white_space : 3; // EWhiteSpace
+ unsigned char _box_direction : 1; // EBoxDirection (CSS3 box_direction property, flexible box layout module)
// 34 bits
// non CSS2 inherited
- unsigned m_rtlOrdering : 1; // Order
+ unsigned char m_rtlOrdering : 1; // Order
bool _force_backgrounds_to_white : 1;
- unsigned _pointerEvents : 4; // EPointerEvents
- unsigned _insideLink : 2; // EInsideLink
+ unsigned char _pointerEvents : 4; // EPointerEvents
+ unsigned char _insideLink : 2; // EInsideLink
// 43 bits
// CSS Text Layout Module Level 3: Vertical writing support
- unsigned m_writingMode : 2; // WritingMode
+ unsigned char m_writingMode : 2; // WritingMode
// 45 bits
} inherited_flags;
@@ -245,26 +245,26 @@
bool operator!=(const NonInheritedFlags& other) const { return !(*this == other); }
- unsigned _effectiveDisplay : 5; // EDisplay
- unsigned _originalDisplay : 5; // EDisplay
- unsigned _overflowX : 3; // EOverflow
- unsigned _overflowY : 3; // EOverflow
- unsigned _vertical_align : 4; // EVerticalAlign
- unsigned _clear : 2; // EClear
- unsigned _position : 2; // EPosition
- unsigned _floating : 2; // EFloat
- unsigned _table_layout : 1; // ETableLayout
+ unsigned char _effectiveDisplay : 5; // EDisplay
+ unsigned char _originalDisplay : 5; // EDisplay
+ unsigned char _overflowX : 3; // EOverflow
+ unsigned char _overflowY : 3; // EOverflow
+ unsigned char _vertical_align : 4; // EVerticalAlign
+ unsigned char _clear : 2; // EClear
+ unsigned char _position : 2; // EPosition
+ unsigned char _floating : 2; // EFloat
+ unsigned char _table_layout : 1; // ETableLayout
- unsigned _page_break_before : 2; // EPageBreak
- unsigned _page_break_after : 2; // EPageBreak
- unsigned _page_break_inside : 2; // EPageBreak
+ unsigned char _page_break_before : 2; // EPageBreak
+ unsigned char _page_break_after : 2; // EPageBreak
+ unsigned char _page_break_inside : 2; // EPageBreak
- unsigned _styleType : 6; // PseudoId
+ unsigned char _styleType : 6; // PseudoId
bool _affectedByHover : 1;
bool _affectedByActive : 1;
bool _affectedByDrag : 1;
- unsigned _pseudoBits : 7;
- unsigned _unicodeBidi : 3; // EUnicodeBidi
+ unsigned char _pseudoBits : 7;
+ unsigned char _unicodeBidi : 3; // EUnicodeBidi
bool _isLink : 1;
// 53 bits
} noninherited_flags;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes