Bug 60943 - Disable keyboard input (with exceptions) in full-screen mode.
Summary: Disable keyboard input (with exceptions) in full-screen mode.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jer Noble
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2011-05-16 23:06 PDT by Jer Noble
Modified: 2011-05-18 00:38 PDT (History)
0 users

See Also:


Attachments
Patch (8.52 KB, patch)
2011-05-16 23:14 PDT, Jer Noble
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jer Noble 2011-05-16 23:06:01 PDT
Disable keyboard input (with exceptions) in full-screen mode.
Comment 1 Jer Noble 2011-05-16 23:06:19 PDT
<rdar://problem/9450785>
Comment 2 Jer Noble 2011-05-16 23:14:15 PDT
Created attachment 93740 [details]
Patch
Comment 3 Darin Adler 2011-05-17 18:11:11 PDT
Comment on attachment 93740 [details]
Patch

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

> Source/WebCore/page/EventHandler.cpp:2442
> +    if ((keyCode >= VK_BACK && keyCode <= VK_CAPITAL)
> +        || (keyCode >= VK_SPACE && keyCode <= VK_DELETE)
> +        || (keyCode >= VK_OEM_1 && keyCode <= VK_OEM_PLUS)
> +        || (keyCode >= VK_MULTIPLY && keyCode <= VK_OEM_8))
> +        return true;
> +
> +    return false;

This seems quite unclear. Is this specific set of key code ranges straight out of some specification? If not, what is the rationale for what keys are listed here and what keys are not?

Also, if (x) return true; return false; is an anti-pattern. Just use a return.
Comment 4 Jer Noble 2011-05-17 21:19:38 PDT
(In reply to comment #3)
> (From update of attachment 93740 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=93740&action=review
> 
> > Source/WebCore/page/EventHandler.cpp:2442
> > +    if ((keyCode >= VK_BACK && keyCode <= VK_CAPITAL)
> > +        || (keyCode >= VK_SPACE && keyCode <= VK_DELETE)
> > +        || (keyCode >= VK_OEM_1 && keyCode <= VK_OEM_PLUS)
> > +        || (keyCode >= VK_MULTIPLY && keyCode <= VK_OEM_8))
> > +        return true;
> > +
> > +    return false;
> 
> This seems quite unclear. Is this specific set of key code ranges straight out of some specification? If not, what is the rationale for what keys are listed here and what keys are not?

Yes, it's specifically from the proposed Full Screen API:

"Toplevel browsing contexts can be in a "keys disabled" state. In this state, the user agent must suppress all keyup, keydown and keypress events whose keyCode is not in one of the following ranges:

DOM_VK_CANCEL to DOM_VK_CAPS_LOCK, inclusive
DOM_VK_SPACE to DOM_VK_DELETE, inclusive
DOM_VK_SEMICOLON to DOM_VK_EQUALS, inclusive
DOM_VK_MULTIPLY to DOM_VK_META, inclusive"

The key codes listed in the patch are the equivalents to the Mozilla-specific enums in the spec.

> Also, if (x) return true; return false; is an anti-pattern. Just use a return.

Sure thing.  Thanks!
Comment 5 Jer Noble 2011-05-18 00:38:41 PDT
Committed r86741: <http://trac.webkit.org/changeset/86741>