From 08439602353db9a5dbaa4aa2a8ba26c3e1551bc7 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 25 Sep 2022 15:48:23 +0200 Subject: LibWeb: Use CSS::Size for computed size and max-size values This patch changes the *computed* representation of the following CSS properties to use CSS::Size: - width, min-width, max-width - height, min-height, max-height A few things had to change in order for things to keep working, but I tried to keep the diff to a minimum. The main trouble was that `min-width` and `max-width` can't actually be `auto`, but they *can* be `none`. We previously treated `auto` as a valid value (and it behaved mostly like `none`). --- Userland/Libraries/LibWeb/Layout/LayoutState.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Userland/Libraries/LibWeb/Layout/LayoutState.cpp') diff --git a/Userland/Libraries/LibWeb/Layout/LayoutState.cpp b/Userland/Libraries/LibWeb/Layout/LayoutState.cpp index 085294650a..940059baf7 100644 --- a/Userland/Libraries/LibWeb/Layout/LayoutState.cpp +++ b/Userland/Libraries/LibWeb/Layout/LayoutState.cpp @@ -184,7 +184,7 @@ void LayoutState::UsedValues::set_node(NodeWithStyleAndBoxModelMetrics& node, Us auto const& computed_values = node.computed_values(); - auto is_definite_size = [&](CSS::LengthPercentage const& size, float& resolved_definite_size, bool width) { + auto is_definite_size = [&](CSS::Size const& size, float& resolved_definite_size, bool width) { // A size that can be determined without performing layout; that is, // a , // a measure of text (without consideration of line-wrapping), @@ -206,6 +206,8 @@ void LayoutState::UsedValues::set_node(NodeWithStyleAndBoxModelMetrics& node, Us } if (size.is_length()) { + if (size.length().is_calculated()) + return false; resolved_definite_size = size.length().to_px(node); return true; } -- cgit v1.2.3