Don't create compositing layers for sticky position unless using the ScrollingCoordinator
https://bugs.webkit.org/show_bug.cgi?id=115060
Source/WebCore:
Reviewed by Tim Horton.
Creating compositing layers for sticky position elements is only useful
when we're using a ScrollingCoordinator, so don't create them if
we're not in a frame that uses a scrolling coordinator.
Tests: compositing/layer-creation/no-compositing-for-sticky.html
platform/mac-wk2/tiled-drawing/sticky/sticky-layers.html
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::requiresCompositingForPosition):
LayoutTests:
Reviewed by Tim Horton.
Tests that we create layers for sticky position when in tiled drawing mode,
and that we have no layers when not.
* compositing/layer-creation/no-compositing-for-sticky-expected.txt: Added.
* compositing/layer-creation/no-compositing-for-sticky.html: Added.
* platform/mac-wk2/tiled-drawing/sticky/sticky-layers-expected.txt: Added.
* platform/mac-wk2/tiled-drawing/sticky/sticky-layers.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148998 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/compositing/layer-creation/no-compositing-for-sticky.html b/LayoutTests/compositing/layer-creation/no-compositing-for-sticky.html
new file mode 100644
index 0000000..af58b4b
--- /dev/null
+++ b/LayoutTests/compositing/layer-creation/no-compositing-for-sticky.html
@@ -0,0 +1,76 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ body {
+ width: 2000px;
+ }
+
+ .container {
+ position: relative;
+ height: 450px;
+ width: 800px;
+ margin: 20px auto;
+ background-color: #eee;
+ border: 1px solid black;
+ }
+
+ .left {
+ float: left;
+ width: 200px;
+ height: 100%;
+ background-color: #ddd;
+ }
+
+ .sticky {
+ position: -webkit-sticky;
+ display: inline-block;
+ background: silver;
+ margin: 4px;
+ height: 60px;
+ width: 300px;
+ }
+
+ .box {
+ display: none;
+ width: 100px;
+ height: 100px;
+ background-color: blue;
+ }
+ </style>
+ <script>
+ if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+ }
+
+ function doScroll()
+ {
+ window.setTimeout(function() {
+ window.scrollTo(800, 0);
+ if (window.testRunner) {
+ document.getElementById('results').innerText = window.internals.layerTreeAsText(document);
+ testRunner.notifyDone();
+ }
+ }, 10);
+ }
+
+ window.addEventListener('load', doScroll, false);
+ </script>
+</head>
+<body>
+<p>There should be no compositing layers for sticky positioned elements.</p>
+ <div class="container">
+ <div class="left"></div>
+ <div class="horizontal sticky" style="left: 20px">Left sticky <div class="composited box"></div></div>
+ <div class="horizontal sticky" style="right: 20px">Right sticky <div class="composited box"></div></div>
+ <div class="horizontal sticky" style="left: 20%">Left % sticky <div class="composited box"></div></div>
+ <div class="horizontal sticky" style="right: 20%">Right % sticky <div class="composited box"></div></div>
+
+ <div class="horizontal sticky" style="left: 20px; right: 20px">Left and Right <div class="composited box"></div></div>
+ <div class="horizontal sticky" style="left: 20%; right: 20%">Left and Right %<div class="composited box"></div></div>
+ </div>
+<pre id="results"></pre>
+</body>
+</html>