mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 09:09:43 +00:00
LibWeb/CSS: Allow getting a property's computed value without animations
The algorithm for starting a transition requires us to examine the before-change and after-change values of the property, without taking any current animations into account.
This commit is contained in:
parent
91b2cd7d31
commit
3a10596136
Notes:
github-actions[bot]
2024-09-22 04:43:20 +00:00
Author: https://github.com/AtkinsSJ
Commit: 3a10596136
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1442
2 changed files with 10 additions and 4 deletions
|
@ -112,10 +112,12 @@ void StyleProperties::reset_animated_properties()
|
||||||
m_data->m_animated_property_values.clear();
|
m_data->m_animated_property_values.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
NonnullRefPtr<CSSStyleValue const> StyleProperties::property(CSS::PropertyID property_id) const
|
NonnullRefPtr<CSSStyleValue const> StyleProperties::property(CSS::PropertyID property_id, WithAnimationsApplied return_animated_value) const
|
||||||
{
|
{
|
||||||
if (auto animated_value = m_data->m_animated_property_values.get(property_id).value_or(nullptr))
|
if (return_animated_value == WithAnimationsApplied::Yes) {
|
||||||
return *animated_value;
|
if (auto animated_value = m_data->m_animated_property_values.get(property_id).value_or(nullptr))
|
||||||
|
return *animated_value;
|
||||||
|
}
|
||||||
|
|
||||||
// By the time we call this method, all properties have values assigned.
|
// By the time we call this method, all properties have values assigned.
|
||||||
return *m_data->m_property_values[to_underlying(property_id)];
|
return *m_data->m_property_values[to_underlying(property_id)];
|
||||||
|
|
|
@ -74,7 +74,11 @@ public:
|
||||||
|
|
||||||
void set_property(CSS::PropertyID, NonnullRefPtr<CSSStyleValue const> value, Inherited = Inherited::No, Important = Important::No);
|
void set_property(CSS::PropertyID, NonnullRefPtr<CSSStyleValue const> value, Inherited = Inherited::No, Important = Important::No);
|
||||||
void set_animated_property(CSS::PropertyID, NonnullRefPtr<CSSStyleValue const> value);
|
void set_animated_property(CSS::PropertyID, NonnullRefPtr<CSSStyleValue const> value);
|
||||||
NonnullRefPtr<CSSStyleValue const> property(CSS::PropertyID) const;
|
enum class WithAnimationsApplied {
|
||||||
|
No,
|
||||||
|
Yes,
|
||||||
|
};
|
||||||
|
NonnullRefPtr<CSSStyleValue const> property(CSS::PropertyID, WithAnimationsApplied = WithAnimationsApplied::Yes) const;
|
||||||
RefPtr<CSSStyleValue const> maybe_null_property(CSS::PropertyID) const;
|
RefPtr<CSSStyleValue const> maybe_null_property(CSS::PropertyID) const;
|
||||||
void revert_property(CSS::PropertyID, StyleProperties const& style_for_revert);
|
void revert_property(CSS::PropertyID, StyleProperties const& style_for_revert);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue