mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Eliminate untraversed node types from LayoutNodeType.
MozReview-Commit-ID: 926ReI1BSsf
This commit is contained in:
parent
6b40f97289
commit
97fd61f512
4 changed files with 5 additions and 30 deletions
|
@ -1472,13 +1472,6 @@ impl<'a, ConcreteThreadSafeLayoutNode> PostorderNodeMutTraversal<ConcreteThreadS
|
|||
}
|
||||
Some(LayoutNodeType::Text) =>
|
||||
(display::T::inline, float::T::none, position::T::static_),
|
||||
Some(LayoutNodeType::Comment) |
|
||||
Some(LayoutNodeType::ProcessingInstruction) |
|
||||
Some(LayoutNodeType::DocumentType) |
|
||||
Some(LayoutNodeType::DocumentFragment) |
|
||||
Some(LayoutNodeType::Document) => {
|
||||
(display::T::none, float::T::none, position::T::static_)
|
||||
}
|
||||
};
|
||||
|
||||
debug!("building flow for node: {:?} {:?} {:?} {:?}", display, float, positioning, node.type_id());
|
||||
|
@ -1615,12 +1608,7 @@ impl<ConcreteThreadSafeLayoutNode> NodeUtils for ConcreteThreadSafeLayoutNode
|
|||
where ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode {
|
||||
fn is_replaced_content(&self) -> bool {
|
||||
match self.type_id() {
|
||||
Some(LayoutNodeType::Comment) |
|
||||
Some(LayoutNodeType::ProcessingInstruction) |
|
||||
Some(LayoutNodeType::Text) |
|
||||
Some(LayoutNodeType::DocumentType) |
|
||||
Some(LayoutNodeType::DocumentFragment) |
|
||||
Some(LayoutNodeType::Document) |
|
||||
Some(LayoutNodeType::Element(LayoutElementType::HTMLImageElement)) |
|
||||
Some(LayoutNodeType::Element(LayoutElementType::HTMLIFrameElement)) |
|
||||
Some(LayoutNodeType::Element(LayoutElementType::HTMLCanvasElement)) |
|
||||
|
|
|
@ -2654,20 +2654,11 @@ impl Into<LayoutNodeType> for NodeTypeId {
|
|||
#[inline(always)]
|
||||
fn into(self) -> LayoutNodeType {
|
||||
match self {
|
||||
NodeTypeId::CharacterData(CharacterDataTypeId::Comment) =>
|
||||
LayoutNodeType::Comment,
|
||||
NodeTypeId::Document(..) =>
|
||||
LayoutNodeType::Document,
|
||||
NodeTypeId::DocumentFragment =>
|
||||
LayoutNodeType::DocumentFragment,
|
||||
NodeTypeId::DocumentType =>
|
||||
LayoutNodeType::DocumentType,
|
||||
NodeTypeId::Element(e) =>
|
||||
LayoutNodeType::Element(e.into()),
|
||||
NodeTypeId::CharacterData(CharacterDataTypeId::ProcessingInstruction) =>
|
||||
LayoutNodeType::ProcessingInstruction,
|
||||
NodeTypeId::CharacterData(CharacterDataTypeId::Text) =>
|
||||
LayoutNodeType::Text,
|
||||
x => unreachable!("Layout should not traverse nodes of type {:?}", x),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -783,15 +783,16 @@ impl<'ln> ServoThreadSafeLayoutNode<'ln> {
|
|||
|
||||
impl<'ln> NodeInfo for ServoThreadSafeLayoutNode<'ln> {
|
||||
fn is_element(&self) -> bool {
|
||||
if let Some(LayoutNodeType::Element(_)) = self.type_id() { true } else { false }
|
||||
self.pseudo == PseudoElementType::Normal && self.node.is_element()
|
||||
}
|
||||
|
||||
fn is_text_node(&self) -> bool {
|
||||
if let Some(LayoutNodeType::Text) = self.type_id() { true } else { false }
|
||||
self.pseudo == PseudoElementType::Normal && self.node.is_text_node()
|
||||
}
|
||||
|
||||
fn needs_layout(&self) -> bool {
|
||||
self.pseudo != PseudoElementType::Normal || self.is_element() || self.is_text_node()
|
||||
self.pseudo != PseudoElementType::Normal ||
|
||||
self.node.is_element() || self.node.is_text_node()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -107,12 +107,7 @@ impl DomParallelInfo {
|
|||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||
pub enum LayoutNodeType {
|
||||
Comment,
|
||||
Document,
|
||||
DocumentFragment,
|
||||
DocumentType,
|
||||
Element(LayoutElementType),
|
||||
ProcessingInstruction,
|
||||
Text,
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue