diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-03-11 11:32:04 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-03-18 13:40:17 +0000 |
commit | 31ccca0778db85c159634478b4ec7997f6704860 (patch) | |
tree | 3d33fc3afd9d5ec95541e1bbe074a9cf8da12a0e /chromium/third_party/blink/renderer/core/frame/frame_view.cc | |
parent | 248b70b82a40964d5594eb04feca0fa36716185d (diff) | |
download | qtwebengine-chromium-31ccca0778db85c159634478b4ec7997f6704860.tar.gz |
BASELINE: Update Chromium to 80.0.3987.136
Change-Id: I98e1649aafae85ba3a83e67af00bb27ef301db7b
Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/core/frame/frame_view.cc')
-rw-r--r-- | chromium/third_party/blink/renderer/core/frame/frame_view.cc | 51 |
1 files changed, 36 insertions, 15 deletions
diff --git a/chromium/third_party/blink/renderer/core/frame/frame_view.cc b/chromium/third_party/blink/renderer/core/frame/frame_view.cc index 855c72e7a01..b7eae97648b 100644 --- a/chromium/third_party/blink/renderer/core/frame/frame_view.cc +++ b/chromium/third_party/blink/renderer/core/frame/frame_view.cc @@ -52,6 +52,7 @@ void FrameView::UpdateViewportIntersection(unsigned flags, if (!owner_element) return; Document& owner_document = owner_element->GetDocument(); + IntPoint viewport_offset; IntRect viewport_intersection; DocumentLifecycle::LifecycleState parent_lifecycle_state = owner_document.Lifecycle().GetState(); @@ -92,27 +93,48 @@ void FrameView::UpdateViewportIntersection(unsigned flags, rect_in_parent_stable_since_ = base::TimeTicks::Now(); } } - - PhysicalRect intersection_rect = owner_layout_object->AncestorToLocalRect( - nullptr, geometry.IntersectionRect()); - // Map from the box coordinates of the owner to the inner frame. - intersection_rect.Move(-owner_layout_object->PhysicalContentBoxOffset()); - // Don't let EnclosingIntRect turn an empty rect into a non-empty one. - if (intersection_rect.IsEmpty()) { - viewport_intersection = - IntRect(FlooredIntPoint(intersection_rect.offset), IntSize()); - } else { - viewport_intersection = EnclosingIntRect(intersection_rect); - } if (should_compute_occlusion && !geometry.IsVisible()) occlusion_state = FrameOcclusionState::kPossiblyOccluded; + + // The coordinate system for the iframe's LayoutObject has its origin at the + // top/left of the border box rect. The coordinate system of the child frame + // is the same as the coordinate system of the iframe's content box rect. + // The iframe's PhysicalContentBoxOffset() can be used to move between them. + PhysicalOffset content_box_offset = + owner_layout_object->PhysicalContentBoxOffset(); + + if (NeedsViewportOffset()) { + viewport_offset = + RoundedIntPoint(owner_layout_object->LocalToAbsolutePoint( + content_box_offset, + kTraverseDocumentBoundaries | kApplyRemoteRootFrameOffset)); + } + + if (geometry.IsIntersecting()) { + // geometry.IntersectionRect() is in the coordinate system of the document + // containing the iframe. First map it down to border-box coordinates for + // the iframe, then apply content_box_offset to translate to the + // coordinates of the child frame. + PhysicalRect intersection_rect = owner_layout_object->AncestorToLocalRect( + nullptr, geometry.IntersectionRect()); + intersection_rect.Move(-content_box_offset); + + // Don't let EnclosingIntRect turn an empty rect into a non-empty one. + if (intersection_rect.IsEmpty()) { + viewport_intersection = + IntRect(FlooredIntPoint(intersection_rect.offset), IntSize()); + } else { + viewport_intersection = EnclosingIntRect(intersection_rect); + } + } } else if (occlusion_state == FrameOcclusionState::kGuaranteedNotOccluded) { // If the parent LocalFrameView is throttled and out-of-date, then we can't // get any useful information. occlusion_state = FrameOcclusionState::kUnknown; } - SetViewportIntersection(viewport_intersection, occlusion_state); + SetViewportIntersection( + {viewport_offset, viewport_intersection, WebRect(), occlusion_state}); UpdateFrameVisibility(!viewport_intersection.IsEmpty()); @@ -143,8 +165,7 @@ void FrameView::UpdateFrameVisibility(bool intersects_viewport) { } if (frame_visibility != frame_visibility_) { frame_visibility_ = frame_visibility; - if (FrameClient* client = GetFrame().Client()) - client->VisibilityChanged(frame_visibility); + VisibilityChanged(frame_visibility); } } |