Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(426)

Unified Diff: third_party/WebKit/Source/core/editing/FrameSelection.cpp

Issue 2894803002: Use current selection when tab navigation. (Closed)
Patch Set: update Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
}
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameSelection.h ('k') | third_party/WebKit/Source/core/editing/VisibleUnits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698