1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:38:11 +00:00

LibWeb: Implement the CSS revert keyword

This is a universal value like `initial` and `inherit` and works by
reverting the current value to whatever we had at the start of the
current cascade origin.

The implementation is somewhat inefficient as we make a copy of all
current values at the start of each origin. I'm sure we can come up with
a way to make this faster eventually.
This commit is contained in:
Andreas Kling 2023-07-29 17:14:18 +02:00
parent 13d5d47b56
commit 8f29bdb62c
8 changed files with 257 additions and 187 deletions

View file

@ -76,6 +76,7 @@
#include <LibWeb/CSS/StyleValues/RatioStyleValue.h>
#include <LibWeb/CSS/StyleValues/RectStyleValue.h>
#include <LibWeb/CSS/StyleValues/ResolutionStyleValue.h>
#include <LibWeb/CSS/StyleValues/RevertStyleValue.h>
#include <LibWeb/CSS/StyleValues/ShadowStyleValue.h>
#include <LibWeb/CSS/StyleValues/StringStyleValue.h>
#include <LibWeb/CSS/StyleValues/StyleValueList.h>
@ -3352,7 +3353,9 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_builtin_value(ComponentValue const& co
return InitialStyleValue::the();
if (ident.equals_ignoring_ascii_case("unset"sv))
return UnsetStyleValue::the();
// FIXME: Implement `revert` and `revert-layer` keywords, from Cascade4 and Cascade5 respectively
if (ident.equals_ignoring_ascii_case("revert"sv))
return RevertStyleValue::the();
// FIXME: Implement `revert-layer` from CSS-CASCADE-5.
}
return nullptr;