Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1018)

Issue 102123013: Fix painting of fixed background images in composited layers (Closed)

Created:
6 years, 11 months ago by Stephen White
Modified:
6 years, 8 months ago
Reviewers:
esprehn
CC:
blink-reviews, bemjb+rendering_chromium.org, eae+blinkwatch, leviw+renderwatch, jchaffraix+rendering, zoltan1, enne (OOO)
Visibility:
Public.

Description

This is a merge of http://trac.webkit.org/changeset/151623 by Simon Fraser <simon.fraser@apple.com>;. It was a mostly-mechanical merge. The reftest fixed-backgrounds.html required some tweaking, since it relied on composited and non-composited output being identical. This required changing the shadow from a soft shadow to a hard shadow. BUG=330852 -- Source/WebCore: Painting of fixed background images is wrong in composited layers ​https://bugs.webkit.org/show_bug.cgi?id=65793 Reviewed by Sam Weinig. The code that computed background image geometry for background-attachment:fixed images was unaware of compositing, so often painting the image at the wrong location. Fix by having RenderBoxModelObject::calculateBackgroundImageGeometry() do the correct math for fixed backgrounds in composited layer by offsetting the viewport rect by the paint container's absolute position. Tests: compositing/backgrounds/fixed-background-on-descendant.html compositing/backgrounds/fixed-backgrounds.html rendering/RenderBox.cpp: (WebCore::RenderBox::getBackgroundPaintedExtent): Now returns a bool indicating whether it is returning a reliable extent rect. It can return false in the case where a background is fixed, since computing the correct extent would require finding the appropriate composited ancestor to pass to calculateBackgroundImageGeometry(). This is OK since this function is used for "background opaque" optimizations. (WebCore::RenderBox::computeBackgroundIsKnownToBeObscured): If getBackgroundPaintedExtent() returns false, return false. (WebCore::RenderBox::maskClipRect): We removed mask-attachment, so we never need to compute the composited ancestor here and can pass null. (WebCore::RenderBox::repaintLayerRectsForImage): Unwrap a comment. If the changed image is related to a fixed background, geometry.hasNonLocalGeometry() will be true. In that cause, just repaint the entire renderer rather than groveling around for a composited ancestor. rendering/RenderBox.h: Changed name and signature of backgroundPaintedExtent. rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::paintFillLayerExtended): calculateBackgroundImageGeometry() now needs to know the painting container. (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry): Now takes a painting container, that is required to correctly compute the viewport-relative offset for fixed backgrounds. geometry.setHasNonLocalGeometry() is set for fixed backgrounds to indicate to callers that, if they didn't pass a paint container, the destRect is not accurate. The main bug fix is also here: we move the viewportRect by the absolute location of paint container, which is equivalent to the composited layer offset. (WebCore::RenderBoxModelObject::getGeometryForBackgroundImage): calculateBackgroundImageGeometry() takes a paint container. rendering/RenderBoxModelObject.h: (WebCore::RenderBoxModelObject::BackgroundImageGeometry::BackgroundImageGeometry): (WebCore::RenderBoxModelObject::BackgroundImageGeometry::setHasNonLocalGeometry): (WebCore::RenderBoxModelObject::BackgroundImageGeometry::hasNonLocalGeometry): rendering/RenderImage.cpp: (WebCore::RenderImage::computeBackgroundIsKnownToBeObscured): If getBackgroundPaintedExtent() can't cheaply give an accurate answer, return false. rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundImage): Pass the paint container, which is our own renderer. LayoutTests: Fixed background images behave strangely with webkit transitions ​https://bugs.webkit.org/show_bug.cgi?id=65793 Reviewed by Sam Weinig. Ref tests that compare fixed background rendering after a scroll, with and without compositing, with a couple of layer configurations. compositing/backgrounds/fixed-background-on-descendant-expected.html: Added. compositing/backgrounds/fixed-background-on-descendant.html: Added. compositing/backgrounds/fixed-backgrounds-expected.html: Added. compositing/backgrounds/fixed-backgrounds.html: Added. Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=170618

Patch Set 1 #

Total comments: 10

Patch Set 2 : Update to ToT #

Patch Set 3 : Fixes per review comments #

Total comments: 4

Patch Set 4 : Updated to ToT #

Patch Set 5 : Added missing DOCTYPEs #

Unified diffs Side-by-side diffs Delta from patch set Stats (+224 lines, -19 lines) Patch
A LayoutTests/compositing/backgrounds/fixed-background-on-descendant.html View 1 2 3 4 1 chunk +51 lines, -0 lines 0 comments Download
A LayoutTests/compositing/backgrounds/fixed-background-on-descendant-expected.html View 1 2 3 4 1 chunk +47 lines, -0 lines 0 comments Download
A LayoutTests/compositing/backgrounds/fixed-backgrounds.html View 1 2 3 4 1 chunk +36 lines, -0 lines 0 comments Download
A LayoutTests/compositing/backgrounds/fixed-backgrounds-expected.html View 1 2 3 4 1 chunk +31 lines, -0 lines 0 comments Download
M Source/core/rendering/RenderBox.h View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download
M Source/core/rendering/RenderBox.cpp View 1 2 3 5 chunks +30 lines, -12 lines 0 comments Download
M Source/core/rendering/RenderBoxModelObject.h View 1 2 2 chunks +10 lines, -1 line 0 comments Download
M Source/core/rendering/RenderBoxModelObject.cpp View 1 4 chunks +12 lines, -4 lines 0 comments Download
M Source/core/rendering/RenderImage.cpp View 1 1 chunk +5 lines, -1 line 0 comments Download

Messages

Total messages: 14 (0 generated)
Stephen White
Shawn, could you take a look? I'm not an expert in this code, but this ...
6 years, 11 months ago (2014-01-02 22:49:04 UTC) #1
esprehn
You should add a title and change description for what this patch actually does. There ...
6 years, 11 months ago (2014-01-03 16:41:33 UTC) #2
Stephen White
On 2014/01/03 16:41:33, esprehn wrote: > You should add a title and change description for ...
6 years, 11 months ago (2014-01-03 17:43:43 UTC) #3
Stephen White
+enne for compositor-fu (for realz this time).
6 years, 11 months ago (2014-01-03 17:49:06 UTC) #4
shawnsingh
Superficially this looks OK to me, but I'm not familiar enough with this side of ...
6 years, 11 months ago (2014-01-05 18:48:17 UTC) #5
Stephen White
esprehn@: ping?
6 years, 11 months ago (2014-01-07 20:59:35 UTC) #6
esprehn
https://codereview.chromium.org/102123013/diff/1/LayoutTests/compositing/backgrounds/fixed-background-on-descendant-expected.html File LayoutTests/compositing/backgrounds/fixed-background-on-descendant-expected.html (right): https://codereview.chromium.org/102123013/diff/1/LayoutTests/compositing/backgrounds/fixed-background-on-descendant-expected.html#newcode3 LayoutTests/compositing/backgrounds/fixed-background-on-descendant-expected.html:3: <html> We usually leave off the <html>, <head> and ...
6 years, 11 months ago (2014-01-08 01:53:54 UTC) #7
esprehn
What happened to this patch?
6 years, 9 months ago (2014-03-27 09:48:24 UTC) #8
Stephen White
On 2014/03/27 09:48:24, esprehn wrote: > What happened to this patch? Deprioritized. I'll dust it ...
6 years, 9 months ago (2014-03-27 14:43:34 UTC) #9
Stephen White
New patch up. https://codereview.chromium.org/102123013/diff/1/LayoutTests/compositing/backgrounds/fixed-background-on-descendant-expected.html File LayoutTests/compositing/backgrounds/fixed-background-on-descendant-expected.html (right): https://codereview.chromium.org/102123013/diff/1/LayoutTests/compositing/backgrounds/fixed-background-on-descendant-expected.html#newcode3 LayoutTests/compositing/backgrounds/fixed-background-on-descendant-expected.html:3: <html> On 2014/01/08 01:53:55, esprehn wrote: ...
6 years, 9 months ago (2014-03-27 15:07:12 UTC) #10
esprehn
lgtm https://codereview.chromium.org/102123013/diff/130001/LayoutTests/compositing/backgrounds/fixed-background-on-descendant-expected.html File LayoutTests/compositing/backgrounds/fixed-background-on-descendant-expected.html (right): https://codereview.chromium.org/102123013/diff/130001/LayoutTests/compositing/backgrounds/fixed-background-on-descendant-expected.html#newcode1 LayoutTests/compositing/backgrounds/fixed-background-on-descendant-expected.html:1: <style> same https://codereview.chromium.org/102123013/diff/130001/LayoutTests/compositing/backgrounds/fixed-background-on-descendant.html File LayoutTests/compositing/backgrounds/fixed-background-on-descendant.html (right): https://codereview.chromium.org/102123013/diff/130001/LayoutTests/compositing/backgrounds/fixed-background-on-descendant.html#newcode1 LayoutTests/compositing/backgrounds/fixed-background-on-descendant.html:1: ...
6 years, 8 months ago (2014-04-01 22:00:12 UTC) #11
Stephen White
The CQ bit was checked by senorblanco@chromium.org
6 years, 8 months ago (2014-04-01 22:45:41 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/senorblanco@chromium.org/102123013/170001
6 years, 8 months ago (2014-04-01 22:45:49 UTC) #13
commit-bot: I haz the power
6 years, 8 months ago (2014-04-02 01:08:23 UTC) #14
Message was sent while issue was closed.
Change committed as 170618

Powered by Google App Engine
This is Rietveld 408576698