Skip to content

Use keyboard-types crate - #21881

Merged
bors-servo merged 2 commits into
servo:masterfrom
pyfisch:keyboard-types
Oct 17, 2018
Merged

bors-servo merged 2 commits into
servo:masterfrom
pyfisch:keyboard-types

Conversation

@pyfisch

@pyfisch pyfisch commented Oct 6, 2018 •

Copy link
Copy Markdown
Contributor

Have embedders send DOM keys to servo and use a strongly typed KeyboardEvent
from the W3C UI Events spec. All keyboard handling now uses the new types.

Introduce a ShortcutMatcher to recognize key bindings. Shortcuts are now
recognized in a uniform way.

Updated the winit port.
Updated webdriver integration.

part of #20331

What this PR does:

  • allow the use non-ASCII keyboards for text input
  • decouple keyboard event "key" from "code" (key meaning vs location)

What this PR does not do:

  • completely improve keyboard events send from winit and webdriver
  • add support for CompositionEvent or IME

Notes:

  • The winit embedder does not send keyup events for printable keys (this is a regression)
  • keyboard-types is on crates.io because I believe it to be useful outside of servo. If you prefer I can add a copy in this repo.

This change is Reviewable

@highfive

highfive commented Oct 6, 2018

Copy link
Copy Markdown

Heads up! This PR modifies the following files:

  • @asajeffrey: components/webdriver_server/keys.rs, components/constellation/lib.rs, components/script/textinput.rs, components/script/dom/document.rs, components/script/lib.rs and 7 more
  • @cbrewster: components/constellation/lib.rs, components/constellation/Cargo.toml, components/constellation/constellation.rs
  • @jgraham: components/webdriver_server/keys.rs, components/webdriver_server/lib.rs, components/webdriver_server/Cargo.toml
  • @paulrouget: ports/servo/glutin_app/keyutils.rs, components/compositing/lib.rs, components/constellation/lib.rs, components/servo/lib.rs, ports/servo/non_android_main.rs and 7 more
  • @KiChjang: components/script/textinput.rs, components/script/dom/document.rs, components/script_traits/lib.rs, components/script/lib.rs, components/script/Cargo.toml and 3 more

@highfive

highfive commented Oct 6, 2018

Copy link
Copy Markdown

warning Warning warning

  • These commits modify script code, but no tests are modified. Please consider adding a test!

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Oct 6, 2018
@pyfisch
pyfisch force-pushed the keyboard-types branch 2 times, most recently from d45aef0 to a2b9bed Compare October 6, 2018 18:19
@pyfisch

pyfisch commented Oct 6, 2018

Copy link
Copy Markdown
Contributor Author

@bors-servo try=wpt

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit a2b9bed with merge 5567394...

bors-servo pushed a commit that referenced this pull request Oct 6, 2018
WIP Use keyboard-types crate

Have embedders send DOM keys to servo and use a strongly typed KeyboardEvent
from the W3C UI Events spec. All keyboard handling now uses the new types.

Introduce a ShortcutMatcher to recognize key bindings. Shortcuts are now
recognized in a uniform way.

Updated the winit port.
Updated webdriver integration.

part of #20331

What this PR does:

* allow the use non-ASCII keyboards for text input
* decouple keyboard event "key" from "code" (key meaning vs location)

What this PR does not do:

* completely improve keyboard events send from winit and webdriver
* add support for CompositionEvent or IME

Notes:

* The winit embedder does not send keyup events for printable keys (this is a regression)

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21881)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - linux-rel-css

@highfive highfive added the S-tests-failed The changes caused existing tests to fail. label Oct 6, 2018
@highfive highfive removed the S-tests-failed The changes caused existing tests to fail. label Oct 6, 2018
@pyfisch

pyfisch commented Oct 6, 2018

Copy link
Copy Markdown
Contributor Author

@bors-servo try=wpt

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit 23a84a6 with merge fd00720...

bors-servo pushed a commit that referenced this pull request Oct 6, 2018
WIP Use keyboard-types crate

Have embedders send DOM keys to servo and use a strongly typed KeyboardEvent
from the W3C UI Events spec. All keyboard handling now uses the new types.

Introduce a ShortcutMatcher to recognize key bindings. Shortcuts are now
recognized in a uniform way.

Updated the winit port.
Updated webdriver integration.

part of #20331

What this PR does:

* allow the use non-ASCII keyboards for text input
* decouple keyboard event "key" from "code" (key meaning vs location)

What this PR does not do:

* completely improve keyboard events send from winit and webdriver
* add support for CompositionEvent or IME

Notes:

* The winit embedder does not send keyup events for printable keys (this is a regression)
* keyboard-types is on crates.io because I believe it to be useful outside of servo. If you prefer I can add a copy in this repo.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21881)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

💥 Test timed out

@pyfisch pyfisch changed the title WIP Use keyboard-types crate Use keyboard-types crate Oct 7, 2018
@pyfisch

pyfisch commented Oct 7, 2018 •

Copy link
Copy Markdown
Contributor Author

Questions for reviewers:

  • keyboard-types
    • naming: KeyState or just State?
    • should I remove the CompositionEvent? It is not used yet but will be used for composing keys (and IMEs?).
    • ShortcutMatcher currently takes all modifier keys into account. But some keys like NumLock are not usually part of shortcuts and they are locking keys so they will prevent any other shortcuts from working. Which keys are usually used in shortcuts? (Shift, Control, Alt, Meta only?)
    • naming: is Key::Character a good name as it contains a String and not a char?
  • textinput
    • BTW selecting text with the arrow keys and shift can cause an assertion failure (select some chars to the left and then press shift+right)
  • webdriver
  • Do all keyboard shortcuts work? (Especially on Mac)
    • Control+Shift+3 (capture webrender does not work because the characters emitted by winit for Control+* are messed up

(to be continued ;-) )

When someone reviews this (unfortunately large) PR Id suggest to start with the keyboard-types crate, then continue to the DOM KeyboardEvent and textinput file and last review the embedders winit and webdriver.

@pyfisch
pyfisch force-pushed the keyboard-types branch 2 times, most recently from 6b396de to 7e3a212 Compare October 7, 2018 13:20
Comment thread components/script/dom/document.rs Resolved
Comment thread components/script/dom/document.rs Resolved
Comment thread components/script/script_thread.rs Resolved
@pyfisch
pyfisch force-pushed the keyboard-types branch 4 times, most recently from da4d76b to e8d9447 Compare October 7, 2018 15:50
@pyfisch

pyfisch commented Oct 7, 2018

Copy link
Copy Markdown
Contributor Author

@bors-servo try

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit e8d9447 with merge d566217...

bors-servo pushed a commit that referenced this pull request Oct 7, 2018
Use keyboard-types crate

Have embedders send DOM keys to servo and use a strongly typed KeyboardEvent
from the W3C UI Events spec. All keyboard handling now uses the new types.

Introduce a ShortcutMatcher to recognize key bindings. Shortcuts are now
recognized in a uniform way.

Updated the winit port.
Updated webdriver integration.

part of #20331

What this PR does:

* allow the use non-ASCII keyboards for text input
* decouple keyboard event "key" from "code" (key meaning vs location)

What this PR does not do:

* completely improve keyboard events send from winit and webdriver
* add support for CompositionEvent or IME

Notes:

* The winit embedder does not send keyup events for printable keys (this is a regression)
* keyboard-types is on crates.io because I believe it to be useful outside of servo. If you prefer I can add a copy in this repo.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21881)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - android-x86

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit c861942 with merge a8ce352...

bors-servo pushed a commit that referenced this pull request Oct 13, 2018
Use keyboard-types crate

Have embedders send DOM keys to servo and use a strongly typed KeyboardEvent
from the W3C UI Events spec. All keyboard handling now uses the new types.

Introduce a ShortcutMatcher to recognize key bindings. Shortcuts are now
recognized in a uniform way.

Updated the winit port.
Updated webdriver integration.

part of #20331

What this PR does:

* allow the use non-ASCII keyboards for text input
* decouple keyboard event "key" from "code" (key meaning vs location)

What this PR does not do:

* completely improve keyboard events send from winit and webdriver
* add support for CompositionEvent or IME

Notes:

* The winit embedder does not send keyup events for printable keys (this is a regression)
* keyboard-types is on crates.io because I believe it to be useful outside of servo. If you prefer I can add a copy in this repo.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21881)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - linux-rel-wpt

@highfive highfive added the S-tests-failed The changes caused existing tests to fail. label Oct 13, 2018
@pyfisch

pyfisch commented Oct 15, 2018

Copy link
Copy Markdown
Contributor Author

@bors-servo try=wpt

@jdm

jdm commented Oct 15, 2018

Copy link
Copy Markdown
Member

@bors-servo retry

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit c861942 with merge 409cd3f...

bors-servo pushed a commit that referenced this pull request Oct 15, 2018
Use keyboard-types crate

Have embedders send DOM keys to servo and use a strongly typed KeyboardEvent
from the W3C UI Events spec. All keyboard handling now uses the new types.

Introduce a ShortcutMatcher to recognize key bindings. Shortcuts are now
recognized in a uniform way.

Updated the winit port.
Updated webdriver integration.

part of #20331

What this PR does:

* allow the use non-ASCII keyboards for text input
* decouple keyboard event "key" from "code" (key meaning vs location)

What this PR does not do:

* completely improve keyboard events send from winit and webdriver
* add support for CompositionEvent or IME

Notes:

* The winit embedder does not send keyup events for printable keys (this is a regression)
* keyboard-types is on crates.io because I believe it to be useful outside of servo. If you prefer I can add a copy in this repo.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21881)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

💥 Test timed out

@jdm

jdm commented Oct 15, 2018

Copy link
Copy Markdown
Member

It was green.

@paulrouget

Copy link
Copy Markdown
Contributor

I'm happy with both this PR and keyboard-types. This is a significant improvement. Thank you.
I haven't had a chance to test on MacOS though because of servo/mozjs#156.

@bors-servo r+

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit c861942 has been approved by paulrouget

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. S-tests-failed The changes caused existing tests to fail. labels Oct 17, 2018
bors-servo pushed a commit that referenced this pull request Oct 17, 2018
Use keyboard-types crate

Have embedders send DOM keys to servo and use a strongly typed KeyboardEvent
from the W3C UI Events spec. All keyboard handling now uses the new types.

Introduce a ShortcutMatcher to recognize key bindings. Shortcuts are now
recognized in a uniform way.

Updated the winit port.
Updated webdriver integration.

part of #20331

What this PR does:

* allow the use non-ASCII keyboards for text input
* decouple keyboard event "key" from "code" (key meaning vs location)

What this PR does not do:

* completely improve keyboard events send from winit and webdriver
* add support for CompositionEvent or IME

Notes:

* The winit embedder does not send keyup events for printable keys (this is a regression)
* keyboard-types is on crates.io because I believe it to be useful outside of servo. If you prefer I can add a copy in this repo.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21881)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit c861942 with merge 9a0404a...

@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, android-mac, android-x86, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, status-taskcluster, windows-msvc-dev
Approved by: paulrouget
Pushing 9a0404a to master...

@bors-servo
bors-servo merged commit c861942 into servo:master Oct 17, 2018
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Oct 17, 2018
@bors-servo bors-servo mentioned this pull request Oct 17, 2018
5 tasks
@pyfisch
pyfisch deleted the keyboard-types branch October 17, 2018 10:25
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Oct 18, 2018
Have embedders send DOM keys to servo and use a strongly typed KeyboardEvent
from the W3C UI Events spec. All keyboard handling now uses the new types.

Introduce a ShortcutMatcher to recognize key bindings. Shortcuts are now
recognized in a uniform way.

Updated the winit port.
Updated webdriver integration.

part of #20331

This cherry-picks part of servo/servo#21881.
xeonchen pushed a commit to xeonchen/gecko-cinnabar that referenced this pull request Oct 19, 2018
Have embedders send DOM keys to servo and use a strongly typed KeyboardEvent
from the W3C UI Events spec. All keyboard handling now uses the new types.

Introduce a ShortcutMatcher to recognize key bindings. Shortcuts are now
recognized in a uniform way.

Updated the winit port.
Updated webdriver integration.

part of #20331

This cherry-picks part of servo/servo#21881.
@nox

nox commented Oct 22, 2018

Copy link
Copy Markdown
Contributor

I'm confused, why are we using a prerelease version of this crate?

@pyfisch

pyfisch commented Oct 22, 2018

Copy link
Copy Markdown
Contributor Author

I'm confused, why are we using a prerelease version of this crate?

Because I wanted some feedback on the keyboard-types crate without publishing a new release version for keyboard-types.

gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 3, 2019
Have embedders send DOM keys to servo and use a strongly typed KeyboardEvent
from the W3C UI Events spec. All keyboard handling now uses the new types.

Introduce a ShortcutMatcher to recognize key bindings. Shortcuts are now
recognized in a uniform way.

Updated the winit port.
Updated webdriver integration.

part of #20331

This cherry-picks part of servo/servo#21881.

UltraBlame original commit: 61bdac71c45c07c9f5f6c3adfcd2c9919b93f7fd
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 3, 2019
Have embedders send DOM keys to servo and use a strongly typed KeyboardEvent
from the W3C UI Events spec. All keyboard handling now uses the new types.

Introduce a ShortcutMatcher to recognize key bindings. Shortcuts are now
recognized in a uniform way.

Updated the winit port.
Updated webdriver integration.

part of #20331

This cherry-picks part of servo/servo#21881.

UltraBlame original commit: 61bdac71c45c07c9f5f6c3adfcd2c9919b93f7fd
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 3, 2019
Have embedders send DOM keys to servo and use a strongly typed KeyboardEvent
from the W3C UI Events spec. All keyboard handling now uses the new types.

Introduce a ShortcutMatcher to recognize key bindings. Shortcuts are now
recognized in a uniform way.

Updated the winit port.
Updated webdriver integration.

part of #20331

This cherry-picks part of servo/servo#21881.

UltraBlame original commit: 61bdac71c45c07c9f5f6c3adfcd2c9919b93f7fd
bhearsum pushed a commit to mozilla-releng/staging-firefox that referenced this pull request May 1, 2025
Have embedders send DOM keys to servo and use a strongly typed KeyboardEvent
from the W3C UI Events spec. All keyboard handling now uses the new types.

Introduce a ShortcutMatcher to recognize key bindings. Shortcuts are now
recognized in a uniform way.

Updated the winit port.
Updated webdriver integration.

part of #20331

This cherry-picks part of servo/servo#21881.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants