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

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

Issue 2776983003: Expand FrameSelection/SelectionEditor::firstRange() (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/FrameSelection.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/DOMSelection.cpp
diff --git a/third_party/WebKit/Source/core/editing/DOMSelection.cpp b/third_party/WebKit/Source/core/editing/DOMSelection.cpp
index 1c73eeedc0565ef287fb6d733d629df7b7920849..fd59dced6fe22cd8f6fb1b08cf23cbcbe70d51bb 100644
--- a/third_party/WebKit/Source/core/editing/DOMSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/DOMSelection.cpp
@@ -540,15 +540,16 @@ Range* DOMSelection::primaryRangeOrNull() const {
}
Range* DOMSelection::createRangeFromSelectionEditor() const {
- Position anchor = blink::anchorPosition(visibleSelection());
+ const VisibleSelection& selection = visibleSelection();
+ const Position& anchor = blink::anchorPosition(selection);
if (isSelectionOfDocument() && !anchor.anchorNode()->isInShadowTree())
- return frame()->selection().firstRange();
+ return createRange(firstEphemeralRangeOf(selection));
- Node* node = shadowAdjustedNode(anchor);
+ Node* const node = shadowAdjustedNode(anchor);
if (!node) // crbug.com/595100
return nullptr;
- Position focus = focusPosition(visibleSelection());
- if (!visibleSelection().isBaseFirst()) {
+ const Position& focus = focusPosition(selection);
+ if (!selection.isBaseFirst()) {
return Range::create(*anchor.document(), shadowAdjustedNode(focus),
shadowAdjustedOffset(focus), node,
shadowAdjustedOffset(anchor));
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/FrameSelection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698