Do not render the contents of block-level replaced elements.

Fixes #10733
This commit is contained in:
Michael Howell 2016-04-20 19:18:09 -07:00
parent 75d99eec0f
commit 5a90c8f2bd
3 changed files with 17 additions and 19 deletions

View file

@ -619,18 +619,20 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
// List of absolute descendants, in tree order. // List of absolute descendants, in tree order.
let mut abs_descendants = AbsoluteDescendants::new(); let mut abs_descendants = AbsoluteDescendants::new();
for kid in node.children() { if !node.is_replaced_content() {
if kid.get_pseudo_element_type() != PseudoElementType::Normal { for kid in node.children() {
self.process(&kid); if kid.get_pseudo_element_type() != PseudoElementType::Normal {
} self.process(&kid);
}
self.build_block_flow_using_construction_result_of_child( self.build_block_flow_using_construction_result_of_child(
&mut flow, &mut flow,
&mut consecutive_siblings, &mut consecutive_siblings,
node, node,
kid, kid,
&mut inline_fragment_accumulator, &mut inline_fragment_accumulator,
&mut abs_descendants); &mut abs_descendants);
}
} }
// Perform a final flush of any inline fragments that we were gathering up to handle {ib} // Perform a final flush of any inline fragments that we were gathering up to handle {ib}
@ -683,7 +685,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
HTMLElementTypeId::HTMLInputElement))) || HTMLElementTypeId::HTMLInputElement))) ||
node.type_id() == Some(NodeTypeId::Element(ElementTypeId::HTMLElement( node.type_id() == Some(NodeTypeId::Element(ElementTypeId::HTMLElement(
HTMLElementTypeId::HTMLTextAreaElement))); HTMLElementTypeId::HTMLTextAreaElement)));
if node.get_pseudo_element_type().is_before_or_after() || if node.get_pseudo_element_type().is_replaced_content() ||
node_is_input_or_text_area { node_is_input_or_text_area {
// A TextArea's text contents are displayed through the input text // A TextArea's text contents are displayed through the input text
// box, so don't construct them. // box, so don't construct them.
@ -1659,7 +1661,6 @@ impl<ConcreteThreadSafeLayoutNode> NodeUtils for ConcreteThreadSafeLayoutNode
where ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode { where ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode {
fn is_replaced_content(&self) -> bool { fn is_replaced_content(&self) -> bool {
match self.type_id() { match self.type_id() {
None |
Some(NodeTypeId::CharacterData(_)) | Some(NodeTypeId::CharacterData(_)) |
Some(NodeTypeId::DocumentType) | Some(NodeTypeId::DocumentType) |
Some(NodeTypeId::DocumentFragment) | Some(NodeTypeId::DocumentFragment) |
@ -1673,6 +1674,7 @@ impl<ConcreteThreadSafeLayoutNode> NodeUtils for ConcreteThreadSafeLayoutNode
Some(NodeTypeId::Element(ElementTypeId::HTMLElement( Some(NodeTypeId::Element(ElementTypeId::HTMLElement(
HTMLElementTypeId::HTMLObjectElement))) => self.has_object_data(), HTMLElementTypeId::HTMLObjectElement))) => self.has_object_data(),
Some(NodeTypeId::Element(_)) => false, Some(NodeTypeId::Element(_)) => false,
None => self.get_pseudo_element_type().is_replaced_content(),
} }
} }

View file

@ -630,7 +630,7 @@ impl<T> PseudoElementType<T> {
} }
} }
pub fn is_before_or_after(&self) -> bool { pub fn is_replaced_content(&self) -> bool {
match *self { match *self {
PseudoElementType::Before(_) | PseudoElementType::After(_) => true, PseudoElementType::Before(_) | PseudoElementType::After(_) => true,
_ => false, _ => false,
@ -1041,7 +1041,7 @@ impl<'ln> ThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> {
} }
fn text_content(&self) -> TextContent { fn text_content(&self) -> TextContent {
if self.pseudo.is_before_or_after() { if self.pseudo.is_replaced_content() {
let data = &self.borrow_layout_data().unwrap().style_data; let data = &self.borrow_layout_data().unwrap().style_data;
let style = if self.pseudo.is_before() { let style = if self.pseudo.is_before() {

View file

@ -1,4 +0,0 @@
[canvas-fallback.html]
type: reftest
expected: FAIL
bug: https://github.com/servo/servo/issues/10733