aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_2020/formatting_contexts.rs
Commit message (Collapse)AuthorAgeFilesLines
...
* rustdoc: Fix many rustdoc errors (#31147)Martin Robinson2024-01-221-2/+2
| | | | 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.
* layout: Add *very* basic support for table layout (#31121)Martin Robinson2024-01-191-5/+5
| | | | | | | | | | | | | | | | | | | | | * layout: Add *very* basic support for table layout This is the first step to proper table layout. It implements a naive layout algorithm, notably only taking into account the preferred widths of the first table row. Still, it causes some float tests to start passing, so turn on the `layout.tables.enabled` preference for those directories. Co-authored-by: Oriol Brufau <obrufau@igalia.com> * Address review comments * Fix a crash with rowspan=0 * Turn on pref and update results for `/css/css-tables` and `/css/CSS2/tables` --------- Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* layout: Switch `IndependentLayout` to use `Au` instead of `Length` (#31083)atbrakhi2024-01-151-3/+3
| | | | | | | * use au in layout * fmt * review fix
* layout: Implement support for `line-height` and `vertical-align` (#30902)Martin Robinson2024-01-081-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * layout: Implement support for `line-height` and `vertical-align` This is an initial implementation of proper `line-height` and `vertical-align` support. While this change includes the bulk of the work there are still many missing pieces for full support. In particular some big missing things are: - Flex containers do not properly compute their baselines. The idea is to tackle this in a followup change. This causes various flex tests to start failing because everything used to be top aligned. - The implementation of the line-height quirks (only active in quirks mode) are incomplete. While the quirk works in many cases, there are still some cases where it is handled incorrectly. This requires more redesign and refinement, better suited for a followup. - Most of the features are CSS 3 such as precision control of the baseline and first and last baselines are not implemented. This change gets us close to CSS 2.x support. While there are many new test passes with this change some tests are starting to fail. An accounting of new failures: Tests failing also in Layout 2013: - /css/css2/positioning/toogle-abspos-on-relpos-inline-child.html (only passes in Chrome) - /css/CSS2/fonts/font-applies-to-001.xht (potentially an issue with font size) Invalid tests: - /css/CSS2/visudet/inline-block-baseline-003.xht - /css/CSS2/visudet/inline-block-baseline-004.xht - These are are failing in all browsers. See https://bugs.chromium.org/p/chromium/issues/detail?id=1222151. Missing table support: - /_mozilla/mozilla/table_valign_middle.html Missing `font-size-adjust` support : - /css/css-fonts/font-size-adjust-zero-2.html (also failing in 2013) Incomplete form field support : - /html/rendering/widgets/the-select-element/option-add-label-quirks.html (label isn't rendered so button isn't the right size in quirks mode due to line height quirk) Need support for calculating flexbox baseline: - /css/css-flexbox/fieldset-baseline-alignment.html - /css/css-flexbox/flex-inline.html - /css/css-flexbox/flexbox-baseline-multi-line-horiz-001.html - /css/css-flexbox/flexbox-baseline-single-item-001a.html - /css/css-flexbox/flexbox-baseline-single-item-001b.html Failing because we don't create anonymous inline boxes for text children of blocks: - /css/CSS2/linebox/anonymous-inline-inherit-001.html Passes locally (potentially related to fonts): - /css/CSS2/css1/c414-flt-fit-004.xht - /css/css-transforms/transform-input-017.html - /html/obsolete/requirements-for-implementations/the-marquee-element-0/marquee-min-intrinsic-size.html - /css/css-fonts/first-available-font-005.html - /css/css-fonts/first-available-font-006.html * Some cleanups after live review with @mukilan Also update results.
* Add initial support for table box tree construction (#30799)Martin Robinson2023-12-051-3/+17
| | | | | | | | | | | | This is the first part of constructing the box tree for table layout. No layout is actually done and the construction of tables is now hidden behind a flag (in order to not regress WPT). Notably, this does not handle anonymous table part construction, when the DOM does not reflect a fully-formed table. That's part two. Progress toward #27459. Co-authored-by: Oriol Brufau <obrufau@igalia.com> Co-authored-by: Manish Goregaokar <manishsmail@gmail.com>
* Strict import formatting (grouping and granularity) (#30325)Samson2023-09-111-7/+9
| | | | | * strict imports formatting * Reformat all imports
* remove `extern crate` (#30311)Samson2023-09-081-0/+1
| | | | | | | | | | | * 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>
* Resolve cyclic margin and padding percentages against zero (#30085)Oriol Brufau2023-08-101-20/+7
| | | | | | | 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.
* Simplify layout of absolutes with static insetsMartin Robinson2023-06-201-13/+6
| | | | | | | | | | | | | | | | | | | Absolutes with static insets need to be laid out at their ancestor containing blocks, but their position is dependent on their parent's layout. The static layout position is passed up the tree during hoisting and ancestors each add their own offset to the position until it is relative to the containing block that contains the absolute. This is currently done with a closure and a fairly tricky "tree rank" numbering system that needs to be threaded through the entire layout. This change replaces that system. Every time a child is laid out we create a positioning context to hold any absolute children (this can be optimized away at a later time). At each of these moments, we call a method to aggregate offsets to the static insets of hoisted absolutes. This makes the logic easier to follow and will also allow implementing this behavior for inline-blocks, which was impossible with the old system.
* Layout 2020: Move all Fragment code to the `fragment_tree` directoryMartin Robinson2023-06-041-2/+1
| | | | | | | | This is a simple code organization change with no behavior change with the idea of making Layout 2020 easier to understand by new folks to the project. The idea is that we will have a cleaner separation between the different parts of layout ie one directory for the fragment tree and one (currently multiple) directory for the box tree.
* layout_2020: Implement automatic minimum size of flex itemsPu Xingyu2023-06-021-1/+1
| | | | | Implement the algorithm described in https://drafts.csswg.org/css-flexbox/#min-size-auto.
* Combine DOM-related concepts in Layout 2020 into dom.rsMartin Robinson2023-05-131-1/+2
|
* Detect body elements during layoutMartin Robinson2023-05-041-16/+17
| | | | | | | | | | | | | | | | | During layout it is often useful, for various specification reasons, to know if an element is the `<body>` element of an `<html>` element root. There are a couple places where a brittle heuristic is used to detect `<body>` elements. This information is going to be even more important to properly handle `<html>` elements that inherit their overflow property from their `<body>` children. Implementing this properly requires updating the DOM wrapper interface. This check does reach up to the parent of thread-safe nodes, but this is essentially the same kind of operation that `parent_style()` does, so is ostensibly safe. This change should not change any behavior and is just a preparation step for properly handle `<body>` overflow.
* Make a bool for `display: list-item` available to flow box constructionSimon Sapin2020-07-231-1/+3
|
* First pass at implementing the Flex Layout AlgorithmSimon Sapin2020-06-231-1/+12
| | | | https://drafts.csswg.org/css-flexbox/#layout-algorithm
* An element establishing a formatting context *is* the containing block for ↵Simon Sapin2020-06-231-5/+3
| | | | its contents
* Rename outer_inline* outside of sizing.rs to outer_inline_content_sizes*Simon Sapin2020-06-191-4/+6
|
* Compute content sizes lazily in layout 2020Anthony Ramine2020-06-181-47/+90
|
* Make IndependentFormattingContext an enumAnthony Ramine2020-06-151-61/+55
|
* Move IndependentFormattingContext::as_replaced to ↵Anthony Ramine2020-06-151-9/+22
| | | | IndependentFormattingContextContents
* layout_2020: Tag fragments with their pseudo content typeMartin Robinson2020-06-061-21/+17
| | | | | This will allow us to answer queries and properly handle animations in the future for fragments generated for pseudo content.
* Anonymous flex item for text directly in a flex containerSimon Sapin2020-06-041-0/+22
|
* Layout 2020 skeleton for `display: flex`, behind a prefSimon Sapin2020-06-041-0/+26
|
* Propagate text decoration where neededFernando Jiménez Moreno2020-03-231-0/+3
|
* Make AbsolutelyPositionedBox be 'staticAnthony Ramine2020-03-171-2/+2
|
* Dump box tree state into json files and display it on layout 2020 viewerFernando Jiménez Moreno2020-02-211-2/+3
|
* Store an OpaqueNode in boxes and fragmentsAnthony Ramine2019-12-131-0/+4
|
* Remove the Node type parameter from ContentsAnthony Ramine2019-12-131-1/+3
| | | | We now pass the Node as an argument during DOM traversal in layout.
* Introduce PositioningContextSimon Sapin2019-12-121-3/+3
|
* Fix min/max-content of replaced boxesSimon Sapin2019-12-101-14/+13
|
* Add min/max-width/height support for `inline-block`Simon Sapin2019-12-101-0/+2
| | | | (… and other non-replaced atomic inline-level boxes.)
* Use a new `BoxContentSizes` enum instead of `Option<ContentSizes>`Simon Sapin2019-12-041-8/+11
|
* Replace boolean parameters by a new `ContentSizesRequest` enumSimon Sapin2019-12-041-7/+7
|
* Remove IndependentFormattingContext::layoutSimon Sapin2019-12-031-18/+0
| | | | Callers should handle replaced v.s. not separately
* Finish plumbing intrinsic min/max-content through box constructionSimon Sapin2019-12-031-7/+25
|
* Add a `request_content_sizes` parameter to ↵Simon Sapin2019-12-031-0/+1
| | | | `IndependentFormattingContext::construct`
* Pass a LayoutContext through box constructionSimon Sapin2019-12-021-3/+2
|
* Un-allow and fix warnings in `components/layout_2020`Simon Sapin2019-12-021-3/+2
|
* Start supporting images in layout 2020Anthony Ramine2019-12-011-1/+1
|
* Split FlowChildren in IndependentLayout and FlowLayoutAnthony Ramine2019-11-261-3/+10
| | | | | The result of doing the layout of an independent formatting context should be unconcerned with margin collapsing.
* Make IndependentFormattingContext a struct that owns stylesSimon Sapin2019-11-261-0/+107
… and has a private enum for its contents. Privacy forces the rest of the code to go through methods rather than matching on the enum, reducing accidental layout-mode-specific behavior.