WebKit Bugzilla
Attachment 369654 Details for
Bug 197768
: Layer bounds are incorrect for sharing layers that paint with transforms
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-197768-20190511111102.patch (text/plain), 15.19 KB, created by
Simon Fraser (smfr)
on 2019-05-11 11:11:03 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Simon Fraser (smfr)
Created:
2019-05-11 11:11:03 PDT
Size:
15.19 KB
patch
obsolete
>Subversion Revision: 245204 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 8855b1fbc9c474744fef221c469002ec96d7b035..ae97377a74e6b8c44be6355ed3ff87ff71dcdf26 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,25 @@ >+2019-05-11 Simon Fraser <simon.fraser@apple.com> >+ >+ Layer bounds are incorrect for sharing layers that paint with transforms >+ https://bugs.webkit.org/show_bug.cgi?id=197768 >+ <rdar://problem/50695493> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ We don't need to traverse shared layers if the backing-provider has overflow clip, >+ because we know they are containing-block descendants and therefore clipped. >+ >+ Note tha the CSS "clip" property doesn't guarantee this, because the clip rect >+ can be larger than the element, so in that case we just traverse shared layers. >+ >+ Tests: compositing/shared-backing/sharing-bounds-clip.html >+ compositing/shared-backing/sharing-bounds-non-clipping-shared-layer.html >+ compositing/shared-backing/sharing-bounds-transformed-sharing-layer.html >+ compositing/shared-backing/sharing-bounds.html >+ >+ * rendering/RenderLayerBacking.cpp: >+ (WebCore::RenderLayerBacking::updateCompositedBounds): >+ > 2019-05-10 Simon Fraser <simon.fraser@apple.com> > > Backing-sharing layers with transforms render incorrectly >diff --git a/Source/WebCore/rendering/RenderLayerBacking.cpp b/Source/WebCore/rendering/RenderLayerBacking.cpp >index c3fcb9f0ac47b86b22382ad73780da7b1f2d03c6..152163f6dfc2fd6f91587759176bafcc9425c5bc 100644 >--- a/Source/WebCore/rendering/RenderLayerBacking.cpp >+++ b/Source/WebCore/rendering/RenderLayerBacking.cpp >@@ -671,12 +671,15 @@ bool RenderLayerBacking::updateCompositedBounds() > layerBounds.intersect(clippingBounds); > } > >- for (auto& layerWeakPtr : m_backingSharingLayers) { >- auto* boundsRootLayer = &m_owningLayer; >- ASSERT(layerWeakPtr->isDescendantOf(m_owningLayer)); >- auto offset = layerWeakPtr->offsetFromAncestor(&m_owningLayer); >- auto bounds = layerWeakPtr->calculateLayerBounds(boundsRootLayer, offset, RenderLayer::defaultCalculateLayerBoundsFlags() | RenderLayer::ExcludeHiddenDescendants | RenderLayer::DontConstrainForMask); >- layerBounds.unite(bounds); >+ // If the backing provider has overflow:clip, we know all sharing layers are affected by the clip because they are containing-block descendants. >+ if (!renderer().hasOverflowClip()) { >+ for (auto& layerWeakPtr : m_backingSharingLayers) { >+ auto* boundsRootLayer = &m_owningLayer; >+ ASSERT(layerWeakPtr->isDescendantOf(m_owningLayer)); >+ auto offset = layerWeakPtr->offsetFromAncestor(&m_owningLayer); >+ auto bounds = layerWeakPtr->calculateLayerBounds(boundsRootLayer, offset, RenderLayer::defaultCalculateLayerBoundsFlags() | RenderLayer::ExcludeHiddenDescendants | RenderLayer::DontConstrainForMask); >+ layerBounds.unite(bounds); >+ } > } > > // If the element has a transform-origin that has fixed lengths, and the renderer has zero size, >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index ea0598fb9d75f403e0060f166dcfdab13f64901f..062c62f6161aa7f4a13fd298811d874a11dafd1c 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,22 @@ >+2019-05-11 Simon Fraser <simon.fraser@apple.com> >+ >+ Layer bounds are incorrect for sharing layers that paint with transforms >+ https://bugs.webkit.org/show_bug.cgi?id=197768 >+ <rdar://problem/50695493> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Tests for backing-shared layer bounds in various configurations. >+ >+ * compositing/shared-backing/sharing-bounds-clip-expected.txt: Added. >+ * compositing/shared-backing/sharing-bounds-clip.html: Added. >+ * compositing/shared-backing/sharing-bounds-expected.txt: Added. >+ * compositing/shared-backing/sharing-bounds-non-clipping-shared-layer-expected.txt: Added. >+ * compositing/shared-backing/sharing-bounds-non-clipping-shared-layer.html: Added. >+ * compositing/shared-backing/sharing-bounds-transformed-sharing-layer-expected.txt: Added. >+ * compositing/shared-backing/sharing-bounds-transformed-sharing-layer.html: Added. >+ * compositing/shared-backing/sharing-bounds.html: Added. >+ > 2019-05-10 Simon Fraser <simon.fraser@apple.com> > > Backing-sharing layers with transforms render incorrectly >diff --git a/LayoutTests/compositing/shared-backing/sharing-bounds-clip-expected.txt b/LayoutTests/compositing/shared-backing/sharing-bounds-clip-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..67d5ffc386cae03b81df3057997ca95977a0e7ba >--- /dev/null >+++ b/LayoutTests/compositing/shared-backing/sharing-bounds-clip-expected.txt >@@ -0,0 +1,23 @@ >+(GraphicsLayer >+ (anchor 0.00 0.00) >+ (bounds 800.00 600.00) >+ (children 1 >+ (GraphicsLayer >+ (bounds 800.00 600.00) >+ (contentsOpaque 1) >+ (children 2 >+ (GraphicsLayer >+ (position 8.00 8.00) >+ (bounds 50.00 50.00) >+ (contentsOpaque 1) >+ ) >+ (GraphicsLayer >+ (position 30.00 30.00) >+ (bounds 500.00 302.00) >+ (drawsContent 1) >+ ) >+ ) >+ ) >+ ) >+) >+ >diff --git a/LayoutTests/compositing/shared-backing/sharing-bounds-clip.html b/LayoutTests/compositing/shared-backing/sharing-bounds-clip.html >new file mode 100644 >index 0000000000000000000000000000000000000000..06a37b9de39a0ff1922aed0a72a58544b677ccf3 >--- /dev/null >+++ b/LayoutTests/compositing/shared-backing/sharing-bounds-clip.html >@@ -0,0 +1,63 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <title>Tests the backing provider layer bounds with a transformed sharing layer</title> >+ <style> >+ .relative { >+ position: absolute; >+ top: 20px; >+ left: 20px; >+ height: 300px; >+ width: 300px; >+ margin: 10px; >+ border: 1px solid black; >+ background-color: silver; >+ clip: rect(10px, 500px, 300px, 10px); /* larger than the bounds */ >+ } >+ >+ .sharing { >+ position: relative; >+ top: 50px; >+ left: 50px; >+ width: 200px; >+ height: 200px; >+ background-color: green; >+ } >+ >+ .inner { >+ position: absolute; >+ left: 200px; >+ top: 200px; >+ width: 100px; >+ height: 100px; >+ background-color: blue; >+ } >+ >+ .trigger { >+ transform: translateZ(0); >+ width: 50px; >+ height: 50px; >+ background-color: silver; >+ } >+ </style> >+ <script> >+ if (window.testRunner) >+ testRunner.dumpAsText(); >+ >+ window.addEventListener('load', () => { >+ if (window.internals) >+ document.getElementById('layers').textContent = internals.layerTreeAsText(document); >+ }, false); >+ </script> >+</head> >+<body> >+ <div class="trigger"></div> >+ <div class="relative"> >+ <div class="sharing"> >+ <div class="inner"> >+ </div> >+ </div> >+ </div> >+<pre id="layers"></pre> >+</body> >+</html> >diff --git a/LayoutTests/compositing/shared-backing/sharing-bounds-expected.txt b/LayoutTests/compositing/shared-backing/sharing-bounds-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..3508f59cfdb7a936b7de4f81a45e1fa8bf634e2d >--- /dev/null >+++ b/LayoutTests/compositing/shared-backing/sharing-bounds-expected.txt >@@ -0,0 +1,23 @@ >+(GraphicsLayer >+ (anchor 0.00 0.00) >+ (bounds 800.00 600.00) >+ (children 1 >+ (GraphicsLayer >+ (bounds 800.00 600.00) >+ (contentsOpaque 1) >+ (children 2 >+ (GraphicsLayer >+ (position 8.00 8.00) >+ (bounds 50.00 50.00) >+ (contentsOpaque 1) >+ ) >+ (GraphicsLayer >+ (position 30.00 30.00) >+ (bounds 302.00 302.00) >+ (drawsContent 1) >+ ) >+ ) >+ ) >+ ) >+) >+ >diff --git a/LayoutTests/compositing/shared-backing/sharing-bounds-non-clipping-shared-layer-expected.txt b/LayoutTests/compositing/shared-backing/sharing-bounds-non-clipping-shared-layer-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..f9b9b6ad52daba1e54f9576237bc43a5cd831ed9 >--- /dev/null >+++ b/LayoutTests/compositing/shared-backing/sharing-bounds-non-clipping-shared-layer-expected.txt >@@ -0,0 +1,23 @@ >+(GraphicsLayer >+ (anchor 0.00 0.00) >+ (bounds 800.00 600.00) >+ (children 1 >+ (GraphicsLayer >+ (bounds 800.00 600.00) >+ (contentsOpaque 1) >+ (children 2 >+ (GraphicsLayer >+ (position 8.00 8.00) >+ (bounds 50.00 50.00) >+ (contentsOpaque 1) >+ ) >+ (GraphicsLayer >+ (position 30.00 30.00) >+ (bounds 501.00 501.00) >+ (drawsContent 1) >+ ) >+ ) >+ ) >+ ) >+) >+ >diff --git a/LayoutTests/compositing/shared-backing/sharing-bounds-non-clipping-shared-layer.html b/LayoutTests/compositing/shared-backing/sharing-bounds-non-clipping-shared-layer.html >new file mode 100644 >index 0000000000000000000000000000000000000000..3c26c869aed7d73b987b7acac93e00045e04bd7e >--- /dev/null >+++ b/LayoutTests/compositing/shared-backing/sharing-bounds-non-clipping-shared-layer.html >@@ -0,0 +1,63 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <title>Tests the backing provider layer bounds with a transformed sharing layer</title> >+ <style> >+ .relative { >+ position: absolute; >+ top: 20px; >+ left: 20px; >+ height: 300px; >+ width: 300px; >+ margin: 10px; >+ border: 1px solid black; >+ } >+ >+ .sharing { >+ position: relative; >+ top: 50px; >+ left: 50px; >+ width: 200px; >+ height: 200px; >+ background-color: green; >+ transform: scale(1.5); >+ transform-origin: top left; >+ } >+ >+ .inner { >+ position: absolute; >+ left: 200px; >+ top: 200px; >+ width: 100px; >+ height: 100px; >+ background-color: blue; >+ } >+ >+ .trigger { >+ transform: translateZ(0); >+ width: 50px; >+ height: 50px; >+ background-color: silver; >+ } >+ </style> >+ <script> >+ if (window.testRunner) >+ testRunner.dumpAsText(); >+ >+ window.addEventListener('load', () => { >+ if (window.internals) >+ document.getElementById('layers').textContent = internals.layerTreeAsText(document); >+ }, false); >+ </script> >+</head> >+<body> >+ <div class="trigger"></div> >+ <div class="relative"> >+ <div class="sharing"> >+ <div class="inner"> >+ </div> >+ </div> >+ </div> >+<pre id="layers"></pre> >+</body> >+</html> >diff --git a/LayoutTests/compositing/shared-backing/sharing-bounds-transformed-sharing-layer-expected.txt b/LayoutTests/compositing/shared-backing/sharing-bounds-transformed-sharing-layer-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..3508f59cfdb7a936b7de4f81a45e1fa8bf634e2d >--- /dev/null >+++ b/LayoutTests/compositing/shared-backing/sharing-bounds-transformed-sharing-layer-expected.txt >@@ -0,0 +1,23 @@ >+(GraphicsLayer >+ (anchor 0.00 0.00) >+ (bounds 800.00 600.00) >+ (children 1 >+ (GraphicsLayer >+ (bounds 800.00 600.00) >+ (contentsOpaque 1) >+ (children 2 >+ (GraphicsLayer >+ (position 8.00 8.00) >+ (bounds 50.00 50.00) >+ (contentsOpaque 1) >+ ) >+ (GraphicsLayer >+ (position 30.00 30.00) >+ (bounds 302.00 302.00) >+ (drawsContent 1) >+ ) >+ ) >+ ) >+ ) >+) >+ >diff --git a/LayoutTests/compositing/shared-backing/sharing-bounds-transformed-sharing-layer.html b/LayoutTests/compositing/shared-backing/sharing-bounds-transformed-sharing-layer.html >new file mode 100644 >index 0000000000000000000000000000000000000000..0d08d15a6c999d5a330812f6591d5be554f6f36e >--- /dev/null >+++ b/LayoutTests/compositing/shared-backing/sharing-bounds-transformed-sharing-layer.html >@@ -0,0 +1,50 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <title>Tests bounds computation for a transformed layer painting into shared backing</title> >+ <style> >+ .clipping { >+ position: absolute; >+ top: 20px; >+ left: 20px; >+ overflow: hidden; >+ height: 300px; >+ width: 300px; >+ margin: 10px; >+ border: 1px solid black; >+ } >+ >+ .transformed { >+ width: 400px; >+ height: 100px; >+ background-color: green; >+ transform: scale(2); >+ transform-origin: top left; >+ } >+ >+ .trigger { >+ transform: translateZ(0); >+ width: 50px; >+ height: 50px; >+ background-color: silver; >+ } >+ </style> >+ <script> >+ if (window.testRunner) >+ testRunner.dumpAsText(); >+ >+ window.addEventListener('load', () => { >+ if (window.internals) >+ document.getElementById('layers').textContent = internals.layerTreeAsText(document); >+ }, false); >+ </script> >+</head> >+<body> >+ <div class="trigger"></div> >+ <div class="clipping"> >+ <div class="transformed"> >+ </div> >+ </div> >+<pre id="layers"></pre> >+</body> >+</html> >diff --git a/LayoutTests/compositing/shared-backing/sharing-bounds.html b/LayoutTests/compositing/shared-backing/sharing-bounds.html >new file mode 100644 >index 0000000000000000000000000000000000000000..33a6240b31b1c70903bbaf7d696dfc2fae6d2215 >--- /dev/null >+++ b/LayoutTests/compositing/shared-backing/sharing-bounds.html >@@ -0,0 +1,63 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <title>Tests the backing provider layer bounds with a positioned child</title> >+ <style> >+ .clipping { >+ position: absolute; >+ top: 20px; >+ left: 20px; >+ overflow: hidden; >+ height: 300px; >+ width: 300px; >+ margin: 10px; >+ border: 1px solid black; >+ } >+ >+ .sharing { >+ position: relative; >+ top: 50px; >+ left: 50px; >+ width: 200px; >+ height: 200px; >+ background-color: green; >+ } >+ >+ .inner { >+ position: absolute; >+ left: 200px; >+ top: 200px; >+ width: 100px; >+ height: 100px; >+ background-color: blue; >+ } >+ >+ .trigger { >+ transform: translateZ(0); >+ width: 50px; >+ height: 50px; >+ background-color: silver; >+ } >+ >+ </style> >+ <script> >+ if (window.testRunner) >+ testRunner.dumpAsText(); >+ >+ window.addEventListener('load', () => { >+ if (window.internals) >+ document.getElementById('layers').textContent = internals.layerTreeAsText(document); >+ }, false); >+ </script> >+</head> >+<body> >+ <div class="composited trigger"></div> >+ <div class="clipping"> >+ <div class="sharing"> >+ <div class="inner"> >+ </div> >+ </div> >+ </div> >+<pre id="layers"></pre> >+</body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 197768
:
369545
| 369654