| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Store taffy detailed info into fragment
Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>
* Fix info propagation and resolved grid track query
Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>
* Fix import
Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>
* Fix tracklist matching logic and type optimization
Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>
* Run fmt
Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>
* Update wpt expectations
Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>
* Optimizing info propagation and minor qol
Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>
* Run fmt
Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>
---------
Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A box is usually sized by the formatting context in which it participates.
However, tables have some special sizing behaviors, and these were in
conflict.
Instead of letting tables attempting to re-resolve their inline table,
which failed to e.g. take flex properties into account or resolve sizing
keywords correctly, now tables will trust the inline size determined by
the parent. They will only floor it by the min-content size, and maybe
shrink the final size due to collapsed columns.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When laying out a block-level box that avoids floats, if we know that
its size doesn't depend on the available space, we can take a fast path
and only lay it out once. If its size depends on the available space,
we may have to lay it out multiple times, which can be slower.
This patch improves the check for this dependency on the available space.
For example, `min-width: 200px; width: 100px; max-width: stretch` was
previously considered to depend on the available space because of
`max-width`. However, `max-width` is irrelevant when the min size is
greater than the preferred size.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
| |
There is an early return for independent formatting contexts, so at this
point we don't need to handle them.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
| |
`content_inline_size_for_table` is an override for table layout.
We only use taffy for grid layout, not for table layout.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
| |
In the past this didn't hold, so we had to floor GRIDMAX by GRIDMIN.
We must have fixed some bugs because now it's fine to just assert it.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
|
|
| |
`width` and `max-width` typically treat expressions with percentages as
their initial value, but for the min-content contribution of replaced
elements, they should instead be treated as zero.
https://drafts.csswg.org/css-sizing-3/#replaced-percentage-min-contribution
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
|
|
| |
The new version of rust allows us to elide some lifetimes and clippy is
now complaining about this. This change elides them where possible and
removes the clippy exceptions.
Fixes #34804.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Upgrade rustc to 1.83
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Fix crown (change copied from linked clippy function)
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Fix named lifetime lint
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Bump shell.nix
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Fix non-local impl warnings
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Format with 1.83 formatting changes
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Fix manual non-local impl
Signed-off-by: Nico Burns <nico@nicoburns.com>
* More fixes for crown
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Fix tidy
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Fix needless_return lints
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Fix doc comment lint
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Fix missing wait lint
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Allow needless_lifetimes lint
Signed-off-by: Nico Burns <nico@nicoburns.com>
* more doc comments
Signed-off-by: Nico Burns <nico@nicoburns.com>
* More needless_returns
Signed-off-by: Nico Burns <nico@nicoburns.com>
* is_empty lint
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Fix needless_lifetime lints
Signed-off-by: Nico Burns <nico@nicoburns.com>
* fix div_ceil lint
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Allow non-minimal bool
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Non-local impl in constellation
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Missing wait in constellation
Signed-off-by: Nico Burns <nico@nicoburns.com>
* fmt
Signed-off-by: Nico Burns <nico@nicoburns.com>
* remove useless lints table
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Fixup comments
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Allow non-local definition in sandboxing code to simplify feature flagging
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Remove wait calls and allow zombie_processes lint
Signed-off-by: Nico Burns <nico@nicoburns.com>
---------
Signed-off-by: Nico Burns <nico@nicoburns.com>
|
|
|
|
|
|
| |
Fix some warnings in documentation as well as some faulty documentation
introduced in #34776.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
|
|
|
|
|
| |
`find_block_margin_collapsing_with_parent_from_slice()` (#34725)
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
|
| |
Block layout uses some heuristics to guess whether margins are separated
by clearance and then don't collapse. These heuristics now take the
min-content, max-content, fit-content and stretch sizing keywords into
account.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
| |
In order to compute the inline min-content and max-content contributions
of an anonymous block, we were finding its min-content and max-content
inline size with a SizeConstraint coming from the block size of the box.
However, anonymous blocks do not establish a containing block for their
contents, so this patch uses a SizeConstraint from the block size of the
containing block.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
|
|
| |
If a table element had e.g. `width: 0px`, we were assuming that this was
its intrinsic min-content and max-content contributions.
However, tables are always at least as big as its min-content size, so
this patch floors the intrinsic contributions by that amount.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
| |
When an element is a shadow root, lay out the shadow root elements
instead of the non-shadow children.
This fixes some tests and introduces some failures, due to bugs in the
Shadow DOM implementation. In general, this is very low impact as the
Shadow DOM is still disabled by default. At least this gets elements
rendering when the preference is turned on though.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
|
|
|
|
|
|
|
|
|
| |
in each layout logic, in order to correctly resolve sizing keywords.
This patch adds a new `Sizes` struct which holds the preferred, min and
max sizing values for one axis, and unifies the logic to resolve the
final size into there.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Consider:
```html
<div style="position: relative; width: 50px; height: 50px; border: solid; margin: 5px">
<div style="position: absolute; top: 0; bottom: 0; height: max-content">
<canvas width="25" height="25" style="background: cyan; height: 100%"></canvas>
</div>
</div>
```
In order to determine the inline min/max-content sizes, we need a
tentative block size as the input, which only takes extrinsic values
into account.
In this case `height: max-content` is intrinsic, so we were treating it
as `height: initial`, which would behave as a definite `height: stretch`.
Therefore, the canvas was able to resolve its percentage.
However, it seems weird to treat an explicitly intrinsic keyword in an
extrinsic way, and Blink doesn't do it. So now we treat the tentative
block size as indefinite, therefore the percentage behaves as auto.
This adds a new test, we were previously failing 6 subtests, now only 3.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
| |
It only needs to store the block sizes, not the inline ones which have
already been resolved.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
| |
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
|
|
|
|
|
|
|
| |
Adds support for min-content, max-content, fit-content and stretch,
for the case that was missing from #34568: block-level elements that
establish an independent formatting context, when there are floats.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
|
| |
Manage `<iframe>` size updates in `Window`. In addition to removing
duplicated code, this will allow setting `<iframe>` sizes synchronously
on child `Pipeline`s of the same origin in the script process in a
followup change. The goal is remove flakiness from `<iframe>` sizing.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
|
|
|
|
|
|
|
| |
Adds support for min-content, max-content, fit-content and stretch,
for block-level elements that don't establish an independent formatting
context, and for block-level elements when there is no float.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
| |
Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
(#34608)
It was a bit confusing that e.g. a float with `FloatSide::InlineStart`
would set `FloatBand::left`, or that `PlacementAmongFloats` would
compute `max_inline_start` from the various `FloatBand::left`.
So now all the float logic will consistently use logical terminoligy.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Several structs and enums had a `inline_content_sizes()` method, but it
wasn't clear which ones would try to cache the result, and which ones
would always compute it.
Therefore, this performs some clarifying renaming:
- Cached ones stay as `inline_content_sizes()`
- Uncached ones become `compute_inline_content_sizes()`
Also, to simplify calls to `LayoutBoxBase::inline_content_sizes()`,
`compute_inline_content_sizes()` is moved into a new trait.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
| |
Due to a typo, the containing block established by a table row for the
table cells had its block size set to the its inline size. However,
this block size is currently unused, so no change in behavior.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* [fix](inline flow): Create PBM items in inline context in propper visual order
Signed-off-by: Desiatkin Dmitrii <d.desyatkin@innopolis.university>
* Rename left/right pbm terms in inline layout to logical nomenclature
- LineItem::LeftInlineBoxPaddingBorderMargin(_) is renamed to
LineItem::InlineStartBoxPaddingBorderMargin(_)
- LineItem::RightInlineBoxPaddingBorderMargin(_) is renamed to
LineItem::InlineEndBoxPaddingBorderMargin(_)
- LineLayoutInlineContainerFlags::HAD_LEFT_PBM is renamed to
LineLayoutInlineContainerFlags::HAD_INLINE_START_PBM
- LineLayoutInlineContainerFlags::HAD_RIGHT_PBM is renamed to
LineLayoutInlineContainerFlags::HAD_INLINE_END_PBM
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* Update test expectations
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
---------
Signed-off-by: Desiatkin Dmitrii <d.desyatkin@innopolis.university>
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Block-level elements that establish an independent formatting context
(or are replaced) need to avoid overlapping floats.
In the non-replaced case, we have two different subcases, depending on
whether the inline size of the element is known. This patch makes them
share more logic.
Then `solve_clearance_and_inline_margins_avoiding_floats()` would only
be used in the replaced case, so it's removed, inlining its logic.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
| |
Signed-off-by: Nico Burns <nico@nicoburns.com>
|
|
|
| |
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
|
|
|
| |
Signed-off-by: Nico Burns <nico@nicoburns.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The refactoring in 264c0f972fd1a732ee1d1490d78a1d26a65c6f5f stopped
caching the `inline_content_sizes()` calls from:
- `FlexItemBox::layout_for_block_content_size()`
- `IndependentFormattingContext::layout_float_or_atomic_inline()`
- `TaffyContainerContext::compute_child_layout()`
Also, the call from `OutsideMarker::layout()` was never cached.
This patch caches all of them.
It's not clear at all which `inline_content_sizes()` are cached and
which aren't, so I plan to improve the situation in a follow-up.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
| |
- Remove the `LayoutBox::InlineBox` variant that was only used for
inline level boxes. Now they are stored in `LayoutBox::InlineLevel`
along with other kinds of out-of-flow and atomic inline items.
- Reduce the size of `InlineItem` by 260 bytes per item by using atomic
indirection / pointers. This adds a bit of overhead to access items in
exchange for a lot of memory saved.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
|
| |
This might make caching these values a bit easier in the future.
Correcting the visibility of `ContainingBlock` also exposed some new
rustc and clippy warnings that are fixed here.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Consider this testcase:
```html
<canvas style="aspect-ratio: 1; height: stretch; background: cyan"
width="200" height="100"></canvas>
```
To compute the intrinsic inline sizes we were treating `height: stretch`
as the natural height (100px) and then transferring that to the inline
axis through the preferred aspect ratio. So the element was 100px wide.
However, an indefinite `stretch` should be treated as an automatic size,
which wouldn't be transferred to the inline axis.
The fix actually makes the code slightly simpler.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
| |
This allows `SameFormattingContextBlock` to cache inline content sizes
and will eventually allow it to participate in incremental layout.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
|
|
|
|
|
|
| |
This allows cells to cache their inline content size and will eventually
allow them to participate in incremental layout.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#34507)
Add a new struct `LayoutBoxBase`, that will be used throughout the box
tree. The idea of this struct is that we have a place to consistently
store common layout information (style and node information) and also to
cache layout results such as content sizes (inline and maybe later box
sizes) and eventually layout results.
In addition to the addition of this struct,
`IndependentFormattingContext` is flattened slightly so that it directly
holds the contents of both replaced and non-replaced elements.
This is only added to independent formatting contexts, but will later be
added to all block containers as well.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Upgrade Stylo to 2024-12-04
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* Fixup for https://phabricator.services.mozilla.com/D229998
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* Update test expectations
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
---------
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
| |
We were sizing absolutely positioned replaced elements within their
actual containing block instead of the inset-modified containing block.
Then the `stretch` keyword would result in a wrong size.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
positioned elements (#34365)
* Add missing support for some alignment keywords on absolutely positioned elements
Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>
* Check the direction of the alignment container, nits, test expectations
In this case we need to check the direction of the static position
containing block, not the actual containing block:
```html
<!DOCTYPE html>
<div style="position: relative">
<div style="display: flex; flex-direction: column; width: 100px; height: 100px; border: solid; direction: rtl">
<div style="position: absolute; width: 20px; height: 20px; background: cyan; top: 20px; align-self: self-start"></div>
<div style="position: absolute; width: 20px; height: 20px; background: magenta; bottom: 20px; align-self: self-end"></div>
</div>
</div>
```
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
---------
Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Obey min and max properties when computing main size of column flex
When laying out a column flex container with an auto preferred main size,
we were resolving the used main size to the intrinsic max-content size.
However, we weren't clamping this amount between the min and max sizes.
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* Improve performance of flex column layouts by caching
We were already using a cache for layout_for_block_content_size(), but
we were only storing the intrinsic block size. Thus when laying out the
flex items for real, we would perform new layouts, triggering an
exponential complexity in case of nested flexboxes.
Now we cache the entire layout result so that we can avoid doing the
work again.
This improves the results of flexbox-deeply-nested-column-flow.html
(a Blink perf test) from ~40 runs/second to ~500 runs/second on my PC.
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
---------
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
|
|
|
|
|
|
|
|
| |
When laying out a column flex container with an auto preferred main size,
we were resolving the used main size to the intrinsic max-content size.
However, we weren't clamping this amount between the min and max sizes.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`AbsoluteAxisSolver::solve()` would compute, among other things, the
position of the absolute positioned element if it had start alignment.
Then, `AbsoluteAxisSolver::origin_for_alignment_or_justification()`
could optionally opt into modifying that alignment if needed.
This was quite convoluted and not easy to follow. It's simpler to not
compute the position in `AbsoluteAxisSolver::solve()`, and instead do it
always in `AbsoluteAxisSolver::origin_for_alignment_or_justification()`,
which I'm renaming to `AbsoluteAxisSolver::origin_for_margin_box()`
because it aligns the margin box of the abspos within its alignment
container.
Then the `Anchor` struct becomes useless and can be removed.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The containing block for the static position of an absolutely positioned
element in flex layout is established by the flex container. However, if
the flex container has static position, the actual containing block will
be established by another ancestor.
If the flex container and the containing block have different directions,
the static position needs especial handling when aligning the abspos.
We were already trying to do so with the `flip_anchor` flag, but there
were bugs.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
|
|
|
|
| |
used_size_as_if_inline_element_from_content_box_sizes() (#34421)
Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>
|
|
|
|
|
|
|
|
| |
We were using the preferred aspect ratio provided by the `aspect-ratio`
property instead of the natural aspect ratio. However, the preferred
aspect ratio should only be used to size the replaced element. To paint
the replaced contents into that element we need the natural ratio.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
| |
Signed-off-by: Delan Azabani <dazabani@igalia.com>
|
|
|
|
|
|
| |
It panics if the value is mutably borrowed concurrently, but this allows
it to perform better.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|