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

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayer.h

Issue 2285633005: Reland of Skip PaintLayer empty paint phases if it previously painted nothing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/paint/PaintLayer.h
diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.h b/third_party/WebKit/Source/core/paint/PaintLayer.h
index d003945cf4f18d84301a29ab3fa3d2d1ac88a7ab..30cad3431d944a215956dc8a5ce42586afecf690 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayer.h
+++ b/third_party/WebKit/Source/core/paint/PaintLayer.h
@@ -681,17 +681,37 @@ public:
void setPreviousPaintResult(PaintLayerPainter::PaintResult result) { m_previousPaintResult = static_cast<unsigned>(result); ASSERT(m_previousPaintResult == static_cast<unsigned>(result)); }
// Used to skip PaintPhaseDescendantOutlinesOnly for layers that have never had descendant outlines.
- // Once it's set we never clear it because it's not easy to track if all outlines have been removed.
+ // The flag is set during paint invalidation on a self painting layer if any contained object has outline.
+ // It's cleared during painting if PaintPhaseDescendantOutlinesOnly painted nothing.
// For more details, see core/paint/REAME.md#Empty paint phase optimization.
- bool needsPaintPhaseDescendantOutlines() const { return m_needsPaintPhaseDescendantOutlines; }
- void setNeedsPaintPhaseDescendantOutlines() { ASSERT(isSelfPaintingLayer()); m_needsPaintPhaseDescendantOutlines = true; }
+ bool needsPaintPhaseDescendantOutlines() const { return m_needsPaintPhaseDescendantOutlines && !m_previousPaintPhaseDescendantOutlinesWasEmpty; }
+ void setNeedsPaintPhaseDescendantOutlines()
+ {
+ DCHECK(isSelfPaintingLayer());
+ m_needsPaintPhaseDescendantOutlines = true;
+ m_previousPaintPhaseDescendantOutlinesWasEmpty = false;
+ }
+ void setPreviousPaintPhaseDescendantOutlinesEmpty(bool isEmpty) { m_previousPaintPhaseDescendantOutlinesWasEmpty = isEmpty; }
// Similar to above, but for PaintPhaseFloat.
- bool needsPaintPhaseFloat() const { return m_needsPaintPhaseFloat; }
- void setNeedsPaintPhaseFloat() { ASSERT(isSelfPaintingLayer()); m_needsPaintPhaseFloat = true; }
+ bool needsPaintPhaseFloat() const { return m_needsPaintPhaseFloat && !m_previousPaintPhaseFloatWasEmpty; }
+ void setNeedsPaintPhaseFloat()
+ {
+ DCHECK(isSelfPaintingLayer());
+ m_needsPaintPhaseFloat = true;
+ m_previousPaintPhaseFloatWasEmpty = false;
+ }
+ void setPreviousPaintPhaseFloatEmpty(bool isEmpty) { m_previousPaintPhaseFloatWasEmpty= isEmpty; }
- bool needsPaintPhaseDescendantBlockBackgrounds() const { return m_needsPaintPhaseDescendantBlockBackgrounds; }
- void setNeedsPaintPhaseDescendantBlockBackgrounds() { ASSERT(isSelfPaintingLayer()); m_needsPaintPhaseDescendantBlockBackgrounds = true; }
+ // Similar to above, but for PaintPhaseDescendantBlockBackgroundsOnly.
+ bool needsPaintPhaseDescendantBlockBackgrounds() const { return m_needsPaintPhaseDescendantBlockBackgrounds && !m_previousPaintPhaseDescendantBlockBackgroundsWasEmpty; }
+ void setNeedsPaintPhaseDescendantBlockBackgrounds()
+ {
+ DCHECK(isSelfPaintingLayer());
+ m_needsPaintPhaseDescendantBlockBackgrounds = true;
+ m_previousPaintPhaseDescendantBlockBackgroundsWasEmpty = false;
+ }
+ void setPreviousPaintPhaseDescendantBlockBackgroundsEmpty(bool isEmpty) { m_previousPaintPhaseDescendantBlockBackgroundsWasEmpty = isEmpty; }
PaintTiming* paintTiming();
@@ -851,8 +871,11 @@ private:
unsigned m_previousPaintResult : 1; // PaintLayerPainter::PaintResult
unsigned m_needsPaintPhaseDescendantOutlines : 1;
+ unsigned m_previousPaintPhaseDescendantOutlinesWasEmpty : 1;
unsigned m_needsPaintPhaseFloat : 1;
+ unsigned m_previousPaintPhaseFloatWasEmpty : 1;
unsigned m_needsPaintPhaseDescendantBlockBackgrounds : 1;
+ unsigned m_previousPaintPhaseDescendantBlockBackgroundsWasEmpty : 1;
// These bitfields are part of ancestor/descendant dependent compositing inputs.
unsigned m_hasDescendantWithClipPath : 1;

Powered by Google App Engine
This is Rietveld 408576698