diff options
author | Andreas Kling <kling@serenityos.org> | 2022-09-25 15:48:23 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-09-25 17:51:43 +0200 |
commit | 08439602353db9a5dbaa4aa2a8ba26c3e1551bc7 (patch) | |
tree | ec862c830e4ae9538aad973276f71e32ba47df64 /Userland/Libraries/LibWeb/Layout/LayoutState.cpp | |
parent | 844321d89fda5fc9424f9122f030f63ee5b29a31 (diff) | |
download | serenity-08439602353db9a5dbaa4aa2a8ba26c3e1551bc7.zip |
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`).
Diffstat (limited to 'Userland/Libraries/LibWeb/Layout/LayoutState.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/LayoutState.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
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 <length>, // 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; } |