Commit graph

32 commits

Author SHA1 Message Date
Oriol Brufau
50eb69a7e0
Allow creating a ContentSizes from Au (#33208)
No change in behavior, it just simplies some code a little bit.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2024-08-27 15:22:47 +00:00
Oriol Brufau
c00cd1326a
Take into account the intrinsic block size when computing the main size of a 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>
2024-08-20 11:30:27 +00:00
Martin Robinson
7633bdccd2
layout: Initial implementation of flex-direction: column and 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>
2024-08-14 14:25:09 +00:00
Delan Azabani
974c9dc89a
layout: Compute intrinsic sizes for flex items and flex containers (#32854)
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-08-02 06:45:11 +00:00
Martin Robinson
127aa657c2
layout: Add initial support for row height distribution (#31421)
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>
2024-02-29 12:12:54 +00:00
Martin Robinson
d68c7e7881
layout: Implement computation of table column widths (#31165)
* 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>
2024-01-25 23:13:13 +00:00
Oriol Brufau
50f56affe3
Lint layout_2020 with clippy (#31169)
cargo clippy --fix -p layout_2020 --allow-dirty --broken-code
2024-01-25 09:03:31 +00:00
atbrakhi
45af1198aa
Layout: use Au in ContentSizes (#31135)
* use app_units

* resolve errors in table layout

* fmt

* add back current_line.min_content

* update expectation

* review fix
2024-01-23 10:18:39 +00:00
Martin Robinson
5c1723c983
rustdoc: Fix many rustdoc errors (#31147)
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.
2024-01-22 13:13:48 +00:00
Samson
aad2dccc9c
Strict import formatting (grouping and granularity) (#30325)
* strict imports formatting

* Reformat all imports
2023-09-11 19:16:54 +00:00
Samson
711dbbd4af
remove extern crate (#30311)
* 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>
2023-09-08 12:11:31 +00:00
Oriol Brufau
c264993da8
Resolve cyclic margin and padding percentages against zero (#30085)
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.
2023-08-10 11:38:44 +00:00
Oriol Brufau
4ec6dd1783 Handle floats in BlockContainer::inline_content_sizes
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.
2023-06-19 16:02:35 +02:00
Simon Sapin
42e9d2450e Parallelize BlockContainer::inline_content_sizes 2020-06-19 15:38:15 +02:00
Anthony Ramine
235df94f2e Compute content sizes lazily in layout 2020 2020-06-18 14:11:02 +02:00
Anthony Ramine
07d8c28d4a Make outer_inline and outer_inline_and_percentages free functions
They now take a closure that will compute the content sizes on demand.
2020-06-15 18:09:15 +02:00
Simon Sapin
08f008a011 Use the writing mode of the containing block when accessing CSS properties
… 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.
2020-06-10 09:03:18 +02:00
Simon Sapin
08801d94cd Less cloning 2020-04-01 01:00:14 +02:00
Simon Sapin
c377d9c48e Implement the box-sizing property 2020-03-31 23:43:58 +02:00
Fernando Jiménez Moreno
a042f85083 Dump box tree state into json files and display it on layout 2020 viewer 2020-02-21 11:11:00 +01:00
Emilio Cobos Álvarez
1754c832d8
layout_2020: Avoid decomposing mixed length / percentages in intrinsic sizing.
As that makes no sense in presence of min / max.
2020-02-12 02:43:23 +01:00
Emilio Cobos Álvarez
e227715aee
style: Miscellaneous Servo build fixes. 2020-02-12 02:43:23 +01:00
Emilio Cobos Álvarez
e885ccb7ae layout-2020: build fixes. 2019-12-16 14:23:56 +01:00
Simon Sapin
999dd72895 Account for min/max-width in outer intrinsic sizing 2019-12-10 12:36:43 +01:00
Simon Sapin
dd9dfc66e3 Use a new BoxContentSizes enum instead of Option<ContentSizes> 2019-12-04 15:36:05 +01:00
Simon Sapin
38e8fd1e99 Replace boolean parameters by a new ContentSizesRequest enum 2019-12-04 15:10:11 +01:00
Simon Sapin
01034b10e1 Use Sides::inline_sum method 2019-12-04 13:47:13 +01:00
Simon Sapin
77d2c45991 Fix incorrect variable name
This was not the specified value
2019-12-04 13:37:20 +01:00
Simon Sapin
46f0f7d7e2 Implement shrink-to-fit for abspos 2019-12-03 15:11:35 +01:00
Simon Sapin
c056e5b6b0 Finish plumbing intrinsic min/max-content through box construction 2019-12-03 15:11:35 +01:00
Simon Sapin
303b36f17b Add content sizes computation for block containers 2019-12-03 15:11:35 +01:00
Simon Sapin
6a5b8337a1 Rename IntrinsicSizes to ContentSizes 2019-12-03 15:11:35 +01:00
Renamed from components/layout_2020/intrinsic.rs (Browse further)