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

Unified Diff: Source/core/inspector/DOMPatchSupport.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/DOMPatchSupport.cpp
diff --git a/Source/core/inspector/DOMPatchSupport.cpp b/Source/core/inspector/DOMPatchSupport.cpp
index 8afcb0dbce2770433d52c5ab64d16a8787576fd7..699585cc3ab825d843396d4f1faf2ca39c24527f 100644
--- a/Source/core/inspector/DOMPatchSupport.cpp
+++ b/Source/core/inspector/DOMPatchSupport.cpp
@@ -181,7 +181,7 @@ bool DOMPatchSupport::innerPatchNode(Digest* oldDigest, Digest* newDigest, Excep
return false;
}
- if (oldNode->nodeType() != Node::ELEMENT_NODE)
+ if (!oldNode->isElementNode())
return true;
// Patch attributes
@@ -420,21 +420,21 @@ PassOwnPtr<DOMPatchSupport::Digest> DOMPatchSupport::createDigest(Node* node, Un
addStringToDigestor(digestor.get(), node->nodeName());
addStringToDigestor(digestor.get(), node->nodeValue());
- if (node->nodeType() == Node::ELEMENT_NODE) {
- Node* child = node->firstChild();
+ if (node->isElementNode()) {
+ Element& element = toElement(*node);
+ Node* child = element.firstChild();
while (child) {
OwnPtr<Digest> childInfo = createDigest(child, unusedNodesMap);
addStringToDigestor(digestor.get(), childInfo->m_sha1);
child = child->nextSibling();
digest->m_children.append(childInfo.release());
}
- Element* element = toElement(node);
- if (element->hasAttributesWithoutUpdate()) {
- size_t numAttrs = element->attributeCount();
+ if (element.hasAttributesWithoutUpdate()) {
+ size_t numAttrs = element.attributeCount();
OwnPtr<blink::WebCryptoDigestor> attrsDigestor = createDigestor(HashAlgorithmSha1);
for (size_t i = 0; i < numAttrs; ++i) {
- const Attribute& attribute = element->attributeItem(i);
+ const Attribute& attribute = element.attributeItem(i);
addStringToDigestor(attrsDigestor.get(), attribute.name().toString());
addStringToDigestor(attrsDigestor.get(), attribute.value().string());
}

Powered by Google App Engine
This is Rietveld 408576698