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 PaintControllerPaintTest_h | 5 #ifndef PaintControllerPaintTest_h |
6 #define PaintControllerPaintTest_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" |
(...skipping 13 matching lines...) Expand all Loading... |
24 { } | 24 { } |
25 | 25 |
26 protected: | 26 protected: |
27 LayoutView& layoutView() { return *document().layoutView(); } | 27 LayoutView& layoutView() { return *document().layoutView(); } |
28 PaintController& rootPaintController() { return layoutView().layer()->graphi
csLayerBacking()->getPaintController(); } | 28 PaintController& rootPaintController() { return layoutView().layer()->graphi
csLayerBacking()->getPaintController(); } |
29 | 29 |
30 void SetUp() override | 30 void SetUp() override |
31 { | 31 { |
32 RenderingTest::SetUp(); | 32 RenderingTest::SetUp(); |
33 enableCompositing(); | 33 enableCompositing(); |
34 GraphicsLayer::setDrawDebugRedFillForTesting(false); | |
35 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(m_enableSlimmingPaintV
2); | 34 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(m_enableSlimmingPaintV
2); |
36 } | 35 } |
37 void TearDown() override | 36 void TearDown() override |
38 { | 37 { |
39 RuntimeEnabledFeatures::setSlimmingPaintInvalidationEnabled(m_originalSl
immingPaintInvalidationEnabled); | 38 RuntimeEnabledFeatures::setSlimmingPaintInvalidationEnabled(m_originalSl
immingPaintInvalidationEnabled); |
40 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(m_originalSlimmingPain
tV2Enabled); | 39 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(m_originalSlimmingPain
tV2Enabled); |
41 GraphicsLayer::setDrawDebugRedFillForTesting(true); | |
42 } | 40 } |
43 | 41 |
44 bool paintWithoutCommit(const IntRect* interestRect = nullptr) | 42 bool paintWithoutCommit(const IntRect* interestRect = nullptr) |
45 { | 43 { |
46 // Only root graphics layer is supported. | 44 // Only root graphics layer is supported. |
47 document().view()->lifecycle().advanceTo(DocumentLifecycle::InPaint); | 45 document().view()->lifecycle().advanceTo(DocumentLifecycle::InPaint); |
48 if (!layoutView().layer()->graphicsLayerBacking()->paintWithoutCommit(in
terestRect)) { | 46 if (!layoutView().layer()->graphicsLayerBacking()->paintWithoutCommit(in
terestRect)) { |
49 document().view()->lifecycle().advanceTo(DocumentLifecycle::PaintCle
an); | 47 document().view()->lifecycle().advanceTo(DocumentLifecycle::PaintCle
an); |
50 return false; | 48 return false; |
51 } | 49 } |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 } while (false); | 128 } while (false); |
131 | 129 |
132 // Shorter names for frequently used display item types in tests. | 130 // Shorter names for frequently used display item types in tests. |
133 const DisplayItem::Type backgroundType = DisplayItem::BoxDecorationBackground; | 131 const DisplayItem::Type backgroundType = DisplayItem::BoxDecorationBackground; |
134 const DisplayItem::Type foregroundType = DisplayItem::paintPhaseToDrawingType(Pa
intPhaseForeground); | 132 const DisplayItem::Type foregroundType = DisplayItem::paintPhaseToDrawingType(Pa
intPhaseForeground); |
135 const DisplayItem::Type documentBackgroundType = DisplayItem::DocumentBackground
; | 133 const DisplayItem::Type documentBackgroundType = DisplayItem::DocumentBackground
; |
136 | 134 |
137 } // namespace blink | 135 } // namespace blink |
138 | 136 |
139 #endif // PaintControllerPaintTest_h | 137 #endif // PaintControllerPaintTest_h |
OLD | NEW |