Diff
Modified: trunk/LayoutTests/ChangeLog (204551 => 204552)
--- trunk/LayoutTests/ChangeLog 2016-08-17 03:17:04 UTC (rev 204551)
+++ trunk/LayoutTests/ChangeLog 2016-08-17 03:18:21 UTC (rev 204552)
@@ -1,3 +1,20 @@
+2016-08-16 Zalan Bujtas <[email protected]>
+
+ Subpixel rendering: Cleanup RenderLayerBacking::updateGeometry.
+ https://bugs.webkit.org/show_bug.cgi?id=156860
+ <rdar://problem/25432352>
+
+ Reviewed by Simon Fraser.
+
+ * compositing/hidpi-ancestor-subpixel-clipping-expected.html: Added.
+ * compositing/hidpi-ancestor-subpixel-clipping.html: Added.
+ * compositing/hidpi-sibling-composited-content-offset-expected.html: Added.
+ * compositing/hidpi-sibling-composited-content-offset.html: Added.
+ * compositing/hidpi-subpixel-transform-origin-expected.html: Added.
+ * compositing/hidpi-subpixel-transform-origin.html: Added.
+ * fast/scrolling/ios/subpixel-overflow-scrolling-with-ancestor-expected.txt: Added.
+ * fast/scrolling/ios/subpixel-overflow-scrolling-with-ancestor.html: Added.
+
2016-08-16 Commit Queue <[email protected]>
Unreviewed, rolling out r204540, r204545, and r204547.
Added: trunk/LayoutTests/compositing/hidpi-ancestor-subpixel-clipping-expected.html (0 => 204552)
--- trunk/LayoutTests/compositing/hidpi-ancestor-subpixel-clipping-expected.html (rev 0)
+++ trunk/LayoutTests/compositing/hidpi-ancestor-subpixel-clipping-expected.html 2016-08-17 03:18:21 UTC (rev 204552)
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests ancestor clipping with subpixel positioning.</title>
+<style>
+.container {
+ position: absolute;
+ background-color: green;
+ width: 15px;
+ height: 15px;
+}
+
+.clippingAncestor {
+ width: 10px;
+ height: 10px;
+ overflow: hidden;
+ border-style: solid;
+ border-color: red;
+ }
+
+.jiggle {
+ height: 5px;
+ width: 5px;
+ position: relative;
+ background-color: blue;
+}
+</style>
+</head>
+<body>
+<script>
+var subpixelForContainer = 0;
+for (var i = 0; i < 20; ++i) {
+ var borderWidth = 2;
+ var subpixelForJiggle = -2;
+ for (var j = 0; j < 20; ++j) {
+ var container = document.createElement("div");
+ container.className = "container";
+ container.style.left = i * 20 + subpixelForContainer + "px";
+ container.style.top = j * 20 + subpixelForContainer + "px";
+ document.body.appendChild(container);
+ subpixelForContainer += 0.05;
+
+ var clippingAncestor = document.createElement("div");
+ clippingAncestor.className = "clippingAncestor";
+ clippingAncestor.style.borderWidth = borderWidth + "px";
+ container.appendChild(clippingAncestor);
+ borderWidth += 0.1;
+
+ var jiggle = document.createElement("div");
+ jiggle.className = "jiggle";
+ jiggle.style.top = subpixelForJiggle + "px";
+ jiggle.style.left = subpixelForJiggle + "px";
+ subpixelForJiggle += 0.1;
+ clippingAncestor.appendChild(jiggle);
+ }
+}
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/compositing/hidpi-ancestor-subpixel-clipping.html (0 => 204552)
--- trunk/LayoutTests/compositing/hidpi-ancestor-subpixel-clipping.html (rev 0)
+++ trunk/LayoutTests/compositing/hidpi-ancestor-subpixel-clipping.html 2016-08-17 03:18:21 UTC (rev 204552)
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests ancestor clipping with subpixel positioning.</title>
+<style>
+.container {
+ position: absolute;
+ background-color: green;
+ width: 15px;
+ height: 15px;
+ transform: translateZ(0);
+}
+
+.clippingAncestor {
+ width: 10px;
+ height: 10px;
+ overflow: hidden;
+ border-style: solid;
+ border-color: red;
+ }
+
+.jiggle {
+ height: 5px;
+ width: 5px;
+ position: relative;
+ background-color: blue;
+ transform: translateZ(0);
+}
+</style>
+</head>
+<body>
+<script>
+var subpixelForContainer = 0;
+for (var i = 0; i < 20; ++i) {
+ var borderWidth = 2;
+ var subpixelForJiggle = -2;
+ for (var j = 0; j < 20; ++j) {
+ var container = document.createElement("div");
+ container.className = "container";
+ container.style.left = i * 20 + subpixelForContainer + "px";
+ container.style.top = j * 20 + subpixelForContainer + "px";
+ document.body.appendChild(container);
+ subpixelForContainer += 0.05;
+
+ var clippingAncestor = document.createElement("div");
+ clippingAncestor.className = "clippingAncestor";
+ clippingAncestor.style.borderWidth = borderWidth + "px";
+ container.appendChild(clippingAncestor);
+ borderWidth += 0.1;
+
+ var jiggle = document.createElement("div");
+ jiggle.className = "jiggle";
+ jiggle.style.top = subpixelForJiggle + "px";
+ jiggle.style.left = subpixelForJiggle + "px";
+ subpixelForJiggle += 0.1;
+ clippingAncestor.appendChild(jiggle);
+ }
+}
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/compositing/hidpi-sibling-composited-content-offset-expected.html (0 => 204552)
--- trunk/LayoutTests/compositing/hidpi-sibling-composited-content-offset-expected.html (rev 0)
+++ trunk/LayoutTests/compositing/hidpi-sibling-composited-content-offset-expected.html 2016-08-17 03:18:21 UTC (rev 204552)
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests sibling composited content with subpixel positioning.</title>
+<style>
+.container {
+ position: absolute;
+ background-color: green;
+ transform: translateZ(0);
+ width: 15px;
+ height: 15px;
+}
+
+.offset {
+ background-color: blue;
+ width: 5px;
+ height: 5px;
+ position: relative;
+ }
+
+.jiggle {
+ height: 5px;
+ width: 5px;
+ background-color: red;
+}
+</style>
+</head>
+<body>
+<script>
+var subpixelForContainer = 0;
+for (var i = 0; i < 20; ++i) {
+ var subpixelForChild = -2;
+ for (var j = 0; j < 20; ++j) {
+ var container = document.createElement("div");
+ container.className = "container";
+ container.style.left = i * 20 + subpixelForContainer + "px";
+ container.style.top = j * 20 + subpixelForContainer + "px";
+ document.body.appendChild(container);
+ subpixelForContainer += 0.05;
+
+ var offset = document.createElement("div");
+ offset.className = "offset";
+ offset.style.left = subpixelForChild + "px";
+ container.appendChild(offset);
+ subpixelForChild += 0.05;
+
+ var jiggle = document.createElement("div");
+ jiggle.className = "jiggle";
+ container.appendChild(jiggle);
+ }
+}
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/compositing/hidpi-sibling-composited-content-offset.html (0 => 204552)
--- trunk/LayoutTests/compositing/hidpi-sibling-composited-content-offset.html (rev 0)
+++ trunk/LayoutTests/compositing/hidpi-sibling-composited-content-offset.html 2016-08-17 03:18:21 UTC (rev 204552)
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests sibling composited content with subpixel positioning.</title>
+<style>
+.container {
+ position: absolute;
+ background-color: green;
+ transform: translateZ(0);
+ width: 15px;
+ height: 15px;
+}
+
+.offset {
+ background-color: blue;
+ width: 5px;
+ height: 5px;
+ position: relative;
+ }
+
+.jiggle {
+ height: 5px;
+ width: 5px;
+ background-color: red;
+ transform: translateZ(0);
+}
+</style>
+</head>
+<body>
+<script>
+var subpixelForContainer = 0;
+for (var i = 0; i < 20; ++i) {
+ var subpixelForChild = -2;
+ for (var j = 0; j < 20; ++j) {
+ var container = document.createElement("div");
+ container.className = "container";
+ container.style.left = i * 20 + subpixelForContainer + "px";
+ container.style.top = j * 20 + subpixelForContainer + "px";
+ document.body.appendChild(container);
+ subpixelForContainer += 0.05;
+
+ var offset = document.createElement("div");
+ offset.className = "offset";
+ offset.style.left = subpixelForChild + "px";
+ container.appendChild(offset);
+ subpixelForChild += 0.05;
+
+ var jiggle = document.createElement("div");
+ jiggle.className = "jiggle";
+ container.appendChild(jiggle);
+ }
+}
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/compositing/hidpi-subpixel-transform-origin-expected.html (0 => 204552)
--- trunk/LayoutTests/compositing/hidpi-subpixel-transform-origin-expected.html (rev 0)
+++ trunk/LayoutTests/compositing/hidpi-subpixel-transform-origin-expected.html 2016-08-17 03:18:21 UTC (rev 204552)
@@ -0,0 +1,117 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests transform origin with subpixel values.</title>
+<style>
+.container {
+ position: absolute;
+ background-color: green;
+ width: 15px;
+ height: 15px;
+ transform: rotate(90deg) translateZ(0);
+}
+</style>
+</head>
+<body>
+<div class="container" style="left: 30px; top: 30px; transform-origin: 0px 0px;"></div>
+<div class="container" style="left: 30px; top: 50px; transform-origin: 0px 0px;"></div>
+<div class="container" style="left: 30px; top: 70px; transform-origin: 0px 1px;"></div>
+<div class="container" style="left: 30px; top: 90px; transform-origin: 0px 2px;"></div>
+<div class="container" style="left: 30px; top: 110px; transform-origin: 0px 3px;"></div>
+<div class="container" style="left: 30.5px; top: 130.5px; transform-origin: 0px 5px;"></div>
+<div class="container" style="left: 30.5px; top: 150.5px; transform-origin: 0px 7px;"></div>
+<div class="container" style="left: 30.5px; top: 170.5px; transform-origin: 0px 10px;"></div>
+<div class="container" style="left: 30.5px; top: 190.5px; transform-origin: 0px 13px;"></div>
+<div class="container" style="left: 30.5px; top: 210.5px; transform-origin: 0px 16px;"></div>
+<div class="container" style="left: 50.5px; top: 30.5px; transform-origin: 0px 0px;"></div>
+<div class="container" style="left: 50.5px; top: 50.5px; transform-origin: 0px 0px;"></div>
+<div class="container" style="left: 50.5px; top: 70.5px; transform-origin: 0.5px 1px;"></div>
+<div class="container" style="left: 50.5px; top: 90.5px; transform-origin: 0.5px 2px;"></div>
+<div class="container" style="left: 50.5px; top: 110.5px; transform-origin: 1px 3px;"></div>
+<div class="container" style="left: 51px; top: 131px; transform-origin: 1px 5px;"></div>
+<div class="container" style="left: 51px; top: 151px; transform-origin: 1px 7px;"></div>
+<div class="container" style="left: 51px; top: 171px; transform-origin: 1.5px 10px;"></div>
+<div class="container" style="left: 51px; top: 191px; transform-origin: 1.5px 13px;"></div>
+<div class="container" style="left: 51px; top: 211px; transform-origin: 2px 16px;"></div>
+<div class="container" style="left: 71px; top: 31px; transform-origin: 0px 0px;"></div>
+<div class="container" style="left: 71px; top: 51px; transform-origin: 0.5px 0px;"></div>
+<div class="container" style="left: 71px; top: 71px; transform-origin: 1px 1px;"></div>
+<div class="container" style="left: 71px; top: 91px; transform-origin: 1px 2px;"></div>
+<div class="container" style="left: 71px; top: 111px; transform-origin: 1.5px 3px;"></div>
+<div class="container" style="left: 71.5px; top: 131.5px; transform-origin: 2px 5px;"></div>
+<div class="container" style="left: 71.5px; top: 151.5px; transform-origin: 2.5px 7px;"></div>
+<div class="container" style="left: 71.5px; top: 171.5px; transform-origin: 3px 10px;"></div>
+<div class="container" style="left: 71.5px; top: 191.5px; transform-origin: 3px 13px;"></div>
+<div class="container" style="left: 71.5px; top: 211.5px; transform-origin: 3.5px 16px;"></div>
+<div class="container" style="left: 91.5px; top: 31.5px; transform-origin: 0px 0px;"></div>
+<div class="container" style="left: 91.5px; top: 51.5px; transform-origin: 0.5px 0.2px;"></div>
+<div class="container" style="left: 91.5px; top: 71.5px; transform-origin: 1px 1px;"></div>
+<div class="container" style="left: 91.5px; top: 91.5px; transform-origin: 2px 2px;"></div>
+<div class="container" style="left: 91.5px; top: 111.5px; transform-origin: 2.5px 3px;"></div>
+<div class="container" style="left: 92px; top: 132px; transform-origin: 3px 5px;"></div>
+<div class="container" style="left: 92px; top: 152px; transform-origin: 3.5px 7px;"></div>
+<div class="container" style="left: 92px; top: 172px; transform-origin: 4px 10px;"></div>
+<div class="container" style="left: 92px; top: 192px; transform-origin: 5px 13px;"></div>
+<div class="container" style="left: 92px; top: 212px; transform-origin: 5.5px 16px;"></div>
+<div class="container" style="left: 112px; top: 32px; transform-origin: 0px 0px;"></div>
+<div class="container" style="left: 112px; top: 52px; transform-origin: 1px 0px;"></div>
+<div class="container" style="left: 112px; top: 72px; transform-origin: 1.5px 1px;"></div>
+<div class="container" style="left: 112px; top: 92px; transform-origin: 2.5px 2px;"></div>
+<div class="container" style="left: 112px; top: 112px; transform-origin: 3px 3px;"></div>
+<div class="container" style="left: 112.5px; top: 132.5px; transform-origin: 4px 5px;"></div>
+<div class="container" style="left: 112.5px; top: 152.5px; transform-origin: 5px 7px;"></div>
+<div class="container" style="left: 112.5px; top: 172.5px; transform-origin: 5.5px 10px;"></div>
+<div class="container" style="left: 112.5px; top: 192.5px; transform-origin: 6.5px 13px;"></div>
+<div class="container" style="left: 112.5px; top: 212.5px; transform-origin: 7px 16px;"></div>
+<div class="container" style="left: 132.5px; top: 32.5px; transform-origin: 0px 0px;"></div>
+<div class="container" style="left: 132.5px; top: 52.5px; transform-origin: 1px 0px;"></div>
+<div class="container" style="left: 132.5px; top: 72.5px; transform-origin: 2px 1px;"></div>
+<div class="container" style="left: 132.5px; top: 92.5px; transform-origin: 3px 2px;"></div>
+<div class="container" style="left: 132.5px; top: 112.5px; transform-origin: 4px 3px;"></div>
+<div class="container" style="left: 133px; top: 133px; transform-origin: 5px 5px;"></div>
+<div class="container" style="left: 133px; top: 153px; transform-origin: 6px 7px;"></div>
+<div class="container" style="left: 133px; top: 173px; transform-origin: 7px 10px;"></div>
+<div class="container" style="left: 133px; top: 193px; transform-origin: 8px 13px;"></div>
+<div class="container" style="left: 133px; top: 213px; transform-origin: 9px 16px;"></div>
+<div class="container" style="left: 153px; top: 33px; transform-origin: 0px 0px;"></div>
+<div class="container" style="left: 153px; top: 53px; transform-origin: 1px 0.2px;"></div>
+<div class="container" style="left: 153px; top: 73px; transform-origin: 2.5px 1px;"></div>
+<div class="container" style="left: 153px; top: 93px; transform-origin: 3.5px 2px;"></div>
+<div class="container" style="left: 153px; top: 113px; transform-origin: 5px 3px;"></div>
+<div class="container" style="left: 153.5px; top: 133.5px; transform-origin: 6px 5px;"></div>
+<div class="container" style="left: 153.5px; top: 153.5px; transform-origin: 7px 7px;"></div>
+<div class="container" style="left: 153.5px; top: 173.5px; transform-origin: 8.5px 10px;"></div>
+<div class="container" style="left: 153.5px; top: 193.5px; transform-origin: 9.5px 13px;"></div>
+<div class="container" style="left: 153.5px; top: 213.5px; transform-origin: 11px 16px;"></div>
+<div class="container" style="left: 173.5px; top: 33.5px; transform-origin: 0px 0px;"></div>
+<div class="container" style="left: 173.5px; top: 53.5px; transform-origin: 1.5px 0.2px;"></div>
+<div class="container" style="left: 173.5px; top: 73.5px; transform-origin: 3px 1px;"></div>
+<div class="container" style="left: 173.5px; top: 93.5px; transform-origin: 4px 2px;"></div>
+<div class="container" style="left: 173.5px; top: 113.5px; transform-origin: 5.5px 3px;"></div>
+<div class="container" style="left: 174px; top: 134px; transform-origin: 7px 5px;"></div>
+<div class="container" style="left: 174px; top: 154px; transform-origin: 8.5px 7px;"></div>
+<div class="container" style="left: 174px; top: 174px; transform-origin: 10px 10px;"></div>
+<div class="container" style="left: 174px; top: 194px; transform-origin: 11px 13px;"></div>
+<div class="container" style="left: 174px; top: 214px; transform-origin: 12.5px 16px;"></div>
+<div class="container" style="left: 194px; top: 34px; transform-origin: 0px 0px;"></div>
+<div class="container" style="left: 194px; top: 54px; transform-origin: 1.5px 0px;"></div>
+<div class="container" style="left: 194px; top: 74px; transform-origin: 3px 1px;"></div>
+<div class="container" style="left: 194px; top: 94px; transform-origin: 5px 2px;"></div>
+<div class="container" style="left: 194px; top: 114px; transform-origin: 6.5px 3px;"></div>
+<div class="container" style="left: 194.5px; top: 134.5px; transform-origin: 8px 5px;"></div>
+<div class="container" style="left: 194.5px; top: 154.5px; transform-origin: 9.5px 7px;"></div>
+<div class="container" style="left: 194.5px; top: 174.5px; transform-origin: 11px 10px;"></div>
+<div class="container" style="left: 194.5px; top: 194.5px; transform-origin: 13px 13px;"></div>
+<div class="container" style="left: 194.5px; top: 214.5px; transform-origin: 14.5px 16px;"></div>
+<div class="container" style="left: 214.5px; top: 34.5px; transform-origin: 0px 0px;"></div>
+<div class="container" style="left: 214.5px; top: 54.5px; transform-origin: 2px 0px;"></div>
+<div class="container" style="left: 214.5px; top: 74.5px; transform-origin: 3.5px 1px;"></div>
+<div class="container" style="left: 214.5px; top: 94.5px; transform-origin: 5.5px 2px;"></div>
+<div class="container" style="left: 214.5px; top: 114.5px; transform-origin: 7px 3px;"></div>
+<div class="container" style="left: 215px; top: 135px; transform-origin: 9px 5px;"></div>
+<div class="container" style="left: 215px; top: 155px; transform-origin: 11px 7px;"></div>
+<div class="container" style="left: 215px; top: 175px; transform-origin: 12.5px 10px;"></div>
+<div class="container" style="left: 215px; top: 195px; transform-origin: 14.5px 13px;"></div>
+<div class="container" style="left: 215px; top: 215px; transform-origin: 16px 16px;"></div>
+
+</body></html>
\ No newline at end of file
Added: trunk/LayoutTests/compositing/hidpi-subpixel-transform-origin.html (0 => 204552)
--- trunk/LayoutTests/compositing/hidpi-subpixel-transform-origin.html (rev 0)
+++ trunk/LayoutTests/compositing/hidpi-subpixel-transform-origin.html 2016-08-17 03:18:21 UTC (rev 204552)
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests transform origin with subpixel values.</title>
+<style>
+.container {
+ position: absolute;
+ background-color: green;
+ width: 15px;
+ height: 15px;
+ transform: rotate(90deg) translateZ(0);
+}
+</style>
+</head>
+<body>
+<script>
+var subpixelForContainer = 30;
+for (var i = 0; i < 10; ++i) {
+ var subpixelForOrigin = 0;
+ for (var j = 0; j < 10; ++j) {
+ var container = document.createElement("div");
+ container.className = "container";
+ container.style.left = i * 20 + subpixelForContainer + "px";
+ container.style.top = j * 20 + subpixelForContainer + "px";
+ container.style.transformOrigin = i * subpixelForOrigin +"px " + j * subpixelForOrigin + "px";
+ document.body.appendChild(container);
+ subpixelForContainer += 0.05;
+ subpixelForOrigin += 0.2;
+ }
+}
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/fast/scrolling/ios/subpixel-overflow-scrolling-with-ancestor-expected.txt (0 => 204552)
--- trunk/LayoutTests/fast/scrolling/ios/subpixel-overflow-scrolling-with-ancestor-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/scrolling/ios/subpixel-overflow-scrolling-with-ancestor-expected.txt 2016-08-17 03:18:21 UTC (rev 204552)
@@ -0,0 +1,41 @@
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 320.00 568.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 320.00 568.00)
+ (contentsOpaque 1)
+ (children 1
+ (GraphicsLayer
+ (position 8.00 8.00)
+ (bounds 300.00 400.00)
+ (children 1
+ (GraphicsLayer
+ (bounds origin 0.00 30.00)
+ (bounds 300.00 400.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 300.00 900.00)
+ (drawsContent 1)
+ (children 1
+ (GraphicsLayer
+ (position 20.00 50.00)
+ (bounds 260.00 800.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 260.00 800.00)
+ (contentsOpaque 1)
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+)
+
Added: trunk/LayoutTests/fast/scrolling/ios/subpixel-overflow-scrolling-with-ancestor.html (0 => 204552)
--- trunk/LayoutTests/fast/scrolling/ios/subpixel-overflow-scrolling-with-ancestor.html (rev 0)
+++ trunk/LayoutTests/fast/scrolling/ios/subpixel-overflow-scrolling-with-ancestor.html 2016-08-17 03:18:21 UTC (rev 204552)
@@ -0,0 +1,54 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<html>
+<head>
+ <meta name="viewport" content="width=device-width">
+ <script>
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ function doScroll()
+ {
+ var overflow = document.getElementById('scroller');
+ overflow.scrollTop = 30.5;
+
+ if (window.testRunner)
+ document.getElementById('layers').innerHTML = window.internals.layerTreeAsText(document);
+ }
+
+ window.addEventListener('load', doScroll, false);
+ </script>
+ <style>
+ #scroller {
+ overflow: scroll;
+ -webkit-overflow-scrolling: touch;
+ width: 300px;
+ height: 400px;
+ }
+
+ .column {
+ overflow: hidden;
+ margin: 50px 20px;
+ width: 260px;
+ height: 800px;
+ background-color: red;
+ }
+
+ .contents {
+ -webkit-transform: translateZ(0);
+ width: 100%;
+ height: 100%;
+ background: green;
+ }
+ </style>
+</head>
+<body>
+
+ <div id="scroller">
+ <div class="column">
+ <div class="contents"></div>
+ </div>
+ </div>
+ <pre id="layers">Layer tree goes here in DRT.</pre>
+
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (204551 => 204552)
--- trunk/Source/WebCore/ChangeLog 2016-08-17 03:17:04 UTC (rev 204551)
+++ trunk/Source/WebCore/ChangeLog 2016-08-17 03:18:21 UTC (rev 204552)
@@ -1,3 +1,58 @@
+2016-08-16 Zalan Bujtas <[email protected]>
+
+ Subpixel rendering: Cleanup RenderLayerBacking::updateGeometry.
+ https://bugs.webkit.org/show_bug.cgi?id=156860
+ <rdar://problem/25432352>
+
+ Reviewed by Simon Fraser.
+
+ This patch cleans up the subpixel adjustment computation for the graphics layers
+ in RenderLayerBacking::updateGeometry.
+ It also fixes subpixel jiggling with clipping layers (both ancestor and child containment layers).
+
+ Tests: compositing/hidpi-ancestor-subpixel-clipping.html
+ compositing/hidpi-sibling-composited-content-offset.html
+ compositing/hidpi-subpixel-transform-origin.html
+ fast/scrolling/ios/subpixel-overflow-scrolling-with-ancestor.html
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::beginTransparencyLayers):
+ (WebCore::RenderLayer::paint):
+ (WebCore::RenderLayer::clipToRect):
+ (WebCore::RenderLayer::setupClipPath):
+ (WebCore::RenderLayer::paintLayerByApplyingTransform):
+ (WebCore::RenderLayer::paintBackgroundForFragments):
+ (WebCore::RenderLayer::paintForegroundForFragmentsWithPhase):
+ (WebCore::RenderLayer::paintOutlineForFragments):
+ (WebCore::RenderLayer::paintMaskForFragments):
+ (WebCore::RenderLayer::paintChildClippingMaskForFragments):
+ (WebCore::RenderLayer::paintOverflowControlsForFragments):
+ (WebCore::RenderLayer::calculateClipRects):
+ * rendering/RenderLayer.h:
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::subpixelOffsetFromRendererChanged):
+ (WebCore::subpixelForLayerPainting):
+ (WebCore::computeOffsetFromRenderer):
+ (WebCore::snappedGraphicsLayerRect):
+ (WebCore::computeOffsetFromAncestorGraphicsLayer):
+ (WebCore::ComputedOffsets::ComputedOffsets): This is a helper class to hold offset values.
+ (WebCore::ComputedOffsets::fromAncestorGraphicsLayer):
+ (WebCore::ComputedOffsets::fromParentGraphicsLayer):
+ (WebCore::ComputedOffsets::fromPrimaryGraphicsLayer):
+ (WebCore::RenderLayerBacking::computePrimaryGraphicsLayerRect):
+ (WebCore::RenderLayerBacking::computeParentGraphicsLayerRect):
+ (WebCore::RenderLayerBacking::updateGeometry):
+ (WebCore::RenderLayerBacking::updateMaskingLayerGeometry):
+ (WebCore::RenderLayerBacking::contentOffsetInCompostingLayer):
+ (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):
+ (WebCore::RenderLayerBacking::paintIntoLayer):
+ (WebCore::RenderLayerBacking::paintContents):
+ (WebCore::devicePixelFractionGapFromRendererChanged): Deleted.
+ (WebCore::pixelFractionForLayerPainting): Deleted.
+ (WebCore::calculateDevicePixelOffsetFromRenderer): Deleted.
+ (WebCore::RenderLayerBacking::adjustAncestorCompositingBoundsForFlowThread): Deleted.
+ * rendering/RenderLayerBacking.h:
+
2016-08-16 Commit Queue <[email protected]>
Unreviewed, rolling out r204540, r204545, and r204547.
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (204551 => 204552)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2016-08-17 03:17:04 UTC (rev 204551)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2016-08-17 03:18:21 UTC (rev 204552)
@@ -1811,7 +1811,7 @@
m_usedTransparency = true;
context.save();
LayoutRect adjustedClipRect = paintingExtent(*this, paintingInfo.rootLayer, dirtyRect, paintingInfo.paintBehavior);
- adjustedClipRect.move(paintingInfo.subpixelAccumulation);
+ adjustedClipRect.move(paintingInfo.subpixelOffset);
FloatRect pixelSnappedClipRect = snapRectToDevicePixels(adjustedClipRect, renderer().document().deviceScaleFactor());
context.clip(pixelSnappedClipRect);
@@ -3808,11 +3808,11 @@
return ScrollableArea::scroll(direction, granularity, multiplier);
}
-void RenderLayer::paint(GraphicsContext& context, const LayoutRect& damageRect, const LayoutSize& subpixelAccumulation, PaintBehavior paintBehavior, RenderObject* subtreePaintRoot, PaintLayerFlags paintFlags)
+void RenderLayer::paint(GraphicsContext& context, const LayoutRect& damageRect, const LayoutSize& subpixelOffset, PaintBehavior paintBehavior, RenderObject* subtreePaintRoot, PaintLayerFlags paintFlags)
{
OverlapTestRequestMap overlapTestRequests;
- LayerPaintingInfo paintingInfo(this, enclosingIntRect(damageRect), paintBehavior, subpixelAccumulation, subtreePaintRoot, &overlapTestRequests);
+ LayerPaintingInfo paintingInfo(this, enclosingIntRect(damageRect), paintBehavior, subpixelOffset, subtreePaintRoot, &overlapTestRequests);
paintLayer(context, paintingInfo, paintFlags);
for (auto& widget : overlapTestRequests.keys())
@@ -3851,7 +3851,7 @@
if (needsClipping) {
LayoutRect adjustedClipRect = clipRect.rect();
- adjustedClipRect.move(paintingInfo.subpixelAccumulation);
+ adjustedClipRect.move(paintingInfo.subpixelOffset);
context.clip(snapRectToDevicePixels(adjustedClipRect, deviceScaleFactor));
}
@@ -3862,7 +3862,7 @@
for (RenderLayer* layer = rule == IncludeSelfForBorderRadius ? this : parent(); layer; layer = layer->parent()) {
if (layer->renderer().hasOverflowClip() && layer->renderer().style().hasBorderRadius() && inContainingBlockChain(this, layer)) {
LayoutRect adjustedClipRect = LayoutRect(toLayoutPoint(layer->offsetFromAncestor(paintingInfo.rootLayer, AdjustForColumns)), layer->size());
- adjustedClipRect.move(paintingInfo.subpixelAccumulation);
+ adjustedClipRect.move(paintingInfo.subpixelOffset);
FloatRoundedRect roundedRect = layer->renderer().style().getRoundedInnerBorderFor(adjustedClipRect).pixelSnappedRoundedRectForPainting(deviceScaleFactor);
if (roundedRect.intersectionIsRectangular(paintingInfo.paintDirtyRect))
context.clip(snapRectToDevicePixels(intersection(paintingInfo.paintDirtyRect, adjustedClipRect), deviceScaleFactor));
@@ -4134,7 +4134,7 @@
ASSERT(style.clipPath());
if (is<ShapeClipPathOperation>(*style.clipPath()) || (is<BoxClipPathOperation>(*style.clipPath()) && is<RenderBox>(renderer()))) {
WindRule windRule;
- LayoutSize paintingOffsetFromRoot = LayoutSize(snapSizeToDevicePixel(offsetFromRoot + paintingInfo.subpixelAccumulation, LayoutPoint(), renderer().document().deviceScaleFactor()));
+ LayoutSize paintingOffsetFromRoot = LayoutSize(snapSizeToDevicePixel(offsetFromRoot + paintingInfo.subpixelOffset, LayoutPoint(), renderer().document().deviceScaleFactor()));
Path path = computeClipPath(paintingOffsetFromRoot, rootRelativeBounds, windRule);
context.save();
context.clipPath(path, windRule);
@@ -4450,7 +4450,7 @@
offsetFromParent += translationOffset;
TransformationMatrix transform(renderableTransform(paintingInfo.paintBehavior));
// Add the subpixel accumulation to the current layer's offset so that we can always snap the translateRight value to where the renderer() is supposed to be painting.
- LayoutSize offsetForThisLayer = offsetFromParent + paintingInfo.subpixelAccumulation;
+ LayoutSize offsetForThisLayer = offsetFromParent + paintingInfo.subpixelOffset;
FloatSize devicePixelSnappedOffsetForThisLayer = toFloatSize(roundPointToDevicePixels(toLayoutPoint(offsetForThisLayer), deviceScaleFactor));
// We handle accumulated subpixels through nested layers here. Since the context gets translated to device pixels,
// all we need to do is add the delta to the accumulated pixels coming from ancestor layers.
@@ -4461,9 +4461,9 @@
context.concatCTM(transform.toAffineTransform());
// Now do a paint with the root layer shifted to be us.
- LayoutSize adjustedSubpixelAccumulation = offsetForThisLayer - LayoutSize(devicePixelSnappedOffsetForThisLayer);
+ LayoutSize adjustedSubpixelOffset = offsetForThisLayer - LayoutSize(devicePixelSnappedOffsetForThisLayer);
LayerPaintingInfo transformedPaintingInfo(this, LayoutRect(encloseRectToDevicePixels(transform.inverse().valueOr(AffineTransform()).mapRect(paintingInfo.paintDirtyRect), deviceScaleFactor)),
- paintingInfo.paintBehavior, adjustedSubpixelAccumulation, paintingInfo.subtreePaintRoot, paintingInfo.overlapTestRequests);
+ paintingInfo.paintBehavior, adjustedSubpixelOffset, paintingInfo.subtreePaintRoot, paintingInfo.overlapTestRequests);
paintLayerContentsAndReflection(context, transformedPaintingInfo, paintFlags);
context.setCTM(oldTransfrom);
}
@@ -4705,7 +4705,7 @@
// Paint the background.
// FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info.
PaintInfo paintInfo(context, fragment.backgroundRect.rect(), PaintPhaseBlockBackground, paintBehavior, subtreePaintRootForRenderer, nullptr, nullptr, &localPaintingInfo.rootLayer->renderer());
- renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelAccumulation));
+ renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelOffset));
if (localPaintingInfo.clipToDirtyRect)
restoreClip(context, localPaintingInfo, fragment.backgroundRect);
@@ -4772,7 +4772,7 @@
PaintInfo paintInfo(context, fragment.foregroundRect.rect(), phase, paintBehavior, subtreePaintRootForRenderer, nullptr, nullptr, &localPaintingInfo.rootLayer->renderer());
if (phase == PaintPhaseForeground)
paintInfo.overlapTestRequests = localPaintingInfo.overlapTestRequests;
- renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelAccumulation));
+ renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelOffset));
if (shouldClip)
restoreClip(context, localPaintingInfo, fragment.foregroundRect);
@@ -4789,7 +4789,7 @@
// Paint our own outline
PaintInfo paintInfo(context, fragment.backgroundRect.rect(), PaintPhaseSelfOutline, paintBehavior, subtreePaintRootForRenderer, nullptr, nullptr, &localPaintingInfo.rootLayer->renderer());
clipToRect(context, localPaintingInfo, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius);
- renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelAccumulation));
+ renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelOffset));
restoreClip(context, localPaintingInfo, fragment.backgroundRect);
}
}
@@ -4807,7 +4807,7 @@
// Paint the mask.
// FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info.
PaintInfo paintInfo(context, fragment.backgroundRect.rect(), PaintPhaseMask, PaintBehaviorNormal, subtreePaintRootForRenderer, nullptr, nullptr, &localPaintingInfo.rootLayer->renderer());
- renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelAccumulation));
+ renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelOffset));
if (localPaintingInfo.clipToDirtyRect)
restoreClip(context, localPaintingInfo, fragment.backgroundRect);
@@ -4826,7 +4826,7 @@
// Paint the clipped mask.
PaintInfo paintInfo(context, fragment.backgroundRect.rect(), PaintPhaseClippingMask, PaintBehaviorNormal, subtreePaintRootForRenderer, nullptr, nullptr, &localPaintingInfo.rootLayer->renderer());
- renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelAccumulation));
+ renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelOffset));
if (localPaintingInfo.clipToDirtyRect)
restoreClip(context, localPaintingInfo, fragment.foregroundRect);
@@ -4839,7 +4839,7 @@
if (fragment.backgroundRect.isEmpty())
continue;
clipToRect(context, localPaintingInfo, fragment.backgroundRect);
- paintOverflowControls(context, roundedIntPoint(toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelAccumulation)),
+ paintOverflowControls(context, roundedIntPoint(toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelOffset)),
snappedIntRect(fragment.backgroundRect.rect()), true);
restoreClip(context, localPaintingInfo, fragment.backgroundRect);
}
@@ -6981,9 +6981,9 @@
context.save();
context.translate(-adjustedPaintOffset.x(), -adjustedPaintOffset.y());
- LayoutSize subpixelAccumulation = moveOffset - toLayoutSize(LayoutPoint(adjustedPaintOffset));
+ LayoutSize subpixelOffset = moveOffset - toLayoutSize(LayoutPoint(adjustedPaintOffset));
paintDirtyRect.move(moveOffset);
- paint(context, paintDirtyRect, LayoutSize(-subpixelAccumulation.width(), -subpixelAccumulation.height()), paintBehavior, nullptr, paintFlags | PaintLayerTemporaryClipRects);
+ paint(context, paintDirtyRect, LayoutSize(-subpixelOffset.width(), -subpixelOffset.height()), paintBehavior, nullptr, paintFlags | PaintLayerTemporaryClipRects);
region->restoreRegionObjectsOriginalStyle();
context.restore();
}
@@ -7024,7 +7024,7 @@
if (shouldClip)
clipToRect(context, paintingInfo, clipRect);
- flowThreadLayer->paintNamedFlowThreadInsideRegion(context, flowFragment, paintingInfo.paintDirtyRect, fragment.layerBounds.location() + paintingInfo.subpixelAccumulation,
+ flowThreadLayer->paintNamedFlowThreadInsideRegion(context, flowFragment, paintingInfo.paintDirtyRect, fragment.layerBounds.location() + paintingInfo.subpixelOffset,
paintingInfo.paintBehavior, paintFlags);
if (shouldClip)
Modified: trunk/Source/WebCore/rendering/RenderLayer.h (204551 => 204552)
--- trunk/Source/WebCore/rendering/RenderLayer.h 2016-08-17 03:17:04 UTC (rev 204551)
+++ trunk/Source/WebCore/rendering/RenderLayer.h 2016-08-17 03:18:21 UTC (rev 204552)
@@ -466,7 +466,7 @@
// paints the layers that intersect the damage rect from back to
// front. The hitTest method looks for mouse events by walking
// layers that intersect the point from front to back.
- void paint(GraphicsContext&, const LayoutRect& damageRect, const LayoutSize& subpixelAccumulation = LayoutSize(), PaintBehavior = PaintBehaviorNormal,
+ void paint(GraphicsContext&, const LayoutRect& damageRect, const LayoutSize& subpixelOffset = LayoutSize(), PaintBehavior = PaintBehaviorNormal,
RenderObject* subtreePaintRoot = nullptr, PaintLayerFlags = 0);
bool hitTest(const HitTestRequest&, HitTestResult&);
bool hitTest(const HitTestRequest&, const HitTestLocation&, HitTestResult&);
@@ -678,11 +678,11 @@
enum CollectLayersBehavior { StopAtStackingContexts, StopAtStackingContainers };
struct LayerPaintingInfo {
- LayerPaintingInfo(RenderLayer* inRootLayer, const LayoutRect& inDirtyRect, PaintBehavior inPaintBehavior, const LayoutSize& inSubpixelAccumulation, RenderObject* inSubtreePaintRoot = nullptr, OverlapTestRequestMap* inOverlapTestRequests = nullptr)
+ LayerPaintingInfo(RenderLayer* inRootLayer, const LayoutRect& inDirtyRect, PaintBehavior inPaintBehavior, const LayoutSize& inSupixelOffset, RenderObject* inSubtreePaintRoot = nullptr, OverlapTestRequestMap* inOverlapTestRequests = nullptr)
: rootLayer(inRootLayer)
, subtreePaintRoot(inSubtreePaintRoot)
, paintDirtyRect(inDirtyRect)
- , subpixelAccumulation(inSubpixelAccumulation)
+ , subpixelOffset(inSupixelOffset)
, overlapTestRequests(inOverlapTestRequests)
, paintBehavior(inPaintBehavior)
, clipToDirtyRect(true)
@@ -690,7 +690,7 @@
RenderLayer* rootLayer;
RenderObject* subtreePaintRoot; // only paint descendants of this object
LayoutRect paintDirtyRect; // relative to rootLayer;
- LayoutSize subpixelAccumulation;
+ LayoutSize subpixelOffset;
OverlapTestRequestMap* overlapTestRequests; // May be null.
PaintBehavior paintBehavior;
bool clipToDirtyRect;
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (204551 => 204552)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2016-08-17 03:17:04 UTC (rev 204551)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2016-08-17 03:18:21 UTC (rev 204552)
@@ -696,14 +696,14 @@
return result;
}
-static bool devicePixelFractionGapFromRendererChanged(const LayoutSize& previousDevicePixelFractionFromRenderer, const LayoutSize& currentDevicePixelFractionFromRenderer, float deviceScaleFactor)
+static bool subpixelOffsetFromRendererChanged(const LayoutSize& oldSubpixelOffsetFromRenderer, const LayoutSize& newSubpixelOffsetFromRenderer, float deviceScaleFactor)
{
- FloatSize previous = snapSizeToDevicePixel(previousDevicePixelFractionFromRenderer, LayoutPoint(), deviceScaleFactor);
- FloatSize current = snapSizeToDevicePixel(currentDevicePixelFractionFromRenderer, LayoutPoint(), deviceScaleFactor);
+ FloatSize previous = snapSizeToDevicePixel(oldSubpixelOffsetFromRenderer, LayoutPoint(), deviceScaleFactor);
+ FloatSize current = snapSizeToDevicePixel(newSubpixelOffsetFromRenderer, LayoutPoint(), deviceScaleFactor);
return previous != current;
}
-
-static FloatSize pixelFractionForLayerPainting(const LayoutPoint& point, float pixelSnappingFactor)
+
+static FloatSize subpixelForLayerPainting(const LayoutPoint& point, float pixelSnappingFactor)
{
LayoutUnit x = point.x();
LayoutUnit y = point.y();
@@ -712,13 +712,153 @@
return point - LayoutPoint(x, y);
}
-static void calculateDevicePixelOffsetFromRenderer(const LayoutSize& rendererOffsetFromGraphicsLayer, FloatSize& devicePixelOffsetFromRenderer,
- LayoutSize& devicePixelFractionFromRenderer, float deviceScaleFactor)
+struct OffsetFromRenderer {
+ // 1.2px - > { m_devicePixelOffset = 1px m_subpixelOffset = 0.2px }
+ LayoutSize m_devicePixelOffset;
+ LayoutSize m_subpixelOffset;
+};
+
+static OffsetFromRenderer computeOffsetFromRenderer(const LayoutSize& offset, float deviceScaleFactor)
{
- devicePixelFractionFromRenderer = LayoutSize(pixelFractionForLayerPainting(toLayoutPoint(rendererOffsetFromGraphicsLayer), deviceScaleFactor));
- devicePixelOffsetFromRenderer = rendererOffsetFromGraphicsLayer - devicePixelFractionFromRenderer;
+ OffsetFromRenderer offsetFromRenderer;
+ offsetFromRenderer.m_subpixelOffset = LayoutSize(subpixelForLayerPainting(toLayoutPoint(offset), deviceScaleFactor));
+ offsetFromRenderer.m_devicePixelOffset = offset - offsetFromRenderer.m_subpixelOffset;
+ return offsetFromRenderer;
}
+
+struct SnappedRectInfo {
+ LayoutRect m_snappedRect;
+ LayoutSize m_snapDelta;
+};
+
+static SnappedRectInfo snappedGraphicsLayer(const LayoutSize& offset, const LayoutSize& size, float deviceScaleFactor)
+{
+ SnappedRectInfo snappedGraphicsLayer;
+ LayoutRect graphicsLayerRect = LayoutRect(toLayoutPoint(offset), size);
+ snappedGraphicsLayer.m_snappedRect = LayoutRect(snapRectToDevicePixels(graphicsLayerRect, deviceScaleFactor));
+ snappedGraphicsLayer.m_snapDelta = snappedGraphicsLayer.m_snappedRect.location() - toLayoutPoint(offset);
+ return snappedGraphicsLayer;
+}
+static LayoutSize computeOffsetFromAncestorGraphicsLayer(RenderLayer* compositedAncestor, const LayoutPoint& location)
+{
+ if (!compositedAncestor)
+ return toLayoutSize(location);
+
+ LayoutSize ancestorRenderLayerOffsetFromAncestorGraphicsLayer = -(LayoutSize(compositedAncestor->backing()->graphicsLayer()->offsetFromRenderer())
+ + compositedAncestor->backing()->subpixelOffsetFromRenderer());
+ return ancestorRenderLayerOffsetFromAncestorGraphicsLayer + toLayoutSize(location);
+}
+
+class ComputedOffsets {
+public:
+ ComputedOffsets(const RenderLayer& renderLayer, const LayoutRect& localRect, const LayoutRect& parentGraphicsLayerRect, const LayoutRect& primaryGraphicsLayerRect)
+ : m_renderLayer(renderLayer)
+ , m_location(localRect.location())
+ , m_parentGraphicsLayerOffset(toLayoutSize(parentGraphicsLayerRect.location()))
+ , m_primaryGraphicsLayerOffset(toLayoutSize(primaryGraphicsLayerRect.location()))
+ {
+ }
+
+ LayoutSize fromParentGraphicsLayer()
+ {
+ if (!m_fromParentGraphicsLayer)
+ m_fromParentGraphicsLayer = fromAncestorGraphicsLayer() - m_parentGraphicsLayerOffset;
+ return m_fromParentGraphicsLayer.value();
+ }
+
+ LayoutSize fromPrimaryGraphicsLayer()
+ {
+ if (!m_fromPrimaryGraphicsLayer)
+ m_fromPrimaryGraphicsLayer = fromAncestorGraphicsLayer() - m_parentGraphicsLayerOffset - m_primaryGraphicsLayerOffset;
+ return m_fromPrimaryGraphicsLayer.value();
+ }
+
+private:
+ LayoutSize fromAncestorGraphicsLayer()
+ {
+ if (!m_fromAncestorGraphicsLayer) {
+ RenderLayer* compositedAncestor = m_renderLayer.ancestorCompositingLayer();
+ LayoutPoint localPointInAncestorRenderLayerCoords = m_renderLayer.convertToLayerCoords(compositedAncestor, m_location, RenderLayer::AdjustForColumns);
+ m_fromAncestorGraphicsLayer = computeOffsetFromAncestorGraphicsLayer(compositedAncestor, localPointInAncestorRenderLayerCoords);
+ }
+ return m_fromAncestorGraphicsLayer.value();
+ }
+
+ Optional<LayoutSize> m_fromAncestorGraphicsLayer;
+ Optional<LayoutSize> m_fromParentGraphicsLayer;
+ Optional<LayoutSize> m_fromPrimaryGraphicsLayer;
+
+ const RenderLayer& m_renderLayer;
+ // Location is relative to the renderer.
+ const LayoutPoint m_location;
+ const LayoutSize m_parentGraphicsLayerOffset;
+ const LayoutSize m_primaryGraphicsLayerOffset;
+};
+
+LayoutRect RenderLayerBacking::computePrimaryGraphicsLayerRect(const LayoutRect& parentGraphicsLayerRect) const
+{
+ ComputedOffsets compositedBoundsOffset(m_owningLayer, compositedBounds(), parentGraphicsLayerRect, LayoutRect());
+ return LayoutRect(encloseRectToDevicePixels(LayoutRect(toLayoutPoint(compositedBoundsOffset.fromParentGraphicsLayer()), compositedBounds().size()),
+ deviceScaleFactor()));
+}
+
+LayoutRect RenderLayerBacking::computeParentGraphicsLayerRect(RenderLayer* compositedAncestor, LayoutSize& ancestorClippingLayerOffset) const
+{
+ if (!compositedAncestor || !compositedAncestor->backing())
+ return renderer().view().documentRect();
+
+ auto* ancestorBackingLayer = compositedAncestor->backing();
+ LayoutRect parentGraphicsLayerRect;
+ if (m_owningLayer.isInsideFlowThread()) {
+ /// FIXME: flows/columns need work.
+ LayoutRect ancestorCompositedBounds = ancestorBackingLayer->compositedBounds();
+ ancestorCompositedBounds.setLocation(LayoutPoint());
+ adjustAncestorCompositingBoundsForFlowThread(ancestorCompositedBounds, compositedAncestor);
+ parentGraphicsLayerRect = ancestorCompositedBounds;
+ }
+
+ if (ancestorBackingLayer->hasClippingLayer()) {
+ // If the compositing ancestor has a layer to clip children, we parent in that, and therefore position relative to it.
+ LayoutRect clippingBox = clipBox(downcast<RenderBox>(compositedAncestor->renderer()));
+ LayoutSize clippingBoxOffset = computeOffsetFromAncestorGraphicsLayer(compositedAncestor, clippingBox.location());
+ parentGraphicsLayerRect = snappedGraphicsLayer(clippingBoxOffset, clippingBox.size(), deviceScaleFactor()).m_snappedRect;
+ }
+
+#if PLATFORM(IOS)
+ if (compositedAncestor->hasTouchScrollableOverflow()) {
+ auto& renderBox = downcast<RenderBox>(compositedAncestor->renderer());
+ LayoutRect paddingBox(renderBox.borderLeft(), renderBox.borderTop(),
+ renderBox.width() - renderBox.borderLeft() - renderBox.borderRight(),
+ renderBox.height() - renderBox.borderTop() - renderBox.borderBottom());
+ ScrollOffset scrollOffset = compositedAncestor->scrollOffset();
+ parentGraphicsLayerRect = LayoutRect((paddingBox.location() - toLayoutSize(scrollOffset)), paddingBox.size());
+ }
+#else
+ if (compositedAncestor->needsCompositedScrolling()) {
+ auto& renderBox = downcast<RenderBox>(compositedAncestor->renderer());
+ LayoutPoint scrollOrigin(renderBox.borderLeft(), renderBox.borderTop());
+ parentGraphicsLayerRect = LayoutRect(scrollOrigin - toLayoutSize(compositedAncestor->scrollOffset()), renderBox.borderBoxRect().size());
+ }
+#endif
+
+ if (m_ancestorClippingLayer) {
+ // Call calculateRects to get the backgroundRect which is what is used to clip the contents of this
+ // layer. Note that we call it with temporaryClipRects = true because normally when computing clip rects
+ // for a compositing layer, rootLayer is the layer itself.
+ ShouldRespectOverflowClip shouldRespectOverflowClip = compositedAncestor->isolatesCompositedBlending() ? RespectOverflowClip : IgnoreOverflowClip;
+ RenderLayer::ClipRectsContext clipRectsContext(compositedAncestor, TemporaryClipRects, IgnoreOverlayScrollbarSize, shouldRespectOverflowClip);
+ LayoutRect parentClipRect = m_owningLayer.backgroundClipRect(clipRectsContext).rect(); // FIXME: Incorrect for CSS regions.
+ ASSERT(!parentClipRect.isInfinite());
+ LayoutSize clippingOffset = computeOffsetFromAncestorGraphicsLayer(compositedAncestor, parentClipRect.location());
+ LayoutRect snappedClippingLayerRect = snappedGraphicsLayer(clippingOffset, parentClipRect.size(), deviceScaleFactor()).m_snappedRect;
+ // The primary layer is then parented in, and positioned relative to this clipping layer.
+ ancestorClippingLayerOffset = snappedClippingLayerRect.location() - parentGraphicsLayerRect.location();
+ parentGraphicsLayerRect = snappedClippingLayerRect;
+ }
+ return parentGraphicsLayerRect;
+}
+
void RenderLayerBacking::updateGeometry()
{
// If we haven't built z-order lists yet, wait until later.
@@ -726,7 +866,6 @@
return;
const RenderStyle& style = renderer().style();
-
// Set transform property, if it is not animating. We have to do this here because the transform
// is affected by the layer dimensions.
if (!renderer().animation().isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyTransform, AnimationBase::Running | AnimationBase::Paused))
@@ -743,7 +882,6 @@
#if ENABLE(CSS_COMPOSITING)
updateBlendMode(style);
#endif
-
m_owningLayer.updateDescendantDependentFlags();
// FIXME: reflections should force transform-style to be flat in the style: https://bugs.webkit.org/show_bug.cgi?id=106959
@@ -750,123 +888,42 @@
bool preserves3D = style.transformStyle3D() == TransformStyle3DPreserve3D && !renderer().hasReflection();
m_graphicsLayer->setPreserves3D(preserves3D);
m_graphicsLayer->setBackfaceVisibility(style.backfaceVisibility() == BackfaceVisibilityVisible);
- /*
- * GraphicsLayer: device pixel positioned, enclosing rect.
- * RenderLayer: subpixel positioned.
- * Offset from renderer (GraphicsLayer <-> RenderLayer::renderer()): subpixel based offset.
- *
- * relativeCompositingBounds
- * _______________________________________
- * |\ GraphicsLayer |
- * | \ |
- * | \ offset from renderer: (device pixel + subpixel)
- * | \ |
- * | \______________________________ |
- * | | localCompositingBounds | |
- * | | | |
- * | | RenderLayer::renderer() | |
- * | | | |
- *
- * localCompositingBounds: this RenderLayer relative to its renderer().
- * relativeCompositingBounds: this RenderLayer relative to its parent compositing layer.
- * enclosingRelativeCompositingBounds: this RenderLayer relative to its parent, device pixel enclosing.
- * rendererOffsetFromGraphicsLayer: RenderLayer::renderer()'s offset from its enclosing GraphicsLayer.
- * devicePixelOffsetFromRenderer: rendererOffsetFromGraphicsLayer's device pixel part. (6.9px -> 6.5px in case of 2x display)
- * devicePixelFractionFromRenderer: rendererOffsetFromGraphicsLayer's fractional part (6.9px -> 0.4px in case of 2x display)
- */
- float deviceScaleFactor = this->deviceScaleFactor();
- RenderLayer* compAncestor = m_owningLayer.ancestorCompositingLayer();
- // We compute everything relative to the enclosing compositing layer.
- LayoutRect ancestorCompositingBounds;
- if (compAncestor) {
- ASSERT(compAncestor->backing());
- ancestorCompositingBounds = compAncestor->backing()->compositedBounds();
- }
- LayoutRect localCompositingBounds = compositedBounds();
- LayoutRect relativeCompositingBounds(localCompositingBounds);
- LayoutPoint offsetFromParent = m_owningLayer.convertToLayerCoords(compAncestor, LayoutPoint(), RenderLayer::AdjustForColumns);
- // Device pixel fractions get accumulated through ancestor layers. Our painting offset is layout offset + parent's painting offset.
- offsetFromParent = offsetFromParent + (compAncestor ? compAncestor->backing()->devicePixelFractionFromRenderer() : LayoutSize());
- relativeCompositingBounds.moveBy(offsetFromParent);
+ RenderLayer* compositedAncestor = m_owningLayer.ancestorCompositingLayer();
+ LayoutSize ancestorClippingLayerOffset;
+ LayoutRect parentGraphicsLayerRect = computeParentGraphicsLayerRect(compositedAncestor, ancestorClippingLayerOffset);
+ LayoutRect primaryGraphicsLayerRect = computePrimaryGraphicsLayerRect(parentGraphicsLayerRect);
- LayoutRect enclosingRelativeCompositingBounds = LayoutRect(encloseRectToDevicePixels(relativeCompositingBounds, deviceScaleFactor));
- m_compositedBoundsDeltaFromGraphicsLayer = enclosingRelativeCompositingBounds.location() - relativeCompositingBounds.location();
- LayoutSize rendererOffsetFromGraphicsLayer = toLayoutSize(localCompositingBounds.location()) + m_compositedBoundsDeltaFromGraphicsLayer;
+ ComputedOffsets compositedBoundsOffset(m_owningLayer, compositedBounds(), parentGraphicsLayerRect, primaryGraphicsLayerRect);
+ m_compositedBoundsOffsetFromGraphicsLayer = compositedBoundsOffset.fromPrimaryGraphicsLayer();
+ m_graphicsLayer->setPosition(primaryGraphicsLayerRect.location());
+ m_graphicsLayer->setSize(primaryGraphicsLayerRect.size());
- FloatSize devicePixelOffsetFromRenderer;
- LayoutSize devicePixelFractionFromRenderer;
- calculateDevicePixelOffsetFromRenderer(rendererOffsetFromGraphicsLayer, devicePixelOffsetFromRenderer, devicePixelFractionFromRenderer, deviceScaleFactor);
- LayoutSize oldDevicePixelFractionFromRenderer = m_devicePixelFractionFromRenderer;
- m_devicePixelFractionFromRenderer = LayoutSize(-devicePixelFractionFromRenderer.width(), -devicePixelFractionFromRenderer.height());
-
- adjustAncestorCompositingBoundsForFlowThread(ancestorCompositingBounds, compAncestor);
-
- LayoutPoint graphicsLayerParentLocation;
- if (compAncestor && compAncestor->backing()->hasClippingLayer()) {
- // If the compositing ancestor has a layer to clip children, we parent in that, and therefore
- // position relative to it.
- // FIXME: need to do some pixel snapping here.
- LayoutRect clippingBox = clipBox(downcast<RenderBox>(compAncestor->renderer()));
- graphicsLayerParentLocation = clippingBox.location();
- } else if (compAncestor)
- graphicsLayerParentLocation = ancestorCompositingBounds.location();
- else
- graphicsLayerParentLocation = renderer().view().documentRect().location();
-
-#if PLATFORM(IOS)
- if (compAncestor && compAncestor->hasTouchScrollableOverflow()) {
- auto& renderBox = downcast<RenderBox>(compAncestor->renderer());
- LayoutRect paddingBox(renderBox.borderLeft(), renderBox.borderTop(),
- renderBox.width() - renderBox.borderLeft() - renderBox.borderRight(),
- renderBox.height() - renderBox.borderTop() - renderBox.borderBottom());
-
- ScrollOffset scrollOffset = compAncestor->scrollOffset();
- // FIXME: pixel snap the padding box.
- graphicsLayerParentLocation = paddingBox.location() - toLayoutSize(scrollOffset);
+ ComputedOffsets rendererOffset(m_owningLayer, LayoutRect(), parentGraphicsLayerRect, primaryGraphicsLayerRect);
+ if (m_ancestorClippingLayer) {
+ // Clipping layer is parented in the ancestor layer.
+ m_ancestorClippingLayer->setPosition(toLayoutPoint(ancestorClippingLayerOffset));
+ m_ancestorClippingLayer->setSize(parentGraphicsLayerRect.size());
+ m_ancestorClippingLayer->setOffsetFromRenderer(-rendererOffset.fromParentGraphicsLayer());
}
-#else
- if (compAncestor && compAncestor->needsCompositedScrolling()) {
- auto& renderBox = downcast<RenderBox>(compAncestor->renderer());
- LayoutPoint scrollOrigin(renderBox.borderLeft(), renderBox.borderTop());
- graphicsLayerParentLocation = scrollOrigin - toLayoutSize(compAncestor->scrollOffset());
- }
-#endif
- if (compAncestor && m_ancestorClippingLayer) {
- // Call calculateRects to get the backgroundRect which is what is used to clip the contents of this
- // layer. Note that we call it with temporaryClipRects = true because normally when computing clip rects
- // for a compositing layer, rootLayer is the layer itself.
- ShouldRespectOverflowClip shouldRespectOverflowClip = compAncestor->isolatesCompositedBlending() ? RespectOverflowClip : IgnoreOverflowClip;
- RenderLayer::ClipRectsContext clipRectsContext(compAncestor, TemporaryClipRects, IgnoreOverlayScrollbarSize, shouldRespectOverflowClip);
- LayoutRect parentClipRect = m_owningLayer.backgroundClipRect(clipRectsContext).rect(); // FIXME: Incorrect for CSS regions.
- ASSERT(!parentClipRect.isInfinite());
- FloatPoint enclosingClippingLayerPosition = floorPointToDevicePixels(LayoutPoint(parentClipRect.location() - graphicsLayerParentLocation), deviceScaleFactor);
- m_ancestorClippingLayer->setPosition(enclosingClippingLayerPosition);
- m_ancestorClippingLayer->setSize(parentClipRect.size());
-
- // backgroundRect is relative to compAncestor, so subtract deltaX/deltaY to get back to local coords.
- m_ancestorClippingLayer->setOffsetFromRenderer(parentClipRect.location() - offsetFromParent);
-
- // The primary layer is then parented in, and positioned relative to this clipping layer.
- graphicsLayerParentLocation = parentClipRect.location();
- }
-
- LayoutSize contentsSize = enclosingRelativeCompositingBounds.size();
if (m_contentsContainmentLayer) {
m_contentsContainmentLayer->setPreserves3D(preserves3D);
- FloatPoint enclosingGraphicsParentLocation = floorPointToDevicePixels(graphicsLayerParentLocation, deviceScaleFactor);
- m_contentsContainmentLayer->setPosition(FloatPoint(enclosingRelativeCompositingBounds.location() - enclosingGraphicsParentLocation));
+ m_contentsContainmentLayer->setPosition(primaryGraphicsLayerRect.location());
+ m_graphicsLayer->setPosition(FloatPoint());
// Use the same size as m_graphicsLayer so transforms behave correctly.
- m_contentsContainmentLayer->setSize(contentsSize);
- graphicsLayerParentLocation = enclosingRelativeCompositingBounds.location();
+ m_contentsContainmentLayer->setSize(primaryGraphicsLayerRect.size());
}
- FloatPoint enclosingGraphicsParentLocation = floorPointToDevicePixels(graphicsLayerParentLocation, deviceScaleFactor);
- m_graphicsLayer->setPosition(FloatPoint(enclosingRelativeCompositingBounds.location() - enclosingGraphicsParentLocation));
- m_graphicsLayer->setSize(contentsSize);
- if (devicePixelOffsetFromRenderer != m_graphicsLayer->offsetFromRenderer()) {
- m_graphicsLayer->setOffsetFromRenderer(devicePixelOffsetFromRenderer);
+ // Compute renderer offset from primary graphics layer. Note that primaryGraphicsLayerRect is in parentGraphicsLayer's coordidate system which is not necessarily
+ // the same as the ancestor graphics layer.
+ OffsetFromRenderer primaryGraphicsLayerOffsetFromRenderer;
+ LayoutSize oldSubpixelOffsetFromRenderer = m_subpixelOffsetFromRenderer;
+ primaryGraphicsLayerOffsetFromRenderer = computeOffsetFromRenderer(-rendererOffset.fromPrimaryGraphicsLayer(), deviceScaleFactor());
+ m_subpixelOffsetFromRenderer = primaryGraphicsLayerOffsetFromRenderer.m_subpixelOffset;
+
+ if (primaryGraphicsLayerOffsetFromRenderer.m_devicePixelOffset != m_graphicsLayer->offsetFromRenderer()) {
+ m_graphicsLayer->setOffsetFromRenderer(primaryGraphicsLayerOffsetFromRenderer.m_devicePixelOffset);
positionOverflowControlsLayers();
}
@@ -873,18 +930,21 @@
if (!m_isMainFrameRenderViewLayer) {
// For non-root layers, background is always painted by the primary graphics layer.
ASSERT(!m_backgroundLayer);
- bool hadSubpixelRounding = enclosingRelativeCompositingBounds != relativeCompositingBounds;
- m_graphicsLayer->setContentsOpaque(!hadSubpixelRounding && m_owningLayer.backgroundIsKnownToBeOpaqueInRect(localCompositingBounds));
+ // 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 (GraphicsLayer* clipLayer = clippingLayer()) {
- // FIXME: need to do some pixel snapping here.
clippingBox = clipBox(downcast<RenderBox>(renderer()));
- clipLayer->setPosition(FloatPoint(clippingBox.location() - localCompositingBounds.location()));
- clipLayer->setSize(clippingBox.size());
- clipLayer->setOffsetFromRenderer(toFloatSize(clippingBox.location()));
+ // Clipping layer is parented in the primary graphics layer.
+ LayoutSize clipBoxOffsetFromGraphicsLayer = toLayoutSize(clippingBox.location()) + rendererOffset.fromPrimaryGraphicsLayer();
+ SnappedRectInfo snappedClippingGraphicsLayer = snappedGraphicsLayer(clipBoxOffsetFromGraphicsLayer, clippingBox.size(), deviceScaleFactor());
+ clipLayer->setPosition(snappedClippingGraphicsLayer.m_snappedRect.location());
+ clipLayer->setSize(snappedClippingGraphicsLayer.m_snappedRect.size());
+ clipLayer->setOffsetFromRenderer(toLayoutSize(clippingBox.location() - snappedClippingGraphicsLayer.m_snapDelta));
if (m_childClippingMaskLayer && !m_scrollingLayer) {
m_childClippingMaskLayer->setSize(clipLayer->size());
@@ -899,12 +959,12 @@
if (m_owningLayer.renderer().hasTransformRelatedProperty()) {
// Update properties that depend on layer dimensions.
FloatPoint3D transformOrigin = computeTransformOriginForPainting(downcast<RenderBox>(renderer()).borderBoxRect());
- // Get layout bounds in the coords of compAncestor to match relativeCompositingBounds.
- FloatPoint layerOffset = roundPointToDevicePixels(offsetFromParent, deviceScaleFactor);
+ FloatPoint layerOffset = roundPointToDevicePixels(toLayoutPoint(rendererOffset.fromParentGraphicsLayer()), deviceScaleFactor());
// Compute the anchor point, which is in the center of the renderer box unless transform-origin is set.
- FloatPoint3D anchor(enclosingRelativeCompositingBounds.width() ? ((layerOffset.x() - enclosingRelativeCompositingBounds.x()) + transformOrigin.x())
- / enclosingRelativeCompositingBounds.width() : 0.5, enclosingRelativeCompositingBounds.height() ? ((layerOffset.y() - enclosingRelativeCompositingBounds.y())
- + transformOrigin.y()) / enclosingRelativeCompositingBounds.height() : 0.5, transformOrigin.z());
+ FloatPoint3D anchor(
+ primaryGraphicsLayerRect.width() ? ((layerOffset.x() - primaryGraphicsLayerRect.x()) + transformOrigin.x()) / primaryGraphicsLayerRect.width() : 0.5,
+ primaryGraphicsLayerRect.height() ? ((layerOffset.y() - primaryGraphicsLayerRect.y())+ transformOrigin.y()) / primaryGraphicsLayerRect.height() : 0.5,
+ transformOrigin.z());
if (m_contentsContainmentLayer)
m_contentsContainmentLayer->setAnchorPoint(anchor);
@@ -935,7 +995,7 @@
if (m_foregroundLayer) {
FloatPoint foregroundPosition;
- FloatSize foregroundSize = contentsSize;
+ FloatSize foregroundSize = primaryGraphicsLayerRect.size();
FloatSize foregroundOffset = m_graphicsLayer->offsetFromRenderer();
if (hasClippingLayer()) {
// If we have a clipping layer (which clips descendants), then the foreground layer is a child of it,
@@ -951,7 +1011,7 @@
if (m_backgroundLayer) {
FloatPoint backgroundPosition;
- FloatSize backgroundSize = contentsSize;
+ FloatSize backgroundSize = primaryGraphicsLayerRect.size();
if (backgroundLayerPaintsFixedRootBackground()) {
const FrameView& frameView = renderer().view().frameView();
backgroundPosition = frameView.scrollPositionForFixedPosition();
@@ -968,7 +1028,7 @@
// The reflection layer has the bounds of m_owningLayer.reflectionLayer(),
// but the reflected layer is the bounds of this layer, so we need to position it appropriately.
- FloatRect layerBounds = compositedBounds();
+ FloatRect layerBounds = this->compositedBounds();
FloatRect reflectionLayerBounds = reflectionBacking->compositedBounds();
reflectionBacking->graphicsLayer()->setReplicatedLayerPosition(FloatPoint(layerBounds.location() - reflectionLayerBounds.location()));
}
@@ -980,7 +1040,7 @@
ScrollOffset scrollOffset = m_owningLayer.scrollOffset();
// FIXME: need to do some pixel snapping here.
- m_scrollingLayer->setPosition(FloatPoint(paddingBox.location() - localCompositingBounds.location()));
+ m_scrollingLayer->setPosition(FloatPoint(paddingBox.location() - compositedBounds().location()));
m_scrollingLayer->setSize(roundedIntSize(LayoutSize(renderBox.clientWidth(), renderBox.clientHeight())));
#if PLATFORM(IOS)
@@ -1044,13 +1104,15 @@
}
// If this layer was created just for clipping or to apply perspective, it doesn't need its own backing store.
- setRequiresOwnBackingStore(compositor().requiresOwnBackingStore(m_owningLayer, compAncestor, enclosingRelativeCompositingBounds, ancestorCompositingBounds));
+ LayoutRect ancestorCompositedBounds = compositedAncestor ? compositedAncestor->backing()->compositedBounds() : LayoutRect();
+ setRequiresOwnBackingStore(compositor().requiresOwnBackingStore(m_owningLayer, compositedAncestor,
+ LayoutRect(toLayoutPoint(compositedBoundsOffset.fromParentGraphicsLayer()), compositedBounds().size()), ancestorCompositedBounds));
#if ENABLE(FILTERS_LEVEL_2)
updateBackdropFiltersGeometry();
#endif
updateAfterWidgetResize();
- if (devicePixelFractionGapFromRendererChanged(oldDevicePixelFractionFromRenderer, m_devicePixelFractionFromRenderer, deviceScaleFactor) && canIssueSetNeedsDisplay())
+ if (subpixelOffsetFromRendererChanged(oldSubpixelOffsetFromRenderer, m_subpixelOffsetFromRenderer, deviceScaleFactor()) && canIssueSetNeedsDisplay())
setContentsNeedDisplay();
compositor().updateScrollCoordinatedStatus(m_owningLayer);
@@ -1092,7 +1154,7 @@
// FIXME: Use correct reference box for inlines: https://bugs.webkit.org/show_bug.cgi?id=129047
LayoutRect boundingBox = m_owningLayer.boundingBox(&m_owningLayer);
LayoutRect referenceBoxForClippedInline = LayoutRect(snapRectToDevicePixels(boundingBox, deviceScaleFactor()));
- LayoutSize offset = LayoutSize(snapSizeToDevicePixel(m_devicePixelFractionFromRenderer, LayoutPoint(), deviceScaleFactor()));
+ LayoutSize offset = LayoutSize(snapSizeToDevicePixel(-m_subpixelOffsetFromRenderer, LayoutPoint(), deviceScaleFactor()));
Path clipPath = m_owningLayer.computeClipPath(offset, referenceBoxForClippedInline, windRule);
FloatSize pathOffset = m_maskLayer->offsetFromRenderer();
@@ -1107,9 +1169,6 @@
void RenderLayerBacking::adjustAncestorCompositingBoundsForFlowThread(LayoutRect& ancestorCompositingBounds, const RenderLayer* compositingAncestor) const
{
- if (!m_owningLayer.isInsideFlowThread())
- return;
-
RenderLayer* flowThreadLayer = m_owningLayer.isInsideOutOfFlowThread() ? m_owningLayer.stackingContainer() : nullptr;
if (flowThreadLayer && flowThreadLayer->isRenderFlowThread()) {
if (m_owningLayer.isFlowThreadCollectingGraphicsLayersUnderRegions()) {
@@ -2102,7 +2161,7 @@
// Return the offset from the top-left of this compositing layer at which the renderer's contents are painted.
LayoutSize RenderLayerBacking::contentOffsetInCompostingLayer() const
{
- return LayoutSize(-m_compositedBounds.x() - m_compositedBoundsDeltaFromGraphicsLayer.width(), -m_compositedBounds.y() - m_compositedBoundsDeltaFromGraphicsLayer.height());
+ return LayoutSize(-m_compositedBounds.x() + m_compositedBoundsOffsetFromGraphicsLayer.width(), -m_compositedBounds.y() + m_compositedBoundsOffsetFromGraphicsLayer.height());
}
LayoutRect RenderLayerBacking::contentsBox() const
@@ -2250,13 +2309,13 @@
if (m_graphicsLayer && m_graphicsLayer->drawsContent()) {
FloatRect layerDirtyRect = pixelSnappedRectForPainting;
- layerDirtyRect.move(-m_graphicsLayer->offsetFromRenderer() + m_devicePixelFractionFromRenderer);
+ layerDirtyRect.move(-m_graphicsLayer->offsetFromRenderer() - m_subpixelOffsetFromRenderer);
m_graphicsLayer->setNeedsDisplayInRect(layerDirtyRect, shouldClip);
}
if (m_foregroundLayer && m_foregroundLayer->drawsContent()) {
FloatRect layerDirtyRect = pixelSnappedRectForPainting;
- layerDirtyRect.move(-m_foregroundLayer->offsetFromRenderer() + m_devicePixelFractionFromRenderer);
+ layerDirtyRect.move(-m_foregroundLayer->offsetFromRenderer() - m_subpixelOffsetFromRenderer);
m_foregroundLayer->setNeedsDisplayInRect(layerDirtyRect, shouldClip);
}
@@ -2263,13 +2322,13 @@
// FIXME: need to split out repaints for the background.
if (m_backgroundLayer && m_backgroundLayer->drawsContent()) {
FloatRect layerDirtyRect = pixelSnappedRectForPainting;
- layerDirtyRect.move(-m_backgroundLayer->offsetFromRenderer() + m_devicePixelFractionFromRenderer);
+ layerDirtyRect.move(-m_backgroundLayer->offsetFromRenderer() - m_subpixelOffsetFromRenderer);
m_backgroundLayer->setNeedsDisplayInRect(layerDirtyRect, shouldClip);
}
if (m_maskLayer && m_maskLayer->drawsContent()) {
FloatRect layerDirtyRect = pixelSnappedRectForPainting;
- layerDirtyRect.move(-m_maskLayer->offsetFromRenderer() + m_devicePixelFractionFromRenderer);
+ layerDirtyRect.move(-m_maskLayer->offsetFromRenderer() - m_subpixelOffsetFromRenderer);
m_maskLayer->setNeedsDisplayInRect(layerDirtyRect, shouldClip);
}
@@ -2281,7 +2340,7 @@
if (m_scrollingContentsLayer && m_scrollingContentsLayer->drawsContent()) {
FloatRect layerDirtyRect = pixelSnappedRectForPainting;
- layerDirtyRect.move(-m_scrollingContentsLayer->offsetFromRenderer() + m_devicePixelFractionFromRenderer);
+ layerDirtyRect.move(-m_scrollingContentsLayer->offsetFromRenderer() - m_subpixelOffsetFromRenderer);
#if PLATFORM(IOS)
// Account for the fact that RenderLayerBacking::updateGeometry() bakes scrollOffset into offsetFromRenderer on iOS,
// but the repaint rect is computed without taking the scroll position into account (see shouldApplyClipAndScrollPositionForRepaint()).
@@ -2335,7 +2394,7 @@
renderer().view().frameView().willPaintContents(context, paintDirtyRect, paintingState);
// FIXME: GraphicsLayers need a way to split for RenderRegions.
- RenderLayer::LayerPaintingInfo paintingInfo(&m_owningLayer, paintDirtyRect, paintBehavior, m_devicePixelFractionFromRenderer);
+ RenderLayer::LayerPaintingInfo paintingInfo(&m_owningLayer, paintDirtyRect, paintBehavior, -m_subpixelOffsetFromRenderer);
m_owningLayer.paintLayerContents(context, paintingInfo, paintFlags);
if (m_owningLayer.containsDirtyOverlayScrollbars())
@@ -2359,7 +2418,7 @@
// The dirtyRect is in the coords of the painting root.
FloatRect adjustedClipRect = clip;
- adjustedClipRect.move(-m_devicePixelFractionFromRenderer);
+ adjustedClipRect.move(m_subpixelOffsetFromRenderer);
IntRect dirtyRect = enclosingIntRect(adjustedClipRect);
if (graphicsLayer == m_graphicsLayer.get()
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (204551 => 204552)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.h 2016-08-17 03:17:04 UTC (rev 204551)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h 2016-08-17 03:18:21 UTC (rev 204552)
@@ -216,6 +216,8 @@
bool useGiantTiles() const override;
bool needsPixelAligment() const override { return !m_isMainFrameRenderViewLayer; }
+ LayoutSize subpixelOffsetFromRenderer() const { return m_subpixelOffsetFromRenderer; }
+
#if PLATFORM(IOS)
bool needsIOSDumpRenderTreeMainFrameRenderViewLayerIsAlwaysOpaqueHack(const GraphicsLayer&) const override;
#endif
@@ -248,8 +250,6 @@
WEBCORE_EXPORT void setIsTrackingDisplayListReplay(bool);
WEBCORE_EXPORT String replayDisplayListAsText(DisplayList::AsTextFlags) const;
- LayoutSize devicePixelFractionFromRenderer() const { return m_devicePixelFractionFromRenderer; }
-
private:
FloatRect backgroundBoxForSimpleContainerPainting() const;
@@ -343,6 +343,8 @@
static AnimatedPropertyID cssToGraphicsLayerProperty(CSSPropertyID);
bool canIssueSetNeedsDisplay() const { return !paintsIntoWindow() && !paintsIntoCompositedAncestor(); }
+ LayoutRect computeParentGraphicsLayerRect(RenderLayer* compositedAncestor, LayoutSize& ancestorClippingLayerOffset) const;
+ LayoutRect computePrimaryGraphicsLayerRect(const LayoutRect& parentGraphicsLayerRect) const;
RenderLayer& m_owningLayer;
@@ -366,8 +368,8 @@
ScrollingNodeID m_scrollingNodeID;
LayoutRect m_compositedBounds;
- LayoutSize m_devicePixelFractionFromRenderer;
- LayoutSize m_compositedBoundsDeltaFromGraphicsLayer; // This is the (subpixel) distance between the edge of the graphics layer and the layer bounds.
+ LayoutSize m_subpixelOffsetFromRenderer; // This is the subpixel distance between the primary graphics layer and the associated renderer's bounds.
+ LayoutSize m_compositedBoundsOffsetFromGraphicsLayer; // This is the subpixel distance between the primary graphics layer and the render layer bounds.
bool m_artificiallyInflatedBounds; // bounds had to be made non-zero to make transform-origin work
bool m_isMainFrameRenderViewLayer;