Bug 35874 - [Chromium] Adding touch event routing
Summary: [Chromium] Adding touch event routing
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other All
: P2 Enhancement
Assignee: Nobody
URL:
Keywords:
Depends on: 37634
Blocks:
  Show dependency treegraph
 
Reported: 2010-03-08 11:33 PST by Garret Kelly
Modified: 2010-05-12 06:53 PDT (History)
3 users (show)

See Also:


Attachments
Initial patch (4.91 KB, patch)
2010-03-08 11:38 PST, Garret Kelly
no flags Details | Formatted Diff | Diff
First-round review changes (4.95 KB, patch)
2010-03-08 14:32 PST, Garret Kelly
no flags Details | Formatted Diff | Diff
Second-round review fixes (4.91 KB, patch)
2010-03-08 15:46 PST, Garret Kelly
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Garret Kelly 2010-03-08 11:33:38 PST
WebKit-side support for routing WebTouchEvents into the event handler.
Comment 1 Garret Kelly 2010-03-08 11:38:42 PST
Created attachment 50240 [details]
Initial patch
Comment 2 Darin Fisher (:fishd, Google) 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.
Comment 3 Garret Kelly 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.
Comment 4 Garret Kelly 2010-03-08 14:32:47 PST
Created attachment 50247 [details]
First-round review changes
Comment 5 Darin Fisher (:fishd, Google) 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 ;-)
Comment 6 Garret Kelly 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.
Comment 7 Garret Kelly 2010-03-08 15:46:39 PST
Created attachment 50262 [details]
Second-round review fixes
Comment 8 WebKit Commit Bot 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>
Comment 9 WebKit Commit Bot 2010-03-10 13:34:43 PST
All reviewed patches have been landed.  Closing bug.