Chromium Code Reviews| 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 04bfecc398e49c0c402a70089a50983906e22d16..629b64f72490b07bafb5ea768b48e14b3bf93398 100644 |
| --- a/third_party/WebKit/Source/core/dom/Node.cpp |
| +++ b/third_party/WebKit/Source/core/dom/Node.cpp |
| @@ -1518,8 +1518,6 @@ String Node::debugNodeName() const |
| return nodeName(); |
| } |
| -#ifndef NDEBUG |
| - |
| static void appendAttributeDesc(const Node* node, StringBuilder& stringBuilder, const QualifiedName& name, const char* attrDesc) |
| { |
| if (!node->isElementNode()) |
| @@ -1535,6 +1533,28 @@ static void appendAttributeDesc(const Node* node, StringBuilder& stringBuilder, |
| stringBuilder.appendLiteral("\""); |
| } |
| +// |std::ostream| version of |Node::showNode| |
| +std::ostream& operator<<(std::ostream& ostream, const Node& node) |
|
yosin_UTC9
2016/03/24 07:47:17
Thanks!!
|
| +{ |
| + ostream << node.nodeName(); |
| + if (node.isTextNode()) |
| + return ostream << " " << node.nodeValue(); |
| + StringBuilder attrs; |
| + appendAttributeDesc(&node, attrs, HTMLNames::idAttr, " ID"); |
| + appendAttributeDesc(&node, attrs, HTMLNames::classAttr, " CLASS"); |
| + appendAttributeDesc(&node, attrs, HTMLNames::styleAttr, " STYLE"); |
| + return ostream << attrs.toString(); |
| +} |
| + |
| +std::ostream& operator<<(std::ostream& ostream, const Node* node) |
| +{ |
| + if (!node) |
| + return ostream << "null"; |
| + return ostream << *node; |
| +} |
| + |
| +#ifndef NDEBUG |
| + |
| void Node::showNode(const char* prefix) const |
| { |
| if (!prefix) |