1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:17:35 +00:00

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`).
This commit is contained in:
Andreas Kling 2022-09-25 15:48:23 +02:00
parent 844321d89f
commit 0843960235
9 changed files with 144 additions and 109 deletions

View file

@ -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;
}