diff --git a/Tests/LibWeb/Layout/expected/acid1.txt b/Tests/LibWeb/Layout/expected/acid1.txt index 388e4b9e93..c48aaded78 100644 --- a/Tests/LibWeb/Layout/expected/acid1.txt +++ b/Tests/LibWeb/Layout/expected/acid1.txt @@ -7,7 +7,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline TextNode <#text> BlockContainer
at (25,25) content-size 470x0 children: inline TextNode <#text> - BlockContainer
at (40,40) content-size 49.998596x280 floating [BFC] children: inline + BlockContainer
at (40,40) content-size 49.998597x280 floating [BFC] children: inline line 0 width: 28.310546, height: 10, bottom: 10, baseline: 7.998046 frag 0 from TextNode start: 0, length: 6, rect: [40,40 28.310546x10] "toggle" diff --git a/Tests/LibWeb/Layout/expected/flex-item-vertical-padding-relative-to-flex-container-width.txt b/Tests/LibWeb/Layout/expected/flex-item-vertical-padding-relative-to-flex-container-width.txt index 4de70c599c..0384aacb72 100644 --- a/Tests/LibWeb/Layout/expected/flex-item-vertical-padding-relative-to-flex-container-width.txt +++ b/Tests/LibWeb/Layout/expected/flex-item-vertical-padding-relative-to-flex-container-width.txt @@ -6,9 +6,9 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline Box at (11,11) content-size 600x10 flex-container(row) [FFC] children: not-inline BlockContainer <(anonymous)> at (11,11) content-size 0x0 [BFC] children: inline TextNode <#text> - BlockContainer at (12,71.999996) content-size 27.15625x18.000010 flex-item [BFC] children: inline + BlockContainer at (12,72) content-size 27.15625x18 flex-item [BFC] children: inline line 0 width: 27.15625, height: 17.46875, bottom: 17.46875, baseline: 13.53125 - frag 0 from TextNode start: 0, length: 3, rect: [12,71.999996 27.15625x17.46875] + frag 0 from TextNode start: 0, length: 3, rect: [12,72 27.15625x17.46875] "foo" TextNode <#text> BlockContainer <(anonymous)> at (11,11) content-size 0x0 [BFC] children: inline diff --git a/Tests/LibWeb/Layout/expected/flex-shrink-2.txt b/Tests/LibWeb/Layout/expected/flex-shrink-2.txt index 7e63a8c110..553e0a620d 100644 --- a/Tests/LibWeb/Layout/expected/flex-shrink-2.txt +++ b/Tests/LibWeb/Layout/expected/flex-shrink-2.txt @@ -4,23 +4,23 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline Box at (9,9) content-size 500x102 flex-container(row) [FFC] children: not-inline BlockContainer <(anonymous)> at (9,9) content-size 0x0 [BFC] children: inline TextNode <#text> - BlockContainer at (10,10) content-size 47.000011x100 flex-item [BFC] children: inline + BlockContainer at (10,10) content-size 47x100 flex-item [BFC] children: inline line 0 width: 6.34375, height: 17.46875, bottom: 17.46875, baseline: 13.53125 frag 0 from TextNode start: 0, length: 1, rect: [10,10 6.34375x17.46875] "1" TextNode <#text> BlockContainer <(anonymous)> at (9,9) content-size 0x0 [BFC] children: inline TextNode <#text> - BlockContainer at (59.000011,10) content-size 164.666666x100 flex-item [BFC] children: inline + BlockContainer at (59,10) content-size 164.666666x100 flex-item [BFC] children: inline line 0 width: 8.8125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 - frag 0 from TextNode start: 0, length: 1, rect: [59.000011,10 8.8125x17.46875] + frag 0 from TextNode start: 0, length: 1, rect: [59,10 8.8125x17.46875] "2" TextNode <#text> BlockContainer <(anonymous)> at (9,9) content-size 0x0 [BFC] children: inline TextNode <#text> - BlockContainer at (225.666678,10) content-size 282.333321x100 flex-item [BFC] children: inline + BlockContainer at (225.666666,10) content-size 282.333333x100 flex-item [BFC] children: inline line 0 width: 9.09375, height: 17.46875, bottom: 17.46875, baseline: 13.53125 - frag 0 from TextNode start: 0, length: 1, rect: [225.666678,10 9.09375x17.46875] + frag 0 from TextNode start: 0, length: 1, rect: [225.666666,10 9.09375x17.46875] "3" TextNode <#text> BlockContainer <(anonymous)> at (9,9) content-size 0x0 [BFC] children: inline diff --git a/Tests/LibWeb/Layout/expected/grid/borders.txt b/Tests/LibWeb/Layout/expected/grid/borders.txt index 9ca6009f9e..b98afbdc67 100644 --- a/Tests/LibWeb/Layout/expected/grid/borders.txt +++ b/Tests/LibWeb/Layout/expected/grid/borders.txt @@ -103,14 +103,14 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline Box at (8,275.34375) content-size 784x90.9375 [GFC] children: not-inline BlockContainer <(anonymous)> at (8,275.34375) content-size 0x0 [BFC] children: inline TextNode <#text> - BlockContainer at (444.199997,285.34375) content-size 337.800002x17.46875 [BFC] children: inline + BlockContainer at (444.2,285.34375) content-size 337.8x17.46875 [BFC] children: inline line 0 width: 6.34375, height: 17.46875, bottom: 17.46875, baseline: 13.53125 - frag 0 from TextNode start: 0, length: 1, rect: [444.199997,285.34375 6.34375x17.46875] + frag 0 from TextNode start: 0, length: 1, rect: [444.2,285.34375 6.34375x17.46875] "1" TextNode <#text> BlockContainer <(anonymous)> at (8,275.34375) content-size 0x0 [BFC] children: inline TextNode <#text> - BlockContainer at (18,338.8125) content-size 337.800002x17.46875 [BFC] children: inline + BlockContainer at (18,338.8125) content-size 337.8x17.46875 [BFC] children: inline line 0 width: 8.8125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 frag 0 from TextNode start: 0, length: 1, rect: [18,338.8125 8.8125x17.46875] "2" diff --git a/Tests/LibWeb/Layout/expected/grid/grid-gap-2.txt b/Tests/LibWeb/Layout/expected/grid/grid-gap-2.txt index a9b860ffab..be15123436 100644 --- a/Tests/LibWeb/Layout/expected/grid/grid-gap-2.txt +++ b/Tests/LibWeb/Layout/expected/grid/grid-gap-2.txt @@ -2,12 +2,12 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline BlockContainer at (0,0) content-size 800x600 [BFC] children: not-inline BlockContainer at (8,8) content-size 784x50.9375 children: not-inline Box at (8,8) content-size 784x50.9375 [GFC] children: not-inline - BlockContainer at (434.199997,8) content-size 357.800002x17.46875 [BFC] children: inline + BlockContainer at (434.2,8) content-size 357.8x17.46875 [BFC] children: inline line 0 width: 6.34375, height: 17.46875, bottom: 17.46875, baseline: 13.53125 - frag 0 from TextNode start: 0, length: 1, rect: [434.199997,8 6.34375x17.46875] + frag 0 from TextNode start: 0, length: 1, rect: [434.2,8 6.34375x17.46875] "1" TextNode <#text> - BlockContainer at (8,41.46875) content-size 357.800002x17.46875 [BFC] children: inline + BlockContainer at (8,41.46875) content-size 357.8x17.46875 [BFC] children: inline line 0 width: 8.8125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 frag 0 from TextNode start: 0, length: 1, rect: [8,41.46875 8.8125x17.46875] "2" diff --git a/Tests/LibWeb/Layout/expected/grid/grid-item-percentage-width.txt b/Tests/LibWeb/Layout/expected/grid/grid-item-percentage-width.txt index 324ad4e1f3..f4752fc2b9 100644 --- a/Tests/LibWeb/Layout/expected/grid/grid-item-percentage-width.txt +++ b/Tests/LibWeb/Layout/expected/grid/grid-item-percentage-width.txt @@ -2,12 +2,12 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline BlockContainer at (0,0) content-size 800x600 [BFC] children: not-inline BlockContainer at (8,8) content-size 784x17.46875 children: not-inline Box at (8,8) content-size 784x17.46875 [GFC] children: not-inline - BlockContainer at (8,8) content-size 313.599981x17.46875 [BFC] children: inline + BlockContainer at (8,8) content-size 313.6x17.46875 [BFC] children: inline line 0 width: 42.140625, height: 17.46875, bottom: 17.46875, baseline: 13.53125 frag 0 from TextNode start: 0, length: 5, rect: [8,8 42.140625x17.46875] "First" TextNode <#text> - BlockContainer at (400,8) content-size 78.399995x17.46875 [BFC] children: inline + BlockContainer at (400,8) content-size 78.4x17.46875 [BFC] children: inline line 0 width: 57.40625, height: 17.46875, bottom: 17.46875, baseline: 13.53125 frag 0 from TextNode start: 0, length: 6, rect: [400,8 57.40625x17.46875] "Second" diff --git a/Tests/LibWeb/Layout/expected/vertical-padding-relative-to-cb-width.txt b/Tests/LibWeb/Layout/expected/vertical-padding-relative-to-cb-width.txt index bf19431d44..32c4bdfef4 100644 --- a/Tests/LibWeb/Layout/expected/vertical-padding-relative-to-cb-width.txt +++ b/Tests/LibWeb/Layout/expected/vertical-padding-relative-to-cb-width.txt @@ -6,9 +6,9 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline BlockContainer at (11,11) content-size 600x10 children: not-inline BlockContainer <(anonymous)> at (11,11) content-size 600x0 children: inline TextNode <#text> - BlockContainer at (12,71.999996) content-size 598x18.000010 children: inline + BlockContainer at (12,72) content-size 598x18 children: inline line 0 width: 27.15625, height: 17.46875, bottom: 17.46875, baseline: 13.53125 - frag 0 from TextNode start: 0, length: 3, rect: [12,71.999996 27.15625x17.46875] + frag 0 from TextNode start: 0, length: 3, rect: [12,72 27.15625x17.46875] "foo" TextNode <#text> BlockContainer <(anonymous)> at (11,211) content-size 600x17.46875 children: inline diff --git a/Userland/Libraries/LibWeb/CSS/Angle.cpp b/Userland/Libraries/LibWeb/CSS/Angle.cpp index 2b0ae58622..37acc9ad65 100644 --- a/Userland/Libraries/LibWeb/CSS/Angle.cpp +++ b/Userland/Libraries/LibWeb/CSS/Angle.cpp @@ -16,13 +16,13 @@ Angle::Angle(int value, Type type) { } -Angle::Angle(float value, Type type) +Angle::Angle(double value, Type type) : m_type(type) , m_value(value) { } -Angle Angle::make_degrees(float value) +Angle Angle::make_degrees(double value) { return { value, Type::Deg }; } @@ -37,17 +37,17 @@ ErrorOr Angle::to_string() const return String::formatted("{}deg", to_degrees()); } -float Angle::to_degrees() const +double Angle::to_degrees() const { switch (m_type) { case Type::Deg: return m_value; case Type::Grad: - return m_value * (360.0f / 400.0f); + return m_value * (360.0 / 400.0); case Type::Rad: - return m_value * (180.0f / AK::Pi); + return m_value * (180.0 / AK::Pi); case Type::Turn: - return m_value * 360.0f; + return m_value * 360.0; } VERIFY_NOT_REACHED(); } diff --git a/Userland/Libraries/LibWeb/CSS/Angle.h b/Userland/Libraries/LibWeb/CSS/Angle.h index b7f7e1c3fa..f65cc602ef 100644 --- a/Userland/Libraries/LibWeb/CSS/Angle.h +++ b/Userland/Libraries/LibWeb/CSS/Angle.h @@ -23,15 +23,15 @@ public: static Optional unit_from_name(StringView); Angle(int value, Type type); - Angle(float value, Type type); - static Angle make_degrees(float); + Angle(double value, Type type); + static Angle make_degrees(double); Angle percentage_of(Percentage const&) const; ErrorOr to_string() const; - float to_degrees() const; + double to_degrees() const; Type type() const { return m_type; } - float raw_value() const { return m_value; } + double raw_value() const { return m_value; } bool operator==(Angle const& other) const { @@ -42,7 +42,7 @@ private: StringView unit_name() const; Type m_type; - float m_value { 0 }; + double m_value { 0 }; }; } diff --git a/Userland/Libraries/LibWeb/CSS/ComputedValues.h b/Userland/Libraries/LibWeb/CSS/ComputedValues.h index 093f1d7566..2edc73ecbd 100644 --- a/Userland/Libraries/LibWeb/CSS/ComputedValues.h +++ b/Userland/Libraries/LibWeb/CSS/ComputedValues.h @@ -140,7 +140,7 @@ public: bool operator==(BorderData const&) const = default; }; -using TransformValue = Variant; +using TransformValue = Variant; struct Transformation { CSS::TransformFunction function; diff --git a/Userland/Libraries/LibWeb/CSS/Frequency.cpp b/Userland/Libraries/LibWeb/CSS/Frequency.cpp index 6a975b7ebe..9b4b0c569d 100644 --- a/Userland/Libraries/LibWeb/CSS/Frequency.cpp +++ b/Userland/Libraries/LibWeb/CSS/Frequency.cpp @@ -15,13 +15,13 @@ Frequency::Frequency(int value, Type type) { } -Frequency::Frequency(float value, Type type) +Frequency::Frequency(double value, Type type) : m_type(type) , m_value(value) { } -Frequency Frequency::make_hertz(float value) +Frequency Frequency::make_hertz(double value) { return { value, Type::Hz }; } @@ -36,7 +36,7 @@ ErrorOr Frequency::to_string() const return String::formatted("{}hz", to_hertz()); } -float Frequency::to_hertz() const +double Frequency::to_hertz() const { switch (m_type) { case Type::Hz: diff --git a/Userland/Libraries/LibWeb/CSS/Frequency.h b/Userland/Libraries/LibWeb/CSS/Frequency.h index b98b42df1f..7e8075cda1 100644 --- a/Userland/Libraries/LibWeb/CSS/Frequency.h +++ b/Userland/Libraries/LibWeb/CSS/Frequency.h @@ -20,15 +20,15 @@ public: static Optional unit_from_name(StringView); Frequency(int value, Type type); - Frequency(float value, Type type); - static Frequency make_hertz(float); + Frequency(double value, Type type); + static Frequency make_hertz(double); Frequency percentage_of(Percentage const&) const; ErrorOr to_string() const; - float to_hertz() const; + double to_hertz() const; Type type() const { return m_type; } - float raw_value() const { return m_value; } + double raw_value() const { return m_value; } bool operator==(Frequency const& other) const { @@ -39,7 +39,7 @@ private: StringView unit_name() const; Type m_type; - float m_value { 0 }; + double m_value { 0 }; }; } diff --git a/Userland/Libraries/LibWeb/CSS/Number.h b/Userland/Libraries/LibWeb/CSS/Number.h index a9d4b1303e..1a9a9f3ea3 100644 --- a/Userland/Libraries/LibWeb/CSS/Number.h +++ b/Userland/Libraries/LibWeb/CSS/Number.h @@ -25,21 +25,21 @@ public: , m_type(Type::Number) { } - Number(Type type, float value) + Number(Type type, double value) : m_value(value) , m_type(type) { } Type type() const { return m_type; } - float value() const { return m_value; } + double value() const { return m_value; } i64 integer_value() const { // https://www.w3.org/TR/css-values-4/#numeric-types // When a value cannot be explicitly supported due to range/precision limitations, it must be converted // to the closest value supported by the implementation, but how the implementation defines "closest" // is explicitly undefined as well. - return llroundf(m_value); + return llround(m_value); } bool is_integer() const { return m_type == Type::Integer || m_type == Type::IntegerWithExplicitSign; } bool is_integer_with_explicit_sign() const { return m_type == Type::IntegerWithExplicitSign; } @@ -83,7 +83,7 @@ public: } private: - float m_value { 0 }; + double m_value { 0 }; Type m_type; }; } diff --git a/Userland/Libraries/LibWeb/CSS/Percentage.h b/Userland/Libraries/LibWeb/CSS/Percentage.h index 6769ccf1ca..59566524af 100644 --- a/Userland/Libraries/LibWeb/CSS/Percentage.h +++ b/Userland/Libraries/LibWeb/CSS/Percentage.h @@ -23,13 +23,13 @@ public: { } - explicit Percentage(float value) + explicit Percentage(double value) : m_value(value) { } - float value() const { return m_value; } - float as_fraction() const { return m_value * 0.01f; } + double value() const { return m_value; } + double as_fraction() const { return m_value * 0.01; } ErrorOr to_string() const { @@ -39,7 +39,7 @@ public: bool operator==(Percentage const& other) const { return m_value == other.m_value; } private: - float m_value; + double m_value; }; } diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp index ad41952b17..0fc12fb9dd 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -1015,7 +1015,7 @@ StyleComputer::AnimationStepTransition StyleComputer::Animation::step(CSS::Time remaining_delay = CSS::Time { 0, CSS::Time::Type::Ms }; time_step_ms -= delay_ms; - float added_progress = static_cast(time_step_ms / duration.to_milliseconds()); + auto added_progress = time_step_ms / duration.to_milliseconds(); auto new_progress = progress.as_fraction() + added_progress; auto changed_iteration = false; if (new_progress >= 1) { @@ -1250,7 +1250,7 @@ ErrorOr StyleComputer::Animation::collect_into(StyleProperties& style_prop bool StyleComputer::Animation::is_done() const { - return progress.as_fraction() >= 0.9999f && iteration_count.has_value() && iteration_count.value() == 0; + return progress.as_fraction() >= 0.9999 && iteration_count.has_value() && iteration_count.value() == 0; } float StyleComputer::Animation::compute_output_progress(float input_progress) const diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp index 27c59da0dc..6cda1a98db 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp @@ -513,7 +513,7 @@ void CalculatedStyleValue::CalculationResult::add_or_subtract_internal(SumOperat void CalculatedStyleValue::CalculationResult::multiply_by(CalculationResult const& other, Layout::Node const* layout_node) { // We know from validation when resolving the type, that at least one side must be a or . - // Both of these are represented as a float. + // Both of these are represented as a double. VERIFY(m_value.has() || other.m_value.has()); bool other_is_number = other.m_value.has(); @@ -552,7 +552,7 @@ void CalculatedStyleValue::CalculationResult::divide_by(CalculationResult const& // Both of these are represented as a Number. auto denominator = other.m_value.get().value(); // FIXME: Dividing by 0 is invalid, and should be caught during parsing. - VERIFY(denominator != 0.0f); + VERIFY(denominator != 0.0); m_value.visit( [&](Number const& number) { @@ -745,7 +745,7 @@ Optional