0

Let LayoutObject::InvalidateIntersectionObserverCachedRects() schedule update

Previously all callers of
LayoutObject::InvalidateIntersectionObserverCachedRects() called
LocalFrameView::SetIntersectionObservationState() immediately.
Now let the former call the latter to ensure intersection observation
update will be always scheduled when any cached rects are invalidated.

This is a pure refactor without any behavior change.

Bug: 1400495
Change-Id: I79dbee97c9f49c055624d2c567e145ded8bd0d31
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4909747
Reviewed-by: Stefan Zager <szager@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1204951}
This commit is contained in:
Xianzhu Wang
2023-10-04 00:21:01 +00:00
committed by Chromium LUCI CQ
parent 26862b53ef
commit 1858874765
6 changed files with 1 additions and 8 deletions

@ -345,7 +345,6 @@ void LayoutBlock::ComputeVisualOverflow() {
if (VisualOverflowRect() != previous_visual_overflow_rect) {
InvalidateIntersectionObserverCachedRects();
SetShouldCheckForPaintInvalidation();
GetFrameView()->SetIntersectionObservationState(LocalFrameView::kDesired);
}
}

@ -171,7 +171,6 @@ void LayoutBlockFlow::ComputeVisualOverflow() {
if (VisualOverflowRect() != previous_visual_overflow_rect) {
InvalidateIntersectionObserverCachedRects();
SetShouldCheckForPaintInvalidation();
GetFrameView()->SetIntersectionObservationState(LocalFrameView::kDesired);
}
}

@ -3706,7 +3706,6 @@ void LayoutBox::CopyVisualOverflowFromFragments() {
return;
InvalidateIntersectionObserverCachedRects();
SetShouldCheckForPaintInvalidation();
GetFrameView()->SetIntersectionObservationState(LocalFrameView::kDesired);
}
void LayoutBox::CopyVisualOverflowFromFragmentsWithoutInvalidations() {

@ -1597,6 +1597,7 @@ void LayoutObject::InvalidateIntersectionObserverCachedRects() {
data->InvalidateCachedRects();
}
}
GetFrameView()->SetIntersectionObservationState(LocalFrameView::kDesired);
}
static inline bool ShouldInvalidateBeyond(LayoutObject* o) {

@ -483,9 +483,6 @@ void PaintLayer::UpdateDescendantDependentFlags() {
}
}
GetLayoutObject().InvalidateIntersectionObserverCachedRects();
GetLayoutObject().GetFrameView()->SetIntersectionObservationState(
LocalFrameView::kDesired);
needs_visual_overflow_recalc_ = false;
}

@ -2959,8 +2959,6 @@ void FragmentPaintPropertyTreeBuilder::UpdateForObjectLocationAndSize(
}
object_.GetMutableForPainting().InvalidateIntersectionObserverCachedRects();
object_.GetFrameView()->SetIntersectionObservationState(
LocalFrameView::kDesired);
}
if (paint_offset_translation)