Project: chromium Issues People Development process History Sign in
New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 24 users
Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug

Blocking:
issue 381840



Sign in to add a comment
mixed background (fixed + local, or scroll + local) not invalidated when composited scroller is scrolled
Project Member Reported by trchen@chromium.org, Dec 11 2015 Back to list
How to repro: Open http://jsbin.com/pawidok/ and scroll down the div.
Actual: The google logo should scroll down along with normal flow.
Expected: The google logo stayed still.

This is due to painting CSS background onto main layer(CLM::m_graphicsLayer) when a scrollable div gets composited, and we never issue invalidation on scroll when composited scrolling is used.

Proposed solution: We should still invalidate on scroll and fallback to main-thread scrolling whenever background attachment is neither all 'fixed' or all 'scroll'.

Optimization (optional but strongly recommended): When background attachment is all 'local', paint background into CLM::m_scrollingContentsLayer or CLM::m_backgroundLayer (when negative z-index child stacking context presents), and try not to create textures for CLM::m_graphicsLayer if no other box decoration presents.

Although SPv2 probably will make everything easier to fix, I feel it is still worthwhile to implement this optimization for SPv1 because Settings::rootLayerScrolls is heavily affected by this:

1. background-attachment:local itself is uncommon, but root background treat 'scroll'(the default) as 'local', thus very common if we enabled RLS (so the root background go through the same code path as normal elements).

2. Memory regression due to moving contents to m_scrollingContentsLayer but still need m_graphicsLayer for backgrounds.
2.1. Lose LCD texts too.

3. Performance regression due to the need of re-paint & re-raster on every scroll.


 
Comment 1 by trchen@chromium.org, Dec 11 2015
Blocking: chromium:417782
Cc: bokan@chromium.org
Blocking: 381840
Owner: flackr@chromium.org
Status: Started
I'm looking into this in the context of  issue 381840 . In particular, we want to paint the background into m_scrollingContentsLayer when possible so that we can promote overflow scrolling layers to be composited on low dpi while preserving lcd text. This would be possible when we have background-attachment local or just a solid color background (solid color could be treated as background-attachment local).
Cc: dsinclair@chromium.org le...@chromium.org ashej...@chromium.org jchaffraix@chromium.org
 Issue 417349  has been merged into this issue.
Comment 5 by flackr@chromium.org, Jun 14 2016
I have a hacky WIP patch uploaded which paints background attachment local backgrounds into the scrolling contents layer. I'm probably going to split this up into several pieces and add appropriate tests.
https://codereview.chromium.org/2068723002. 
Cc: flackr@chromium.org
 Issue 627037  has been merged into this issue.
Project Member Comment 7 by bugdroid1@chromium.org, Aug 26 2016
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/05ee9971df08ffd2e57af7e6258a2b3efab9b539

commit 05ee9971df08ffd2e57af7e6258a2b3efab9b539
Author: flackr <flackr@chromium.org>
Date: Fri Aug 26 20:26:03 2016

Paint local attachment backgrounds into composited scrolling contents layer

This change detects when we can paint the background onto the scrolling contents layer. This will unblock promoting scrollers with supported backgrounds on low DPI devices as we can now maintain subpixel antialiased text.

BUG= 381840 ,568847
TEST=compositing/overflow/overflow-scroll-with-local-image-background.html, LayoutBoxTest.BackgroundRect, CompositedLayerMappingTest.ShouldPaintBackgroundOntoScrollingContentsLayer
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2068723002
Cr-Commit-Position: refs/heads/master@{#414795}

[modify] https://crrev.com/05ee9971df08ffd2e57af7e6258a2b3efab9b539/third_party/WebKit/LayoutTests/compositing/layer-creation/overlap-transformed-layer-expected.txt
[modify] https://crrev.com/05ee9971df08ffd2e57af7e6258a2b3efab9b539/third_party/WebKit/LayoutTests/compositing/layer-creation/overlap-transformed-layer-with-transform-body-expected.txt
[modify] https://crrev.com/05ee9971df08ffd2e57af7e6258a2b3efab9b539/third_party/WebKit/LayoutTests/compositing/layer-creation/overlap-transformed-preserved-3d-expected.txt
[modify] https://crrev.com/05ee9971df08ffd2e57af7e6258a2b3efab9b539/third_party/WebKit/LayoutTests/compositing/overflow/overflow-scroll-with-local-background-expected.html
[modify] https://crrev.com/05ee9971df08ffd2e57af7e6258a2b3efab9b539/third_party/WebKit/LayoutTests/compositing/overflow/overflow-scroll-with-local-background.html
[add] https://crrev.com/05ee9971df08ffd2e57af7e6258a2b3efab9b539/third_party/WebKit/LayoutTests/compositing/overflow/overflow-scroll-with-local-image-background-expected.html
[add] https://crrev.com/05ee9971df08ffd2e57af7e6258a2b3efab9b539/third_party/WebKit/LayoutTests/compositing/overflow/overflow-scroll-with-local-image-background.html
[modify] https://crrev.com/05ee9971df08ffd2e57af7e6258a2b3efab9b539/third_party/WebKit/LayoutTests/compositing/squashing/squashing-inside-perspective-expected.txt
[modify] https://crrev.com/05ee9971df08ffd2e57af7e6258a2b3efab9b539/third_party/WebKit/LayoutTests/css3/blending/mix-blend-mode-composited-reason-children-expected.txt
[modify] https://crrev.com/05ee9971df08ffd2e57af7e6258a2b3efab9b539/third_party/WebKit/LayoutTests/fast/borders/overflow-hidden-border-radius-force-backing-store-expected.txt
[modify] https://crrev.com/05ee9971df08ffd2e57af7e6258a2b3efab9b539/third_party/WebKit/LayoutTests/fast/repaint/background-resize-height-expected.txt
[modify] https://crrev.com/05ee9971df08ffd2e57af7e6258a2b3efab9b539/third_party/WebKit/LayoutTests/fast/repaint/fixed-element-repaint-after-compositing-update-expected.txt
[modify] https://crrev.com/05ee9971df08ffd2e57af7e6258a2b3efab9b539/third_party/WebKit/LayoutTests/paint/invalidation/invalidate-descendants-when-receiving-paint-layer-expected.txt
[modify] https://crrev.com/05ee9971df08ffd2e57af7e6258a2b3efab9b539/third_party/WebKit/LayoutTests/platform/android/css3/blending/mix-blend-mode-composited-layers-expected.txt
[modify] https://crrev.com/05ee9971df08ffd2e57af7e6258a2b3efab9b539/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/fixed-element-repaint-after-compositing-update-expected.txt
[modify] https://crrev.com/05ee9971df08ffd2e57af7e6258a2b3efab9b539/third_party/WebKit/LayoutTests/platform/mac/css3/blending/mix-blend-mode-composited-layers-expected.txt
[modify] https://crrev.com/05ee9971df08ffd2e57af7e6258a2b3efab9b539/third_party/WebKit/LayoutTests/platform/win/css3/blending/mix-blend-mode-composited-layers-expected.txt
[modify] https://crrev.com/05ee9971df08ffd2e57af7e6258a2b3efab9b539/third_party/WebKit/Source/core/layout/LayoutBox.cpp
[modify] https://crrev.com/05ee9971df08ffd2e57af7e6258a2b3efab9b539/third_party/WebKit/Source/core/layout/LayoutBox.h
[modify] https://crrev.com/05ee9971df08ffd2e57af7e6258a2b3efab9b539/third_party/WebKit/Source/core/layout/LayoutBoxTest.cpp
[modify] https://crrev.com/05ee9971df08ffd2e57af7e6258a2b3efab9b539/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
[modify] https://crrev.com/05ee9971df08ffd2e57af7e6258a2b3efab9b539/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp
[modify] https://crrev.com/05ee9971df08ffd2e57af7e6258a2b3efab9b539/third_party/WebKit/Source/core/style/ComputedStyle.cpp
[modify] https://crrev.com/05ee9971df08ffd2e57af7e6258a2b3efab9b539/third_party/WebKit/Source/core/style/ComputedStyle.h
[modify] https://crrev.com/05ee9971df08ffd2e57af7e6258a2b3efab9b539/third_party/WebKit/Source/core/style/ComputedStyleConstants.h
[modify] https://crrev.com/05ee9971df08ffd2e57af7e6258a2b3efab9b539/third_party/WebKit/Source/core/style/FillLayer.cpp

Comment 8 by flackr@chromium.org, Aug 30 2016
Owner: ----
Status: Available
Summary: Mixed background-attachment:fixed|scroll and background-attachment:local should be invalidated on scroll with composited scrolling (was: background-attachment:local should be invalidated on scroll with composited scrolling)
My patch fixes this for the optimized case where all backgrounds are locally attached (including the demo at http://jsbin.com/pawidok/) and soon for locally equivalent backgrounds such as solid colors in certain circumstances (see https://codereview.chromium.org/2264663002) such that we don't need to repaint, however this will still be broken when some of the backgrounds are not locally attached. I'm updating the title of the bug to reflect the remaining work and making it available again.
Project Member Comment 9 by bugdroid1@chromium.org, Nov 18 2016
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/a2907993ffbc7f8e21b2dce12c2ff5d541afca7e

commit a2907993ffbc7f8e21b2dce12c2ff5d541afca7e
Author: wangxianzhu <wangxianzhu@chromium.org>
Date: Fri Nov 18 04:16:06 2016

Paint invalidation of local attachment backgrounds

Previously if a local attachment background was painted on the scrolling
contents layer, we called invalidatePaintUsingContainer() with the visual
rect of the object, and in setBackingNeedsPaintInvalidationInRect()
we invalidated the rect on the main layer, and invalidated the whole
scrolling contents layer.

This CL specially handles background invalidation on scrolling contents
layer with LayoutObject::backgroundChangedSinceLastPaintInvalidation()
and a new paint invalidation reason PaintInvalidationBackgroundOnScrollingContentsLayer.
Also supports incremental invalidation of backgrounds on scrolling
contents layer caused by layout overflow change, if possible.

We need this change because now more backgrounds are/will be treated as local
attachment [equivalent] and previous handling of paint invalidation of
them caused too many unnecessary full invalidation on both the container
layer and the scrolling contents layer.

We (will) have more background treated as local attachment because of
the following reasons:
- With rootLayerScrolling, most LayoutViews (except those with fixed background)
  are treated as normal scrolling object with local attachment background.
  Always full invalidation of either container or contents layer is not
  acceptable at least on Android on which hiding/showing the top control
  (which causes resize of the LayoutView) is a key scenario of performance
  and power consumption;
- With composited scrolling with opaque background regardless of LCD text,
  we treat normal solid color backgrounds as local attachment backgrounds.
  Full paint invalidation of scrolling contents layer of them is a big
  regression.

BUG= 660156 ,568847
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2498823002
Cr-Commit-Position: refs/heads/master@{#433093}

[modify] https://crrev.com/a2907993ffbc7f8e21b2dce12c2ff5d541afca7e/third_party/WebKit/LayoutTests/paint/invalidation/composited-overflow-with-local-background-expected.txt
[add] https://crrev.com/a2907993ffbc7f8e21b2dce12c2ff5d541afca7e/third_party/WebKit/LayoutTests/paint/invalidation/compositing/background-attachment-local-composited-expected.html
[add] https://crrev.com/a2907993ffbc7f8e21b2dce12c2ff5d541afca7e/third_party/WebKit/LayoutTests/paint/invalidation/compositing/background-attachment-local-composited-expected.txt
[add] https://crrev.com/a2907993ffbc7f8e21b2dce12c2ff5d541afca7e/third_party/WebKit/LayoutTests/paint/invalidation/compositing/background-attachment-local-composited.html
[add] https://crrev.com/a2907993ffbc7f8e21b2dce12c2ff5d541afca7e/third_party/WebKit/LayoutTests/paint/invalidation/compositing/background-attachment-local-equivalent-expected.html
[add] https://crrev.com/a2907993ffbc7f8e21b2dce12c2ff5d541afca7e/third_party/WebKit/LayoutTests/paint/invalidation/compositing/background-attachment-local-equivalent-expected.txt
[add] https://crrev.com/a2907993ffbc7f8e21b2dce12c2ff5d541afca7e/third_party/WebKit/LayoutTests/paint/invalidation/compositing/background-attachment-local-equivalent.html
[add] https://crrev.com/a2907993ffbc7f8e21b2dce12c2ff5d541afca7e/third_party/WebKit/LayoutTests/paint/invalidation/compositing/should-not-repaint-scrolling-contents-outline-change-expected.html
[add] https://crrev.com/a2907993ffbc7f8e21b2dce12c2ff5d541afca7e/third_party/WebKit/LayoutTests/paint/invalidation/compositing/should-not-repaint-scrolling-contents-outline-change-expected.txt
[add] https://crrev.com/a2907993ffbc7f8e21b2dce12c2ff5d541afca7e/third_party/WebKit/LayoutTests/paint/invalidation/compositing/should-not-repaint-scrolling-contents-outline-change.html
[modify] https://crrev.com/a2907993ffbc7f8e21b2dce12c2ff5d541afca7e/third_party/WebKit/LayoutTests/paint/invalidation/overflow-scroll-local-background-text-color-change-expected.txt
[modify] https://crrev.com/a2907993ffbc7f8e21b2dce12c2ff5d541afca7e/third_party/WebKit/LayoutTests/paint/invalidation/repaint-composited-child-in-scrolled-container.html
[modify] https://crrev.com/a2907993ffbc7f8e21b2dce12c2ff5d541afca7e/third_party/WebKit/LayoutTests/platform/linux/paint/invalidation/overflow-scroll-local-background-text-color-change-expected.txt
[modify] https://crrev.com/a2907993ffbc7f8e21b2dce12c2ff5d541afca7e/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
[modify] https://crrev.com/a2907993ffbc7f8e21b2dce12c2ff5d541afca7e/third_party/WebKit/Source/core/paint/BoxPaintInvalidator.cpp
[modify] https://crrev.com/a2907993ffbc7f8e21b2dce12c2ff5d541afca7e/third_party/WebKit/Source/core/paint/BoxPaintInvalidator.h
[modify] https://crrev.com/a2907993ffbc7f8e21b2dce12c2ff5d541afca7e/third_party/WebKit/Source/core/paint/BoxPaintInvalidatorTest.cpp
[modify] https://crrev.com/a2907993ffbc7f8e21b2dce12c2ff5d541afca7e/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp
[modify] https://crrev.com/a2907993ffbc7f8e21b2dce12c2ff5d541afca7e/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.h
[modify] https://crrev.com/a2907993ffbc7f8e21b2dce12c2ff5d541afca7e/third_party/WebKit/Source/platform/graphics/PaintInvalidationReason.cpp
[modify] https://crrev.com/a2907993ffbc7f8e21b2dce12c2ff5d541afca7e/third_party/WebKit/Source/platform/graphics/PaintInvalidationReason.h

Cc: kavvaru@chromium.org yigu@chromium.org
 Issue 686780  has been merged into this issue.
trchen@, naive question: is the actual and expected cases in the original report backwards (or the jsbin changed)? I would expect a background-attachment: local to make the google logo move when the div is scrolled.
Oops, yes I mixed it up in my original post. Your understanding is correct, and flackr's change did fix the background-attachment:local case.

 Issue 725803  has been merged into this issue.
Summary: mixed background (fixed + local, or scroll + local) not invalidated when composited scroller is scrolled (was: Mixed background-attachment:fixed|scroll and background-attachment:local should be invalidated on scroll with composited scrolling)
This is still broken, but it took me a while to understand the history / current status.  Here is a current repro: http://output.jsbin.com/felujuz/quiet

The green ball should move when the <div> is scrolled.

Mixed backgrounds are the only scenario where a composited <div> needs to invalidate its own paint on scroll.  When all of the <div>'s backgrounds have the same attachment, we paint them into a GraphicsLayer that tracks its movement.

There is a related issue 754094 which tracks descendant invalidation.
Blocking: -417782
Sign in to add a comment