diff --git a/Userland/Libraries/LibWeb/Layout/AvailableSpace.cpp b/Userland/Libraries/LibWeb/Layout/AvailableSpace.cpp index 189ac7e3a0..ee5fbfb0b0 100644 --- a/Userland/Libraries/LibWeb/Layout/AvailableSpace.cpp +++ b/Userland/Libraries/LibWeb/Layout/AvailableSpace.cpp @@ -11,7 +11,7 @@ namespace Web::Layout { AvailableSize AvailableSize::make_definite(CSSPixels value) { - VERIFY(isfinite(value.to_double())); + VERIFY(!value.might_be_saturated()); return AvailableSize { Type::Definite, value }; } diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp index 3d5381223e..baf050ef4a 100644 --- a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp @@ -1307,7 +1307,7 @@ CSSPixels FormattingContext::calculate_min_content_width(Layout::Box const& box) cache.min_content_width = context->automatic_content_width(); - if (!isfinite(cache.min_content_width->to_double())) { + if (cache.min_content_width->might_be_saturated()) { // HACK: If layout calculates a non-finite result, something went wrong. Force it to zero and log a little whine. dbgln("FIXME: Calculated non-finite min-content width for {}", box.debug_description()); cache.min_content_width = 0; @@ -1345,7 +1345,7 @@ CSSPixels FormattingContext::calculate_max_content_width(Layout::Box const& box) cache.max_content_width = context->automatic_content_width(); - if (!isfinite(cache.max_content_width->to_double())) { + if (cache.max_content_width->might_be_saturated()) { // HACK: If layout calculates a non-finite result, something went wrong. Force it to zero and log a little whine. dbgln("FIXME: Calculated non-finite max-content width for {}", box.debug_description()); cache.max_content_width = 0; @@ -1388,7 +1388,7 @@ CSSPixels FormattingContext::calculate_min_content_height(Layout::Box const& box context->run(box, LayoutMode::IntrinsicSizing, AvailableSpace(AvailableSize::make_definite(width), AvailableSize::make_min_content())); auto min_content_height = context->automatic_content_height(); - if (!isfinite(min_content_height.to_double())) { + if (min_content_height.might_be_saturated()) { // HACK: If layout calculates a non-finite result, something went wrong. Force it to zero and log a little whine. dbgln("FIXME: Calculated non-finite min-content height for {}", box.debug_description()); min_content_height = 0; @@ -1433,7 +1433,7 @@ CSSPixels FormattingContext::calculate_max_content_height(Layout::Box const& box auto max_content_height = context->automatic_content_height(); - if (!isfinite(max_content_height.to_double())) { + if (max_content_height.might_be_saturated()) { // HACK: If layout calculates a non-finite result, something went wrong. Force it to zero and log a little whine. dbgln("FIXME: Calculated non-finite max-content height for {}", box.debug_description()); max_content_height = 0;