RESOLVED FIXED Bug 68959
Extend DOM WheelEvent to differentiate between physical and logical scroll directions
https://bugs.webkit.org/show_bug.cgi?id=68959
Summary Extend DOM WheelEvent to differentiate between physical and logical scroll di...
Jon Lee
Reported 2011-09-27 16:43:57 PDT
With Lion, users may choose to reverse the scrolling direction. Exposing a boolean indicating whether the user is scrolling naturally would help web authors determine a scroll event's direction. <rdar://problem/10036688>
Attachments
Patch (21.98 KB, patch)
2011-09-28 14:01 PDT, Jon Lee
no flags
Patch (21.99 KB, patch)
2011-09-28 14:17 PDT, Jon Lee
no flags
Patch (22.00 KB, patch)
2011-09-28 14:39 PDT, Jon Lee
no flags
Patch (22.22 KB, patch)
2011-09-28 16:02 PDT, Jon Lee
no flags
Patch (28.13 KB, patch)
2011-10-03 12:54 PDT, Jon Lee
sam: review+
Jon Lee
Comment 1 2011-09-28 14:01:22 PDT
Mark Rowe (bdash)
Comment 2 2011-09-28 14:11:08 PDT
Comment on attachment 109072 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=109072&action=review > Source/WebKit2/Shared/mac/WebEventFactory.mm:1103 > +#if BUILDING_ON_LION > + bool directionInvertedFromDevice = [event isDirectionInvertedFromDevice]; > +#else > + bool directionInvertedFromDevice = false; > +#endif This is not correct.
Jon Lee
Comment 3 2011-09-28 14:17:03 PDT
Jon Lee
Comment 4 2011-09-28 14:17:51 PDT
Fixed the #if OS check.
Jon Lee
Comment 5 2011-09-28 14:29:20 PDT
The #if should be #if !defined(...)-- sending another patch.
Jon Lee
Comment 6 2011-09-28 14:39:52 PDT
Sam Weinig
Comment 7 2011-09-28 15:20:40 PDT
Comment on attachment 109079 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=109079&action=review I think we probably want to prefix the IDL attribute with webkit as well. > Source/WebCore/platform/mac/WheelEventMac.mm:104 > + , m_directionInvertedFromDevice([event isDirectionInvertedFromDevice]) I think this probably needs to be conditional on Lion or later.
Jon Lee
Comment 8 2011-09-28 15:29:29 PDT
(In reply to comment #7) > (From update of attachment 109079 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=109079&action=review > > I think we probably want to prefix the IDL attribute with webkit as well. OK. > > > Source/WebCore/platform/mac/WheelEventMac.mm:104 > > + , m_directionInvertedFromDevice([event isDirectionInvertedFromDevice]) > > I think this probably needs to be conditional on Lion or later. Whoops, you are right. Will add.
Jon Lee
Comment 9 2011-09-28 16:02:56 PDT
Jon Lee
Comment 10 2011-09-28 16:07:36 PDT
Updated with Sam's corrections.
Darin Adler
Comment 11 2011-10-03 09:58:09 PDT
Comment on attachment 109083 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=109083&action=review OK as-is, but seems to be too conditional in the wrong way, so maybe we could tighten it up. > Source/WebCore/dom/WheelEvent.h:95 > +#if PLATFORM(MAC) > + WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta, > + Granularity, PassRefPtr<AbstractView>, > + const IntPoint& screenLocation, const IntPoint& pageLocation, > + bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool directionInvertedFromDevice); > +#endif Perhaps we could set the directionInvertedFromDevice flag with an explicit set call after construction. That would eliminate the need to repeat the entire constructor and improve the ifdefs. > Source/WebCore/dom/WheelEvent.idl:45 > +#if defined(WTF_PLATFORM_MAC) && WTF_PLATFORM_MAC > + readonly attribute boolean webkitDirectionInvertedFromDevice; > +#endif /* PLATFORM(WTF_PLATFORM_MAC) */ It’s ugly to use the WTF prefixed macros directly in IDL files. Ideally this would be a HAVE-type define instead of a direct platform one, like HAVE(INVERTED_WHEEL) or something like that. The platform macros themselves are slated for demolition. Why wouldn’t we want this attribute to exist and be false on all platforms?
Sam Weinig
Comment 12 2011-10-03 10:23:24 PDT
> > Why wouldn’t we want this attribute to exist and be false on all platforms? I think the answer to that is we probably do want it on all platforms. -Sam
Jon Lee
Comment 13 2011-10-03 10:42:09 PDT
I'll make the adjustments and send out another patch.
Jon Lee
Comment 14 2011-10-03 12:54:18 PDT
Sam Weinig
Comment 15 2011-10-04 10:22:25 PDT
Comment on attachment 109510 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=109510&action=review > Source/WebKit2/ChangeLog:41 > +2011-09-28 Jon Lee <jonlee@apple.com> > + > + Extend DOM WheelEvent to differentiate between physical and logical scroll directions > + https://bugs.webkit.org/show_bug.cgi?id=68959 > + <rdar://problem/10036688> > + > + Reviewed by NOBODY (OOPS!). > + > + * Shared/WebEvent.h: > + (WebKit::WebWheelEvent::directionInvertedFromDevice): > + * Shared/WebEventConversion.cpp: > + (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent): > + * Shared/WebWheelEvent.cpp: > + (WebKit::WebWheelEvent::WebWheelEvent): > + (WebKit::WebWheelEvent::encode): > + (WebKit::WebWheelEvent::decode): > + * Shared/mac/WebEventFactory.mm: > + (WebKit::WebEventFactory::createWebWheelEvent): get the flag from the NSEvent. > + * UIProcess/WebPageProxy.cpp: > + (WebKit::coalesce): Double changelog!
Jon Lee
Comment 16 2011-10-04 10:38:07 PDT
(In reply to comment #15) > Double changelog! Fixed, and thanks!
Jon Lee
Comment 17 2011-10-04 11:07:34 PDT
Ryosuke Niwa
Comment 18 2011-10-04 12:16:49 PDT
This patch broke Leopard build. Fix attempted in http://trac.webkit.org/changeset/96629.
Gavin Peters
Comment 19 2011-10-04 14:11:43 PDT
Gavin Peters
Comment 20 2011-10-04 14:15:41 PDT
n/m, false alarm on the gtk folks.
Ryosuke Niwa
Comment 21 2011-10-04 14:19:24 PDT
Note You need to log in before you can comment on or make changes to this bug.