1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 19:07:36 +00:00

LibWeb: Store computed CSS value of background-repeat

This commit is contained in:
Timothy Flynn 2021-04-02 15:41:29 -04:00 committed by Andreas Kling
parent fcfeadaffa
commit bd5a91269f
7 changed files with 55 additions and 0 deletions

View file

@ -612,4 +612,28 @@ Optional<CSS::Overflow> StyleProperties::overflow(CSS::PropertyID property_id) c
}
}
Optional<CSS::Repeat> StyleProperties::background_repeat() const
{
auto value = property(CSS::PropertyID::BackgroundRepeat);
if (!value.has_value())
return {};
switch (value.value()->to_identifier()) {
case CSS::ValueID::NoRepeat:
return CSS::Repeat::NoRepeat;
case CSS::ValueID::Repeat:
return CSS::Repeat::Repeat;
case CSS::ValueID::RepeatX:
return CSS::Repeat::RepeatX;
case CSS::ValueID::RepeatY:
return CSS::Repeat::RepeatY;
case CSS::ValueID::Round:
return CSS::Repeat::Round;
case CSS::ValueID::Space:
return CSS::Repeat::Space;
default:
return {};
}
}
}