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

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

Issue 2515113002: WIP: Prune the prepaint tree walk (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/paint/ObjectPaintProperties.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/LayoutObject.h
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.h b/third_party/WebKit/Source/core/layout/LayoutObject.h
index 8478f86e332c7f6041d231b7552db5f38e8c24dc..061ef652c3601955383c94d41e771573959f3202 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.h
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.h
@@ -1707,6 +1707,12 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver,
void clearNeedsPaintPropertyUpdate() {
m_layoutObject.clearNeedsPaintPropertyUpdate();
}
+ void setDescendantNeedsPaintPropertyUpdate() {
+ m_layoutObject.setDescendantNeedsPaintPropertyUpdate();
+ }
+ void clearDescendantNeedsPaintPropertyUpdate() {
+ m_layoutObject.clearDescendantNeedsPaintPropertyUpdate();
+ }
protected:
friend class PaintPropertyTreeBuilder;
@@ -1734,16 +1740,36 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver,
// state (location, transform, etc) as well as properties from ancestors.
// When these inputs change, setNeedsPaintPropertyUpdate will cause a property
// tree update during the next document lifecycle update.
- // TODO(pdr): Add additional granularity such as the ability to signal that
- // only a local paint property update is needed.
+ //
+ // In addition to tracking if an object needs its own paint properties
+ // updated, |descendantNeedsPaintPropertyUpdate| is used to track if any
+ // descendant needs an update too. This bit is up the tree, crossing frames.
+ //
+ // TODO(pdr): We may want to add more granular paint property update types
+ // such as the ability to only update one property type.
void setNeedsPaintPropertyUpdate() {
m_bitfields.setNeedsPaintPropertyUpdate(true);
+ // TODO(pdr): paintInvalidationParent is not inlined. May want to optimize
+ // this to check m_parent first.
+ if (auto* parent = paintInvalidationParent())
+ parent->setDescendantNeedsPaintPropertyUpdate();
+ }
+ void setDescendantNeedsPaintPropertyUpdate() {
+ if (!m_bitfields.descendantNeedsPaintPropertyUpdate()) {
+ m_bitfields.setDescendantNeedsPaintPropertyUpdate(true);
+ // TODO(pdr): paintInvalidationParent is not inlined. May want to optimize
+ // this to check m_parent first.
+ if (auto* parent = paintInvalidationParent())
+ parent->setDescendantNeedsPaintPropertyUpdate();
+ } else {
+ auto* parent = paintInvalidationParent();
+ DCHECK(!parent || parent->descendantNeedsPaintPropertyUpdate());
+ }
}
- // TODO(pdr): This can be removed once we have more granular update flags.
void setAllAncestorsNeedPaintPropertyUpdate() {
- if (m_parent) {
- m_parent->setNeedsPaintPropertyUpdate();
- m_parent->setAllAncestorsNeedPaintPropertyUpdate();
+ if (auto* parent = paintInvalidationParent()) {
+ parent->setNeedsPaintPropertyUpdate();
+ parent->setAllAncestorsNeedPaintPropertyUpdate();
}
}
void clearNeedsPaintPropertyUpdate() {
@@ -1753,6 +1779,13 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver,
bool needsPaintPropertyUpdate() const {
return m_bitfields.needsPaintPropertyUpdate();
}
+ void clearDescendantNeedsPaintPropertyUpdate() {
+ DCHECK_EQ(document().lifecycle().state(), DocumentLifecycle::InPrePaint);
+ m_bitfields.setDescendantNeedsPaintPropertyUpdate(false);
+ }
+ bool descendantNeedsPaintPropertyUpdate() const {
+ return m_bitfields.descendantNeedsPaintPropertyUpdate();
+ }
void setIsScrollAnchorObject() { m_bitfields.setIsScrollAnchorObject(true); }
// Clears the IsScrollAnchorObject bit if and only if no ScrollAnchors still
@@ -2149,6 +2182,7 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver,
m_hasPreviousSelectionVisualRect(false),
m_hasPreviousBoxGeometries(false),
m_needsPaintPropertyUpdate(true),
+ m_descendantNeedsPaintPropertyUpdate(true),
m_backgroundChangedSinceLastPaintInvalidation(false),
m_positionedState(IsStaticallyPositioned),
m_selectionState(SelectionNone),
@@ -2321,13 +2355,17 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver,
// Whether the paint properties need to be updated. For more details, see
// LayoutObject::needsPaintPropertyUpdate().
ADD_BOOLEAN_BITFIELD(needsPaintPropertyUpdate, NeedsPaintPropertyUpdate);
+ // Whether the paint properties of a descendant need to be updated. For more
+ // details, see LayoutObject::descendantNeedsPaintPropertyUpdate().
+ ADD_BOOLEAN_BITFIELD(descendantNeedsPaintPropertyUpdate,
+ DescendantNeedsPaintPropertyUpdate);
ADD_BOOLEAN_BITFIELD(backgroundChangedSinceLastPaintInvalidation,
BackgroundChangedSinceLastPaintInvalidation);
protected:
// Use protected to avoid warning about unused variable.
- unsigned m_unusedBits : 8;
+ unsigned m_unusedBits : 7;
private:
// This is the cached 'position' value of this object
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/paint/ObjectPaintProperties.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698