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

Unified Diff: Source/core/inspector/InspectorDOMAgent.cpp

Issue 308963002: Minimize calls to Node::nodeType() as it is virtual (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix typo Created 6 years, 7 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: Source/core/inspector/InspectorDOMAgent.cpp
diff --git a/Source/core/inspector/InspectorDOMAgent.cpp b/Source/core/inspector/InspectorDOMAgent.cpp
index 765a44fd6bb9116a21573741822a2c22fc1cb6bb..f1be89c6e9ea5082f0d1f39548fc88f4e19cd9d3 100644
--- a/Source/core/inspector/InspectorDOMAgent.cpp
+++ b/Source/core/inspector/InspectorDOMAgent.cpp
@@ -416,7 +416,7 @@ Element* InspectorDOMAgent::assertElement(ErrorString* errorString, int nodeId)
if (!node)
return 0;
- if (node->nodeType() != Node::ELEMENT_NODE) {
+ if (!node->isElementNode()) {
*errorString = "Node is not an Element";
return 0;
}
@@ -519,7 +519,7 @@ void InspectorDOMAgent::getDocument(ErrorString* errorString, RefPtr<TypeBuilder
void InspectorDOMAgent::pushChildNodesToFrontend(int nodeId, int depth)
{
Node* node = nodeForId(nodeId);
- if (!node || (node->nodeType() != Node::ELEMENT_NODE && node->nodeType() != Node::DOCUMENT_NODE && node->nodeType() != Node::DOCUMENT_FRAGMENT_NODE))
+ if (!node || (!node->isElementNode() && !node->isDocumentNode() && !node->isDocumentFragment()))
return;
NodeToIdMap* nodeMap = m_idToNodesMap.get(nodeId);
@@ -1109,7 +1109,7 @@ void InspectorDOMAgent::inspect(Node* inspectedNode)
return;
Node* node = inspectedNode;
- while (node && node->nodeType() != Node::ELEMENT_NODE && node->nodeType() != Node::DOCUMENT_NODE && node->nodeType() != Node::DOCUMENT_FRAGMENT_NODE)
+ while (node && !node->isElementNode() && !node->isDocumentNode() && !node->isDocumentFragment())
node = node->parentOrShadowHostNode();
if (!node)

Powered by Google App Engine
This is Rietveld 408576698