OLD | NEW |
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 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" |
10 | 11 |
11 namespace blink { | 12 namespace blink { |
12 | 13 |
13 struct PaintLayerPainterTestParam { | 14 struct PaintLayerPainterTestParam { |
14 PaintLayerPainterTestParam(FrameSettingOverrideFunction frameSettingOverride
, bool slimmingPaintV2) | 15 PaintLayerPainterTestParam(bool rootLayerScrolling, bool slimmingPaintV2) |
15 : frameSettingOverride(frameSettingOverride), slimmingPaintV2(slimmingPa
intV2) { } | 16 : rootLayerScrolling(rootLayerScrolling), slimmingPaintV2(slimmingPaintV
2) { } |
16 | 17 |
17 FrameSettingOverrideFunction frameSettingOverride; | 18 bool rootLayerScrolling; |
18 bool slimmingPaintV2; | 19 bool slimmingPaintV2; |
19 }; | 20 }; |
20 | 21 |
21 class PaintLayerPainterTest | 22 class PaintLayerPainterTest |
22 : public PaintControllerPaintTestBase | 23 : public testing::WithParamInterface<PaintLayerPainterTestParam> |
23 , public testing::WithParamInterface<PaintLayerPainterTestParam> { | 24 , private ScopedRootLayerScrollingForTest |
| 25 , public PaintControllerPaintTestBase { |
24 USING_FAST_MALLOC(PaintLayerPainterTest); | 26 USING_FAST_MALLOC(PaintLayerPainterTest); |
25 public: | 27 public: |
26 PaintLayerPainterTest() : PaintControllerPaintTestBase(GetParam().slimmingPa
intV2) { } | 28 PaintLayerPainterTest() |
27 FrameSettingOverrideFunction settingOverrider() const override { return GetP
aram().frameSettingOverride; } | 29 : ScopedRootLayerScrollingForTest(GetParam().rootLayerScrolling) |
| 30 , PaintControllerPaintTestBase(GetParam().slimmingPaintV2) { } |
28 }; | 31 }; |
29 | 32 |
30 INSTANTIATE_TEST_CASE_P(All, PaintLayerPainterTest, ::testing::Values( | 33 INSTANTIATE_TEST_CASE_P(All, PaintLayerPainterTest, ::testing::Values( |
31 PaintLayerPainterTestParam(nullptr, false), // non-root-layer-scrolls, slimm
ing-paint-v1 | 34 PaintLayerPainterTestParam(false, false), // non-root-layer-scrolls, slimmin
g-paint-v1 |
32 PaintLayerPainterTestParam(nullptr, true), // non-root-layer-scrolls, slimmi
ng-paint-v2 | 35 PaintLayerPainterTestParam(false, true), // non-root-layer-scrolls, slimming
-paint-v2 |
33 PaintLayerPainterTestParam(RootLayerScrollsFrameSettingOverride, false), //
root-layer-scrolls, slimming-paint-v1 | 36 PaintLayerPainterTestParam(true, false), // root-layer-scrolls, slimming-pai
nt-v1 |
34 PaintLayerPainterTestParam(RootLayerScrollsFrameSettingOverride, true))); //
root-layer-scrolls, slimming-paint-v2 | 37 PaintLayerPainterTestParam(true, true))); // root-layer-scrolls, slimming-pa
int-v2 |
35 | 38 |
36 TEST_P(PaintLayerPainterTest, CachedSubsequence) | 39 TEST_P(PaintLayerPainterTest, CachedSubsequence) |
37 { | 40 { |
38 setBodyInnerHTML( | 41 setBodyInnerHTML( |
39 "<div id='container1' style='position: relative; z-index: 1; width: 200p
x; height: 200px; background-color: blue'>" | 42 "<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>" | 43 " <div id='content1' style='position: absolute; width: 100px; height: 1
00px; background-color: red'></div>" |
41 "</div>" | 44 "</div>" |
42 "<div id='container2' style='position: relative; z-index: 1; width: 200p
x; height: 200px; background-color: blue'>" | 45 "<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>" | 46 " <div id='content2' style='position: absolute; width: 100px; height: 1
00px; background-color: green'></div>" |
44 "</div>"); | 47 "</div>"); |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 PaintLayer& layer = *table.layer(); | 528 PaintLayer& layer = *table.layer(); |
526 EXPECT_TRUE(layer.isSelfPaintingLayer()); | 529 EXPECT_TRUE(layer.isSelfPaintingLayer()); |
527 EXPECT_FALSE(layer.needsPaintPhaseDescendantBlockBackgrounds()); | 530 EXPECT_FALSE(layer.needsPaintPhaseDescendantBlockBackgrounds()); |
528 | 531 |
529 toHTMLElement(table.node())->setAttribute(HTMLNames::styleAttr, "position: r
elative; border-collapse: collapse"); | 532 toHTMLElement(table.node())->setAttribute(HTMLNames::styleAttr, "position: r
elative; border-collapse: collapse"); |
530 document().view()->updateAllLifecyclePhases(); | 533 document().view()->updateAllLifecyclePhases(); |
531 EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds()); | 534 EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds()); |
532 } | 535 } |
533 | 536 |
534 } // namespace blink | 537 } // namespace blink |
OLD | NEW |