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

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

Issue 1192053002: Templatize extractSelectedHTMLAlgorithm used by FrameSelection function (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/FrameSelection.cpp
diff --git a/Source/core/editing/FrameSelection.cpp b/Source/core/editing/FrameSelection.cpp
index bdba0152fa4165f0b667948ef790bd507d0333b4..57fc93db93daffe3c79be1bd85f0274c0d16b5d9 100644
--- a/Source/core/editing/FrameSelection.cpp
+++ b/Source/core/editing/FrameSelection.cpp
@@ -1669,9 +1669,20 @@ static String extractSelectedText(const FrameSelection& selection, TextIteratorB
return plainText(selection.toNormalizedRange().get(), behavior).replace(0, "");
}
+template <typename Strategy>
+static String extractSelectedHTMLAlgorithm(const FrameSelection& selection)
+{
+ using PositionType = typename Strategy::PositionType;
+ PositionType start;
+ PositionType end;
+ VisibleSelection visibleSelection = selection.selection();
+ VisibleSelection::normalizePositions(Strategy::selectionStart(visibleSelection), Strategy::selectionEnd(visibleSelection), &start, &end);
+ return createMarkup(start, end, AnnotateForInterchange, ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs);
+}
+
String FrameSelection::selectedHTMLForClipboard() const
{
- return createMarkup(m_selection.toNormalizedRange().get(), AnnotateForInterchange, ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs);
+ return extractSelectedHTMLAlgorithm<VisibleSelection::InDOMTree>(*this);
}
String FrameSelection::selectedText() const
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698