Changeset 208981 in webkit
- Timestamp:
- Nov 26, 2016 6:06:59 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r208980 r208981 1 2016-11-26 Simon Fraser <simon.fraser@apple.com> 2 3 Composited negative z-index elements are hidden behind the body sometimes 4 https://bugs.webkit.org/show_bug.cgi?id=165080 5 rdar://problem/22260229 6 7 Reviewed by Zalan Bujtas. 8 9 * compositing/backgrounds/negative-z-index-behind-body-expected.html: Added. 10 * compositing/backgrounds/negative-z-index-behind-body-non-propagated-expected.html: Added. 11 * compositing/backgrounds/negative-z-index-behind-body-non-propagated.html: Added. 12 * compositing/backgrounds/negative-z-index-behind-body.html: Added. 13 1 14 2016-11-26 Simon Fraser <simon.fraser@apple.com> 2 15 -
trunk/Source/WebCore/ChangeLog
r208976 r208981 1 2016-11-26 Simon Fraser <simon.fraser@apple.com> 2 3 Composited negative z-index elements are hidden behind the body sometimes 4 https://bugs.webkit.org/show_bug.cgi?id=165080 5 rdar://problem/22260229 6 7 Reviewed by Zalan Bujtas. 8 9 If the <body> falls into the "directly composited background color" code path 10 (say, because it's composited because of composited negative z-index children, 11 and has content of its own), then we failed to take root background propagation 12 into account, and put the opaque root background color on the body's layer. 13 14 Fix by sharing some code from RenderBox related to whether the body's renderer 15 paints its background. 16 17 Tests cover the buggy case, and the case where the <html> has its own background color. 18 19 Tests: compositing/backgrounds/negative-z-index-behind-body-non-propagated.html 20 compositing/backgrounds/negative-z-index-behind-body.html 21 22 * rendering/RenderBox.cpp: 23 (WebCore::RenderBox::paintsOwnBackground): 24 (WebCore::RenderBox::paintBackground): 25 (WebCore::RenderBox::backgroundIsKnownToBeOpaqueInRect): 26 (WebCore::skipBodyBackground): Deleted. 27 * rendering/RenderBox.h: 28 * rendering/RenderLayerBacking.cpp: 29 (WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundColor): 30 1 31 2016-11-25 Myles C. Maxfield <mmaxfield@apple.com> 2 32 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r208597 r208981 131 131 bool RenderBox::s_hadOverflowClip = false; 132 132 133 static bool skipBodyBackground(const RenderBox* bodyElementRenderer)134 {135 ASSERT(bodyElementRenderer->isBody());136 // The <body> only paints its background if the root element has defined a background independent of the body,137 // or if the <body>'s parent is not the document element's renderer (e.g. inside SVG foreignObject).138 auto documentElementRenderer = bodyElementRenderer->document().documentElement()->renderer();139 return documentElementRenderer140 && !documentElementRenderer->hasBackground()141 && (documentElementRenderer == bodyElementRenderer->parent());142 }143 144 133 RenderBox::RenderBox(Element& element, RenderStyle&& style, BaseTypeFlags baseTypeFlags) 145 134 : RenderBoxModelObject(element, WTFMove(style), baseTypeFlags) … … 1384 1373 } 1385 1374 1375 bool RenderBox::paintsOwnBackground() const 1376 { 1377 if (isBody()) { 1378 // The <body> only paints its background if the root element has defined a background independent of the body, 1379 // or if the <body>'s parent is not the document element's renderer (e.g. inside SVG foreignObject). 1380 auto documentElementRenderer = document().documentElement()->renderer(); 1381 return !documentElementRenderer 1382 || documentElementRenderer->hasBackground() 1383 || (documentElementRenderer != parent()); 1384 } 1385 1386 return true; 1387 } 1388 1386 1389 void RenderBox::paintBackground(const PaintInfo& paintInfo, const LayoutRect& paintRect, BackgroundBleedAvoidance bleedAvoidance) 1387 1390 { … … 1390 1393 return; 1391 1394 } 1392 if (isBody() && skipBodyBackground(this)) 1395 1396 if (!paintsOwnBackground()) 1393 1397 return; 1398 1394 1399 if (backgroundIsKnownToBeObscured(paintRect.location()) && !boxShadowShouldBeAppliedToBackground(paintRect.location(), bleedAvoidance)) 1395 1400 return; 1401 1396 1402 paintFillLayers(paintInfo, style().visitedDependentColor(CSSPropertyBackgroundColor), style().backgroundLayers(), paintRect, bleedAvoidance); 1397 1403 } … … 1420 1426 bool RenderBox::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const 1421 1427 { 1422 if ( isBody() && skipBodyBackground(this))1428 if (!paintsOwnBackground()) 1423 1429 return false; 1424 1430 -
trunk/Source/WebCore/rendering/RenderBox.h
r208668 r208981 57 57 58 58 bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const final; 59 60 // Returns false for the body renderer if its background is propagated to the root. 61 bool paintsOwnBackground() const; 59 62 60 63 // Use this with caution! No type checking is done! -
trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
r208460 r208981 1810 1810 void RenderLayerBacking::updateDirectlyCompositedBackgroundColor(bool isSimpleContainer, bool& didUpdateContentsRect) 1811 1811 { 1812 if (!isSimpleContainer ) {1812 if (!isSimpleContainer || (is<RenderBox>(renderer()) && !downcast<RenderBox>(renderer()).paintsOwnBackground())) { 1813 1813 m_graphicsLayer->setContentsToSolidColor(Color()); 1814 1814 return;
Note: See TracChangeset
for help on using the changeset viewer.