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

Unified Diff: third_party/WebKit/Source/web/WebRange.cpp

Issue 2260283002: Adapt WebRange to only deal with EphemeralRanges. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added back the isNull case, sorry. Created 4 years, 4 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 | « third_party/WebKit/Source/web/WebLocalFrameImpl.cpp ('k') | third_party/WebKit/public/web/WebRange.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/WebRange.cpp
diff --git a/third_party/WebKit/Source/web/WebRange.cpp b/third_party/WebKit/Source/web/WebRange.cpp
index b659375b30dd94bffb3c15cca2be0f49bb16b8b9..a877e8a4e2f9d2182cf367ed57683574b9689acd 100644
--- a/third_party/WebKit/Source/web/WebRange.cpp
+++ b/third_party/WebKit/Source/web/WebRange.cpp
@@ -45,21 +45,21 @@ WebRange::WebRange(int start, int length)
DCHECK(start != -1 && length != 0) << "These values are reserved to indicate that the range is null";
}
-WebRange::WebRange(Range* range)
+WebRange::WebRange(const EphemeralRange& range)
{
- if (!range)
+ if (range.isNull())
return;
- m_start = range->startOffset();
- m_end = range->endOffset();
+ m_start = range.startPosition().computeOffsetInContainerNode();
+ m_end =range.endPosition().computeOffsetInContainerNode();
}
-Range* WebRange::createRange(LocalFrame* frame) const
+EphemeralRange WebRange::createEphemeralRange(LocalFrame* frame) const
{
Element* selectionRoot = frame->selection().rootEditableElement();
ContainerNode* scope = selectionRoot ? selectionRoot : frame->document()->documentElement();
- return blink::createRange(PlainTextRange(m_start, m_end).createRange(*scope));
+ return PlainTextRange(m_start, m_end).createRange(*scope);
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/web/WebLocalFrameImpl.cpp ('k') | third_party/WebKit/public/web/WebRange.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698