| 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 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 | 899 |
| 900 ContainerNode* Node::ownerScope() const | 900 ContainerNode* Node::ownerScope() const |
| 901 { | 901 { |
| 902 if (inDocument()) | 902 if (inDocument()) |
| 903 return &treeScope().rootNode(); | 903 return &treeScope().rootNode(); |
| 904 if (ShadowRoot* root = containingShadowRoot()) | 904 if (ShadowRoot* root = containingShadowRoot()) |
| 905 return root; | 905 return root; |
| 906 return 0; | 906 return 0; |
| 907 } | 907 } |
| 908 | 908 |
| 909 static void appendTextContent(const Node* node, bool convertBRsToNewlines, Strin
gBuilder& content) | 909 String Node::textContent() const |
| 910 { | |
| 911 if (node->nodeType() == Node::TEXT_NODE) { | |
| 912 content.append(toCharacterData(node)->data()); | |
| 913 return; | |
| 914 } | |
| 915 | |
| 916 for (Node* child = toContainerNode(node)->firstChild(); child; child = child
->nextSibling()) { | |
| 917 appendTextContent(child, convertBRsToNewlines, content); | |
| 918 } | |
| 919 } | |
| 920 | |
| 921 String Node::textContent(bool convertBRsToNewlines) const | |
| 922 { | 910 { |
| 923 StringBuilder content; | 911 StringBuilder content; |
| 924 appendTextContent(this, convertBRsToNewlines, content); | 912 for (const Node* node = this; node; node = NodeTraversal::next(*node, this))
{ |
| 913 if (node->isTextNode()) |
| 914 content.append(toText(node)->data()); |
| 915 } |
| 925 return content.toString(); | 916 return content.toString(); |
| 926 } | 917 } |
| 927 | 918 |
| 928 void Node::setTextContent(const String& text) | 919 void Node::setTextContent(const String& text) |
| 929 { | 920 { |
| 930 switch (nodeType()) { | 921 switch (nodeType()) { |
| 931 case TEXT_NODE: | 922 case TEXT_NODE: |
| 932 toText(this)->setData(text); | 923 toText(this)->setData(text); |
| 933 return; | 924 return; |
| 934 case ELEMENT_NODE: | 925 case ELEMENT_NODE: |
| (...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1738 node->showTreeForThis(); | 1729 node->showTreeForThis(); |
| 1739 } | 1730 } |
| 1740 | 1731 |
| 1741 void showNodePath(const blink::Node* node) | 1732 void showNodePath(const blink::Node* node) |
| 1742 { | 1733 { |
| 1743 if (node) | 1734 if (node) |
| 1744 node->showNodePathForThis(); | 1735 node->showNodePathForThis(); |
| 1745 } | 1736 } |
| 1746 | 1737 |
| 1747 #endif | 1738 #endif |
| OLD | NEW |