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 84a8cea65e1140ef19992d5e3c884b1fd0ce5c1f..d539dc910819e8b10112b676cd312d3e198a6528 100644 |
| --- a/third_party/WebKit/Source/core/dom/Node.cpp |
| +++ b/third_party/WebKit/Source/core/dom/Node.cpp |
| @@ -537,31 +537,32 @@ void Node::normalize() |
| bool Node::isContentEditable(UserSelectAllTreatment treatment) const |
| { |
| document().updateStyleAndLayoutTree(); |
| - return hasEditableStyle(Editable, treatment); |
| + return hasEditableStyle(this, Editable, treatment); |
| } |
| bool Node::isContentRichlyEditable() const |
| { |
| document().updateStyleAndLayoutTree(); |
| - return hasEditableStyle(RichlyEditable, UserSelectAllIsAlwaysNonEditable); |
| + return hasEditableStyle(this, RichlyEditable, UserSelectAllIsAlwaysNonEditable); |
| } |
| -bool Node::hasEditableStyle(EditableLevel editableLevel, UserSelectAllTreatment treatment) const |
| +// TODO(yoichio): Move this to core/editing |
| +bool Node::hasEditableStyle(const Node* node, EditableLevel editableLevel, UserSelectAllTreatment treatment) |
|
yosin_UTC9
2016/07/07 09:34:54
s/const Node*/const Node&/
|
| { |
| - if (isPseudoElement()) |
| + if (node->isPseudoElement()) |
| return false; |
| // Ideally we'd call DCHECK(!needsStyleRecalc()) here, but |
| // ContainerNode::setFocus() calls setNeedsStyleRecalc(), so the assertion |
| // would fire in the middle of Document::setFocusedNode(). |
| - for (const Node& node : NodeTraversal::inclusiveAncestorsOf(*this)) { |
| - if ((node.isHTMLElement() || node.isDocumentNode()) && node.layoutObject()) { |
| + for (const Node& ancestor : NodeTraversal::inclusiveAncestorsOf(*node)) { |
| + if ((ancestor.isHTMLElement() || ancestor.isDocumentNode()) && ancestor.layoutObject()) { |
| // Elements with user-select: all style are considered atomic |
| // therefore non editable. |
| - if (nodeIsUserSelectAll(&node) && treatment == UserSelectAllIsAlwaysNonEditable) |
| + if (nodeIsUserSelectAll(&ancestor) && treatment == UserSelectAllIsAlwaysNonEditable) |
| return false; |
| - switch (node.layoutObject()->style()->userModify()) { |
| + switch (ancestor.layoutObject()->style()->userModify()) { |
| case READ_ONLY: |
| return false; |
| case READ_WRITE: |
| @@ -577,9 +578,10 @@ bool Node::hasEditableStyle(EditableLevel editableLevel, UserSelectAllTreatment |
| return false; |
| } |
| -bool Node::isEditableToAccessibility(EditableLevel editableLevel) const |
| +// TODO(yoichio): Move this to core/editing |
| +bool Node::isEditableToAccessibility(const Node* node, EditableLevel editableLevel) |
|
yosin_UTC9
2016/07/07 09:34:54
s/const Node*/const Node&/
|
| { |
| - if (hasEditableStyle(editableLevel)) |
| + if (hasEditableStyle(node, editableLevel)) |
| return true; |
| // FIXME: Respect editableLevel for ARIA editable elements. |
| @@ -587,8 +589,8 @@ bool Node::isEditableToAccessibility(EditableLevel editableLevel) const |
| return false; |
| // FIXME(dmazzoni): support ScopedAXObjectCache (crbug/489851). |
| - if (AXObjectCache* cache = document().existingAXObjectCache()) |
| - return cache->rootAXEditableElement(this); |
| + if (AXObjectCache* cache = node->document().existingAXObjectCache()) |
| + return cache->rootAXEditableElement(node); |
| return false; |
| } |