Separate paint and scroll offsets for RenderLayerBacking::m_scrollingContentsLayer
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Nov 2018 06:35:36 +0000 (06:35 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Nov 2018 06:35:36 +0000 (06:35 +0000)
commit7ef6eb1664eb6d2fc79243811e2cfa3016cb1199
tree7aa2a19fe2a130f09a7e9421d047c9ffefea1eae
parent2463f6cee9a88dd1c1b539e17fcb407ad579a530
Separate paint and scroll offsets for RenderLayerBacking::m_scrollingContentsLayer
https://bugs.webkit.org/show_bug.cgi?id=183040

Source/WebCore:

Currently, scroll offset of RenderLayerBacking::m_scrollingContentsLayer is stored in the
GraphicsLayer::m_offsetFromRenderer member used for paint offset. This patch separates these
two concept by introducing a new GraphicsLayer::m_scrollOffset for the scroll offset. This
makes the API a little bit cleaner, the code easier to understand and might avoid unnecessary
repaints in composited scroll.

Patch by Frederic Wang <fwang@igalia.com> on 2018-11-29
Reviewed by Simon Fraser.

No new tests, already covered by existing tests.

* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::setScrollOffset): Setter function to update the scroll offset
of the content layer inside its scrolling parent layer. Ask a repaint if it has changed and
is requested by the caller.
(WebCore::GraphicsLayer::paintGraphicsLayerContents): Take into account the scroll offset
when painting.
(WebCore::GraphicsLayer::dumpProperties const): Dump the scroll offset property.
* platform/graphics/GraphicsLayer.h: Include ScrollableArea for the ScrollOffset typedef.
Add member for the scroll offset of the content layer inside its scrolling parent layer.
(WebCore::GraphicsLayer::scrollOffset const): Getter function.
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateGeometry): Do not include the scroll offset in the
paint offset of m_scrollingContentsLayer since it is now taken into account in
paintGraphicsLayerContents. Update the scroll offset of m_scrollingContentsLayer separately.
Leave the paint offset of m_foregroundLayer unchanged.
(WebCore::RenderLayerBacking::setContentsNeedDisplayInRect): Take into account the scroll
offset of m_scrollingContentsLayer when calculating the dirty rect.

LayoutTests:

Patch by Frederic Wang <fwang@igalia.com> on 2018-11-29
Reviewed by Simon Fraser.

Update expectations containing layer trees of RenderLayerBacking::m_scrollingContentsLayer, to separate offsetFromRenderer and
scrollOffset. We have OLD offsetFromRenderer = NEW offsetFromRenderer - scrollOffset.

* compositing/ios/overflow-scroll-touch-tiles-expected.txt:
* fast/scrolling/ios/overflow-scroll-touch-expected.txt:
* fast/scrolling/ios/subpixel-overflow-scrolling-with-ancestor-expected.txt:
* platform/ios/compositing/overflow/scrolling-without-painting-expected.txt:
* platform/ios/compositing/overflow/textarea-scroll-touch-expected.txt:
* platform/ios/compositing/rtl/rtl-scrolling-with-transformed-descendants-expected.txt:
* platform/ios/fast/scrolling/ios/overflow-scrolling-ancestor-clip-expected.txt:
* platform/ios/fast/scrolling/ios/overflow-scrolling-ancestor-clip-size-expected.txt:
* platform/ios/fast/scrolling/ios/textarea-scroll-touch-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238727 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
LayoutTests/ChangeLog
LayoutTests/compositing/ios/overflow-scroll-touch-tiles-expected.txt
LayoutTests/fast/scrolling/ios/overflow-scroll-touch-expected.txt
LayoutTests/fast/scrolling/ios/subpixel-overflow-scrolling-with-ancestor-expected.txt
LayoutTests/platform/ios/compositing/overflow/scrolling-without-painting-expected.txt
LayoutTests/platform/ios/compositing/overflow/textarea-scroll-touch-expected.txt
LayoutTests/platform/ios/compositing/rtl/rtl-scrolling-with-transformed-descendants-expected.txt
LayoutTests/platform/ios/fast/scrolling/ios/overflow-scrolling-ancestor-clip-expected.txt
LayoutTests/platform/ios/fast/scrolling/ios/overflow-scrolling-ancestor-clip-size-expected.txt
LayoutTests/platform/ios/fast/scrolling/ios/textarea-scroll-touch-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/GraphicsLayer.cpp
Source/WebCore/platform/graphics/GraphicsLayer.h
Source/WebCore/rendering/RenderLayerBacking.cpp