Generate ::before and ::after content from url() for layout2020

This commit is contained in:
Fernando Jiménez Moreno 2020-02-28 11:44:23 +01:00
parent 756cf66cd2
commit dc9a33f3a9
5 changed files with 46 additions and 6 deletions

View file

@ -271,10 +271,11 @@ where
})
}
/// https://www.w3.org/TR/CSS2/generate.html#propdef-content
fn generate_pseudo_element_content<'dom, Node>(
pseudo_element_style: &ComputedValues,
element: Node,
_context: &LayoutContext,
context: &LayoutContext,
) -> Vec<PseudoElementContentItem>
where
Node: NodeExt<'dom>,
@ -298,6 +299,13 @@ where
attr_val.map_or("".to_string(), |s| s.to_string()),
));
},
ContentItem::Url(image_url) => {
if let Some(replaced_content) =
ReplacedContent::from_image_url(element, context, image_url)
{
vec.push(PseudoElementContentItem::Replaced(replaced_content));
}
},
_ => (),
}
}