aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_2020/flow
Commit message (Collapse)AuthorAgeFilesLines
...
* | Auto merge of #29799 - stshine:align-self-stretch, r=Loirooriolbors-servo2023-06-012-1/+2
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | layout_2020: Specify the used cross size when replaced item is stretched According to spec, if the flex item has [align-self: stretch](https://drafts.csswg.org/css-flexbox/#propdef-align-self), redo layout for its contents, treating this used size as its definite cross size so that percentage-sized children can be resolved. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #29788 (GitHub issue number if applicable) <!-- Either: --> - [x] There are tests for these changes OR <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
| * | layout_2020: Add an optional box size parameter to ↵Pu Xingyu2023-05-272-1/+2
| |/ | | | | | | | | | | | | ReplacedContent::used_size_as_if_inline_element This allow us to specify the used size when calculating size of replaced content.
* / layout_2020: Check blocks for whether they will establish a formatting contextPu Xingyu2023-05-311-2/+4
|/
* Refactor Layout 2020 layout for a compositor-side scroll treeMartin Robinson2023-05-171-52/+9
| | | | | | | | | | | | | | | | | | | | This change refactors how layout is done in Layout 2020 in preparation for a compositor-side scroll tree: 1. Now the SpatialId and ClipId of each fragment is stored separately. This will allow storing a scroll node id instead of only the handle to the WebRender spatial node. 2. Separate out stacking context tree construction and display list building. This change will make it possible to eventually build the stacking context tree without the full display list if we find that necessary. For instance, this might be useful to cache containing block boundaries. 3. Add a `DisplayList` struct that stores both the WebRender display list builder and the compositor info. This exposes the API to the layout thread for display list building. In addition, this change adds a lot of missing documentation. This should not change behavior.
* Combine DOM-related concepts in Layout 2020 into dom.rsMartin Robinson2023-05-133-8/+6
|
* Better implement getComputedStyle() for positioned insetsMartin Robinson2023-05-091-6/+9
| | | | | | | | The specification dictates quite quite idiosyncratic return values when querying insets of positioned elements via getComputedStyle(). These depend on whether or not the elements size was overconstrained. This change adds a better implementation of that in preparation for returning proper values for position: sticky.
* Detect body elements during layoutMartin Robinson2023-05-044-44/+37
| | | | | | | | | | | | | | | | | 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.
* Rework CB management during stacking context tree constructionMartin Robinson2023-05-033-45/+51
| | | | | | | | | | Manage containing blocks and WebRender SpaceAndClip during stacking context tree constuction using the ContainingBlockInfo data structure. This will allow us to reuse this data structure whenever we traverse the fragment tree. In addition, StackingContextBuilder is no longer necessary at all. This change also fixes some bugs where fixed position fragments were not placed in the correct spatial node. Unfortunately, these fixes are difficult to test because of #29659.
* Fix text-decoration for block containers in layout-2020Oriol Brufau2023-04-262-4/+7
| | | | | | It was only applied to the 1st inline formatting context of a block container. Other IFCs were created with the Default trait, implying TextDecorationLine::NONE.
* Auto merge of #29650 - Loirooriol:text-indent, r=mrobinsonbors-servo2023-04-262-3/+25
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Support text-indent in layout-2020 Existing WPT now passing: - _mozilla/css/text_indent_a.html - css/CSS2/css1/c71-fwd-parsing-002.xht - css/CSS2/css1/c71-fwd-parsing-004.xht - css/CSS2/floats-clear/floats-138.xht - css/CSS2/text/text-indent-007.xht - css/CSS2/text/text-indent-008.xht - css/CSS2/text/text-indent-010.xht - css/CSS2/text/text-indent-019.xht - css/CSS2/text/text-indent-020.xht - css/CSS2/text/text-indent-031.xht - css/CSS2/text/text-indent-032.xht - css/CSS2/text/text-indent-043.xht - css/CSS2/text/text-indent-044.xht - css/CSS2/text/text-indent-055.xht - css/CSS2/text/text-indent-056.xht - css/CSS2/text/text-indent-067.xht - css/CSS2/text/text-indent-068.xht - css/CSS2/text/text-indent-079.xht - css/CSS2/text/text-indent-080.xht - css/CSS2/text/text-indent-091.xht - css/CSS2/text/text-indent-092.xht - css/CSS2/text/text-indent-103.xht - css/CSS2/text/text-indent-104.xht - css/CSS2/text/text-indent-112.xht - css/CSS2/text/text-indent-113.xht - css/CSS2/text/text-indent-115.xht - css/CSS2/text/text-indent-applies-to-002.xht - css/CSS2/text/text-indent-applies-to-003.xht - css/CSS2/text/text-indent-applies-to-005.xht - css/CSS2/text/text-indent-applies-to-006.xht - css/CSS2/text/text-indent-applies-to-007.xht - css/CSS2/text/text-indent-applies-to-008.xht - css/CSS2/text/text-indent-applies-to-009.xht - css/CSS2/text/text-indent-applies-to-010.xht - css/CSS2/text/text-indent-applies-to-011.xht - css/CSS2/text/text-indent-applies-to-014.xht - css/CSS2/text/text-indent-applies-to-015.xht - css/CSS2/text/text-indent-inherited-001.xht - css/CSS2/text/text-indent-overflow-001.xht - css/CSS2/text/text-indent-overflow-002.xht - css/CSS2/text/text-indent-overflow-003.xht - css/CSS2/text/text-indent-overflow-004.xht - css/CSS2/text/text-indent-wrap-001.xht - css/css-text-decor/text-shadow/textindent.html - css/css-text/text-indent/text-indent-percentage-001.xht - css/css-text/text-indent/text-indent-percentage-002.html - css/css-text/text-indent/text-indent-percentage-003.html - css/css-text/text-indent/text-indent-percentage-004.html - css/css-values/minmax-length-percent-serialize.html - css/css-values/minmax-length-serialize.html Also improvements in: - _mozilla/mozilla/calc.html - css/css-text/animations/text-indent-interpolation.html - css/css-text/inheritance.html - css/css-text/parsing/text-indent-computed.html - css/css-text/parsing/text-indent-valid.html - css/css-transitions/properties-value-implicit-001.html - css/css-values/animations/calc-interpolation.html - css/css-values/minmax-percentage-serialize.html - css/css-values/viewport-units-css2-001.html - css/css-variables/variable-substitution-basic.html - css/cssom/serialize-values.html Existing WPT now failing, due to lack of direction, outside list markers, flex and grid: - css/CSS2/text/text-indent-rtl-001.xht - css/CSS2/text/text-indent-rtl-002.xht - css/css-pseudo/marker-content-023.html - css/css-text/text-indent/anonymous-flex-item-001.html - css/css-text/text-indent/anonymous-grid-item-001.html New WPT tests: - css/css-text/text-indent/text-indent-length-001.html - css/css-text/text-indent/text-indent-length-002.html This one fails in layout-2013. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #29649 (GitHub issue number if applicable) <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
| * Support text-indent in layout-2020Oriol Brufau2023-04-252-3/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Existing WPT now passing: - _mozilla/css/text_indent_a.html - css/CSS2/css1/c71-fwd-parsing-002.xht - css/CSS2/css1/c71-fwd-parsing-004.xht - css/CSS2/floats-clear/floats-138.xht - css/CSS2/text/text-indent-007.xht - css/CSS2/text/text-indent-008.xht - css/CSS2/text/text-indent-010.xht - css/CSS2/text/text-indent-019.xht - css/CSS2/text/text-indent-020.xht - css/CSS2/text/text-indent-031.xht - css/CSS2/text/text-indent-032.xht - css/CSS2/text/text-indent-043.xht - css/CSS2/text/text-indent-044.xht - css/CSS2/text/text-indent-055.xht - css/CSS2/text/text-indent-056.xht - css/CSS2/text/text-indent-067.xht - css/CSS2/text/text-indent-068.xht - css/CSS2/text/text-indent-079.xht - css/CSS2/text/text-indent-080.xht - css/CSS2/text/text-indent-091.xht - css/CSS2/text/text-indent-092.xht - css/CSS2/text/text-indent-103.xht - css/CSS2/text/text-indent-104.xht - css/CSS2/text/text-indent-112.xht - css/CSS2/text/text-indent-113.xht - css/CSS2/text/text-indent-115.xht - css/CSS2/text/text-indent-applies-to-002.xht - css/CSS2/text/text-indent-applies-to-003.xht - css/CSS2/text/text-indent-applies-to-005.xht - css/CSS2/text/text-indent-applies-to-006.xht - css/CSS2/text/text-indent-applies-to-007.xht - css/CSS2/text/text-indent-applies-to-008.xht - css/CSS2/text/text-indent-applies-to-009.xht - css/CSS2/text/text-indent-applies-to-010.xht - css/CSS2/text/text-indent-applies-to-011.xht - css/CSS2/text/text-indent-applies-to-014.xht - css/CSS2/text/text-indent-applies-to-015.xht - css/CSS2/text/text-indent-inherited-001.xht - css/CSS2/text/text-indent-overflow-001.xht - css/CSS2/text/text-indent-overflow-002.xht - css/CSS2/text/text-indent-overflow-003.xht - css/CSS2/text/text-indent-overflow-004.xht - css/CSS2/text/text-indent-wrap-001.xht - css/css-text-decor/text-shadow/textindent.html - css/css-text/text-indent/text-indent-percentage-001.xht - css/css-text/text-indent/text-indent-percentage-002.html - css/css-text/text-indent/text-indent-percentage-003.html - css/css-text/text-indent/text-indent-percentage-004.html - css/css-values/minmax-length-percent-serialize.html - css/css-values/minmax-length-serialize.html Also improvements in: - _mozilla/mozilla/calc.html - css/css-text/animations/text-indent-interpolation.html - css/css-text/inheritance.html - css/css-text/parsing/text-indent-computed.html - css/css-text/parsing/text-indent-valid.html - css/css-transitions/properties-value-implicit-001.html - css/css-values/animations/calc-interpolation.html - css/css-values/minmax-percentage-serialize.html - css/css-values/viewport-units-css2-001.html - css/css-variables/variable-substitution-basic.html - css/cssom/serialize-values.html Existing WPT now failing, due to lack of direction, outside list markers, flex and grid: - css/CSS2/text/text-indent-rtl-001.xht - css/CSS2/text/text-indent-rtl-002.xht - css/css-pseudo/marker-content-023.html - css/css-text/text-indent/anonymous-flex-item-001.html - css/css-text/text-indent/anonymous-grid-item-001.html New WPT tests: - css/css-text/text-indent/text-indent-length-001.html - css/css-text/text-indent/text-indent-length-002.html This one fails in layout-2013.
* | Fix scrolling from script in Layout 2020Martin Robinson2023-04-251-0/+33
|/ | | | | | | | | Script will only scroll if it detects that an element has a scrolling box, so this change adds an implementation of the scroll area query to Layout 2020. This allows some scrolling tests to start passing. This change also updates all expected results in css-backgrounds and cssom-view.
* Add support for <iframe> elements for Layout 2020Martin Robinson2023-04-041-0/+2
| | | | | | This change adds support for the <iframe> element to Layout 2020. In addition, certain aspects of the implementation are made the same between both layout systems.
* fmtNaveen Gattu2021-11-301-2/+3
|
* rm wsNaveen Gattu2021-11-301-1/+1
|
* Do not use ParallelIterator if not using rayonNaveen Gattu2021-11-301-2/+9
|
* refactor(layout_2020): add `depth` parameter to the closure passed to ↵yvt2021-06-161-5/+5
| | | | `FragmentTree::find`
* Simplify control flow of whitespace handling.Josh Matthews2020-07-272-71/+102
|
* Implement basic white-space: pre support for layout 2020.Josh Matthews2020-07-272-20/+53
|
* Adjust absolute positioned box offsets in flow layoutManish Goregaokar2020-07-271-1/+12
|
* Allow adjusting box offsetsManish Goregaokar2020-07-271-0/+3
|
* Auto merge of #27385 - servo:list, r=Manishearthbors-servo2020-07-241-10/+88
|\ | | | | | | Add Layout 2020 support for `display: list-item`
| * Add layout support for list markersSimon Sapin2020-07-241-2/+45
| |
| * Make a bool for `display: list-item` available to flow box constructionSimon Sapin2020-07-231-10/+45
| |
* | Use the size of the containing block, not the size of the block formattingPatrick Walton2020-07-222-53/+106
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | context, to place floats in layout 2020. The containing block for a float is not necessarily the same as the block formatting context the float is in per CSS 2.1 [1]: "For other elements, if the element’s position is relative or static, the containing block is formed by the content edge of the nearest block container ancestor box." This shows up in the simplest case: <html> <body> <div style="float: left">Hello</div> </body> </html> In this case, the `<html>` element is the block formatting context with inline size equal to the width of the window, but the `<body>` element with nonzero inline margins is the containing block for the float. The float placement must respect the content box of the `<body>` element (i.e. floats must not overlap the `<body>` element's margins), not that of the `<html>` element. Because a single block formatting context may contain floats with different containing blocks, the left and right "walls" of that containing block become properties of individual floats at the time of placement, not properties of the float context itself. Additionally, this commit generalizes the float placement logic a bit to allow the placement of arbitrary objects, not just floats. This is intended to support inline layout and block formatting context placement. This commit updates the `FloatContext` and associated tests only and doesn't actually wire the context up to the rest of layout, so floats in pages still aren't actually laid out. [1]: https://drafts.csswg.org/css2/#containing-block-details
* Add an implementation of the core float and clear placement logic in layoutPatrick Walton2020-07-202-6/+471
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 2020, not yet wired to the rest of layout. This commit implements an object that handles the 10 rules in CSS 2.1: https://www.w3.org/TR/CSS2/visuren.html#float-position The implementation strategy is that of a persistent balanced binary search tree of float bands. Binary search trees are commonly used for implementing float positioning; e.g. by WebKit. Persistence enables each object that interacts with floats to efficiently contain a snapshot of the float list at the time that object was laid out. That way, incremental layout can invalidate and start reflow at any point in a containing block. This commit features extensive use of [QuickCheck](https://github.com/BurntSushi/quickcheck) to ensure that the rules of the CSS specification are followed. Because this is not yet connected to layout, floats will not actually be laid out in Web pages yet. Note that unit tests as set up in Servo currently require types that they access to be public. Therefore, some internal layout 2020 types that were previously private have been made public. This is somewhat unfortunate. Part of #25167.
* An element establishing a formatting context *is* the containing block for ↵Simon Sapin2020-06-231-3/+3
| | | | its contents
* Auto merge of #26968 - servo:layout-2020-lazy-content-sizes, r=SimonSapinbors-servo2020-06-195-132/+71
|\ | | | | | | Compute content sizes lazily in layout 2020
| * Parallelize `BlockContainer::inline_content_sizes`Simon Sapin2020-06-191-11/+7
| |
| * Remove the now single-field `Accumulator` structSimon Sapin2020-06-191-15/+7
| |
| * Rename outer_inline* outside of sizing.rs to outer_inline_content_sizes*Simon Sapin2020-06-192-4/+3
| |
| * Compute content sizes lazily in layout 2020Anthony Ramine2020-06-185-118/+70
| |
* | Add animation and transition support for pseudo-elementsMartin Robinson2020-06-161-3/+7
|/ | | | | | | | | | This change extends the DocumentAnimationSet to hold animations for pseudo-elements. Since pseudo-elements in Servo are not in the DOM like in Gecko, they need to be handled a bit carefully in stylo. When a pseudo-element has an animation, recascade the style. Finally, this change passes the pseudo-element string properly to animation events. Fixes: #10316
* Auto merge of #26921 - mrobinson:animation-set-key, r=jdmbors-servo2020-06-161-2/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add DocumentAnimationSet and AnimationSetKey This will be used in order to hold animations for pseudo elements in the DocumentAnimationSet. Also no longer store the OpaqueNode in the animation and transition data structures. This is already part of the DocumentAnimationSet key. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes do not require tests because they should not change behavior. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
| * Add DocumentAnimationSet and AnimationSetKeyMartin Robinson2020-06-151-2/+3
| | | | | | | | | | | | | | This will be used in order to hold animations for pseudo elements in the DocumentAnimationSet. Also no longer store the OpaqueNode in the animation and transition data structures. This is already part of the DocumentAnimationSet key.
* | Make IndependentFormattingContext an enumAnthony Ramine2020-06-153-55/+76
| |
* | Make outer_inline and outer_inline_and_percentages free functionsAnthony Ramine2020-06-152-13/+14
| | | | | | | | They now take a closure that will compute the content sizes on demand.
* | Move IndependentFormattingContext::as_replaced to ↵Anthony Ramine2020-06-152-8/+8
| | | | | | | | IndependentFormattingContextContents
* | Rename contents to context in AbsolutelyPositionedBoxAnthony Ramine2020-06-152-2/+2
|/
* Use the writing mode of the containing block when accessing CSS propertiesSimon Sapin2020-06-103-24/+64
| | | | | | | | … 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.
* Store abspos boxes in a RefCell tooAnthony Ramine2020-06-094-13/+21
| | | | | | We want to mutate them when lazily computing their content sizes, but they are behind an Arc for the hoisting infra, so it also needs its own layer of inner mutability.
* Mutably borrow to do layout of independent formatting contextsAnthony Ramine2020-06-092-5/+5
| | | | | We want to compute content sizes on demand rather than eagerly so we will need to mutate the independent formatting contexts that own the content sizes.
* layout_2020: Tag fragments with their pseudo content typeMartin Robinson2020-06-065-145/+101
| | | | | This will allow us to answer queries and properly handle animations in the future for fragments generated for pseudo content.
* Owned `ServoArc<ComputedValues>` in `TraversalHandler`Simon Sapin2020-06-041-19/+9
|
* Anonymous flex item for text directly in a flex containerSimon Sapin2020-06-041-0/+24
|
* Flex items in the box treeSimon Sapin2020-06-041-0/+16
|
* Reconstruct the box tree incrementally in some caseAnthony Ramine2020-06-041-1/+139
|
* layout_2020: Add support for transitions and animationsMartin Robinson2020-05-191-0/+10
|
* Correctly paint the CSS canvas’ backgroundSimon Sapin2020-05-151-3/+83
| | | | | | | https://drafts.csswg.org/css-backgrounds/#special-backgrounds Fixes https://github.com/servo/servo/issues/25559 Closes https://github.com/servo/servo/pull/26121, as it is an alternative.
* Rewrite handling of pointers to boxes in the DOM treeSimon Sapin2020-05-151-1/+1
|