Chromium Code Reviews

Unified Diff: Source/WebCore/dom/Document.cpp

Issue 11612021: Revert 137939 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1364/
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « Source/WebCore/dom/Document.h ('k') | Source/WebCore/dom/Node.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/dom/Document.cpp
===================================================================
--- Source/WebCore/dom/Document.cpp (revision 138019)
+++ Source/WebCore/dom/Document.cpp (working copy)
@@ -498,6 +498,9 @@
, m_writeRecursionIsTooDeep(false)
, m_writeRecursionDepth(0)
, m_wheelEventHandlerCount(0)
+#if ENABLE(TOUCH_EVENTS)
+ , m_touchEventHandlerCount(0)
+#endif
, m_pendingTasksTimer(this, &Document::pendingTasksTimerFired)
, m_scheduledTasksAreSuspended(false)
, m_visualUpdatesAllowed(true)
@@ -610,10 +613,6 @@
ASSERT(!m_parentTreeScope);
ASSERT(!m_guardRefCount);
-#if ENABLE(TOUCH_EVENT_TRACKING)
- if (Document* ownerDocument = this->ownerDocument())
- ownerDocument->didRemoveEventTargetNode(this);
-#endif
// FIXME: Should we reset m_domWindow when we detach from the Frame?
if (m_domWindow)
m_domWindow->resetUnlessSuspendedForPageCache();
@@ -5600,68 +5599,36 @@
wheelEventHandlerCountChanged(this);
}
-void Document::didAddTouchEventHandler(Node* handler)
+void Document::didAddTouchEventHandler()
{
#if ENABLE(TOUCH_EVENTS)
- if (!m_touchEventTargets.get())
- m_touchEventTargets = adoptPtr(new TouchEventTargetSet);
- m_touchEventTargets->add(handler);
- if (Document* parent = parentDocument()) {
- parent->didAddTouchEventHandler(this);
+ ++m_touchEventHandlerCount;
+ if (m_touchEventHandlerCount > 1)
return;
- }
- if (Page* page = this->page()) {
-#if ENABLE(TOUCH_EVENT_TRACKING)
- if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
- scrollingCoordinator->touchEventTargetRectsDidChange(this);
+ if (Page* page = this->page())
+ page->chrome()->client()->needTouchEvents(true);
#endif
- if (m_touchEventTargets->size() == 1)
- page->chrome()->client()->needTouchEvents(true);
- }
-#else
- UNUSED_PARAM(handler);
-#endif
}
-void Document::didRemoveTouchEventHandler(Node* handler)
+void Document::didRemoveTouchEventHandler()
{
#if ENABLE(TOUCH_EVENTS)
- if (!m_touchEventTargets.get())
+ ASSERT(m_touchEventHandlerCount);
+ --m_touchEventHandlerCount;
+ if (m_touchEventHandlerCount)
return;
- ASSERT(m_touchEventTargets->contains(handler));
- m_touchEventTargets->remove(handler);
- if (Document* parent = parentDocument()) {
- parent->didRemoveTouchEventHandler(this);
- return;
- }
Page* page = this->page();
if (!page)
return;
-#if ENABLE(TOUCH_EVENT_TRACKING)
- if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
- scrollingCoordinator->touchEventTargetRectsDidChange(this);
-#endif
- if (m_touchEventTargets->size())
- return;
for (const Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
- if (frame->document() && frame->document()->hasTouchEventHandlers())
+ if (frame->document() && frame->document()->touchEventHandlerCount())
return;
}
page->chrome()->client()->needTouchEvents(false);
-#else
- UNUSED_PARAM(handler);
#endif
}
-#if ENABLE(TOUCH_EVENT_TRACKING)
-void Document::didRemoveEventTargetNode(Node* handler)
-{
- if (m_touchEventTargets.get())
- m_touchEventTargets->removeAll(handler);
-}
-#endif
-
HTMLIFrameElement* Document::seamlessParentIFrame() const
{
if (!shouldDisplaySeamlesslyWithParent())
« no previous file with comments | « Source/WebCore/dom/Document.h ('k') | Source/WebCore/dom/Node.cpp » ('j') | no next file with comments »

Powered by Google App Engine