Merge branch 'master' into breaking

This commit is contained in:
Jonathan Kelley committed 2024-01-30 16:20:19 -08:00
commit eff1dd6c90
29 files changed
+684 -258

No files matched your search

+195
View File
@@ -1744,4 +1744,199 @@ builder_constructors! {
r#use ["use", "http://www.w3.org/2000/svg"] {
href: String DEFAULT,
};
// MathML elements
/// Build a
/// [`<annotation>`](https://w3c.github.io/mathml-core/#dfn-annotation)
/// element.
annotation "http://www.w3.org/1998/Math/MathML" {
encoding: String DEFAULT,
};
/// Build a
/// [`<annotation-xml>`](https://w3c.github.io/mathml-core/#dfn-annotation-xml)
/// element.
annotationXml ["annotation-xml", "http://www.w3.org/1998/Math/MathML"] {
encoding: String DEFAULT,
};
/// Build a
/// [`<merror>`](https://developer.mozilla.org/en-US/docs/Web/MathML/Element/merror)
/// element.
merror "http://www.w3.org/1998/Math/MathML" {};
/// Build a
/// [`<math>`](https://developer.mozilla.org/en-US/docs/Web/MathML/Element/math)
/// element.
math "http://www.w3.org/1998/Math/MathML" {
display: String DEFAULT,
};
/// Build a
/// [`<mfrac>`](https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mfrac)
/// element.
mfrac "http://www.w3.org/1998/Math/MathML" {
linethickness: usize DEFAULT,
};
/// Build a
/// [`<mi>`](https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mi)
/// element.
mi "http://www.w3.org/1998/Math/MathML" {
mathvariant: String DEFAULT,
};
/// Build a
/// [`<mmultiscripts>`](https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mmultiscripts)
/// element.
mmultiscripts "http://www.w3.org/1998/math/mathml" {};
/// Build a
/// [`<mn>`](https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mn)
/// element.
mn "http://www.w3.org/1998/Math/MathML" {};
/// Build a
/// [`<mo>`](https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mo)
/// element.
mo "http://www.w3.org/1998/Math/MathML" {
fence: Bool DEFAULT,
largeop: Bool DEFAULT,
lspace: usize DEFAULT,
maxsize: usize DEFAULT,
minsize: usize DEFAULT,
movablelimits: Bool DEFAULT,
rspace: usize DEFAULT,
separator: Bool DEFAULT,
stretchy: Bool DEFAULT,
symmetric: Bool DEFAULT,
};
/// Build a
/// [`<mover>`](https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mover)
/// element.
mover "http://www.w3.org/1998/Math/MathML" {
accent: Bool DEFAULT,
};
/// Build a
/// [`<mpadded>`](https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mpadded)
/// element.
mpadded "http://www.w3.org/1998/Math/MathML" {
depth: usize DEFAULT,
height: usize DEFAULT,
lspace: usize DEFAULT,
voffset: usize DEFAULT,
width: usize DEFAULT,
};
/// Build a
/// [`<mphantom>`](https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mphantom)
/// element.
mphantom "http://www.w3.org/1998/Math/MathML" {};
/// Build a
/// [`<mprescripts>`](https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mprescripts)
/// element.
mprescripts "http://www.w3.org/1998/Math/MathML" {};
/// Build a
/// [`<mroot>`](https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mroot)
/// element.
mroot "http://www.w3.org/1998/Math/MathML" {};
/// Build a
/// [`<mrow>`](https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mrow)
/// element.
mrow "http://www.w3.org/1998/Math/MathML" {
};
/// Build a
/// [`<ms>`](https://developer.mozilla.org/en-US/docs/Web/MathML/Element/ms)
/// element.
ms "http://www.w3.org/1998/Math/MathML" {
lquote: String DEFAULT,
rquote: String DEFAULT,
};
/// Build a
/// [`<mspace>`](https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mspace)
/// element.
mspace "http://www.w3.org/1998/Math/MathML" {
depth: usize DEFAULT,
height: usize DEFAULT,
width: usize DEFAULT,
};
/// Build a
/// [`<msqrt>`](https://developer.mozilla.org/en-US/docs/Web/MathML/Element/msqrt)
/// element.
msqrt "http://www.w3.org/1998/Math/MathML" {};
/// Build a
/// [`<mstyle>`](https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mstyle)
/// element.
mstyle "http://www.w3.org/1998/Math/MathML" {};
/// Build a
/// [`<msub>`](https://developer.mozilla.org/en-US/docs/Web/MathML/Element/msub)
/// element.
msub "http://www.w3.org/1998/Math/MathML" {};
/// Build a
/// [`<msubsup>`](https://developer.mozilla.org/en-US/docs/Web/MathML/Element/msubsup)
/// element.
msubsup "http://www.w3.org/1998/Math/MathML" {};
/// Build a
/// [`<msup>`](https://developer.mozilla.org/en-US/docs/Web/MathML/Element/msup)
/// element.
msup "http://www.w3.org/1998/Math/MathML" {};
/// Build a
/// [`<mtable>`](https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mtable)
/// element.
mtable "http://www.w3.org/1998/Math/MathML" {};
/// Build a
/// [`<mtd>`](https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mtd)
/// element.
mtd "http://www.w3.org/1998/Math/MathML" {
columnspan: usize DEFAULT,
rowspan: usize DEFAULT,
};
/// Build a
/// [`<mtext>`](https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mtext)
/// element.
mtext "http://www.w3.org/1998/Math/MathML" {};
/// Build a
/// [`<mtr>`](https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mtr)
/// element.
mtr "http://www.w3.org/1998/Math/MathML" {};
/// Build a
/// [`<munder>`](https://developer.mozilla.org/en-US/docs/Web/MathML/Element/munder)
/// element.
munder "http://www.w3.org/1998/Math/MathML" {
accentunder: Bool DEFAULT,
};
/// Build a
/// [`<munderover>`](https://developer.mozilla.org/en-US/docs/Web/MathML/Element/munderover)
/// element.
munderover "http://www.w3.org/1998/Math/MathML" {
accent: Bool DEFAULT,
accentunder: Bool DEFAULT,
};
/// Build a
/// [`<semantics>`](https://developer.mozilla.org/en-US/docs/Web/MathML/Element/semantics)
/// element.
semantics "http://www.w3.org/1998/Math/MathML" {
encoding: String DEFAULT,
};
}
+18
View File
@@ -33,6 +33,7 @@ impl std::fmt::Debug for KeyboardData {
.field("modifiers", &self.modifiers())
.field("location", &self.location())
.field("is_auto_repeating", &self.is_auto_repeating())
.field("is_composing", &self.is_composing())
.finish()
}
}
@@ -44,6 +45,7 @@ impl PartialEq for KeyboardData {
&& self.modifiers() == other.modifiers()
&& self.location() == other.location()
&& self.is_auto_repeating() == other.is_auto_repeating()
&& self.is_composing() == other.is_composing()
}
}
@@ -75,6 +77,11 @@ impl KeyboardData {
self.inner.is_auto_repeating()
}
/// Indicates whether the key is fired within a composition session.
pub fn is_composing(&self) -> bool {
self.inner.is_composing()
}
/// Downcast this KeyboardData to a concrete type.
pub fn downcast<T: 'static>(&self) -> Option<&T> {
self.inner.as_any().downcast_ref::<T>()
@@ -92,6 +99,7 @@ impl ModifiersInteraction for KeyboardData {
#[derive(serde::Serialize, serde::Deserialize, Debug, PartialEq, Clone)]
pub struct SerializedKeyboardData {
char_code: u32,
is_composing: bool,
key: String,
key_code: KeyCode,
#[serde(deserialize_with = "resilient_deserialize_code")]
@@ -114,9 +122,11 @@ impl SerializedKeyboardData {
location: Location,
is_auto_repeating: bool,
modifiers: Modifiers,
is_composing: bool,
) -> Self {
Self {
char_code: key.legacy_charcode(),
is_composing,
key: key.to_string(),
key_code: KeyCode::from_raw_code(
std::convert::TryInto::try_into(key.legacy_keycode())
@@ -144,6 +154,7 @@ impl From<&KeyboardData> for SerializedKeyboardData {
data.location(),
data.is_auto_repeating(),
data.modifiers(),
data.is_composing(),
)
}
}
@@ -166,6 +177,10 @@ impl HasKeyboardData for SerializedKeyboardData {
self.repeat
}
fn is_composing(&self) -> bool {
self.is_composing
}
fn as_any(&self) -> &dyn std::any::Any {
self
}
@@ -236,6 +251,9 @@ pub trait HasKeyboardData: ModifiersInteraction + std::any::Any {
/// `true` iff the key is being held down such that it is automatically repeating.
fn is_auto_repeating(&self) -> bool;
/// Indicates whether the key is fired within a composition session.
fn is_composing(&self) -> bool;
/// return self as Any
fn as_any(&self) -> &dyn std::any::Any;
}
+4
View File
@@ -78,6 +78,10 @@ impl HasKeyboardData for KeyboardEvent {
self.repeat()
}
fn is_composing(&self) -> bool {
self.is_composing()
}
fn as_any(&self) -> &dyn std::any::Any {
self
}