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 #ifndef DisplayItemListPaintTest_h | 5 #ifndef PaintControllerPaintTest_h |
6 #define DisplayItemListPaintTest_h | 6 #define PaintControllerPaintTest_h |
7 | 7 |
8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
9 #include "core/layout/LayoutTestHelper.h" | 9 #include "core/layout/LayoutTestHelper.h" |
10 #include "core/layout/LayoutView.h" | 10 #include "core/layout/LayoutView.h" |
11 #include "core/paint/PaintLayer.h" | 11 #include "core/paint/PaintLayer.h" |
12 #include "platform/graphics/GraphicsLayer.h" | 12 #include "platform/graphics/GraphicsLayer.h" |
13 #include <gtest/gtest.h> | 13 #include <gtest/gtest.h> |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 class DisplayItemListPaintTest : public RenderingTest { | 17 class PaintControllerPaintTest : public RenderingTest { |
18 public: | 18 public: |
19 DisplayItemListPaintTest() | 19 PaintControllerPaintTest() |
20 : m_originalSlimmingPaintSubsequenceCachingEnabled(RuntimeEnabledFeature
s::slimmingPaintSubsequenceCachingEnabled()) | 20 : m_originalSlimmingPaintSubsequenceCachingEnabled(RuntimeEnabledFeature
s::slimmingPaintSubsequenceCachingEnabled()) |
21 , m_originalSlimmingPaintOffsetCachingEnabled(RuntimeEnabledFeatures::sl
immingPaintOffsetCachingEnabled()) | 21 , m_originalSlimmingPaintOffsetCachingEnabled(RuntimeEnabledFeatures::sl
immingPaintOffsetCachingEnabled()) |
22 { } | 22 { } |
23 | 23 |
24 protected: | 24 protected: |
25 LayoutView& layoutView() { return *document().layoutView(); } | 25 LayoutView& layoutView() { return *document().layoutView(); } |
26 DisplayItemList& rootDisplayItemList() { return *layoutView().layer()->graph
icsLayerBacking()->displayItemList(); } | 26 PaintController& rootPaintController() { return *layoutView().layer()->graph
icsLayerBacking()->paintController(); } |
27 | 27 |
28 private: | 28 private: |
29 void SetUp() override | 29 void SetUp() override |
30 { | 30 { |
31 RenderingTest::SetUp(); | 31 RenderingTest::SetUp(); |
32 enableCompositing(); | 32 enableCompositing(); |
33 } | 33 } |
34 void TearDown() override | 34 void TearDown() override |
35 { | 35 { |
36 RuntimeEnabledFeatures::setSlimmingPaintSubsequenceCachingEnabled(m_orig
inalSlimmingPaintSubsequenceCachingEnabled); | 36 RuntimeEnabledFeatures::setSlimmingPaintSubsequenceCachingEnabled(m_orig
inalSlimmingPaintSubsequenceCachingEnabled); |
37 RuntimeEnabledFeatures::setSlimmingPaintOffsetCachingEnabled(m_originalS
limmingPaintOffsetCachingEnabled); | 37 RuntimeEnabledFeatures::setSlimmingPaintOffsetCachingEnabled(m_originalS
limmingPaintOffsetCachingEnabled); |
38 } | 38 } |
39 | 39 |
40 bool m_originalSlimmingPaintSubsequenceCachingEnabled; | 40 bool m_originalSlimmingPaintSubsequenceCachingEnabled; |
41 bool m_originalSlimmingPaintOffsetCachingEnabled; | 41 bool m_originalSlimmingPaintOffsetCachingEnabled; |
42 }; | 42 }; |
43 | 43 |
44 // Slimming paint v2 has subtly different behavior on some paint tests. This | 44 // Slimming paint v2 has subtly different behavior on some paint tests. This |
45 // class is used to test only v2 behavior while maintaining v1 test coverage. | 45 // class is used to test only v2 behavior while maintaining v1 test coverage. |
46 class DisplayItemListPaintTestForSlimmingPaintV2 : public RenderingTest { | 46 class PaintControllerPaintTestForSlimmingPaintV2 : public RenderingTest { |
47 public: | 47 public: |
48 DisplayItemListPaintTestForSlimmingPaintV2() | 48 PaintControllerPaintTestForSlimmingPaintV2() |
49 : m_originalSlimmingPaintV2Enabled(RuntimeEnabledFeatures::slimmingPaint
V2Enabled()) { } | 49 : m_originalSlimmingPaintV2Enabled(RuntimeEnabledFeatures::slimmingPaint
V2Enabled()) { } |
50 | 50 |
51 protected: | 51 protected: |
52 LayoutView& layoutView() { return *document().layoutView(); } | 52 LayoutView& layoutView() { return *document().layoutView(); } |
53 DisplayItemList& rootDisplayItemList() { return *layoutView().layer()->graph
icsLayerBacking()->displayItemList(); } | 53 PaintController& rootPaintController() { return *layoutView().layer()->graph
icsLayerBacking()->paintController(); } |
54 void setNeedsDisplayForRoot() | 54 void setNeedsDisplayForRoot() |
55 { | 55 { |
56 layoutView().layer()->graphicsLayerBacking()->setNeedsDisplay(); | 56 layoutView().layer()->graphicsLayerBacking()->setNeedsDisplay(); |
57 } | 57 } |
58 void setNeedsDisplayWithoutInvalidationForRoot() | 58 void setNeedsDisplayWithoutInvalidationForRoot() |
59 { | 59 { |
60 layoutView().layer()->graphicsLayerBacking()->setNeedsDisplayWithoutInva
lidateForTesting(); | 60 layoutView().layer()->graphicsLayerBacking()->setNeedsDisplayWithoutInva
lidateForTesting(); |
61 } | 61 } |
62 | 62 |
63 // Expose some document lifecycle steps for checking new display items befor
e commiting. | 63 // Expose some document lifecycle steps for checking new display items befor
e commiting. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 const DisplayItem::Type backgroundType = DisplayItem::BoxDecorationBackground; | 122 const DisplayItem::Type backgroundType = DisplayItem::BoxDecorationBackground; |
123 const DisplayItem::Type cachedBackgroundType = DisplayItem::drawingTypeToCachedD
rawingType(backgroundType); | 123 const DisplayItem::Type cachedBackgroundType = DisplayItem::drawingTypeToCachedD
rawingType(backgroundType); |
124 const DisplayItem::Type foregroundType = DisplayItem::paintPhaseToDrawingType(Pa
intPhaseForeground); | 124 const DisplayItem::Type foregroundType = DisplayItem::paintPhaseToDrawingType(Pa
intPhaseForeground); |
125 const DisplayItem::Type cachedForegroundType = DisplayItem::drawingTypeToCachedD
rawingType(foregroundType); | 125 const DisplayItem::Type cachedForegroundType = DisplayItem::drawingTypeToCachedD
rawingType(foregroundType); |
126 const DisplayItem::Type subsequenceType = DisplayItem::SubsequenceNormalFlowAndP
ositiveZOrder; | 126 const DisplayItem::Type subsequenceType = DisplayItem::SubsequenceNormalFlowAndP
ositiveZOrder; |
127 const DisplayItem::Type endSubsequenceType = DisplayItem::subsequenceTypeToEndSu
bsequenceType(subsequenceType); | 127 const DisplayItem::Type endSubsequenceType = DisplayItem::subsequenceTypeToEndSu
bsequenceType(subsequenceType); |
128 const DisplayItem::Type cachedSubsequenceType = DisplayItem::subsequenceTypeToCa
chedSubsequenceType(subsequenceType); | 128 const DisplayItem::Type cachedSubsequenceType = DisplayItem::subsequenceTypeToCa
chedSubsequenceType(subsequenceType); |
129 | 129 |
130 } // namespace blink | 130 } // namespace blink |
131 | 131 |
132 #endif // DisplayItemListPaintTest_h | 132 #endif // PaintControllerPaintTest_h |
OLD | NEW |