- Revision
- 260371
- Author
- simon.fra...@apple.com
- Date
- 2020-04-20 10:14:51 -0700 (Mon, 20 Apr 2020)
Log Message
Content disappears on CSS parallax example
https://bugs.webkit.org/show_bug.cgi?id=210732
Source/WebCore:
<rdar://problem/61997636>
Reviewed by Darin Adler.
If scrolling affects the computation of coverage rect of a TiledBacking, we plumb
that expanded coverage back into TransformState which is maintained during GraphicsLayer flushing,
and it's used to compute coverage rect for descendants.
It's passed into TransformState::setLastPlanarSecondaryQuad(), which has to map it back into
the coordinate system of the last flattening ancestor. However, TransformState::mapQuad()
had a missing return and the quad mapping was wrong. The new code is now the same as
TransformState::mappedPoint() (you can see where the copy/paste error came from).
Test: compositing/tiling/coverage-adjustment-secondary-quad-mapping.html
* platform/graphics/transforms/TransformState.cpp:
(WebCore::TransformState::mapQuad const):
(WebCore::TransformState::flattenWithTransform):
LayoutTests:
Reviewed by Darin Adler.
* compositing/tiling/coverage-adjustment-secondary-quad-mapping-expected.txt: Added.
* compositing/tiling/coverage-adjustment-secondary-quad-mapping.html: Added.
* platform/ios-wk2/compositing/tiling/coverage-adjustment-secondary-quad-mapping-expected.txt: Added.
* platform/mac-wk1/compositing/tiling/coverage-adjustment-secondary-quad-mapping-expected.txt: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (260370 => 260371)
--- trunk/LayoutTests/ChangeLog 2020-04-20 16:54:15 UTC (rev 260370)
+++ trunk/LayoutTests/ChangeLog 2020-04-20 17:14:51 UTC (rev 260371)
@@ -1,3 +1,15 @@
+2020-04-19 Simon Fraser <simon.fra...@apple.com>
+
+ Content disappears on CSS parallax example
+ https://bugs.webkit.org/show_bug.cgi?id=210732
+
+ Reviewed by Darin Adler.
+
+ * compositing/tiling/coverage-adjustment-secondary-quad-mapping-expected.txt: Added.
+ * compositing/tiling/coverage-adjustment-secondary-quad-mapping.html: Added.
+ * platform/ios-wk2/compositing/tiling/coverage-adjustment-secondary-quad-mapping-expected.txt: Added.
+ * platform/mac-wk1/compositing/tiling/coverage-adjustment-secondary-quad-mapping-expected.txt: Added.
+
2020-04-20 Zalan Bujtas <za...@apple.com>
[LFC][TFC] Add support for border-collapse: collapse.
Added: trunk/LayoutTests/compositing/tiling/coverage-adjustment-secondary-quad-mapping-expected.txt (0 => 260371)
--- trunk/LayoutTests/compositing/tiling/coverage-adjustment-secondary-quad-mapping-expected.txt (rev 0)
+++ trunk/LayoutTests/compositing/tiling/coverage-adjustment-secondary-quad-mapping-expected.txt 2020-04-20 17:14:51 UTC (rev 260371)
@@ -0,0 +1,66 @@
+
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 785.00 620.00)
+ (backingStoreAttached 1)
+ (children 1
+ (GraphicsLayer
+ (bounds 785.00 620.00)
+ (contentsOpaque 1)
+ (backingStoreAttached 1)
+ (children 1
+ (GraphicsLayer
+ (position 8.00 20.00)
+ (anchor 0.50 0.50)
+ (bounds 769.00 580.00)
+ (backingStoreAttached 1)
+ (children 1
+ (GraphicsLayer
+ (position 20.00 0.00)
+ (bounds 600.00 580.00)
+ (drawsContent 1)
+ (backingStoreAttached 1)
+ (children 1
+ (GraphicsLayer
+ (offsetFromRenderer width=1 height=1)
+ (position 1.00 1.00)
+ (bounds 583.00 578.00)
+ (backingStoreAttached 1)
+ (childrenTransform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [-300.00 -290.00 1.00 -1.00] [0.00 0.00 0.00 1.00])
+ (children 1
+ (GraphicsLayer
+ (position 0.00 -400.00)
+ (anchor 0.00 0.00)
+ (bounds 583.00 12800.00)
+ (usingTiledLayer 1)
+ (preserves3D 1)
+ (drawsContent 1)
+ (backingStoreAttached 1)
+ (children 2
+ (GraphicsLayer
+ (position 20.00 0.00)
+ (anchor 0.50 0.50)
+ (bounds 467.00 1300.00)
+ (backingStoreAttached 1)
+ (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 -220.00 -2.00 1.00])
+ )
+ (GraphicsLayer
+ (position 0.00 200.00)
+ (bounds 583.00 600.00)
+ (contentsOpaque 1)
+ (drawsContent 1)
+ (backingStoreAttached 1)
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+)
+
Added: trunk/LayoutTests/compositing/tiling/coverage-adjustment-secondary-quad-mapping.html (0 => 260371)
--- trunk/LayoutTests/compositing/tiling/coverage-adjustment-secondary-quad-mapping.html (rev 0)
+++ trunk/LayoutTests/compositing/tiling/coverage-adjustment-secondary-quad-mapping.html 2020-04-20 17:14:51 UTC (rev 260371)
@@ -0,0 +1,92 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <style>
+ * {
+ box-sizing: border-box;
+ }
+
+ body {
+ transform: translateZ(0px);
+ }
+
+ .scroller {
+ position: relative;
+ margin: 20px;
+ width: 600px;
+ height: 580px;
+ overflow-x: hidden;
+ overflow-y: auto;
+ perspective-origin: right bottom;
+ perspective: 1px;
+ border: 1px solid black;
+ }
+
+ .preserve3d {
+ transform-origin: top left;
+ transform-style: preserve-3d;
+ }
+
+ .box {
+ height: 12000px;
+ background-color: rgba(0, 0, 0, 0.2);
+ }
+
+ .parallax {
+ background-size: cover;
+ box-sizing: border-box;
+ width: 80%;
+ margin-left: 20px;
+ height: 1300px;;
+ /* Since the parallax elements still consume space, we set the margin to undo
+ the height of this parallax element making it essentially consume 0 space.
+ */
+ margin-bottom: -1300px;
+ }
+
+ .tester {
+ position: relative;
+ z-index: 1;
+ background-color: green;
+ margin-top: 200px;
+ height: 600px;
+ width: 100%;
+ will-change: transform;
+ }
+
+ .filler {
+ background-color: silver;
+ }
+ </style>
+ <script>
+ if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+ }
+
+ window.addEventListener('load', () => {
+ setTimeout(() => {
+ let scroller = document.querySelector('.scroller');
+ scroller.scrollTop = 400;
+
+ if (window.internals)
+ document.getElementById('layers').innerText = window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_BACKING_STORE_ATTACHED);
+
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }, 0);
+ }, false);
+ </script>
+</head>
+<body>
+ <div class="scroller">
+ <div class="preserve3d">
+ <div class="parallax" style="transform: translate3d(0px, -220px, -2px);"></div>
+ <div class="box tester"> </div>
+ <div class="box filler"></div>
+ </div>
+ </div>
+<pre id="layers"></pre>
+</body>
+</html>
Added: trunk/LayoutTests/platform/ios-wk2/compositing/tiling/coverage-adjustment-secondary-quad-mapping-expected.txt (0 => 260371)
--- trunk/LayoutTests/platform/ios-wk2/compositing/tiling/coverage-adjustment-secondary-quad-mapping-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/ios-wk2/compositing/tiling/coverage-adjustment-secondary-quad-mapping-expected.txt 2020-04-20 17:14:51 UTC (rev 260371)
@@ -0,0 +1,65 @@
+
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 800.00 620.00)
+ (backingStoreAttached 1)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 620.00)
+ (contentsOpaque 1)
+ (backingStoreAttached 1)
+ (children 1
+ (GraphicsLayer
+ (position 8.00 20.00)
+ (bounds 784.00 580.00)
+ (backingStoreAttached 1)
+ (children 1
+ (GraphicsLayer
+ (position 20.00 0.00)
+ (bounds 600.00 580.00)
+ (drawsContent 1)
+ (backingStoreAttached 1)
+ (children 1
+ (GraphicsLayer
+ (offsetFromRenderer width=1 height=1)
+ (position 1.00 1.00)
+ (bounds 583.00 578.00)
+ (backingStoreAttached 1)
+ (childrenTransform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [-300.00 -290.00 1.00 -1.00] [0.00 0.00 0.00 1.00])
+ (children 1
+ (GraphicsLayer
+ (position 0.00 -400.00)
+ (anchor 0.00 0.00)
+ (bounds 583.00 12800.00)
+ (usingTiledLayer 1)
+ (preserves3D 1)
+ (drawsContent 1)
+ (backingStoreAttached 1)
+ (children 2
+ (GraphicsLayer
+ (position 20.00 0.00)
+ (anchor 0.50 0.50)
+ (bounds 466.50 1300.00)
+ (backingStoreAttached 1)
+ (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 -220.00 -2.00 1.00])
+ )
+ (GraphicsLayer
+ (position 0.00 200.00)
+ (bounds 583.00 600.00)
+ (contentsOpaque 1)
+ (drawsContent 1)
+ (backingStoreAttached 1)
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+)
+
Added: trunk/LayoutTests/platform/mac-wk1/compositing/tiling/coverage-adjustment-secondary-quad-mapping-expected.txt (0 => 260371)
--- trunk/LayoutTests/platform/mac-wk1/compositing/tiling/coverage-adjustment-secondary-quad-mapping-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac-wk1/compositing/tiling/coverage-adjustment-secondary-quad-mapping-expected.txt 2020-04-20 17:14:51 UTC (rev 260371)
@@ -0,0 +1,66 @@
+
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 785.00 620.00)
+ (backingStoreAttached 1)
+ (children 1
+ (GraphicsLayer
+ (bounds 785.00 620.00)
+ (contentsOpaque 1)
+ (backingStoreAttached 1)
+ (children 1
+ (GraphicsLayer
+ (position 8.00 20.00)
+ (anchor 0.50 0.50)
+ (bounds 769.00 580.00)
+ (backingStoreAttached 1)
+ (children 1
+ (GraphicsLayer
+ (position 20.00 0.00)
+ (bounds 600.00 580.00)
+ (drawsContent 1)
+ (backingStoreAttached 1)
+ (children 1
+ (GraphicsLayer
+ (offsetFromRenderer width=1 height=1)
+ (position 1.00 1.00)
+ (bounds 583.00 578.00)
+ (backingStoreAttached 1)
+ (childrenTransform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [-300.00 -290.00 1.00 -1.00] [0.00 0.00 0.00 1.00])
+ (children 1
+ (GraphicsLayer
+ (position 0.00 -400.00)
+ (anchor 0.00 0.00)
+ (bounds 583.00 12800.00)
+ (usingTiledLayer 1)
+ (preserves3D 1)
+ (drawsContent 1)
+ (backingStoreAttached 1)
+ (children 2
+ (GraphicsLayer
+ (position 20.00 0.00)
+ (anchor 0.50 0.50)
+ (bounds 467.00 1300.00)
+ (backingStoreAttached 1)
+ (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 -220.00 -2.00 1.00])
+ )
+ (GraphicsLayer
+ (position 0.00 200.00)
+ (bounds 583.00 600.00)
+ (contentsOpaque 1)
+ (drawsContent 1)
+ (backingStoreAttached 1)
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+)
+
Modified: trunk/Source/WebCore/ChangeLog (260370 => 260371)
--- trunk/Source/WebCore/ChangeLog 2020-04-20 16:54:15 UTC (rev 260370)
+++ trunk/Source/WebCore/ChangeLog 2020-04-20 17:14:51 UTC (rev 260371)
@@ -1,3 +1,26 @@
+2020-04-19 Simon Fraser <simon.fra...@apple.com>
+
+ Content disappears on CSS parallax example
+ https://bugs.webkit.org/show_bug.cgi?id=210732
+ <rdar://problem/61997636>
+
+ Reviewed by Darin Adler.
+
+ If scrolling affects the computation of coverage rect of a TiledBacking, we plumb
+ that expanded coverage back into TransformState which is maintained during GraphicsLayer flushing,
+ and it's used to compute coverage rect for descendants.
+
+ It's passed into TransformState::setLastPlanarSecondaryQuad(), which has to map it back into
+ the coordinate system of the last flattening ancestor. However, TransformState::mapQuad()
+ had a missing return and the quad mapping was wrong. The new code is now the same as
+ TransformState::mappedPoint() (you can see where the copy/paste error came from).
+
+ Test: compositing/tiling/coverage-adjustment-secondary-quad-mapping.html
+
+ * platform/graphics/transforms/TransformState.cpp:
+ (WebCore::TransformState::mapQuad const):
+ (WebCore::TransformState::flattenWithTransform):
+
2020-04-20 Zalan Bujtas <za...@apple.com>
[LFC][TFC] Add support for border-collapse: collapse.
Modified: trunk/Source/WebCore/platform/graphics/transforms/TransformState.cpp (260370 => 260371)
--- trunk/Source/WebCore/platform/graphics/transforms/TransformState.cpp 2020-04-20 16:54:15 UTC (rev 260370)
+++ trunk/Source/WebCore/platform/graphics/transforms/TransformState.cpp 2020-04-20 17:14:51 UTC (rev 260371)
@@ -215,8 +215,10 @@
if (!m_accumulatedTransform)
return;
- if (direction == ApplyTransformDirection)
+ if (direction == ApplyTransformDirection) {
quad = m_accumulatedTransform->mapQuad(quad);
+ return;
+ }
quad = m_accumulatedTransform->inverse().valueOr(TransformationMatrix()).projectQuad(quad, wasClamped);
}
@@ -231,7 +233,6 @@
if (m_lastPlanarSecondaryQuad)
m_lastPlanarSecondaryQuad = t.mapQuad(*m_lastPlanarSecondaryQuad);
}
-
} else {
TransformationMatrix inverseTransform = t.inverse().valueOr(TransformationMatrix());
if (m_mapPoint)