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

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

Issue 1932523003: Introduce NodeTraversal::ancestorsOf() and inclusiveAncestors() for range-based for loop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-04-28T18:38:12 Created 4 years, 8 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/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/dom/NodeTraversal.h » ('j') | 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 c465177c6fab8fafe3f8be68d4f8c362786cbc7a..a57826c5fac5b181ddfbc73a1872d5eb60d704b6 100644
--- a/third_party/WebKit/Source/core/dom/Node.cpp
+++ b/third_party/WebKit/Source/core/dom/Node.cpp
@@ -464,13 +464,13 @@ bool Node::hasEditableStyle(EditableLevel editableLevel, UserSelectAllTreatment
// ContainerNode::setFocus() calls setNeedsStyleRecalc(), so the assertion
// would fire in the middle of Document::setFocusedNode().
- for (const Node* node = this; node; node = node->parentNode()) {
- if ((node->isHTMLElement() || node->isDocumentNode()) && node->layoutObject()) {
+ for (const Node& node : NodeTraversal::inclusiveAncestorsOf(*this)) {
+ if ((node.isHTMLElement() || node.isDocumentNode()) && node.layoutObject()) {
// Elements with user-select: all style are considered atomic
// therefore non editable.
- if (nodeIsUserSelectAll(node) && treatment == UserSelectAllIsAlwaysNonEditable)
+ if (nodeIsUserSelectAll(&node) && treatment == UserSelectAllIsAlwaysNonEditable)
return false;
- switch (node->layoutObject()->style()->userModify()) {
+ switch (node.layoutObject()->style()->userModify()) {
case READ_ONLY:
return false;
case READ_WRITE:
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/dom/NodeTraversal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698