WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
86694
Implement DOM_KEY_LOCATION_LEFT and RIGHT of KeyboardEvent's location property
https://bugs.webkit.org/show_bug.cgi?id=86694
Summary
Implement DOM_KEY_LOCATION_LEFT and RIGHT of KeyboardEvent's location property
Takashi Sakamoto
Reported
2012-05-16 18:35:44 PDT
Add DOM_KEY_LOCATION_LEFT and DOM_KEY_LOCATION_RIGHT to distinguish between left-control and right-control, between left shift and right shift, and between left menu and right menu. Currently only DOM_KEY_LOCATION_STANDARD and DOM_KEY_LOCATION_NUMPAD are implemented. The location property is defined in the W3C DOM3 specification
http://www.w3.org/TR/DOM-Level-3-Events/#events-keyboardevents
Attachments
Patch
(17.41 KB, patch)
2012-05-16 23:10 PDT
,
Takashi Sakamoto
no flags
Details
Formatted Diff
Diff
Patch
(17.55 KB, patch)
2012-05-17 23:07 PDT
,
Takashi Sakamoto
no flags
Details
Formatted Diff
Diff
Patch
(17.56 KB, patch)
2012-05-21 00:04 PDT
,
Takashi Sakamoto
no flags
Details
Formatted Diff
Diff
Patch
(17.58 KB, patch)
2012-05-21 23:56 PDT
,
Takashi Sakamoto
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Takashi Sakamoto
Comment 1
2012-05-16 23:10:37 PDT
Created
attachment 142419
[details]
Patch
Alexey Proskuryakov
Comment 2
2012-05-17 10:47:54 PDT
Comment on
attachment 142419
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=142419&action=review
Looks great.
> Source/WebCore/ChangeLog:25 > + (WebCore):
Unhelpful cruft like this can be removed from ChangeLogs. This is just a bug in the script - it's meant to be helpful, not authoritative. Thank you for providing helpful comments!
> Source/WebCore/dom/KeyboardEvent.cpp:57 > +static inline int getWindowsVirtualCodeWithoutLocation(int keycode)
In WebCore coding style, "get" prefix means that the result is returned via an out argument. So, just "windowsVirtualCodeWithoutLocation" would be right.
> Source/WebCore/dom/KeyboardEvent.cpp:74 > +static inline unsigned getKeyLocation(const PlatformKeyboardEvent& key)
Ditto. Also, I don't understand why this returns unsigned, and not KeyboardEvent::KeyLocationCode.
> Tools/DumpRenderTree/mac/EventSendingController.mm:644 > + } else if ([character isEqualToString:@"rightMenu"]) {
Perhaps "leftAlt" and "rightAlt" would be better for these. On Windows, the key that maps to VK_MENU is Alt, and on Mac, it's Option - calling that "Menu" is surprising and confusing, regardless of how the Windows API constant is named.
> LayoutTests/fast/events/keydown-leftright-keys.html:51 > + testKeyEventWithLocation("rightShift", VK_SHIFT, KEY_LOCATION_RIGHT);
If you put KEY_LOCATION_RIGHT in quotes, will test output become easier to read?
Takashi Sakamoto
Comment 3
2012-05-17 23:07:57 PDT
Created
attachment 142640
[details]
Patch
Takashi Sakamoto
Comment 4
2012-05-17 23:16:13 PDT
Thank you for reviewing. (In reply to
comment #2
)
> (From update of
attachment 142419
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=142419&action=review
> > Looks great. > > > Source/WebCore/ChangeLog:25 > > + (WebCore): > > Unhelpful cruft like this can be removed from ChangeLogs. This is just a bug in the script - it's meant to be helpful, not authoritative.
I see. I removed.
> > Thank you for providing helpful comments! > > > Source/WebCore/dom/KeyboardEvent.cpp:57 > > +static inline int getWindowsVirtualCodeWithoutLocation(int keycode) > > In WebCore coding style, "get" prefix means that the result is returned via an out argument. So, just "windowsVirtualCodeWithoutLocation" would be right.
Done.
> > Source/WebCore/dom/KeyboardEvent.cpp:74 > > +static inline unsigned getKeyLocation(const PlatformKeyboardEvent& key) > > Ditto.
Done.
> Also, I don't understand why this returns unsigned, and not KeyboardEvent::KeyLocationCode.
I see. I don't have enough reason. Done.
> > Tools/DumpRenderTree/mac/EventSendingController.mm:644 > > + } else if ([character isEqualToString:@"rightMenu"]) { > > Perhaps "leftAlt" and "rightAlt" would be better for these. On Windows, the key that maps to VK_MENU is Alt, and on Mac, it's Option - calling that "Menu" is surprising and confusing, regardless of how the Windows API constant is named.
Done.
> > > LayoutTests/fast/events/keydown-leftright-keys.html:51 > > + testKeyEventWithLocation("rightShift", VK_SHIFT, KEY_LOCATION_RIGHT); > > If you put KEY_LOCATION_RIGHT in quotes, will test output become easier to read?
I agree. Done.
Alexey Proskuryakov
Comment 5
2012-05-18 10:10:02 PDT
Comment on
attachment 142640
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=142640&action=review
> Source/WebCore/dom/KeyboardEvent.cpp:74 > +static inline int keyLocationCode(const PlatformKeyboardEvent& key)
You changed the returned value to int, not to KeyboardEvent::KeyLocationCode. Is there something preventing you from using the latter?
Takashi Sakamoto
Comment 6
2012-05-21 00:04:46 PDT
Created
attachment 142955
[details]
Patch
Takashi Sakamoto
Comment 7
2012-05-21 00:55:11 PDT
(In reply to
comment #5
)
> (From update of
attachment 142640
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=142640&action=review
> > > Source/WebCore/dom/KeyboardEvent.cpp:74 > > +static inline int keyLocationCode(const PlatformKeyboardEvent& key) > > You changed the returned value to int, not to KeyboardEvent::KeyLocationCode. Is there something preventing you from using the latter?
Sorry. I misunderstood your comment. I changed the code to use KeyboardEvent::KeyLocationCode type for returning value type of the function: WebCore::keyLocationCode. Best regards, Takashi Sakamoto
Hajime Morrita
Comment 8
2012-05-21 01:16:14 PDT
SInce you already got r+, you can - Rewrite "Reviewed by" line with the reviewer's name and - Upload the refined patch with no r?, but with cq+.
Takashi Sakamoto
Comment 9
2012-05-21 23:56:47 PDT
Created
attachment 143202
[details]
Patch
Alexey Proskuryakov
Comment 10
2012-05-22 10:16:29 PDT
Comment on
attachment 143202
[details]
Patch As long as you are not a committer, you could have just set cq? on the previous patch.
WebKit Review Bot
Comment 11
2012-05-22 10:44:28 PDT
Comment on
attachment 143202
[details]
Patch Clearing flags on attachment: 143202 Committed
r118001
: <
http://trac.webkit.org/changeset/118001
>
WebKit Review Bot
Comment 12
2012-05-22 10:44:35 PDT
All reviewed patches have been landed. Closing bug.
Jessie Berlin
Comment 13
2012-05-22 15:16:16 PDT
You updated keyDown in DRT, but forgot about WTR:
http://build.webkit.org/results/Lion%20Release%20(WebKit2%20Tests)/r118030%20(7431)/fast/events/keydown-leftright-keys-pretty-diff.html
I have a fix for this, but please try to remember about WTR in the future.
Jessie Berlin
Comment 14
2012-05-22 15:23:39 PDT
Fixed WTR in
http://trac.webkit.org/changeset/118064
.
Takashi Sakamoto
Comment 15
2012-05-30 21:57:52 PDT
(In reply to
comment #14
)
> Fixed WTR in
http://trac.webkit.org/changeset/118064
.
Thank you for fixing WTR, Jessie. I didn't notice that I had to modify WTR. Best regards, Takashi Sakamoto
Jessie Berlin
Comment 16
2012-05-31 08:33:51 PDT
(In reply to
comment #15
)
> (In reply to
comment #14
) > > Fixed WTR in
http://trac.webkit.org/changeset/118064
. > > Thank you for fixing WTR, Jessie. > I didn't notice that I had to modify WTR. > > Best regards, > Takashi Sakamoto
Windows also needed fixing:
http://trac.webkit.org/changeset/118540
Yusuke Sato
Comment 17
2012-06-21 23:57:56 PDT
It seems that on Chrome for Windows (canary channel) the location property is still always zero.
Yusuke Sato
Comment 18
2012-06-22 00:28:04 PDT
Looks like you need to fix WebInputEventFactory::keyboardEvent() in Source/WebKit/chromium/src/win/WebInputEventFactory.cpp too: WebKeyboardEvent WebInputEventFactory::keyboardEvent(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { WebKeyboardEvent result; // TODO(pkasting):
http://b/1117926
Are we guaranteed that the message that // GetMessageTime() refers to is the same one that we're passed in? Perhaps // one of the construction parameters should be the time passed by the // caller, who would know for sure. result.timeStampSeconds = GetMessageTime() / 1000.0; result.windowsKeyCode = static_cast<int>(wparam); // <--------------- HERE
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug