1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:47:34 +00:00

LibWeb+LibIDL: Fix (or paper over) various const-correctness issues

There's definitely stuff to iterate on here, but this takes care of
making the libraries compile with stricter RP and NNRP.
This commit is contained in:
Andreas Kling 2023-02-20 18:56:08 +01:00
parent 68b5df6bf1
commit f11899f885
22 changed files with 210 additions and 186 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2022, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2018-2023, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -277,7 +277,7 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& computed_style)
return 1;
};
auto value_for_layer = [](auto& style_value, size_t layer_index) -> RefPtr<CSS::StyleValue> {
auto value_for_layer = [](auto& style_value, size_t layer_index) -> RefPtr<CSS::StyleValue const> {
if (style_value->is_value_list())
return style_value->as_value_list().value_at(layer_index, true);
return style_value;
@ -301,7 +301,7 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& computed_style)
if (auto image_value = value_for_layer(images, layer_index); image_value) {
if (image_value->is_abstract_image()) {
layer.background_image = image_value->as_abstract_image();
layer.background_image->load_any_resources(document());
const_cast<CSS::AbstractImageStyleValue&>(*layer.background_image).load_any_resources(document());
}
}
@ -517,7 +517,7 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& computed_style)
auto list_style_image = computed_style.property(CSS::PropertyID::ListStyleImage);
if (list_style_image->is_abstract_image()) {
m_list_style_image = list_style_image->as_abstract_image();
m_list_style_image->load_any_resources(document());
const_cast<CSS::AbstractImageStyleValue&>(*m_list_style_image).load_any_resources(document());
}
computed_values.set_color(computed_style.color_or_fallback(CSS::PropertyID::Color, *this, CSS::InitialValues::color()));
@ -574,7 +574,7 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& computed_style)
auto resolve_border_width = [&]() {
auto value = computed_style.property(width_property);
if (value->is_calculated())
return CSS::Length::make_calculated(value->as_calculated()).to_px(*this).value();
return CSS::Length::make_calculated(const_cast<CSS::CalculatedStyleValue&>(value->as_calculated())).to_px(*this).value();
if (value->has_length())
return value->to_length().to_px(*this).value();
if (value->is_identifier()) {