Index: third_party/WebKit/Source/core/editing/FrameSelection.cpp |
diff --git a/third_party/WebKit/Source/core/editing/FrameSelection.cpp b/third_party/WebKit/Source/core/editing/FrameSelection.cpp |
index b321e5015cb329a24b878ef572323f89595dcb54..91eca913ae3b82fd15416100e242ca674fee44bd 100644 |
--- a/third_party/WebKit/Source/core/editing/FrameSelection.cpp |
+++ b/third_party/WebKit/Source/core/editing/FrameSelection.cpp |
@@ -949,6 +949,13 @@ LayoutRect FrameSelection::UnclippedBounds() const { |
return LayoutRect(layout_selection_->SelectionBounds()); |
} |
+static IntRect AbsoluteSelectionBoundsOf( |
+ const VisibleSelectionInFlatTree& selection) { |
+ return ComputeTextRect( |
+ EphemeralRangeInFlatTree(selection.Start(), selection.end())); |
+} |
+ |
+// TODO(editing-dev): This should be done in FlatTree world. |
void FrameSelection::RevealSelection(const ScrollAlignment& alignment, |
RevealExtentOption reveal_extent_option) { |
DCHECK(IsAvailable()); |
@@ -967,10 +974,11 @@ void FrameSelection::RevealSelection(const ScrollAlignment& alignment, |
rect = LayoutRect(AbsoluteCaretBounds()); |
break; |
case kRangeSelection: |
- rect = LayoutRect(reveal_extent_option == kRevealExtent |
- ? AbsoluteCaretBoundsOf(CreateVisiblePosition( |
- ComputeVisibleSelectionInDOMTree().Extent())) |
- : EnclosingIntRect(UnclippedBounds())); |
+ rect = LayoutRect( |
+ reveal_extent_option == kRevealExtent |
+ ? AbsoluteCaretBoundsOf(CreateVisiblePosition( |
+ ComputeVisibleSelectionInDOMTree().Extent())) |
+ : AbsoluteSelectionBoundsOf(ComputeVisibleSelectionInFlatTree())); |
break; |
} |