Title: [112725] trunk/Source/WebCore
Revision
112725
Author
rn...@webkit.org
Date
2012-03-30 14:14:26 -0700 (Fri, 30 Mar 2012)

Log Message

Add a compile assert for the size of InlineFlowBox
https://bugs.webkit.org/show_bug.cgi?id=82767

Reviewed by Tony Chang.

Add a compile assert to ensure InlineFlowBox stays small.
Also make some of the member variables not used in RootInlineBox private.

Changing these booleans to unsigned is safe as I've audited all code that
uses these member variables (they're all in InlineFlowBox or RootInlineBox).

* rendering/InlineFlowBox.cpp:
(SameSizeAsInlineFlowBox):
(WebCore):
* rendering/InlineFlowBox.h:
(InlineFlowBox):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (112724 => 112725)


--- trunk/Source/WebCore/ChangeLog	2012-03-30 21:11:54 UTC (rev 112724)
+++ trunk/Source/WebCore/ChangeLog	2012-03-30 21:14:26 UTC (rev 112725)
@@ -1,3 +1,22 @@
+2012-03-30  Ryosuke Niwa  <rn...@webkit.org>
+
+        Add a compile assert for the size of InlineFlowBox
+        https://bugs.webkit.org/show_bug.cgi?id=82767
+
+        Reviewed by Tony Chang.
+
+        Add a compile assert to ensure InlineFlowBox stays small.
+        Also make some of the member variables not used in RootInlineBox private.
+
+        Changing these booleans to unsigned is safe as I've audited all code that
+        uses these member variables (they're all in InlineFlowBox or RootInlineBox).
+
+        * rendering/InlineFlowBox.cpp:
+        (SameSizeAsInlineFlowBox):
+        (WebCore):
+        * rendering/InlineFlowBox.h:
+        (InlineFlowBox):
+
 2012-03-30  Zalan Bujtas  <zbuj...@gmail.com>
 
         Fix defective size_t overflow in GestureTapHighlighter.

Modified: trunk/Source/WebCore/rendering/InlineFlowBox.cpp (112724 => 112725)


--- trunk/Source/WebCore/rendering/InlineFlowBox.cpp	2012-03-30 21:11:54 UTC (rev 112724)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.cpp	2012-03-30 21:14:26 UTC (rev 112725)
@@ -45,6 +45,13 @@
 
 namespace WebCore {
 
+class SameSizeAsInlineFlowBox : public InlineBox {
+    void* pointers[5];
+    uint32_t bitfields : 24;
+};
+
+COMPILE_ASSERT(sizeof(InlineFlowBox) == sizeof(SameSizeAsInlineFlowBox), InlineFlowBox_should_stay_small);
+
 #ifndef NDEBUG
 
 InlineFlowBox::~InlineFlowBox()

Modified: trunk/Source/WebCore/rendering/InlineFlowBox.h (112724 => 112725)


--- trunk/Source/WebCore/rendering/InlineFlowBox.h	2012-03-30 21:11:54 UTC (rev 112724)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.h	2012-03-30 21:14:26 UTC (rev 112725)
@@ -297,20 +297,22 @@
     InlineFlowBox* m_prevLineBox; // The previous box that also uses our RenderObject
     InlineFlowBox* m_nextLineBox; // The next box that also uses our RenderObject
 
-    bool m_includeLogicalLeftEdge : 1;
-    bool m_includeLogicalRightEdge : 1;
-    bool m_hasTextChildren : 1;
-    bool m_hasTextDescendants : 1;
-    bool m_descendantsHaveSameLineHeightAndBaseline : 1;
+private:
+    unsigned m_includeLogicalLeftEdge : 1;
+    unsigned m_includeLogicalRightEdge : 1;
+    unsigned m_hasTextChildren : 1;
+    unsigned m_hasTextDescendants : 1;
+    unsigned m_descendantsHaveSameLineHeightAndBaseline : 1;
 
+protected:
     // The following members are only used by RootInlineBox but moved here to keep the bits packed.
 
     // Whether or not this line uses alphabetic or ideographic baselines by default.
     unsigned m_baselineType : 1; // FontBaseline
 
     // If the line contains any ruby runs, then this will be true.
-    bool m_hasAnnotationsBefore : 1;
-    bool m_hasAnnotationsAfter : 1;
+    unsigned m_hasAnnotationsBefore : 1;
+    unsigned m_hasAnnotationsAfter : 1;
 
     unsigned m_lineBreakBidiStatusEor : 5; // WTF::Unicode::Direction
     unsigned m_lineBreakBidiStatusLastStrong : 5; // WTF::Unicode::Direction
@@ -320,7 +322,7 @@
 
 #ifndef NDEBUG
 private:
-    bool m_hasBadChildList;
+    unsigned m_hasBadChildList : 1;
 #endif
 };
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to