Chromium Code Reviews| Index: Source/core/page/EventHandler.cpp |
| diff --git a/Source/core/page/EventHandler.cpp b/Source/core/page/EventHandler.cpp |
| index c219ad68c06b3193037b87ccce6af6e308231a02..cdc370707a3a6ed57a43914ec4989f9b9bc0c6e4 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,9 @@ static inline bool dispatchSelectStart(Node* node) |
| static VisibleSelection expandSelectionToRespectUserSelectAll(Node* targetNode, const VisibleSelection& selection) |
| { |
| -#if ENABLE(USERSELECT_ALL) |
| + if (!RuntimeEnabledFeatures::userSelectAllEnabled()) |
|
adamk
2013/08/09 22:28:34
Same here as before, the null check will do the ri
|
| + return selection; |
| + |
| Node* rootUserSelectAll = Position::rootUserSelectAllForNode(targetNode); |
| if (!rootUserSelectAll) |
| return selection; |
| @@ -392,10 +395,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 +770,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()); |