RESOLVED FIXED 35874
[Chromium] Adding touch event routing
https://bugs.webkit.org/show_bug.cgi?id=35874
Summary [Chromium] Adding touch event routing
Garret Kelly
Reported 2010-03-08 11:33:38 PST
WebKit-side support for routing WebTouchEvents into the event handler.
Attachments
Initial patch (4.91 KB, patch)
2010-03-08 11:38 PST, Garret Kelly
no flags
First-round review changes (4.95 KB, patch)
2010-03-08 14:32 PST, Garret Kelly
no flags
Second-round review fixes (4.91 KB, patch)
2010-03-08 15:46 PST, Garret Kelly
no flags
Garret Kelly
Comment 1 2010-03-08 11:38:42 PST
Created attachment 50240 [details] Initial patch
Darin Fisher (:fishd, Google)
Comment 2 2010-03-08 13:01:58 PST
Comment on attachment 50240 [details] Initial patch > +++ b/WebKit/chromium/src/ChromeClientImpl.h ... > +#if ENABLE(TOUCH_EVENTS) > + virtual void needTouchEvents(bool needTouchEvents) { } > +#endif ^^^ is there more to be done here? should there be a FIXME comment? > +++ b/WebKit/chromium/src/WebViewImpl.cpp > @@ -609,6 +609,22 @@ bool WebViewImpl::charEvent(const WebKeyboardEvent& event) > return true; > } > > +#if ENABLE(TOUCH_EVENTS) > +bool WebViewImpl::touchEvent(const WebTouchEvent& event) > +{ > + Frame* focusedFrame = focusedWebCoreFrame(); > + if (!focusedFrame) > + return false; > + > + EventHandler* eventHandler = focusedFrame->eventHandler(); > + if (!eventHandler) > + return false; > + > + PlatformTouchEventBuilder touchEventBuilder(mainFrameImpl()->frameView(), event); > + return eventHandler->handleTouchEvent(touchEventBuilder); > +} Are you sure that calling handleTouchEvent on the focused frame is correct? For mouseDown, etc., we use the EventHandler of the main frame. It looks like an EventHandler for a subframe will still perform a hit test on the topmost frame if the subframe does not contain the point, so it may not matter what EventHandler you use. I was just wondering why you chose the EventHandler of the focused frame.
Garret Kelly
Comment 3 2010-03-08 14:32:16 PST
(In reply to comment #2) > (From update of attachment 50240 [details]) > > +++ b/WebKit/chromium/src/ChromeClientImpl.h > ... > > +#if ENABLE(TOUCH_EVENTS) > > + virtual void needTouchEvents(bool needTouchEvents) { } > > +#endif > > ^^^ is there more to be done here? should there be a FIXME comment? Quite right. FIXME added. > > +++ b/WebKit/chromium/src/WebViewImpl.cpp > > @@ -609,6 +609,22 @@ bool WebViewImpl::charEvent(const WebKeyboardEvent& event) > > return true; > > } > > > > +#if ENABLE(TOUCH_EVENTS) > > +bool WebViewImpl::touchEvent(const WebTouchEvent& event) > > +{ > > + Frame* focusedFrame = focusedWebCoreFrame(); > > + if (!focusedFrame) > > + return false; > > + > > + EventHandler* eventHandler = focusedFrame->eventHandler(); > > + if (!eventHandler) > > + return false; > > + > > + PlatformTouchEventBuilder touchEventBuilder(mainFrameImpl()->frameView(), event); > > + return eventHandler->handleTouchEvent(touchEventBuilder); > > +} > > Are you sure that calling handleTouchEvent on the focused frame is correct? > For mouseDown, etc., we use the EventHandler of the main frame. > > It looks like an EventHandler for a subframe will still perform a hit test > on the topmost frame if the subframe does not contain the point, so it may > not matter what EventHandler you use. I was just wondering why you chose > the EventHandler of the focused frame. Your right, the hit test shouldn't start in the focused frame but in the topmost. Done.
Garret Kelly
Comment 4 2010-03-08 14:32:47 PST
Created attachment 50247 [details] First-round review changes
Darin Fisher (:fishd, Google)
Comment 5 2010-03-08 15:18:24 PST
Comment on attachment 50247 [details] First-round review changes > +++ b/WebKit/chromium/src/WebViewImpl.cpp ... > +#if ENABLE(TOUCH_EVENTS) > +bool WebViewImpl::touchEvent(const WebTouchEvent& event) > +{ > + if (!mainFrameImpl() || !mainFrameImpl()->frameView()) > + return false; > + > + PlatformTouchEventBuilder touchEventBuilder( > + mainFrameImpl()->frameView(), event); > + > + EventHandler* eventHandler = mainFrameImpl()->frame()->eventHandler(); > + return eventHandler->handleTouchEvent(touchEventBuilder); nit: it is more common in webkit code to just write this w/o the temporary: return mainFrameImpl()->frame()->eventHandler()->handleTouchEvent(touchEventBuilder); it is OK that lines exceed 80 chars ;-)
Garret Kelly
Comment 6 2010-03-08 15:46:04 PST
(In reply to comment #5) > (From update of attachment 50247 [details]) > > +++ b/WebKit/chromium/src/WebViewImpl.cpp > ... > > +#if ENABLE(TOUCH_EVENTS) > > +bool WebViewImpl::touchEvent(const WebTouchEvent& event) > > +{ > > + if (!mainFrameImpl() || !mainFrameImpl()->frameView()) > > + return false; > > + > > + PlatformTouchEventBuilder touchEventBuilder( > > + mainFrameImpl()->frameView(), event); > > + > > + EventHandler* eventHandler = mainFrameImpl()->frame()->eventHandler(); > > + return eventHandler->handleTouchEvent(touchEventBuilder); > > nit: it is more common in webkit code to just write this w/o the temporary: > > return > mainFrameImpl()->frame()->eventHandler()->handleTouchEvent(touchEventBuilder); > > it is OK that lines exceed 80 chars ;-) Ah, my mistake. Force of habit. ;) Done.
Garret Kelly
Comment 7 2010-03-08 15:46:39 PST
Created attachment 50262 [details] Second-round review fixes
WebKit Commit Bot
Comment 8 2010-03-10 13:34:39 PST
Comment on attachment 50262 [details] Second-round review fixes Clearing flags on attachment: 50262 Committed r55800: <http://trac.webkit.org/changeset/55800>
WebKit Commit Bot
Comment 9 2010-03-10 13:34:43 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.