Commit ed12183d authored by Vladimir Levin's avatar Vladimir Levin Committed by Commit Bot

Don't use geometry mapper if the target frame is throttled.

In order to use geometry mapper, we need to ensure that the prepaint
step of the lifecycle has run. However, if the target frame is
throttled this is not the case. We don't want to force run it, because
it causes compositing to run which has memory implications. Instead
fall back to slow path in intersection geometry.

Bug: 868230
R=chrishtr@chromium.org, pdr@chromium.org

Change-Id: Icaef44dd3e399b12df77eb550eb5ae0fa43291b6
Reviewed-on: https://chromium-review.googlesource.com/1150876
Commit-Queue: vmpstr <vmpstr@chromium.org>
Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578794}
parent cbcb900a
...@@ -155,8 +155,26 @@ void IntersectionGeometry::ClipToRoot() { ...@@ -155,8 +155,26 @@ void IntersectionGeometry::ClipToRoot() {
LayoutBox* local_ancestor = nullptr; LayoutBox* local_ancestor = nullptr;
if (!RootIsImplicit() || root_->GetDocument().IsInMainFrame()) if (!RootIsImplicit() || root_->GetDocument().IsInMainFrame())
local_ancestor = ToLayoutBox(root_); local_ancestor = ToLayoutBox(root_);
// If we're throttled, then we can't guarantee that geometry mapper is up to
// date, so we fall back to the slow path. If we're unthrottled, then ensure
// that prepaint has run and the frame view doesn't need a paint property
// update.
#if DCHECK_IS_ON()
{
auto* frame_view = target_->GetFrameView();
auto* layout_view = frame_view->GetLayoutView();
DCHECK(frame_view->ShouldThrottleRendering() || !layout_view ||
!(layout_view->NeedsPaintPropertyUpdate() ||
layout_view->DescendantNeedsPaintPropertyUpdate()));
}
#endif
VisualRectFlags use_geometry_mapper =
target_->GetFrameView()->ShouldThrottleRendering()
? kDefaultVisualRectFlags
: kUseGeometryMapper;
VisualRectFlags flags = VisualRectFlags flags =
static_cast<VisualRectFlags>(kUseGeometryMapper | kEdgeInclusive); static_cast<VisualRectFlags>(use_geometry_mapper | kEdgeInclusive);
does_intersect_ = target_->MapToVisualRectInAncestorSpace( does_intersect_ = target_->MapToVisualRectInAncestorSpace(
local_ancestor, intersection_rect_, flags); local_ancestor, intersection_rect_, flags);
if (!does_intersect_ || !local_ancestor) if (!does_intersect_ || !local_ancestor)
......
...@@ -82,8 +82,9 @@ struct WebScrollIntoViewParams; ...@@ -82,8 +82,9 @@ struct WebScrollIntoViewParams;
enum VisualRectFlags { enum VisualRectFlags {
kDefaultVisualRectFlags = 0, kDefaultVisualRectFlags = 0,
kEdgeInclusive = 1, kEdgeInclusive = 1 << 0,
kUseGeometryMapper = 2, // Use the GeometryMapper fast-path, if possible. // Use the GeometryMapper fast-path, if possible.
kUseGeometryMapper = 1 << 1,
}; };
enum CursorDirective { kSetCursorBasedOnStyle, kSetCursor, kDoNotSetCursor }; enum CursorDirective { kSetCursorBasedOnStyle, kSetCursor, kDoNotSetCursor };
......
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