mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
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:
parent
eaaad757e8
commit
c0cef69108
16 changed files with 291 additions and 207 deletions
|
@ -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
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue