mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 10:48:41 +00:00
LibWeb: Cache width of "alt" text in ImageBox
We were constantly measuring and re-measuring the "alt" attribute text of ImageBox layout nodes, even when the alt text didn't change. By caching this, we avoid a *lot* of repeated text measurement work.
This commit is contained in:
@@ -78,6 +78,11 @@ void HTMLImageElement::parse_attribute(FlyString const& name, String const& valu
|
||||
|
||||
if (name == HTML::AttributeNames::src && !value.is_empty())
|
||||
m_image_loader.load(document().parse_url(value));
|
||||
|
||||
if (name == HTML::AttributeNames::alt) {
|
||||
if (layout_node())
|
||||
verify_cast<Layout::ImageBox>(*layout_node()).dom_node_did_update_alt_text({});
|
||||
}
|
||||
}
|
||||
|
||||
RefPtr<Layout::Node> HTMLImageElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
|
||||
Reference in New Issue
Block a user