Composited negative z-index elements are hidden behind the body sometimes
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 27 Nov 2016 02:06:59 +0000 (02:06 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 27 Nov 2016 02:06:59 +0000 (02:06 +0000)
commit7a8d0891f730d09269f5c19c2829752e8049e60c
tree6184e676250b01a30f8ae8afcdee76672f22bc51
parentac391c6f93326c1ac81b17a5ef49a95ac61be90e
Composited negative z-index elements are hidden behind the body sometimes
https://bugs.webkit.org/show_bug.cgi?id=165080
rdar://problem/22260229

Reviewed by Zalan Bujtas.

Source/WebCore:

If the <body> falls into the "directly composited background color" code path
(say, because it's composited because of composited negative z-index children,
and has content of its own), then we failed to take root background propagation
into account, and put the opaque root background color on the body's layer.

Fix by sharing some code from RenderBox related to whether the body's renderer
paints its background.

Tests cover the buggy case, and the case where the <html> has its own background color.

Tests: compositing/backgrounds/negative-z-index-behind-body-non-propagated.html
       compositing/backgrounds/negative-z-index-behind-body.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::paintsOwnBackground):
(WebCore::RenderBox::paintBackground):
(WebCore::RenderBox::backgroundIsKnownToBeOpaqueInRect):
(WebCore::skipBodyBackground): Deleted.
* rendering/RenderBox.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundColor):

LayoutTests:

* compositing/backgrounds/negative-z-index-behind-body-expected.html: Added.
* compositing/backgrounds/negative-z-index-behind-body-non-propagated-expected.html: Added.
* compositing/backgrounds/negative-z-index-behind-body-non-propagated.html: Added.
* compositing/backgrounds/negative-z-index-behind-body.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208981 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/compositing/backgrounds/negative-z-index-behind-body-expected.html [new file with mode: 0644]
LayoutTests/compositing/backgrounds/negative-z-index-behind-body-non-propagated-expected.html [new file with mode: 0644]
LayoutTests/compositing/backgrounds/negative-z-index-behind-body-non-propagated.html [new file with mode: 0644]
LayoutTests/compositing/backgrounds/negative-z-index-behind-body.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderBox.h
Source/WebCore/rendering/RenderLayerBacking.cpp