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 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1504 DOCUMENT_POSITION_PRECEDING | DOCUMENT_POSITION_CONTAINS | connection; | 1504 DOCUMENT_POSITION_PRECEDING | DOCUMENT_POSITION_CONTAINS | connection; |
1505 } | 1505 } |
1506 | 1506 |
1507 String Node::debugName() const | 1507 String Node::debugName() const |
1508 { | 1508 { |
1509 StringBuilder name; | 1509 StringBuilder name; |
1510 name.append(debugNodeName()); | 1510 name.append(debugNodeName()); |
1511 if (isElementNode()) { | 1511 if (isElementNode()) { |
1512 const Element& thisElement = toElement(*this); | 1512 const Element& thisElement = toElement(*this); |
1513 if (thisElement.hasID()) { | 1513 if (thisElement.hasID()) { |
1514 name.appendLiteral(" id=\'"); | 1514 name.append(" id=\'"); |
1515 name.append(thisElement.getIdAttribute()); | 1515 name.append(thisElement.getIdAttribute()); |
1516 name.append('\''); | 1516 name.append('\''); |
1517 } | 1517 } |
1518 | 1518 |
1519 if (thisElement.hasClass()) { | 1519 if (thisElement.hasClass()) { |
1520 name.appendLiteral(" class=\'"); | 1520 name.append(" class=\'"); |
1521 for (size_t i = 0; i < thisElement.classNames().size(); ++i) { | 1521 for (size_t i = 0; i < thisElement.classNames().size(); ++i) { |
1522 if (i > 0) | 1522 if (i > 0) |
1523 name.append(' '); | 1523 name.append(' '); |
1524 name.append(thisElement.classNames()[i]); | 1524 name.append(thisElement.classNames()[i]); |
1525 } | 1525 } |
1526 name.append('\''); | 1526 name.append('\''); |
1527 } | 1527 } |
1528 } | 1528 } |
1529 return name.toString(); | 1529 return name.toString(); |
1530 } | 1530 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1569 static void appendAttributeDesc(const Node* node, StringBuilder& stringBuilder,
const QualifiedName& name, const char* attrDesc) | 1569 static void appendAttributeDesc(const Node* node, StringBuilder& stringBuilder,
const QualifiedName& name, const char* attrDesc) |
1570 { | 1570 { |
1571 if (!node->isElementNode()) | 1571 if (!node->isElementNode()) |
1572 return; | 1572 return; |
1573 | 1573 |
1574 String attr = toElement(node)->getAttribute(name); | 1574 String attr = toElement(node)->getAttribute(name); |
1575 if (attr.isEmpty()) | 1575 if (attr.isEmpty()) |
1576 return; | 1576 return; |
1577 | 1577 |
1578 stringBuilder.append(attrDesc); | 1578 stringBuilder.append(attrDesc); |
1579 stringBuilder.appendLiteral("=\""); | 1579 stringBuilder.append("=\""); |
1580 stringBuilder.append(attr); | 1580 stringBuilder.append(attr); |
1581 stringBuilder.appendLiteral("\""); | 1581 stringBuilder.append("\""); |
1582 } | 1582 } |
1583 | 1583 |
1584 void Node::showNode(const char* prefix) const | 1584 void Node::showNode(const char* prefix) const |
1585 { | 1585 { |
1586 if (!prefix) | 1586 if (!prefix) |
1587 prefix = ""; | 1587 prefix = ""; |
1588 if (isTextNode()) { | 1588 if (isTextNode()) { |
1589 String value = nodeValue(); | 1589 String value = nodeValue(); |
1590 value.replace('\\', "\\\\"); | 1590 value.replace('\\', "\\\\"); |
1591 value.replace('\n', "\\n"); | 1591 value.replace('\n', "\\n"); |
1592 WTFLogAlways("%s%s\t%p \"%s\"\n", prefix, nodeName().utf8().data(), this
, value.utf8().data()); | 1592 WTFLogAlways("%s%s\t%p \"%s\"\n", prefix, nodeName().utf8().data(), this
, value.utf8().data()); |
1593 } else if (isDocumentTypeNode()) { | 1593 } else if (isDocumentTypeNode()) { |
1594 WTFLogAlways("%sDOCTYPE %s\t%p\n", prefix, nodeName().utf8().data(), thi
s); | 1594 WTFLogAlways("%sDOCTYPE %s\t%p\n", prefix, nodeName().utf8().data(), thi
s); |
1595 } else if (getNodeType() == PROCESSING_INSTRUCTION_NODE) { | 1595 } else if (getNodeType() == PROCESSING_INSTRUCTION_NODE) { |
1596 WTFLogAlways("%s?%s\t%p\n", prefix, nodeName().utf8().data(), this); | 1596 WTFLogAlways("%s?%s\t%p\n", prefix, nodeName().utf8().data(), this); |
1597 } else if (isShadowRoot()) { | 1597 } else if (isShadowRoot()) { |
1598 // nodeName of ShadowRoot is #document-fragment. It's confused with | 1598 // nodeName of ShadowRoot is #document-fragment. It's confused with |
1599 // DocumentFragment. | 1599 // DocumentFragment. |
1600 WTFLogAlways("%s#shadow-root\t%p\n", prefix, this); | 1600 WTFLogAlways("%s#shadow-root\t%p\n", prefix, this); |
1601 } else { | 1601 } else { |
1602 StringBuilder attrs; | 1602 StringBuilder attrs; |
1603 appendAttributeDesc(this, attrs, idAttr, " ID"); | 1603 appendAttributeDesc(this, attrs, idAttr, " ID"); |
1604 appendAttributeDesc(this, attrs, classAttr, " CLASS"); | 1604 appendAttributeDesc(this, attrs, classAttr, " CLASS"); |
1605 appendAttributeDesc(this, attrs, styleAttr, " STYLE"); | 1605 appendAttributeDesc(this, attrs, styleAttr, " STYLE"); |
1606 if (hasEditableStyle()) | 1606 if (hasEditableStyle()) |
1607 attrs.appendLiteral(" (editable)"); | 1607 attrs.append(" (editable)"); |
1608 if (document().focusedElement() == this) | 1608 if (document().focusedElement() == this) |
1609 attrs.appendLiteral(" (focused)"); | 1609 attrs.append(" (focused)"); |
1610 WTFLogAlways("%s%s\t%p%s\n", prefix, nodeName().utf8().data(), this, att
rs.toString().utf8().data()); | 1610 WTFLogAlways("%s%s\t%p%s\n", prefix, nodeName().utf8().data(), this, att
rs.toString().utf8().data()); |
1611 } | 1611 } |
1612 } | 1612 } |
1613 | 1613 |
1614 void Node::showTreeForThis() const | 1614 void Node::showTreeForThis() const |
1615 { | 1615 { |
1616 showTreeAndMark(this, "*"); | 1616 showTreeAndMark(this, "*"); |
1617 } | 1617 } |
1618 | 1618 |
1619 void Node::showTreeForThisInFlatTree() const | 1619 void Node::showTreeForThisInFlatTree() const |
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2497 | 2497 |
2498 void showNodePath(const blink::Node* node) | 2498 void showNodePath(const blink::Node* node) |
2499 { | 2499 { |
2500 if (node) | 2500 if (node) |
2501 node->showNodePathForThis(); | 2501 node->showNodePathForThis(); |
2502 else | 2502 else |
2503 fprintf(stderr, "Cannot showNodePath for (nil)\n"); | 2503 fprintf(stderr, "Cannot showNodePath for (nil)\n"); |
2504 } | 2504 } |
2505 | 2505 |
2506 #endif | 2506 #endif |
OLD | NEW |