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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 #include "core/dom/ContextFeatures.h" | 64 #include "core/dom/ContextFeatures.h" |
65 #include "core/dom/DOMImplementation.h" | 65 #include "core/dom/DOMImplementation.h" |
66 #include "core/dom/DocumentFragment.h" | 66 #include "core/dom/DocumentFragment.h" |
67 #include "core/dom/DocumentLifecycleNotifier.h" | 67 #include "core/dom/DocumentLifecycleNotifier.h" |
68 #include "core/dom/DocumentLifecycleObserver.h" | 68 #include "core/dom/DocumentLifecycleObserver.h" |
69 #include "core/dom/DocumentMarkerController.h" | 69 #include "core/dom/DocumentMarkerController.h" |
70 #include "core/dom/DocumentType.h" | 70 #include "core/dom/DocumentType.h" |
71 #include "core/dom/Element.h" | 71 #include "core/dom/Element.h" |
72 #include "core/dom/ElementDataCache.h" | 72 #include "core/dom/ElementDataCache.h" |
73 #include "core/dom/ElementTraversal.h" | 73 #include "core/dom/ElementTraversal.h" |
| 74 #include "core/dom/EventHandlerRegistry.h" |
74 #include "core/dom/ExceptionCode.h" | 75 #include "core/dom/ExceptionCode.h" |
75 #include "core/dom/ExecutionContextTask.h" | 76 #include "core/dom/ExecutionContextTask.h" |
76 #include "core/dom/MainThreadTaskRunner.h" | 77 #include "core/dom/MainThreadTaskRunner.h" |
77 #include "core/dom/MutationObserver.h" | 78 #include "core/dom/MutationObserver.h" |
78 #include "core/dom/NodeChildRemovalTracker.h" | 79 #include "core/dom/NodeChildRemovalTracker.h" |
79 #include "core/dom/NodeFilter.h" | 80 #include "core/dom/NodeFilter.h" |
80 #include "core/dom/NodeIterator.h" | 81 #include "core/dom/NodeIterator.h" |
81 #include "core/dom/NodeRareData.h" | 82 #include "core/dom/NodeRareData.h" |
82 #include "core/dom/NodeRenderStyle.h" | 83 #include "core/dom/NodeRenderStyle.h" |
83 #include "core/dom/NodeRenderingTraversal.h" | 84 #include "core/dom/NodeRenderingTraversal.h" |
(...skipping 2004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2088 m_renderView->setStyle(StyleResolver::styleForDocument(*this)); | 2089 m_renderView->setStyle(StyleResolver::styleForDocument(*this)); |
2089 view()->updateCompositingLayersAfterStyleChange(); | 2090 view()->updateCompositingLayersAfterStyleChange(); |
2090 | 2091 |
2091 ContainerNode::attach(context); | 2092 ContainerNode::attach(context); |
2092 | 2093 |
2093 // FastTextAutosizer can't update render view info while the Document is det
ached, so update now in case anything changed. | 2094 // FastTextAutosizer can't update render view info while the Document is det
ached, so update now in case anything changed. |
2094 if (FastTextAutosizer* textAutosizer = fastTextAutosizer()) | 2095 if (FastTextAutosizer* textAutosizer = fastTextAutosizer()) |
2095 textAutosizer->updatePageInfo(); | 2096 textAutosizer->updatePageInfo(); |
2096 | 2097 |
2097 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); | 2098 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); |
| 2099 lifecycleNotifier().notifyDocumentWasAttached(); |
2098 } | 2100 } |
2099 | 2101 |
2100 void Document::detach(const AttachContext& context) | 2102 void Document::detach(const AttachContext& context) |
2101 { | 2103 { |
2102 ASSERT(isActive()); | 2104 ASSERT(isActive()); |
2103 m_lifecycle.advanceTo(DocumentLifecycle::Stopping); | 2105 m_lifecycle.advanceTo(DocumentLifecycle::Stopping); |
| 2106 lifecycleNotifier().notifyWillDetachDocument(); |
2104 | 2107 |
2105 if (page()) | 2108 if (page()) |
2106 page()->documentDetached(this); | 2109 page()->documentDetached(this); |
2107 InspectorInstrumentation::documentDetached(this); | 2110 InspectorInstrumentation::documentDetached(this); |
2108 | 2111 |
2109 if (m_frame->loader().client()->sharedWorkerRepositoryClient()) | 2112 if (m_frame->loader().client()->sharedWorkerRepositoryClient()) |
2110 m_frame->loader().client()->sharedWorkerRepositoryClient()->documentDeta
ched(this); | 2113 m_frame->loader().client()->sharedWorkerRepositoryClient()->documentDeta
ched(this); |
2111 | 2114 |
2112 if (this == topDocument()) | 2115 if (this == topDocument()) |
2113 clearAXObjectCache(); | 2116 clearAXObjectCache(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2147 m_activeHoverElement = nullptr; | 2150 m_activeHoverElement = nullptr; |
2148 m_autofocusElement = nullptr; | 2151 m_autofocusElement = nullptr; |
2149 | 2152 |
2150 ContainerNode::detach(context); | 2153 ContainerNode::detach(context); |
2151 | 2154 |
2152 m_styleEngine->didDetach(); | 2155 m_styleEngine->didDetach(); |
2153 | 2156 |
2154 if (renderView) | 2157 if (renderView) |
2155 renderView->destroy(); | 2158 renderView->destroy(); |
2156 | 2159 |
2157 if (Document* parentDoc = parentDocument()) | |
2158 parentDoc->didClearTouchEventHandlers(this); | |
2159 | |
2160 // This is required, as our LocalFrame might delete itself as soon as it det
aches | 2160 // This is required, as our LocalFrame might delete itself as soon as it det
aches |
2161 // us. However, this violates Node::detach() semantics, as it's never | 2161 // us. However, this violates Node::detach() semantics, as it's never |
2162 // possible to re-attach. Eventually Document::detach() should be renamed, | 2162 // possible to re-attach. Eventually Document::detach() should be renamed, |
2163 // or this setting of the frame to 0 could be made explicit in each of the | 2163 // or this setting of the frame to 0 could be made explicit in each of the |
2164 // callers of Document::detach(). | 2164 // callers of Document::detach(). |
2165 m_frame = 0; | 2165 m_frame = 0; |
2166 | 2166 |
2167 if (m_mediaQueryMatcher) | 2167 if (m_mediaQueryMatcher) |
2168 m_mediaQueryMatcher->documentDestroyed(); | 2168 m_mediaQueryMatcher->documentDestroyed(); |
2169 | 2169 |
(...skipping 2843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5013 // and implement them here. See https://bugs.webkit.org/show_bug.cgi?id=4781
9 | 5013 // and implement them here. See https://bugs.webkit.org/show_bug.cgi?id=4781
9 |
5014 LocalFrame* frame = window ? window->frame() : this->frame(); | 5014 LocalFrame* frame = window ? window->frame() : this->frame(); |
5015 return Touch::create(frame, target, identifier, screenX, screenY, pageX, pag
eY, radiusX, radiusY, rotationAngle, force); | 5015 return Touch::create(frame, target, identifier, screenX, screenY, pageX, pag
eY, radiusX, radiusY, rotationAngle, force); |
5016 } | 5016 } |
5017 | 5017 |
5018 PassRefPtrWillBeRawPtr<TouchList> Document::createTouchList(WillBeHeapVector<Ref
PtrWillBeMember<Touch> >& touches) const | 5018 PassRefPtrWillBeRawPtr<TouchList> Document::createTouchList(WillBeHeapVector<Ref
PtrWillBeMember<Touch> >& touches) const |
5019 { | 5019 { |
5020 return TouchList::create(touches); | 5020 return TouchList::create(touches); |
5021 } | 5021 } |
5022 | 5022 |
5023 void Document::didAddTouchEventHandler(Node* handler) | |
5024 { | |
5025 // The node should either be in this document, or be the Document node of a
child | |
5026 // of this document. | |
5027 ASSERT(&handler->document() == this | |
5028 || (handler->isDocumentNode() && toDocument(handler)->parentDocument() =
= this)); | |
5029 if (!m_touchEventTargets.get()) | |
5030 m_touchEventTargets = adoptPtr(new TouchEventTargetSet); | |
5031 bool isFirstHandler = m_touchEventTargets->isEmpty(); | |
5032 | |
5033 if (!m_touchEventTargets->add(handler).isNewEntry) { | |
5034 // Just incremented refcount, no real change. | |
5035 // If this is a child document node, then the count should never go abov
e 1. | |
5036 ASSERT(!handler->isDocumentNode() || &handler->document() == this); | |
5037 return; | |
5038 } | |
5039 | |
5040 if (isFirstHandler) { | |
5041 if (Document* parent = parentDocument()) { | |
5042 parent->didAddTouchEventHandler(this); | |
5043 } else { | |
5044 // This is the first touch handler on the whole page. | |
5045 if (FrameHost* frameHost = this->frameHost()) | |
5046 frameHost->chrome().client().needTouchEvents(true); | |
5047 } | |
5048 } | |
5049 | |
5050 // When we're all done with all frames, ensure touch hit rects are marked as
dirty. | |
5051 if (!handler->isDocumentNode() || handler == this) { | |
5052 if (Page* page = this->page()) { | |
5053 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoor
dinator()) | |
5054 scrollingCoordinator->touchEventTargetRectsDidChange(); | |
5055 } | |
5056 } | |
5057 } | |
5058 | |
5059 void Document::didRemoveTouchEventHandler(Node* handler, bool clearAll) | |
5060 { | |
5061 // Note that we can't assert that |handler| is in this document because it m
ight be in | |
5062 // the process of moving out of it. | |
5063 ASSERT(clearAll || m_touchEventTargets->contains(handler)); | |
5064 if (!m_touchEventTargets.get()) | |
5065 return; | |
5066 | |
5067 if (clearAll) { | |
5068 if (!m_touchEventTargets->contains(handler)) | |
5069 return; | |
5070 m_touchEventTargets->removeAll(handler); | |
5071 } else { | |
5072 if (!m_touchEventTargets->remove(handler)) | |
5073 // Just decremented refcount, no real update. | |
5074 return; | |
5075 } | |
5076 | |
5077 if (m_touchEventTargets->isEmpty()) { | |
5078 if (Document* parent = parentDocument()) { | |
5079 // This was the last handler in this document, update the parent doc
ument too. | |
5080 parent->didRemoveTouchEventHandler(this, clearAll); | |
5081 } else { | |
5082 // We just removed the last touch handler on the whole page. | |
5083 if (FrameHost* frameHost = this->frameHost()) | |
5084 frameHost->chrome().client().needTouchEvents(false); | |
5085 } | |
5086 } | |
5087 | |
5088 // When we're all done with all frames, ensure touch hit rects are marked as
dirty. | |
5089 if (!handler->isDocumentNode() || handler == this) { | |
5090 if (Page* page = this->page()) { | |
5091 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoor
dinator()) | |
5092 scrollingCoordinator->touchEventTargetRectsDidChange(); | |
5093 } | |
5094 } | |
5095 } | |
5096 | |
5097 void Document::resetLastHandledUserGestureTimestamp() | 5023 void Document::resetLastHandledUserGestureTimestamp() |
5098 { | 5024 { |
5099 m_lastHandledUserGestureTimestamp = currentTime(); | 5025 m_lastHandledUserGestureTimestamp = currentTime(); |
5100 } | 5026 } |
5101 | 5027 |
5102 DocumentLoader* Document::loader() const | 5028 DocumentLoader* Document::loader() const |
5103 { | 5029 { |
5104 if (!m_frame) | 5030 if (!m_frame) |
5105 return 0; | 5031 return 0; |
5106 | 5032 |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5522 } | 5448 } |
5523 | 5449 |
5524 void Document::invalidateNodeListCaches(const QualifiedName* attrName) | 5450 void Document::invalidateNodeListCaches(const QualifiedName* attrName) |
5525 { | 5451 { |
5526 HashSet<LiveNodeListBase*>::iterator end = m_listsInvalidatedAtDocument.end(
); | 5452 HashSet<LiveNodeListBase*>::iterator end = m_listsInvalidatedAtDocument.end(
); |
5527 for (HashSet<LiveNodeListBase*>::iterator it = m_listsInvalidatedAtDocument.
begin(); it != end; ++it) | 5453 for (HashSet<LiveNodeListBase*>::iterator it = m_listsInvalidatedAtDocument.
begin(); it != end; ++it) |
5528 (*it)->invalidateCache(attrName); | 5454 (*it)->invalidateCache(attrName); |
5529 } | 5455 } |
5530 | 5456 |
5531 } // namespace WebCore | 5457 } // namespace WebCore |
OLD | NEW |