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 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. |
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 } | 935 } |
936 | 936 |
937 PassRefPtrWillBeRawPtr<Node> Document::importNode(Node* importedNode, ExceptionS
tate& ec) | 937 PassRefPtrWillBeRawPtr<Node> Document::importNode(Node* importedNode, ExceptionS
tate& ec) |
938 { | 938 { |
939 UseCounter::countDeprecation(this, UseCounter::DocumentImportNodeOptionalArg
ument); | 939 UseCounter::countDeprecation(this, UseCounter::DocumentImportNodeOptionalArg
ument); |
940 return importNode(importedNode, true, ec); | 940 return importNode(importedNode, true, ec); |
941 } | 941 } |
942 | 942 |
943 PassRefPtrWillBeRawPtr<Node> Document::importNode(Node* importedNode, bool deep,
ExceptionState& exceptionState) | 943 PassRefPtrWillBeRawPtr<Node> Document::importNode(Node* importedNode, bool deep,
ExceptionState& exceptionState) |
944 { | 944 { |
945 if (!importedNode) { | |
946 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::a
rgumentNullOrIncorrectType(1, "Node")); | |
947 return nullptr; | |
948 } | |
949 | |
950 switch (importedNode->nodeType()) { | 945 switch (importedNode->nodeType()) { |
951 case TEXT_NODE: | 946 case TEXT_NODE: |
952 return createTextNode(importedNode->nodeValue()); | 947 return createTextNode(importedNode->nodeValue()); |
953 case CDATA_SECTION_NODE: | 948 case CDATA_SECTION_NODE: |
954 return CDATASection::create(*this, importedNode->nodeValue()); | 949 return CDATASection::create(*this, importedNode->nodeValue()); |
955 case PROCESSING_INSTRUCTION_NODE: | 950 case PROCESSING_INSTRUCTION_NODE: |
956 return createProcessingInstruction(importedNode->nodeName(), importedNod
e->nodeValue(), exceptionState); | 951 return createProcessingInstruction(importedNode->nodeName(), importedNod
e->nodeValue(), exceptionState); |
957 case COMMENT_NODE: | 952 case COMMENT_NODE: |
958 return createComment(importedNode->nodeValue()); | 953 return createComment(importedNode->nodeValue()); |
959 case DOCUMENT_TYPE_NODE: { | 954 case DOCUMENT_TYPE_NODE: { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 exceptionState.throwDOMException(NotSupportedError, "The node provided i
s a document, which may not be imported."); | 997 exceptionState.throwDOMException(NotSupportedError, "The node provided i
s a document, which may not be imported."); |
1003 return nullptr; | 998 return nullptr; |
1004 } | 999 } |
1005 | 1000 |
1006 ASSERT_NOT_REACHED(); | 1001 ASSERT_NOT_REACHED(); |
1007 return nullptr; | 1002 return nullptr; |
1008 } | 1003 } |
1009 | 1004 |
1010 PassRefPtrWillBeRawPtr<Node> Document::adoptNode(PassRefPtrWillBeRawPtr<Node> so
urce, ExceptionState& exceptionState) | 1005 PassRefPtrWillBeRawPtr<Node> Document::adoptNode(PassRefPtrWillBeRawPtr<Node> so
urce, ExceptionState& exceptionState) |
1011 { | 1006 { |
1012 if (!source) { | |
1013 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::a
rgumentNullOrIncorrectType(1, "Node")); | |
1014 return nullptr; | |
1015 } | |
1016 | |
1017 EventQueueScope scope; | 1007 EventQueueScope scope; |
1018 | 1008 |
1019 switch (source->nodeType()) { | 1009 switch (source->nodeType()) { |
1020 case DOCUMENT_NODE: | 1010 case DOCUMENT_NODE: |
1021 case DOCUMENT_TYPE_NODE: | 1011 case DOCUMENT_TYPE_NODE: |
1022 exceptionState.throwDOMException(NotSupportedError, "The node provided i
s of type '" + source->nodeName() + "', which may not be adopted."); | 1012 exceptionState.throwDOMException(NotSupportedError, "The node provided i
s of type '" + source->nodeName() + "', which may not be adopted."); |
1023 return nullptr; | 1013 return nullptr; |
1024 case ATTRIBUTE_NODE: { | 1014 case ATTRIBUTE_NODE: { |
1025 Attr* attr = toAttr(source.get()); | 1015 Attr* attr = toAttr(source.get()); |
1026 if (RefPtrWillBeRawPtr<Element> ownerElement = attr->ownerElement()) | 1016 if (RefPtrWillBeRawPtr<Element> ownerElement = attr->ownerElement()) |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1537 return m_frame ? m_frame->settings() : 0; | 1527 return m_frame ? m_frame->settings() : 0; |
1538 } | 1528 } |
1539 | 1529 |
1540 PassRefPtrWillBeRawPtr<Range> Document::createRange() | 1530 PassRefPtrWillBeRawPtr<Range> Document::createRange() |
1541 { | 1531 { |
1542 return Range::create(*this); | 1532 return Range::create(*this); |
1543 } | 1533 } |
1544 | 1534 |
1545 PassRefPtrWillBeRawPtr<NodeIterator> Document::createNodeIterator(Node* root, un
signed whatToShow, PassRefPtrWillBeRawPtr<NodeFilter> filter, ExceptionState& ex
ceptionState) | 1535 PassRefPtrWillBeRawPtr<NodeIterator> Document::createNodeIterator(Node* root, un
signed whatToShow, PassRefPtrWillBeRawPtr<NodeFilter> filter, ExceptionState& ex
ceptionState) |
1546 { | 1536 { |
1547 // FIXME: Probably this should be handled within the bindings layer and Type
Error should be thrown. | |
1548 if (!root) { | |
1549 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::a
rgumentNullOrIncorrectType(1, "Node")); | |
1550 return nullptr; | |
1551 } | |
1552 // FIXME: It might be a good idea to emit a warning if |whatToShow| contains
a bit that is not defined in | 1537 // FIXME: It might be a good idea to emit a warning if |whatToShow| contains
a bit that is not defined in |
1553 // NodeFilter. | 1538 // NodeFilter. |
1554 return NodeIterator::create(root, whatToShow, filter); | 1539 return NodeIterator::create(root, whatToShow, filter); |
1555 } | 1540 } |
1556 | 1541 |
1557 PassRefPtrWillBeRawPtr<TreeWalker> Document::createTreeWalker(Node* root, unsign
ed whatToShow, PassRefPtrWillBeRawPtr<NodeFilter> filter, ExceptionState& except
ionState) | 1542 PassRefPtrWillBeRawPtr<TreeWalker> Document::createTreeWalker(Node* root, unsign
ed whatToShow, PassRefPtrWillBeRawPtr<NodeFilter> filter, ExceptionState& except
ionState) |
1558 { | 1543 { |
1559 // FIXME: Probably this should be handled within the bindings layer and Type
Error should be thrown. | |
1560 if (!root) { | |
1561 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::a
rgumentNullOrIncorrectType(1, "Node")); | |
1562 return nullptr; | |
1563 } | |
1564 return TreeWalker::create(root, whatToShow, filter); | 1544 return TreeWalker::create(root, whatToShow, filter); |
1565 } | 1545 } |
1566 | 1546 |
1567 bool Document::needsRenderTreeUpdate() const | 1547 bool Document::needsRenderTreeUpdate() const |
1568 { | 1548 { |
1569 if (!isActive() || !view()) | 1549 if (!isActive() || !view()) |
1570 return false; | 1550 return false; |
1571 if (needsFullRenderTreeUpdate()) | 1551 if (needsFullRenderTreeUpdate()) |
1572 return true; | 1552 return true; |
1573 if (childNeedsStyleRecalc()) | 1553 if (childNeedsStyleRecalc()) |
(...skipping 4262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5836 visitor->trace(m_compositorPendingAnimations); | 5816 visitor->trace(m_compositorPendingAnimations); |
5837 visitor->trace(m_contextDocument); | 5817 visitor->trace(m_contextDocument); |
5838 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this); | 5818 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this); |
5839 DocumentSupplementable::trace(visitor); | 5819 DocumentSupplementable::trace(visitor); |
5840 TreeScope::trace(visitor); | 5820 TreeScope::trace(visitor); |
5841 ContainerNode::trace(visitor); | 5821 ContainerNode::trace(visitor); |
5842 ExecutionContext::trace(visitor); | 5822 ExecutionContext::trace(visitor); |
5843 } | 5823 } |
5844 | 5824 |
5845 } // namespace WebCore | 5825 } // namespace WebCore |
OLD | NEW |