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

Unified Diff: third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp

Issue 2841603003: Record non-stacking-context as main thread scrolling reasons (Closed)
Patch Set: nit Created 3 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/web/tests/ScrollMetricsTest.cpp ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp b/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp
index bf8143fa7e096a1c27d66beda492e081dd8451d7..821f9e3cbac3751bc81e7b5b5da8fee2a3906a1b 100644
--- a/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp
+++ b/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp
@@ -1052,7 +1052,8 @@ class NonCompositedMainThreadScrollingReasonTest
static const uint32_t kLCDTextRelatedReasons =
MainThreadScrollingReason::kHasOpacityAndLCDText |
MainThreadScrollingReason::kHasTransformAndLCDText |
- MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText;
+ MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText |
+ MainThreadScrollingReason::kIsNotStackingContextAndLCDText;
protected:
NonCompositedMainThreadScrollingReasonTest() {
@@ -1207,6 +1208,35 @@ TEST_P(NonCompositedMainThreadScrollingReasonTest, BoxShadowTest) {
"box-shadow", MainThreadScrollingReason::kHasBoxShadowFromNonRootLayer);
}
+TEST_P(NonCompositedMainThreadScrollingReasonTest, StackingContextTest) {
+ GetWebViewImpl()->GetSettings()->SetPreferCompositingToLCDTextEnabled(false);
+
+ Document* document = GetFrame()->GetDocument();
+ Element* container = document->getElementById("scroller1");
+ ASSERT_TRUE(container);
+
+ ForceFullCompositingUpdate();
+
+ // If a scroller contains all its children, it's not a stacking context.
+ PaintLayerScrollableArea* scrollable_area =
+ ToLayoutBoxModelObject(container->GetLayoutObject())->GetScrollableArea();
+ ASSERT_TRUE(scrollable_area);
+ EXPECT_TRUE(scrollable_area->GetNonCompositedMainThreadScrollingReasons() &
+ MainThreadScrollingReason::kIsNotStackingContextAndLCDText);
+
+ GetWebViewImpl()->GetSettings()->SetPreferCompositingToLCDTextEnabled(true);
+ ForceFullCompositingUpdate();
+ EXPECT_FALSE(scrollable_area->GetNonCompositedMainThreadScrollingReasons() &
+ MainThreadScrollingReason::kIsNotStackingContextAndLCDText);
+ GetWebViewImpl()->GetSettings()->SetPreferCompositingToLCDTextEnabled(false);
+
+ // Adding "contain: paint" to force a stacking context leads to promotion.
+ container->setAttribute("style", "contain: paint", ASSERT_NO_EXCEPTION);
+ ForceFullCompositingUpdate();
+
+ EXPECT_FALSE(scrollable_area->GetNonCompositedMainThreadScrollingReasons());
+}
+
TEST_P(NonCompositedMainThreadScrollingReasonTest,
CompositedWithLCDTextRelatedReasonsTest) {
// With "will-change:transform" we composite elements with
« no previous file with comments | « third_party/WebKit/Source/web/tests/ScrollMetricsTest.cpp ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698