1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:28:12 +00:00

LibWeb: Support rendering background images with 'background-repeat'

Update the painting of background images for both <body> nodes and other
non-initial nodes. Currently, only the following values are supported:
    repeat, repeat-x, repeat-y, no-repeat

This also doesn't support the two-value syntax which allows for setting
horizontal and vertical repetition separately.
This commit is contained in:
Timothy Flynn 2021-04-02 18:19:33 -04:00 committed by Andreas Kling
parent bd5a91269f
commit fa9ba8bce5
4 changed files with 55 additions and 6 deletions

View file

@ -362,6 +362,19 @@ RefPtr<Gfx::Bitmap> Document::background_image() const
return background_image->bitmap();
}
CSS::Repeat Document::background_repeat() const
{
auto* body_element = body();
if (!body_element)
return CSS::Repeat::Repeat;
auto* body_layout_node = body_element->layout_node();
if (!body_layout_node)
return CSS::Repeat::Repeat;
return body_layout_node->computed_values().background_repeat();
}
URL Document::complete_url(const String& string) const
{
return m_url.complete_url(string);