- Revision
- 245570
- Author
- [email protected]
- Date
- 2019-05-21 10:29:54 -0700 (Tue, 21 May 2019)
Log Message
Cherry-pick r245207. rdar://problem/50865946
Translucent gradient rendering bug due to will-change transform
https://bugs.webkit.org/show_bug.cgi?id=197654
<rdar://problem/50547664>
Reviewed by Dean Jackson.
Source/WebCore:
We failed to re-evaluate 'contentsOpaque' when a background changed, because this
happened in updateGeometry() and that doesn't run for background changes.
However, 'contentsOpaque' also requires knowing about geometry because we have to
turn it off when there's subpixel positioning, and updateConfiguration()
runs before updateGeometry().
So compute m_hasSubpixelRounding in updateGeometry() and set contentsOpaque in
updateAfterDescendants().
Test: compositing/contents-opaque/background-change-to-transparent.html
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateConfiguration):
(WebCore::RenderLayerBacking::updateGeometry):
(WebCore::RenderLayerBacking::updateAfterDescendants):
* rendering/RenderLayerBacking.h:
LayoutTests:
* compositing/contents-opaque/background-change-to-transparent-expected.txt: Added.
* compositing/contents-opaque/background-change-to-transparent.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245207 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Added Paths
Diff
Modified: branches/safari-608.1.24.20-branch/LayoutTests/ChangeLog (245569 => 245570)
--- branches/safari-608.1.24.20-branch/LayoutTests/ChangeLog 2019-05-21 17:07:57 UTC (rev 245569)
+++ branches/safari-608.1.24.20-branch/LayoutTests/ChangeLog 2019-05-21 17:29:54 UTC (rev 245570)
@@ -1,3 +1,51 @@
+2019-05-21 Kocsen Chung <[email protected]>
+
+ Cherry-pick r245207. rdar://problem/50865946
+
+ Translucent gradient rendering bug due to will-change transform
+ https://bugs.webkit.org/show_bug.cgi?id=197654
+ <rdar://problem/50547664>
+
+ Reviewed by Dean Jackson.
+ Source/WebCore:
+
+ We failed to re-evaluate 'contentsOpaque' when a background changed, because this
+ happened in updateGeometry() and that doesn't run for background changes.
+
+ However, 'contentsOpaque' also requires knowing about geometry because we have to
+ turn it off when there's subpixel positioning, and updateConfiguration()
+ runs before updateGeometry().
+
+ So compute m_hasSubpixelRounding in updateGeometry() and set contentsOpaque in
+ updateAfterDescendants().
+
+ Test: compositing/contents-opaque/background-change-to-transparent.html
+
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::updateConfiguration):
+ (WebCore::RenderLayerBacking::updateGeometry):
+ (WebCore::RenderLayerBacking::updateAfterDescendants):
+ * rendering/RenderLayerBacking.h:
+
+ LayoutTests:
+
+ * compositing/contents-opaque/background-change-to-transparent-expected.txt: Added.
+ * compositing/contents-opaque/background-change-to-transparent.html: Added.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245207 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-05-11 Simon Fraser <[email protected]>
+
+ Translucent gradient rendering bug due to will-change transform
+ https://bugs.webkit.org/show_bug.cgi?id=197654
+ <rdar://problem/50547664>
+
+ Reviewed by Dean Jackson.
+
+ * compositing/contents-opaque/background-change-to-transparent-expected.txt: Added.
+ * compositing/contents-opaque/background-change-to-transparent.html: Added.
+
2019-05-20 Kocsen Chung <[email protected]>
Cherry-pick r245505. rdar://problem/50801608
Added: branches/safari-608.1.24.20-branch/LayoutTests/compositing/contents-opaque/background-change-to-transparent-expected.txt (0 => 245570)
--- branches/safari-608.1.24.20-branch/LayoutTests/compositing/contents-opaque/background-change-to-transparent-expected.txt (rev 0)
+++ branches/safari-608.1.24.20-branch/LayoutTests/compositing/contents-opaque/background-change-to-transparent-expected.txt 2019-05-21 17:29:54 UTC (rev 245570)
@@ -0,0 +1,19 @@
+Text here
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 800.00 600.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 600.00)
+ (contentsOpaque 1)
+ (children 1
+ (GraphicsLayer
+ (position 18.00 10.00)
+ (bounds 300.00 300.00)
+ (drawsContent 1)
+ )
+ )
+ )
+ )
+)
+
Added: branches/safari-608.1.24.20-branch/LayoutTests/compositing/contents-opaque/background-change-to-transparent.html (0 => 245570)
--- branches/safari-608.1.24.20-branch/LayoutTests/compositing/contents-opaque/background-change-to-transparent.html (rev 0)
+++ branches/safari-608.1.24.20-branch/LayoutTests/compositing/contents-opaque/background-change-to-transparent.html 2019-05-21 17:29:54 UTC (rev 245570)
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Tests that contentsOpaque is re-evaluated after a background style change</title>
+ <style>
+ .composited {
+ margin: 20px;
+ height: 300px;
+ width: 300px;
+ margin: 10px;
+ background-color: silver;
+ transform: translateZ(0);
+ }
+
+ .composited.changed {
+ background: none;
+ }
+ </style>
+ <script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ window.addEventListener('load', () => {
+ setTimeout(() => {
+ document.querySelector('.composited').classList.add('changed');
+ if (window.internals)
+ document.getElementById('layers').textContent = window.internals.layerTreeAsText(document);
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }, 0);
+ }, false);
+ </script>
+</head>
+<body>
+ <div class="composited">Text here</div>
+<pre id="layers"></pre>
+</body>
+</html>
+
Modified: branches/safari-608.1.24.20-branch/Source/WebCore/ChangeLog (245569 => 245570)
--- branches/safari-608.1.24.20-branch/Source/WebCore/ChangeLog 2019-05-21 17:07:57 UTC (rev 245569)
+++ branches/safari-608.1.24.20-branch/Source/WebCore/ChangeLog 2019-05-21 17:29:54 UTC (rev 245570)
@@ -1,3 +1,66 @@
+2019-05-21 Kocsen Chung <[email protected]>
+
+ Cherry-pick r245207. rdar://problem/50865946
+
+ Translucent gradient rendering bug due to will-change transform
+ https://bugs.webkit.org/show_bug.cgi?id=197654
+ <rdar://problem/50547664>
+
+ Reviewed by Dean Jackson.
+ Source/WebCore:
+
+ We failed to re-evaluate 'contentsOpaque' when a background changed, because this
+ happened in updateGeometry() and that doesn't run for background changes.
+
+ However, 'contentsOpaque' also requires knowing about geometry because we have to
+ turn it off when there's subpixel positioning, and updateConfiguration()
+ runs before updateGeometry().
+
+ So compute m_hasSubpixelRounding in updateGeometry() and set contentsOpaque in
+ updateAfterDescendants().
+
+ Test: compositing/contents-opaque/background-change-to-transparent.html
+
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::updateConfiguration):
+ (WebCore::RenderLayerBacking::updateGeometry):
+ (WebCore::RenderLayerBacking::updateAfterDescendants):
+ * rendering/RenderLayerBacking.h:
+
+ LayoutTests:
+
+ * compositing/contents-opaque/background-change-to-transparent-expected.txt: Added.
+ * compositing/contents-opaque/background-change-to-transparent.html: Added.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245207 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-05-11 Simon Fraser <[email protected]>
+
+ Translucent gradient rendering bug due to will-change transform
+ https://bugs.webkit.org/show_bug.cgi?id=197654
+ <rdar://problem/50547664>
+
+ Reviewed by Dean Jackson.
+
+ We failed to re-evaluate 'contentsOpaque' when a background changed, because this
+ happened in updateGeometry() and that doesn't run for background changes.
+
+ However, 'contentsOpaque' also requires knowing about geometry because we have to
+ turn it off when there's subpixel positioning, and updateConfiguration()
+ runs before updateGeometry().
+
+ So compute m_hasSubpixelRounding in updateGeometry() and set contentsOpaque in
+ updateAfterDescendants().
+
+ Test: compositing/contents-opaque/background-change-to-transparent.html
+
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::updateConfiguration):
+ (WebCore::RenderLayerBacking::updateGeometry):
+ (WebCore::RenderLayerBacking::updateAfterDescendants):
+ * rendering/RenderLayerBacking.h:
+
2019-05-20 Kocsen Chung <[email protected]>
Cherry-pick r245539. rdar://problem/48740417
Modified: branches/safari-608.1.24.20-branch/Source/WebCore/rendering/RenderLayerBacking.cpp (245569 => 245570)
--- branches/safari-608.1.24.20-branch/Source/WebCore/rendering/RenderLayerBacking.cpp 2019-05-21 17:07:57 UTC (rev 245569)
+++ branches/safari-608.1.24.20-branch/Source/WebCore/rendering/RenderLayerBacking.cpp 2019-05-21 17:29:54 UTC (rev 245570)
@@ -813,7 +813,7 @@
updateRootLayerConfiguration();
updateEventRegion();
-
+
// Requires layout.
if (contentsInfo.isDirectlyCompositedImage())
updateImageContents(contentsInfo);
@@ -1106,6 +1106,7 @@
LayoutSize oldSubpixelOffsetFromRenderer = m_subpixelOffsetFromRenderer;
primaryGraphicsLayerOffsetFromRenderer = computeOffsetFromRenderer(-rendererOffset.fromPrimaryGraphicsLayer(), deviceScaleFactor());
m_subpixelOffsetFromRenderer = primaryGraphicsLayerOffsetFromRenderer.m_subpixelOffset;
+ m_hasSubpixelRounding = !m_subpixelOffsetFromRenderer.isZero() || compositedBounds().size() != primaryGraphicsLayerRect.size();
if (primaryGraphicsLayerOffsetFromRenderer.m_devicePixelOffset != m_graphicsLayer->offsetFromRenderer()) {
m_graphicsLayer->setOffsetFromRenderer(primaryGraphicsLayerOffsetFromRenderer.m_devicePixelOffset);
@@ -1112,14 +1113,6 @@
positionOverflowControlsLayers();
}
- if (!m_isMainFrameRenderViewLayer && !m_isFrameLayerWithTiledBacking && !m_requiresBackgroundLayer) {
- // For non-root layers, background is always painted by the primary graphics layer.
- ASSERT(!m_backgroundLayer);
- // Subpixel offset from graphics layer or size changed.
- bool hadSubpixelRounding = !m_subpixelOffsetFromRenderer.isZero() || compositedBounds().size() != primaryGraphicsLayerRect.size();
- m_graphicsLayer->setContentsOpaque(!hadSubpixelRounding && m_owningLayer.backgroundIsKnownToBeOpaqueInRect(compositedBounds()));
- }
-
// If we have a layer that clips children, position it.
LayoutRect clippingBox;
if (auto* clipLayer = clippingLayer()) {
@@ -1320,6 +1313,12 @@
updateDrawsContent(contentsInfo);
+ if (!m_isMainFrameRenderViewLayer && !m_isFrameLayerWithTiledBacking && !m_requiresBackgroundLayer) {
+ // For non-root layers, background is always painted by the primary graphics layer.
+ ASSERT(!m_backgroundLayer);
+ m_graphicsLayer->setContentsOpaque(!m_hasSubpixelRounding && m_owningLayer.backgroundIsKnownToBeOpaqueInRect(compositedBounds()));
+ }
+
m_graphicsLayer->setContentsVisible(m_owningLayer.hasVisibleContent() || hasVisibleNonCompositedDescendants());
if (m_scrollContainerLayer) {
m_scrollContainerLayer->setContentsVisible(renderer().style().visibility() == Visibility::Visible);
Modified: branches/safari-608.1.24.20-branch/Source/WebCore/rendering/RenderLayerBacking.h (245569 => 245570)
--- branches/safari-608.1.24.20-branch/Source/WebCore/rendering/RenderLayerBacking.h 2019-05-21 17:07:57 UTC (rev 245569)
+++ branches/safari-608.1.24.20-branch/Source/WebCore/rendering/RenderLayerBacking.h 2019-05-21 17:29:54 UTC (rev 245570)
@@ -434,6 +434,7 @@
#endif
bool m_backgroundLayerPaintsFixedRootBackground { false };
bool m_requiresBackgroundLayer { false };
+ bool m_hasSubpixelRounding { false };
bool m_paintsSubpixelAntialiasedText { false }; // This is for logging only.
};