| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Refactor computation of preferred aspect ratios
Computing min/max-content sizes required a ContainingBlock in order to
resolve the padding and border when determining the preferred aspect
ratio. However, all callers already knew the padding and border, so they
can compute the ratio themselves, and pass it directly instead of
the ContainingBlock.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* Put preferred aspect ratio into ConstraintSpace
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
---------
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
| |
- Clamp the stretch size to not be negative when the sum of padding,
borders and margins exceed the available space. This avoids a 2nd
layout.
- Avoid computing the inline content sizes if the result isn't needed.
- Instead of clamping both the min-content and max-content sizes to be
between the min and max constraints, just compute the fit-content size
first, and then clamp. Then `ContentSizes::map()` can be removed.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#34152)
To compute the min-content and max-content inline sizes of a replaced
element, we were only using the aspect ratio to transfer definite block
sizes resulting from clamping the preferred block size between the min
and max block sizes.
However, if the preferred block size is indefinite, then we weren't
transfering the min and max through the aspect ratio.
This patch adds a `SizeConstraint` enum that can represent these cases,
and a `ConstraintSpace` struct analogous to `IndefiniteContainingBlock`
but with no inline size, and a `SizeConstraint` block size.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
| |
We only need the writing mode, not the entire computed style.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
| |
Correctly handle keyword sizes when computing the min-content or
max-content contribution of a box.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is the second flexbox caching change. It seeks to detect when a
relayout can be avoided in the case of a stretching flex item. This
heuristic can be combined, because currently we still do relayout
sometimes when we do not need to.
For instance currently we always relayout when a flex child is itself a
column flex. This only needs to happen when the grandchildren themselves
grow or shrink. That optimization is perhaps a lower priority as
`flex-grow: 0 / flex-shrink: 1` is the default behavior for flex.
Since this change means we more consistenly zero out the percentage part
of `calc` expressions when they have circular dependencies, this causes one
test to start failing (`/css/css-values/calc-min-height-block-1.html`).
This is related to w3c/csswg-drafts#10969, which is pending on further
discussion in the working group.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
| |
The result of `inline_content_sizes()` may depend on the block size of
the containing block, so we were always recomputing in case we got
a different block size.
However, if no content has a vertical percentage or stretches vertically,
then we don't need to recompute: the result will be the same anyways.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This will allow callers to start obeying `min-content`, `max-content`,
`fit-content` and `stretch` in follow-up patches.
The old functionality is kept as deprecated methods that we should
eventually remove.
This patch has very little impact on the existing behavior, just some
very minimal implementation of the keywords for css tables.
This also overhauls fixed-layout-2.html since:
- It had code that wasn't doing anything
- It had wrong expecations in prose
- The logic seemed broken in general
- All browsers were failing one testcase
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
| |
And ensure that the minimum wins for malformed ContentSizes.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
|
| |
In particular, this takes into account that flex items may be stretched,
and if they have an aspect ratio, we ma6y need to convert the stretched
size through the ratio.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When computing the min-content or max-content size of an element we
need to ignore `inline-size`, `min-inline-size` and `max-inline-size`.
However, we should take the block-axis sizing properties into account.
That's because the contents could have percentages depending on them,
which can then affect their inline size via an aspect ratio.
Therefore, this patch adds `IndefiniteContainingBlock`, which is similar
to `ContainingBlock`, but it allows an indefinite inline-size. This
struct is then passed arround during intrinsic sizing.
More refinement will be needed in follow-up patches in order to fully
address the problem.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
|
|
|
|
|
| |
No change in behavior, it just simplies some code a little bit.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
column flex container (#33135)
In particular, `main_content_sizes()` now works with columns.
`layout_for_block_content_size()` is now used for both intrinsic sizes
and intrinsic contributions, a IntrinsicSizingMode parameter is added
to choose the behavior.
Also, we consider the main size of a flex item as indefinite if its flex
basis is indefinite and the flex container has an indefinite main size.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`column-reverse` (#33031)
This change removes restrictions on using the column layout mode of
flexbox and adds an initial implementation of sizing for that flex
direction. There's a lot of missing pieces still, but in some cases this
does render column flexbox.
In particular, there are now two code paths for preferred widths
(intrinsic size) calcuation: one in the main axis (row) and one in
the cross axis (column) corresponding to the flex direciton with
horizontal writing modes.
In addition, `FlexItemBox::inline_content_sizes` is removed in favor of
making `sizing::outer_inline` /
`IndependentFormattingContext::outer_inline_content_sizes` generic
enough to handle using a different value for auto minimum sizes, which
flexbox needs.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
| |
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change adds a version of row height distribution that follows the
distribtuion algorithm used for tables in Blink's LayoutNG. This is just
an intermediate step toward implementing a distribution algorithm for
both rows and columns more similar to Layout NG.
The CSS Table 3 specification is often wrong with regard to web
compatability, which is why we have abandoned it in favor of the Layout
NG algorithm for row height distribution. this work.
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* layout: Implement computation of table column widths
This change implements the various steps of table column width
computation, ignoring features that don't exist yet (such as separated
borders, column elements, and colgroups).
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* Fix an issue with the assignment of column percent width
* Respond to review comments
---------
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
| |
cargo clippy --fix -p layout_2020 --allow-dirty --broken-code
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* use app_units
* resolve errors in table layout
* fmt
* add back current_line.min_content
* update expectation
* review fix
|
|
|
|
| |
This fixes many rustdoc errors that occur due to raw URLs in rustdoc
comments as well as unescaped Rust code that should be in backticks.
|
|
|
|
|
| |
* strict imports formatting
* Reformat all imports
|
|
|
|
|
|
|
|
|
|
|
| |
* remove extern crate
* Update components/script_plugins/lib.rs
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
---------
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
|
|
|
|
|
|
|
| |
From https://drafts.csswg.org/css-sizing-3/#min-percentage-contribution
> For the min size properties, as well as for margins and paddings
> (and gutters), a cyclic percentage is resolved against zero
> for determining intrinsic size contributions.
|
|
|
|
|
|
| |
Typically, block-level contents are stacked vertically, so this was just
taking the maximum size among all contents. However, floats can be
stacked horizontally, so we need to sum their sizes.
|
| |
|
| |
|
|
|
|
| |
They now take a closure that will compute the content sizes on demand.
|
|
|
|
|
|
|
|
| |
… and converting them to flow-relative geometric values.
These values are almost always used to size and position a fragment within its containing block, so using the mode of the containing block seems more correct.
Note that the `writing-mode` and `direction` properties are disabled in Servo at the moment, so this PR by itself should have no effect: the writing mode of an element is always the same of that of its containing block since they’re both horizontal rtl.
|
| |
|
| |
|
| |
|
|
|
|
| |
As that makes no sense in presence of min / max.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
This was not the specified value
|
| |
|
| |
|
| |
|
|
|