mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-05 15:49:15 +00:00
LibWeb: Move and rename CSSStyleValue to StyleValues/StyleValue.{h,cpp}
This reverts 0e3487b9ab
.
Back when I made that change, I thought we could make our StyleValue
classes match the typed-om definitions directly. However, they have
different requirements. Typed-om types need to be mutable and GCed,
whereas StyleValues are immutable and ideally wouldn't require a JS VM.
While I was already making such a cataclysmic change, I've moved it into
the StyleValues directory, because it *not* being there has bothered me
for a long time. 😅
This commit is contained in:
parent
0d8ad0a9fe
commit
c57975c9fd
Notes:
github-actions[bot]
2025-08-08 14:20:54 +00:00
Author: https://github.com/AtkinsSJ
Commit: c57975c9fd
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5775
Reviewed-by: https://github.com/tcl3 ✅
167 changed files with 989 additions and 990 deletions
|
@ -64,7 +64,7 @@ String TransformationStyleValue::to_string(SerializationMode mode) const
|
|||
{
|
||||
// https://drafts.csswg.org/css-transforms-2/#individual-transform-serialization
|
||||
if (m_properties.property == PropertyID::Rotate) {
|
||||
auto resolve_to_number = [](ValueComparingNonnullRefPtr<CSSStyleValue const> const& value) -> Optional<double> {
|
||||
auto resolve_to_number = [](ValueComparingNonnullRefPtr<StyleValue const> const& value) -> Optional<double> {
|
||||
if (value->is_number())
|
||||
return value->as_number().number();
|
||||
if (value->is_calculated() && value->as_calculated().resolves_to_number())
|
||||
|
@ -117,7 +117,7 @@ String TransformationStyleValue::to_string(SerializationMode mode) const
|
|||
return MUST(String::formatted("{} {} {} {}", rotation_x->to_string(mode), rotation_y->to_string(mode), rotation_z->to_string(mode), angle->to_string(mode)));
|
||||
}
|
||||
if (m_properties.property == PropertyID::Scale) {
|
||||
auto resolve_to_string = [mode](CSSStyleValue const& value) -> String {
|
||||
auto resolve_to_string = [mode](StyleValue const& value) -> String {
|
||||
Optional<double> raw_value;
|
||||
|
||||
if (value.is_number())
|
||||
|
@ -160,7 +160,7 @@ String TransformationStyleValue::to_string(SerializationMode mode) const
|
|||
return builder.to_string_without_validation();
|
||||
}
|
||||
if (m_properties.property == PropertyID::Translate) {
|
||||
auto resolve_to_string = [mode](CSSStyleValue const& value) -> Optional<String> {
|
||||
auto resolve_to_string = [mode](StyleValue const& value) -> Optional<String> {
|
||||
auto string_value = value.to_string(mode);
|
||||
|
||||
if (string_value == "0px"_string)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue