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

Side by Side Diff: third_party/WebKit/Source/core/dom/Node.cpp

Issue 1741873002: Fix isEqualNode behavior (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: V2 Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/nodes/Node-isEqualNode-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1114 1114
1115 bool Node::isEqualNode(Node* other) const 1115 bool Node::isEqualNode(Node* other) const
1116 { 1116 {
1117 if (!other) 1117 if (!other)
1118 return false; 1118 return false;
1119 1119
1120 NodeType nodeType = this->getNodeType(); 1120 NodeType nodeType = this->getNodeType();
1121 if (nodeType != other->getNodeType()) 1121 if (nodeType != other->getNodeType())
1122 return false; 1122 return false;
1123 1123
1124 if (nodeName() != other->nodeName())
1125 return false;
1126
1127 if (nodeValue() != other->nodeValue()) 1124 if (nodeValue() != other->nodeValue())
1128 return false; 1125 return false;
1129 1126
1130 if (isAttributeNode()) { 1127 if (isAttributeNode()) {
1131 if (toAttr(this)->localName() != toAttr(other)->localName()) 1128 if (toAttr(this)->localName() != toAttr(other)->localName())
1132 return false; 1129 return false;
1133 1130
1134 if (toAttr(this)->namespaceURI() != toAttr(other)->namespaceURI()) 1131 if (toAttr(this)->namespaceURI() != toAttr(other)->namespaceURI())
1135 return false; 1132 return false;
1136 } else if (isElementNode()) { 1133 } else if (isElementNode()) {
1137 if (toElement(this)->localName() != toElement(other)->localName()) 1134 if (toElement(this)->tagQName() != toElement(other)->tagQName())
1138 return false;
1139
1140 if (toElement(this)->namespaceURI() != toElement(other)->namespaceURI())
1141 return false; 1135 return false;
1142 1136
1143 if (!toElement(this)->hasEquivalentAttributes(toElement(other))) 1137 if (!toElement(this)->hasEquivalentAttributes(toElement(other)))
1144 return false; 1138 return false;
1139 } else if (nodeName() != other->nodeName()) {
1140 return false;
1145 } 1141 }
1146 1142
1147 Node* child = firstChild(); 1143 Node* child = firstChild();
1148 Node* otherChild = other->firstChild(); 1144 Node* otherChild = other->firstChild();
1149 1145
1150 while (child) { 1146 while (child) {
1151 if (!child->isEqualNode(otherChild)) 1147 if (!child->isEqualNode(otherChild))
1152 return false; 1148 return false;
1153 1149
1154 child = child->nextSibling(); 1150 child = child->nextSibling();
(...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after
2441 2437
2442 void showNodePath(const blink::Node* node) 2438 void showNodePath(const blink::Node* node)
2443 { 2439 {
2444 if (node) 2440 if (node)
2445 node->showNodePathForThis(); 2441 node->showNodePathForThis();
2446 else 2442 else
2447 fprintf(stderr, "Cannot showNodePath for (nil)\n"); 2443 fprintf(stderr, "Cannot showNodePath for (nil)\n");
2448 } 2444 }
2449 2445
2450 #endif 2446 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/nodes/Node-isEqualNode-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698