| 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 23 matching lines...) Expand all Loading... |
| 34 GraphicsLayer::setDrawDebugRedFillForTesting(false); | 34 GraphicsLayer::setDrawDebugRedFillForTesting(false); |
| 35 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(m_enableSlimmingPaintV
2); | 35 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(m_enableSlimmingPaintV
2); |
| 36 } | 36 } |
| 37 void TearDown() override | 37 void TearDown() override |
| 38 { | 38 { |
| 39 RuntimeEnabledFeatures::setSlimmingPaintInvalidationEnabled(m_originalSl
immingPaintInvalidationEnabled); | 39 RuntimeEnabledFeatures::setSlimmingPaintInvalidationEnabled(m_originalSl
immingPaintInvalidationEnabled); |
| 40 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(m_originalSlimmingPain
tV2Enabled); | 40 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(m_originalSlimmingPain
tV2Enabled); |
| 41 GraphicsLayer::setDrawDebugRedFillForTesting(true); | 41 GraphicsLayer::setDrawDebugRedFillForTesting(true); |
| 42 } | 42 } |
| 43 | 43 |
| 44 // Expose some document lifecycle steps for checking new display items befor
e commiting. | |
| 45 void updateLifecyclePhasesBeforePaint() | |
| 46 { | |
| 47 // This doesn't do all steps that FrameView does, but is enough for curr
ent tests. | |
| 48 FrameView* frameView = document().view(); | |
| 49 frameView->updateLifecyclePhasesInternal(FrameView::OnlyUpToCompositingC
leanPlusScrolling); | |
| 50 frameView->invalidateTreeIfNeededRecursive(); | |
| 51 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | |
| 52 document().view()->updatePaintProperties(); | |
| 53 } | |
| 54 | |
| 55 void updateLifecyclePhasesToPaintClean() | |
| 56 { | |
| 57 updateLifecyclePhasesBeforePaint(); | |
| 58 document().view()->synchronizedPaint(); | |
| 59 } | |
| 60 | |
| 61 bool paintWithoutCommit(const IntRect* interestRect = nullptr) | 44 bool paintWithoutCommit(const IntRect* interestRect = nullptr) |
| 62 { | 45 { |
| 63 // Only root graphics layer is supported. | 46 // Only root graphics layer is supported. |
| 64 document().view()->lifecycle().advanceTo(DocumentLifecycle::InPaint); | 47 document().view()->lifecycle().advanceTo(DocumentLifecycle::InPaint); |
| 65 if (!layoutView().layer()->graphicsLayerBacking()->paintWithoutCommit(in
terestRect)) { | 48 if (!layoutView().layer()->graphicsLayerBacking()->paintWithoutCommit(in
terestRect)) { |
| 66 document().view()->lifecycle().advanceTo(DocumentLifecycle::PaintCle
an); | 49 document().view()->lifecycle().advanceTo(DocumentLifecycle::PaintCle
an); |
| 67 return false; | 50 return false; |
| 68 } | 51 } |
| 69 return true; | 52 return true; |
| 70 } | 53 } |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 const DisplayItem::Type backgroundType = DisplayItem::BoxDecorationBackground; | 131 const DisplayItem::Type backgroundType = DisplayItem::BoxDecorationBackground; |
| 149 const DisplayItem::Type cachedBackgroundType = DisplayItem::drawingTypeToCachedD
rawingType(backgroundType); | 132 const DisplayItem::Type cachedBackgroundType = DisplayItem::drawingTypeToCachedD
rawingType(backgroundType); |
| 150 const DisplayItem::Type foregroundType = DisplayItem::paintPhaseToDrawingType(Pa
intPhaseForeground); | 133 const DisplayItem::Type foregroundType = DisplayItem::paintPhaseToDrawingType(Pa
intPhaseForeground); |
| 151 const DisplayItem::Type cachedForegroundType = DisplayItem::drawingTypeToCachedD
rawingType(foregroundType); | 134 const DisplayItem::Type cachedForegroundType = DisplayItem::drawingTypeToCachedD
rawingType(foregroundType); |
| 152 const DisplayItem::Type documentBackgroundType = DisplayItem::DocumentBackground
; | 135 const DisplayItem::Type documentBackgroundType = DisplayItem::DocumentBackground
; |
| 153 const DisplayItem::Type cachedDocumentBackgroundType = DisplayItem::drawingTypeT
oCachedDrawingType(DisplayItem::DocumentBackground); | 136 const DisplayItem::Type cachedDocumentBackgroundType = DisplayItem::drawingTypeT
oCachedDrawingType(DisplayItem::DocumentBackground); |
| 154 | 137 |
| 155 } // namespace blink | 138 } // namespace blink |
| 156 | 139 |
| 157 #endif // PaintControllerPaintTest_h | 140 #endif // PaintControllerPaintTest_h |
| OLD | NEW |