LibWeb: Make storage of CSS::StyleValues const-correct

Now we consistently use `RefPtr<StyleValue const>` for all StyleValues.
This commit is contained in:
Andrew Kaster 2025-04-15 15:18:27 -06:00 committed by Andrew Kaster
commit 6d11414957
Notes: github-actions[bot] 2025-04-16 16:44:32 +00:00
113 changed files with 628 additions and 629 deletions

View file

@ -98,7 +98,7 @@ public:
Bindings::ImageSmoothingQuality image_smoothing_quality { Bindings::ImageSmoothingQuality::Low };
float global_alpha = { 1 };
Gfx::CompositingAndBlendingOperator current_compositing_and_blending_operator = Gfx::CompositingAndBlendingOperator::SourceOver;
RefPtr<CSS::CSSStyleValue> font_style_value { nullptr };
RefPtr<CSS::CSSStyleValue const> font_style_value { nullptr };
RefPtr<Gfx::Font const> current_font { nullptr };
Bindings::CanvasTextAlign text_align { Bindings::CanvasTextAlign::Start };
Bindings::CanvasTextBaseline text_baseline { Bindings::CanvasTextBaseline::Alphabetic };

View file

@ -44,7 +44,7 @@ private:
// ^HTML::WindowEventHandlers
virtual GC::Ptr<DOM::EventTarget> window_event_handlers_to_event_target() override;
RefPtr<CSS::ImageStyleValue> m_background_style_value;
RefPtr<CSS::ImageStyleValue const> m_background_style_value;
};
}

View file

@ -4943,7 +4943,7 @@ String HTMLParser::serialize_html_fragment(DOM::Node const& node, SerializableSh
}
// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#current-dimension-value
static RefPtr<CSS::CSSStyleValue> parse_current_dimension_value(float value, Utf8View input, Utf8View::Iterator position)
static RefPtr<CSS::CSSStyleValue const> parse_current_dimension_value(float value, Utf8View input, Utf8View::Iterator position)
{
// 1. If position is past the end of input, then return value as a length.
if (position == input.end())
@ -4958,7 +4958,7 @@ static RefPtr<CSS::CSSStyleValue> parse_current_dimension_value(float value, Utf
}
// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#rules-for-parsing-dimension-values
RefPtr<CSS::CSSStyleValue> parse_dimension_value(StringView string)
RefPtr<CSS::CSSStyleValue const> parse_dimension_value(StringView string)
{
// 1. Let input be the string being parsed.
auto input = Utf8View(string);
@ -5032,7 +5032,7 @@ RefPtr<CSS::CSSStyleValue> parse_dimension_value(StringView string)
}
// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#rules-for-parsing-non-zero-dimension-values
RefPtr<CSS::CSSStyleValue> parse_nonzero_dimension_value(StringView string)
RefPtr<CSS::CSSStyleValue const> parse_nonzero_dimension_value(StringView string)
{
// 1. Let input be the string being parsed.
// 2. Let value be the result of parsing input using the rules for parsing dimension values.

View file

@ -229,8 +229,8 @@ private:
StringBuilder m_character_insertion_builder;
} SWIFT_UNSAFE_REFERENCE;
RefPtr<CSS::CSSStyleValue> parse_dimension_value(StringView);
RefPtr<CSS::CSSStyleValue> parse_nonzero_dimension_value(StringView);
RefPtr<CSS::CSSStyleValue const> parse_dimension_value(StringView);
RefPtr<CSS::CSSStyleValue const> parse_nonzero_dimension_value(StringView);
Optional<Color> parse_legacy_color_value(StringView);
// Swift interop