Commit 5348ff47 authored by Chris Harrelson's avatar Chris Harrelson Committed by Commit Bot

Refactor forced layouts for selection to avoid duplication.

Previously, DragImageForSelection forced lifecycles twice; the
second time was due to the call to ClippedSelection.

Change-Id: I4bca2f5cdb9fefffc6a54d1233d315d721bb0539
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2317769Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791624}
parent dfcbbbed
......@@ -1018,7 +1018,6 @@ PhysicalRect FrameSelection::AbsoluteUnclippedBounds() const {
if (!view || !layout_view)
return PhysicalRect();
view->UpdateLifecycleToLayoutClean(DocumentUpdateReason::kSelection);
return PhysicalRect(layout_selection_->AbsoluteSelectionBounds());
}
......
......@@ -1693,6 +1693,8 @@ void WebLocalFrameImpl::PrintPagesForTesting(
}
WebRect WebLocalFrameImpl::GetSelectionBoundsRectForTesting() const {
GetFrame()->View()->UpdateLifecycleToLayoutClean(
DocumentUpdateReason::kSelection);
return HasSelection()
? WebRect(PixelSnappedIntRect(
GetFrame()->Selection().AbsoluteUnclippedBounds()))
......
......@@ -1043,6 +1043,7 @@ FloatRect DragController::ClippedSelection(const LocalFrame& frame) {
}
static IntPoint DragLocationForSelectionDrag(const LocalFrame& frame) {
frame.View()->UpdateLifecycleToLayoutClean(DocumentUpdateReason::kSelection);
IntRect dragging_rect =
EnclosingIntRect(DragController::ClippedSelection(frame));
int xpos = dragging_rect.MaxX();
......
......@@ -2880,6 +2880,8 @@ DOMRect* Internals::selectionBounds(ExceptionState& exception_state) {
return nullptr;
}
GetFrame()->View()->UpdateLifecycleToLayoutClean(
DocumentUpdateReason::kSelection);
return DOMRect::FromFloatRect(
FloatRect(GetFrame()->Selection().AbsoluteUnclippedBounds()));
}
......
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