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

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

Issue 1739893006: Skip PaintLayer empty paint phases if it previously painted nothing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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 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 5c0990c041a44c675a0abb915cfb1d4cff29073b..c7f325cbb9cc8bcc554ab303d11f0aa4f34505cd 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayer.h
+++ b/third_party/WebKit/Source/core/paint/PaintLayer.h
@@ -669,16 +669,36 @@ 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.
- bool needsPaintPhaseDescendantOutlines() const { return m_needsPaintPhaseDescendantOutlines; }
- void setNeedsPaintPhaseDescendantOutlines() { ASSERT(isSelfPaintingLayer()); m_needsPaintPhaseDescendantOutlines = true; }
+ // 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.
+ bool needsPaintPhaseDescendantOutlines() const { return m_needsPaintPhaseDescendantOutlines && !m_previousPaintPhaseDescendantOutlinesWasEmpty; }
+ void setNeedsPaintPhaseDescendantOutlines()
+ {
+ ASSERT(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()
+ {
+ ASSERT(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()
+ {
+ ASSERT(isSelfPaintingLayer());
+ m_needsPaintPhaseDescendantBlockBackgrounds = true;
+ m_previousPaintPhaseDescendantBlockBackgroundsWasEmpty = false;
+ }
+ void setPreviousPaintPhaseDescendantBlockBackgroundsEmpty(bool isEmpty) { m_previousPaintPhaseDescendantBlockBackgroundsWasEmpty = isEmpty; }
PaintTiming* paintTiming();
@@ -827,8 +847,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;
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.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