| 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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 | 372 |
| 373 PassRefPtr<Node> Node::appendChild(PassRefPtr<Node> newChild, ExceptionState& ex
ceptionState) | 373 PassRefPtr<Node> Node::appendChild(PassRefPtr<Node> newChild, ExceptionState& ex
ceptionState) |
| 374 { | 374 { |
| 375 if (isContainerNode()) | 375 if (isContainerNode()) |
| 376 return toContainerNode(this)->appendChild(newChild, exceptionState); | 376 return toContainerNode(this)->appendChild(newChild, exceptionState); |
| 377 | 377 |
| 378 exceptionState.ThrowDOMException(HierarchyRequestError, "This node type does
not support this method."); | 378 exceptionState.ThrowDOMException(HierarchyRequestError, "This node type does
not support this method."); |
| 379 return nullptr; | 379 return nullptr; |
| 380 } | 380 } |
| 381 | 381 |
| 382 Element* Node::previousElementSibling() |
| 383 { |
| 384 return ElementTraversal::previousSibling(*this); |
| 385 } |
| 386 |
| 387 Element* Node::nextElementSibling() |
| 388 { |
| 389 return ElementTraversal::nextSibling(*this); |
| 390 } |
| 391 |
| 392 void Node::newInsertBefore(Vector<RefPtr<Node>>& nodes, ExceptionState& es) |
| 393 { |
| 394 ScriptForbiddenScope scope; |
| 395 RefPtr<ContainerNode> parent = parentNode(); |
| 396 if (!parent) |
| 397 return; |
| 398 RefPtr<Node> protect(this); |
| 399 for (auto& node : nodes) { |
| 400 parent->insertBefore(node.release(), this, es); |
| 401 if (es.had_exception()) |
| 402 return; |
| 403 } |
| 404 } |
| 405 |
| 406 void Node::newInsertAfter(Vector<RefPtr<Node>>& nodes, ExceptionState& es) |
| 407 { |
| 408 ScriptForbiddenScope scope; |
| 409 RefPtr<ContainerNode> parent = this->parentNode(); |
| 410 if (!parent) |
| 411 return; |
| 412 RefPtr<Node> reference = m_next; |
| 413 for (auto& node : nodes) { |
| 414 parent->insertBefore(node.release(), reference, es); |
| 415 if (es.had_exception()) |
| 416 return; |
| 417 } |
| 418 } |
| 419 |
| 420 void Node::replaceWith(Vector<RefPtr<Node>>& nodes, ExceptionState& es) |
| 421 { |
| 422 RefPtr<ContainerNode> parent = this->parentNode(); |
| 423 if (!parent) |
| 424 return; |
| 425 RefPtr<Node> reference = m_next; |
| 426 remove(es); |
| 427 if (es.had_exception()) |
| 428 return; |
| 429 for (auto& node : nodes) { |
| 430 parent->insertBefore(node, reference.get(), es); |
| 431 if (es.had_exception()) |
| 432 return; |
| 433 } |
| 434 } |
| 435 |
| 382 void Node::remove(ExceptionState& exceptionState) | 436 void Node::remove(ExceptionState& exceptionState) |
| 383 { | 437 { |
| 384 if (ContainerNode* parent = parentNode()) | 438 if (ContainerNode* parent = parentNode()) |
| 385 parent->removeChild(this, exceptionState); | 439 parent->removeChild(this, exceptionState); |
| 386 } | 440 } |
| 387 | 441 |
| 388 const AtomicString& Node::localName() const | 442 const AtomicString& Node::localName() const |
| 389 { | 443 { |
| 390 return nullAtom; | 444 return nullAtom; |
| 391 } | 445 } |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 } | 909 } |
| 856 | 910 |
| 857 // FIXME: End of obviously misplaced HTML editing functions. Try to move these
out of Node. | 911 // FIXME: End of obviously misplaced HTML editing functions. Try to move these
out of Node. |
| 858 | 912 |
| 859 Document* Node::ownerDocument() const | 913 Document* Node::ownerDocument() const |
| 860 { | 914 { |
| 861 Document* doc = &document(); | 915 Document* doc = &document(); |
| 862 return doc == this ? 0 : doc; | 916 return doc == this ? 0 : doc; |
| 863 } | 917 } |
| 864 | 918 |
| 865 ContainerNode* Node::ownerScope() const | 919 ContainerNode* Node::owner() const |
| 866 { | 920 { |
| 867 if (inDocument()) | 921 if (inDocument()) |
| 868 return &treeScope().rootNode(); | 922 return &treeScope().rootNode(); |
| 869 if (ShadowRoot* root = containingShadowRoot()) | 923 if (ShadowRoot* root = containingShadowRoot()) |
| 870 return root; | 924 return root; |
| 871 return 0; | 925 return 0; |
| 872 } | 926 } |
| 873 | 927 |
| 874 String Node::textContent() const | 928 String Node::textContent() const |
| 875 { | 929 { |
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1610 node->showTreeForThis(); | 1664 node->showTreeForThis(); |
| 1611 } | 1665 } |
| 1612 | 1666 |
| 1613 void showNodePath(const blink::Node* node) | 1667 void showNodePath(const blink::Node* node) |
| 1614 { | 1668 { |
| 1615 if (node) | 1669 if (node) |
| 1616 node->showNodePathForThis(); | 1670 node->showNodePathForThis(); |
| 1617 } | 1671 } |
| 1618 | 1672 |
| 1619 #endif | 1673 #endif |
| OLD | NEW |