cargo: Upgrade keyboard-types to 0.8.0 and xcomponent-sys to 0.3.4 (#38375)

With some adjustment for `NamedKey`. The two crates need to be bumped
together to avoid duplicate of `keyboard-types` action.

---------

Signed-off-by: PotatoCP <Kenzie.Raditya.Tirtarahardja@huawei.com>
This commit is contained in:
Kenzie Raditya Tirtarahardja 2025-08-01 16:14:38 +08:00 committed by GitHub
parent a063b5e78a
commit 05ad9026f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 471 additions and 432 deletions

View file

@ -41,7 +41,7 @@ use html5ever::{LocalName, Namespace, QualName, local_name, ns};
use hyper_serde::Serde;
use ipc_channel::ipc;
use js::rust::{HandleObject, HandleValue, MutableHandleValue};
use keyboard_types::{Code, Key, KeyState, Modifiers};
use keyboard_types::{Code, Key, KeyState, Modifiers, NamedKey};
use layout_api::{
PendingRestyle, ReflowGoal, RestyleReason, TrustedNodeAddress, node_id_from_scroll_id,
};
@ -2547,7 +2547,7 @@ impl Document {
let keyevent = KeyboardEvent::new(
&self.window,
DOMString::from(keyboard_event.event.state.to_string()),
DOMString::from(keyboard_event.event.state.event_type()),
true,
true,
Some(&self.window),
@ -2607,7 +2607,8 @@ impl Document {
// however *when* we do it is up to us.
// Here, we're dispatching it after the key event so the script has a chance to cancel it
// https://www.w3.org/Bugs/Public/show_bug.cgi?id=27337
if (keyboard_event.event.key == Key::Enter || keyboard_event.event.code == Code::Space) &&
if (keyboard_event.event.key == Key::Named(NamedKey::Enter) ||
keyboard_event.event.code == Code::Space) &&
keyboard_event.event.state == KeyState::Up
{
if let Some(elem) = target.downcast::<Element>() {
@ -2647,7 +2648,7 @@ impl Document {
let compositionevent = CompositionEvent::new(
&self.window,
DOMString::from(composition_event.state.to_string()),
DOMString::from(composition_event.state.event_type()),
true,
cancelable,
Some(&self.window),
@ -4045,7 +4046,7 @@ impl Document {
}
fn is_character_value_key(key: &Key) -> bool {
matches!(key, Key::Character(_) | Key::Enter)
matches!(key, Key::Character(_) | Key::Named(NamedKey::Enter))
}
#[derive(MallocSizeOf, PartialEq)]

View file

@ -6,7 +6,7 @@ use std::cell::Cell;
use dom_struct::dom_struct;
use js::rust::HandleObject;
use keyboard_types::{Key, Modifiers};
use keyboard_types::{Key, Modifiers, NamedKey};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::KeyboardEventBinding;
@ -43,7 +43,7 @@ impl KeyboardEvent {
KeyboardEvent {
uievent: UIEvent::new_inherited(),
key: DomRefCell::new(DOMString::new()),
typed_key: DomRefCell::new(Key::Unidentified),
typed_key: DomRefCell::new(Key::Named(NamedKey::Unidentified)),
code: DomRefCell::new(DOMString::new()),
location: Cell::new(0),
modifiers: Cell::new(Modifiers::empty()),
@ -180,7 +180,7 @@ impl KeyboardEventMethods<crate::DomTypeHolder> for KeyboardEvent {
init.parent.parent.parent.cancelable,
init.parent.parent.view.as_deref(),
init.parent.parent.detail,
Key::Unidentified,
Key::Named(NamedKey::Unidentified),
init.code.clone(),
init.location,
init.repeat,