https://bugs.webkit.org/show_bug.cgi?id=77440
Patch by Sadrul Habib Chowdhury <sadrul@chromium.org> on 2012-02-15
Reviewed by Darin Fisher and Ryosuke Niwa.
Source/WebCore:
Keep a count of the number of touch-event handlers and notify the
embedder when the count changes. Depending on the count, the embedder
can decide whether or not to dispatch touch events to webkit.
* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::didAddTouchEventHandler):
(WebCore):
(WebCore::Document::didRemoveTouchEventHandler):
* dom/Document.h:
(WebCore::Document::touchEventHandlerCount):
(Document):
* dom/Node.cpp:
(WebCore::isTouchEventType):
(WebCore::tryAddEventListener):
(WebCore::tryRemoveEventListener):
* loader/EmptyClients.h:
(WebCore::EmptyChromeClient::numTouchEventHandlersChanged):
* page/ChromeClient.h:
(ChromeClient):
* page/Frame.cpp:
(WebCore::Frame::notifyChromeClientWheelEventHandlerCountChanged):
(WebCore::Frame::notifyChromeClientTouchEventHandlerCountChanged):
(WebCore):
* page/Frame.h:
(Frame):
Source/WebKit/chromium:
* public/WebViewClient.h:
(WebKit::WebViewClient::numberOfTouchEventHandlersChanged):
* src/ChromeClientImpl.cpp:
(WebKit::ChromeClientImpl::numTouchEventHandlersChanged):
(WebKit):
* src/ChromeClientImpl.h:
(ChromeClientImpl):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::numberOfTouchEventHandlersChanged):
(WebKit):
* src/WebViewImpl.h:
(WebViewImpl):
Source/WebKit/efl:
* WebCoreSupport/ChromeClientEfl.h:
(WebCore::ChromeClientEfl::numTouchEventHandlersChanged):
Source/WebKit/gtk:
* WebCoreSupport/ChromeClientGtk.h:
(WebKit::ChromeClient::numTouchEventHandlersChanged):
Source/WebKit/mac:
* WebCoreSupport/WebChromeClient.h:
Source/WebKit/qt:
* WebCoreSupport/ChromeClientQt.h:
(WebCore::ChromeClientQt::numTouchEventHandlersChanged):
Source/WebKit/win:
* WebCoreSupport/WebChromeClient.h:
(WebChromeClient::numTouchEventHandlersChanged):
Source/WebKit/wince:
* WebCoreSupport/ChromeClientWinCE.h:
(WebKit::ChromeClientWinCE::numTouchEventHandlersChanged):
Source/WebKit/wx:
* WebKitSupport/ChromeClientWx.h:
(WebCore::ChromeClientWx::numTouchEventHandlersChanged):
Source/WebKit2:
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::numTouchEventHandlersChanged):
* WebProcess/WebCoreSupport/WebChromeClient.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107832
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-02-15 Sadrul Habib Chowdhury <sadrul@chromium.org>
+
+ Notify ChromeClient when touch-event handlers are installed/removed.
+ https://bugs.webkit.org/show_bug.cgi?id=77440
+
+ Reviewed by Darin Fisher and Ryosuke Niwa.
+
+ Keep a count of the number of touch-event handlers and notify the
+ embedder when the count changes. Depending on the count, the embedder
+ can decide whether or not to dispatch touch events to webkit.
+
+ * dom/Document.cpp:
+ (WebCore::Document::Document):
+ (WebCore::Document::didAddTouchEventHandler):
+ (WebCore):
+ (WebCore::Document::didRemoveTouchEventHandler):
+ * dom/Document.h:
+ (WebCore::Document::touchEventHandlerCount):
+ (Document):
+ * dom/Node.cpp:
+ (WebCore::isTouchEventType):
+ (WebCore::tryAddEventListener):
+ (WebCore::tryRemoveEventListener):
+ * loader/EmptyClients.h:
+ (WebCore::EmptyChromeClient::numTouchEventHandlersChanged):
+ * page/ChromeClient.h:
+ (ChromeClient):
+ * page/Frame.cpp:
+ (WebCore::Frame::notifyChromeClientWheelEventHandlerCountChanged):
+ (WebCore::Frame::notifyChromeClientTouchEventHandlerCountChanged):
+ (WebCore):
+ * page/Frame.h:
+ (Frame):
+
2012-02-15 Eric Carlson <eric.carlson@apple.com>
Unset the active flag when TextTrackCues go away
, m_writeRecursionIsTooDeep(false)
, m_writeRecursionDepth(0)
, m_wheelEventHandlerCount(0)
+ , m_touchEventHandlerCount(0)
, m_pendingTasksTimer(this, &Document::pendingTasksTimerFired)
{
m_document = this;
wheelEventHandlerCountChanged(this);
}
+void Document::didAddTouchEventHandler()
+{
+ ++m_touchEventHandlerCount;
+ Frame* mainFrame = page() ? page()->mainFrame() : 0;
+ if (mainFrame)
+ mainFrame->notifyChromeClientTouchEventHandlerCountChanged();
+}
+
+void Document::didRemoveTouchEventHandler()
+{
+ ASSERT(m_touchEventHandlerCount > 0);
+ --m_touchEventHandlerCount;
+ Frame* mainFrame = page() ? page()->mainFrame() : 0;
+ if (mainFrame)
+ mainFrame->notifyChromeClientTouchEventHandlerCountChanged();
+}
+
bool Document::visualUpdatesAllowed() const
{
return !settings()
void didAddWheelEventHandler();
void didRemoveWheelEventHandler();
+ unsigned touchEventHandlerCount() const { return m_touchEventHandlerCount; }
+ void didAddTouchEventHandler();
+ void didRemoveTouchEventHandler();
+
bool visualUpdatesAllowed() const;
#if ENABLE(MICRODATA)
unsigned m_writeRecursionDepth;
unsigned m_wheelEventHandlerCount;
+ unsigned m_touchEventHandlerCount;
#if ENABLE(REQUEST_ANIMATION_FRAME)
RefPtr<ScriptedAnimationController> m_scriptedAnimationController;
}
#endif
+static inline bool isTouchEventType(const AtomicString& eventType)
+{
+ return eventType == eventNames().touchstartEvent || eventType == eventNames().touchmoveEvent || eventType == eventNames().touchendEvent || eventType == eventNames().touchcancelEvent;
+}
+
static inline bool tryAddEventListener(Node* targetNode, const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture)
{
if (!targetNode->EventTarget::addEventListener(eventType, listener, useCapture))
document->addListenerTypeIfNeeded(eventType);
if (eventType == eventNames().mousewheelEvent)
document->didAddWheelEventHandler();
+ else if (isTouchEventType(eventType))
+ document->didAddTouchEventHandler();
}
return true;
if (Document* document = targetNode->document()) {
if (eventType == eventNames().mousewheelEvent)
document->didRemoveWheelEventHandler();
+ else if (isTouchEventType(eventType))
+ document->didRemoveTouchEventHandler();
}
return true;
virtual void needTouchEvents(bool) { }
#endif
- virtual void numWheelEventHandlersChanged(unsigned) { }
+ virtual void numWheelEventHandlersChanged(unsigned) OVERRIDE { }
+ virtual void numTouchEventHandlersChanged(unsigned) OVERRIDE { }
virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const { return false; }
};
virtual bool shouldRunModalDialogDuringPageDismissal(const DialogType&, const String& dialogMessage, FrameLoader::PageDismissalType) const { UNUSED_PARAM(dialogMessage); return true; }
virtual void numWheelEventHandlersChanged(unsigned) = 0;
+ virtual void numTouchEventHandlersChanged(unsigned) = 0;
virtual bool isSVGImageChromeClient() const { return false; }
if (m_doc)
m_doc->updateViewportArguments();
- if (m_page && m_page->mainFrame() == this)
+ if (m_page && m_page->mainFrame() == this) {
notifyChromeClientWheelEventHandlerCountChanged();
+ notifyChromeClientTouchEventHandlerCountChanged();
+ }
}
#if ENABLE(ORIENTATION_EVENTS)
{
// Ensure that this method is being called on the main frame of the page.
ASSERT(m_page && m_page->mainFrame() == this);
-
+
unsigned count = 0;
for (const Frame* frame = this; frame; frame = frame->tree()->traverseNext()) {
if (frame->document())
count += frame->document()->wheelEventHandlerCount();
}
-
+
m_page->chrome()->client()->numWheelEventHandlersChanged(count);
}
+void Frame::notifyChromeClientTouchEventHandlerCountChanged() const
+{
+ // Ensure that this method is being called on the main frame of the page.
+ ASSERT(m_page && m_page->mainFrame() == this);
+
+ unsigned count = 0;
+ for (const Frame* frame = this; frame; frame = frame->tree()->traverseNext()) {
+ if (frame->document())
+ count += frame->document()->touchEventHandlerCount();
+ }
+
+ m_page->chrome()->client()->numTouchEventHandlersChanged(count);
+}
+
#if !PLATFORM(MAC) && !PLATFORM(WIN)
struct ScopedFramePaintingState {
ScopedFramePaintingState(Frame* theFrame, RenderObject* theRenderer)
// Should only be called on the main frame of a page.
void notifyChromeClientWheelEventHandlerCountChanged() const;
+ void notifyChromeClientTouchEventHandlerCountChanged() const;
// ========
+2012-02-15 Sadrul Habib Chowdhury <sadrul@chromium.org>
+
+ Notify ChromeClient when touch-event handlers are installed/removed.
+ https://bugs.webkit.org/show_bug.cgi?id=77440
+
+ Reviewed by Darin Fisher and Ryosuke Niwa.
+
+ * public/WebViewClient.h:
+ (WebKit::WebViewClient::numberOfTouchEventHandlersChanged):
+ * src/ChromeClientImpl.cpp:
+ (WebKit::ChromeClientImpl::numTouchEventHandlersChanged):
+ (WebKit):
+ * src/ChromeClientImpl.h:
+ (ChromeClientImpl):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::numberOfTouchEventHandlersChanged):
+ (WebKit):
+ * src/WebViewImpl.h:
+ (WebViewImpl):
+
2012-02-15 Anders Carlsson <andersca@apple.com>
Remove ScrollableArea::handleGestureEvent
virtual void focusedNodeChanged(const WebNode&) { }
virtual void numberOfWheelEventHandlersChanged(unsigned) { }
+ virtual void numberOfTouchEventHandlersChanged(unsigned) { }
// Indicates two things:
// 1) This view may have a new layout now.
m_webView->numberOfWheelEventHandlersChanged(numberOfWheelHandlers);
}
+void ChromeClientImpl::numTouchEventHandlersChanged(unsigned numberOfTouchHandlers)
+{
+ m_webView->numberOfTouchEventHandlersChanged(numberOfTouchHandlers);
+}
+
#if ENABLE(POINTER_LOCK)
bool ChromeClientImpl::requestPointerLock()
{
virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const;
virtual void numWheelEventHandlersChanged(unsigned);
+ virtual void numTouchEventHandlersChanged(unsigned);
#if ENABLE(POINTER_LOCK)
virtual bool requestPointerLock();
#endif
}
+void WebViewImpl::numberOfTouchEventHandlersChanged(unsigned numberOfTouchHandlers)
+{
+ if (m_client)
+ m_client->numberOfTouchEventHandlersChanged(numberOfTouchHandlers);
+}
+
#if !OS(DARWIN)
// Mac has no way to open a context menu based on a keyboard event.
bool WebViewImpl::sendContextMenuEvent(const WebKeyboardEvent& event)
bool touchEvent(const WebTouchEvent&);
void numberOfWheelEventHandlersChanged(unsigned);
+ void numberOfTouchEventHandlersChanged(unsigned);
// Handles context menu events orignated via the the keyboard. These
// include the VK_APPS virtual key and the Shift+F10 combine. Code is
+2012-02-15 Sadrul Habib Chowdhury <sadrul@chromium.org>
+
+ Notify ChromeClient when touch-event handlers are installed/removed.
+ https://bugs.webkit.org/show_bug.cgi?id=77440
+
+ Reviewed by Darin Fisher and Ryosuke Niwa.
+
+ * WebCoreSupport/ChromeClientEfl.h:
+ (WebCore::ChromeClientEfl::numTouchEventHandlersChanged):
+
2012-02-15 Gustavo Lima Chaves <glima@profusion.mobi>
[EFL] Add missing libsoup to (pkgconfig) dependency requirements
virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const { return true; }
virtual void numWheelEventHandlersChanged(unsigned) { }
+ virtual void numTouchEventHandlersChanged(unsigned) { }
Evas_Object* m_view;
KURL m_hoveredLinkURL;
+2012-02-15 Sadrul Habib Chowdhury <sadrul@chromium.org>
+
+ Notify ChromeClient when touch-event handlers are installed/removed.
+ https://bugs.webkit.org/show_bug.cgi?id=77440
+
+ Reviewed by Darin Fisher and Ryosuke Niwa.
+
+ * WebCoreSupport/ChromeClientGtk.h:
+ (WebKit::ChromeClient::numTouchEventHandlersChanged):
+
2012-02-15 No'am Rosenthal <noam.rosenthal@nokia.com>
[Texmap] Divide TextureMapperNode.cpp to 3 files.
virtual bool shouldRubberBandInDirection(ScrollDirection) const { return true; }
virtual void numWheelEventHandlersChanged(unsigned) { }
+ virtual void numTouchEventHandlersChanged(unsigned) { }
#if USE(ACCELERATED_COMPOSITING)
virtual void attachRootGraphicsLayer(Frame*, GraphicsLayer*);
+2012-02-15 Sadrul Habib Chowdhury <sadrul@chromium.org>
+
+ Notify ChromeClient when touch-event handlers are installed/removed.
+ https://bugs.webkit.org/show_bug.cgi?id=77440
+
+ Reviewed by Darin Fisher and Ryosuke Niwa.
+
+ * WebCoreSupport/WebChromeClient.h:
+
2012-02-14 Matt Lilek <mrl@apple.com>
Don't ENABLE_DASHBOARD_SUPPORT unconditionally on all Mac platforms
#endif
virtual void numWheelEventHandlersChanged(unsigned) OVERRIDE { }
+ virtual void numTouchEventHandlersChanged(unsigned) OVERRIDE { }
virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const OVERRIDE { return false; }
private:
WebView *m_webView;
+2012-02-15 Sadrul Habib Chowdhury <sadrul@chromium.org>
+
+ Notify ChromeClient when touch-event handlers are installed/removed.
+ https://bugs.webkit.org/show_bug.cgi?id=77440
+
+ Reviewed by Darin Fisher and Ryosuke Niwa.
+
+ * WebCoreSupport/ChromeClientQt.h:
+ (WebCore::ChromeClientQt::numTouchEventHandlersChanged):
+
2012-02-15 Simon Hausmann <simon.hausmann@nokia.com>
Unreviewed Qt 4.x build fix.
virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const { return true; }
virtual void numWheelEventHandlersChanged(unsigned) { }
+ virtual void numTouchEventHandlersChanged(unsigned) { }
QWebPage* m_webPage;
KURL lastHoverURL;
+2012-02-15 Sadrul Habib Chowdhury <sadrul@chromium.org>
+
+ Notify ChromeClient when touch-event handlers are installed/removed.
+ https://bugs.webkit.org/show_bug.cgi?id=77440
+
+ Reviewed by Darin Fisher and Ryosuke Niwa.
+
+ * WebCoreSupport/WebChromeClient.h:
+ (WebChromeClient::numTouchEventHandlersChanged):
+
2012-02-14 Alexey Proskuryakov <ap@apple.com>
[Mac][Win][WK2] Switch to RFC 6455 protocol for WebSockets
virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const { return true; }
virtual void numWheelEventHandlersChanged(unsigned) { }
+ virtual void numTouchEventHandlersChanged(unsigned) { }
private:
COMPtr<IWebUIDelegate> uiDelegate();
+2012-02-15 Sadrul Habib Chowdhury <sadrul@chromium.org>
+
+ Notify ChromeClient when touch-event handlers are installed/removed.
+ https://bugs.webkit.org/show_bug.cgi?id=77440
+
+ Reviewed by Darin Fisher and Ryosuke Niwa.
+
+ * WebCoreSupport/ChromeClientWinCE.h:
+ (WebKit::ChromeClientWinCE::numTouchEventHandlersChanged):
+
2011-12-19 Sam Weinig <sam@webkit.org>
More PlatformEvent cleanup
virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const { return true; }
virtual void numWheelEventHandlersChanged(unsigned) { }
+ virtual void numTouchEventHandlersChanged(unsigned) { }
private:
WebView* m_webView;
+2012-02-15 Sadrul Habib Chowdhury <sadrul@chromium.org>
+
+ Notify ChromeClient when touch-event handlers are installed/removed.
+ https://bugs.webkit.org/show_bug.cgi?id=77440
+
+ Reviewed by Darin Fisher and Ryosuke Niwa.
+
+ * WebKitSupport/ChromeClientWx.h:
+ (WebCore::ChromeClientWx::numTouchEventHandlersChanged):
+
2012-01-30 Kevin Ollivier <kevino@theolliviers.com>
[wx] Unreviewed. Build fix, add JavaScriptCore/runtime
virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const { return true; }
virtual void numWheelEventHandlersChanged(unsigned) { }
+ virtual void numTouchEventHandlersChanged(unsigned) { }
virtual bool hasOpenedPopup() const;
+2012-02-15 Sadrul Habib Chowdhury <sadrul@chromium.org>
+
+ Notify ChromeClient when touch-event handlers are installed/removed.
+ https://bugs.webkit.org/show_bug.cgi?id=77440
+
+ Reviewed by Darin Fisher and Ryosuke Niwa.
+
+ * UIProcess/WebPageProxy.h:
+ (WebKit::WebPageProxy::numTouchEventHandlersChanged):
+ * WebProcess/WebCoreSupport/WebChromeClient.h:
+
2012-02-15 Patrick Gansterer <paroga@webkit.org>
[CMake] Move RunLoop to WebCore/platform
virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const OVERRIDE;
virtual void numWheelEventHandlersChanged(unsigned) OVERRIDE;
+ virtual void numTouchEventHandlersChanged(unsigned) OVERRIDE { }
String m_cachedToolTip;
mutable RefPtr<WebFrame> m_cachedFrameSetLargestFrame;