Bug 88579

Summary: The size of RenderLayer is too damn high!
Product: WebKit Reporter: Julien Chaffraix <jchaffraix>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: inferno, jamesr, simon.fraser, tony
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   

Description Julien Chaffraix 2012-06-07 14:43:39 PDT
While looking at some bad padding on RenderLayer, this is the size of RenderLayer:

struct SameSizeAsRenderLayer : public ScrollableArea {
    virtual ~SameSizeAsRenderLayer() { } // Allocate vtable pointer.
    void* m_pointers[17];
#if USE(ACCELERATED_COMPOSITING)
    void* m_backing;
#endif

    LayoutRect m_rects[3];
    LayoutSize m_layoutSizes[2];
    LayoutPoint m_layoutPoint;
    IntPoint m_point;
    LayoutUnit m_units[2];
    IntSize m_sizes[2];

    // We don't include our bitfield here to ensure that they are folded into the ones from ScrollableArea.
    // However it seems like some platforms don't fold the bitfield so you need another unsigned (as we have
    // 35 bits at the moment in RenderLayer - including the one from ScrollableArea).
};

COMPILE_ASSERT(sizeof(RenderLayer) == sizeof(SameSizeAsRenderLayer), RenderLayer_should_avoid_increasing);