mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 20:15:07 +00:00
LibWeb: Cache the <body background> style image value
This way we don't refetch the background image every time style is recomputed (e.g when hovering different elements.)
This commit is contained in:
parent
8f25dbf394
commit
7a9cb2dfca
2 changed files with 7 additions and 1 deletions
|
@ -52,7 +52,8 @@ void HTMLBodyElement::apply_presentational_hints(StyleProperties& style) const
|
|||
if (color.has_value())
|
||||
style.set_property(CSS::PropertyID::Color, ColorStyleValue::create(color.value()));
|
||||
} else if (name.equals_ignoring_case("background")) {
|
||||
style.set_property(CSS::PropertyID::BackgroundImage, ImageStyleValue::create(document().complete_url(value), const_cast<Document&>(document())));
|
||||
ASSERT(m_background_style_value);
|
||||
style.set_property(CSS::PropertyID::BackgroundImage, *m_background_style_value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -71,6 +72,8 @@ void HTMLBodyElement::parse_attribute(const String& name, const String& value)
|
|||
auto color = Color::from_string(value);
|
||||
if (color.has_value())
|
||||
document().set_visited_link_color(color.value());
|
||||
} else if (name.equals_ignoring_case("background")) {
|
||||
m_background_style_value = ImageStyleValue::create(document().complete_url(value), const_cast<Document&>(document()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue