| 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 1980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2064 m_renderView = new RenderView(this); | 2065 m_renderView = new RenderView(this); |
| 2065 setRenderer(m_renderView); | 2066 setRenderer(m_renderView); |
| 2066 | 2067 |
| 2067 m_renderView->setIsInWindow(true); | 2068 m_renderView->setIsInWindow(true); |
| 2068 m_renderView->setStyle(StyleResolver::styleForDocument(*this)); | 2069 m_renderView->setStyle(StyleResolver::styleForDocument(*this)); |
| 2069 view()->updateCompositingLayersAfterStyleChange(); | 2070 view()->updateCompositingLayersAfterStyleChange(); |
| 2070 | 2071 |
| 2071 ContainerNode::attach(context); | 2072 ContainerNode::attach(context); |
| 2072 | 2073 |
| 2073 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); | 2074 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); |
| 2075 lifecycleNotifier().notifyDocumentWasAttached(); |
| 2074 } | 2076 } |
| 2075 | 2077 |
| 2076 void Document::detach(const AttachContext& context) | 2078 void Document::detach(const AttachContext& context) |
| 2077 { | 2079 { |
| 2078 ASSERT(isActive()); | 2080 ASSERT(isActive()); |
| 2079 m_lifecycle.advanceTo(DocumentLifecycle::Stopping); | 2081 m_lifecycle.advanceTo(DocumentLifecycle::Stopping); |
| 2082 lifecycleNotifier().notifyWillDetachDocument(); |
| 2080 | 2083 |
| 2081 if (page()) | 2084 if (page()) |
| 2082 page()->documentDetached(this); | 2085 page()->documentDetached(this); |
| 2083 InspectorInstrumentation::documentDetached(this); | 2086 InspectorInstrumentation::documentDetached(this); |
| 2084 | 2087 |
| 2085 if (m_frame->loader().client()->sharedWorkerRepositoryClient()) | 2088 if (m_frame->loader().client()->sharedWorkerRepositoryClient()) |
| 2086 m_frame->loader().client()->sharedWorkerRepositoryClient()->documentDeta
ched(this); | 2089 m_frame->loader().client()->sharedWorkerRepositoryClient()->documentDeta
ched(this); |
| 2087 | 2090 |
| 2088 if (this == topDocument()) | 2091 if (this == topDocument()) |
| 2089 clearAXObjectCache(); | 2092 clearAXObjectCache(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2123 m_activeHoverElement = nullptr; | 2126 m_activeHoverElement = nullptr; |
| 2124 m_autofocusElement = nullptr; | 2127 m_autofocusElement = nullptr; |
| 2125 | 2128 |
| 2126 ContainerNode::detach(context); | 2129 ContainerNode::detach(context); |
| 2127 | 2130 |
| 2128 m_styleEngine->didDetach(); | 2131 m_styleEngine->didDetach(); |
| 2129 | 2132 |
| 2130 if (renderView) | 2133 if (renderView) |
| 2131 renderView->destroy(); | 2134 renderView->destroy(); |
| 2132 | 2135 |
| 2133 if (Document* parentDoc = parentDocument()) | |
| 2134 parentDoc->didClearTouchEventHandlers(this); | |
| 2135 | |
| 2136 // This is required, as our LocalFrame might delete itself as soon as it det
aches | 2136 // This is required, as our LocalFrame might delete itself as soon as it det
aches |
| 2137 // us. However, this violates Node::detach() semantics, as it's never | 2137 // us. However, this violates Node::detach() semantics, as it's never |
| 2138 // possible to re-attach. Eventually Document::detach() should be renamed, | 2138 // possible to re-attach. Eventually Document::detach() should be renamed, |
| 2139 // or this setting of the frame to 0 could be made explicit in each of the | 2139 // or this setting of the frame to 0 could be made explicit in each of the |
| 2140 // callers of Document::detach(). | 2140 // callers of Document::detach(). |
| 2141 m_frame = 0; | 2141 m_frame = 0; |
| 2142 | 2142 |
| 2143 if (m_mediaQueryMatcher) | 2143 if (m_mediaQueryMatcher) |
| 2144 m_mediaQueryMatcher->documentDestroyed(); | 2144 m_mediaQueryMatcher->documentDestroyed(); |
| 2145 | 2145 |
| (...skipping 2838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4984 // and implement them here. See https://bugs.webkit.org/show_bug.cgi?id=4781
9 | 4984 // and implement them here. See https://bugs.webkit.org/show_bug.cgi?id=4781
9 |
| 4985 LocalFrame* frame = window ? window->frame() : this->frame(); | 4985 LocalFrame* frame = window ? window->frame() : this->frame(); |
| 4986 return Touch::create(frame, target, identifier, screenX, screenY, pageX, pag
eY, radiusX, radiusY, rotationAngle, force); | 4986 return Touch::create(frame, target, identifier, screenX, screenY, pageX, pag
eY, radiusX, radiusY, rotationAngle, force); |
| 4987 } | 4987 } |
| 4988 | 4988 |
| 4989 PassRefPtrWillBeRawPtr<TouchList> Document::createTouchList(WillBeHeapVector<Ref
PtrWillBeMember<Touch> >& touches) const | 4989 PassRefPtrWillBeRawPtr<TouchList> Document::createTouchList(WillBeHeapVector<Ref
PtrWillBeMember<Touch> >& touches) const |
| 4990 { | 4990 { |
| 4991 return TouchList::create(touches); | 4991 return TouchList::create(touches); |
| 4992 } | 4992 } |
| 4993 | 4993 |
| 4994 void Document::didAddTouchEventHandler(Node* handler) | |
| 4995 { | |
| 4996 // The node should either be in this document, or be the Document node of a
child | |
| 4997 // of this document. | |
| 4998 ASSERT(&handler->document() == this | |
| 4999 || (handler->isDocumentNode() && toDocument(handler)->parentDocument() =
= this)); | |
| 5000 if (!m_touchEventTargets.get()) | |
| 5001 m_touchEventTargets = adoptPtr(new TouchEventTargetSet); | |
| 5002 bool isFirstHandler = m_touchEventTargets->isEmpty(); | |
| 5003 | |
| 5004 if (!m_touchEventTargets->add(handler).isNewEntry) { | |
| 5005 // Just incremented refcount, no real change. | |
| 5006 // If this is a child document node, then the count should never go abov
e 1. | |
| 5007 ASSERT(!handler->isDocumentNode() || &handler->document() == this); | |
| 5008 return; | |
| 5009 } | |
| 5010 | |
| 5011 if (isFirstHandler) { | |
| 5012 if (Document* parent = parentDocument()) { | |
| 5013 parent->didAddTouchEventHandler(this); | |
| 5014 } else { | |
| 5015 // This is the first touch handler on the whole page. | |
| 5016 if (FrameHost* frameHost = this->frameHost()) | |
| 5017 frameHost->chrome().client().needTouchEvents(true); | |
| 5018 } | |
| 5019 } | |
| 5020 | |
| 5021 // When we're all done with all frames, ensure touch hit rects are marked as
dirty. | |
| 5022 if (!handler->isDocumentNode() || handler == this) { | |
| 5023 if (Page* page = this->page()) { | |
| 5024 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoor
dinator()) | |
| 5025 scrollingCoordinator->touchEventTargetRectsDidChange(); | |
| 5026 } | |
| 5027 } | |
| 5028 } | |
| 5029 | |
| 5030 void Document::didRemoveTouchEventHandler(Node* handler, bool clearAll) | |
| 5031 { | |
| 5032 // Note that we can't assert that |handler| is in this document because it m
ight be in | |
| 5033 // the process of moving out of it. | |
| 5034 ASSERT(clearAll || m_touchEventTargets->contains(handler)); | |
| 5035 if (!m_touchEventTargets.get()) | |
| 5036 return; | |
| 5037 | |
| 5038 if (clearAll) { | |
| 5039 if (!m_touchEventTargets->contains(handler)) | |
| 5040 return; | |
| 5041 m_touchEventTargets->removeAll(handler); | |
| 5042 } else { | |
| 5043 if (!m_touchEventTargets->remove(handler)) | |
| 5044 // Just decremented refcount, no real update. | |
| 5045 return; | |
| 5046 } | |
| 5047 | |
| 5048 if (m_touchEventTargets->isEmpty()) { | |
| 5049 if (Document* parent = parentDocument()) { | |
| 5050 // This was the last handler in this document, update the parent doc
ument too. | |
| 5051 parent->didRemoveTouchEventHandler(this, clearAll); | |
| 5052 } else { | |
| 5053 // We just removed the last touch handler on the whole page. | |
| 5054 if (FrameHost* frameHost = this->frameHost()) | |
| 5055 frameHost->chrome().client().needTouchEvents(false); | |
| 5056 } | |
| 5057 } | |
| 5058 | |
| 5059 // When we're all done with all frames, ensure touch hit rects are marked as
dirty. | |
| 5060 if (!handler->isDocumentNode() || handler == this) { | |
| 5061 if (Page* page = this->page()) { | |
| 5062 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoor
dinator()) | |
| 5063 scrollingCoordinator->touchEventTargetRectsDidChange(); | |
| 5064 } | |
| 5065 } | |
| 5066 } | |
| 5067 | |
| 5068 void Document::resetLastHandledUserGestureTimestamp() | 4994 void Document::resetLastHandledUserGestureTimestamp() |
| 5069 { | 4995 { |
| 5070 m_lastHandledUserGestureTimestamp = currentTime(); | 4996 m_lastHandledUserGestureTimestamp = currentTime(); |
| 5071 } | 4997 } |
| 5072 | 4998 |
| 5073 DocumentLoader* Document::loader() const | 4999 DocumentLoader* Document::loader() const |
| 5074 { | 5000 { |
| 5075 if (!m_frame) | 5001 if (!m_frame) |
| 5076 return 0; | 5002 return 0; |
| 5077 | 5003 |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5492 } | 5418 } |
| 5493 | 5419 |
| 5494 void Document::invalidateNodeListCaches(const QualifiedName* attrName) | 5420 void Document::invalidateNodeListCaches(const QualifiedName* attrName) |
| 5495 { | 5421 { |
| 5496 HashSet<LiveNodeListBase*>::iterator end = m_listsInvalidatedAtDocument.end(
); | 5422 HashSet<LiveNodeListBase*>::iterator end = m_listsInvalidatedAtDocument.end(
); |
| 5497 for (HashSet<LiveNodeListBase*>::iterator it = m_listsInvalidatedAtDocument.
begin(); it != end; ++it) | 5423 for (HashSet<LiveNodeListBase*>::iterator it = m_listsInvalidatedAtDocument.
begin(); it != end; ++it) |
| 5498 (*it)->invalidateCache(attrName); | 5424 (*it)->invalidateCache(attrName); |
| 5499 } | 5425 } |
| 5500 | 5426 |
| 5501 } // namespace WebCore | 5427 } // namespace WebCore |
| OLD | NEW |