Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

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

Issue 11635024: Merge 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. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« 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 138187)
+++ Source/WebCore/dom/Document.cpp (working copy)
@@ -498,9 +498,6 @@
, 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)
@@ -613,6 +610,10 @@
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();
@@ -5599,36 +5600,68 @@
wheelEventHandlerCountChanged(this);
}
-void Document::didAddTouchEventHandler()
+void Document::didAddTouchEventHandler(Node* handler)
{
#if ENABLE(TOUCH_EVENTS)
- ++m_touchEventHandlerCount;
- if (m_touchEventHandlerCount > 1)
+ if (!m_touchEventTargets.get())
+ m_touchEventTargets = adoptPtr(new TouchEventTargetSet);
+ m_touchEventTargets->add(handler);
+ if (Document* parent = parentDocument()) {
+ parent->didAddTouchEventHandler(this);
return;
- if (Page* page = this->page())
- page->chrome()->client()->needTouchEvents(true);
+ }
+ if (Page* page = this->page()) {
+#if ENABLE(TOUCH_EVENT_TRACKING)
+ if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
+ scrollingCoordinator->touchEventTargetRectsDidChange(this);
#endif
+ if (m_touchEventTargets->size() == 1)
+ page->chrome()->client()->needTouchEvents(true);
+ }
+#else
+ UNUSED_PARAM(handler);
+#endif
}
-void Document::didRemoveTouchEventHandler()
+void Document::didRemoveTouchEventHandler(Node* handler)
{
#if ENABLE(TOUCH_EVENTS)
- ASSERT(m_touchEventHandlerCount);
- --m_touchEventHandlerCount;
- if (m_touchEventHandlerCount)
+ if (!m_touchEventTargets.get())
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()->touchEventHandlerCount())
+ if (frame->document() && frame->document()->hasTouchEventHandlers())
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
This is Rietveld 408576698