Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(665)

Unified Diff: Source/core/page/EventHandler.cpp

Issue 22751005: Convert USERSELECT_ALL to a runtime enabled feature. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: undo reordering of if statements Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/editing/htmlediting.cpp ('k') | Source/core/page/RuntimeEnabledFeatures.in » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « Source/core/editing/htmlediting.cpp ('k') | Source/core/page/RuntimeEnabledFeatures.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698