Only allow UA widgets as children of media elements

Do not allow pseudo-elements for replaced elements
This commit is contained in:
Fernando Jiménez Moreno 2019-05-13 17:29:23 +02:00
parent 618f528344
commit e344203c11
6 changed files with 16 additions and 11 deletions

View file

@ -705,11 +705,16 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
// List of absolute descendants, in tree order.
let mut abs_descendants = AbsoluteDescendants::new();
let mut legalizer = Legalizer::new();
if !node.is_replaced_content() ||
node.type_id() == Some(LayoutNodeType::Element(LayoutElementType::HTMLMediaElement))
{
let is_media_element_with_widget = node.type_id() ==
Some(LayoutNodeType::Element(LayoutElementType::HTMLMediaElement)) &&
node.as_element().unwrap().is_shadow_host();
if !node.is_replaced_content() || is_media_element_with_widget {
for kid in node.children() {
if kid.get_pseudo_element_type() != PseudoElementType::Normal {
if node.is_replaced_content() {
// Replaced elements don't have pseudo-elements per spec.
continue;
}
self.process(&kid);
}