Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use keyboard-types crate #21881

Merged
merged 2 commits into from Oct 17, 2018
Merged

Use keyboard-types crate #21881

merged 2 commits into from Oct 17, 2018

Conversation

@pyfisch
Copy link
Contributor

pyfisch commented Oct 6, 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

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
Copy link

highfive commented Oct 6, 2018

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
Copy link

highfive commented Oct 6, 2018

warning Warning warning

  • These commits modify script code, but no tests are modified. Please consider adding a test!
@pyfisch pyfisch force-pushed the pyfisch:keyboard-types branch 2 times, most recently from d45aef0 to a2b9bed Oct 6, 2018
@pyfisch
Copy link
Contributor Author

pyfisch commented Oct 6, 2018

@bors-servo try=wpt

@bors-servo
Copy link
Contributor

bors-servo commented Oct 6, 2018

Trying commit a2b9bed with merge 5567394...

bors-servo added 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
Contributor

bors-servo commented Oct 6, 2018

💔 Test failed - linux-rel-css

@pyfisch pyfisch force-pushed the pyfisch:keyboard-types branch from a2b9bed to 23a84a6 Oct 6, 2018
@highfive highfive removed the S-tests-failed label Oct 6, 2018
@pyfisch
Copy link
Contributor Author

pyfisch commented Oct 6, 2018

@bors-servo try=wpt

@bors-servo
Copy link
Contributor

bors-servo commented Oct 6, 2018

Trying commit 23a84a6 with merge fd00720...

bors-servo added 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
Contributor

bors-servo commented Oct 7, 2018

💥 Test timed out

@pyfisch pyfisch changed the title WIP Use keyboard-types crate Use keyboard-types crate Oct 7, 2018
@pyfisch
Copy link
Contributor Author

pyfisch commented Oct 7, 2018

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
    • What is this mysterious Return key (\u{E006}) referring to? UI Events key Values only has Enter. (see also w3c/webdriver#1271)
  • 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 pyfisch:keyboard-types branch 2 times, most recently from 6b396de to 7e3a212 Oct 7, 2018
components/script/dom/document.rs Outdated Show resolved Hide resolved
components/script/dom/document.rs Outdated Show resolved Hide resolved
components/script/script_thread.rs Outdated Show resolved Hide resolved
@pyfisch pyfisch force-pushed the pyfisch:keyboard-types branch 4 times, most recently from da4d76b to e8d9447 Oct 7, 2018
@pyfisch
Copy link
Contributor Author

pyfisch commented Oct 7, 2018

@bors-servo
Copy link
Contributor

bors-servo commented Oct 7, 2018

Trying commit e8d9447 with merge d566217...

bors-servo added 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
Contributor

bors-servo commented Oct 7, 2018

💔 Test failed - android-x86

@pyfisch
Copy link
Contributor Author

pyfisch commented Oct 13, 2018

@bors-servo try=wpt

@bors-servo
Copy link
Contributor

bors-servo commented Oct 13, 2018

Trying commit c861942 with merge a8ce352...

bors-servo added 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
Contributor

bors-servo commented Oct 13, 2018

💔 Test failed - linux-rel-wpt

@pyfisch
Copy link
Contributor Author

pyfisch commented Oct 15, 2018

@bors-servo try=wpt

@jdm
Copy link
Member

jdm commented Oct 15, 2018

@bors-servo retry

@bors-servo
Copy link
Contributor

bors-servo commented Oct 15, 2018

Trying commit c861942 with merge 409cd3f...

bors-servo added 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
Contributor

bors-servo commented Oct 15, 2018

💥 Test timed out

@jdm
Copy link
Member

jdm commented Oct 15, 2018

It was green.

@paulrouget
Copy link
Contributor

paulrouget commented Oct 17, 2018

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
Contributor

bors-servo commented Oct 17, 2018

📌 Commit c861942 has been approved by paulrouget

bors-servo added 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
Contributor

bors-servo commented Oct 17, 2018

Testing commit c861942 with merge 9a0404a...

@bors-servo
Copy link
Contributor

bors-servo commented Oct 17, 2018

@bors-servo bors-servo merged commit c861942 into servo:master Oct 17, 2018
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@bors-servo bors-servo mentioned this pull request Oct 17, 2018
0 of 5 tasks complete
@pyfisch pyfisch deleted the pyfisch:keyboard-types branch Oct 17, 2018
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
Copy link
Member

nox commented Oct 22, 2018

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

@pyfisch
Copy link
Contributor Author

pyfisch commented Oct 22, 2018

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

8 participants
You can’t perform that action at this time.