mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-11 02:29:21 +00:00
LibWeb/CSS: Make dimension types serialize in resolved form
Some dimensions would always serialize in a canonical unit, others never did, and others we manually would do so in their StyleValue. This commit moves all of that into the dimension types, which means for example that Length can apply its special rounding. Our local serialization test now produces the same output as other browsers. :^)
This commit is contained in:
parent
eec4365542
commit
443f9e5afb
Notes:
github-actions[bot]
2025-05-17 06:54:42 +00:00
Author: https://github.com/AtkinsSJ
Commit: 443f9e5afb
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4783
Reviewed-by: https://github.com/tcl3 ✅
20 changed files with 70 additions and 58 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Sam Atkins <atkinssj@serenityos.org>
|
||||
* Copyright (c) 2023-2025, Sam Atkins <sam@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibWeb/CSS/SerializationMode.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
@ -15,7 +16,7 @@ namespace Web::CSS {
|
|||
// https://drafts.csswg.org/css-grid-2/#typedef-flex
|
||||
class Flex {
|
||||
public:
|
||||
enum class Type {
|
||||
enum class Type : u8 {
|
||||
Fr,
|
||||
};
|
||||
|
||||
|
@ -25,7 +26,7 @@ public:
|
|||
static Flex make_fr(double);
|
||||
Flex percentage_of(Percentage const&) const;
|
||||
|
||||
String to_string() const;
|
||||
String to_string(SerializationMode = SerializationMode::Normal) const;
|
||||
double to_fr() const;
|
||||
|
||||
Type type() const { return m_type; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue