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

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

Issue 2751523011: Reland of Add 'WithoutGeometryChange' variants of paint invalidation flag setters (Closed)
Patch Set: Fix Created 3 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/layout/LayoutObject.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
index 2f058262c0a0d371c51b23bfe4bf2b2716997f83..f1a02b92ae994f4d8b3b39d222de81e8fa5572c3 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
@@ -1624,6 +1624,7 @@ void LayoutObject::markAncestorsForOverflowRecalcIfNeeded() {
void LayoutObject::setNeedsOverflowRecalcAfterStyleChange() {
bool neededRecalc = needsOverflowRecalcAfterStyleChange();
setSelfNeedsOverflowRecalcAfterStyleChange();
+ setMayNeedPaintInvalidation();
if (!neededRecalc)
markAncestorsForOverflowRecalcIfNeeded();
}
@@ -1723,11 +1724,17 @@ void LayoutObject::setStyle(PassRefPtr<ComputedStyle> style) {
}
if (diff.needsPaintInvalidationSubtree() ||
- updatedDiff.needsPaintInvalidationSubtree())
+ updatedDiff.needsPaintInvalidationSubtree()) {
setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants();
- else if (diff.needsPaintInvalidationObject() ||
- updatedDiff.needsPaintInvalidationObject())
- setShouldDoFullPaintInvalidation();
+ } else if (diff.needsPaintInvalidationObject() ||
+ updatedDiff.needsPaintInvalidationObject()) {
+ // TODO(wangxianzhu): For now LayoutSVGRoot::localVisualRect() depends on
+ // several styles. Refactor to avoid this special case.
+ if (isSVGRoot())
+ setShouldDoFullPaintInvalidation();
+ else
+ setShouldDoFullPaintInvalidationWithoutGeometryChange();
+ }
// Text nodes share style with their parents but the paint properties don't
// apply to them, hence the !isText() check.
@@ -3409,14 +3416,24 @@ inline void LayoutObject::markAncestorsForPaintInvalidation() {
for (LayoutObject* parent = this->paintInvalidationParent();
parent && !parent->shouldCheckForPaintInvalidation();
parent = parent->paintInvalidationParent())
- parent->m_bitfields.setChildShouldCheckForPaintInvalidation(true);
+ parent->m_bitfields.setMayNeedPaintInvalidation(true);
+}
+
+inline void LayoutObject::setNeedsPaintOffsetAndVisualRectUpdate() {
+ if (needsPaintOffsetAndVisualRectUpdate())
+ return;
+ m_bitfields.setNeedsPaintOffsetAndVisualRectUpdate(true);
+ for (LayoutObject* parent = paintInvalidationParent();
+ parent && !parent->needsPaintOffsetAndVisualRectUpdate();
+ parent = parent->paintInvalidationParent())
+ parent->m_bitfields.setNeedsPaintOffsetAndVisualRectUpdate(true);
}
void LayoutObject::setShouldInvalidateSelection() {
if (!canUpdateSelectionOnRootLineBoxes())
return;
m_bitfields.setShouldInvalidateSelection(true);
- markAncestorsForPaintInvalidation();
+ setMayNeedPaintInvalidation();
frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded();
}
@@ -3428,8 +3445,14 @@ bool LayoutObject::shouldCheckForPaintInvalidationWithPaintInvalidationState(
void LayoutObject::setShouldDoFullPaintInvalidation(
PaintInvalidationReason reason) {
+ setNeedsPaintOffsetAndVisualRectUpdate();
+ setShouldDoFullPaintInvalidationWithoutGeometryChange(reason);
+}
+
+void LayoutObject::setShouldDoFullPaintInvalidationWithoutGeometryChange(
+ PaintInvalidationReason reason) {
// Only full invalidation reasons are allowed.
- ASSERT(isFullPaintInvalidationReason(reason));
+ DCHECK(isFullPaintInvalidationReason(reason));
bool isUpgradingDelayedFullToFull =
m_bitfields.fullPaintInvalidationReason() ==
@@ -3450,6 +3473,11 @@ void LayoutObject::setShouldDoFullPaintInvalidation(
}
void LayoutObject::setMayNeedPaintInvalidation() {
+ setNeedsPaintOffsetAndVisualRectUpdate();
+ setMayNeedPaintInvalidationWithoutGeometryChange();
+}
+
+void LayoutObject::setMayNeedPaintInvalidationWithoutGeometryChange() {
if (mayNeedPaintInvalidation())
return;
m_bitfields.setMayNeedPaintInvalidation(true);
@@ -3468,7 +3496,7 @@ void LayoutObject::setMayNeedPaintInvalidationAnimatedBackgroundImage() {
if (mayNeedPaintInvalidationAnimatedBackgroundImage())
return;
m_bitfields.setMayNeedPaintInvalidationAnimatedBackgroundImage(true);
- setMayNeedPaintInvalidation();
+ setMayNeedPaintInvalidationWithoutGeometryChange();
}
void LayoutObject::clearPaintInvalidationFlags() {
@@ -3478,10 +3506,10 @@ void LayoutObject::clearPaintInvalidationFlags() {
DCHECK(!shouldCheckForPaintInvalidation() || paintInvalidationStateIsDirty());
#endif
clearShouldDoFullPaintInvalidation();
- m_bitfields.setChildShouldCheckForPaintInvalidation(false);
m_bitfields.setMayNeedPaintInvalidation(false);
m_bitfields.setMayNeedPaintInvalidationSubtree(false);
m_bitfields.setMayNeedPaintInvalidationAnimatedBackgroundImage(false);
+ m_bitfields.setNeedsPaintOffsetAndVisualRectUpdate(false);
m_bitfields.setShouldInvalidateSelection(false);
m_bitfields.setBackgroundChangedSinceLastPaintInvalidation(false);
}
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | third_party/WebKit/Source/core/layout/LayoutObjectTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698