summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Applications/PixelPaint/Tools/GradientTool.cpp2
-rw-r--r--Userland/Libraries/LibWeb/CSS/ComputedValues.h2
-rw-r--r--Userland/Libraries/LibWeb/CSS/EdgeRect.cpp2
-rw-r--r--Userland/Libraries/LibWeb/CSS/EdgeRect.h2
-rw-r--r--Userland/Libraries/LibWeb/CSS/GridTrackSize.cpp2
-rw-r--r--Userland/Libraries/LibWeb/CSS/GridTrackSize.h6
-rw-r--r--Userland/Libraries/LibWeb/CSS/Length.cpp4
-rw-r--r--Userland/Libraries/LibWeb/CSS/Length.h18
-rw-r--r--Userland/Libraries/LibWeb/CSS/Position.cpp12
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleComputer.cpp4
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp4
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleValues/FilterValueListStyleValue.cpp2
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleValues/FilterValueListStyleValue.h6
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleValues/RadialGradientStyleValue.cpp8
-rw-r--r--Userland/Libraries/LibWeb/DOM/Document.cpp2
-rw-r--r--Userland/Libraries/LibWeb/DOM/Element.cpp2
-rw-r--r--Userland/Libraries/LibWeb/HTML/SourceSet.cpp2
-rw-r--r--Userland/Libraries/LibWeb/HTML/SourceSet.h4
-rw-r--r--Userland/Libraries/LibWeb/HTML/Window.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp44
-rw-r--r--Userland/Libraries/LibWeb/Layout/FlexFormattingContext.h14
-rw-r--r--Userland/Libraries/LibWeb/Layout/FormattingContext.cpp6
-rw-r--r--Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp14
-rw-r--r--Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Layout/LayoutState.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Layout/LineBuilder.cpp6
-rw-r--r--Userland/Libraries/LibWeb/Layout/Node.cpp8
-rw-r--r--Userland/Libraries/LibWeb/Layout/SVGFormattingContext.cpp8
-rw-r--r--Userland/Libraries/LibWeb/Layout/SVGGeometryBox.cpp8
-rw-r--r--Userland/Libraries/LibWeb/Layout/TableFormattingContext.h2
-rw-r--r--Userland/Libraries/LibWeb/Page/Page.cpp11
-rw-r--r--Userland/Libraries/LibWeb/Page/Page.h2
-rw-r--r--Userland/Libraries/LibWeb/Painting/BackgroundPainting.cpp16
-rw-r--r--Userland/Libraries/LibWeb/Painting/BorderPainting.cpp10
-rw-r--r--Userland/Libraries/LibWeb/Painting/GradientPainting.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Painting/MarkerPaintable.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Painting/PaintContext.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Painting/PaintContext.h6
-rw-r--r--Userland/Libraries/LibWeb/Painting/PaintableBox.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Painting/SVGGeometryPaintable.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Painting/StackingContext.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Painting/VideoPaintable.cpp2
-rw-r--r--Userland/Libraries/LibWeb/PixelUnits.h2
-rw-r--r--Userland/Libraries/LibWeb/SVG/SVGDecodedImageData.cpp2
-rw-r--r--Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp2
-rw-r--r--Userland/Libraries/LibWeb/SVG/ViewBox.h8
-rw-r--r--Userland/Services/WebContent/PageHost.h2
48 files changed, 144 insertions, 145 deletions
diff --git a/Userland/Applications/PixelPaint/Tools/GradientTool.cpp b/Userland/Applications/PixelPaint/Tools/GradientTool.cpp
index 4cf6f535e9..3b978726ef 100644
--- a/Userland/Applications/PixelPaint/Tools/GradientTool.cpp
+++ b/Userland/Applications/PixelPaint/Tools/GradientTool.cpp
@@ -370,7 +370,7 @@ void GradientTool::draw_gradient(GUI::Painter& painter, bool with_guidelines, co
auto gradient_rect_width = determine_required_side_length(t_gradient_center.x(), width);
auto gradient_max_side_length = AK::max(gradient_rect_height, gradient_rect_width);
auto gradient_rect = Gfx::IntRect::centered_at(t_gradient_center, { gradient_max_side_length, gradient_max_side_length });
- float overall_gradient_length_in_rect = Gfx::calculate_gradient_length(gradient_rect.size(), rotation_degrees - 90);
+ float overall_gradient_length_in_rect = Gfx::calculate_gradient_length(gradient_rect.size().to_type<float>(), rotation_degrees - 90);
if (m_gradient_half_length == 0 || overall_gradient_length_in_rect == 0 || isnan(overall_gradient_length_in_rect))
return;
diff --git a/Userland/Libraries/LibWeb/CSS/ComputedValues.h b/Userland/Libraries/LibWeb/CSS/ComputedValues.h
index 17284b72a5..aaf3ea9172 100644
--- a/Userland/Libraries/LibWeb/CSS/ComputedValues.h
+++ b/Userland/Libraries/LibWeb/CSS/ComputedValues.h
@@ -135,7 +135,7 @@ struct BorderData {
public:
Color color { Color::Transparent };
CSS::LineStyle line_style { CSS::LineStyle::None };
- float width { 0 };
+ double width { 0 };
};
using TransformValue = Variant<CSS::AngleOrCalculated, CSS::LengthPercentage, float>;
diff --git a/Userland/Libraries/LibWeb/CSS/EdgeRect.cpp b/Userland/Libraries/LibWeb/CSS/EdgeRect.cpp
index df862baca9..ed1eae18e3 100644
--- a/Userland/Libraries/LibWeb/CSS/EdgeRect.cpp
+++ b/Userland/Libraries/LibWeb/CSS/EdgeRect.cpp
@@ -12,7 +12,7 @@
namespace Web::CSS {
// https://www.w3.org/TR/CSS2/visufx.html#value-def-shape
-Gfx::FloatRect EdgeRect::resolved(Layout::Node const& layout_node, Gfx::FloatRect border_box) const
+Gfx::FloatRect EdgeRect::resolved(Layout::Node const& layout_node, Gfx::Rect<double> border_box) const
{
// In CSS 2.1, the only valid <shape> value is: rect(<top>, <right>, <bottom>, <left>) where
// <top> and <bottom> specify offsets from the top border edge of the box, and <right>, and
diff --git a/Userland/Libraries/LibWeb/CSS/EdgeRect.h b/Userland/Libraries/LibWeb/CSS/EdgeRect.h
index 97196dcd43..6978ee765b 100644
--- a/Userland/Libraries/LibWeb/CSS/EdgeRect.h
+++ b/Userland/Libraries/LibWeb/CSS/EdgeRect.h
@@ -19,7 +19,7 @@ struct EdgeRect {
Length right_edge;
Length bottom_edge;
Length left_edge;
- Gfx::FloatRect resolved(Layout::Node const&, Gfx::FloatRect) const;
+ Gfx::FloatRect resolved(Layout::Node const&, Gfx::Rect<double>) const;
bool operator==(EdgeRect const&) const = default;
};
diff --git a/Userland/Libraries/LibWeb/CSS/GridTrackSize.cpp b/Userland/Libraries/LibWeb/CSS/GridTrackSize.cpp
index 0f8293077e..7e7356c16b 100644
--- a/Userland/Libraries/LibWeb/CSS/GridTrackSize.cpp
+++ b/Userland/Libraries/LibWeb/CSS/GridTrackSize.cpp
@@ -14,7 +14,7 @@ GridSize::GridSize(LengthPercentage length_percentage)
: m_type(Type::LengthPercentage)
, m_length_percentage(length_percentage) {};
-GridSize::GridSize(float flex_factor)
+GridSize::GridSize(double flex_factor)
: m_type(Type::FlexibleLength)
, m_length_percentage { Length::make_px(0) }
, m_flex_factor(flex_factor)
diff --git a/Userland/Libraries/LibWeb/CSS/GridTrackSize.h b/Userland/Libraries/LibWeb/CSS/GridTrackSize.h
index 7aed327bfa..19af23c36b 100644
--- a/Userland/Libraries/LibWeb/CSS/GridTrackSize.h
+++ b/Userland/Libraries/LibWeb/CSS/GridTrackSize.h
@@ -21,7 +21,7 @@ public:
};
GridSize(LengthPercentage);
- GridSize(float);
+ GridSize(double);
GridSize(Type);
GridSize();
~GridSize();
@@ -37,7 +37,7 @@ public:
bool is_min_content() const { return m_type == Type::MinContent; }
LengthPercentage length_percentage() const { return m_length_percentage; };
- float flex_factor() const { return m_flex_factor; }
+ double flex_factor() const { return m_flex_factor; }
// https://www.w3.org/TR/css-grid-2/#layout-algorithm
// An intrinsic sizing function (min-content, max-content, auto, fit-content()).
@@ -65,7 +65,7 @@ public:
private:
Type m_type;
LengthPercentage m_length_percentage;
- float m_flex_factor { 0 };
+ double m_flex_factor { 0 };
};
class GridMinMax {
diff --git a/Userland/Libraries/LibWeb/CSS/Length.cpp b/Userland/Libraries/LibWeb/CSS/Length.cpp
index 509ad1ec0e..632bc29a36 100644
--- a/Userland/Libraries/LibWeb/CSS/Length.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Length.cpp
@@ -35,7 +35,7 @@ Length::Length(int value, Type type)
, m_value(value)
{
}
-Length::Length(float value, Type type)
+Length::Length(double value, Type type)
: m_type(type)
, m_value(value)
{
@@ -59,7 +59,7 @@ Length Length::percentage_of(Percentage const& percentage) const
return *this;
}
- return Length { percentage.as_fraction() * raw_value(), m_type };
+ return Length { static_cast<double>(percentage.as_fraction()) * raw_value(), m_type };
}
CSSPixels Length::font_relative_length_to_px(Length::FontMetrics const& font_metrics, Length::FontMetrics const& root_font_metrics) const
diff --git a/Userland/Libraries/LibWeb/CSS/Length.h b/Userland/Libraries/LibWeb/CSS/Length.h
index 9673b41519..6c7aa1622a 100644
--- a/Userland/Libraries/LibWeb/CSS/Length.h
+++ b/Userland/Libraries/LibWeb/CSS/Length.h
@@ -83,7 +83,7 @@ public:
static Optional<Type> unit_from_name(StringView);
Length(int value, Type type);
- Length(float value, Type type);
+ Length(double value, Type type);
~Length();
static Length make_auto();
@@ -154,7 +154,7 @@ public:
}
Type type() const { return m_type; }
- float raw_value() const { return m_value; }
+ double raw_value() const { return m_value; }
CSSPixels to_px(Layout::Node const&) const;
@@ -171,8 +171,8 @@ public:
ALWAYS_INLINE CSSPixels absolute_length_to_px() const
{
- constexpr float inch_pixels = 96.0f;
- constexpr float centimeter_pixels = (inch_pixels / 2.54f);
+ constexpr double inch_pixels = 96.0;
+ constexpr double centimeter_pixels = (inch_pixels / 2.54);
switch (m_type) {
case Type::Cm:
return m_value * centimeter_pixels; // 1cm = 96px/2.54
@@ -181,13 +181,13 @@ public:
case Type::Px:
return m_value; // 1px = 1/96th of 1in
case Type::Pt:
- return m_value * ((1.0f / 72.0f) * inch_pixels); // 1pt = 1/72th of 1in
+ return m_value * ((1.0 / 72.0) * inch_pixels); // 1pt = 1/72th of 1in
case Type::Pc:
- return m_value * ((1.0f / 6.0f) * inch_pixels); // 1pc = 1/6th of 1in
+ return m_value * ((1.0 / 6.0) * inch_pixels); // 1pc = 1/6th of 1in
case Type::Mm:
- return m_value * ((1.0f / 10.0f) * centimeter_pixels); // 1mm = 1/10th of 1cm
+ return m_value * ((1.0 / 10.0) * centimeter_pixels); // 1mm = 1/10th of 1cm
case Type::Q:
- return m_value * ((1.0f / 40.0f) * centimeter_pixels); // 1Q = 1/40th of 1cm
+ return m_value * ((1.0 / 40.0) * centimeter_pixels); // 1Q = 1/40th of 1cm
default:
VERIFY_NOT_REACHED();
}
@@ -211,7 +211,7 @@ private:
char const* unit_name() const;
Type m_type;
- float m_value { 0 };
+ double m_value { 0 };
};
}
diff --git a/Userland/Libraries/LibWeb/CSS/Position.cpp b/Userland/Libraries/LibWeb/CSS/Position.cpp
index 6f455c29a1..8e8c7d32db 100644
--- a/Userland/Libraries/LibWeb/CSS/Position.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Position.cpp
@@ -18,11 +18,11 @@ CSSPixelPoint PositionValue::resolved(Layout::Node const& node, CSSPixelRect con
return rect.width() * [&] {
switch (preset) {
case HorizontalPreset::Left:
- return 0.0f;
+ return 0.;
case HorizontalPreset::Center:
- return 0.5f;
+ return 0.5;
case HorizontalPreset::Right:
- return 1.0f;
+ return 1.;
default:
VERIFY_NOT_REACHED();
}
@@ -36,11 +36,11 @@ CSSPixelPoint PositionValue::resolved(Layout::Node const& node, CSSPixelRect con
return rect.height() * [&] {
switch (preset) {
case VerticalPreset::Top:
- return 0.0f;
+ return 0.;
case VerticalPreset::Center:
- return 0.5f;
+ return 0.5;
case VerticalPreset::Bottom:
- return 1.0f;
+ return 1.;
default:
VERIFY_NOT_REACHED();
}
diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp
index 514595124f..3e3ef586ff 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp
+++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp
@@ -1264,7 +1264,7 @@ void StyleComputer::compute_font(StyleProperties& style, DOM::Element const* ele
Optional<Length> maybe_length;
if (font_size->is_percentage()) {
// Percentages refer to parent element's font size
- maybe_length = Length::make_px(font_size->as_percentage().percentage().as_fraction() * parent_font_size());
+ maybe_length = Length::make_px(static_cast<double>(font_size->as_percentage().percentage().as_fraction()) * parent_font_size());
} else if (font_size->is_length()) {
maybe_length = font_size->to_length();
@@ -1438,7 +1438,7 @@ ErrorOr<void> StyleComputer::absolutize_values(StyleProperties& style, DOM::Elem
auto& line_height_value_slot = style.m_property_values[to_underlying(CSS::PropertyID::LineHeight)];
if (line_height_value_slot && line_height_value_slot->is_percentage()) {
line_height_value_slot = TRY(LengthStyleValue::create(
- Length::make_px(font_size * line_height_value_slot->as_percentage().percentage().as_fraction())));
+ Length::make_px(font_size * static_cast<double>(line_height_value_slot->as_percentage().percentage().as_fraction()))));
}
auto line_height = style.line_height(viewport_rect(), font_metrics, m_root_element_font_metrics);
diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp
index e59c9deb99..2ce0745d64 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp
+++ b/Userland/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp
@@ -536,7 +536,7 @@ void CalculatedStyleValue::CalculationResult::multiply_by(CalculationResult cons
},
[&](Length const& length) {
VERIFY(layout_node);
- m_value = Length::make_px(length.to_px(*layout_node) * other.m_value.get<Number>().value());
+ m_value = Length::make_px(length.to_px(*layout_node) * static_cast<double>(other.m_value.get<Number>().value()));
},
[&](Time const& time) {
m_value = Time::make_seconds(time.to_seconds() * other.m_value.get<Number>().value());
@@ -569,7 +569,7 @@ void CalculatedStyleValue::CalculationResult::divide_by(CalculationResult const&
},
[&](Length const& length) {
VERIFY(layout_node);
- m_value = Length::make_px(length.to_px(*layout_node) / denominator);
+ m_value = Length::make_px(length.to_px(*layout_node) / static_cast<double>(denominator));
},
[&](Time const& time) {
m_value = Time::make_seconds(time.to_seconds() / denominator);
diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/FilterValueListStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/FilterValueListStyleValue.cpp
index 8df68e1456..e4e00a0234 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleValues/FilterValueListStyleValue.cpp
+++ b/Userland/Libraries/LibWeb/CSS/StyleValues/FilterValueListStyleValue.cpp
@@ -30,7 +30,7 @@ Filter::DropShadow::Resolved Filter::DropShadow::resolved(Layout::Node const& no
return Resolved {
offset_x.to_px(node).value(),
offset_y.to_px(node).value(),
- radius.has_value() ? radius->to_px(node).value() : 0.0f,
+ radius.has_value() ? radius->to_px(node).value() : 0.0,
color.has_value() ? *color : node.computed_values().color()
};
}
diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/FilterValueListStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/FilterValueListStyleValue.h
index 5c4257d4ee..601d774f28 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleValues/FilterValueListStyleValue.h
+++ b/Userland/Libraries/LibWeb/CSS/StyleValues/FilterValueListStyleValue.h
@@ -30,9 +30,9 @@ struct DropShadow {
Optional<Length> radius {};
Optional<Color> color {};
struct Resolved {
- float offset_x;
- float offset_y;
- float radius;
+ double offset_x;
+ double offset_y;
+ double radius;
Color color;
};
Resolved resolved(Layout::Node const&) const;
diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/RadialGradientStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/RadialGradientStyleValue.cpp
index e414f152d2..5c56d882db 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleValues/RadialGradientStyleValue.cpp
+++ b/Userland/Libraries/LibWeb/CSS/StyleValues/RadialGradientStyleValue.cpp
@@ -146,12 +146,12 @@ Gfx::FloatSize RadialGradientStyleValue::resolve_size(Layout::Node const& node,
},
[&](CircleSize const& circle_size) {
auto radius = circle_size.radius.to_px(node);
- return Gfx::FloatSize { radius, radius };
+ return Gfx::FloatSize { radius.value(), radius.value() };
},
[&](EllipseSize const& ellipse_size) {
auto radius_a = ellipse_size.radius_a.resolved(node, CSS::Length::make_px(size.width())).to_px(node);
auto radius_b = ellipse_size.radius_b.resolved(node, CSS::Length::make_px(size.height())).to_px(node);
- return Gfx::FloatSize { radius_a, radius_b };
+ return Gfx::FloatSize { radius_a.value(), radius_b.value() };
});
// Handle degenerate cases
@@ -187,8 +187,8 @@ Gfx::FloatSize RadialGradientStyleValue::resolve_size(Layout::Node const& node,
void RadialGradientStyleValue::resolve_for_size(Layout::Node const& node, CSSPixelSize paint_size) const
{
CSSPixelRect gradient_box { { 0, 0 }, paint_size };
- auto center = m_properties.position.resolved(node, gradient_box).to_type<float>();
- auto gradient_size = resolve_size(node, center, gradient_box.to_type<float>());
+ auto center = m_properties.position.resolved(node, gradient_box).to_type<double>().to_type<float>();
+ auto gradient_size = resolve_size(node, center, gradient_box.to_type<double>().to_type<float>());
if (m_resolved.has_value() && m_resolved->gradient_size == gradient_size)
return;
m_resolved = ResolvedData {
diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp
index 79964e8723..efc40f379a 100644
--- a/Userland/Libraries/LibWeb/DOM/Document.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Document.cpp
@@ -1811,7 +1811,7 @@ void Document::run_the_resize_steps()
if (!browsing_context())
return;
- auto viewport_size = browsing_context()->viewport_rect().size().to_type<float>().to_type<int>();
+ auto viewport_size = browsing_context()->viewport_rect().size().to_type<double>().to_type<float>().to_type<int>();
if (m_last_viewport_size == viewport_size)
return;
m_last_viewport_size = viewport_size;
diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp
index 56b0e7d315..009df4b1c4 100644
--- a/Userland/Libraries/LibWeb/DOM/Element.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Element.cpp
@@ -709,7 +709,7 @@ JS::NonnullGCPtr<Geometry::DOMRect> Element::get_bounding_client_rect() const
VERIFY(document().browsing_context());
auto viewport_offset = document().browsing_context()->viewport_scroll_offset();
- return Geometry::DOMRect::create(realm(), paintable_box->absolute_rect().translated(-viewport_offset.x(), -viewport_offset.y()).to_type<float>()).release_value_but_fixme_should_propagate_errors();
+ return Geometry::DOMRect::create(realm(), paintable_box->absolute_rect().translated(-viewport_offset.x(), -viewport_offset.y()).to_type<double>().to_type<float>()).release_value_but_fixme_should_propagate_errors();
}
// https://drafts.csswg.org/cssom-view/#dom-element-getclientrects
diff --git a/Userland/Libraries/LibWeb/HTML/SourceSet.cpp b/Userland/Libraries/LibWeb/HTML/SourceSet.cpp
index 5584224e4e..3d99cbe2cf 100644
--- a/Userland/Libraries/LibWeb/HTML/SourceSet.cpp
+++ b/Userland/Libraries/LibWeb/HTML/SourceSet.cpp
@@ -338,7 +338,7 @@ SourceSet SourceSet::create(DOM::Document const& document, String default_source
bool contains_image_source_with_width_descriptor = false;
for (auto& source : source_set.m_sources) {
if (source.descriptor.has<ImageSource::PixelDensityDescriptorValue>()) {
- if (source.descriptor.get<ImageSource::PixelDensityDescriptorValue>().value == 1.0f)
+ if (source.descriptor.get<ImageSource::PixelDensityDescriptorValue>().value == 1.0)
contains_image_source_with_pixel_density_descriptor_value_of_1 = true;
}
if (source.descriptor.has<ImageSource::WidthDescriptorValue>())
diff --git a/Userland/Libraries/LibWeb/HTML/SourceSet.h b/Userland/Libraries/LibWeb/HTML/SourceSet.h
index a88b33258c..663b451d9f 100644
--- a/Userland/Libraries/LibWeb/HTML/SourceSet.h
+++ b/Userland/Libraries/LibWeb/HTML/SourceSet.h
@@ -15,7 +15,7 @@ namespace Web::HTML {
// https://html.spec.whatwg.org/multipage/images.html#image-source
struct ImageSource {
struct PixelDensityDescriptorValue {
- float value { 0 };
+ double value { 0 };
};
struct WidthDescriptorValue {
@@ -28,7 +28,7 @@ struct ImageSource {
struct ImageSourceAndPixelDensity {
ImageSource source;
- float pixel_density { 1.0f };
+ double pixel_density { 1.0f };
};
// https://html.spec.whatwg.org/multipage/images.html#source-set
diff --git a/Userland/Libraries/LibWeb/HTML/Window.cpp b/Userland/Libraries/LibWeb/HTML/Window.cpp
index b6ddf11754..41fcfe60fa 100644
--- a/Userland/Libraries/LibWeb/HTML/Window.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Window.cpp
@@ -1077,7 +1077,7 @@ void Window::scroll(ScrollToOptions const& options)
// 1. If invoked with one argument, follow these substeps:
// 1. Let options be the argument.
- auto viewport_rect = top_level_browsing_context.viewport_rect().to_type<float>();
+ auto viewport_rect = top_level_browsing_context.viewport_rect().to_type<double>().to_type<float>();
// 2. Let x be the value of the left dictionary member of options, if present, or the viewport’s current scroll
// position on the x axis otherwise.
diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp
index 4f4c68462d..b0f80180c7 100644
--- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp
@@ -994,7 +994,7 @@ void BlockFormattingContext::layout_list_item_marker(ListItemBox const& list_ite
marker_state.set_content_height(max(image_height, marker.font().pixel_size_rounded_up() + 1).value());
marker_state.set_content_offset({ -(marker_state.content_width() + default_marker_width),
- max(CSSPixels(0.f), (CSSPixels(marker.line_height()) - marker_state.content_height()) / 2.f) });
+ max(CSSPixels(0), (CSSPixels(marker.line_height()) - marker_state.content_height()) / 2) });
if (marker_state.content_height() > list_item_state.content_height())
list_item_state.set_content_height(marker_state.content_height());
diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
index 9b01495910..98a27eecf8 100644
--- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
@@ -577,7 +577,7 @@ CSS::FlexBasisData FlexFormattingContext::used_flex_basis_for_item(FlexItem cons
return flex_basis;
}
-CSSPixels FlexFormattingContext::calculate_main_size_from_cross_size_and_aspect_ratio(CSSPixels cross_size, float aspect_ratio) const
+CSSPixels FlexFormattingContext::calculate_main_size_from_cross_size_and_aspect_ratio(CSSPixels cross_size, double aspect_ratio) const
{
if (is_row_layout())
return cross_size * aspect_ratio;
@@ -717,7 +717,7 @@ void FlexFormattingContext::determine_flex_base_size_and_hypothetical_main_size(
// The hypothetical main size is the item’s flex base size clamped according to its used min and max main sizes (and flooring the content box size at zero).
auto clamp_min = has_main_min_size(child_box) ? specified_main_min_size(child_box) : automatic_minimum_size(item);
auto clamp_max = has_main_max_size(child_box) ? specified_main_max_size(child_box) : NumericLimits<float>::max();
- item.hypothetical_main_size = max(CSSPixels(0.0f), css_clamp(item.flex_base_size, clamp_min, clamp_max));
+ item.hypothetical_main_size = max(CSSPixels(0), css_clamp(item.flex_base_size, clamp_min, clamp_max));
// NOTE: At this point, we set the hypothetical main size as the flex item's *temporary* main size.
// The size may change again when we resolve flexible lengths, but this is necessary in order for
@@ -1006,7 +1006,7 @@ void FlexFormattingContext::resolve_flexible_lengths_for_line(FlexLine& line)
for (auto& item : line.items) {
if (item.frozen)
continue;
- float ratio = item.flex_factor.value() / sum_of_flex_factor_of_unfrozen_items;
+ double ratio = item.flex_factor.value() / sum_of_flex_factor_of_unfrozen_items;
// Set the item’s target main size to its flex base size plus a fraction of the remaining free space proportional to the ratio.
item.target_main_size = item.flex_base_size + (line.remaining_free_space * ratio);
}
@@ -1024,7 +1024,7 @@ void FlexFormattingContext::resolve_flexible_lengths_for_line(FlexLine& line)
if (item.frozen)
continue;
// Find the ratio of the item’s scaled flex shrink factor to the sum of the scaled flex shrink factors of all unfrozen items on the line.
- float ratio = 1.0f;
+ double ratio = 1.0;
if (sum_of_scaled_flex_shrink_factors_of_all_unfrozen_items_on_line != 0)
ratio = item.scaled_flex_shrink_factor / sum_of_scaled_flex_shrink_factors_of_all_unfrozen_items_on_line;
@@ -1207,7 +1207,7 @@ void FlexFormattingContext::calculate_cross_size_of_each_flex_line()
}
// 3. The used cross-size of the flex line is the largest of the numbers found in the previous two steps and zero.
- flex_line.cross_size = max(CSSPixels(0.0f), largest_hypothetical_cross_size);
+ flex_line.cross_size = max(CSSPixels(0), largest_hypothetical_cross_size);
}
// If the flex container is single-line, then clamp the line’s cross-size to be within the container’s computed min and max cross sizes.
@@ -1276,7 +1276,7 @@ void FlexFormattingContext::distribute_any_remaining_free_space()
used_main_space += main_gap() * (flex_line.items.size() - 1);
if (flex_line.remaining_free_space > 0) {
- CSSPixels size_per_auto_margin = flex_line.remaining_free_space / (float)auto_margins;
+ CSSPixels size_per_auto_margin = flex_line.remaining_free_space / static_cast<double>(auto_margins);
for (auto& item : flex_line.items) {
if (item.margins.main_before_is_auto)
set_main_axis_first_margin(item, size_per_auto_margin);
@@ -1317,7 +1317,7 @@ void FlexFormattingContext::distribute_any_remaining_free_space()
}
break;
case CSS::JustifyContent::Center:
- initial_offset = (inner_main_size(flex_container()) - used_main_space) / 2.0f;
+ initial_offset = (inner_main_size(flex_container()) - used_main_space) / 2.0;
if (is_direction_reverse()) {
initial_offset = inner_main_size(flex_container()) - initial_offset;
}
@@ -1327,7 +1327,7 @@ void FlexFormattingContext::distribute_any_remaining_free_space()
break;
case CSS::JustifyContent::SpaceAround:
space_between_items = flex_line.remaining_free_space / number_of_items;
- initial_offset = space_between_items / 2.0f;
+ initial_offset = space_between_items / 2.0;
break;
}
}
@@ -1443,7 +1443,7 @@ void FlexFormattingContext::align_all_flex_items_along_the_cross_axis()
// FIXME: Take better care of margins
for (auto& flex_line : m_flex_lines) {
for (auto& item : flex_line.items) {
- CSSPixels half_line_size = flex_line.cross_size / 2.0f;
+ CSSPixels half_line_size = flex_line.cross_size / 2.0;
switch (alignment_for_item(item.box)) {
case CSS::AlignItems::Baseline:
// FIXME: Implement this
@@ -1456,7 +1456,7 @@ void FlexFormattingContext::align_all_flex_items_along_the_cross_axis()
item.cross_offset = half_line_size - item.cross_size.value() - item.margins.cross_after - item.borders.cross_after - item.padding.cross_after;
break;
case CSS::AlignItems::Center:
- item.cross_offset = -(item.cross_size.value() / 2.0f);
+ item.cross_offset = -(item.cross_size.value() / 2.0);
break;
default:
break;
@@ -1511,7 +1511,7 @@ void FlexFormattingContext::align_all_flex_lines()
if (is_single_line()) {
// For single-line flex containers, we only need to center the line along the cross axis.
auto& flex_line = m_flex_lines[0];
- CSSPixels center_of_line = cross_size_of_flex_container / 2.0f;
+ CSSPixels center_of_line = cross_size_of_flex_container / 2.0;
for (auto& item : flex_line.items) {
item.cross_offset += center_of_line;
}
@@ -1711,9 +1711,9 @@ CSSPixels FlexFormattingContext::calculate_intrinsic_main_size_of_flex_container
// and the chosen flex fraction, then clamp that result by the max main size floored by the min main size.
CSSPixels sum = 0;
for (auto& item : flex_line.items) {
- float product = 0;
+ double product = 0;
if (item.desired_flex_fraction > 0)
- product = flex_line.chosen_flex_fraction * item.box->computed_values().flex_grow();
+ product = flex_line.chosen_flex_fraction * static_cast<double>(item.box->computed_values().flex_grow());
else if (item.desired_flex_fraction < 0)
product = flex_line.chosen_flex_fraction * item.scaled_flex_shrink_factor;
auto result = item.flex_base_size + product;
@@ -2036,8 +2036,8 @@ void FlexFormattingContext::resolve_cross_axis_auto_margins()
if (outer_cross_size < line.cross_size) {
CSSPixels remainder = line.cross_size - outer_cross_size;
if (item.margins.cross_before_is_auto && item.margins.cross_after_is_auto) {
- item.margins.cross_before = remainder / 2.0f;
- item.margins.cross_after = remainder / 2.0f;
+ item.margins.cross_before = remainder / 2.0;
+ item.margins.cross_after = remainder / 2.0;
} else if (item.margins.cross_before_is_auto) {
item.margins.cross_before = remainder;
} else {
@@ -2110,13 +2110,13 @@ CSSPixelPoint FlexFormattingContext::calculate_static_position(Box const& box) c
cross_offset = half_line_size - inner_cross_size(box) - cross_margin_after - cross_border_after - cross_padding_after;
break;
case CSS::AlignItems::Center:
- cross_offset = -(inner_cross_size(box) / 2.0f);
+ cross_offset = -(inner_cross_size(box) / 2.0);
break;
default:
break;
}
- cross_offset += inner_cross_size(flex_container()) / 2.0f;
+ cross_offset += inner_cross_size(flex_container()) / 2.0;
// The main-axis edges of the static-position rectangle are where the margin edges of the child
// would be positioned if it were the sole flex item in the flex container,
@@ -2161,7 +2161,7 @@ CSSPixelPoint FlexFormattingContext::calculate_static_position(Box const& box) c
break;
case CSS::JustifyContent::Center:
case CSS::JustifyContent::SpaceAround:
- main_offset = inner_main_size(flex_container()) / 2.0f - inner_main_size(box) / 2.0f;
+ main_offset = inner_main_size(flex_container()) / 2.0 - inner_main_size(box) / 2.0;
break;
}
@@ -2185,9 +2185,9 @@ CSSPixelPoint FlexFormattingContext::calculate_static_position(Box const& box) c
return static_position_offset + diff;
}
-float FlexFormattingContext::FlexLine::sum_of_flex_factor_of_unfrozen_items() const
+double FlexFormattingContext::FlexLine::sum_of_flex_factor_of_unfrozen_items() const
{
- float sum = 0;
+ double sum = 0;
for (auto const& item : items) {
if (!item.frozen)
sum += item.flex_factor.value();
@@ -2195,9 +2195,9 @@ float FlexFormattingContext::FlexLine::sum_of_flex_factor_of_unfrozen_items() co
return sum;
}
-float FlexFormattingContext::FlexLine::sum_of_scaled_flex_shrink_factor_of_unfrozen_items() const
+double FlexFormattingContext::FlexLine::sum_of_scaled_flex_shrink_factor_of_unfrozen_items() const
{
- float sum = 0;
+ double sum = 0;
for (auto const& item : items) {
if (!item.frozen)
sum += item.scaled_flex_shrink_factor;
diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.h b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.h
index 7b78703495..6aed71c3cb 100644
--- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.h
+++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.h
@@ -35,7 +35,7 @@ private:
[[nodiscard]] bool should_treat_cross_size_as_auto(Box const&) const;
[[nodiscard]] CSSPixels adjust_main_size_through_aspect_ratio_for_cross_size_min_max_constraints(Box const&, CSSPixels main_size, CSS::Size const& min_cross_size, CSS::Size const& max_cross_size) const;
- [[nodiscard]] CSSPixels calculate_main_size_from_cross_size_and_aspect_ratio(CSSPixels cross_size, float aspect_ratio) const;
+ [[nodiscard]] CSSPixels calculate_main_size_from_cross_size_and_aspect_ratio(CSSPixels cross_size, double aspect_ratio) const;
void dump_items() const;
@@ -61,9 +61,9 @@ private:
CSSPixels hypothetical_cross_size_with_margins() { return hypothetical_cross_size + margins.cross_before + margins.cross_after + borders.cross_after + borders.cross_before + padding.cross_after + padding.cross_before; }
CSSPixels target_main_size { 0 };
bool frozen { false };
- Optional<float> flex_factor {};
- float scaled_flex_shrink_factor { 0 };
- float desired_flex_fraction { 0 };
+ Optional<double> flex_factor {};
+ double scaled_flex_shrink_factor { 0 };
+ double desired_flex_fraction { 0 };
CSSPixels outer_hypothetical_main_size() const
{
@@ -109,10 +109,10 @@ private:
Vector<FlexItem&> items;
CSSPixels cross_size { 0 };
CSSPixels remaining_free_space { 0 };
- float chosen_flex_fraction { 0 };
+ double chosen_flex_fraction { 0 };
- float sum_of_flex_factor_of_unfrozen_items() const;
- float sum_of_scaled_flex_shrink_factor_of_unfrozen_items() const;
+ double sum_of_flex_factor_of_unfrozen_items() const;
+ double sum_of_scaled_flex_shrink_factor_of_unfrozen_items() const;
};
CSSPixels main_gap() const;
diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp
index d896588404..5682585212 100644
--- a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp
@@ -391,7 +391,7 @@ CSSPixels FormattingContext::tentative_width_for_replaced_element(LayoutState co
// (used height) * (intrinsic ratio)
if ((computed_height.is_auto() && computed_width.is_auto() && !box.has_intrinsic_width() && box.has_intrinsic_height() && box.has_intrinsic_aspect_ratio())
|| (computed_width.is_auto() && !computed_height.is_auto() && box.has_intrinsic_aspect_ratio())) {
- return compute_height_for_replaced_element(state, box, available_space) * box.intrinsic_aspect_ratio().value();
+ return compute_height_for_replaced_element(state, box, available_space) * static_cast<double>(box.intrinsic_aspect_ratio().value());
}
// If 'height' and 'width' both have computed values of 'auto' and the element has an intrinsic ratio but no intrinsic height or width,
@@ -486,7 +486,7 @@ CSSPixels FormattingContext::tentative_height_for_replaced_element(LayoutState c
//
// (used width) / (intrinsic ratio)
if (computed_height.is_auto() && box.has_intrinsic_aspect_ratio())
- return state.get(box).content_width() / box.intrinsic_aspect_ratio().value();
+ return state.get(box).content_width() / static_cast<double>(box.intrinsic_aspect_ratio().value());
// Otherwise, if 'height' has a computed value of 'auto', and the element has an intrinsic height, then that intrinsic height is the used value of 'height'.
if (computed_height.is_auto() && box.has_intrinsic_height())
@@ -1280,7 +1280,7 @@ CSSPixels FormattingContext::calculate_min_content_height(Layout::Box const& box
CSSPixels FormattingContext::calculate_max_content_height(Layout::Box const& box, AvailableSize const& available_width) const
{
if (box.has_intrinsic_aspect_ratio() && available_width.is_definite())
- return available_width.to_px() / *box.intrinsic_aspect_ratio();
+ return available_width.to_px() / static_cast<double>(*box.intrinsic_aspect_ratio());
if (box.has_intrinsic_height())
return *box.intrinsic_height();
diff --git a/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp
index 03f5c1738e..0b108ea3d4 100644
--- a/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp
@@ -751,7 +751,7 @@ void GridFormattingContext::resolve_intrinsic_track_sizes(AvailableSpace const&
// 5. If any track still has an infinite growth limit (because, for example, it had no items placed in
// it or it is a flexible track), set its growth limit to its base size.
for (auto& track : tracks_and_gaps) {
- if (track.growth_limit == INFINITY) {
+ if (!isfinite(track.growth_limit.value())) {
track.growth_limit = track.base_size;
}
}
@@ -774,7 +774,7 @@ void GridFormattingContext::distribute_extra_space_across_spanned_tracks_base_si
// 2. Distribute space up to limits:
// FIXME: If a fixed-point type were used to represent CSS pixels, it would be possible to compare with 0
// instead of epsilon.
- while (extra_space > NumericLimits<float>().epsilon()) {
+ while (extra_space > NumericLimits<double>().epsilon()) {
auto all_frozen = all_of(spanned_tracks, [](auto const& track) { return track.base_size_frozen; });
if (all_frozen)
break;
@@ -816,7 +816,7 @@ void GridFormattingContext::distribute_extra_space_across_spanned_tracks_growth_
// 1. Find the space to distribute:
CSSPixels spanned_tracks_sizes_sum = 0;
for (auto& track : spanned_tracks) {
- if (track.growth_limit != INFINITY) {
+ if (isfinite(track.growth_limit.value())) {
spanned_tracks_sizes_sum += track.growth_limit;
} else {
spanned_tracks_sizes_sum += track.base_size;
@@ -830,7 +830,7 @@ void GridFormattingContext::distribute_extra_space_across_spanned_tracks_growth_
// 2. Distribute space up to limits:
// FIXME: If a fixed-point type were used to represent CSS pixels, it would be possible to compare with 0
// instead of epsilon.
- while (extra_space > NumericLimits<float>().epsilon()) {
+ while (extra_space > NumericLimits<double>().epsilon()) {
auto all_frozen = all_of(spanned_tracks, [](auto const& track) { return track.growth_limit_frozen; });
if (all_frozen)
break;
@@ -957,7 +957,7 @@ void GridFormattingContext::increase_sizes_to_accommodate_spanning_items_crossin
}
distribute_extra_space_across_spanned_tracks_growth_limit(item_min_content_contribution, intrinsic_maximum_tracks);
for (auto& track : spanned_tracks) {
- if (track.growth_limit == INFINITY) {
+ if (!isfinite(track.growth_limit.value())) {
// If the affected size is an infinite growth limit, set it to the track’s base size plus the planned increase.
track.growth_limit = track.base_size + track.planned_increase;
// Mark any tracks whose growth limit changed from infinite to finite in this step as infinitely growable
@@ -982,7 +982,7 @@ void GridFormattingContext::increase_sizes_to_accommodate_spanning_items_crossin
auto item_max_content_contribution = calculate_max_content_contribution(item, dimension);
distribute_extra_space_across_spanned_tracks_growth_limit(item_max_content_contribution, max_content_maximum_tracks);
for (auto& track : spanned_tracks) {
- if (track.growth_limit == INFINITY) {
+ if (!isfinite(track.growth_limit.value())) {
// If the affected size is an infinite growth limit, set it to the track’s base size plus the planned increase.
track.growth_limit = track.base_size + track.planned_increase;
} else {
@@ -1058,7 +1058,7 @@ void GridFormattingContext::maximize_tracks(AvailableSpace const& available_spac
while (free_space_px > 0) {
auto free_space_to_distribute_per_track = free_space_px / tracks.size();
for (auto& track : tracks) {
- VERIFY(track.growth_limit != INFINITY);
+ VERIFY(isfinite(track.growth_limit.value()));
track.base_size = min(track.growth_limit, track.base_size + free_space_to_distribute_per_track);
}
if (get_free_space_px() == free_space_px)
diff --git a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp
index 71b2e482c4..ed016399c5 100644
--- a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp
@@ -18,7 +18,7 @@
namespace Web::Layout {
-constexpr float text_justification_threshold = 0.1;
+constexpr double text_justification_threshold = 0.1;
InlineFormattingContext::InlineFormattingContext(LayoutState& state, BlockContainer const& containing_block, BlockFormattingContext& parent)
: FormattingContext(Type::Inline, state, containing_block, &parent)
@@ -209,7 +209,7 @@ void InlineFormattingContext::apply_justification_to_fragments(CSS::TextJustify
}
}
- CSSPixels justified_space_width = whitespace_count > 0 ? (excess_horizontal_space_including_whitespace / static_cast<float>(whitespace_count)) : 0;
+ CSSPixels justified_space_width = whitespace_count > 0 ? (excess_horizontal_space_including_whitespace / static_cast<double>(whitespace_count)) : 0;
// This is the amount that each fragment will be offset by. If a whitespace
// fragment is shorter than the justified space width, it increases to push
diff --git a/Userland/Libraries/LibWeb/Layout/LayoutState.cpp b/Userland/Libraries/LibWeb/Layout/LayoutState.cpp
index 17b29575f2..e39b294959 100644
--- a/Userland/Libraries/LibWeb/Layout/LayoutState.cpp
+++ b/Userland/Libraries/LibWeb/Layout/LayoutState.cpp
@@ -320,7 +320,7 @@ void LayoutState::UsedValues::set_node(NodeWithStyleAndBoxModelMetrics& node, Us
if (size.is_percentage()) {
if (containing_block_has_definite_size) {
auto containing_block_size = width ? containing_block_used_values->content_width() : containing_block_used_values->content_height();
- resolved_definite_size = adjust_for_box_sizing(containing_block_size * size.percentage().as_fraction(), size, width);
+ resolved_definite_size = adjust_for_box_sizing(containing_block_size * static_cast<double>(size.percentage().as_fraction()), size, width);
return true;
}
return false;
diff --git a/Userland/Libraries/LibWeb/Layout/LineBuilder.cpp b/Userland/Libraries/LibWeb/Layout/LineBuilder.cpp
index fd61fef8eb..6cfd4b3c5d 100644
--- a/Userland/Libraries/LibWeb/Layout/LineBuilder.cpp
+++ b/Userland/Libraries/LibWeb/Layout/LineBuilder.cpp
@@ -223,7 +223,7 @@ void LineBuilder::update_last_line()
if (length_percentage->is_length())
fragment_baseline += length_percentage->length().to_px(fragment.layout_node());
else if (length_percentage->is_percentage())
- fragment_baseline += length_percentage->percentage().as_fraction() * line_height;
+ fragment_baseline += static_cast<double>(length_percentage->percentage().as_fraction()) * line_height;
}
line_box_baseline = max(line_box_baseline, fragment_baseline);
@@ -277,7 +277,7 @@ void LineBuilder::update_last_line()
auto vertical_align_amount = length_percentage->length().to_px(fragment.layout_node());
new_fragment_y = y_value_for_alignment(CSS::VerticalAlign::Baseline) - vertical_align_amount;
} else if (length_percentage->is_percentage()) {
- auto vertical_align_amount = length_percentage->percentage().as_fraction() * m_context.containing_block().line_height();
+ auto vertical_align_amount = static_cast<double>(length_percentage->percentage().as_fraction()) * m_context.containing_block().line_height();
new_fragment_y = y_value_for_alignment(CSS::VerticalAlign::Baseline) - vertical_align_amount;
}
}
@@ -305,7 +305,7 @@ void LineBuilder::update_last_line()
if (length_percentage->is_length())
bottom_of_inline_box += length_percentage->length().to_px(fragment.layout_node());
else if (length_percentage->is_percentage())
- bottom_of_inline_box += length_percentage->percentage().as_fraction() * m_context.containing_block().line_height();
+ bottom_of_inline_box += static_cast<double>(length_percentage->percentage().as_fraction()) * m_context.containing_block().line_height();
}
}
diff --git a/Userland/Libraries/LibWeb/Layout/Node.cpp b/Userland/Libraries/LibWeb/Layout/Node.cpp
index fc9c79f412..60d4c00485 100644
--- a/Userland/Libraries/LibWeb/Layout/Node.cpp
+++ b/Userland/Libraries/LibWeb/Layout/Node.cpp
@@ -609,7 +609,7 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& computed_style)
if (border.line_style == CSS::LineStyle::None || border.line_style == CSS::LineStyle::Hidden) {
border.width = 0;
} else {
- auto resolve_border_width = [&]() {
+ auto resolve_border_width = [&]() -> double {
auto value = computed_style.property(width_property);
if (value->is_calculated())
return value->as_calculated().resolve_length(*this)->to_px(*this).value();
@@ -619,11 +619,11 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& computed_style)
// https://www.w3.org/TR/css-backgrounds-3/#valdef-line-width-thin
switch (value->to_identifier()) {
case CSS::ValueID::Thin:
- return 1.0f;
+ return 1.0;
case CSS::ValueID::Medium:
- return 3.0f;
+ return 3.0;
case CSS::ValueID::Thick:
- return 5.0f;
+ return 5.0;
default:
VERIFY_NOT_REACHED();
}
diff --git a/Userland/Libraries/LibWeb/Layout/SVGFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/SVGFormattingContext.cpp
index 80470811ba..bd28eaa644 100644
--- a/Userland/Libraries/LibWeb/Layout/SVGFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/SVGFormattingContext.cpp
@@ -35,7 +35,7 @@ CSSPixels SVGFormattingContext::automatic_content_height() const
struct ViewBoxTransform {
CSSPixelPoint offset;
- float scale_factor;
+ double scale_factor;
};
// https://svgwg.org/svg2-draft/coords.html#PreserveAspectRatioAttribute
@@ -156,7 +156,7 @@ void SVGFormattingContext::run(Box const& box, LayoutMode layout_mode, Available
auto& path = dom_node.get_path();
auto path_transform = dom_node.get_transform();
- float viewbox_scale = 1;
+ double viewbox_scale = 1;
auto& maybe_view_box = svg_svg_element.view_box();
if (maybe_view_box.has_value()) {
// FIXME: This should allow just one of width or height to be specified.
@@ -172,13 +172,13 @@ void SVGFormattingContext::run(Box const& box, LayoutMode layout_mode, Available
// The initial value for preserveAspectRatio is xMidYMid meet.
auto preserve_aspect_ratio = svg_svg_element.preserve_aspect_ratio().value_or(SVG::PreserveAspectRatio {});
auto viewbox_transform = scale_and_align_viewbox_content(preserve_aspect_ratio, view_box, { scale_width, scale_height }, svg_box_state);
- path_transform = Gfx::AffineTransform {}.translate(viewbox_transform.offset.to_type<float>()).scale(viewbox_transform.scale_factor, viewbox_transform.scale_factor).translate({ -view_box.min_x, -view_box.min_y }).multiply(path_transform);
+ path_transform = Gfx::AffineTransform {}.translate(viewbox_transform.offset.to_type<double>().to_type<float>()).scale(viewbox_transform.scale_factor, viewbox_transform.scale_factor).translate({ -view_box.min_x, -view_box.min_y }).multiply(path_transform);
viewbox_scale = viewbox_transform.scale_factor;
}
// Stroke increases the path's size by stroke_width/2 per side.
auto path_bounding_box = path_transform.map(path.bounding_box()).to_type<CSSPixels>();
- CSSPixels stroke_width = geometry_box.dom_node().visible_stroke_width() * viewbox_scale;
+ CSSPixels stroke_width = static_cast<double>(geometry_box.dom_node().visible_stroke_width()) * viewbox_scale;
path_bounding_box.inflate(stroke_width, stroke_width);
geometry_box_state.set_content_offset(path_bounding_box.top_left());
geometry_box_state.set_content_width(path_bounding_box.width());
diff --git a/Userland/Libraries/LibWeb/Layout/SVGGeometryBox.cpp b/Userland/Libraries/LibWeb/Layout/SVGGeometryBox.cpp
index 33fdd4339b..b1497c05e6 100644
--- a/Userland/Libraries/LibWeb/Layout/SVGGeometryBox.cpp
+++ b/Userland/Libraries/LibWeb/Layout/SVGGeometryBox.cpp
@@ -30,8 +30,8 @@ Optional<Gfx::AffineTransform> SVGGeometryBox::layout_transform() const
auto& geometry_element = dom_node();
auto transform = geometry_element.get_transform();
auto* svg_box = geometry_element.first_ancestor_of_type<SVG::SVGSVGElement>();
- float scaling = 1;
- auto origin = viewbox_origin().to_type<float>();
+ double scaling = 1;
+ auto origin = viewbox_origin().to_type<double>().to_type<float>();
Gfx::FloatPoint paint_offset = {};
if (svg_box && svg_box->view_box().has_value()) {
// Note: SVGFormattingContext has already done the scaling based on the viewbox,
@@ -45,9 +45,9 @@ Optional<Gfx::AffineTransform> SVGGeometryBox::layout_transform() const
return {};
auto scaled_width = paintable_box()->content_width().value();
auto scaled_height = paintable_box()->content_height().value();
- scaling = min(scaled_width / original_bounding_box.width(), scaled_height / original_bounding_box.height());
+ scaling = min(scaled_width / static_cast<double>(original_bounding_box.width()), scaled_height / static_cast<double>(original_bounding_box.height()));
auto scaled_bounding_box = original_bounding_box.scaled(scaling, scaling);
- paint_offset = (paintable_box()->absolute_rect().location() - svg_box->paintable_box()->absolute_rect().location()).to_type<float>() - scaled_bounding_box.location();
+ paint_offset = (paintable_box()->absolute_rect().location() - svg_box->paintable_box()->absolute_rect().location()).to_type<double>().to_type<float>() - scaled_bounding_box.location();
}
return Gfx::AffineTransform {}.translate(paint_offset).scale(scaling, scaling).translate(-origin).multiply(transform);
}
diff --git a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h
index 0b85bb34ea..5b4d726c45 100644
--- a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h
+++ b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h
@@ -56,7 +56,7 @@ private:
CSSPixels min_width { 0 };
CSSPixels max_width { 0 };
CSSPixels used_width { 0 };
- float percentage_width { 0 };
+ double percentage_width { 0 };
};
struct Row {
diff --git a/Userland/Libraries/LibWeb/Page/Page.cpp b/Userland/Libraries/LibWeb/Page/Page.cpp
index e1e5f3e915..9b1a332f10 100644
--- a/Userland/Libraries/LibWeb/Page/Page.cpp
+++ b/Userland/Libraries/LibWeb/Page/Page.cpp
@@ -105,12 +105,11 @@ CSSPixelRect Page::device_to_css_rect(DevicePixelRect rect) const
DevicePixelRect Page::enclosing_device_rect(CSSPixelRect rect) const
{
auto scale = client().device_pixels_per_css_pixel();
- return {
- floorf(rect.x().value() * scale),
- floorf(rect.y().value() * scale),
- ceilf(rect.width().value() * scale),
- ceilf(rect.height().value() * scale)
- };
+ return DevicePixelRect(
+ floor(rect.x().value() * scale),
+ floor(rect.y().value() * scale),
+ ceil(rect.width().value() * scale),
+ ceil(rect.height().value() * scale));
}
DevicePixelRect Page::rounded_device_rect(CSSPixelRect rect) const
diff --git a/Userland/Libraries/LibWeb/Page/Page.h b/Userland/Libraries/LibWeb/Page/Page.h
index 0b1ef936d9..3bc9c474ba 100644
--- a/Userland/Libraries/LibWeb/Page/Page.h
+++ b/Userland/Libraries/LibWeb/Page/Page.h
@@ -166,7 +166,7 @@ public:
virtual bool is_connection_open() const = 0;
virtual Gfx::Palette palette() const = 0;
virtual DevicePixelRect screen_rect() const = 0;
- virtual float device_pixels_per_css_pixel() const = 0;
+ virtual double device_pixels_per_css_pixel() const = 0;
virtual CSS::PreferredColorScheme preferred_color_scheme() const = 0;
virtual void paint(DevicePixelRect const&, Gfx::Bitmap&) = 0;
virtual void page_did_change_title(DeprecatedString const&) { }
diff --git a/Userland/Libraries/LibWeb/Painting/BackgroundPainting.cpp b/Userland/Libraries/LibWeb/Painting/BackgroundPainting.cpp
index 0661debd4b..a78e4b76a4 100644
--- a/Userland/Libraries/LibWeb/Painting/BackgroundPainting.cpp
+++ b/Userland/Libraries/LibWeb/Painting/BackgroundPainting.cpp
@@ -148,16 +148,16 @@ void paint_background(PaintContext& context, Layout::NodeWithStyleAndBoxModelMet
CSSPixelRect image_rect;
switch (layer.size_type) {
case CSS::BackgroundSize::Contain: {
- float max_width_ratio = (background_positioning_area.width() / natural_image_width).value();
- float max_height_ratio = (background_positioning_area.height() / natural_image_height).value();
- float ratio = min(max_width_ratio, max_height_ratio);
+ double max_width_ratio = (background_positioning_area.width() / natural_image_width).value();
+ double max_height_ratio = (background_positioning_area.height() / natural_image_height).value();
+ double ratio = min(max_width_ratio, max_height_ratio);
image_rect.set_size(natural_image_width * ratio, natural_image_height * ratio);
break;
}
case CSS::BackgroundSize::Cover: {
- float max_width_ratio = (background_positioning_area.width() / natural_image_width).value();
- float max_height_ratio = (background_positioning_area.height() / natural_image_height).value();
- float ratio = max(max_width_ratio, max_height_ratio);
+ double max_width_ratio = (background_positioning_area.width() / natural_image_width).value();
+ double max_height_ratio = (background_positioning_area.height() / natural_image_height).value();
+ double ratio = max(max_width_ratio, max_height_ratio);
image_rect.set_size(natural_image_width * ratio, natural_image_height * ratio);
break;
}
@@ -253,7 +253,7 @@ void paint_background(PaintContext& context, Layout::NodeWithStyleAndBoxModelMet
repeat_x = false;
} else {
auto space = fmod(background_positioning_area.width(), image_rect.width());
- x_step = image_rect.width() + (space / (float)(whole_images - 1));
+ x_step = image_rect.width() + (space / static_cast<double>(whole_images - 1));
repeat_x = true;
}
break;
@@ -284,7 +284,7 @@ void paint_background(PaintContext& context, Layout::NodeWithStyleAndBoxModelMet
repeat_y = false;
} else {
auto space = fmod(background_positioning_area.height(), image_rect.height());
- y_step = image_rect.height() + ((float)space / (float)(whole_images - 1));
+ y_step = image_rect.height() + (static_cast<double>(space) / static_cast<double>(whole_images - 1));
repeat_y = true;
}
break;
diff --git a/Userland/Libraries/LibWeb/Painting/BorderPainting.cpp b/Userland/Libraries/LibWeb/Painting/BorderPainting.cpp
index 80f6bda200..9f92331a0f 100644
--- a/Userland/Libraries/LibWeb/Painting/BorderPainting.cpp
+++ b/Userland/Libraries/LibWeb/Painting/BorderPainting.cpp
@@ -33,14 +33,14 @@ BorderRadiiData normalized_border_radii_data(Layout::Node const& node, CSSPixelR
// Scale overlapping curves according to https://www.w3.org/TR/css-backgrounds-3/#corner-overlap
CSSPixels f = 1.0f;
- auto width_reciprocal = 1.0f / rect.width().value();
- auto height_reciprocal = 1.0f / rect.height().value();
+ auto width_reciprocal = 1.0 / rect.width().value();
+ auto height_reciprocal = 1.0 / rect.height().value();
f = max(f, width_reciprocal * (top_left_radius_px.horizontal_radius + top_right_radius_px.horizontal_radius));
f = max(f, height_reciprocal * (top_right_radius_px.vertical_radius + bottom_right_radius_px.vertical_radius));
f = max(f, width_reciprocal * (bottom_left_radius_px.horizontal_radius + bottom_right_radius_px.horizontal_radius));
f = max(f, height_reciprocal * (top_left_radius_px.vertical_radius + bottom_left_radius_px.vertical_radius));
- f = 1.0f / f.value();
+ f = 1.0 / f.value();
top_left_radius_px.horizontal_radius *= f;
top_left_radius_px.vertical_radius *= f;
@@ -149,8 +149,8 @@ void paint_border(PaintContext& context, BorderEdge edge, DevicePixelRect const&
auto draw_border = [&](auto const& border, auto const& radius, auto const& opposite_border, auto const& opposite_radius, auto p1_step_translate, auto p2_step_translate) {
auto [p1, p2] = points_for_edge(edge, rect);
- auto p1_step = radius ? 0 : border.width / static_cast<float>(device_pixel_width.value());
- auto p2_step = opposite_radius ? 0 : opposite_border.width / static_cast<float>(device_pixel_width.value());
+ auto p1_step = radius ? 0 : border.width / device_pixel_width.value();
+ auto p2_step = opposite_radius ? 0 : opposite_border.width / device_pixel_width.value();
for (DevicePixels i = 0; i < device_pixel_width; ++i) {
draw_horizontal_or_vertical_line(p1, p2);
p1_step_translate(p1, p1_step);
diff --git a/Userland/Libraries/LibWeb/Painting/GradientPainting.cpp b/Userland/Libraries/LibWeb/Painting/GradientPainting.cpp
index 3d0543478d..78cb3db804 100644
--- a/Userland/Libraries/LibWeb/Painting/GradientPainting.cpp
+++ b/Userland/Libraries/LibWeb/Painting/GradientPainting.cpp
@@ -111,11 +111,11 @@ static ColorStopData resolve_color_stop_positions(auto const& color_stop_list, a
LinearGradientData resolve_linear_gradient_data(Layout::Node const& node, CSSPixelSize gradient_size, CSS::LinearGradientStyleValue const& linear_gradient)
{
auto gradient_angle = linear_gradient.angle_degrees(gradient_size);
- auto gradient_length_px = Gfx::calculate_gradient_length(gradient_size, gradient_angle);
+ auto gradient_length_px = Gfx::calculate_gradient_length(gradient_size.to_type<double>().to_type<float>(), gradient_angle);
auto resolved_color_stops = resolve_color_stop_positions(
linear_gradient.color_stop_list(), [&](auto const& length_percentage) {
- return length_percentage.to_px(node, gradient_length_px).value() / gradient_length_px;
+ return length_percentage.to_px(node, gradient_length_px).value() / static_cast<double>(gradient_length_px);
},
linear_gradient.is_repeating());
diff --git a/Userland/Libraries/LibWeb/Painting/MarkerPaintable.cpp b/Userland/Libraries/LibWeb/Painting/MarkerPaintable.cpp
index 5e347f3454..4263a3b44e 100644
--- a/Userland/Libraries/LibWeb/Painting/MarkerPaintable.cpp
+++ b/Userland/Libraries/LibWeb/Painting/MarkerPaintable.cpp
@@ -32,10 +32,10 @@ void MarkerPaintable::paint(PaintContext& context, PaintPhase phase) const
return;
// FIXME: All this does is round to the nearest whole CSS pixel, but it's goofy.
- CSSPixelRect enclosing = absolute_rect().to_type<float>().to_rounded<float>().to_type<CSSPixels>();
+ CSSPixelRect enclosing = absolute_rect().to_type<double>().to_type<float>().to_rounded<float>().to_type<CSSPixels>();
auto device_enclosing = context.enclosing_device_rect(enclosing);
- CSSPixels marker_width = enclosing.height() / 2.0f;
+ CSSPixels marker_width = enclosing.height() / 2.0;
if (auto const* list_style_image = layout_box().list_style_image()) {
CSSPixelRect image_rect {
diff --git a/Userland/Libraries/LibWeb/Painting/PaintContext.cpp b/Userland/Libraries/LibWeb/Painting/PaintContext.cpp
index 86c40fe89a..f767a2e03f 100644
--- a/Userland/Libraries/LibWeb/Painting/PaintContext.cpp
+++ b/Userland/Libraries/LibWeb/Painting/PaintContext.cpp
@@ -10,7 +10,7 @@
namespace Web {
-PaintContext::PaintContext(Gfx::Painter& painter, Palette const& palette, float device_pixels_per_css_pixel)
+PaintContext::PaintContext(Gfx::Painter& painter, Palette const& palette, double device_pixels_per_css_pixel)
: m_painter(painter)
, m_palette(palette)
, m_device_pixels_per_css_pixel(device_pixels_per_css_pixel)
diff --git a/Userland/Libraries/LibWeb/Painting/PaintContext.h b/Userland/Libraries/LibWeb/Painting/PaintContext.h
index d8fd425147..0f590eefa6 100644
--- a/Userland/Libraries/LibWeb/Painting/PaintContext.h
+++ b/Userland/Libraries/LibWeb/Painting/PaintContext.h
@@ -18,7 +18,7 @@ namespace Web {
class PaintContext {
public:
- PaintContext(Gfx::Painter& painter, Palette const& palette, float device_pixels_per_css_pixel);
+ PaintContext(Gfx::Painter& painter, Palette const& palette, double device_pixels_per_css_pixel);
Gfx::Painter& painter() const { return m_painter; }
Palette const& palette() const { return m_palette; }
@@ -64,13 +64,13 @@ public:
return clone;
}
- float device_pixels_per_css_pixel() const { return m_device_pixels_per_css_pixel; }
+ double device_pixels_per_css_pixel() const { return m_device_pixels_per_css_pixel; }
private:
Gfx::Painter& m_painter;
Palette m_palette;
Optional<SVGContext> m_svg_context;
- float m_device_pixels_per_css_pixel;
+ double m_device_pixels_per_css_pixel { 0 };
DevicePixelRect m_device_viewport_rect;
bool m_should_show_line_box_borders { false };
bool m_focus { false };
diff --git a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp
index e243c8475f..e358622e3a 100644
--- a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp
+++ b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp
@@ -155,7 +155,7 @@ void PaintableBox::paint(PaintContext& context, PaintPhase phase) const
if (should_clip_rect) {
context.painter().save();
auto border_box = absolute_border_box_rect();
- context.painter().add_clip_rect(context.rounded_device_rect(clip_rect.to_rect().resolved(Paintable::layout_node(), border_box.to_type<float>()).to_type<CSSPixels>()).to_type<int>());
+ context.painter().add_clip_rect(context.rounded_device_rect(clip_rect.to_rect().resolved(Paintable::layout_node(), border_box.to_type<double>()).to_type<CSSPixels>()).to_type<int>());
}
paint_backdrop_filter(context);
paint_background(context);
@@ -434,7 +434,7 @@ static void paint_text_decoration(PaintContext& context, Gfx::Painter& painter,
CSSPixels css_line_thickness = [&] {
CSS::Length computed_thickness = text_node.computed_values().text_decoration_thickness().resolved(text_node, CSS::Length(1, CSS::Length::Type::Em));
if (computed_thickness.is_auto())
- return max(glyph_height * 0.1f, 1.f);
+ return max(glyph_height * 0.1, 1.);
return computed_thickness.to_px(text_node);
}();
diff --git a/Userland/Libraries/LibWeb/Painting/SVGGeometryPaintable.cpp b/Userland/Libraries/LibWeb/Painting/SVGGeometryPaintable.cpp
index 09ac1270a5..7fc3076b39 100644
--- a/Userland/Libraries/LibWeb/Painting/SVGGeometryPaintable.cpp
+++ b/Userland/Libraries/LibWeb/Painting/SVGGeometryPaintable.cpp
@@ -36,7 +36,7 @@ Optional<HitTestResult> SVGGeometryPaintable::hit_test(CSSPixelPoint position, H
if (auto transform = layout_box().layout_transform(); transform.has_value()) {
auto transformed_bounding_box = transform->map_to_quad(
const_cast<SVG::SVGGeometryElement&>(geometry_element).get_path().bounding_box());
- if (!transformed_bounding_box.contains(position.to_type<float>()))
+ if (!transformed_bounding_box.contains(position.to_type<double>().to_type<float>()))
return {};
}
return result;
@@ -92,7 +92,7 @@ void SVGGeometryPaintable::paint(PaintContext& context, PaintPhase phase) const
auto svg_viewport = [&] {
if (maybe_view_box.has_value())
return Gfx::FloatRect { maybe_view_box->min_x, maybe_view_box->min_y, maybe_view_box->width, maybe_view_box->height };
- return Gfx::FloatRect { { 0, 0 }, svg_context.svg_element_size().to_type<float>() };
+ return Gfx::FloatRect { { 0, 0 }, svg_context.svg_element_size().to_type<double>().to_type<float>() };
}();
SVG::SVGPaintContext paint_context {
diff --git a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp
index 8a98a76afa..4c83296c34 100644
--- a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp
+++ b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp
@@ -232,7 +232,7 @@ Gfx::FloatMatrix4x4 StackingContext::get_transformation_matrix(CSS::Transformati
auto count = transformation.values.size();
auto value = [this, transformation](size_t index, Optional<CSS::Length const&> reference_length = {}) -> float {
return transformation.values[index].visit(
- [this, reference_length](CSS::LengthPercentage const& value) {
+ [this, reference_length](CSS::LengthPercentage const& value) -> float {
if (reference_length.has_value()) {
return value.resolved(m_box, reference_length.value()).to_px(m_box).value();
}
@@ -430,7 +430,7 @@ Gfx::FloatPoint StackingContext::compute_transform_origin() const
auto reference_box = paintable_box().absolute_border_box_rect();
auto x = reference_box.left() + style_value.x.to_px(m_box, reference_box.width());
auto y = reference_box.top() + style_value.y.to_px(m_box, reference_box.height());
- return { x, y };
+ return { static_cast<float>(x.value()), static_cast<float>(y.value()) };
}
template<typename U, typename Callback>
diff --git a/Userland/Libraries/LibWeb/Painting/VideoPaintable.cpp b/Userland/Libraries/LibWeb/Painting/VideoPaintable.cpp
index 96a5d36232..078db4eaca 100644
--- a/Userland/Libraries/LibWeb/Painting/VideoPaintable.cpp
+++ b/Userland/Libraries/LibWeb/Painting/VideoPaintable.cpp
@@ -378,7 +378,7 @@ VideoPaintable::DispatchEventOfSameName VideoPaintable::handle_mouseup(Badge<Eve
if (cached_layout_boxes.timeline_rect.has_value() && cached_layout_boxes.timeline_rect->contains(position)) {
auto x_offset = position.x() - cached_layout_boxes.timeline_rect->x();
- auto x_percentage = static_cast<float>(x_offset) / static_cast<float>(cached_layout_boxes.timeline_rect->width());
+ auto x_percentage = static_cast<double>(x_offset) / static_cast<double>(cached_layout_boxes.timeline_rect->width());
auto position = static_cast<double>(x_percentage) * video_element.duration();
video_element.set_current_time(position);
diff --git a/Userland/Libraries/LibWeb/PixelUnits.h b/Userland/Libraries/LibWeb/PixelUnits.h
index f2fed528d2..71d72f2cbc 100644
--- a/Userland/Libraries/LibWeb/PixelUnits.h
+++ b/Userland/Libraries/LibWeb/PixelUnits.h
@@ -48,7 +48,7 @@ constexpr DevicePixels operator%(DevicePixels left, T right) { return left.value
/// CSSPixels: A position or length in CSS "reference pixels", independent of zoom or screen DPI.
/// See https://www.w3.org/TR/css-values-3/#reference-pixel
-AK_TYPEDEF_DISTINCT_NUMERIC_GENERAL(float, CSSPixels, Arithmetic, CastToUnderlying, Comparison, Increment);
+AK_TYPEDEF_DISTINCT_NUMERIC_GENERAL(double, CSSPixels, Arithmetic, CastToUnderlying, Comparison, Increment);
template<Arithmetic T>
constexpr bool operator==(CSSPixels left, T right) { return left.value() == right; }
diff --git a/Userland/Libraries/LibWeb/SVG/SVGDecodedImageData.cpp b/Userland/Libraries/LibWeb/SVG/SVGDecodedImageData.cpp
index 9c0c3fa9da..61ae4d0dc0 100644
--- a/Userland/Libraries/LibWeb/SVG/SVGDecodedImageData.cpp
+++ b/Userland/Libraries/LibWeb/SVG/SVGDecodedImageData.cpp
@@ -34,7 +34,7 @@ public:
virtual bool is_connection_open() const override { return false; }
virtual Gfx::Palette palette() const override { return m_host_page.client().palette(); }
virtual DevicePixelRect screen_rect() const override { return {}; }
- virtual float device_pixels_per_css_pixel() const override { return m_host_page.client().device_pixels_per_css_pixel(); }
+ virtual double device_pixels_per_css_pixel() const override { return m_host_page.client().device_pixels_per_css_pixel(); }
virtual CSS::PreferredColorScheme preferred_color_scheme() const override { return m_host_page.client().preferred_color_scheme(); }
virtual void request_file(FileRequest) override { }
virtual void paint(DevicePixelRect const&, Gfx::Bitmap&) override { }
diff --git a/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp
index 86214f95ad..3b9ca3419d 100644
--- a/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp
+++ b/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp
@@ -185,7 +185,7 @@ Optional<float> SVGGraphicsElement::stroke_width() const
viewport_height = svg_svg_layout_node->computed_values().height().to_px(*svg_svg_layout_node, 0);
}
}
- auto scaled_viewport_size = (viewport_width + viewport_height) * 0.5f;
+ auto scaled_viewport_size = (viewport_width + viewport_height) * 0.5;
return width->to_px(*layout_node(), scaled_viewport_size).value();
}
return {};
diff --git a/Userland/Libraries/LibWeb/SVG/ViewBox.h b/Userland/Libraries/LibWeb/SVG/ViewBox.h
index 8c1be55ec8..e46b85175b 100644
--- a/Userland/Libraries/LibWeb/SVG/ViewBox.h
+++ b/Userland/Libraries/LibWeb/SVG/ViewBox.h
@@ -12,10 +12,10 @@
namespace Web::SVG {
struct ViewBox {
- float min_x { 0 };
- float min_y { 0 };
- float width { 0 };
- float height { 0 };
+ double min_x { 0 };
+ double min_y { 0 };
+ double width { 0 };
+ double height { 0 };
};
Optional<ViewBox> try_parse_view_box(StringView);
diff --git a/Userland/Services/WebContent/PageHost.h b/Userland/Services/WebContent/PageHost.h
index 9f8b068057..615dde4aa4 100644
--- a/Userland/Services/WebContent/PageHost.h
+++ b/Userland/Services/WebContent/PageHost.h
@@ -60,7 +60,7 @@ private:
virtual bool is_connection_open() const override;
virtual Gfx::Palette palette() const override;
virtual Web::DevicePixelRect screen_rect() const override { return m_screen_rect; }
- virtual float device_pixels_per_css_pixel() const override { return m_device_pixels_per_css_pixel; }
+ virtual double device_pixels_per_css_pixel() const override { return m_device_pixels_per_css_pixel; }
virtual Web::CSS::PreferredColorScheme preferred_color_scheme() const override { return m_preferred_color_scheme; }
virtual void page_did_invalidate(Web::CSSPixelRect const&) override;
virtual void page_did_change_selection() override;