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 8887dc3c9ad1bbcd71139232797e17c2ce296b75..a021faecdba13cebab8c391a8f8b56167ba74472 100644 |
| --- a/third_party/WebKit/Source/core/dom/Node.cpp |
| +++ b/third_party/WebKit/Source/core/dom/Node.cpp |
| @@ -936,15 +936,20 @@ 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; |
| + |
| + for (const Node* parent = FlatTreeTraversal::parent(*this); parent; parent = FlatTreeTraversal::parent(*parent)) { |
|
yosin_UTC9
2016/08/16 06:34:42
Could you add TODO to use |FlatTreeTraversal::ance
yoichio
2016/08/16 08:25:46
Done.
|
| + 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), |