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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintControllerPaintTest.h

Issue 1391753005: (WIP) Invalidation during painting (for synchronized painting) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 #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"
11 #include "core/paint/PaintLayer.h" 11 #include "core/paint/PaintLayer.h"
12 #include "platform/graphics/GraphicsContext.h" 12 #include "platform/graphics/GraphicsContext.h"
13 #include "platform/graphics/GraphicsLayer.h" 13 #include "platform/graphics/GraphicsLayer.h"
14 #include <gtest/gtest.h> 14 #include <gtest/gtest.h>
15 15
16 namespace blink { 16 namespace blink {
17 17
18 class PaintControllerPaintTestBase : public RenderingTest { 18 class PaintControllerPaintTestBase : public RenderingTest {
19 public: 19 public:
20 PaintControllerPaintTestBase(bool enableSlimmingPaintV2) 20 PaintControllerPaintTestBase(bool enableSlimmingPaintV2)
21 : m_originalSlimmingPaintOffsetCachingEnabled(RuntimeEnabledFeatures::sl immingPaintOffsetCachingEnabled()) 21 : m_originalSlimmingPaintV2Enabled(RuntimeEnabledFeatures::slimmingPaint V2Enabled())
22 , m_originalSlimmingPaintV2Enabled(RuntimeEnabledFeatures::slimmingPaint V2Enabled())
23 , m_enableSlimmingPaintV2(enableSlimmingPaintV2) 22 , m_enableSlimmingPaintV2(enableSlimmingPaintV2)
24 { } 23 { }
25 24
26 protected: 25 protected:
27 LayoutView& layoutView() { return *document().layoutView(); } 26 LayoutView& layoutView() { return *document().layoutView(); }
28 PaintController& rootPaintController() { return layoutView().layer()->graphi csLayerBacking()->paintController(); } 27 PaintController& rootPaintController() { return layoutView().layer()->graphi csLayerBacking()->paintController(); }
29 28
30 void SetUp() override 29 void SetUp() override
31 { 30 {
32 RenderingTest::SetUp(); 31 RenderingTest::SetUp();
33 enableCompositing(); 32 enableCompositing();
34 GraphicsLayer::setDrawDebugRedFillForTesting(false); 33 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::setSlimmingPaintOffsetCachingEnabled(m_originalS limmingPaintOffsetCachingEnabled);
40 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(m_originalSlimmingPain tV2Enabled); 38 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(m_originalSlimmingPain tV2Enabled);
41 GraphicsLayer::setDrawDebugRedFillForTesting(true); 39 GraphicsLayer::setDrawDebugRedFillForTesting(true);
42 } 40 }
43 41
44 // Expose some document lifecycle steps for checking new display items befor e commiting. 42 // Expose some document lifecycle steps for checking new display items befor e commiting.
45 void updateLifecyclePhasesBeforePaint() 43 void updateLifecyclePhasesBeforePaint()
46 { 44 {
47 // This doesn't do all steps that FrameView does, but is enough for curr ent tests. 45 // This doesn't do all steps that FrameView does, but is enough for curr ent tests.
48 FrameView* frameView = document().view(); 46 FrameView* frameView = document().view();
49 frameView->updateLifecyclePhasesInternal(FrameView::OnlyUpToCompositingC leanPlusScrolling); 47 frameView->updateLifecyclePhasesInternal(FrameView::OnlyUpToCompositingC leanPlusScrolling);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 bool displayItemListContains(const DisplayItemList& displayItemList, Display ItemClient& client, DisplayItem::Type type) 84 bool displayItemListContains(const DisplayItemList& displayItemList, Display ItemClient& client, DisplayItem::Type type)
87 { 85 {
88 for (auto& item : displayItemList) { 86 for (auto& item : displayItemList) {
89 if (item.client() == client && item.type() == type) 87 if (item.client() == client && item.type() == type)
90 return true; 88 return true;
91 } 89 }
92 return false; 90 return false;
93 } 91 }
94 92
95 private: 93 private:
96 bool m_originalSlimmingPaintOffsetCachingEnabled;
97 bool m_originalSlimmingPaintV2Enabled; 94 bool m_originalSlimmingPaintV2Enabled;
98 bool m_enableSlimmingPaintV2; 95 bool m_enableSlimmingPaintV2;
99 }; 96 };
100 97
101 class PaintControllerPaintTest : public PaintControllerPaintTestBase { 98 class PaintControllerPaintTest : public PaintControllerPaintTestBase {
102 public: 99 public:
103 PaintControllerPaintTest() : PaintControllerPaintTestBase(false) { } 100 PaintControllerPaintTest() : PaintControllerPaintTestBase(false) { }
104 }; 101 };
105 102
106 class PaintControllerPaintTestForSlimmingPaintV2 : public PaintControllerPaintTe stBase { 103 class PaintControllerPaintTestForSlimmingPaintV2 : public PaintControllerPaintTe stBase {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 const DisplayItem::Type backgroundType = DisplayItem::BoxDecorationBackground; 145 const DisplayItem::Type backgroundType = DisplayItem::BoxDecorationBackground;
149 const DisplayItem::Type cachedBackgroundType = DisplayItem::drawingTypeToCachedD rawingType(backgroundType); 146 const DisplayItem::Type cachedBackgroundType = DisplayItem::drawingTypeToCachedD rawingType(backgroundType);
150 const DisplayItem::Type foregroundType = DisplayItem::paintPhaseToDrawingType(Pa intPhaseForeground); 147 const DisplayItem::Type foregroundType = DisplayItem::paintPhaseToDrawingType(Pa intPhaseForeground);
151 const DisplayItem::Type cachedForegroundType = DisplayItem::drawingTypeToCachedD rawingType(foregroundType); 148 const DisplayItem::Type cachedForegroundType = DisplayItem::drawingTypeToCachedD rawingType(foregroundType);
152 const DisplayItem::Type documentBackgroundType = DisplayItem::DocumentBackground ; 149 const DisplayItem::Type documentBackgroundType = DisplayItem::DocumentBackground ;
153 const DisplayItem::Type cachedDocumentBackgroundType = DisplayItem::drawingTypeT oCachedDrawingType(DisplayItem::DocumentBackground); 150 const DisplayItem::Type cachedDocumentBackgroundType = DisplayItem::drawingTypeT oCachedDrawingType(DisplayItem::DocumentBackground);
154 151
155 } // namespace blink 152 } // namespace blink
156 153
157 #endif // PaintControllerPaintTest_h 154 #endif // PaintControllerPaintTest_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/ObjectPainter.cpp ('k') | third_party/WebKit/Source/core/paint/PaintLayer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698