Chromium Code Reviews| Index: Source/core/dom/Document.cpp |
| diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp |
| index 931178c83ae212f1cb39bfc1b87d65bd6fe57a36..44a52851fff440eed687874c56608a88eb1cf6e0 100644 |
| --- a/Source/core/dom/Document.cpp |
| +++ b/Source/core/dom/Document.cpp |
| @@ -71,6 +71,7 @@ |
| #include "core/dom/Element.h" |
| #include "core/dom/ElementDataCache.h" |
| #include "core/dom/ElementTraversal.h" |
| +#include "core/dom/EventHandlerRegistry.h" |
| #include "core/dom/ExceptionCode.h" |
| #include "core/dom/ExecutionContextTask.h" |
| #include "core/dom/MainThreadTaskRunner.h" |
| @@ -2090,12 +2091,14 @@ void Document::attach(const AttachContext& context) |
| textAutosizer->updatePageInfo(); |
| m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); |
| + lifecycleNotifier().notifyDocumentWasAttached(); |
| } |
| void Document::detach(const AttachContext& context) |
| { |
| ASSERT(isActive()); |
| m_lifecycle.advanceTo(DocumentLifecycle::Stopping); |
| + lifecycleNotifier().notifyWillDetachDocument(); |
| if (page()) |
| page()->documentDetached(this); |
| @@ -2149,9 +2152,6 @@ void Document::detach(const AttachContext& context) |
| if (renderView) |
| renderView->destroy(); |
| - if (Document* parentDoc = parentDocument()) |
| - parentDoc->didClearTouchEventHandlers(this); |
| - |
| // This is required, as our LocalFrame might delete itself as soon as it detaches |
| // us. However, this violates Node::detach() semantics, as it's never |
| // possible to re-attach. Eventually Document::detach() should be renamed, |
| @@ -5022,78 +5022,9 @@ PassRefPtrWillBeRawPtr<TouchList> Document::createTouchList(WillBeHeapVector<Ref |
| return TouchList::create(touches); |
| } |
| -void Document::didAddTouchEventHandler(Node* handler) |
| -{ |
| - // The node should either be in this document, or be the Document node of a child |
| - // of this document. |
| - ASSERT(&handler->document() == this |
| - || (handler->isDocumentNode() && toDocument(handler)->parentDocument() == this)); |
| - if (!m_touchEventTargets.get()) |
| - m_touchEventTargets = adoptPtr(new TouchEventTargetSet); |
| - bool isFirstHandler = m_touchEventTargets->isEmpty(); |
| - |
| - if (!m_touchEventTargets->add(handler).isNewEntry) { |
| - // Just incremented refcount, no real change. |
| - // If this is a child document node, then the count should never go above 1. |
| - ASSERT(!handler->isDocumentNode() || &handler->document() == this); |
| - return; |
| - } |
| - |
| - if (isFirstHandler) { |
| - if (Document* parent = parentDocument()) { |
| - parent->didAddTouchEventHandler(this); |
| - } else { |
| - // This is the first touch handler on the whole page. |
| - if (FrameHost* frameHost = this->frameHost()) |
| - frameHost->chrome().client().needTouchEvents(true); |
| - } |
| - } |
| - |
| - // When we're all done with all frames, ensure touch hit rects are marked as dirty. |
| - if (!handler->isDocumentNode() || handler == this) { |
| - if (Page* page = this->page()) { |
| - if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator()) |
| - scrollingCoordinator->touchEventTargetRectsDidChange(); |
| - } |
| - } |
| -} |
| - |
| -void Document::didRemoveTouchEventHandler(Node* handler, bool clearAll) |
| +void Document::resetLastHandledUserGestureTimestamp() |
|
Rick Byers
2014/04/04 20:12:27
ditto
Sami
2014/04/07 14:56:49
Done.
|
| { |
| - // Note that we can't assert that |handler| is in this document because it might be in |
| - // the process of moving out of it. |
| - ASSERT(clearAll || m_touchEventTargets->contains(handler)); |
| - if (!m_touchEventTargets.get()) |
| - return; |
| - |
| - if (clearAll) { |
| - if (!m_touchEventTargets->contains(handler)) |
| - return; |
| - m_touchEventTargets->removeAll(handler); |
| - } else { |
| - if (!m_touchEventTargets->remove(handler)) |
| - // Just decremented refcount, no real update. |
| - return; |
| - } |
| - |
| - if (m_touchEventTargets->isEmpty()) { |
| - if (Document* parent = parentDocument()) { |
| - // This was the last handler in this document, update the parent document too. |
| - parent->didRemoveTouchEventHandler(this, clearAll); |
| - } else { |
| - // We just removed the last touch handler on the whole page. |
| - if (FrameHost* frameHost = this->frameHost()) |
| - frameHost->chrome().client().needTouchEvents(false); |
| - } |
| - } |
| - |
| - // When we're all done with all frames, ensure touch hit rects are marked as dirty. |
| - if (!handler->isDocumentNode() || handler == this) { |
| - if (Page* page = this->page()) { |
| - if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator()) |
| - scrollingCoordinator->touchEventTargetRectsDidChange(); |
| - } |
| - } |
| + m_lastHandledUserGestureTimestamp = currentTime(); |
| } |
| DocumentLoader* Document::loader() const |