mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-17 05:29:56 +00:00
LibWeb/CSS: Use generated code to convert between dimension units
This commit is contained in:
parent
82f5be871a
commit
5534ed6715
Notes:
github-actions[bot]
2025-09-11 16:07:38 +00:00
Author: https://github.com/AtkinsSJ
Commit: 5534ed6715
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6071
6 changed files with 8 additions and 69 deletions
|
@ -47,24 +47,12 @@ String Time::to_string(SerializationMode serialization_mode) const
|
|||
|
||||
double Time::to_seconds() const
|
||||
{
|
||||
switch (m_unit) {
|
||||
case TimeUnit::S:
|
||||
return m_value;
|
||||
case TimeUnit::Ms:
|
||||
return m_value / 1000.0;
|
||||
}
|
||||
VERIFY_NOT_REACHED();
|
||||
return ratio_between_units(m_unit, TimeUnit::S) * m_value;
|
||||
}
|
||||
|
||||
double Time::to_milliseconds() const
|
||||
{
|
||||
switch (m_unit) {
|
||||
case TimeUnit::S:
|
||||
return m_value * 1000.0;
|
||||
case TimeUnit::Ms:
|
||||
return m_value;
|
||||
}
|
||||
VERIFY_NOT_REACHED();
|
||||
return ratio_between_units(m_unit, TimeUnit::Ms) * m_value;
|
||||
}
|
||||
|
||||
Time Time::resolve_calculated(NonnullRefPtr<CalculatedStyleValue const> const& calculated, Layout::Node const& layout_node, Time const& reference_value)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue