Index: third_party/WebKit/Source/core/paint/PaintLayerScrollableAreaTest.cpp |
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableAreaTest.cpp b/third_party/WebKit/Source/core/paint/PaintLayerScrollableAreaTest.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..fc3f6a6f696805059d8727676fb722624dadc072 |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableAreaTest.cpp |
@@ -0,0 +1,49 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
chrishtr
2016/08/04 16:35:44
2016
Stephen Chennney
2016/08/04 17:35:25
Done.
chrishtr
2016/08/09 18:03:40
Still not done. Update the patchset?
|
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "core/paint/PaintLayerScrollableAreaTest.h" |
+ |
+namespace blink { |
+ |
+TEST_F(PaintLayerScrollableAreaTest, OpaqueLayersPromoted) |
+{ |
+ RuntimeEnabledFeatures::setCompositeOpaqueScrollersEnabled(true); |
+ |
+ setBodyInnerHTML( |
+ "<style>" |
+ "#scroller { overflow: scroll; height: 300px; width: 300px; background-color: rgb(0,128,0); }" |
+ "#scrolled { height: 1000px; width: 250px; }" |
+ "</style>" |
+ "<div id=\"scroller\"><div id=\"scrolled\"></div></div>"); |
+ document().view()->updateAllLifecyclePhases(); |
+ |
+ ASSERT_TRUE(RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled()); |
+ Element* scroller = document().getElementById("scroller"); |
+ PaintLayer* paintLayer = toLayoutBoxModelObject(scroller->layoutObject())->layer(); |
+ ASSERT_TRUE(paintLayer); |
+ DisableCompositingQueryAsserts compositingQueryEnabler; |
chrishtr
2016/08/04 16:35:44
Why do you need this? The lifecycle should be up t
Stephen Chennney
2016/08/04 17:35:25
Artifact of an earlier iteration of the test. Gone
|
+ ASSERT_TRUE(paintLayer->needsCompositedScrolling()); |
+} |
+ |
+TEST_F(PaintLayerScrollableAreaTest, TransparentLayersNotPromoted) |
+{ |
+ RuntimeEnabledFeatures::setCompositeOpaqueScrollersEnabled(true); |
+ |
+ setBodyInnerHTML( |
+ "<style>" |
+ "#scroller { overflow: scroll; height: 300px; width: 300px; background-color: rgba(0,128,0,0.5); }" |
+ "#scrolled { height: 1000px; width: 250px; }" |
+ "</style>" |
+ "<div id=\"scroller\"><div id=\"scrolled\"></div></div>"); |
+ document().view()->updateAllLifecyclePhases(); |
+ |
+ ASSERT_TRUE(RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled()); |
+ Element* scroller = document().getElementById("scroller"); |
+ PaintLayer* paintLayer = toLayoutBoxModelObject(scroller->layoutObject())->layer(); |
+ ASSERT_TRUE(paintLayer); |
+ DisableCompositingQueryAsserts compositingQueryEnabler; |
+ ASSERT_TRUE(!paintLayer->needsCompositedScrolling()); |
+} |
+ |
+} |