Changeset 116129 in webkit


Ignore:
Timestamp:
May 4, 2012 11:28:05 AM (12 years ago)
Author:
tony@chromium.org
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.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r116127 r116129  
     12012-05-04  Tony Chang  <tony@chromium.org>
     2
     3        fix bit packing in FillLayer on Windows
     4        https://bugs.webkit.org/show_bug.cgi?id=85636
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Use unsigned for all bit packed types. I manually verified that
     9        the current uses of these member variables always assign true or false.
     10
     11        No new tests, adding a compile assert to verify bit packing.
     12
     13        * rendering/style/FillLayer.cpp:
     14        (SameSizeAsFillLayer): Added compile assert.
     15        (WebCore):
     16        (WebCore::FillLayer::FillLayer): Reorder m_sizeLength so bit packed fields are adjacent.
     17        (WebCore::FillLayer::operator=): Ditto.
     18        * rendering/style/FillLayer.h:
     19        (FillLayer): Convert bools to unsigned to match other bit packed fields.
     20
    1212012-05-04  Tommy Widenflycht  <tommyw@google.com>
    222
  • trunk/Source/WebCore/rendering/style/FillLayer.cpp

    r80868 r116129  
    2424
    2525namespace WebCore {
     26
     27struct SameSizeAsFillLayer {
     28    FillLayer* m_next;
     29
     30    RefPtr<StyleImage> m_image;
     31
     32    Length m_xPosition;
     33    Length m_yPosition;
     34
     35    LengthSize m_sizeLength;
     36
     37    unsigned m_bitfields;
     38};
     39
     40COMPILE_ASSERT(sizeof(FillLayer) == sizeof(SameSizeAsFillLayer), FillLayer_should_stay_small);
    2641
    2742FillLayer::FillLayer(EFillLayerType type)
     
    3045    , m_xPosition(FillLayer::initialFillXPosition(type))
    3146    , m_yPosition(FillLayer::initialFillYPosition(type))
     47    , m_sizeLength(FillLayer::initialFillSizeLength(type))
    3248    , m_attachment(FillLayer::initialFillAttachment(type))
    3349    , m_clip(FillLayer::initialFillClip(type))
     
    3753    , m_composite(FillLayer::initialFillComposite(type))
    3854    , m_sizeType(SizeNone)
    39     , m_sizeLength(FillLayer::initialFillSizeLength(type))
    4055    , m_imageSet(false)
    4156    , m_attachmentSet(false)
     
    5671    , m_xPosition(o.m_xPosition)
    5772    , m_yPosition(o.m_yPosition)
     73    , m_sizeLength(o.m_sizeLength)
    5874    , m_attachment(o.m_attachment)
    5975    , m_clip(o.m_clip)
     
    6379    , m_composite(o.m_composite)
    6480    , m_sizeType(o.m_sizeType)
    65     , m_sizeLength(o.m_sizeLength)
    6681    , m_imageSet(o.m_imageSet)
    6782    , m_attachmentSet(o.m_attachmentSet)
     
    92107    m_xPosition = o.m_xPosition;
    93108    m_yPosition = o.m_yPosition;
     109    m_sizeLength = o.m_sizeLength;
    94110    m_attachment = o.m_attachment;
    95111    m_clip = o.m_clip;
     
    99115    m_repeatY = o.m_repeatY;
    100116    m_sizeType = o.m_sizeType;
    101     m_sizeLength = o.m_sizeLength;
    102117
    103118    m_imageSet = o.m_imageSet;
  • trunk/Source/WebCore/rendering/style/FillLayer.h

    r101177 r116129  
    175175    Length m_yPosition;
    176176
     177    LengthSize m_sizeLength;
     178
    177179    unsigned m_attachment : 2; // EFillAttachment
    178180    unsigned m_clip : 2; // EFillBox
     
    183185    unsigned m_sizeType : 2; // EFillSizeType
    184186   
    185     LengthSize m_sizeLength;
    186 
    187     bool m_imageSet : 1;
    188     bool m_attachmentSet : 1;
    189     bool m_clipSet : 1;
    190     bool m_originSet : 1;
    191     bool m_repeatXSet : 1;
    192     bool m_repeatYSet : 1;
    193     bool m_xPosSet : 1;
    194     bool m_yPosSet : 1;
    195     bool m_compositeSet : 1;
     187    unsigned m_imageSet : 1;
     188    unsigned m_attachmentSet : 1;
     189    unsigned m_clipSet : 1;
     190    unsigned m_originSet : 1;
     191    unsigned m_repeatXSet : 1;
     192    unsigned m_repeatYSet : 1;
     193    unsigned m_xPosSet : 1;
     194    unsigned m_yPosSet : 1;
     195    unsigned m_compositeSet : 1;
    196196   
    197197    unsigned m_type : 1; // EFillLayerType
Note: See TracChangeset for help on using the changeset viewer.