From e5dcfe3905e8ac5b12bbcdb371927ec9b46fcdc6 Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Wed, 26 Jul 2023 14:50:12 +0200 Subject: [PATCH] LibWeb: Verify that value is not saturated in set_content_width/height Checking if CSSPixels contains a finite value is no longer makes sense after converting to fixed-point arithmetics. Instead there should assertion that used value is not saturated. --- Userland/Libraries/LibWeb/Layout/LayoutState.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWeb/Layout/LayoutState.cpp b/Userland/Libraries/LibWeb/Layout/LayoutState.cpp index c02b01d084..e863f9fb8e 100644 --- a/Userland/Libraries/LibWeb/Layout/LayoutState.cpp +++ b/Userland/Libraries/LibWeb/Layout/LayoutState.cpp @@ -334,7 +334,7 @@ void LayoutState::UsedValues::set_node(NodeWithStyleAndBoxModelMetrics& node, Us void LayoutState::UsedValues::set_content_width(CSSPixels width) { - VERIFY(isfinite(width.to_double())); + VERIFY(!width.might_be_saturated()); if (width < 0) { // Negative widths are not allowed in CSS. We have a bug somewhere! Clamp to 0 to avoid doing too much damage. dbgln_if(LIBWEB_CSS_DEBUG, "FIXME: Layout calculated a negative width for {}: {}", m_node->debug_description(), width); @@ -346,7 +346,7 @@ void LayoutState::UsedValues::set_content_width(CSSPixels width) void LayoutState::UsedValues::set_content_height(CSSPixels height) { - VERIFY(isfinite(height.to_double())); + VERIFY(!height.might_be_saturated()); if (height < 0) { // Negative heights are not allowed in CSS. We have a bug somewhere! Clamp to 0 to avoid doing too much damage. dbgln_if(LIBWEB_CSS_DEBUG, "FIXME: Layout calculated a negative height for {}: {}", m_node->debug_description(), height);