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

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

Issue 1412713003: Reland 'Use FrameSelection::selectedText where possible.' Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use SelectionEditor::setWithoutValidation. Created 5 years, 2 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/web/WebLocalFrameImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
index b54487a2e59b265d948f17b59b67a28f91cd502d..863ff44d499a278017d047e191763e09bf8e7425 100644
--- a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
+++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
@@ -1235,11 +1235,7 @@ WebString WebLocalFrameImpl::selectionAsText() const
if (pluginContainer)
return pluginContainer->plugin()->selectionAsText();
- const EphemeralRange range = frame()->selection().selection().toNormalizedEphemeralRange();
- if (range.isNull())
- return WebString();
-
- String text = plainText(range, TextIteratorEmitsObjectReplacementCharacter);
+ String text = frame()->selection().selectedText(TextIteratorEmitsObjectReplacementCharacter);
#if OS(WIN)
replaceNewlinesWithWindowsStyleNewlines(text);
#endif
@@ -1253,11 +1249,7 @@ WebString WebLocalFrameImpl::selectionAsMarkup() const
if (pluginContainer)
return pluginContainer->plugin()->selectionAsMarkup();
- const EphemeralRange range = frame()->selection().selection().toNormalizedEphemeralRange();
- if (range.isNull())
- return WebString();
-
- return createMarkup(range.startPosition(), range.endPosition(), AnnotateForInterchange, ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs);
+ return frame()->selection().selectedHTMLForClipboard();
}
void WebLocalFrameImpl::selectWordAroundPosition(LocalFrame* frame, VisiblePosition position)

Powered by Google App Engine
This is Rietveld 408576698