| 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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 { | 361 { |
| 362 String message = "Unsafe JavaScript attempt to initiate navigation for frame
with URL '" + frame.document()->url().string() + "' from frame with URL '" + ac
tiveURL.string() + "'. " + reason + "\n"; | 362 String message = "Unsafe JavaScript attempt to initiate navigation for frame
with URL '" + frame.document()->url().string() + "' from frame with URL '" + ac
tiveURL.string() + "'. " + reason + "\n"; |
| 363 | 363 |
| 364 // FIXME: should we print to the console of the document performing the navi
gation instead? | 364 // FIXME: should we print to the console of the document performing the navi
gation instead? |
| 365 frame.domWindow()->printErrorMessage(message); | 365 frame.domWindow()->printErrorMessage(message); |
| 366 } | 366 } |
| 367 | 367 |
| 368 uint64_t Document::s_globalTreeVersion = 0; | 368 uint64_t Document::s_globalTreeVersion = 0; |
| 369 | 369 |
| 370 #ifndef NDEBUG | 370 #ifndef NDEBUG |
| 371 typedef WillBeHeapHashSet<RawPtrWillBeWeakMember<Document> > WeakDocumentSet; | 371 using WeakDocumentSet = WillBeHeapHashSet<RawPtrWillBeWeakMember<Document>>; |
| 372 static WeakDocumentSet& liveDocumentSet() | 372 static WeakDocumentSet& liveDocumentSet() |
| 373 { | 373 { |
| 374 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<WeakDocumentSet>, set, (adoptPtrW
illBeNoop(new WeakDocumentSet()))); | 374 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<WeakDocumentSet>, set, (adoptPtrW
illBeNoop(new WeakDocumentSet()))); |
| 375 return *set; | 375 return *set; |
| 376 } | 376 } |
| 377 #endif | 377 #endif |
| 378 | 378 |
| 379 // This class doesn't work with non-Document ExecutionContext. | 379 // This class doesn't work with non-Document ExecutionContext. |
| 380 class AutofocusTask final : public ExecutionContextTask { | 380 class AutofocusTask final : public ExecutionContextTask { |
| 381 public: | 381 public: |
| (...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1457 return pageVisibilityState() != PageVisibilityStateVisible; | 1457 return pageVisibilityState() != PageVisibilityStateVisible; |
| 1458 } | 1458 } |
| 1459 | 1459 |
| 1460 void Document::didChangeVisibilityState() | 1460 void Document::didChangeVisibilityState() |
| 1461 { | 1461 { |
| 1462 dispatchEvent(Event::create(EventTypeNames::visibilitychange)); | 1462 dispatchEvent(Event::create(EventTypeNames::visibilitychange)); |
| 1463 // Also send out the deprecated version until it can be removed. | 1463 // Also send out the deprecated version until it can be removed. |
| 1464 dispatchEvent(Event::create(EventTypeNames::webkitvisibilitychange)); | 1464 dispatchEvent(Event::create(EventTypeNames::webkitvisibilitychange)); |
| 1465 | 1465 |
| 1466 PageVisibilityState state = pageVisibilityState(); | 1466 PageVisibilityState state = pageVisibilityState(); |
| 1467 DocumentVisibilityObserverSet::const_iterator observerEnd = m_visibilityObse
rvers.end(); | 1467 for (DocumentVisibilityObserver* observer : m_visibilityObservers) |
| 1468 for (DocumentVisibilityObserverSet::const_iterator it = m_visibilityObserver
s.begin(); it != observerEnd; ++it) | 1468 observer->didChangeVisibilityState(state); |
| 1469 (*it)->didChangeVisibilityState(state); | |
| 1470 } | 1469 } |
| 1471 | 1470 |
| 1472 void Document::registerVisibilityObserver(DocumentVisibilityObserver* observer) | 1471 void Document::registerVisibilityObserver(DocumentVisibilityObserver* observer) |
| 1473 { | 1472 { |
| 1474 ASSERT(!m_visibilityObservers.contains(observer)); | 1473 ASSERT(!m_visibilityObservers.contains(observer)); |
| 1475 m_visibilityObservers.add(observer); | 1474 m_visibilityObservers.add(observer); |
| 1476 } | 1475 } |
| 1477 | 1476 |
| 1478 void Document::unregisterVisibilityObserver(DocumentVisibilityObserver* observer
) | 1477 void Document::unregisterVisibilityObserver(DocumentVisibilityObserver* observer
) |
| 1479 { | 1478 { |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2056 | 2055 |
| 2057 setSecurityOrigin(SecurityOrigin::createUnique()); | 2056 setSecurityOrigin(SecurityOrigin::createUnique()); |
| 2058 didUpdateSecurityOrigin(); | 2057 didUpdateSecurityOrigin(); |
| 2059 } | 2058 } |
| 2060 | 2059 |
| 2061 bool Document::dirtyElementsForLayerUpdate() | 2060 bool Document::dirtyElementsForLayerUpdate() |
| 2062 { | 2061 { |
| 2063 if (m_layerUpdateSVGFilterElements.isEmpty()) | 2062 if (m_layerUpdateSVGFilterElements.isEmpty()) |
| 2064 return false; | 2063 return false; |
| 2065 | 2064 |
| 2066 for (WillBeHeapHashSet<RawPtrWillBeMember<Element> >::iterator it = m_layerU
pdateSVGFilterElements.begin(), end = m_layerUpdateSVGFilterElements.end(); it !
= end; ++it) | 2065 for (Element* element : m_layerUpdateSVGFilterElements) |
| 2067 (*it)->setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing
::create(StyleChangeReason::SVGFilterLayerUpdate)); | 2066 element->setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTraci
ng::create(StyleChangeReason::SVGFilterLayerUpdate)); |
| 2068 m_layerUpdateSVGFilterElements.clear(); | 2067 m_layerUpdateSVGFilterElements.clear(); |
| 2069 return true; | 2068 return true; |
| 2070 } | 2069 } |
| 2071 | 2070 |
| 2072 void Document::scheduleSVGFilterLayerUpdateHack(Element& element) | 2071 void Document::scheduleSVGFilterLayerUpdateHack(Element& element) |
| 2073 { | 2072 { |
| 2074 if (element.styleChangeType() == NeedsReattachStyleChange) | 2073 if (element.styleChangeType() == NeedsReattachStyleChange) |
| 2075 return; | 2074 return; |
| 2076 element.setSVGFilterNeedsLayerUpdate(); | 2075 element.setSVGFilterNeedsLayerUpdate(); |
| 2077 m_layerUpdateSVGFilterElements.add(&element); | 2076 m_layerUpdateSVGFilterElements.add(&element); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2095 m_useElementsNeedingUpdate.remove(&element); | 2094 m_useElementsNeedingUpdate.remove(&element); |
| 2096 } | 2095 } |
| 2097 | 2096 |
| 2098 void Document::updateUseShadowTreesIfNeeded() | 2097 void Document::updateUseShadowTreesIfNeeded() |
| 2099 { | 2098 { |
| 2100 ScriptForbiddenScope forbidScript; | 2099 ScriptForbiddenScope forbidScript; |
| 2101 | 2100 |
| 2102 if (m_useElementsNeedingUpdate.isEmpty()) | 2101 if (m_useElementsNeedingUpdate.isEmpty()) |
| 2103 return; | 2102 return; |
| 2104 | 2103 |
| 2105 WillBeHeapVector<RawPtrWillBeMember<SVGUseElement> > elements; | 2104 WillBeHeapVector<RawPtrWillBeMember<SVGUseElement>> elements; |
| 2106 copyToVector(m_useElementsNeedingUpdate, elements); | 2105 copyToVector(m_useElementsNeedingUpdate, elements); |
| 2107 m_useElementsNeedingUpdate.clear(); | 2106 m_useElementsNeedingUpdate.clear(); |
| 2108 | 2107 |
| 2109 for (WillBeHeapVector<RawPtrWillBeMember<SVGUseElement> >::iterator it = ele
ments.begin(), end = elements.end(); it != end; ++it) | 2108 for (SVGUseElement* element : elements) |
| 2110 (*it)->buildPendingResource(); | 2109 element->buildPendingResource(); |
| 2111 } | 2110 } |
| 2112 | 2111 |
| 2113 StyleResolver* Document::styleResolver() const | 2112 StyleResolver* Document::styleResolver() const |
| 2114 { | 2113 { |
| 2115 return m_styleEngine->resolver(); | 2114 return m_styleEngine->resolver(); |
| 2116 } | 2115 } |
| 2117 | 2116 |
| 2118 StyleResolver& Document::ensureStyleResolver() const | 2117 StyleResolver& Document::ensureStyleResolver() const |
| 2119 { | 2118 { |
| 2120 return m_styleEngine->ensureResolver(); | 2119 return m_styleEngine->ensureResolver(); |
| (...skipping 1590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3711 | 3710 |
| 3712 void Document::detachNodeIterator(NodeIterator* ni) | 3711 void Document::detachNodeIterator(NodeIterator* ni) |
| 3713 { | 3712 { |
| 3714 // The node iterator can be detached without having been attached if its roo
t node didn't have a document | 3713 // The node iterator can be detached without having been attached if its roo
t node didn't have a document |
| 3715 // when the iterator was created, but has it now. | 3714 // when the iterator was created, but has it now. |
| 3716 m_nodeIterators.remove(ni); | 3715 m_nodeIterators.remove(ni); |
| 3717 } | 3716 } |
| 3718 | 3717 |
| 3719 void Document::moveNodeIteratorsToNewDocument(Node& node, Document& newDocument) | 3718 void Document::moveNodeIteratorsToNewDocument(Node& node, Document& newDocument) |
| 3720 { | 3719 { |
| 3721 WillBeHeapHashSet<RawPtrWillBeWeakMember<NodeIterator> > nodeIteratorsList =
m_nodeIterators; | 3720 WillBeHeapHashSet<RawPtrWillBeWeakMember<NodeIterator>> nodeIteratorsList =
m_nodeIterators; |
| 3722 WillBeHeapHashSet<RawPtrWillBeWeakMember<NodeIterator> >::const_iterator nod
eIteratorsEnd = nodeIteratorsList.end(); | 3721 for (NodeIterator* ni : nodeIteratorsList) { |
| 3723 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<NodeIterator> >::const_iterato
r it = nodeIteratorsList.begin(); it != nodeIteratorsEnd; ++it) { | 3722 if (ni->root() == node) { |
| 3724 if ((*it)->root() == node) { | 3723 detachNodeIterator(ni); |
| 3725 detachNodeIterator(*it); | 3724 newDocument.attachNodeIterator(ni); |
| 3726 newDocument.attachNodeIterator(*it); | |
| 3727 } | 3725 } |
| 3728 } | 3726 } |
| 3729 } | 3727 } |
| 3730 | 3728 |
| 3731 void Document::updateRangesAfterChildrenChanged(ContainerNode* container) | 3729 void Document::updateRangesAfterChildrenChanged(ContainerNode* container) |
| 3732 { | 3730 { |
| 3733 if (!m_ranges.isEmpty()) { | 3731 for (Range* range : m_ranges) |
| 3734 AttachedRangeSet::const_iterator end = m_ranges.end(); | 3732 range->nodeChildrenChanged(container); |
| 3735 for (AttachedRangeSet::const_iterator it = m_ranges.begin(); it != end;
++it) | |
| 3736 (*it)->nodeChildrenChanged(container); | |
| 3737 } | |
| 3738 } | 3733 } |
| 3739 | 3734 |
| 3740 void Document::updateRangesAfterNodeMovedToAnotherDocument(const Node& node) | 3735 void Document::updateRangesAfterNodeMovedToAnotherDocument(const Node& node) |
| 3741 { | 3736 { |
| 3742 ASSERT(node.document() != this); | 3737 ASSERT(node.document() != this); |
| 3743 if (m_ranges.isEmpty()) | 3738 if (m_ranges.isEmpty()) |
| 3744 return; | 3739 return; |
| 3740 |
| 3745 AttachedRangeSet ranges = m_ranges; | 3741 AttachedRangeSet ranges = m_ranges; |
| 3746 AttachedRangeSet::const_iterator end = ranges.end(); | 3742 for (Range* range : ranges) |
| 3747 for (AttachedRangeSet::const_iterator it = ranges.begin(); it != end; ++it) | 3743 range->updateOwnerDocumentIfNeeded(); |
| 3748 (*it)->updateOwnerDocumentIfNeeded(); | |
| 3749 } | 3744 } |
| 3750 | 3745 |
| 3751 void Document::nodeChildrenWillBeRemoved(ContainerNode& container) | 3746 void Document::nodeChildrenWillBeRemoved(ContainerNode& container) |
| 3752 { | 3747 { |
| 3753 EventDispatchForbiddenScope assertNoEventDispatch; | 3748 EventDispatchForbiddenScope assertNoEventDispatch; |
| 3754 if (!m_ranges.isEmpty()) { | 3749 for (Range* range : m_ranges) |
| 3755 AttachedRangeSet::const_iterator end = m_ranges.end(); | 3750 range->nodeChildrenWillBeRemoved(container); |
| 3756 for (AttachedRangeSet::const_iterator it = m_ranges.begin(); it != end;
++it) | |
| 3757 (*it)->nodeChildrenWillBeRemoved(container); | |
| 3758 } | |
| 3759 | 3751 |
| 3760 WillBeHeapHashSet<RawPtrWillBeWeakMember<NodeIterator> >::const_iterator nod
eIteratorsEnd = m_nodeIterators.end(); | 3752 for (NodeIterator* ni : m_nodeIterators) { |
| 3761 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<NodeIterator> >::const_iterato
r it = m_nodeIterators.begin(); it != nodeIteratorsEnd; ++it) { | |
| 3762 for (Node& n : NodeTraversal::childrenOf(container)) | 3753 for (Node& n : NodeTraversal::childrenOf(container)) |
| 3763 (*it)->nodeWillBeRemoved(n); | 3754 ni->nodeWillBeRemoved(n); |
| 3764 } | 3755 } |
| 3765 | 3756 |
| 3766 if (LocalFrame* frame = this->frame()) { | 3757 if (LocalFrame* frame = this->frame()) { |
| 3767 for (Node& n : NodeTraversal::childrenOf(container)) { | 3758 for (Node& n : NodeTraversal::childrenOf(container)) { |
| 3768 frame->eventHandler().nodeWillBeRemoved(n); | 3759 frame->eventHandler().nodeWillBeRemoved(n); |
| 3769 frame->selection().nodeWillBeRemoved(n); | 3760 frame->selection().nodeWillBeRemoved(n); |
| 3770 frame->page()->dragCaretController().nodeWillBeRemoved(n); | 3761 frame->page()->dragCaretController().nodeWillBeRemoved(n); |
| 3771 } | 3762 } |
| 3772 } | 3763 } |
| 3773 } | 3764 } |
| 3774 | 3765 |
| 3775 void Document::nodeWillBeRemoved(Node& n) | 3766 void Document::nodeWillBeRemoved(Node& n) |
| 3776 { | 3767 { |
| 3777 WillBeHeapHashSet<RawPtrWillBeWeakMember<NodeIterator> >::const_iterator nod
eIteratorsEnd = m_nodeIterators.end(); | 3768 for (NodeIterator* ni : m_nodeIterators) |
| 3778 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<NodeIterator> >::const_iterato
r it = m_nodeIterators.begin(); it != nodeIteratorsEnd; ++it) | 3769 ni->nodeWillBeRemoved(n); |
| 3779 (*it)->nodeWillBeRemoved(n); | |
| 3780 | 3770 |
| 3781 if (!m_ranges.isEmpty()) { | 3771 for (Range* range : m_ranges) |
| 3782 AttachedRangeSet::const_iterator rangesEnd = m_ranges.end(); | 3772 range->nodeWillBeRemoved(n); |
| 3783 for (AttachedRangeSet::const_iterator it = m_ranges.begin(); it != range
sEnd; ++it) | |
| 3784 (*it)->nodeWillBeRemoved(n); | |
| 3785 } | |
| 3786 | 3773 |
| 3787 if (LocalFrame* frame = this->frame()) { | 3774 if (LocalFrame* frame = this->frame()) { |
| 3788 frame->eventHandler().nodeWillBeRemoved(n); | 3775 frame->eventHandler().nodeWillBeRemoved(n); |
| 3789 frame->selection().nodeWillBeRemoved(n); | 3776 frame->selection().nodeWillBeRemoved(n); |
| 3790 frame->page()->dragCaretController().nodeWillBeRemoved(n); | 3777 frame->page()->dragCaretController().nodeWillBeRemoved(n); |
| 3791 } | 3778 } |
| 3792 } | 3779 } |
| 3793 | 3780 |
| 3794 void Document::didInsertText(Node* text, unsigned offset, unsigned length) | 3781 void Document::didInsertText(Node* text, unsigned offset, unsigned length) |
| 3795 { | 3782 { |
| 3796 if (!m_ranges.isEmpty()) { | 3783 for (Range* range : m_ranges) |
| 3797 AttachedRangeSet::const_iterator end = m_ranges.end(); | 3784 range->didInsertText(text, offset, length); |
| 3798 for (AttachedRangeSet::const_iterator it = m_ranges.begin(); it != end;
++it) | |
| 3799 (*it)->didInsertText(text, offset, length); | |
| 3800 } | |
| 3801 | 3785 |
| 3802 // Update the markers for spelling and grammar checking. | 3786 // Update the markers for spelling and grammar checking. |
| 3803 m_markers->shiftMarkers(text, offset, length); | 3787 m_markers->shiftMarkers(text, offset, length); |
| 3804 } | 3788 } |
| 3805 | 3789 |
| 3806 void Document::didRemoveText(Node* text, unsigned offset, unsigned length) | 3790 void Document::didRemoveText(Node* text, unsigned offset, unsigned length) |
| 3807 { | 3791 { |
| 3808 if (!m_ranges.isEmpty()) { | 3792 for (Range* range : m_ranges) |
| 3809 AttachedRangeSet::const_iterator end = m_ranges.end(); | 3793 range->didRemoveText(text, offset, length); |
| 3810 for (AttachedRangeSet::const_iterator it = m_ranges.begin(); it != end;
++it) | |
| 3811 (*it)->didRemoveText(text, offset, length); | |
| 3812 } | |
| 3813 | 3794 |
| 3814 // Update the markers for spelling and grammar checking. | 3795 // Update the markers for spelling and grammar checking. |
| 3815 m_markers->removeMarkers(text, offset, length); | 3796 m_markers->removeMarkers(text, offset, length); |
| 3816 m_markers->shiftMarkers(text, offset + length, 0 - length); | 3797 m_markers->shiftMarkers(text, offset + length, 0 - length); |
| 3817 } | 3798 } |
| 3818 | 3799 |
| 3819 void Document::didMergeTextNodes(Text& oldNode, unsigned offset) | 3800 void Document::didMergeTextNodes(Text& oldNode, unsigned offset) |
| 3820 { | 3801 { |
| 3821 if (!m_ranges.isEmpty()) { | 3802 if (!m_ranges.isEmpty()) { |
| 3822 NodeWithIndex oldNodeWithIndex(oldNode); | 3803 NodeWithIndex oldNodeWithIndex(oldNode); |
| 3823 AttachedRangeSet::const_iterator end = m_ranges.end(); | 3804 for (Range* range : m_ranges) |
| 3824 for (AttachedRangeSet::const_iterator it = m_ranges.begin(); it != end;
++it) | 3805 range->didMergeTextNodes(oldNodeWithIndex, offset); |
| 3825 (*it)->didMergeTextNodes(oldNodeWithIndex, offset); | |
| 3826 } | 3806 } |
| 3827 | 3807 |
| 3828 if (m_frame) | 3808 if (m_frame) |
| 3829 m_frame->selection().didMergeTextNodes(oldNode, offset); | 3809 m_frame->selection().didMergeTextNodes(oldNode, offset); |
| 3830 | 3810 |
| 3831 // FIXME: This should update markers for spelling and grammar checking. | 3811 // FIXME: This should update markers for spelling and grammar checking. |
| 3832 } | 3812 } |
| 3833 | 3813 |
| 3834 void Document::didSplitTextNode(Text& oldNode) | 3814 void Document::didSplitTextNode(Text& oldNode) |
| 3835 { | 3815 { |
| 3836 if (!m_ranges.isEmpty()) { | 3816 for (Range* range : m_ranges) |
| 3837 AttachedRangeSet::const_iterator end = m_ranges.end(); | 3817 range->didSplitTextNode(oldNode); |
| 3838 for (AttachedRangeSet::const_iterator it = m_ranges.begin(); it != end;
++it) | |
| 3839 (*it)->didSplitTextNode(oldNode); | |
| 3840 } | |
| 3841 | 3818 |
| 3842 if (m_frame) | 3819 if (m_frame) |
| 3843 m_frame->selection().didSplitTextNode(oldNode); | 3820 m_frame->selection().didSplitTextNode(oldNode); |
| 3844 | 3821 |
| 3845 // FIXME: This should update markers for spelling and grammar checking. | 3822 // FIXME: This should update markers for spelling and grammar checking. |
| 3846 } | 3823 } |
| 3847 | 3824 |
| 3848 void Document::setWindowAttributeEventListener(const AtomicString& eventType, Pa
ssRefPtr<EventListener> listener) | 3825 void Document::setWindowAttributeEventListener(const AtomicString& eventType, Pa
ssRefPtr<EventListener> listener) |
| 3849 { | 3826 { |
| 3850 LocalDOMWindow* domWindow = this->domWindow(); | 3827 LocalDOMWindow* domWindow = this->domWindow(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3886 ensureScriptedAnimationController().enqueuePerFrameEvent(scrollEvent.release
()); | 3863 ensureScriptedAnimationController().enqueuePerFrameEvent(scrollEvent.release
()); |
| 3887 } | 3864 } |
| 3888 | 3865 |
| 3889 void Document::enqueueResizeEvent() | 3866 void Document::enqueueResizeEvent() |
| 3890 { | 3867 { |
| 3891 RefPtrWillBeRawPtr<Event> event = Event::create(EventTypeNames::resize); | 3868 RefPtrWillBeRawPtr<Event> event = Event::create(EventTypeNames::resize); |
| 3892 event->setTarget(domWindow()); | 3869 event->setTarget(domWindow()); |
| 3893 ensureScriptedAnimationController().enqueuePerFrameEvent(event.release()); | 3870 ensureScriptedAnimationController().enqueuePerFrameEvent(event.release()); |
| 3894 } | 3871 } |
| 3895 | 3872 |
| 3896 void Document::enqueueMediaQueryChangeListeners(WillBeHeapVector<RefPtrWillBeMem
ber<MediaQueryListListener> >& listeners) | 3873 void Document::enqueueMediaQueryChangeListeners(WillBeHeapVector<RefPtrWillBeMem
ber<MediaQueryListListener>>& listeners) |
| 3897 { | 3874 { |
| 3898 ensureScriptedAnimationController().enqueueMediaQueryChangeListeners(listene
rs); | 3875 ensureScriptedAnimationController().enqueueMediaQueryChangeListeners(listene
rs); |
| 3899 } | 3876 } |
| 3900 | 3877 |
| 3901 Document::EventFactorySet& Document::eventFactories() | 3878 Document::EventFactorySet& Document::eventFactories() |
| 3902 { | 3879 { |
| 3903 DEFINE_STATIC_LOCAL(EventFactorySet, s_eventFactory, ()); | 3880 DEFINE_STATIC_LOCAL(EventFactorySet, s_eventFactory, ()); |
| 3904 return s_eventFactory; | 3881 return s_eventFactory; |
| 3905 } | 3882 } |
| 3906 | 3883 |
| 3907 void Document::registerEventFactory(PassOwnPtr<EventFactoryBase> eventFactory) | 3884 void Document::registerEventFactory(PassOwnPtr<EventFactoryBase> eventFactory) |
| 3908 { | 3885 { |
| 3909 ASSERT(!eventFactories().contains(eventFactory.get())); | 3886 ASSERT(!eventFactories().contains(eventFactory.get())); |
| 3910 eventFactories().add(eventFactory); | 3887 eventFactories().add(eventFactory); |
| 3911 } | 3888 } |
| 3912 | 3889 |
| 3913 PassRefPtrWillBeRawPtr<Event> Document::createEvent(const String& eventType, Exc
eptionState& exceptionState) | 3890 PassRefPtrWillBeRawPtr<Event> Document::createEvent(const String& eventType, Exc
eptionState& exceptionState) |
| 3914 { | 3891 { |
| 3915 RefPtrWillBeRawPtr<Event> event = nullptr; | 3892 RefPtrWillBeRawPtr<Event> event = nullptr; |
| 3916 for (EventFactorySet::const_iterator it = eventFactories().begin(); it != ev
entFactories().end(); ++it) { | 3893 for (const auto& factory : eventFactories()) { |
| 3917 event = (*it)->create(eventType); | 3894 event = factory->create(eventType); |
| 3918 if (event) | 3895 if (event) |
| 3919 return event.release(); | 3896 return event.release(); |
| 3920 } | 3897 } |
| 3921 exceptionState.throwDOMException(NotSupportedError, "The provided event type
('" + eventType + "') is invalid."); | 3898 exceptionState.throwDOMException(NotSupportedError, "The provided event type
('" + eventType + "') is invalid."); |
| 3922 return nullptr; | 3899 return nullptr; |
| 3923 } | 3900 } |
| 3924 | 3901 |
| 3925 void Document::addMutationEventListenerTypeIfEnabled(ListenerType listenerType) | 3902 void Document::addMutationEventListenerTypeIfEnabled(ListenerType listenerType) |
| 3926 { | 3903 { |
| 3927 if (ContextFeatures::mutationEventsEnabled(this)) | 3904 if (ContextFeatures::mutationEventsEnabled(this)) |
| (...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5256 force = 0; | 5233 force = 0; |
| 5257 | 5234 |
| 5258 // FIXME: It's not clear from the documentation at | 5235 // FIXME: It's not clear from the documentation at |
| 5259 // http://developer.apple.com/library/safari/#documentation/UserExperience/R
eference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html | 5236 // http://developer.apple.com/library/safari/#documentation/UserExperience/R
eference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html |
| 5260 // when this method should throw and nor is it by inspection of iOS behavior
. It would be nice to verify any cases where it throws under iOS | 5237 // when this method should throw and nor is it by inspection of iOS behavior
. It would be nice to verify any cases where it throws under iOS |
| 5261 // and implement them here. See https://bugs.webkit.org/show_bug.cgi?id=4781
9 | 5238 // and implement them here. See https://bugs.webkit.org/show_bug.cgi?id=4781
9 |
| 5262 LocalFrame* frame = window ? window->frame() : this->frame(); | 5239 LocalFrame* frame = window ? window->frame() : this->frame(); |
| 5263 return Touch::create(frame, target, identifier, FloatPoint(screenX, screenY)
, FloatPoint(pageX, pageY), FloatSize(radiusX, radiusY), rotationAngle, force); | 5240 return Touch::create(frame, target, identifier, FloatPoint(screenX, screenY)
, FloatPoint(pageX, pageY), FloatSize(radiusX, radiusY), rotationAngle, force); |
| 5264 } | 5241 } |
| 5265 | 5242 |
| 5266 PassRefPtrWillBeRawPtr<TouchList> Document::createTouchList(WillBeHeapVector<Ref
PtrWillBeMember<Touch> >& touches) const | 5243 PassRefPtrWillBeRawPtr<TouchList> Document::createTouchList(WillBeHeapVector<Ref
PtrWillBeMember<Touch>>& touches) const |
| 5267 { | 5244 { |
| 5268 return TouchList::adopt(touches); | 5245 return TouchList::adopt(touches); |
| 5269 } | 5246 } |
| 5270 | 5247 |
| 5271 DocumentLoader* Document::loader() const | 5248 DocumentLoader* Document::loader() const |
| 5272 { | 5249 { |
| 5273 if (!m_frame) | 5250 if (!m_frame) |
| 5274 return 0; | 5251 return 0; |
| 5275 | 5252 |
| 5276 DocumentLoader* loader = m_frame->loader().documentLoader(); | 5253 DocumentLoader* loader = m_frame->loader().documentLoader(); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5545 if (!m_didAssociateFormControlsTimer.isActive()) | 5522 if (!m_didAssociateFormControlsTimer.isActive()) |
| 5546 m_didAssociateFormControlsTimer.startOneShot(0, FROM_HERE); | 5523 m_didAssociateFormControlsTimer.startOneShot(0, FROM_HERE); |
| 5547 } | 5524 } |
| 5548 | 5525 |
| 5549 void Document::didAssociateFormControlsTimerFired(Timer<Document>* timer) | 5526 void Document::didAssociateFormControlsTimerFired(Timer<Document>* timer) |
| 5550 { | 5527 { |
| 5551 ASSERT_UNUSED(timer, timer == &m_didAssociateFormControlsTimer); | 5528 ASSERT_UNUSED(timer, timer == &m_didAssociateFormControlsTimer); |
| 5552 if (!frame() || !frame()->page()) | 5529 if (!frame() || !frame()->page()) |
| 5553 return; | 5530 return; |
| 5554 | 5531 |
| 5555 WillBeHeapVector<RefPtrWillBeMember<Element> > associatedFormControls; | 5532 WillBeHeapVector<RefPtrWillBeMember<Element>> associatedFormControls; |
| 5556 copyToVector(m_associatedFormControls, associatedFormControls); | 5533 copyToVector(m_associatedFormControls, associatedFormControls); |
| 5557 | 5534 |
| 5558 frame()->page()->chrome().client().didAssociateFormControls(associatedFormCo
ntrols); | 5535 frame()->page()->chrome().client().didAssociateFormControls(associatedFormCo
ntrols); |
| 5559 m_associatedFormControls.clear(); | 5536 m_associatedFormControls.clear(); |
| 5560 } | 5537 } |
| 5561 | 5538 |
| 5562 float Document::devicePixelRatio() const | 5539 float Document::devicePixelRatio() const |
| 5563 { | 5540 { |
| 5564 return m_frame ? m_frame->devicePixelRatio() : 1.0; | 5541 return m_frame ? m_frame->devicePixelRatio() : 1.0; |
| 5565 } | 5542 } |
| 5566 | 5543 |
| 5567 PassOwnPtr<LifecycleNotifier<Document> > Document::createLifecycleNotifier() | 5544 PassOwnPtr<LifecycleNotifier<Document>> Document::createLifecycleNotifier() |
| 5568 { | 5545 { |
| 5569 return DocumentLifecycleNotifier::create(this); | 5546 return DocumentLifecycleNotifier::create(this); |
| 5570 } | 5547 } |
| 5571 | 5548 |
| 5572 DocumentLifecycleNotifier& Document::lifecycleNotifier() | 5549 DocumentLifecycleNotifier& Document::lifecycleNotifier() |
| 5573 { | 5550 { |
| 5574 return static_cast<DocumentLifecycleNotifier&>(LifecycleContext<Document>::l
ifecycleNotifier()); | 5551 return static_cast<DocumentLifecycleNotifier&>(LifecycleContext<Document>::l
ifecycleNotifier()); |
| 5575 } | 5552 } |
| 5576 | 5553 |
| 5577 void Document::removedStyleSheet(StyleSheet* sheet, StyleResolverUpdateMode upda
teMode) | 5554 void Document::removedStyleSheet(StyleSheet* sheet, StyleResolverUpdateMode upda
teMode) |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5684 Frame* focusedFrame = page->focusController().focusedFrame(); | 5661 Frame* focusedFrame = page->focusController().focusedFrame(); |
| 5685 if (focusedFrame && focusedFrame->isLocalFrame()) { | 5662 if (focusedFrame && focusedFrame->isLocalFrame()) { |
| 5686 if (toLocalFrame(focusedFrame)->tree().isDescendantOf(frame())) | 5663 if (toLocalFrame(focusedFrame)->tree().isDescendantOf(frame())) |
| 5687 return true; | 5664 return true; |
| 5688 } | 5665 } |
| 5689 return false; | 5666 return false; |
| 5690 } | 5667 } |
| 5691 | 5668 |
| 5692 #if ENABLE(OILPAN) | 5669 #if ENABLE(OILPAN) |
| 5693 template<unsigned type> | 5670 template<unsigned type> |
| 5694 bool shouldInvalidateNodeListCachesForAttr(const HeapHashSet<WeakMember<const Li
veNodeListBase> > nodeLists[], const QualifiedName& attrName) | 5671 bool shouldInvalidateNodeListCachesForAttr(const HeapHashSet<WeakMember<const Li
veNodeListBase>> nodeLists[], const QualifiedName& attrName) |
| 5695 { | 5672 { |
| 5696 if (!nodeLists[type].isEmpty() && LiveNodeListBase::shouldInvalidateTypeOnAt
tributeChange(static_cast<NodeListInvalidationType>(type), attrName)) | 5673 if (!nodeLists[type].isEmpty() && LiveNodeListBase::shouldInvalidateTypeOnAt
tributeChange(static_cast<NodeListInvalidationType>(type), attrName)) |
| 5697 return true; | 5674 return true; |
| 5698 return shouldInvalidateNodeListCachesForAttr<type + 1>(nodeLists, attrName); | 5675 return shouldInvalidateNodeListCachesForAttr<type + 1>(nodeLists, attrName); |
| 5699 } | 5676 } |
| 5700 | 5677 |
| 5701 template<> | 5678 template<> |
| 5702 bool shouldInvalidateNodeListCachesForAttr<numNodeListInvalidationTypes>(const H
eapHashSet<WeakMember<const LiveNodeListBase> >[], const QualifiedName&) | 5679 bool shouldInvalidateNodeListCachesForAttr<numNodeListInvalidationTypes>(const H
eapHashSet<WeakMember<const LiveNodeListBase>>[], const QualifiedName&) |
| 5703 { | 5680 { |
| 5704 return false; | 5681 return false; |
| 5705 } | 5682 } |
| 5706 #else | 5683 #else |
| 5707 template<unsigned type> | 5684 template<unsigned type> |
| 5708 bool shouldInvalidateNodeListCachesForAttr(const unsigned nodeListCounts[], cons
t QualifiedName& attrName) | 5685 bool shouldInvalidateNodeListCachesForAttr(const unsigned nodeListCounts[], cons
t QualifiedName& attrName) |
| 5709 { | 5686 { |
| 5710 if (nodeListCounts[type] && LiveNodeListBase::shouldInvalidateTypeOnAttribut
eChange(static_cast<NodeListInvalidationType>(type), attrName)) | 5687 if (nodeListCounts[type] && LiveNodeListBase::shouldInvalidateTypeOnAttribut
eChange(static_cast<NodeListInvalidationType>(type), attrName)) |
| 5711 return true; | 5688 return true; |
| 5712 return shouldInvalidateNodeListCachesForAttr<type + 1>(nodeListCounts, attrN
ame); | 5689 return shouldInvalidateNodeListCachesForAttr<type + 1>(nodeListCounts, attrN
ame); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 5736 if (m_nodeListCounts[type]) | 5713 if (m_nodeListCounts[type]) |
| 5737 #endif | 5714 #endif |
| 5738 return true; | 5715 return true; |
| 5739 } | 5716 } |
| 5740 | 5717 |
| 5741 return false; | 5718 return false; |
| 5742 } | 5719 } |
| 5743 | 5720 |
| 5744 void Document::invalidateNodeListCaches(const QualifiedName* attrName) | 5721 void Document::invalidateNodeListCaches(const QualifiedName* attrName) |
| 5745 { | 5722 { |
| 5746 WillBeHeapHashSet<RawPtrWillBeWeakMember<const LiveNodeListBase> >::const_it
erator end = m_listsInvalidatedAtDocument.end(); | 5723 for (const LiveNodeListBase* list : m_listsInvalidatedAtDocument) |
| 5747 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<const LiveNodeListBase> >::con
st_iterator it = m_listsInvalidatedAtDocument.begin(); it != end; ++it) | 5724 list->invalidateCacheForAttribute(attrName); |
| 5748 (*it)->invalidateCacheForAttribute(attrName); | |
| 5749 } | 5725 } |
| 5750 | 5726 |
| 5751 void Document::clearWeakMembers(Visitor* visitor) | 5727 void Document::clearWeakMembers(Visitor* visitor) |
| 5752 { | 5728 { |
| 5753 if (m_axObjectCache) | 5729 if (m_axObjectCache) |
| 5754 m_axObjectCache->clearWeakMembers(visitor); | 5730 m_axObjectCache->clearWeakMembers(visitor); |
| 5755 } | 5731 } |
| 5756 | 5732 |
| 5757 v8::Handle<v8::Object> Document::wrap(v8::Handle<v8::Object> creationContext, v8
::Isolate* isolate) | 5733 v8::Handle<v8::Object> Document::wrap(v8::Handle<v8::Object> creationContext, v8
::Isolate* isolate) |
| 5758 { | 5734 { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5850 } | 5826 } |
| 5851 | 5827 |
| 5852 } // namespace blink | 5828 } // namespace blink |
| 5853 | 5829 |
| 5854 #ifndef NDEBUG | 5830 #ifndef NDEBUG |
| 5855 using namespace blink; | 5831 using namespace blink; |
| 5856 void showLiveDocumentInstances() | 5832 void showLiveDocumentInstances() |
| 5857 { | 5833 { |
| 5858 WeakDocumentSet& set = liveDocumentSet(); | 5834 WeakDocumentSet& set = liveDocumentSet(); |
| 5859 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5835 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 5860 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it
) { | 5836 for (Document* document : set) |
| 5861 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut
f8().data()); | 5837 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); |
| 5862 } | |
| 5863 } | 5838 } |
| 5864 #endif | 5839 #endif |
| OLD | NEW |