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

Unified Diff: third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp

Issue 1950573003: Improve handling of PaintInvalidationLayer (renamed to PaintInvalidationSubtree) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@LocationChange
Patch Set: Created 4 years, 7 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/layout/PaintInvalidationState.cpp
diff --git a/third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp b/third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp
index 1b53e44ec460467725b8986801a9cf0ea4d389cf..890eee0f79f907b67e2ce33ab9b3aa75f8d91783 100644
--- a/third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp
+++ b/third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp
@@ -29,8 +29,7 @@ static bool supportsCachedOffsets(const LayoutObject& object)
PaintInvalidationState::PaintInvalidationState(const LayoutView& layoutView, Vector<LayoutObject*>& pendingDelayedPaintInvalidations)
: m_currentObject(layoutView)
- , m_forcedSubtreeInvalidationWithinContainer(false)
- , m_forcedSubtreeInvalidationRectUpdateWithinContainer(false)
+ , m_forcedSubtreeInvalidationFlags(0)
, m_clipped(false)
, m_clippedForAbsolutePosition(false)
, m_cachedOffsetsEnabled(true)
@@ -59,8 +58,7 @@ PaintInvalidationState::PaintInvalidationState(const LayoutView& layoutView, Vec
PaintInvalidationState::PaintInvalidationState(const PaintInvalidationState& parentState, const LayoutObject& currentObject)
: m_currentObject(currentObject)
- , m_forcedSubtreeInvalidationWithinContainer(parentState.m_forcedSubtreeInvalidationWithinContainer)
- , m_forcedSubtreeInvalidationRectUpdateWithinContainer(parentState.m_forcedSubtreeInvalidationRectUpdateWithinContainer)
+ , m_forcedSubtreeInvalidationFlags(parentState.m_forcedSubtreeInvalidationFlags)
, m_clipped(parentState.m_clipped)
, m_clippedForAbsolutePosition(parentState.m_clippedForAbsolutePosition)
, m_clipRect(parentState.m_clipRect)
@@ -119,6 +117,8 @@ PaintInvalidationState::PaintInvalidationState(const PaintInvalidationState& par
// descendants if possible; or
// - Track offset between the two paintInvalidationContainers.
m_cachedOffsetsEnabled = false;
+ if (m_forcedSubtreeInvalidationFlags & FullInvalidationForStackedContents)
+ m_forcedSubtreeInvalidationFlags |= FullInvalidation;
}
if (!currentObject.isBoxModelObject() && !currentObject.isSVG())
@@ -144,21 +144,25 @@ PaintInvalidationState::PaintInvalidationState(const PaintInvalidationState& par
// continue forcing a check for paint invalidation, since we're
// descending into a different invalidation container. (For instance if
// our parents were moved, the entire container will just move.)
- m_forcedSubtreeInvalidationWithinContainer = false;
- m_forcedSubtreeInvalidationRectUpdateWithinContainer = false;
-
- if (currentObject == m_paintInvalidationContainerForStackedContents
- && currentObject != m_containerForAbsolutePosition
- && m_cachedOffsetsForAbsolutePositionEnabled
- && m_cachedOffsetsEnabled) {
- // The current object is the new paintInvalidationContainer for absolute-position descendants but is not their container.
- // Call updateForCurrentObject() before resetting m_paintOffset to get paint offset of the current object
- // from the original paintInvalidationContainerForStackingContents, then use this paint offset to adjust
- // m_paintOffsetForAbsolutePosition.
- updateForCurrentObject(parentState);
- m_paintOffsetForAbsolutePosition -= m_paintOffset;
- if (m_clippedForAbsolutePosition)
- m_clipRectForAbsolutePosition.move(-m_paintOffset);
+ if (currentObject != m_paintInvalidationContainerForStackedContents) {
+ // However, we need to keep the FullInvalidationForStackedContents flag
+ // if the current object isn't the paint invalidation container of
+ // stacked contents.
+ m_forcedSubtreeInvalidationFlags &= FullInvalidationForStackedContents;
+ } else {
+ m_forcedSubtreeInvalidationFlags = 0;
+ if (currentObject != m_containerForAbsolutePosition
+ && m_cachedOffsetsForAbsolutePositionEnabled
+ && m_cachedOffsetsEnabled) {
+ // The current object is the new paintInvalidationContainer for absolute-position descendants but is not their container.
+ // Call updateForCurrentObject() before resetting m_paintOffset to get paint offset of the current object
+ // from the original paintInvalidationContainerForStackingContents, then use this paint offset to adjust
+ // m_paintOffsetForAbsolutePosition.
+ updateForCurrentObject(parentState);
+ m_paintOffsetForAbsolutePosition -= m_paintOffset;
+ if (m_clippedForAbsolutePosition)
+ m_clipRectForAbsolutePosition.move(-m_paintOffset);
+ }
}
m_clipped = false; // Will be updated in updateForChildren().
@@ -231,13 +235,27 @@ void PaintInvalidationState::updateForCurrentObject(const PaintInvalidationState
m_paintOffset += toLayoutBoxModelObject(m_currentObject).layer()->offsetForInFlowPosition();
}
-void PaintInvalidationState::updateForChildren()
+void PaintInvalidationState::updateForChildren(PaintInvalidationReason reason)
{
#if ENABLE(ASSERT)
ASSERT(!m_didUpdateForChildren);
m_didUpdateForChildren = true;
#endif
+ switch (reason) {
+ case PaintInvalidationDelayedFull:
+ pushDelayedPaintInvalidationTarget(const_cast<LayoutObject&>(m_currentObject));
+ break;
+ case PaintInvalidationSubtree:
+ m_forcedSubtreeInvalidationFlags |= (FullInvalidation | FullInvalidationForStackedContents);
+ break;
+ case PaintInvalidationSVGResourceChange:
+ setForceSubtreeInvalidationCheckingWithinContainer();
+ break;
+ default:
+ break;
+ }
+
updateForNormalChildren();
if (m_currentObject == m_containerForAbsolutePosition) {

Powered by Google App Engine
This is Rietveld 408576698