Title: [116129] trunk/Source/WebCore
Revision
116129
Author
[email protected]
Date
2012-05-04 11:28:05 -0700 (Fri, 04 May 2012)

Log Message

fix bit packing in FillLayer on Windows
https://bugs.webkit.org/show_bug.cgi?id=85636

Reviewed by Ryosuke Niwa.

Use unsigned for all bit packed types. I manually verified that
the current uses of these member variables always assign true or false.

No new tests, adding a compile assert to verify bit packing.

* rendering/style/FillLayer.cpp:
(SameSizeAsFillLayer): Added compile assert.
(WebCore):
(WebCore::FillLayer::FillLayer): Reorder m_sizeLength so bit packed fields are adjacent.
(WebCore::FillLayer::operator=): Ditto.
* rendering/style/FillLayer.h:
(FillLayer): Convert bools to unsigned to match other bit packed fields.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (116128 => 116129)


--- trunk/Source/WebCore/ChangeLog	2012-05-04 17:57:51 UTC (rev 116128)
+++ trunk/Source/WebCore/ChangeLog	2012-05-04 18:28:05 UTC (rev 116129)
@@ -1,3 +1,23 @@
+2012-05-04  Tony Chang  <[email protected]>
+
+        fix bit packing in FillLayer on Windows
+        https://bugs.webkit.org/show_bug.cgi?id=85636
+
+        Reviewed by Ryosuke Niwa.
+
+        Use unsigned for all bit packed types. I manually verified that
+        the current uses of these member variables always assign true or false.
+
+        No new tests, adding a compile assert to verify bit packing.
+
+        * rendering/style/FillLayer.cpp:
+        (SameSizeAsFillLayer): Added compile assert.
+        (WebCore):
+        (WebCore::FillLayer::FillLayer): Reorder m_sizeLength so bit packed fields are adjacent.
+        (WebCore::FillLayer::operator=): Ditto.
+        * rendering/style/FillLayer.h:
+        (FillLayer): Convert bools to unsigned to match other bit packed fields.
+
 2012-05-04  Tommy Widenflycht  <[email protected]>
 
         MediaStream API: Make PeerConnection00's API fully compliant with the draft

Modified: trunk/Source/WebCore/rendering/style/FillLayer.cpp (116128 => 116129)


--- trunk/Source/WebCore/rendering/style/FillLayer.cpp	2012-05-04 17:57:51 UTC (rev 116128)
+++ trunk/Source/WebCore/rendering/style/FillLayer.cpp	2012-05-04 18:28:05 UTC (rev 116129)
@@ -24,11 +24,27 @@
 
 namespace WebCore {
 
+struct SameSizeAsFillLayer {
+    FillLayer* m_next;
+
+    RefPtr<StyleImage> m_image;
+
+    Length m_xPosition;
+    Length m_yPosition;
+
+    LengthSize m_sizeLength;
+
+    unsigned m_bitfields;
+};
+
+COMPILE_ASSERT(sizeof(FillLayer) == sizeof(SameSizeAsFillLayer), FillLayer_should_stay_small);
+
 FillLayer::FillLayer(EFillLayerType type)
     : m_next(0)
     , m_image(FillLayer::initialFillImage(type))
     , m_xPosition(FillLayer::initialFillXPosition(type))
     , m_yPosition(FillLayer::initialFillYPosition(type))
+    , m_sizeLength(FillLayer::initialFillSizeLength(type))
     , m_attachment(FillLayer::initialFillAttachment(type))
     , m_clip(FillLayer::initialFillClip(type))
     , m_origin(FillLayer::initialFillOrigin(type))
@@ -36,7 +52,6 @@
     , m_repeatY(FillLayer::initialFillRepeatY(type))
     , m_composite(FillLayer::initialFillComposite(type))
     , m_sizeType(SizeNone)
-    , m_sizeLength(FillLayer::initialFillSizeLength(type))
     , m_imageSet(false)
     , m_attachmentSet(false)
     , m_clipSet(false)
@@ -55,6 +70,7 @@
     , m_image(o.m_image)
     , m_xPosition(o.m_xPosition)
     , m_yPosition(o.m_yPosition)
+    , m_sizeLength(o.m_sizeLength)
     , m_attachment(o.m_attachment)
     , m_clip(o.m_clip)
     , m_origin(o.m_origin)
@@ -62,7 +78,6 @@
     , m_repeatY(o.m_repeatY)
     , m_composite(o.m_composite)
     , m_sizeType(o.m_sizeType)
-    , m_sizeLength(o.m_sizeLength)
     , m_imageSet(o.m_imageSet)
     , m_attachmentSet(o.m_attachmentSet)
     , m_clipSet(o.m_clipSet)
@@ -91,6 +106,7 @@
     m_image = o.m_image;
     m_xPosition = o.m_xPosition;
     m_yPosition = o.m_yPosition;
+    m_sizeLength = o.m_sizeLength;
     m_attachment = o.m_attachment;
     m_clip = o.m_clip;
     m_composite = o.m_composite;
@@ -98,7 +114,6 @@
     m_repeatX = o.m_repeatX;
     m_repeatY = o.m_repeatY;
     m_sizeType = o.m_sizeType;
-    m_sizeLength = o.m_sizeLength;
 
     m_imageSet = o.m_imageSet;
     m_attachmentSet = o.m_attachmentSet;

Modified: trunk/Source/WebCore/rendering/style/FillLayer.h (116128 => 116129)


--- trunk/Source/WebCore/rendering/style/FillLayer.h	2012-05-04 17:57:51 UTC (rev 116128)
+++ trunk/Source/WebCore/rendering/style/FillLayer.h	2012-05-04 18:28:05 UTC (rev 116129)
@@ -174,6 +174,8 @@
     Length m_xPosition;
     Length m_yPosition;
 
+    LengthSize m_sizeLength;
+
     unsigned m_attachment : 2; // EFillAttachment
     unsigned m_clip : 2; // EFillBox
     unsigned m_origin : 2; // EFillBox
@@ -182,17 +184,15 @@
     unsigned m_composite : 4; // CompositeOperator
     unsigned m_sizeType : 2; // EFillSizeType
     
-    LengthSize m_sizeLength;
-
-    bool m_imageSet : 1;
-    bool m_attachmentSet : 1;
-    bool m_clipSet : 1;
-    bool m_originSet : 1;
-    bool m_repeatXSet : 1;
-    bool m_repeatYSet : 1;
-    bool m_xPosSet : 1;
-    bool m_yPosSet : 1;
-    bool m_compositeSet : 1;
+    unsigned m_imageSet : 1;
+    unsigned m_attachmentSet : 1;
+    unsigned m_clipSet : 1;
+    unsigned m_originSet : 1;
+    unsigned m_repeatXSet : 1;
+    unsigned m_repeatYSet : 1;
+    unsigned m_xPosSet : 1;
+    unsigned m_yPosSet : 1;
+    unsigned m_compositeSet : 1;
     
     unsigned m_type : 1; // EFillLayerType
 };
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to