Bug 56761 - KeyboardEvent keyIdentifier is not propagated to plugins by Chromium
Summary: KeyboardEvent keyIdentifier is not propagated to plugins by Chromium
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-21 11:40 PDT by wez
Modified: 2013-04-11 13:30 PDT (History)
3 users (show)

See Also:


Attachments
Patch (1.64 KB, patch)
2011-03-23 07:14 PDT, wez
ojan: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description wez 2011-03-21 11:40:29 PDT
Overview:

DOM KeyboardEvents reach plug-ins in Chromium via the WebPluginContainerImpl, which converts them to Chromium's WebKeyboardEvent.  The conversion process doesn't currently propagate the keyIdentifier field (presumably because that is never currently passed to plug-ins).

Steps to Reproduce:

Try to use the keyIdentifier field of the WebKeyboardEvent from plug-in code.

Actual Results:

The keyIdentifier string will be empty.

Expected Results:

The keyIdentifier field should contain a character key-value (e.g. U+0041) or key function name (e.g. "Shift").

Build Date & Platform:

Build 2011-03-21 on Linux w/ Chromium development build.
Comment 1 wez 2011-03-23 07:14:29 PDT
Created attachment 86613 [details]
Patch
Comment 2 Hajime Morrita 2011-04-12 14:17:02 PDT
Looks no harm. This patch would be safe to r+ for any reviewers ;-)
Comment 3 David Levin 2011-04-12 15:03:45 PDT
Comment on attachment 86613 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=86613&action=review

> Source/WebKit/chromium/src/WebInputEventConversion.cpp:339
> +            sizeof(keyIdentifier) - 1);

I dislike strncpy. It does weird things. (Why fill in all those 0's?)

What about memcpy?
   memcpy(keyIdentifier, event.keyIdentifier().ascii().data(), std::min(sizeof(keyIdentifier) - 1, event.keyIdentifier().ascii().length());
   keyIdentifier[event.keyIdentifier().ascii().length()] = '\0';

(Of course, you may want to put event.keyIdentifier().ascii() in a local and possible length as well, so I guess that makes it slightly longer.)

What do you think?
Comment 4 David Levin 2011-04-12 15:05:32 PDT
fwiw, I tried to find a function in webkit that did this but failed.
Comment 5 Ojan Vafai 2011-04-26 16:54:06 PDT
Comment on attachment 86613 [details]
Patch

r- per David's last comment.