Commit 9d2b24b2 authored by Stefan Zager's avatar Stefan Zager Committed by Commit Bot

Don't compute viewport intersection if parent frame is throttled

If a RemoteFrameView is inside a throttled LocalFrameView with out-of-
date layout, then it's not possible to compute its viewport
intersection. In that case, just propagate an empty intersection (which
is probably correct, because a throttled frame is presumably off
screen).

BUG=711468
R=kenrb@chromium.org

Change-Id: Ie400c407871aab74561b4e34eefece17aa8c3e27
Reviewed-on: https://chromium-review.googlesource.com/1173345Reviewed-by: default avatarKen Buchanan <kenrb@chromium.org>
Commit-Queue: Stefan Zager <szager@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583002}
parent 498eeb39
...@@ -119,7 +119,6 @@ crbug.com/801992 http/tests/misc/iframe-script-modify-attr.html [ Pass Crash ] ...@@ -119,7 +119,6 @@ crbug.com/801992 http/tests/misc/iframe-script-modify-attr.html [ Pass Crash ]
crbug.com/711468 virtual/gpu/fast/canvas/canvas-composite-image.html [ Pass Timeout ] crbug.com/711468 virtual/gpu/fast/canvas/canvas-composite-image.html [ Pass Timeout ]
crbug.com/711468 virtual/gpu/fast/canvas/canvas-scale-strokePath-shadow.html [ Pass Timeout ] crbug.com/711468 virtual/gpu/fast/canvas/canvas-scale-strokePath-shadow.html [ Pass Timeout ]
crbug.com/711468 http/tests/intersection-observer/cross-origin-iframe-with-nesting.html [ Failure ]
crbug.com/807675 http/tests/images/image-decode-in-frame.html [ Crash Failure ] crbug.com/807675 http/tests/images/image-decode-in-frame.html [ Crash Failure ]
......
...@@ -64,7 +64,8 @@ RemoteFrameView* RemoteFrameView::Create(RemoteFrame* remote_frame) { ...@@ -64,7 +64,8 @@ RemoteFrameView* RemoteFrameView::Create(RemoteFrame* remote_frame) {
} }
void RemoteFrameView::UpdateViewportIntersectionsForSubtree() { void RemoteFrameView::UpdateViewportIntersectionsForSubtree() {
if (!remote_frame_->OwnerLayoutObject()) LayoutEmbeddedContent* owner = remote_frame_->OwnerLayoutObject();
if (!owner)
return; return;
LocalFrameView* local_root_view = LocalFrameView* local_root_view =
...@@ -72,17 +73,23 @@ void RemoteFrameView::UpdateViewportIntersectionsForSubtree() { ...@@ -72,17 +73,23 @@ void RemoteFrameView::UpdateViewportIntersectionsForSubtree() {
if (!local_root_view) if (!local_root_view)
return; return;
IntRect viewport_intersection;
DocumentLifecycle::LifecycleState parent_state =
owner->GetDocument().Lifecycle().GetState();
// If the parent LocalFrameView is throttled and out-of-date, then we can't
// get any useful information.
if (parent_state >= DocumentLifecycle::kLayoutClean) {
// Start with rect in remote frame's coordinate space. Then // Start with rect in remote frame's coordinate space. Then
// mapToVisualRectInAncestorSpace will move it to the local root's coordinate // mapToVisualRectInAncestorSpace will move it to the local root's
// space and account for any clip from containing elements such as a // coordinate space and account for any clip from containing elements such
// scrollable div. Passing nullptr as an argument to // as a scrollable div. Passing nullptr as an argument to
// mapToVisualRectInAncestorSpace causes it to be clipped to the viewport, // mapToVisualRectInAncestorSpace causes it to be clipped to the viewport,
// even if there are RemoteFrame ancestors in the frame tree. // even if there are RemoteFrame ancestors in the frame tree.
LayoutRect rect(0, 0, frame_rect_.Width(), frame_rect_.Height()); LayoutRect rect(0, 0, frame_rect_.Width(), frame_rect_.Height());
rect.Move(remote_frame_->OwnerLayoutObject()->ContentBoxOffset()); rect.Move(owner->ContentBoxOffset());
IntRect viewport_intersection; if (owner->MapToVisualRectInAncestorSpace(nullptr, rect,
if (remote_frame_->OwnerLayoutObject()->MapToVisualRectInAncestorSpace( kUseGeometryMapper)) {
nullptr, rect, kUseGeometryMapper)) {
IntRect root_visible_rect(IntPoint(), local_root_view->Size()); IntRect root_visible_rect(IntPoint(), local_root_view->Size());
IntRect intersected_rect = EnclosingIntRect(rect); IntRect intersected_rect = EnclosingIntRect(rect);
intersected_rect.Intersect(root_visible_rect); intersected_rect.Intersect(root_visible_rect);
...@@ -91,19 +98,19 @@ void RemoteFrameView::UpdateViewportIntersectionsForSubtree() { ...@@ -91,19 +98,19 @@ void RemoteFrameView::UpdateViewportIntersectionsForSubtree() {
// to the remote frame's coordinate space. // to the remote frame's coordinate space.
FloatRect viewport_intersection_float = FloatRect viewport_intersection_float =
remote_frame_->OwnerLayoutObject() remote_frame_->OwnerLayoutObject()
->AncestorToLocalQuad(local_root_view->GetLayoutView(), ->AncestorToLocalQuad(
FloatQuad(intersected_rect), local_root_view->GetLayoutView(), FloatQuad(intersected_rect),
kTraverseDocumentBoundaries | kUseTransforms) kTraverseDocumentBoundaries | kUseTransforms)
.BoundingBox(); .BoundingBox();
viewport_intersection_float.Move( viewport_intersection_float.Move(
-remote_frame_->OwnerLayoutObject()->ContentBoxOffset()); -remote_frame_->OwnerLayoutObject()->ContentBoxOffset());
viewport_intersection = EnclosingIntRect(viewport_intersection_float); viewport_intersection = EnclosingIntRect(viewport_intersection_float);
} }
}
if (viewport_intersection == last_viewport_intersection_) if (viewport_intersection == last_viewport_intersection_)
return; return;
// TODO(szager): Propagate occlusion information.
last_viewport_intersection_ = viewport_intersection; last_viewport_intersection_ = viewport_intersection;
remote_frame_->Client()->UpdateRemoteViewportIntersection( remote_frame_->Client()->UpdateRemoteViewportIntersection(
viewport_intersection); viewport_intersection);
......
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