1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:57:35 +00:00

LibWeb: Support two-value background-repeat

The background-repeat value may be specified as either one- or two-value
identifiers (to be interpreted as horizontal and vertical repeat). This
adds two pseudo-properties, background-repeat-x and background-repeat-y,
to handle this. One-value identifiers are mapped to two-value in
accordance with the spec.
This commit is contained in:
Timothy Flynn 2021-04-05 12:05:35 -04:00 committed by Andreas Kling
parent 0794d879f3
commit 5de0e0068c
12 changed files with 152 additions and 35 deletions

View file

@ -362,7 +362,7 @@ RefPtr<Gfx::Bitmap> Document::background_image() const
return background_image->bitmap();
}
CSS::Repeat Document::background_repeat() const
CSS::Repeat Document::background_repeat_x() const
{
auto* body_element = body();
if (!body_element)
@ -372,7 +372,20 @@ CSS::Repeat Document::background_repeat() const
if (!body_layout_node)
return CSS::Repeat::Repeat;
return body_layout_node->computed_values().background_repeat();
return body_layout_node->computed_values().background_repeat_x();
}
CSS::Repeat Document::background_repeat_y() 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_y();
}
URL Document::complete_url(const String& string) const