| 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 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 if (deep) { | 646 if (deep) { |
| 647 if (!importContainerNodeChildren(oldElement, newElement, exceptionSt
ate)) | 647 if (!importContainerNodeChildren(oldElement, newElement, exceptionSt
ate)) |
| 648 return nullptr; | 648 return nullptr; |
| 649 if (isHTMLTemplateElement(*oldElement) | 649 if (isHTMLTemplateElement(*oldElement) |
| 650 && !importContainerNodeChildren(toHTMLTemplateElement(oldElement
)->content(), toHTMLTemplateElement(newElement)->content(), exceptionState)) | 650 && !importContainerNodeChildren(toHTMLTemplateElement(oldElement
)->content(), toHTMLTemplateElement(newElement)->content(), exceptionState)) |
| 651 return nullptr; | 651 return nullptr; |
| 652 } | 652 } |
| 653 | 653 |
| 654 return newElement.release(); | 654 return newElement.release(); |
| 655 } | 655 } |
| 656 case ATTRIBUTE_NODE: | |
| 657 exceptionState.throwDOMException(NotSupportedError, "Cannot clone an Att
r."); | |
| 658 return nullptr; | |
| 659 case DOCUMENT_FRAGMENT_NODE: { | 656 case DOCUMENT_FRAGMENT_NODE: { |
| 660 if (importedNode->isShadowRoot()) { | 657 if (importedNode->isShadowRoot()) { |
| 661 // ShadowRoot nodes should not be explicitly importable. | 658 // ShadowRoot nodes should not be explicitly importable. |
| 662 // Either they are imported along with their host node, or created i
mplicitly. | 659 // Either they are imported along with their host node, or created i
mplicitly. |
| 663 exceptionState.throwDOMException(NotSupportedError, "The node provid
ed is a shadow root, which may not be imported."); | 660 exceptionState.throwDOMException(NotSupportedError, "The node provid
ed is a shadow root, which may not be imported."); |
| 664 return nullptr; | 661 return nullptr; |
| 665 } | 662 } |
| 666 DocumentFragment* oldFragment = toDocumentFragment(importedNode); | 663 DocumentFragment* oldFragment = toDocumentFragment(importedNode); |
| 667 RefPtr<DocumentFragment> newFragment = createDocumentFragment(); | 664 RefPtr<DocumentFragment> newFragment = createDocumentFragment(); |
| 668 if (deep && !importContainerNodeChildren(oldFragment, newFragment, excep
tionState)) | 665 if (deep && !importContainerNodeChildren(oldFragment, newFragment, excep
tionState)) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 680 } | 677 } |
| 681 | 678 |
| 682 PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionState& ex
ceptionState) | 679 PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionState& ex
ceptionState) |
| 683 { | 680 { |
| 684 EventQueueScope scope; | 681 EventQueueScope scope; |
| 685 | 682 |
| 686 switch (source->nodeType()) { | 683 switch (source->nodeType()) { |
| 687 case DOCUMENT_NODE: | 684 case DOCUMENT_NODE: |
| 688 exceptionState.throwDOMException(NotSupportedError, "The node provided i
s of type '" + source->nodeName() + "', which may not be adopted."); | 685 exceptionState.throwDOMException(NotSupportedError, "The node provided i
s of type '" + source->nodeName() + "', which may not be adopted."); |
| 689 return nullptr; | 686 return nullptr; |
| 690 case ATTRIBUTE_NODE: { | |
| 691 exceptionState.throwDOMException(NotSupportedError, "Cannot adopt Attr."
); | |
| 692 break; | |
| 693 } | |
| 694 default: | 687 default: |
| 695 if (source->isShadowRoot()) { | 688 if (source->isShadowRoot()) { |
| 696 // ShadowRoot cannot disconnect itself from the host node. | 689 // ShadowRoot cannot disconnect itself from the host node. |
| 697 exceptionState.throwDOMException(HierarchyRequestError, "The node pr
ovided is a shadow root, which may not be adopted."); | 690 exceptionState.throwDOMException(HierarchyRequestError, "The node pr
ovided is a shadow root, which may not be adopted."); |
| 698 return nullptr; | 691 return nullptr; |
| 699 } | 692 } |
| 700 | 693 |
| 701 if (source->parentNode()) { | 694 if (source->parentNode()) { |
| 702 source->parentNode()->removeChild(source.get(), exceptionState); | 695 source->parentNode()->removeChild(source.get(), exceptionState); |
| 703 if (exceptionState.hadException()) | 696 if (exceptionState.hadException()) |
| (...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1814 if (!request.readOnly()) | 1807 if (!request.readOnly()) |
| 1815 updateHoverActiveState(request, result.innerElement(), &event); | 1808 updateHoverActiveState(request, result.innerElement(), &event); |
| 1816 | 1809 |
| 1817 return MouseEventWithHitTestResults(event, result); | 1810 return MouseEventWithHitTestResults(event, result); |
| 1818 } | 1811 } |
| 1819 | 1812 |
| 1820 // DOM Section 1.1.1 | 1813 // DOM Section 1.1.1 |
| 1821 bool Document::childTypeAllowed(NodeType type) const | 1814 bool Document::childTypeAllowed(NodeType type) const |
| 1822 { | 1815 { |
| 1823 switch (type) { | 1816 switch (type) { |
| 1824 case ATTRIBUTE_NODE: | |
| 1825 case DOCUMENT_FRAGMENT_NODE: | 1817 case DOCUMENT_FRAGMENT_NODE: |
| 1826 case DOCUMENT_NODE: | 1818 case DOCUMENT_NODE: |
| 1827 case TEXT_NODE: | 1819 case TEXT_NODE: |
| 1828 return false; | 1820 return false; |
| 1829 case ELEMENT_NODE: | 1821 case ELEMENT_NODE: |
| 1830 // Documents may contain no more than one of each of these. | 1822 // Documents may contain no more than one of each of these. |
| 1831 // (One Element and one DocumentType.) | 1823 // (One Element and one DocumentType.) |
| 1832 for (Node* c = firstChild(); c; c = c->nextSibling()) | 1824 for (Node* c = firstChild(); c; c = c->nextSibling()) |
| 1833 if (c->nodeType() == type) | 1825 if (c->nodeType() == type) |
| 1834 return false; | 1826 return false; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1856 break; | 1848 break; |
| 1857 default: | 1849 default: |
| 1858 break; | 1850 break; |
| 1859 } | 1851 } |
| 1860 } | 1852 } |
| 1861 | 1853 |
| 1862 // Then, see how many doctypes and elements might be added by the new child. | 1854 // Then, see how many doctypes and elements might be added by the new child. |
| 1863 if (newChild.isDocumentFragment()) { | 1855 if (newChild.isDocumentFragment()) { |
| 1864 for (Node* c = toDocumentFragment(newChild).firstChild(); c; c = c->next
Sibling()) { | 1856 for (Node* c = toDocumentFragment(newChild).firstChild(); c; c = c->next
Sibling()) { |
| 1865 switch (c->nodeType()) { | 1857 switch (c->nodeType()) { |
| 1866 case ATTRIBUTE_NODE: | |
| 1867 case DOCUMENT_FRAGMENT_NODE: | 1858 case DOCUMENT_FRAGMENT_NODE: |
| 1868 case DOCUMENT_NODE: | 1859 case DOCUMENT_NODE: |
| 1869 case TEXT_NODE: | 1860 case TEXT_NODE: |
| 1870 return false; | 1861 return false; |
| 1871 case ELEMENT_NODE: | 1862 case ELEMENT_NODE: |
| 1872 numElements++; | 1863 numElements++; |
| 1873 break; | 1864 break; |
| 1874 } | 1865 } |
| 1875 } | 1866 } |
| 1876 } else { | 1867 } else { |
| 1877 switch (newChild.nodeType()) { | 1868 switch (newChild.nodeType()) { |
| 1878 case ATTRIBUTE_NODE: | |
| 1879 case DOCUMENT_FRAGMENT_NODE: | 1869 case DOCUMENT_FRAGMENT_NODE: |
| 1880 case DOCUMENT_NODE: | 1870 case DOCUMENT_NODE: |
| 1881 case TEXT_NODE: | 1871 case TEXT_NODE: |
| 1882 return false; | 1872 return false; |
| 1883 case ELEMENT_NODE: | 1873 case ELEMENT_NODE: |
| 1884 numElements++; | 1874 numElements++; |
| 1885 break; | 1875 break; |
| 1886 } | 1876 } |
| 1887 } | 1877 } |
| 1888 | 1878 |
| (...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3129 using namespace blink; | 3119 using namespace blink; |
| 3130 void showLiveDocumentInstances() | 3120 void showLiveDocumentInstances() |
| 3131 { | 3121 { |
| 3132 WeakDocumentSet& set = liveDocumentSet(); | 3122 WeakDocumentSet& set = liveDocumentSet(); |
| 3133 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 3123 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 3134 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it
) { | 3124 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it
) { |
| 3135 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut
f8().data()); | 3125 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut
f8().data()); |
| 3136 } | 3126 } |
| 3137 } | 3127 } |
| 3138 #endif | 3128 #endif |
| OLD | NEW |