Index: Source/core/page/EventHandler.cpp |
diff --git a/Source/core/page/EventHandler.cpp b/Source/core/page/EventHandler.cpp |
index c219ad68c06b3193037b87ccce6af6e308231a02..504e35b7fd80cc39a5e60e527b00fe51a76cb1e4 100644 |
--- a/Source/core/page/EventHandler.cpp |
+++ b/Source/core/page/EventHandler.cpp |
@@ -29,6 +29,7 @@ |
#include "core/page/EventHandler.h" |
#include "HTMLNames.h" |
+#include "RuntimeEnabledFeatures.h" |
#include "SVGNames.h" |
#include "bindings/v8/ExceptionStatePlaceholder.h" |
#include "core/dom/Document.h" |
@@ -382,7 +383,6 @@ static inline bool dispatchSelectStart(Node* node) |
static VisibleSelection expandSelectionToRespectUserSelectAll(Node* targetNode, const VisibleSelection& selection) |
{ |
-#if ENABLE(USERSELECT_ALL) |
Node* rootUserSelectAll = Position::rootUserSelectAllForNode(targetNode); |
if (!rootUserSelectAll) |
return selection; |
@@ -392,10 +392,6 @@ static VisibleSelection expandSelectionToRespectUserSelectAll(Node* targetNode, |
newSelection.setExtent(positionAfterNode(rootUserSelectAll).downstream(CanCrossEditingBoundary)); |
return newSelection; |
-#else |
- UNUSED_PARAM(targetNode); |
- return selection; |
-#endif |
} |
bool EventHandler::updateSelectionForMouseDownDispatchingSelectStart(Node* targetNode, const VisibleSelection& selection, TextGranularity granularity) |
@@ -771,27 +767,27 @@ void EventHandler::updateSelectionForMouseDrag(const HitTestResult& hitTestResul |
newSelection = VisibleSelection(targetPosition); |
} |
-#if ENABLE(USERSELECT_ALL) |
- Node* rootUserSelectAllForMousePressNode = Position::rootUserSelectAllForNode(m_mousePressNode.get()); |
- if (rootUserSelectAllForMousePressNode && rootUserSelectAllForMousePressNode == Position::rootUserSelectAllForNode(target)) { |
- newSelection.setBase(positionBeforeNode(rootUserSelectAllForMousePressNode).upstream(CanCrossEditingBoundary)); |
- newSelection.setExtent(positionAfterNode(rootUserSelectAllForMousePressNode).downstream(CanCrossEditingBoundary)); |
+ if (RuntimeEnabledFeatures::userSelectAllEnabled()) { |
+ Node* rootUserSelectAllForMousePressNode = Position::rootUserSelectAllForNode(m_mousePressNode.get()); |
+ if (rootUserSelectAllForMousePressNode && rootUserSelectAllForMousePressNode == Position::rootUserSelectAllForNode(target)) { |
+ newSelection.setBase(positionBeforeNode(rootUserSelectAllForMousePressNode).upstream(CanCrossEditingBoundary)); |
+ newSelection.setExtent(positionAfterNode(rootUserSelectAllForMousePressNode).downstream(CanCrossEditingBoundary)); |
+ } else { |
+ // Reset base for user select all when base is inside user-select-all area and extent < base. |
+ if (rootUserSelectAllForMousePressNode && comparePositions(target->renderer()->positionForPoint(hitTestResult.localPoint()), m_mousePressNode->renderer()->positionForPoint(m_dragStartPos)) < 0) |
+ newSelection.setBase(positionAfterNode(rootUserSelectAllForMousePressNode).downstream(CanCrossEditingBoundary)); |
+ |
+ Node* rootUserSelectAllForTarget = Position::rootUserSelectAllForNode(target); |
+ if (rootUserSelectAllForTarget && m_mousePressNode->renderer() && comparePositions(target->renderer()->positionForPoint(hitTestResult.localPoint()), m_mousePressNode->renderer()->positionForPoint(m_dragStartPos)) < 0) |
+ newSelection.setExtent(positionBeforeNode(rootUserSelectAllForTarget).upstream(CanCrossEditingBoundary)); |
+ else if (rootUserSelectAllForTarget && m_mousePressNode->renderer()) |
+ newSelection.setExtent(positionAfterNode(rootUserSelectAllForTarget).downstream(CanCrossEditingBoundary)); |
+ else |
+ newSelection.setExtent(targetPosition); |
+ } |
} else { |
- // Reset base for user select all when base is inside user-select-all area and extent < base. |
- if (rootUserSelectAllForMousePressNode && comparePositions(target->renderer()->positionForPoint(hitTestResult.localPoint()), m_mousePressNode->renderer()->positionForPoint(m_dragStartPos)) < 0) |
- newSelection.setBase(positionAfterNode(rootUserSelectAllForMousePressNode).downstream(CanCrossEditingBoundary)); |
- |
- Node* rootUserSelectAllForTarget = Position::rootUserSelectAllForNode(target); |
- if (rootUserSelectAllForTarget && m_mousePressNode->renderer() && comparePositions(target->renderer()->positionForPoint(hitTestResult.localPoint()), m_mousePressNode->renderer()->positionForPoint(m_dragStartPos)) < 0) |
- newSelection.setExtent(positionBeforeNode(rootUserSelectAllForTarget).upstream(CanCrossEditingBoundary)); |
- else if (rootUserSelectAllForTarget && m_mousePressNode->renderer()) |
- newSelection.setExtent(positionAfterNode(rootUserSelectAllForTarget).downstream(CanCrossEditingBoundary)); |
- else |
- newSelection.setExtent(targetPosition); |
+ newSelection.setExtent(targetPosition); |
} |
-#else |
- newSelection.setExtent(targetPosition); |
-#endif |
if (m_frame->selection()->granularity() != CharacterGranularity) |
newSelection.expandUsingGranularity(m_frame->selection()->granularity()); |