mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-03 17:58:49 +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:
parent
514fa83708
commit
faf9746244
Notes:
sideshowbarker
2024-07-17 23:00:03 +09:00
Author: https://github.com/awesomekling
Commit: faf9746244
3 changed files with 21 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue