Commit graph

194 commits

Author SHA1 Message Date
Martin Robinson
30ab348116 Properly position absolutes with static insets that are children of floats
Previously, final float positions were calculated when their parents
were positioned. This prevented proper positioning of absolute children
of floats with static insets, because they accumulate offsets as they
are hoisted up the tree.

This change moves the final float positioning to
`PlacementState::place_fragment` for the float itself so that it happens
before any insets are updated for hoisted descendants. In addition to
simplifying the code, this makes it a bit more efficient. Finally,
floats are taken into account when updating static insets of hoisted
boxes.

Fixes #29826.
2023-06-22 01:55:21 +02:00
Oriol Brufau
0dd6abe023 Fix interaction of clearance with margin collapse
In #29897 I did the simple naive thing, but it wasn't entirely correct.
This patch tries to address the problems. In particular:

 - Clearance should prevent margins from collapsing through if it
   happens between them, as opposed to on the element that owns them.
 - The margins of an element with clearance can still collapse through,
   and collapse with other siblings as normal, but the resulting
   margin can't collapse with the bottom margin of the parent.
2023-06-21 18:00:05 +02:00
bors-servo
fa7107ac12
Auto merge of #29894 - mrobinson:ditch-static-position-closure, r=Loirooriol
Simplify layout of absolutes with static insets

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.

<!-- 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 do not require tests because it 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. -->
2023-06-21 08:16:49 +02:00
bors-servo
07bbbad5f9
Auto merge of #29897 - Loirooriol:clearance-prevents-margin-collapse, r=mrobinson
Prevent margins from collapsing through when separated by clearance

This fixes #29884 and improves #29896.

<!-- 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 #29884 and improve #29896
- [X] There are tests for these changes

<!-- 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. -->
2023-06-20 23:22:41 +02:00
Oriol Brufau
00a5a4e6c4 Prevent margins from collapsing through when separated by clearance
This fixes #29884 and improves #29896.
2023-06-20 21:27:54 +02:00
bors-servo
47714f767e
Auto merge of #29870 - mrobinson:float-root, r=Loirooriol
Layout 2020: Correct rendering of floated root

Fix two issues around floating a root element:

1. In the StackingContext code handle the case where a root element is a Float fragment and not a Box fragment. This fixes a debug assertion failure in the css/CSS2/float/float-root.html test.
2. When initializing the SequentialLayoutState, use the containing block width as the maximum inline float placement position instead of infinity. This fixes the rendering of css/CSS2/float/float-root.html.

Note that css/CSS2/float/float-root.html was passing before, because both the test and reference were subject to the same bug. This fixes a couple other tests as well.

<!-- 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] There are tests for these changes

<!-- 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. -->
2023-06-20 18:36:03 +02:00
Martin Robinson
4cb4332602
Correct rendering of floated root
Fix two issues around floating a root element:

1. In the StackingContext code handle the case where a root element is a
   Float fragment and not a Box fragment. This fixes a debug assertion
   failure in the css/CSS2/float/float-root.html test.
2. When initializing the SequentialLayoutState, use the containing block
   width as the maximum inline float placement position instead of
   infinity. This fixes the rendering of css/CSS2/float/float-root.html.

Note that css/CSS2/float/float-root.html was passing before, because
both the test and reference were subject to the same bug. This fixes a
couple other tests as well.
2023-06-20 17:46:45 +02:00
Martin Robinson
459a7d26aa
Simplify layout of absolutes with static insets
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.
2023-06-20 11:44:25 +02: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
bors-servo
47fb54fc54
Auto merge of #29883 - Loirooriol:float-inline-size, r=mrobinson
Implement BlockLevelBox::inline_content_sizes for floats

This improves #29874, but `BlockContainer::inline_content_sizes` will still need more changes in order to correctly handle sequences of floats.

<!-- 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
- [ ] These changes fix #___ (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. -->
2023-06-16 20:03:36 +02:00
Oriol Brufau
66c4eee082 Implement BlockLevelBox::inline_content_sizes for floats
This improves #29874, but BlockContainer::inline_content_sizes will still
need more changes in order to correctly handle sequences of floats.
2023-06-16 15:46:35 +02:00
Martin Robinson
3b3dc4adbe
Layout 2020: Fix issues with float implementation documentation
Fix some rustdoc comments which won't process properly unless they start
with three '/' characters. In addition, improve the name of a function
and add some missing documentation.
2023-06-14 17:09:56 +02:00
Martin Robinson
bc58bb080f Layout 2020: Properly handle negative block margins in floats
If a float has negative block margins, it should be pushed upward, but
shouldn't affect the positioning of any floats that came before it. It
should lower the ceiling though when it still has some non-negative
block contribution. In order to implement this behavior, we should only
place the float considering its non-negative block length contribution. If
the float is pushed up completely past it's "natural" position, it
should be placed like a float with zero block size.
2023-06-11 11:47:56 +02:00
Oriol Brufau
5e1f059de2 Improve margin collapse in layout-2020
According to https://drafts.csswg.org/css2/#collapsing-margins, bottom
margins should only collapse with the last child if `height` is `auto`.
Also, the note mentions `min-height: 0`, but the normative text doesn't
have such requirement, so I'm dropping it, matching WebKit.

The previous logic is moved into the case of collapsing the top and
bottom margins of the same element, since this can happen either with
`height: auto` or `height: 0`, and requires `min-height: 0`.
2023-06-08 11:05:57 +02:00
bors-servo
6cf6b53b68
Auto merge of #29827 - mrobinson:fragment-tree-directory, r=atbrakhi
Layout 2020: Move all Fragment code to the `fragment_tree` directory

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.

<!-- 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 do not require tests because they do 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. -->
2023-06-04 20:06:31 +02:00
Martin Robinson
e563927718 Layout 2020: Move all Fragment code to the fragment_tree directory
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.
2023-06-04 18:12:11 +02:00
Pu Xingyu
a103d85405 layout_2020: Allow end margin to collapse with children if height is
set to zero

Previously, end margin was allowed to collapse only when block size is
not set.
2023-06-04 22:31:06 +08:00
Martin Robinson
5c5cc4b795 Fix the unit test
These were broken for various issues.
2023-06-03 06:10:17 +02:00
Martin Robinson
25f6cc04a2 Do not hoist floated fragments
Instead of hoisting floated fragments to be siblings of the fragment
created by their containing block formatting context, keep them in
"normal" fragment tree position and adjust their positioning to be
relative to the containing block. This means that float fragments follow
the existing invariants of the fragment tree and properly handle hit
testing, painting order, and relative positioning.

The tradeoff here is more complexity tracking the containing block
offsets from the block formatting context (including handling collapsed
margins), but less complexity dealing with hoisting / shared ownership
in addition to the correctness benefits.

Some tests are failing now because this change revealed some additional
shortcomings with clearing block formatting context content size past
the end of their contained floats. This will be fixed in a followup
change.

Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2023-06-03 06:10:17 +02:00
Patrick Walton
cdec48328e Place floats in layout 2020, but don't flow text around the floats yet.
This commit puts floats behind the `layout.floats.enabled` pref, because of the
following issues and unimplemented features:

* Inline formatting contexts don't take floats into account, so text doesn't
  flow around the floats yet.

* Non-floated block formatting contexts don't take floats into account, so BFCs
  can overlap floats.

* Block formatting contexts that contain floats don't expand vertically to
  contain all the floats. That is, floats can stick out the bottom of BFCs,
  contra spec.
2023-06-03 06:09:21 +02:00
bors-servo
053a0aa4fd
Auto merge of #29803 - stshine:no-margins, r=Loirooriol
layout_2020: Only count for content size for height of non-replaced inline elements

<!-- Please describe your changes on the following line: -->

Accorinding to https://drafts.csswg.org/css2/#inline-non-replaced, The vertical padding, border and margin of an inline, non-replaced box start at the top and bottom of the content area, and has nothing to do with the line-height. But only the line-height is used when calculating the height of the line box.

---
<!-- 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

<!-- 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. -->
2023-06-03 03:27:56 +02:00
bors-servo
0ea942f00f
Auto merge of #29799 - stshine:align-self-stretch, r=Loirooriol
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. -->
2023-06-01 23:52:08 +02:00
Pu Xingyu
8a6a4e7550 layout_2020: Only count for content size for height of non-replaced
inline elements

Accorinding to https://drafts.csswg.org/css2/#inline-non-replaced, The
vertical padding, border and margin of an inline, non-replaced box
start at the top and bottom of the content area, and has nothing to do
with the line-height. But only the line-height is used when
calculating the height of the line box.
2023-06-01 05:07:52 +08:00
Pu Xingyu
5c71219819 layout_2020: Check blocks for whether they will establish a formatting context 2023-05-31 23:28:28 +08:00
Pu Xingyu
1dbd74f389 layout_2020: Add an optional box size parameter to ReplacedContent::used_size_as_if_inline_element
This allow us to specify the used size when calculating size of
replaced content.
2023-05-27 09:03:40 +08:00
Martin Robinson
b60e105526 Refactor Layout 2020 layout for a compositor-side scroll tree
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.
2023-05-17 10:46:27 +02:00
Martin Robinson
72b5fcd0b6 Combine DOM-related concepts in Layout 2020 into dom.rs 2023-05-13 11:52:59 +02:00
Martin Robinson
e167526618 Better implement getComputedStyle() for positioned insets
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.
2023-05-09 12:07:20 +02:00
Martin Robinson
72302e2dae Detect body elements during layout
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.
2023-05-04 10:46:27 +02:00
Martin Robinson
0c13fcb9f2 Rework CB management during stacking context tree construction
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.
2023-05-03 10:43:56 +02:00
Oriol Brufau
2692426103 Fix text-decoration for block containers in layout-2020
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.
2023-04-26 20:44:01 +02:00
bors-servo
7114b31cf7
Auto merge of #29650 - Loirooriol:text-indent, r=mrobinson
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. -->
2023-04-26 01:11:55 +02:00
Oriol Brufau
c842023741 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.
2023-04-25 23:01:07 +02:00
Martin Robinson
404ee8b984 Fix scrolling from script in Layout 2020
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.
2023-04-25 21:25:01 +02:00
Martin Robinson
9e0b41ebc4 Add support for <iframe> elements for Layout 2020
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.
2023-04-04 17:49:24 +02:00
Naveen Gattu
0e3b52af27 fmt 2021-11-30 18:13:39 -08:00
Naveen Gattu
00a7c172e2
rm ws 2021-11-30 12:54:15 -08:00
Naveen Gattu
9af545e4e4
Do not use ParallelIterator if not using rayon 2021-11-30 12:51:56 -08:00
yvt
638941ac43 refactor(layout_2020): add depth parameter to the closure passed to FragmentTree::find 2021-06-16 00:56:41 +09:00
Josh Matthews
260347e5dc Simplify control flow of whitespace handling. 2020-07-27 20:06:55 -04:00
Josh Matthews
d8b4dab4e3 Implement basic white-space: pre support for layout 2020. 2020-07-27 20:06:53 -04:00
Manish Goregaokar
5a53fb1271 Adjust absolute positioned box offsets in flow layout 2020-07-27 09:48:37 -07:00
Manish Goregaokar
96c0c50874 Allow adjusting box offsets 2020-07-27 09:48:37 -07:00
bors-servo
9864e4ce6c
Auto merge of #27385 - servo:list, r=Manishearth
Add Layout 2020 support for `display: list-item`
2020-07-24 21:18:16 -04:00
Simon Sapin
b91e293819 Add layout support for list markers 2020-07-24 09:31:24 +02:00
Simon Sapin
82e274aec9 Make a bool for display: list-item available to flow box construction 2020-07-23 16:43:57 +02:00
Patrick Walton
362b64aa68 Use the size of the containing block, not the size of the block formatting
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
2020-07-22 19:58:28 -07:00
Patrick Walton
5b36d211b4 Add an implementation of the core float and clear placement logic in layout
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.
2020-07-20 12:42:34 -07:00
Simon Sapin
080f5bb763 An element establishing a formatting context *is* the containing block for its contents 2020-06-23 00:41:26 +02:00
bors-servo
53263595f1
Auto merge of #26968 - servo:layout-2020-lazy-content-sizes, r=SimonSapin
Compute content sizes lazily in layout 2020
2020-06-19 13:50:29 -04:00