1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 22:37:35 +00:00

LibWeb: Resolve Lengths to CSSPixels

This commit is contained in:
Sam Atkins 2022-11-08 17:29:52 +00:00 committed by Linus Groh
parent 7d40e3eb0d
commit 8cc0bdf777
13 changed files with 44 additions and 44 deletions

View file

@ -66,7 +66,7 @@ static ColorStopData resolve_color_stop_positions(auto const& color_stop_list, a
// or transition hint before it.
auto max_previous_color_stop_or_hint = resolved_color_stops[0].position;
auto resolve_stop_position = [&](auto& position) {
float value = resolve_position_to_float(position);
float value = static_cast<float>(resolve_position_to_float(position));
value = max(value, max_previous_color_stop_or_hint);
max_previous_color_stop_or_hint = value;
return value;

View file

@ -435,7 +435,7 @@ static void paint_text_decoration(PaintContext& context, Gfx::Painter& painter,
if (computed_thickness.is_auto())
return max(glyph_height * 0.1f, 1.f);
return CSSPixels(computed_thickness.to_px(text_node));
return computed_thickness.to_px(text_node);
}();
auto device_line_thickness = context.rounded_device_pixels(css_line_thickness);

View file

@ -215,10 +215,10 @@ Gfx::FloatMatrix4x4 StackingContext::get_transformation_matrix(CSS::Transformati
return transformation.values[index].visit(
[this, reference_length](CSS::LengthPercentage const& value) {
if (reference_length.has_value()) {
return value.resolved(m_box, reference_length.value()).to_px(m_box);
return value.resolved(m_box, reference_length.value()).to_px(m_box).value();
}
return value.length().to_px(m_box);
return value.length().to_px(m_box).value();
},
[](CSS::Angle const& value) {
return value.to_degrees() * static_cast<float>(M_DEG2RAD);