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

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

Issue 2521613003: Add flag for tracking descendant paint property updates (Closed)
Patch Set: Address Xianzhu's comments 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
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 22c9acdecad7fc9b01f776650e8885a8d5bcc3b9..8ccfd94ac1df8591b0525b2082a01eacd27c33cd 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
@@ -1472,7 +1472,6 @@ StyleDifference LayoutObject::adjustStyleDifference(
// When transform, opacity, etc. change, paint properties will also change
// so we need to mark this object as needing an update.
- // TODO(pdr): Also update in the non-spv2 codepath?
getMutableForPainting().setNeedsPaintPropertyUpdate();
}
} else {
@@ -2508,7 +2507,7 @@ LayoutObject* LayoutObject::container(const LayoutBoxModelObject* ancestor,
return o;
}
-LayoutObject* LayoutObject::paintInvalidationParent() const {
+inline LayoutObject* LayoutObject::paintInvalidationParent() const {
if (isLayoutView())
return LayoutAPIShim::layoutObjectFrom(frame()->ownerLayoutItem());
if (isColumnSpanAll())
@@ -2516,6 +2515,10 @@ LayoutObject* LayoutObject::paintInvalidationParent() const {
return parent();
}
+LayoutObject* LayoutObject::slowPaintInvalidationParentForTesting() const {
+ return paintInvalidationParent();
+}
+
bool LayoutObject::isSelectionBorder() const {
SelectionState st = getSelectionState();
return st == SelectionStart || st == SelectionEnd || st == SelectionBoth;
@@ -2724,6 +2727,27 @@ void LayoutObject::willBeRemovedFromTree() {
}
}
+void LayoutObject::setNeedsPaintPropertyUpdate() {
+ m_bitfields.setNeedsPaintPropertyUpdate(true);
+
+ // Mark all ancestors as having a descendant needing paint property updates.
+ // |paintInvalidationParent()| is used to ensure we continue marking across
+ // frame boundaries.
+ LayoutObject* ancestor = paintInvalidationParent();
+ while (ancestor && !ancestor->descendantNeedsPaintPropertyUpdate()) {
+ ancestor->m_bitfields.setDescendantNeedsPaintPropertyUpdate(true);
+ ancestor = ancestor->paintInvalidationParent();
+ }
+}
+
+void LayoutObject::setAncestorsNeedPaintPropertyUpdateForMainThreadScrolling() {
+ LayoutObject* ancestor = paintInvalidationParent();
+ while (ancestor) {
+ ancestor->setNeedsPaintPropertyUpdate();
+ ancestor = ancestor->paintInvalidationParent();
+ }
+}
+
void LayoutObject::maybeClearIsScrollAnchorObject() {
if (!m_bitfields.isScrollAnchorObject())
return;

Powered by Google App Engine
This is Rietveld 408576698