Chromium Code Reviews| 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 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 920 if (exceptionState.hadException()) | 920 if (exceptionState.hadException()) |
| 921 return false; | 921 return false; |
| 922 newContainerNode->appendChild(newChild.release(), exceptionState); | 922 newContainerNode->appendChild(newChild.release(), exceptionState); |
| 923 if (exceptionState.hadException()) | 923 if (exceptionState.hadException()) |
| 924 return false; | 924 return false; |
| 925 } | 925 } |
| 926 | 926 |
| 927 return true; | 927 return true; |
| 928 } | 928 } |
| 929 | 929 |
| 930 PassRefPtr<Node> Document::importNode(Node* importedNode, ExceptionState& ec) | 930 PassRefPtrWillBeRawPtr<Node> Document::importNode(Node* importedNode, ExceptionS tate& ec) |
| 931 { | 931 { |
| 932 UseCounter::countDeprecation(this, UseCounter::DocumentImportNodeOptionalArg ument); | 932 UseCounter::countDeprecation(this, UseCounter::DocumentImportNodeOptionalArg ument); |
| 933 return importNode(importedNode, true, ec); | 933 return importNode(importedNode, true, ec); |
| 934 } | 934 } |
| 935 | 935 |
| 936 PassRefPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionSt ate& exceptionState) | 936 PassRefPtrWillBeRawPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionState& exceptionState) |
| 937 { | 937 { |
| 938 if (!importedNode) { | 938 if (!importedNode) { |
| 939 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::a rgumentNullOrIncorrectType(1, "Node")); | 939 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::a rgumentNullOrIncorrectType(1, "Node")); |
| 940 return nullptr; | 940 return nullptr; |
| 941 } | 941 } |
| 942 | 942 |
| 943 switch (importedNode->nodeType()) { | 943 switch (importedNode->nodeType()) { |
| 944 case TEXT_NODE: | 944 case TEXT_NODE: |
| 945 return createTextNode(importedNode->nodeValue()); | 945 return createTextNode(importedNode->nodeValue()); |
| 946 case CDATA_SECTION_NODE: | 946 case CDATA_SECTION_NODE: |
| 947 return createCDATASection(importedNode->nodeValue(), exceptionState); | 947 return createCDATASection(importedNode->nodeValue(), exceptionState); |
| 948 case PROCESSING_INSTRUCTION_NODE: | 948 case PROCESSING_INSTRUCTION_NODE: |
| 949 return createProcessingInstruction(importedNode->nodeName(), importedNod e->nodeValue(), exceptionState); | 949 return createProcessingInstruction(importedNode->nodeName(), importedNod e->nodeValue(), exceptionState); |
| 950 case COMMENT_NODE: | 950 case COMMENT_NODE: |
| 951 return createComment(importedNode->nodeValue()); | 951 return createComment(importedNode->nodeValue()); |
| 952 case DOCUMENT_TYPE_NODE: { | 952 case DOCUMENT_TYPE_NODE: { |
| 953 DocumentType* doctype = toDocumentType(importedNode); | 953 DocumentType* doctype = toDocumentType(importedNode); |
| 954 return DocumentType::create(this, doctype->name(), doctype->publicId(), doctype->systemId()); | 954 return DocumentType::create(this, doctype->name(), doctype->publicId(), doctype->systemId()); |
| 955 } | 955 } |
| 956 case ELEMENT_NODE: { | 956 case ELEMENT_NODE: { |
| 957 Element* oldElement = toElement(importedNode); | 957 Element* oldElement = toElement(importedNode); |
| 958 // FIXME: The following check might be unnecessary. Is it possible that | 958 // FIXME: The following check might be unnecessary. Is it possible that |
| 959 // oldElement has mismatched prefix/namespace? | 959 // oldElement has mismatched prefix/namespace? |
| 960 if (!hasValidNamespaceForElements(oldElement->tagQName())) { | 960 if (!hasValidNamespaceForElements(oldElement->tagQName())) { |
| 961 exceptionState.throwDOMException(NamespaceError, "The imported node has an invalid namespace."); | 961 exceptionState.throwDOMException(NamespaceError, "The imported node has an invalid namespace."); |
| 962 return nullptr; | 962 return nullptr; |
| 963 } | 963 } |
| 964 RefPtr<Element> newElement = createElement(oldElement->tagQName(), false ); | 964 RefPtrWillBeRawPtr<Element> newElement = createElement(oldElement->tagQN ame(), false); |
| 965 | 965 |
| 966 newElement->cloneDataFromElement(*oldElement); | 966 newElement->cloneDataFromElement(*oldElement); |
| 967 | 967 |
| 968 if (deep) { | 968 if (deep) { |
| 969 if (!importContainerNodeChildren(oldElement, newElement, exceptionSt ate)) | 969 if (!importContainerNodeChildren(oldElement, newElement, exceptionSt ate)) |
| 970 return nullptr; | 970 return nullptr; |
| 971 if (isHTMLTemplateElement(*oldElement) | 971 if (isHTMLTemplateElement(*oldElement) |
| 972 && !importContainerNodeChildren(toHTMLTemplateElement(oldElement )->content(), toHTMLTemplateElement(newElement)->content(), exceptionState)) | 972 && !importContainerNodeChildren(toHTMLTemplateElement(oldElement )->content(), toHTMLTemplateElement(newElement)->content(), exceptionState)) |
| 973 return nullptr; | 973 return nullptr; |
| 974 } | 974 } |
| (...skipping 4738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5713 // FIXME: Oilpan: Use a weak counted set instead. | 5713 // FIXME: Oilpan: Use a weak counted set instead. |
| 5714 if (m_touchEventTargets) { | 5714 if (m_touchEventTargets) { |
| 5715 Vector<Node*> deadNodes; | 5715 Vector<Node*> deadNodes; |
| 5716 for (TouchEventTargetSet::iterator it = m_touchEventTargets->begin(); it != m_touchEventTargets->end(); ++it) { | 5716 for (TouchEventTargetSet::iterator it = m_touchEventTargets->begin(); it != m_touchEventTargets->end(); ++it) { |
| 5717 if (!visitor->isAlive(it->key)) | 5717 if (!visitor->isAlive(it->key)) |
| 5718 deadNodes.append(it->key); | 5718 deadNodes.append(it->key); |
| 5719 } | 5719 } |
| 5720 for (unsigned i = 0; i < deadNodes.size(); ++i) | 5720 for (unsigned i = 0; i < deadNodes.size(); ++i) |
| 5721 didClearTouchEventHandlers(deadNodes[i]); | 5721 didClearTouchEventHandlers(deadNodes[i]); |
| 5722 } | 5722 } |
| 5723 if (m_domWindow && !visitor->isAlive(m_domWindow)) | |
| 5724 m_domWindow.clear(); | |
|
haraken
2014/05/23 12:23:27
I think we can just trace m_domWindow and ask oilp
sof
2014/05/23 14:29:07
I'm fine with doing that, but we already have clea
haraken
2014/05/23 15:02:45
You're right.
| |
| 5723 } | 5725 } |
| 5724 | 5726 |
| 5725 void Document::trace(Visitor* visitor) | 5727 void Document::trace(Visitor* visitor) |
| 5726 { | 5728 { |
| 5727 visitor->trace(m_docType); | 5729 visitor->trace(m_docType); |
| 5728 visitor->trace(m_implementation); | 5730 visitor->trace(m_implementation); |
| 5729 visitor->trace(m_autofocusElement); | 5731 visitor->trace(m_autofocusElement); |
| 5730 visitor->trace(m_focusedElement); | 5732 visitor->trace(m_focusedElement); |
| 5731 visitor->trace(m_hoverNode); | 5733 visitor->trace(m_hoverNode); |
| 5732 visitor->trace(m_activeHoverElement); | 5734 visitor->trace(m_activeHoverElement); |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 5759 visitor->trace(m_timeline); | 5761 visitor->trace(m_timeline); |
| 5760 visitor->trace(m_compositorPendingAnimations); | 5762 visitor->trace(m_compositorPendingAnimations); |
| 5761 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this); | 5763 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this); |
| 5762 DocumentSupplementable::trace(visitor); | 5764 DocumentSupplementable::trace(visitor); |
| 5763 TreeScope::trace(visitor); | 5765 TreeScope::trace(visitor); |
| 5764 ContainerNode::trace(visitor); | 5766 ContainerNode::trace(visitor); |
| 5765 ExecutionContext::trace(visitor); | 5767 ExecutionContext::trace(visitor); |
| 5766 } | 5768 } |
| 5767 | 5769 |
| 5768 } // namespace WebCore | 5770 } // namespace WebCore |
| OLD | NEW |