mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 08:08:43 +00:00
LibWeb/CSS: Use serialize_a_number() for Ratio serialization
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
This commit is contained in:
parent
6b69b00a05
commit
92dc2faa10
Notes:
github-actions[bot]
2025-08-18 15:53:44 +00:00
Author: https://github.com/AtkinsSJ
Commit: 92dc2faa10
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5898
2 changed files with 12 additions and 3 deletions
|
@ -1,10 +1,11 @@
|
|||
/*
|
||||
* Copyright (c) 2022-2023, Sam Atkins <atkinssj@serenityos.org>
|
||||
* Copyright (c) 2022-2025, Sam Atkins <sam@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "Ratio.h"
|
||||
#include <LibWeb/CSS/Serialize.h>
|
||||
#include <math.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
@ -24,7 +25,15 @@ bool Ratio::is_degenerate() const
|
|||
|
||||
String Ratio::to_string() const
|
||||
{
|
||||
return MUST(String::formatted("{:.5} / {:.5}", m_first_value, m_second_value));
|
||||
// https://drafts.csswg.org/cssom/#serialize-a-css-value
|
||||
// -> <ratio>
|
||||
// The numerator serialized as per <number> followed by the literal string " / ", followed by the denominator
|
||||
// serialized as per <number>.
|
||||
StringBuilder builder;
|
||||
serialize_a_number(builder, m_first_value);
|
||||
builder.append(" / "sv);
|
||||
serialize_a_number(builder, m_second_value);
|
||||
return builder.to_string_without_validation();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ At time 400:
|
|||
accent-color: rgb(78, 88, 99)
|
||||
align-content: flex-start
|
||||
animation-duration: 0s
|
||||
aspect-ratio: 1.54415 / 1
|
||||
aspect-ratio: 1.544154 / 1
|
||||
background-color: rgb(78, 88, 99)
|
||||
background-repeat: repeat-x
|
||||
bottom: auto
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue