Commit 8540108f authored by Stefan Zager's avatar Stefan Zager Committed by Commit Bot

Don't update viewport intersection for iframe in dirty parent

LocalFrameView::UpdateViewportIntersectionsForSubtree already has a
(!NeedsLayout()) check to prevent it from computing intersections if
layout is dirty. This patch uses the same logic to avoid recomputing
the intersection of an iframe with its embedding document if the
embedding document's layout is dirty.

It's not clear why NeedsLayout() would be true if the document
lifecycle is >= kLayoutClean, although I suspect it has something to
do with the way LocalFrameView::has_pending_layout_ is used. I've
been unable to construct a test case which reproduces the condition.
I added a TODO to figure out how this can happen.

BUG=989637
R=chrishtr@chromium.org

Change-Id: I3ed84f7ccc3736e495efcd4cf945d44379086d66
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1732335Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Commit-Queue: Stefan Zager <szager@chromium.org>
Cr-Commit-Position: refs/heads/master@{#684128}
parent d9370f1f
...@@ -72,7 +72,8 @@ void FrameView::UpdateViewportIntersection(unsigned flags, ...@@ -72,7 +72,8 @@ void FrameView::UpdateViewportIntersection(unsigned flags,
// viewport_intersection empty, and signal the frame as occluded if // viewport_intersection empty, and signal the frame as occluded if
// necessary. // necessary.
occlusion_state = FrameOcclusionState::kPossiblyOccluded; occlusion_state = FrameOcclusionState::kPossiblyOccluded;
} else if (parent_lifecycle_state >= DocumentLifecycle::kLayoutClean) { } else if (parent_lifecycle_state >= DocumentLifecycle::kLayoutClean &&
!owner_document.View()->NeedsLayout()) {
unsigned geometry_flags = unsigned geometry_flags =
IntersectionGeometry::kShouldUseReplacedContentRect; IntersectionGeometry::kShouldUseReplacedContentRect;
if (should_compute_occlusion) if (should_compute_occlusion)
......
...@@ -2917,6 +2917,10 @@ void LocalFrameView::UpdateStyleAndLayoutIfNeededRecursive() { ...@@ -2917,6 +2917,10 @@ void LocalFrameView::UpdateStyleAndLayoutIfNeededRecursive() {
// These asserts ensure that parent frames are clean, when child frames // These asserts ensure that parent frames are clean, when child frames
// finished updating layout and style. // finished updating layout and style.
// TODO(szager): this is the last call to CheckDoesNotNeedLayout during the
// lifecycle code, but it can happen that NeedsLayout() becomes true after
// this point, even while the document lifecycle proceeds to kLayoutClean
// and beyond. Figure out how this happens, and do something sensible.
CheckDoesNotNeedLayout(); CheckDoesNotNeedLayout();
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
frame_->GetDocument()->GetLayoutView()->AssertLaidOut(); frame_->GetDocument()->GetLayoutView()->AssertLaidOut();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment