Index: third_party/WebKit/Source/core/frame/FrameView.cpp |
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp |
index d7af7ba56a5426ac3ae365a376c9ffdab5dac2b4..1a40cfdc81db760a50a60d1fbe68916fc563ab7e 100644 |
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp |
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp |
@@ -1479,8 +1479,12 @@ void FrameView::addBackgroundAttachmentFixedObject(LayoutObject* object) { |
scrollingCoordinator->frameViewHasBackgroundAttachmentFixedObjectsDidChange( |
this); |
- // TODO(pdr): When slimming paint v2 is enabled, invalidate the scroll paint |
- // property subtree for this so main thread scroll reasons are recomputed. |
+ // Ensure main thread scrolling reasons are recomputed. |
+ if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
+ setNeedsPaintPropertyUpdate(); |
+ // The object's scroll properties are not affected by its own background. |
+ object->setAllAncestorsNeedPaintPropertyUpdate(); |
+ } |
} |
void FrameView::removeBackgroundAttachmentFixedObject(LayoutObject* object) { |
@@ -1491,8 +1495,12 @@ void FrameView::removeBackgroundAttachmentFixedObject(LayoutObject* object) { |
scrollingCoordinator->frameViewHasBackgroundAttachmentFixedObjectsDidChange( |
this); |
- // TODO(pdr): When slimming paint v2 is enabled, invalidate the scroll paint |
- // property subtree for this so main thread scroll reasons are recomputed. |
+ // Ensure main thread scrolling reasons are recomputed. |
+ if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
+ setNeedsPaintPropertyUpdate(); |
+ // The object's scroll properties are not affected by its own background. |
+ object->setAllAncestorsNeedPaintPropertyUpdate(); |
+ } |
} |
void FrameView::addViewportConstrainedObject(LayoutObject* object) { |
@@ -1598,6 +1606,17 @@ void FrameView::invalidateBackgroundAttachmentFixedObjects() { |
layoutObject->setShouldDoFullPaintInvalidation(); |
} |
+bool FrameView::hasBackgroundAttachmentFixedDescendants( |
+ const LayoutObject& object) const { |
+ for (const auto* potentialDescendant : m_backgroundAttachmentFixedObjects) { |
+ if (potentialDescendant == &object) |
+ continue; |
+ if (potentialDescendant->isDescendantOf(&object)) |
+ return true; |
+ } |
+ return false; |
+} |
+ |
bool FrameView::invalidateViewportConstrainedObjects() { |
bool fastPathAllowed = true; |
for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) { |