03/01/12 10:46:56 (3 years ago)

Lazily allocate overflow: hidden layers if we have overflowing content

Reviewed by David Hyatt.


Change covered by the existing tests and the tons of rebaselines.

This change makes us lazily allocate our RenderLayer for overflow: hidden layers only.

Apart from saving some memory, it will also speed up the rendering as we don't need to
go through the layer's machinery when painting and hit testing.

On http://dglazkov.github.com/performance-tests/biggrid.html benchmark, this puts the
overflow: hidden case in par with the overflow: visible case when scrolling that is a
very-smooth scrolling vs a jerky one currently (mostly due to the painting speedup).

  • rendering/RenderBlock.cpp:

Changed this method to update our size cache if needed.

  • rendering/RenderBlock.cpp:


  • rendering/RenderBlock.h:


  • rendering/RenderBox.cpp:

Added layer() check to the previous call sites.

  • rendering/RenderBoxModelObject.cpp:

Added this function to create and add a new layer.

Patched those method to handle updating / removing
cached size entries.

This logic stores the size information for later repainting.
It is in practice replicating what RenderLayer is doing.

  • rendering/RenderBoxModelObject.h:

Updated to call requiresLayerForOverflowClip.

Added this method to check if we can lazily allocate the layer.

  • rendering/RenderDeprecatedFlexibleBox.cpp:

Removed some checks as they are part of updateScrollInfoAfterLayout.

  • rendering/RenderObject.cpp:

Added a layer() check.

  • rendering/RenderTableRow.h:

Added a comment about why we need a layout for table rows.


  • platform/chromium-win/fast/repaint/iframe-scroll-repaint-expected.png:

This test really doesn't seem to test much on all platforms. The new expected result is as
good as the original from a correctness perspective. It just means we now do repaint the whole
iframe when scrolling.

  • platform/chromium/test_expectations.txt:
  • platform/efl/test_expectations.txt:
  • platform/gtk/test_expectations.txt:
  • platform/mac/test_expectations.txt:
  • platform/qt/test_expectations.txt:
  • platform/win/Skipped:

Disable gazillions tests that need a small rebaseline after losing some layers. The expectations are
updated to match each platform as best as I could but expect some breakage...

1 edited


  • trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp

    r106694 r109367  
    306306    // Update our scrollbars if we're overflow:auto/scroll/hidden now that we know if 
    307307    // we overflow or not. 
    308     if (hasOverflowClip()) 
    309         layer()->updateScrollInfoAfterLayout(); 
     308    updateScrollInfoAfterLayout(); 
    311310    // Repaint with our new bounds if they are different from our old bounds. 
Note: See TracChangeset for help on using the changeset viewer.