aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/layout/construct.rs12
-rw-r--r--components/script/dom/node.rs11
-rw-r--r--components/script/layout_wrapper.rs7
-rw-r--r--components/script_layout_interface/lib.rs5
4 files changed, 5 insertions, 30 deletions
diff --git a/components/layout/construct.rs b/components/layout/construct.rs
index d3a0c63e7a6..7c7eff8bc0c 100644
--- a/components/layout/construct.rs
+++ b/components/layout/construct.rs
@@ -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)) |
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index c9275306e53..ec2c45bfe8c 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -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),
}
}
}
diff --git a/components/script/layout_wrapper.rs b/components/script/layout_wrapper.rs
index 4d615d2a50e..cad48e36a64 100644
--- a/components/script/layout_wrapper.rs
+++ b/components/script/layout_wrapper.rs
@@ -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()
}
}
diff --git a/components/script_layout_interface/lib.rs b/components/script_layout_interface/lib.rs
index 120f794c249..3ad565d0c78 100644
--- a/components/script_layout_interface/lib.rs
+++ b/components/script_layout_interface/lib.rs
@@ -107,12 +107,7 @@ impl DomParallelInfo {
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum LayoutNodeType {
- Comment,
- Document,
- DocumentFragment,
- DocumentType,
Element(LayoutElementType),
- ProcessingInstruction,
Text,
}