Move more foundational types to script_bindings (#35280)

* script: Move DOMClass to script_bindings.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Move DOMJSClass and get_dom_class to script_bindings.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Move Castable/DerivedFrom/IDLInterface to script_bindings.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews 2025-02-04 05:36:30 -05:00 committed by GitHub
parent eaaad757e8
commit c0cef69108
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 291 additions and 207 deletions

View file

@ -3802,21 +3802,25 @@ impl UniqueId {
}
}
impl From<NodeTypeId> for LayoutNodeType {
pub(crate) struct NodeTypeIdWrapper(pub(crate) NodeTypeId);
impl From<NodeTypeIdWrapper> for LayoutNodeType {
#[inline(always)]
fn from(node_type: NodeTypeId) -> LayoutNodeType {
match node_type {
NodeTypeId::Element(e) => LayoutNodeType::Element(e.into()),
fn from(node_type: NodeTypeIdWrapper) -> LayoutNodeType {
match node_type.0 {
NodeTypeId::Element(e) => LayoutNodeType::Element(ElementTypeIdWrapper(e).into()),
NodeTypeId::CharacterData(CharacterDataTypeId::Text(_)) => LayoutNodeType::Text,
x => unreachable!("Layout should not traverse nodes of type {:?}", x),
}
}
}
impl From<ElementTypeId> for LayoutElementType {
struct ElementTypeIdWrapper(ElementTypeId);
impl From<ElementTypeIdWrapper> for LayoutElementType {
#[inline(always)]
fn from(element_type: ElementTypeId) -> LayoutElementType {
match element_type {
fn from(element_type: ElementTypeIdWrapper) -> LayoutElementType {
match element_type.0 {
ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBodyElement) => {
LayoutElementType::HTMLBodyElement
},