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

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

Issue 2140733003: [Editing][CodeHealth] Make Node::rootEditableElement static (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
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..d830fe984f09eb70e76808d7a3fd42efeaf11a13 100644
--- a/third_party/WebKit/Source/core/dom/Node.cpp
+++ b/third_party/WebKit/Source/core/dom/Node.cpp
@@ -1107,29 +1107,32 @@ ContainerNode* Node::parentOrShadowHostOrTemplateHostNode() const
return parentOrShadowHostNode();
}
-bool Node::isRootEditableElement() const
+// TODO(yoichio): Move to core/editing
+bool isRootEditableElement(const Node& node)
{
- return hasEditableStyle() && isElementNode() && (!parentNode() || !parentNode()->hasEditableStyle()
- || !parentNode()->isElementNode() || this == document().body());
+ return node.hasEditableStyle() && node.isElementNode() && (!node.parentNode() || !node.parentNode()->hasEditableStyle()
+ || !node.parentNode()->isElementNode() || &node == node.document().body());
}
-Element* Node::rootEditableElement(EditableType editableType) const
+// TODO(yoichio): Move to core/editing
+Element* rootEditableElement(const Node& node, EditableType editableType)
{
if (editableType == HasEditableAXRole) {
- if (AXObjectCache* cache = document().existingAXObjectCache())
- return const_cast<Element*>(cache->rootAXEditableElement(this));
+ if (AXObjectCache* cache = node.document().existingAXObjectCache())
+ return const_cast<Element*>(cache->rootAXEditableElement(&node));
}
- return rootEditableElement();
+ return rootEditableElement(node);
}
-Element* Node::rootEditableElement() const
+// TODO(yoichio): Move to core/editing
+Element* rootEditableElement(const Node& node)
{
const Node* result = nullptr;
- for (const Node* n = this; n && n->hasEditableStyle(); n = n->parentNode()) {
+ for (const Node* n = &node; n && n->hasEditableStyle(); n = n->parentNode()) {
if (n->isElementNode())
result = n;
- if (document().body() == n)
+ if (node.document().body() == n)
break;
}
return toElement(const_cast<Node*>(result));
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.h ('k') | third_party/WebKit/Source/core/editing/EditingUtilities.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698