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

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

Issue 2894803002: Use current selection when tab navigation. (Closed)
Patch Set: Fix selection direction 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..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;
}
« 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