mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-08 10:36:02 +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:
parent
13d5d47b56
commit
8f29bdb62c
Notes:
sideshowbarker
2024-07-17 05:02:42 +09:00
Author: https://github.com/awesomekling
Commit: 8f29bdb62c
Pull-request: https://github.com/SerenityOS/serenity/pull/20253
Reviewed-by: https://github.com/ADKaster
Reviewed-by: https://github.com/AtkinsSJ
8 changed files with 257 additions and 187 deletions
|
@ -35,6 +35,12 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
struct StyleAndSourceDeclaration {
|
||||
NonnullRefPtr<StyleValue const> style;
|
||||
CSS::CSSStyleDeclaration const* declaration = nullptr;
|
||||
};
|
||||
using PropertyValues = Array<Optional<StyleAndSourceDeclaration>, to_underlying(CSS::last_property_id) + 1>;
|
||||
|
||||
auto& properties() { return m_property_values; }
|
||||
auto const& properties() const { return m_property_values; }
|
||||
|
||||
|
@ -138,11 +144,7 @@ public:
|
|||
private:
|
||||
friend class StyleComputer;
|
||||
|
||||
struct StyleAndSourceDeclaration {
|
||||
NonnullRefPtr<StyleValue const> style;
|
||||
CSS::CSSStyleDeclaration const* declaration = nullptr;
|
||||
};
|
||||
Array<Optional<StyleAndSourceDeclaration>, to_underlying(CSS::last_property_id) + 1> m_property_values;
|
||||
PropertyValues m_property_values;
|
||||
Optional<CSS::Overflow> overflow(CSS::PropertyID) const;
|
||||
Vector<CSS::ShadowData> shadow(CSS::PropertyID, Layout::Node const&) const;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue