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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp

Issue 2258523006: Convert Settings::rootLayerScrolls to RuntimeEnabledFeatures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase & fix mistake Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/layout/LayoutBlock.h" 5 #include "core/layout/LayoutBlock.h"
6 #include "core/layout/LayoutInline.h" 6 #include "core/layout/LayoutInline.h"
7 #include "core/layout/compositing/CompositedLayerMapping.h" 7 #include "core/layout/compositing/CompositedLayerMapping.h"
8 #include "core/paint/PaintControllerPaintTest.h" 8 #include "core/paint/PaintControllerPaintTest.h"
9 #include "platform/graphics/GraphicsContext.h" 9 #include "platform/graphics/GraphicsContext.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 struct PaintLayerPainterTestParam { 13 struct PaintLayerPainterTestParam {
14 PaintLayerPainterTestParam(FrameSettingOverrideFunction frameSettingOverride , bool slimmingPaintV2) 14 PaintLayerPainterTestParam(bool rootLayerScrolling, bool slimmingPaintV2)
15 : frameSettingOverride(frameSettingOverride), slimmingPaintV2(slimmingPa intV2) { } 15 : rootLayerScrolling(rootLayerScrolling), slimmingPaintV2(slimmingPaintV 2) { }
16 16
17 FrameSettingOverrideFunction frameSettingOverride; 17 bool rootLayerScrolling;
18 bool slimmingPaintV2; 18 bool slimmingPaintV2;
19 }; 19 };
20 20
21 class PaintLayerPainterTest 21 class PaintLayerPainterTest
22 : public PaintControllerPaintTestBase 22 : public PaintControllerPaintTestBase
23 , public testing::WithParamInterface<PaintLayerPainterTestParam> { 23 , public testing::WithParamInterface<PaintLayerPainterTestParam> {
24 USING_FAST_MALLOC(PaintLayerPainterTest); 24 USING_FAST_MALLOC(PaintLayerPainterTest);
25 public: 25 public:
26 PaintLayerPainterTest() : PaintControllerPaintTestBase(GetParam().slimmingPa intV2) { } 26 PaintLayerPainterTest()
27 FrameSettingOverrideFunction settingOverrider() const override { return GetP aram().frameSettingOverride; } 27 : PaintControllerPaintTestBase(GetParam().slimmingPaintV2)
28 , m_originalRootLayerScrollingEnabled(RuntimeEnabledFeatures::rootLayerS crollingEnabled())
29 , m_enableRootLayerScrolling(GetParam().rootLayerScrolling)
30 {
31 RuntimeEnabledFeatures::setRootLayerScrollingEnabled(m_enableRootLayerSc rolling);
32 }
33
34 ~PaintLayerPainterTest()
35 {
36 CHECK_EQ(m_enableRootLayerScrolling, RuntimeEnabledFeatures::rootLayerSc rollingEnabled());
37 RuntimeEnabledFeatures::setRootLayerScrollingEnabled(m_originalRootLayer ScrollingEnabled);
38 }
39
40 private:
41 bool m_originalRootLayerScrollingEnabled;
42 bool m_enableRootLayerScrolling;
28 }; 43 };
29 44
30 INSTANTIATE_TEST_CASE_P(All, PaintLayerPainterTest, ::testing::Values( 45 INSTANTIATE_TEST_CASE_P(All, PaintLayerPainterTest, ::testing::Values(
31 PaintLayerPainterTestParam(nullptr, false), // non-root-layer-scrolls, slimm ing-paint-v1 46 PaintLayerPainterTestParam(false, false), // non-root-layer-scrolls, slimmin g-paint-v1
32 PaintLayerPainterTestParam(nullptr, true), // non-root-layer-scrolls, slimmi ng-paint-v2 47 PaintLayerPainterTestParam(false, true), // non-root-layer-scrolls, slimming -paint-v2
33 PaintLayerPainterTestParam(RootLayerScrollsFrameSettingOverride, false), // root-layer-scrolls, slimming-paint-v1 48 PaintLayerPainterTestParam(true, false), // root-layer-scrolls, slimming-pai nt-v1
34 PaintLayerPainterTestParam(RootLayerScrollsFrameSettingOverride, true))); // root-layer-scrolls, slimming-paint-v2 49 PaintLayerPainterTestParam(true, true))); // root-layer-scrolls, slimming-pa int-v2
35 50
36 TEST_P(PaintLayerPainterTest, CachedSubsequence) 51 TEST_P(PaintLayerPainterTest, CachedSubsequence)
37 { 52 {
38 setBodyInnerHTML( 53 setBodyInnerHTML(
39 "<div id='container1' style='position: relative; z-index: 1; width: 200p x; height: 200px; background-color: blue'>" 54 "<div id='container1' style='position: relative; z-index: 1; width: 200p x; height: 200px; background-color: blue'>"
40 " <div id='content1' style='position: absolute; width: 100px; height: 1 00px; background-color: red'></div>" 55 " <div id='content1' style='position: absolute; width: 100px; height: 1 00px; background-color: red'></div>"
41 "</div>" 56 "</div>"
42 "<div id='container2' style='position: relative; z-index: 1; width: 200p x; height: 200px; background-color: blue'>" 57 "<div id='container2' style='position: relative; z-index: 1; width: 200p x; height: 200px; background-color: blue'>"
43 " <div id='content2' style='position: absolute; width: 100px; height: 1 00px; background-color: green'></div>" 58 " <div id='content2' style='position: absolute; width: 100px; height: 1 00px; background-color: green'></div>"
44 "</div>"); 59 "</div>");
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 PaintLayer& layer = *table.layer(); 540 PaintLayer& layer = *table.layer();
526 EXPECT_TRUE(layer.isSelfPaintingLayer()); 541 EXPECT_TRUE(layer.isSelfPaintingLayer());
527 EXPECT_FALSE(layer.needsPaintPhaseDescendantBlockBackgrounds()); 542 EXPECT_FALSE(layer.needsPaintPhaseDescendantBlockBackgrounds());
528 543
529 toHTMLElement(table.node())->setAttribute(HTMLNames::styleAttr, "position: r elative; border-collapse: collapse"); 544 toHTMLElement(table.node())->setAttribute(HTMLNames::styleAttr, "position: r elative; border-collapse: collapse");
530 document().view()->updateAllLifecyclePhases(); 545 document().view()->updateAllLifecyclePhases();
531 EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds()); 546 EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds());
532 } 547 }
533 548
534 } // namespace blink 549 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698