Index: third_party/WebKit/LayoutTests/compositing/overflow/overflow-scroll-background-opaque-to-transparent.html |
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/overflow-scroll-background-opaque-to-transparent.html b/third_party/WebKit/LayoutTests/compositing/overflow/overflow-scroll-background-opaque-to-transparent.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..cd409c9a13c9f80162442ab25a4b8ed458d69956 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/compositing/overflow/overflow-scroll-background-opaque-to-transparent.html |
@@ -0,0 +1,74 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
+<script src="../../resources/run-after-layout-and-paint.js"></script> |
+<script> |
+ if (window.internals) |
+ internals.runtimeFlags.compositeOpaqueScrollersEnabled = true; |
+ |
+ if (window.testRunner) { |
+ testRunner.dumpAsTextWithPixelResults(); |
+ testRunner.waitUntilDone(); |
+ } |
+ |
+ function hasOpaqueCompositedScrollingContentsLayer(layer) { |
+ if (layer.name == "Scrolling Contents Layer") |
+ return layer.contentsOpaque; |
+ if (layer.children) { |
+ for (var i = 0; i < layer.children.length; i++) { |
+ if (hasOpaqueCompositedScrollingContentsLayer(layer.children[i])) |
+ return true; |
+ } |
+ } |
+ return false; |
+ } |
+ |
+ onload = function() { |
+ if (!window.testRunner || !window.internals) |
+ return; |
+ |
+ var result = "Should have opaque composited scrolling contents layer: "; |
+ if (hasOpaqueCompositedScrollingContentsLayer(JSON.parse(window.internals.layerTreeAsText(document)))) |
+ result += "Pass.\n"; |
+ else |
+ result += "Fail.\n"; |
+ document.getElementById("test-1-output").innerHTML = result; |
+ |
+ scrollerElement = document.getElementById("scroller"); |
+ scrollerElement.style.background = "transparent local content-box"; |
+ |
+ runAfterLayoutAndPaint(function() { |
+ var result = "Should not have opaque composited scrolling contents layer: "; |
+ if (!hasOpaqueCompositedScrollingContentsLayer(JSON.parse(window.internals.layerTreeAsText(document)))) |
flackr
2016/08/30 21:14:49
The negation of hasOpaqueCompositedScrollingConten
Stephen Chennney
2016/08/31 20:50:20
Done. Added hasCompositedScrollingContentsLayer an
|
+ result += "Pass.\n"; |
+ else |
+ result += "Fail.\n"; |
+ document.getElementById("test-2-output").innerHTML = result; |
+ runAfterLayoutAndPaint(function() { testRunner.notifyDone(); }); |
+ }); |
+ } |
+</script> |
+<style> |
+#scroller { |
+ background: red local content-box; |
+ border: 10px solid rgba(0, 255, 0, 0.5); |
+ overflow: scroll; |
+ width: 200px; |
+ height: 200px; |
+} |
+.spacer { |
+ height: 300px; |
+} |
+</style> |
+</head> |
+<body> |
+<!-- The scroller's Scrolling Contents Layer should be opaque due to the opaque |
+ color background. Even though the background has a content-box clip there |
+ is no gap because the scroller has no padding. This means that we will be |
+ able to draw text with subpixel anti-aliasing. |
flackr
2016/08/30 21:14:49
This comments seems out of date - doesn't mention
Stephen Chennney
2016/08/31 20:50:20
Done.
|
+--> |
+<div id="scroller"><div class="spacer"></div></div> |
+<p>Scroller background should be white</p> |
+<p id="test-1-output"></p> |
+<p id="test-2-output"></p> |
+</body></html> |