| Index: Source/core/editing/FrameSelection.cpp
|
| diff --git a/Source/core/editing/FrameSelection.cpp b/Source/core/editing/FrameSelection.cpp
|
| index bdba0152fa4165f0b667948ef790bd507d0333b4..7690346d473ed25f834f84e5e1a9b3d12671ceb9 100644
|
| --- a/Source/core/editing/FrameSelection.cpp
|
| +++ b/Source/core/editing/FrameSelection.cpp
|
| @@ -191,15 +191,16 @@ static void adjustEndpointsAtBidiBoundary(VisiblePosition& visibleBase, VisibleP
|
| }
|
| }
|
|
|
| -void FrameSelection::setNonDirectionalSelectionIfNeeded(const VisibleSelection& passedNewSelection, TextGranularity granularity,
|
| +template <typename Strategy>
|
| +void FrameSelection::setNonDirectionalSelectionIfNeededAlgorithm(const VisibleSelection& passedNewSelection, TextGranularity granularity,
|
| EndPointsAdjustmentMode endpointsAdjustmentMode)
|
| {
|
| VisibleSelection newSelection = passedNewSelection;
|
| bool isDirectional = shouldAlwaysUseDirectionalSelection(m_frame) || newSelection.isDirectional();
|
|
|
| - VisiblePosition base = m_originalBase.isNotNull() ? m_originalBase : newSelection.visibleBase();
|
| + VisiblePosition base = m_originalBase.isNotNull() ? m_originalBase : VisiblePosition(Strategy::selectionBase(newSelection));
|
| VisiblePosition newBase = base;
|
| - VisiblePosition extent = newSelection.visibleExtent();
|
| + VisiblePosition extent(Strategy::selectionExtent(newSelection));
|
| VisiblePosition newExtent = extent;
|
| if (endpointsAdjustmentMode == AdjustEndpointsAtBidiBoundary)
|
| adjustEndpointsAtBidiBoundary(newBase, newExtent);
|
| @@ -209,18 +210,23 @@ void FrameSelection::setNonDirectionalSelectionIfNeeded(const VisibleSelection&
|
| newSelection.setBase(newBase);
|
| newSelection.setExtent(newExtent);
|
| } else if (m_originalBase.isNotNull()) {
|
| - if (m_selection.base() == newSelection.base())
|
| + if (Strategy::selectionBase(m_selection) == Strategy::selectionBase(newSelection))
|
| newSelection.setBase(m_originalBase);
|
| m_originalBase.clear();
|
| }
|
|
|
| newSelection.setIsDirectional(isDirectional); // Adjusting base and extent will make newSelection always directional
|
| - if (m_selection == newSelection)
|
| + if (Strategy::equalSelections(m_selection, newSelection))
|
| return;
|
|
|
| setSelection(newSelection, granularity);
|
| }
|
|
|
| +void FrameSelection::setNonDirectionalSelectionIfNeeded(const VisibleSelection& passedNewSelection, TextGranularity granularity, EndPointsAdjustmentMode endpointsAdjustmentMode)
|
| +{
|
| + setNonDirectionalSelectionIfNeededAlgorithm<VisibleSelection::InDOMTree>(passedNewSelection, granularity, endpointsAdjustmentMode);
|
| +}
|
| +
|
| void FrameSelection::setSelection(const VisibleSelection& newSelection, SetSelectionOptions options, CursorAlignOnScroll align, TextGranularity granularity)
|
| {
|
| if (m_granularityStrategy && (options & FrameSelection::DoNotClearStrategy) == 0)
|
|
|