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

Unified Diff: third_party/WebKit/Source/core/dom/Node.cpp

Issue 2257203003: Merge 2832: Revert of [Editing][CSS] Drag from a -webkit-user-select:none element should not start … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2832
Patch Set: Created 4 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 | « third_party/WebKit/LayoutTests/editing/selection/mouse/select_user_select_in_shadow.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Node.cpp
diff --git a/third_party/WebKit/Source/core/dom/Node.cpp b/third_party/WebKit/Source/core/dom/Node.cpp
index a834c8b5463ed24fa606b1d574f35798798572cf..eac5a1ca94a4456e3e673a3779c998f8b71beb00 100644
--- a/third_party/WebKit/Source/core/dom/Node.cpp
+++ b/third_party/WebKit/Source/core/dom/Node.cpp
@@ -938,21 +938,15 @@ bool Node::canStartSelection() const
if (hasEditableStyle(*this))
return true;
- // We don't allow selections to begin within an element that has
- // -webkit-user-select: none set,
- // https://drafts.csswg.org/css-ui-4/#valdef-user-select-none
- if (usedValueOfUserSelect(*this) == SELECT_NONE)
- return false;
-
- if (isHTMLElement() && toHTMLElement(this)->draggable())
- return false;
-
- // TODO(yoichio): Implement FlatTreeTraversal::ancestorsOf() and use it.
- for (const Node* parent = FlatTreeTraversal::parent(*this); parent; parent = FlatTreeTraversal::parent(*parent)) {
- if (!parent->canStartSelection() && usedValueOfUserSelect(*parent) != SELECT_NONE)
+ if (layoutObject()) {
+ const ComputedStyle& style = layoutObject()->styleRef();
+ // We allow selections to begin within an element that has -webkit-user-select: none set,
+ // but if the element is draggable then dragging should take priority over selection.
+ if (style.userDrag() == DRAG_ELEMENT && style.userSelect() == SELECT_NONE)
return false;
}
- return true;
+ ContainerNode* parent = FlatTreeTraversal::parent(*this);
+ return parent ? parent->canStartSelection() : true;
}
// StyledElements allow inline style (style="border: 1px"), presentational attributes (ex. color),
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/selection/mouse/select_user_select_in_shadow.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698