| Index: Source/core/editing/VisibleSelection.cpp
|
| diff --git a/Source/core/editing/VisibleSelection.cpp b/Source/core/editing/VisibleSelection.cpp
|
| index b37baddacdcde8b6dddd213f92b4106b0e51e6a4..3ea806fa8b614f4e467502c60db6ef0d579c9a4a 100644
|
| --- a/Source/core/editing/VisibleSelection.cpp
|
| +++ b/Source/core/editing/VisibleSelection.cpp
|
| @@ -1138,7 +1138,8 @@ EphemeralRangeInComposedTree VisibleSelection::InComposedTree::asRange(const Vis
|
| return EphemeralRangeInComposedTree(selectionStart(selection), selectionEnd(selection));
|
| }
|
|
|
| -bool VisibleSelection::InDOMTree::equalSelections(const VisibleSelection& selection1, const VisibleSelection& selection2)
|
| +template <typename Strategy>
|
| +static bool equalSelectionsAlgorithm(const VisibleSelection& selection1, const VisibleSelection& selection2)
|
| {
|
| if (selection1.affinity() != selection2.affinity() || selection1.isDirectional() != selection2.isDirectional())
|
| return false;
|
| @@ -1146,13 +1147,20 @@ bool VisibleSelection::InDOMTree::equalSelections(const VisibleSelection& select
|
| if (selection1.isNone())
|
| return selection2.isNone();
|
|
|
| - return selection1.start() == selection2.start() && selection1.end() == selection2.end() && selection1.affinity() == selection2.affinity()
|
| - && selection1.isDirectional() == selection2.isDirectional() && selection1.base() == selection2.base() && selection1.extent() == selection2.extent();
|
| + return Strategy::selectionStart(selection1) == Strategy::selectionStart(selection2)
|
| + && Strategy::selectionEnd(selection1) == Strategy::selectionEnd(selection2)
|
| + && Strategy::selectionBase(selection1) == Strategy::selectionBase(selection2)
|
| + && Strategy::selectionExtent(selection1) == Strategy::selectionExtent(selection2);
|
| +}
|
| +
|
| +bool VisibleSelection::InDOMTree::equalSelections(const VisibleSelection& selection1, const VisibleSelection& selection2)
|
| +{
|
| + return equalSelectionsAlgorithm<InDOMTree>(selection1, selection2);
|
| }
|
|
|
| -bool VisibleSelection::InComposedTree::equalSelections(const VisibleSelection& a, const VisibleSelection& b)
|
| +bool VisibleSelection::InComposedTree::equalSelections(const VisibleSelection& selection1, const VisibleSelection& selection2)
|
| {
|
| - return a.startInComposedTree() == b.startInComposedTree() && a.endInComposedTree() == b.endInComposedTree() && a.affinity() == b.affinity() && a.isBaseFirst() == b.isBaseFirst() && a.isDirectional() == b.isDirectional();
|
| + return equalSelectionsAlgorithm<InComposedTree>(selection1, selection2);
|
| }
|
|
|
| #ifndef NDEBUG
|
|
|