Skip to content
Permalink
Browse files
Lazily allocate overflow: hidden layers if we have overflowing content
https://bugs.webkit.org/show_bug.cgi?id=75568

Reviewed by David Hyatt.

Source/WebCore:

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:
(WebCore::RenderBlock::updateScrollInfoAfterLayout):
Changed this method to update our size cache if needed.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::layoutBlock):
(WebCore::RenderBlock::paint):
(WebCore::RenderBlock::isPointInOverflowControl):
* rendering/RenderBlock.h:
(RenderBlock):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::willBeDestroyed):
(WebCore::RenderBox::styleDidChange):
(WebCore::RenderBox::layout):
(WebCore::RenderBox::scrollWidth):
(WebCore::RenderBox::scrollHeight):
(WebCore::RenderBox::scrollLeft):
(WebCore::RenderBox::scrollTop):
(WebCore::RenderBox::setScrollLeft):
(WebCore::RenderBox::setScrollTop):
(WebCore::RenderBox::includeVerticalScrollbarSize):
(WebCore::RenderBox::includeHorizontalScrollbarSize):
(WebCore::RenderBox::scrolledContentOffset):
(WebCore::RenderBox::pushContentsClip):
(WebCore::RenderBox::popContentsClip):
(WebCore::RenderBox::addLayoutOverflow):
Added layer() check to the previous call sites.

(WebCore::cachedSizeForOverflowClipMap):
(WebCore::RenderBox::cachedSizeForOverflowClip):
(WebCore::RenderBox::updateCachedSizeForOverflowClip):
(WebCore::RenderBox::clearCachedSizeForOverflowClip):
This logic stores the size information for later repainting.
It is in practice replicating what RenderLayer is doing.
I had to disable an ASSERT here as it would trigger in NRWT but
not under DRT. I haven't found by code inspection what was wrong.

* rendering/RenderBox.h:
(WebCore::RenderBox::hasOverflowClipWithLayer):
Helper function.

(WebCore::RenderBox::requiresLayerForOverflowClip):
This determines if we can survive without a RenderLayer. For the moment,
it is very conservative.

(WebCore::RenderBox::requiresLayer):
Updated to call requiresLayerForOverflowClip.

* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::ensureLayer):
Added this function to create and add a new layer.

(WebCore::RenderBoxModelObject::willBeDestroyed):
(WebCore::RenderBoxModelObject::styleDidChange):
Patched those method to handle updating / removing
cached size entries.

* rendering/RenderBoxModelObject.h:
(WebCore::RenderBoxModelObject::requiresLayer):
Pushed the overflowClip check down to RenderBox as only RenderBoxes can have
overflow clips.

* rendering/RenderTableRow.h:
(WebCore::RenderTableRow::requiresLayer):
Added a comment about why we need a layout for table rows.

* rendering/RenderDeprecatedFlexibleBox.cpp:
(WebCore::RenderDeprecatedFlexibleBox::layoutBlock):
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutBlock):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::layout):
Updated those call sites to use RenderBlock::updateScrollInfoAfterLayout
or RenderBox::updateCachedSizeForOverflowClip. The current logic is really
not tight proof and would need to be rethought to not avoid cases.

LayoutTests:

* 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...

Canonical link: https://commits.webkit.org/97689@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@110072 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Julien Chaffraix committed Mar 7, 2012
1 parent 5065d03 commit b618910e38faba1dadeddfe043e3a897db9e2781
Showing 18 changed files with 1,247 additions and 37 deletions.
@@ -1,3 +1,19 @@
2012-03-07 Julien Chaffraix <jchaffraix@webkit.org>

Lazily allocate overflow: hidden layers if we have overflowing content
https://bugs.webkit.org/show_bug.cgi?id=75568

Reviewed by David Hyatt.

* 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...

2012-03-07 Stephen Chenney <schenney@chromium.org>

Switch svg/dynamic-updates tests to repaint harness
@@ -1527,7 +1527,8 @@ BUGCR23471 LEOPARD : fast/text/stroking.html = IMAGE
// elsewhere within this file) and thus should not be blindly rebaselined there.
BUGCR104128 : fast/box-shadow/box-shadow-radius.html = IMAGE
BUGCR104128 : fast/box-shadow/inset-box-shadow-radius.html = IMAGE
BUGCR104128 : fast/box-shadow/shadow-buffer-partial.html = IMAGE
// Need TEXT rebaseline after BUGWK75568
BUGCR104128 : fast/box-shadow/shadow-buffer-partial.html = IMAGE+TEXT
BUGCR104128 : fast/canvas/shadow-offset-4.html = IMAGE
BUGCR104128 : fast/canvas/shadow-offset-5.html = IMAGE
BUGCR104128 : fast/canvas/shadow-offset-6.html = IMAGE
@@ -2441,7 +2442,8 @@ BUG_DRT MAC : fast/css/line-height-determined-by-primary-font.html = IMAGE
BUG_DRT : fast/dynamic/window-resize-scrollbars-test.html = IMAGE+TEXT
BUG_DRT DEBUG : fast/frames/calculate-round.html = PASS TIMEOUT
BUGCR43890 SLOW DEBUG : fast/forms/implicit-submission.html = PASS TEXT
BUG_DRT : fast/repaint/iframe-scroll-repaint.html = IMAGE
// Rebaseline needed after BUGWK75568
BUG_DRT : fast/repaint/iframe-scroll-repaint.html = IMAGE+TEXT
BUG_DRT LINUX : fast/repaint/repaint-across-writing-mode-boundary.html = IMAGE
BUG_DRT LINUX : fast/text/justification-padding-mid-word.html = PASS TEXT
BUG_DRT LINUX MAC : http/tests/plugins/post-url-file.html = TIMEOUT
@@ -3838,3 +3840,185 @@ BUGWK80498 WIN : fast/workers/worker-multi-startup.html = CRASH PASS

// flaky
BUGSENORBLANCO : platform/chromium/fast/events/rtl-scrollbar.html = TEXT PASS

// Need text rebaseline after lazily allocating layers.
// The difference should be only layer removal, no size or position should change.

// Those tests have other entries in our expectations filed and may not totally covers
BUGWK75568 RELEASE : animations/combo-transform-translate+scale.html = TEXT
BUGWK75568 LINUX DEBUG : animations/combo-transform-translate+scale.html = TEXT
BUGWK75568 WIN LINUX : editing/spelling/inline_spelling_markers.html = TEXT
BUGWK75568 WIN LINUX : fast/forms/form-element-geometry.html = TEXT
BUGWK75568 WIN LINUX : fast/forms/input-value.html = TEXT
BUGWK75568 WIN LINUX : fast/layers/add-layer-with-nested-stacking.html = TEXT
BUGWK75568 WIN LINUX : fast/layers/remove-layer-with-nested-stacking.html = TEXT
BUGWK75568 WIN LINUX : fast/repaint/inline-relative-positioned.html = TEXT
BUGWK75568 WIN LINUX : fast/repaint/lines-with-layout-delta.html = TEXT
BUGWK75568 WIN LINUX : fast/repaint/overflow-clip-subtree-layout.html = TEXT
BUGWK75568 WIN LINUX : fast/repaint/repaint-resized-overflow.html = TEXT
BUGWK75568 WIN LINUX : fast/repaint/subtree-layoutstate-transform.html = TEXT
BUGWK75568 WIN LINUX : fast/repaint/subtree-root-clip-2.html = TEXT
BUGWK75568 WIN LINUX : fast/repaint/subtree-root-clip.html = TEXT
BUGWK75568 WIN LINUX : fast/repaint/subtree-root-skipped.html = TEXT
BUGWK75568 WIN LINUX : fast/replaced/replaced-breaking.html = TEXT
BUGWK75568 WIN LINUX : fast/replaced/width100percent-searchfield.html = TEXT
BUGWK75568 WIN LINUX : fast/text/textIteratorNilRenderer.html = TEXT

// Those tests need a text baseline after lazily allocating layers.
// The change should only be layer removal.
BUGWK75568 : compositing/geometry/object-clip-rects-assertion.html = TEXT
BUGWK75568 : compositing/overflow/ancestor-overflow.html = TEXT
BUGWK75568 : editing/inserting/before-after-input-element.html = TEXT
BUGWK75568 : editing/pasteboard/4806874.html = TEXT
BUGWK75568 : editing/pasteboard/drop-text-without-selection.html = TEXT
BUGWK75568 : editing/pasteboard/input-field-1.html = TEXT
BUGWK75568 : editing/selection/3690703-2.html = TEXT
BUGWK75568 : editing/selection/3690703.html = TEXT
BUGWK75568 : editing/selection/3690719.html = TEXT
BUGWK75568 : editing/selection/4895428-3.html = TEXT
BUGWK75568 : editing/selection/4975120.html = TEXT
BUGWK75568 : editing/selection/drag-select-1.html = TEXT
BUGWK75568 : editing/selection/expanding-selections.html = TEXT
BUGWK75568 : editing/selection/leave-requested-block.html = TEXT
BUGWK75568 : editing/selection/select-across-readonly-input-1.html = TEXT
BUGWK75568 : editing/selection/select-across-readonly-input-2.html = TEXT
BUGWK75568 : editing/selection/select-across-readonly-input-3.html = TEXT
BUGWK75568 : editing/selection/select-across-readonly-input-4.html = TEXT
BUGWK75568 : editing/selection/select-across-readonly-input-5.html = TEXT
BUGWK75568 : fast/block/float/032.html = TEXT
BUGWK75568 : fast/block/float/033.html = TEXT
BUGWK75568 : fast/block/float/avoidance-rtl.html = TEXT
BUGWK75568 : fast/block/float/float-not-removed-from-next-sibling3.html = TEXT
BUGWK75568 : fast/block/float/float-overflow-hidden-containing-block-width.html = TEXT
BUGWK75568 : fast/block/float/in-margin.html = TEXT
BUGWK75568 : fast/block/float/overlapping-floats-with-overflow-hidden.html = TEXT
BUGWK75568 : fast/block/float/shrink-to-avoid-float-complexity.html = TEXT
BUGWK75568 : fast/block/lineboxcontain/block-font.html = TEXT
BUGWK75568 : fast/block/lineboxcontain/block-glyphs.html = TEXT
BUGWK75568 : fast/block/lineboxcontain/font.html = TEXT
BUGWK75568 : fast/block/lineboxcontain/parsing-invalid.html = TEXT
BUGWK75568 : fast/block/margin-collapse/103.html = TEXT
BUGWK75568 : fast/clip/017.html = TEXT
BUGWK75568 : fast/css/input-search-padding.html = TEXT
BUGWK75568 : fast/css/invalidation-errors-2.html = TEXT
BUGWK75568 : fast/css/invalidation-errors.html = TEXT
BUGWK75568 : fast/css/line-height.html = TEXT
BUGWK75568 : fast/css/nested-layers-with-hover.html = TEXT
BUGWK75568 : fast/css/resize-single-axis.html = TEXT
BUGWK75568 : fast/css/text-input-with-webkit-border-radius.html = TEXT
BUGWK75568 : fast/css/text-overflow-input.html = TEXT
BUGWK75568 : fast/dom/isindex-001.html = TEXT
BUGWK75568 : fast/dom/isindex-002.html = TEXT
BUGWK75568 : fast/dynamic/subtree-boundary-percent-height.html = TEXT
BUGWK75568 : fast/dynamic/subtree-no-common-root-static-y.html = TEXT
BUGWK75568 : fast/dynamic/subtree-table-cell-height.html = TEXT
BUGWK75568 : fast/events/autoscroll.html = TEXT
BUGWK75568 : fast/events/context-no-deselect.html = TEXT
BUGWK75568 : fast/events/mouse-relative-position.html = TEXT
BUGWK75568 : fast/forms/basic-inputs.html = TEXT
BUGWK75568 : fast/forms/box-shadow-override.html = TEXT
BUGWK75568 : fast/forms/encoding-test.html = TEXT
BUGWK75568 : fast/forms/fieldset-align.html = TEXT
BUGWK75568 : fast/forms/floating-textfield-relayout.html = TEXT
BUGWK75568 : fast/forms/input-align.html = TEXT
BUGWK75568 : fast/forms/input-appearance-bkcolor.html = TEXT
BUGWK75568 : fast/forms/input-appearance-default-bkcolor.html = TEXT
BUGWK75568 : fast/forms/input-appearance-disabled.html = TEXT
BUGWK75568 : fast/forms/input-appearance-focus.html = TEXT
BUGWK75568 : fast/forms/input-appearance-height.html = TEXT
BUGWK75568 : fast/forms/input-appearance-preventDefault.html = TEXT
BUGWK75568 : fast/forms/input-appearance-readonly.html = TEXT
BUGWK75568 : fast/forms/input-appearance-selection.html = TEXT
BUGWK75568 : fast/forms/input-appearance-visibility.html = TEXT
BUGWK75568 : fast/forms/input-appearance-width.html = TEXT
BUGWK75568 : fast/forms/input-baseline.html = TEXT
BUGWK75568 : fast/forms/input-double-click-selection-gap-bug.html = TEXT
BUGWK75568 : fast/forms/input-field-text-truncated.html = TEXT
BUGWK75568 : fast/forms/input-placeholder-visibility-1.html = TEXT
BUGWK75568 : fast/forms/input-placeholder-visibility-3.html = TEXT
BUGWK75568 : fast/forms/input-readonly-empty.html = TEXT
BUGWK75568 : fast/forms/input-spaces.html = TEXT
BUGWK75568 : fast/forms/input-table.html = TEXT
BUGWK75568 : fast/forms/input-text-click-inside.html = TEXT
BUGWK75568 : fast/forms/input-text-click-outside.html = TEXT
BUGWK75568 : fast/forms/input-text-option-delete.html = TEXT
BUGWK75568 : fast/forms/input-text-self-emptying-click.html = TEXT
BUGWK75568 : fast/forms/input-width.html = TEXT
BUGWK75568 : fast/forms/number/input-appearance-number-rtl.html = TEXT
BUGWK75568 : fast/forms/number/input-appearance-spinbutton-disabled-readonly.html = TEXT
BUGWK75568 : fast/forms/number/input-appearance-spinbutton-layer.html = TEXT
BUGWK75568 : fast/forms/placeholder-position.html = TEXT
BUGWK75568 : fast/forms/placeholder-pseudo-style.html = TEXT
BUGWK75568 : fast/forms/plaintext-mode-2.html = TEXT
BUGWK75568 : fast/forms/search-cancel-button-style-sharing.html = TEXT
BUGWK75568 : fast/forms/search-display-none-cancel-button.html = TEXT
BUGWK75568 : fast/forms/search-rtl.html = TEXT
BUGWK75568 : fast/forms/search-styled.html = TEXT
BUGWK75568 : fast/forms/search-vertical-alignment.html = TEXT
BUGWK75568 : fast/forms/searchfield-heights.html = TEXT
BUGWK75568 : fast/forms/tabbing-input-iframe.html = TEXT
BUGWK75568 : fast/forms/text-style-color.html = TEXT
BUGWK75568 : fast/forms/textfield-focus-ring.html = TEXT
BUGWK75568 : fast/forms/validation-message-appearance.html = TEXT
BUGWK75568 : fast/forms/visual-hebrew-text-field.html = TEXT
BUGWK75568 : fast/frames/take-focus-from-iframe.html = TEXT
BUGWK75568 : fast/html/details-no-summary4.html = TEXT
BUGWK75568 : fast/html/details-open-javascript.html = TEXT
BUGWK75568 : fast/html/details-open2.html = TEXT
BUGWK75568 : fast/html/details-open4.html = TEXT
BUGWK75568 : fast/invalid/residual-style.html = TEXT
BUGWK75568 : fast/layers/self-painting-outline.html = TEXT
BUGWK75568 : fast/lists/dynamic-marker-crash.html = TEXT
BUGWK75568 : fast/multicol/layers-split-across-columns.html = TEXT
BUGWK75568 : fast/overflow/004.html = TEXT
BUGWK75568 : fast/overflow/clip-rects-fixed-ancestor.html = TEXT
BUGWK75568 : fast/overflow/line-clamp.html = TEXT
BUGWK75568 : fast/overflow/overflow-focus-ring.html = TEXT
BUGWK75568 : fast/repaint/layer-outline-horizontal.html = TEXT
BUGWK75568 : fast/repaint/layer-outline.html = TEXT
BUGWK75568 : fast/repaint/opacity-change-on-overflow-float.html = TEXT
BUGWK75568 : fast/repaint/renderer-destruction-by-invalidateSelection-crash.html = TEXT
BUGWK75568 : fast/repaint/subtree-root-clip-3.html = TEXT
BUGWK75568 : fast/replaced/replaced-breaking-mixture.html = TEXT
BUGWK75568 : fast/text/selection-painted-separately.html = TEXT
BUGWK75568 : fast/text/selection-rect-rounding.html = TEXT
BUGWK75568 : fast/transforms/transformed-focused-text-input.html = TEXT
BUGWK75568 : plugins/mouse-click-plugin-clears-selection.html = TEXT
BUGWK75568 : svg/custom/inline-svg-in-xhtml.xml = TEXT
BUGWK75568 : svg/hixie/mixed/003.xml = TEXT
BUGWK75568 : tables/mozilla/bugs/45621.html = TEXT
BUGWK75568 : tables/mozilla/bugs/bug12384.html = TEXT
BUGWK75568 : tables/mozilla/bugs/bug154780.html = TEXT
BUGWK75568 : tables/mozilla/bugs/bug18359.html = TEXT
BUGWK75568 : tables/mozilla/bugs/bug24200.html = TEXT
BUGWK75568 : tables/mozilla/bugs/bug2479-2.html = TEXT
BUGWK75568 : tables/mozilla/bugs/bug2479-3.html = TEXT
BUGWK75568 : tables/mozilla/bugs/bug2479-4.html = TEXT
BUGWK75568 : tables/mozilla/bugs/bug28928.html = TEXT
BUGWK75568 : tables/mozilla/bugs/bug4382.html = TEXT
BUGWK75568 : tables/mozilla/bugs/bug44505.html = TEXT
BUGWK75568 : tables/mozilla/bugs/bug4527.html = TEXT
BUGWK75568 : tables/mozilla/bugs/bug46368-1.html = TEXT
BUGWK75568 : tables/mozilla/bugs/bug46368-2.html = TEXT
BUGWK75568 : tables/mozilla/bugs/bug51037.html = TEXT
BUGWK75568 : tables/mozilla/bugs/bug55545.html = TEXT
BUGWK75568 : tables/mozilla/bugs/bug7342.html = TEXT
BUGWK75568 : tables/mozilla/bugs/bug99948.html = TEXT
BUGWK75568 : tables/mozilla/dom/tableDom.html = TEXT
BUGWK75568 : tables/mozilla/other/move_row.html = TEXT
BUGWK75568 : tables/mozilla_expected_failures/bugs/bug106966.html = TEXT
BUGWK75568 : tables/mozilla_expected_failures/bugs/bug45621.html = TEXT
BUGWK75568 : tables/mozilla_expected_failures/bugs/bug92647-1.html = TEXT
BUGWK75568 : fast/replaced/width100percent-textfield.html = TEXT
BUGWK75568 : fast/speech/input-appearance-searchandspeech.html = TEXT
BUGWK75568 : fast/speech/input-appearance-speechbutton.html = TEXT
BUGWK75568 : fast/speech/speech-bidi-rendering.html = TEXT
BUGWK75568 : fast/table/003.html = TEXT
BUGWK75568 : fast/table/029.html = TEXT
BUGWK75568 : fast/table/colspanMinWidth-vertical.html = TEXT
BUGWK75568 : fast/table/colspanMinWidth.html = TEXT
BUGWK75568 : fast/table/overflowHidden.html = TEXT
BUGWK75568 : fast/table/spanOverlapRepaint.html = TEXT
BUGWK75568 : fast/table/text-field-baseline.html = TEXT
BUGWK75568 : tables/mozilla/bugs/bug1188.html = TEXT
BUGWK75568 : fast/repaint/search-field-cancel.html = TEXT

0 comments on commit b618910

Please sign in to comment.