Chromium Code Reviews| 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..602a2667e42c64e393392df3b2e11947887c0973 100644 |
| --- a/third_party/WebKit/Source/core/editing/FrameSelection.cpp |
| +++ b/third_party/WebKit/Source/core/editing/FrameSelection.cpp |
| @@ -949,6 +949,14 @@ LayoutRect FrameSelection::UnclippedBounds() const { |
| return LayoutRect(layout_selection_->SelectionBounds()); |
| } |
| +static IntRect AbsoluteSelectionBoundsOf( |
| + const VisibleSelectionInFlatTree& visible_selection) { |
| + const SelectionInFlatTree& selection = visible_selection.AsSelection(); |
| + return ComputeTextRect( |
| + EphemeralRangeInFlatTree(selection.Base(), selection.Extent())); |
|
yosin_UTC9
2017/05/22 08:11:43
I think we should use VSInFlatTree.Start() and End
yoichio
2017/05/22 08:42:21
Done.
|
| +} |
| + |
| +// TODO(editing-dev): This should be done in FlatTree world. |
| void FrameSelection::RevealSelection(const ScrollAlignment& alignment, |
| RevealExtentOption reveal_extent_option) { |
| DCHECK(IsAvailable()); |
| @@ -967,10 +975,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; |
| } |