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 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1528 Settings* Document::settings() const | 1528 Settings* Document::settings() const |
1529 { | 1529 { |
1530 return m_frame ? m_frame->settings() : 0; | 1530 return m_frame ? m_frame->settings() : 0; |
1531 } | 1531 } |
1532 | 1532 |
1533 PassRefPtrWillBeRawPtr<Range> Document::createRange() | 1533 PassRefPtrWillBeRawPtr<Range> Document::createRange() |
1534 { | 1534 { |
1535 return Range::create(*this); | 1535 return Range::create(*this); |
1536 } | 1536 } |
1537 | 1537 |
1538 PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, ExceptionState
& exceptionState) | 1538 PassRefPtrWillBeRawPtr<NodeIterator> Document::createNodeIterator(Node* root, Ex
ceptionState& exceptionState) |
1539 { | 1539 { |
1540 // FIXME: Probably this should be handled within the bindings layer and Type
Error should be thrown. | 1540 // FIXME: Probably this should be handled within the bindings layer and Type
Error should be thrown. |
1541 if (!root) { | 1541 if (!root) { |
1542 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::a
rgumentNullOrIncorrectType(1, "Node")); | 1542 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::a
rgumentNullOrIncorrectType(1, "Node")); |
1543 return nullptr; | 1543 return nullptr; |
1544 } | 1544 } |
1545 return NodeIterator::create(root, NodeFilter::SHOW_ALL, PassRefPtr<NodeFilte
r>()); | 1545 return NodeIterator::create(root, NodeFilter::SHOW_ALL, nullptr); |
1546 } | 1546 } |
1547 | 1547 |
1548 PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatT
oShow, ExceptionState& exceptionState) | 1548 PassRefPtrWillBeRawPtr<NodeIterator> Document::createNodeIterator(Node* root, un
signed whatToShow, ExceptionState& exceptionState) |
1549 { | 1549 { |
1550 if (!root) { | 1550 if (!root) { |
1551 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::a
rgumentNullOrIncorrectType(1, "Node")); | 1551 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::a
rgumentNullOrIncorrectType(1, "Node")); |
1552 return nullptr; | 1552 return nullptr; |
1553 } | 1553 } |
1554 // FIXME: It might be a good idea to emit a warning if |whatToShow| contains
a bit that is not defined in | 1554 // FIXME: It might be a good idea to emit a warning if |whatToShow| contains
a bit that is not defined in |
1555 // NodeFilter. | 1555 // NodeFilter. |
1556 return NodeIterator::create(root, whatToShow, PassRefPtr<NodeFilter>()); | 1556 return NodeIterator::create(root, whatToShow, nullptr); |
1557 } | 1557 } |
1558 | 1558 |
1559 PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatT
oShow, PassRefPtr<NodeFilter> filter, ExceptionState& exceptionState) | 1559 PassRefPtrWillBeRawPtr<NodeIterator> Document::createNodeIterator(Node* root, un
signed whatToShow, PassRefPtrWillBeRawPtr<NodeFilter> filter, ExceptionState& ex
ceptionState) |
1560 { | 1560 { |
1561 if (!root) { | 1561 if (!root) { |
1562 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::a
rgumentNullOrIncorrectType(1, "Node")); | 1562 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::a
rgumentNullOrIncorrectType(1, "Node")); |
1563 return nullptr; | 1563 return nullptr; |
1564 } | 1564 } |
1565 // FIXME: Ditto. | 1565 // FIXME: Ditto. |
1566 return NodeIterator::create(root, whatToShow, filter); | 1566 return NodeIterator::create(root, whatToShow, filter); |
1567 } | 1567 } |
1568 | 1568 |
1569 PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, ExceptionState& ex
ceptionState) | 1569 PassRefPtrWillBeRawPtr<TreeWalker> Document::createTreeWalker(Node* root, Except
ionState& exceptionState) |
1570 { | 1570 { |
1571 if (!root) { | 1571 if (!root) { |
1572 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::a
rgumentNullOrIncorrectType(1, "Node")); | 1572 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::a
rgumentNullOrIncorrectType(1, "Node")); |
1573 return nullptr; | 1573 return nullptr; |
1574 } | 1574 } |
1575 return TreeWalker::create(root, NodeFilter::SHOW_ALL, PassRefPtr<NodeFilter>
()); | 1575 return TreeWalker::create(root, NodeFilter::SHOW_ALL, nullptr); |
1576 } | 1576 } |
1577 | 1577 |
1578 PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToSho
w, ExceptionState& exceptionState) | 1578 PassRefPtrWillBeRawPtr<TreeWalker> Document::createTreeWalker(Node* root, unsign
ed whatToShow, ExceptionState& exceptionState) |
1579 { | 1579 { |
1580 if (!root) { | 1580 if (!root) { |
1581 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::a
rgumentNullOrIncorrectType(1, "Node")); | 1581 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::a
rgumentNullOrIncorrectType(1, "Node")); |
1582 return nullptr; | 1582 return nullptr; |
1583 } | 1583 } |
1584 return TreeWalker::create(root, whatToShow, PassRefPtr<NodeFilter>()); | 1584 return TreeWalker::create(root, whatToShow, nullptr); |
1585 } | 1585 } |
1586 | 1586 |
1587 PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToSho
w, PassRefPtr<NodeFilter> filter, ExceptionState& exceptionState) | 1587 PassRefPtrWillBeRawPtr<TreeWalker> Document::createTreeWalker(Node* root, unsign
ed whatToShow, PassRefPtrWillBeRawPtr<NodeFilter> filter, ExceptionState& except
ionState) |
1588 { | 1588 { |
1589 if (!root) { | 1589 if (!root) { |
1590 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::a
rgumentNullOrIncorrectType(1, "Node")); | 1590 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::a
rgumentNullOrIncorrectType(1, "Node")); |
1591 return nullptr; | 1591 return nullptr; |
1592 } | 1592 } |
1593 return TreeWalker::create(root, whatToShow, filter); | 1593 return TreeWalker::create(root, whatToShow, filter); |
1594 } | 1594 } |
1595 | 1595 |
1596 bool Document::needsRenderTreeUpdate() const | 1596 bool Document::needsRenderTreeUpdate() const |
1597 { | 1597 { |
(...skipping 2120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3718 | 3718 |
3719 void Document::detachNodeIterator(NodeIterator* ni) | 3719 void Document::detachNodeIterator(NodeIterator* ni) |
3720 { | 3720 { |
3721 // The node iterator can be detached without having been attached if its roo
t node didn't have a document | 3721 // The node iterator can be detached without having been attached if its roo
t node didn't have a document |
3722 // when the iterator was created, but has it now. | 3722 // when the iterator was created, but has it now. |
3723 m_nodeIterators.remove(ni); | 3723 m_nodeIterators.remove(ni); |
3724 } | 3724 } |
3725 | 3725 |
3726 void Document::moveNodeIteratorsToNewDocument(Node& node, Document& newDocument) | 3726 void Document::moveNodeIteratorsToNewDocument(Node& node, Document& newDocument) |
3727 { | 3727 { |
3728 HashSet<NodeIterator*> nodeIteratorsList = m_nodeIterators; | 3728 WillBeHeapHashSet<RawPtrWillBeWeakMember<NodeIterator> > nodeIteratorsList =
m_nodeIterators; |
3729 HashSet<NodeIterator*>::const_iterator nodeIteratorsEnd = nodeIteratorsList.
end(); | 3729 WillBeHeapHashSet<RawPtrWillBeWeakMember<NodeIterator> >::const_iterator nod
eIteratorsEnd = nodeIteratorsList.end(); |
3730 for (HashSet<NodeIterator*>::const_iterator it = nodeIteratorsList.begin();
it != nodeIteratorsEnd; ++it) { | 3730 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<NodeIterator> >::const_iterato
r it = nodeIteratorsList.begin(); it != nodeIteratorsEnd; ++it) { |
3731 if ((*it)->root() == node) { | 3731 if ((*it)->root() == node) { |
3732 detachNodeIterator(*it); | 3732 detachNodeIterator(*it); |
3733 newDocument.attachNodeIterator(*it); | 3733 newDocument.attachNodeIterator(*it); |
3734 } | 3734 } |
3735 } | 3735 } |
3736 } | 3736 } |
3737 | 3737 |
3738 void Document::updateRangesAfterChildrenChanged(ContainerNode* container) | 3738 void Document::updateRangesAfterChildrenChanged(ContainerNode* container) |
3739 { | 3739 { |
3740 if (!m_ranges.isEmpty()) { | 3740 if (!m_ranges.isEmpty()) { |
3741 HashSet<Range*>::const_iterator end = m_ranges.end(); | 3741 HashSet<Range*>::const_iterator end = m_ranges.end(); |
3742 for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; +
+it) | 3742 for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; +
+it) |
3743 (*it)->nodeChildrenChanged(container); | 3743 (*it)->nodeChildrenChanged(container); |
3744 } | 3744 } |
3745 } | 3745 } |
3746 | 3746 |
3747 void Document::nodeChildrenWillBeRemoved(ContainerNode& container) | 3747 void Document::nodeChildrenWillBeRemoved(ContainerNode& container) |
3748 { | 3748 { |
3749 NoEventDispatchAssertion assertNoEventDispatch; | 3749 NoEventDispatchAssertion assertNoEventDispatch; |
3750 if (!m_ranges.isEmpty()) { | 3750 if (!m_ranges.isEmpty()) { |
3751 HashSet<Range*>::const_iterator end = m_ranges.end(); | 3751 HashSet<Range*>::const_iterator end = m_ranges.end(); |
3752 for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; +
+it) | 3752 for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; +
+it) |
3753 (*it)->nodeChildrenWillBeRemoved(container); | 3753 (*it)->nodeChildrenWillBeRemoved(container); |
3754 } | 3754 } |
3755 | 3755 |
3756 HashSet<NodeIterator*>::const_iterator nodeIteratorsEnd = m_nodeIterators.en
d(); | 3756 WillBeHeapHashSet<RawPtrWillBeWeakMember<NodeIterator> >::const_iterator nod
eIteratorsEnd = m_nodeIterators.end(); |
3757 for (HashSet<NodeIterator*>::const_iterator it = m_nodeIterators.begin(); it
!= nodeIteratorsEnd; ++it) { | 3757 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<NodeIterator> >::const_iterato
r it = m_nodeIterators.begin(); it != nodeIteratorsEnd; ++it) { |
3758 for (Node* n = container.firstChild(); n; n = n->nextSibling()) | 3758 for (Node* n = container.firstChild(); n; n = n->nextSibling()) |
3759 (*it)->nodeWillBeRemoved(*n); | 3759 (*it)->nodeWillBeRemoved(*n); |
3760 } | 3760 } |
3761 | 3761 |
3762 if (LocalFrame* frame = this->frame()) { | 3762 if (LocalFrame* frame = this->frame()) { |
3763 for (Node* n = container.firstChild(); n; n = n->nextSibling()) { | 3763 for (Node* n = container.firstChild(); n; n = n->nextSibling()) { |
3764 frame->eventHandler().nodeWillBeRemoved(*n); | 3764 frame->eventHandler().nodeWillBeRemoved(*n); |
3765 frame->selection().nodeWillBeRemoved(*n); | 3765 frame->selection().nodeWillBeRemoved(*n); |
3766 frame->page()->dragCaretController().nodeWillBeRemoved(*n); | 3766 frame->page()->dragCaretController().nodeWillBeRemoved(*n); |
3767 } | 3767 } |
3768 } | 3768 } |
3769 } | 3769 } |
3770 | 3770 |
3771 void Document::nodeWillBeRemoved(Node& n) | 3771 void Document::nodeWillBeRemoved(Node& n) |
3772 { | 3772 { |
3773 HashSet<NodeIterator*>::const_iterator nodeIteratorsEnd = m_nodeIterators.en
d(); | 3773 WillBeHeapHashSet<RawPtrWillBeWeakMember<NodeIterator> >::const_iterator nod
eIteratorsEnd = m_nodeIterators.end(); |
3774 for (HashSet<NodeIterator*>::const_iterator it = m_nodeIterators.begin(); it
!= nodeIteratorsEnd; ++it) | 3774 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<NodeIterator> >::const_iterato
r it = m_nodeIterators.begin(); it != nodeIteratorsEnd; ++it) |
3775 (*it)->nodeWillBeRemoved(n); | 3775 (*it)->nodeWillBeRemoved(n); |
3776 | 3776 |
3777 if (!m_ranges.isEmpty()) { | 3777 if (!m_ranges.isEmpty()) { |
3778 HashSet<Range*>::const_iterator rangesEnd = m_ranges.end(); | 3778 HashSet<Range*>::const_iterator rangesEnd = m_ranges.end(); |
3779 for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != ranges
End; ++it) | 3779 for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != ranges
End; ++it) |
3780 (*it)->nodeWillBeRemoved(n); | 3780 (*it)->nodeWillBeRemoved(n); |
3781 } | 3781 } |
3782 | 3782 |
3783 if (LocalFrame* frame = this->frame()) { | 3783 if (LocalFrame* frame = this->frame()) { |
3784 frame->eventHandler().nodeWillBeRemoved(n); | 3784 frame->eventHandler().nodeWillBeRemoved(n); |
(...skipping 1923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5708 visitor->trace(m_hoverNode); | 5708 visitor->trace(m_hoverNode); |
5709 visitor->trace(m_activeHoverElement); | 5709 visitor->trace(m_activeHoverElement); |
5710 visitor->trace(m_documentElement); | 5710 visitor->trace(m_documentElement); |
5711 visitor->trace(m_titleElement); | 5711 visitor->trace(m_titleElement); |
5712 visitor->trace(m_markers); | 5712 visitor->trace(m_markers); |
5713 visitor->trace(m_currentScriptStack); | 5713 visitor->trace(m_currentScriptStack); |
5714 visitor->trace(m_transformSourceDocument); | 5714 visitor->trace(m_transformSourceDocument); |
5715 visitor->trace(m_cssCanvasElements); | 5715 visitor->trace(m_cssCanvasElements); |
5716 visitor->trace(m_topLayerElements); | 5716 visitor->trace(m_topLayerElements); |
5717 visitor->trace(m_elemSheet); | 5717 visitor->trace(m_elemSheet); |
| 5718 visitor->trace(m_nodeIterators); |
5718 visitor->trace(m_styleEngine); | 5719 visitor->trace(m_styleEngine); |
5719 visitor->trace(m_formController); | 5720 visitor->trace(m_formController); |
5720 visitor->trace(m_fetcher); | 5721 visitor->trace(m_fetcher); |
5721 visitor->trace(m_contextFeatures); | 5722 visitor->trace(m_contextFeatures); |
5722 visitor->trace(m_styleSheetList); | 5723 visitor->trace(m_styleSheetList); |
5723 visitor->trace(m_mediaQueryMatcher); | 5724 visitor->trace(m_mediaQueryMatcher); |
5724 visitor->trace(m_associatedFormControls); | 5725 visitor->trace(m_associatedFormControls); |
5725 visitor->trace(m_templateDocument); | 5726 visitor->trace(m_templateDocument); |
5726 visitor->trace(m_templateDocumentHost); | 5727 visitor->trace(m_templateDocumentHost); |
5727 visitor->trace(m_visibilityObservers); | 5728 visitor->trace(m_visibilityObservers); |
5728 visitor->trace(m_userActionElements); | 5729 visitor->trace(m_userActionElements); |
5729 visitor->trace(m_svgExtensions); | 5730 visitor->trace(m_svgExtensions); |
5730 visitor->trace(m_timeline); | 5731 visitor->trace(m_timeline); |
5731 visitor->trace(m_transitionTimeline); | 5732 visitor->trace(m_transitionTimeline); |
5732 visitor->trace(m_compositorPendingAnimations); | 5733 visitor->trace(m_compositorPendingAnimations); |
5733 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this); | 5734 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this); |
5734 DocumentSupplementable::trace(visitor); | 5735 DocumentSupplementable::trace(visitor); |
5735 TreeScope::trace(visitor); | 5736 TreeScope::trace(visitor); |
5736 ContainerNode::trace(visitor); | 5737 ContainerNode::trace(visitor); |
5737 ExecutionContext::trace(visitor); | 5738 ExecutionContext::trace(visitor); |
5738 } | 5739 } |
5739 | 5740 |
5740 } // namespace WebCore | 5741 } // namespace WebCore |
OLD | NEW |