OLD | NEW |
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 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1493 static void dumpAttributeDesc(const Node& node, const QualifiedName& name, std::
ostream& ostream) | 1493 static void dumpAttributeDesc(const Node& node, const QualifiedName& name, std::
ostream& ostream) |
1494 { | 1494 { |
1495 if (!node.isElementNode()) | 1495 if (!node.isElementNode()) |
1496 return; | 1496 return; |
1497 const AtomicString& value = toElement(node).getAttribute(name); | 1497 const AtomicString& value = toElement(node).getAttribute(name); |
1498 if (value.isEmpty()) | 1498 if (value.isEmpty()) |
1499 return; | 1499 return; |
1500 ostream << ' ' << name.toString().utf8().data() << '=' << value; | 1500 ostream << ' ' << name.toString().utf8().data() << '=' << value; |
1501 } | 1501 } |
1502 | 1502 |
1503 // |std::ostream| version of |Node::showNode| | |
1504 std::ostream& operator<<(std::ostream& ostream, const Node& node) | 1503 std::ostream& operator<<(std::ostream& ostream, const Node& node) |
1505 { | 1504 { |
1506 if (node.getNodeType() == Node::kProcessingInstructionNode) | 1505 if (node.getNodeType() == Node::kProcessingInstructionNode) |
1507 return ostream << "?" << node.nodeName().utf8().data(); | 1506 return ostream << "?" << node.nodeName().utf8().data(); |
1508 if (node.isShadowRoot()) { | 1507 if (node.isShadowRoot()) { |
1509 // nodeName of ShadowRoot is #document-fragment. It's confused with | 1508 // nodeName of ShadowRoot is #document-fragment. It's confused with |
1510 // DocumentFragment. | 1509 // DocumentFragment. |
1511 return ostream << "#shadow-root"; | 1510 return ostream << "#shadow-root"; |
1512 } | 1511 } |
1513 if (node.isDocumentTypeNode()) | 1512 if (node.isDocumentTypeNode()) |
(...skipping 24 matching lines...) Expand all Loading... |
1538 | 1537 |
1539 String Node::toString() const | 1538 String Node::toString() const |
1540 { | 1539 { |
1541 // TODO(tkent): We implemented toString() with operator<<. We should | 1540 // TODO(tkent): We implemented toString() with operator<<. We should |
1542 // implement operator<< with toString() instead. | 1541 // implement operator<< with toString() instead. |
1543 std::stringstream stream; | 1542 std::stringstream stream; |
1544 stream << *this; | 1543 stream << *this; |
1545 return String(stream.str().c_str()); | 1544 return String(stream.str().c_str()); |
1546 } | 1545 } |
1547 | 1546 |
1548 void Node::showNode(const char* prefix) const | |
1549 { | |
1550 std::stringstream stream; | |
1551 if (prefix) | |
1552 stream << prefix; | |
1553 stream << *this << "\n"; | |
1554 // TODO(tkent): Replace WTFLogAlways with something else. | |
1555 WTFLogAlways("%s", stream.str().c_str()); | |
1556 } | |
1557 | |
1558 String Node::toTreeStringForThis() const | 1547 String Node::toTreeStringForThis() const |
1559 { | 1548 { |
1560 return toMarkedTreeString(this, "*"); | 1549 return toMarkedTreeString(this, "*"); |
1561 } | 1550 } |
1562 | 1551 |
1563 String Node::toFlatTreeStringForThis() const | 1552 String Node::toFlatTreeStringForThis() const |
1564 { | 1553 { |
1565 return toMarkedFlatTreeString(this, "*"); | 1554 return toMarkedFlatTreeString(this, "*"); |
1566 } | 1555 } |
1567 | 1556 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1728 printSubTreeAcrossFrame(child, markedNode, indent + "\t", stream); | 1717 printSubTreeAcrossFrame(child, markedNode, indent + "\t", stream); |
1729 } | 1718 } |
1730 | 1719 |
1731 void Node::showTreeForThisAcrossFrame() const | 1720 void Node::showTreeForThisAcrossFrame() const |
1732 { | 1721 { |
1733 const Node* rootNode = this; | 1722 const Node* rootNode = this; |
1734 while (parentOrShadowHostOrFrameOwner(rootNode)) | 1723 while (parentOrShadowHostOrFrameOwner(rootNode)) |
1735 rootNode = parentOrShadowHostOrFrameOwner(rootNode); | 1724 rootNode = parentOrShadowHostOrFrameOwner(rootNode); |
1736 std::stringstream stream; | 1725 std::stringstream stream; |
1737 printSubTreeAcrossFrame(rootNode, this, "", stream); | 1726 printSubTreeAcrossFrame(rootNode, this, "", stream); |
1738 // TODO(tkent): Replace WTFLogAlways with something else. | 1727 LOG(INFO) << "\n" << stream.str(); |
1739 WTFLogAlways("%s", stream.str().c_str()); | |
1740 } | 1728 } |
1741 | 1729 |
1742 #endif | 1730 #endif |
1743 | 1731 |
1744 // -------- | 1732 // -------- |
1745 | 1733 |
1746 Element* Node::enclosingLinkEventParentOrSelf() const | 1734 Element* Node::enclosingLinkEventParentOrSelf() const |
1747 { | 1735 { |
1748 const Node* result = nullptr; | 1736 const Node* result = nullptr; |
1749 for (const Node* node = this; node; node = FlatTreeTraversal::parent(*node))
{ | 1737 for (const Node* node = this; node; node = FlatTreeTraversal::parent(*node))
{ |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2389 return V8DOMWrapper::associateObjectWithWrapper(isolate, this, wrapperType,
wrapper); | 2377 return V8DOMWrapper::associateObjectWithWrapper(isolate, this, wrapperType,
wrapper); |
2390 } | 2378 } |
2391 | 2379 |
2392 } // namespace blink | 2380 } // namespace blink |
2393 | 2381 |
2394 #ifndef NDEBUG | 2382 #ifndef NDEBUG |
2395 | 2383 |
2396 void showNode(const blink::Node* node) | 2384 void showNode(const blink::Node* node) |
2397 { | 2385 { |
2398 if (node) | 2386 if (node) |
2399 node->showNode(""); | 2387 LOG(INFO) << *node; |
2400 else | 2388 else |
2401 fprintf(stderr, "Cannot showNode for (nil)\n"); | 2389 LOG(INFO) << "Cannot showNode for <null>"; |
2402 } | 2390 } |
2403 | 2391 |
2404 void showTree(const blink::Node* node) | 2392 void showTree(const blink::Node* node) |
2405 { | 2393 { |
2406 // TODO(tkent): Replace WTFLogAlways with something else. | 2394 if (node) |
2407 WTFLogAlways("%s", node ? node->toTreeStringForThis().utf8().data() : "Canno
t showTree for <null>"); | 2395 LOG(INFO) << "\n" << node->toTreeStringForThis().utf8().data(); |
| 2396 else |
| 2397 LOG(INFO) << "Cannot showTree for <null>"; |
2408 } | 2398 } |
2409 | 2399 |
2410 void showNodePath(const blink::Node* node) | 2400 void showNodePath(const blink::Node* node) |
2411 { | 2401 { |
2412 std::stringstream stream; | 2402 if (node) { |
2413 if (node) | 2403 std::stringstream stream; |
2414 node->printNodePathTo(stream); | 2404 node->printNodePathTo(stream); |
2415 else | 2405 LOG(INFO) << stream.str(); |
2416 stream << "Cannot showNodePath for <null>"; | 2406 } else { |
2417 stream << "\n"; | 2407 LOG(INFO) << "Cannot showNodePath for <null>"; |
2418 // TODO(tkent): Replace WTFLogAlways with something else. | 2408 } |
2419 WTFLogAlways("%s", stream.str().c_str()); | |
2420 } | 2409 } |
2421 | 2410 |
2422 #endif | 2411 #endif |
OLD | NEW |