Chromium Code Reviews| 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 b5d634ec2a491852f9bd91b68dfcddbe5463335c..120b7a3bf8b922bfc28cd0f2b26cdce58e717e6e 100644 |
| --- a/third_party/WebKit/Source/core/dom/Node.cpp |
| +++ b/third_party/WebKit/Source/core/dom/Node.cpp |
| @@ -938,15 +938,21 @@ bool Node::canStartSelection() const |
| if (hasEditableStyle(*this)) |
| return true; |
| - 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) |
| + // 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): Use FlatTreeTraversal::ancestorsOf(). |
|
tkent
2016/08/17 02:34:20
Do you mean we don't have FlatTreeTraversal::ances
|
| + for (const Node* parent = FlatTreeTraversal::parent(*this); parent; parent = FlatTreeTraversal::parent(*parent)) { |
| + if (!parent->canStartSelection() && usedValueOfUserSelect(*parent) != SELECT_NONE) |
| return false; |
| } |
| - ContainerNode* parent = FlatTreeTraversal::parent(*this); |
| - return parent ? parent->canStartSelection() : true; |
| + return true; |
| } |
| // StyledElements allow inline style (style="border: 1px"), presentational attributes (ex. color), |