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

Unified Diff: Source/core/editing/VisibleSelection.cpp

Issue 1332823002: Introduce firstEphemeralRangeOf(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: simplify firstRangeOf Created 5 years, 3 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 | « Source/core/editing/VisibleSelection.h ('k') | Source/web/WebViewImpl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/VisibleSelection.cpp
diff --git a/Source/core/editing/VisibleSelection.cpp b/Source/core/editing/VisibleSelection.cpp
index 4f780ba57ce27365d0f3cb6e760583a6f71a8b6f..ca39a0b963dc4d8f57ac1df4f4b0c0d754ba71e1 100644
--- a/Source/core/editing/VisibleSelection.cpp
+++ b/Source/core/editing/VisibleSelection.cpp
@@ -221,13 +221,18 @@ PositionInComposedTree VisibleSelection::endInComposedTree() const
return m_endInComposedTree;
}
-PassRefPtrWillBeRawPtr<Range> firstRangeOf(const VisibleSelection& selection)
+EphemeralRange firstEphemeralRangeOf(const VisibleSelection& selection)
{
if (selection.isNone())
- return nullptr;
+ return EphemeralRange();
Position start = selection.start().parentAnchoredEquivalent();
Position end = selection.end().parentAnchoredEquivalent();
- return Range::create(*start.document(), start, end);
+ return EphemeralRange(start, end);
+}
+
+PassRefPtrWillBeRawPtr<Range> firstRangeOf(const VisibleSelection& selection)
+{
+ return createRange(firstEphemeralRangeOf(selection));
}
EphemeralRange VisibleSelection::toNormalizedEphemeralRange() const
« no previous file with comments | « Source/core/editing/VisibleSelection.h ('k') | Source/web/WebViewImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698