Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(687)

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayerScrollableAreaTest.cpp

Issue 1826013002: Enable compositing for opaque scrolling content on low DPI screens (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix date (for real this time) Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..f11b78585bf5bbf4aa33df3d6d844357746ec8e4
--- /dev/null
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableAreaTest.cpp
@@ -0,0 +1,47 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// 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);
+ 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);
+ ASSERT_TRUE(!paintLayer->needsCompositedScrolling());
+}
+
+}

Powered by Google App Engine
This is Rietveld 408576698