| Index: Source/core/editing/FrameSelection.cpp
|
| diff --git a/Source/core/editing/FrameSelection.cpp b/Source/core/editing/FrameSelection.cpp
|
| index bdba0152fa4165f0b667948ef790bd507d0333b4..0c9e2192c4d59bce29b6fee775e41a93f43daf69 100644
|
| --- a/Source/core/editing/FrameSelection.cpp
|
| +++ b/Source/core/editing/FrameSelection.cpp
|
| @@ -1663,10 +1663,22 @@ void FrameSelection::setFocusedNodeIfNeeded()
|
| m_frame->page()->focusController().setFocusedElement(0, m_frame);
|
| }
|
|
|
| -static String extractSelectedText(const FrameSelection& selection, TextIteratorBehavior behavior)
|
| +template <typename Strategy>
|
| +String extractSelectedTextAlgorithm(const FrameSelection& selection, TextIteratorBehavior behavior)
|
| {
|
| + using PositionType = typename Strategy::PositionType;
|
| +
|
| + PositionType start;
|
| + PositionType end;
|
| + VisibleSelection visibleSelection = selection.selection();
|
| + VisibleSelection::normalizePositions(Strategy::selectionStart(visibleSelection), Strategy::selectionEnd(visibleSelection), &start, &end);
|
| // We remove '\0' characters because they are not visibly rendered to the user.
|
| - return plainText(selection.toNormalizedRange().get(), behavior).replace(0, "");
|
| + return plainText(start, end, behavior).replace(0, "");
|
| +}
|
| +
|
| +static String extractSelectedText(const FrameSelection& selection, TextIteratorBehavior behavior)
|
| +{
|
| + return extractSelectedTextAlgorithm<VisibleSelection::InDOMTree>(selection, behavior);
|
| }
|
|
|
| String FrameSelection::selectedHTMLForClipboard() const
|
|
|