mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 21:29:06 +00:00
LibWeb: Preserve unit when serializing time values
Previously, when serializing a time value, we would always convert it to seconds. We now canonicalize the time value only when serializing its computed value.
This commit is contained in:
parent
2672fe99b7
commit
d0be5a0cdf
Notes:
github-actions[bot]
2025-03-20 17:00:33 +00:00
Author: https://github.com/tcl3
Commit: d0be5a0cdf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4004
Reviewed-by: https://github.com/AtkinsSJ ✅
4 changed files with 35 additions and 2 deletions
|
@ -26,7 +26,12 @@ public:
|
|||
virtual double value() const override { return m_time.raw_value(); }
|
||||
virtual StringView unit() const override { return m_time.unit_name(); }
|
||||
|
||||
virtual String to_string(SerializationMode) const override { return m_time.to_string(); }
|
||||
virtual String to_string(SerializationMode serialization_mode) const override
|
||||
{
|
||||
if (serialization_mode == SerializationMode::ResolvedValue)
|
||||
return MUST(String::formatted("{}s", m_time.to_seconds()));
|
||||
return m_time.to_string();
|
||||
}
|
||||
|
||||
bool equals(CSSStyleValue const& other) const override
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue