Commit graph

64 commits

Author SHA1 Message Date
Pu Xingyu
4a65dd0425 layout_2020: Implement align-content in flexbox
Align all flex lines per `align-content`.
2023-05-12 10:43:32 +08:00
bors-servo
03574d8191
Auto merge of #29719 - stshine:flexbox-justify-content, r=Loirooriol
layout 2020: Implement justify-content in flexbox

Align the items along the main-axis per justify-content.

<!-- 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-05-11 23:44:48 +02:00
Pu Xingyu
debcd30b21 layout 2020: Implement justify-content in flexbox
Align the items along the main-axis per justify-content.
2023-05-10 19:06:52 +08: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
Dirk Stolle
f2260e7c18 Fix some typos
Signed-off-by: Dirk Stolle <striezel-dev@web.de>
2022-12-17 03:22:34 +01:00
Manish Goregaokar
ba9448e682 flex 2020: Handle positioning flex item based on align-self 2020-07-20 20:16:23 -07:00
Manish Goregaokar
d1b92b68c7 flexbox 2020: Respect the stretchiness of align-self 2020-07-20 14:26:14 -07:00
Manish Goregaokar
63ac4d165c flexbox 2020: Store align_items on FlexContext 2020-07-20 14:26:14 -07:00
Manish Goregaokar
6914c51195 Handle flex item box sizing and minmax for flexbox in 2020 2020-07-20 12:22:06 -07:00
Simon Sapin
22b60d8b82 Manage side effects when redoing layout for align-self: stretch flex item 2020-06-23 10:26:24 +02:00
Simon Sapin
3e13b3be80 Flexbox: add align-self: stretch 2020-06-23 00:51:51 +02:00
Simon Sapin
01905923db First pass at implementing the Flex Layout Algorithm
https://drafts.csswg.org/css-flexbox/#layout-algorithm
2020-06-23 00:41:27 +02:00
Simon Sapin
dd0d6a2a6f Split layout_2020/flexbox.rs into modules 2020-06-10 08:43:51 +02:00