Commit graph

46062 commits

Author SHA1 Message Date
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
bors-servo
836ae5fa48
Auto merge of #29887 - Loirooriol:float-inline-size-complete, r=mrobinson
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.

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

<!-- 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-19 16:56:16 +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
ffccc5c88b
Auto merge of #29890 - servo:wpt_update_18-06-2023, r=servo-wpt-sync
Sync WPT with upstream (18-06-2023)

Automated downstream sync of changes from upstream as of 18-06-2023
[no-wpt-sync]
r? @servo-wpt-sync
2023-06-18 03:22:29 +02:00
WPT Sync Bot
60a0a6bc0f Update web-platform-tests to revision b'b31eaacb964b5e159b841d9eb18aa12e1d37867a' 2023-06-18 01:22:12 +00: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
bors-servo
0b310e6e6a
Auto merge of #29880 - mrobinson:fix-float-stacking-context-order, r=Loirooriol
Don't pass float stacking containers up to parent stacking contexts

Don't pass up float stacking containers to parent stacking contexts

Instead of passing up stacking containers created by floated content,
keep them in their original parent stacking containers. This is in in
line with specification text for stacking containers:

> To paint a stacking container, given a box root and a canvas canvas:
>
>   1.  Paint a stacking context given root and canvas, treating root as
>       if it created a new stacking context, but omitting any positioned
>       descendants or descendants that actually create a stacking context
>       (letting the parent stacking context paint them, instead).

---
<!-- 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-16 17:11:58 +02:00
Martin Robinson
ae3c22aa88
Don't pass up float stacking containers to parent stacking contexts
Instead of passing up stacking containers created by floated content,
keep them in their original parent stacking containers. This is in in
line with specification text for stacking containers:

> To paint a stacking container, given a box root and a canvas canvas:
>
>   1.  Paint a stacking context given root and canvas, treating root as
>       if it created a new stacking context, but omitting any positioned
>       descendants or descendants that actually create a stacking context
>       (letting the parent stacking context paint them, instead).
2023-06-16 17:11:00 +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
bors-servo
db684cb9f1
Auto merge of #29882 - mukilan:fix-windows-nightly, r=mrobinson
Fix windows nightly build failure

PR #29865 changed the target directory for windows to be different from the source folder. However, the 'upload-nightly' command assumes the packages are stored in the default cargo target directory (./target), so the nightly jobs for windows were failing to find the packages.

This PR fixes the 'upload-nightly' command to account for non-default target directories specified via CARGO_TARGET_DIR.

---
- [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 fix a bug in packaging logic.
2023-06-16 10:53:17 +02:00
Mukilan Thiyagarajan
715343b473 Fix windows nightly build failure.
PR #29865 changed the target directory for windows
to be different from the source folder. However,
the 'upload-nightly' command assumes the packages
are stored in the default cargo target directory
(./target), so the nightly jobs for windows were
failing to find the packages.

This PR fixes the 'upload-nightly' command to
account for non-default target directories
specified via CARGO_TARGET_DIR.
2023-06-16 12:39:24 +05:30
bors-servo
1fb7d45d5f
Auto merge of #29877 - mrobinson:unegg-tidy, r=jdm
Convert tidy to a non-egg Python package

It seems that servo-tidy is only used by webrender in my GitHub searches. WebRender could simply use `rustfmt` and the tidy on pypi hasn't been updated since 2018. Converting tidy to a normal Python package removes the maintenance burden of continually fixing the easy install configuration.

Fixes #29094.
Fixes #29334.

<!-- 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 #29094.
- [x] These changes fix #29334.
- [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-16 03:39:29 +02:00
bors-servo
a068816113
Auto merge of #29876 - mrobinson:update-float-docs, r=mrego
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.

<!-- 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-15 15:02:06 +02:00
Martin Robinson
81433a8684
Convert tidy to a non-egg Python package
It seems that servo-tidy is only used by webrender in my GitHub
searches. WebRender could simply use `rustfmt` and the tidy on pypi
hasn't been updated since 2018. Converting tidy to a normal Python
package removes the maintenance burden of continually fixing the easy
install configuration.

Fixes #29094.
Fixes #29334.
2023-06-15 13:10:06 +02:00
bors-servo
fa266abd29
Auto merge of #29873 - Loirooriol:import-assert, r=mrobinson
Avoid assert failure when using @import

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

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because they only affect debug builds, and tests run in release builds.

<!-- 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-14 18:42:59 +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
Oriol Brufau
bc634be84a Avoid assert failure when using @import 2023-06-14 15:58:00 +02:00
bors-servo
f8235ab3fb
Auto merge of #29845 - mrobinson:floats-always-on, r=Loirooriol
Layout 2020: Remove the floats preference

Enable floats always. It doesn't make sense to have this preference as it's a basic feature of an experimental layout engine.

<!-- 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-14 11:00:45 +02:00
Martin Robinson
ae819d690e
Layout 2020: Remove the floats preference
Enable floats always. It doesn't make sense to have this preference as
it's a basic feature of an experimental layout engine.
2023-06-13 19:30:54 +02:00
bors-servo
9260683b5f
Auto merge of #29848 - Loirooriol:sync, r=mrobinson
Backport several style changes from Gecko (4)

<!-- Please describe your changes on the following line: -->
This continues https://github.com/servo/servo/pull/29816.

---
<!-- 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: -->
- [ ] 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-12 12:11:30 +02:00
bors-servo
1d69e7b234
Auto merge of #29859 - mrobinson:float-negative-block-margin, r=Loirooriol
Layout 2020: Properly handle negative 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.

<!-- 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-12 09:33:48 +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
bors-servo
21c199072f
Auto merge of #29869 - servo:wpt_update_11-06-2023, r=servo-wpt-sync
Sync WPT with upstream (11-06-2023)

Automated downstream sync of changes from upstream as of 11-06-2023
[no-wpt-sync]
r? @servo-wpt-sync
2023-06-11 03:26:33 +02:00
WPT Sync Bot
d4243801cf Update web-platform-tests to revision b'04c64baa69c1692214ef350185b1ef817362a13c' 2023-06-11 01:26:17 +00:00
bors-servo
7d9839acc8
Auto merge of #29863 - nicoburns:fix-infinite-loop-when-shrinking, r=Loirooriol
Fix infinite loop in flexbox algorithm

Only apply step 5c of "resolve flexible lengths" if sum of scaled flexible shrink factors > 0
Probably fixes #29852 (but speculative as I can't get mach to run).

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (GitHub issue number if applicable)

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because ___
2023-06-10 16:54:24 +02:00
Oriol Brufau
9cdcf98165 Update test expectations 2023-06-10 02:44:05 +02:00
bors-servo
9aeed659dc
Auto merge of #29866 - mrobinson:run-unit-tests-on-main-workflow, r=atbrakhi
Run unit tests on the main Linux workflow

Not running unit tests on the main Linux workflow makes it faster, but also allows merging changes that break the unit tests. This change fixes that.

---
<!-- 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 are CI 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-09 22:41:41 +02:00
bors-servo
edd197c74e
Auto merge of #29865 - sagudev:win-target, r=mrobinson
windows workflow use C drive as target directory

Currently we clone to drive D (default drive in GitHub Actions), then copy to drive C, then build from there (due to low disk space on D drive). In this PR instead of copying to C drive we only set `CARGO_TARGET_DIR` to C drive, the build is reading source files from D and writing target files to C drive. This gets us approx. -20min.

Try-windows build available [here](https://github.com/sagudev/servo/actions/runs/5219706997/jobs/9421863750).

What do we lose? Well copying step was good benchmarker for GitHub runner machines, fast windows machines spend ~5min in copying step while slow machines ~8min.

For the future: I do believe that D drive may be faster for writing, so switching roles could benefit us, but it will require slow (like copying step) clone.
2023-06-09 20:08:47 +02:00
bors-servo
f63f981654
Auto merge of #29862 - mukilan:default-to-layout-2020, r=jdm
Use layout 2020 by default

This PR switches `./mach build` to use layout 2020 by default. It doesn't switch the nightly builds served from download.servo.org to layout 2020. I can add that change to this PR if we are ready to make the switch in nightly builds as well.

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #29843
- [x] These changes do not require tests because modify mach build configuration.
2023-06-09 15:05:50 +02:00
Martin Robinson
951a244ad1 Run unit tests on the main Linux workflow 2023-06-09 13:35:41 +02:00
Oriol Brufau
aefaa3f16c Update test expectations 2023-06-09 13:01:22 +02:00
bors-servo
b36db7f90e
Auto merge of #29860 - mrobinson:clang-format-python, r=jdm
Get clang-format from pip and upgrade to version 16

This allows relying on a specific version of clang-format and no longer use any version checks. In addition, we can use --dry-run -Werror in order to avoid having to run against every file individually.

Fix #29847.
Fix #29846.

<!-- 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 #29847 and fix #29846.
- [x] These changes do not require tests because they update dev infrastructure.

<!-- 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-09 12:08:15 +02:00
Oriol Brufau
c4dbec650a Avoid complaints from ./mach test-tidy 2023-06-09 11:18:08 +02:00
Emilio Cobos Álvarez
e03261c433 style: Remove some no longer used use statements
MANUAL PUSH: Bustage fix CLOSED TREE
2023-06-09 11:18:08 +02:00
Emilio Cobos Álvarez
01fb804320 style: Use atomic ops to read / write node flags from stylo
The flags stylo cares about reading and writing potentially at the same
time are disjoint, so there's no need for any strong memory ordering.

Differential Revision: https://phabricator.services.mozilla.com/D141829
2023-06-09 11:18:08 +02:00
Emilio Cobos Álvarez
ece2a74709 style: Put overflow: -moz-hidden-unscrollable behind a pref on Nightly
Differential Revision: https://phabricator.services.mozilla.com/D141759
2023-06-09 11:18:08 +02:00
Emilio Cobos Álvarez
32dd0b27e4 style: Honor background-color: transparent in forced colors mode
See comment as for why, and linked bugs, in particular:

  https://bugzilla.mozilla.org/show_bug.cgi?id=1755713#c16

And the following screenshot for example.

Differential Revision: https://phabricator.services.mozilla.com/D141514
2023-06-09 11:18:08 +02:00
Martin Robinson
eb96b29af0 style: Add support for parsing the content-visibility property from the CSS Contain specification
Add initial parsing support for the CSS `content-visibility` attribute.
Currently these parsed values have no effect.

Differential Revision: https://phabricator.services.mozilla.com/D140834
2023-06-09 11:18:07 +02:00
Emilio Cobos Álvarez
8016c434b0 style: Reuse inherited custom properties if they didn't change after resolution
This should be cheap and gives us a lot of memory savings for the page
on the bug, by deduplicating the inherited properties between parent and
children.

WebKit implements a similar optimization.

Differential Revision: https://phabricator.services.mozilla.com/D140826
2023-06-09 11:18:07 +02:00
Emilio Cobos Álvarez
da81d71ffa style: Make custom-property substitution only traverse variables which could have references
If a name is not in self.seen, it means we've inherited it from our
parent. That in turn means that it can't have any variable reference
(because we inherit the computed variables) and we can skip the work of
traversing it, as we'd hit the early-return in traverse() anyways.

This doesn't fix the memory usage issue of the page on the bug, which
has a giant list of properties on the root and then a custom property
specified on all elements, but should significantly reduce the time we
spend iterating over custom properties for all those elements.

Differential Revision: https://phabricator.services.mozilla.com/D140825
2023-06-09 11:18:07 +02:00
Emilio Cobos Álvarez
b798336f81 style: Generalize moz-os-version into moz-platform
Allow differentiating non-windows platforms on it.

Differential Revision: https://phabricator.services.mozilla.com/D138431
2023-06-09 11:18:07 +02:00
Oriol Brufau
e2901169c8 Further changes required by Servo 2023-06-09 11:18:07 +02:00
Emilio Cobos Álvarez
2a67752418 style: Style system and plumbing for mix-blend-mode: plus-lighter
Differential Revision: https://phabricator.services.mozilla.com/D137951
2023-06-09 11:18:07 +02:00
Oriol Brufau
ebfbd2d9c0 Further changes required by Servo 2023-06-09 11:18:07 +02:00
Mike Hommey
d3aeba6bd3 style: Use the mozbuild crate in servo
Differential Revision: https://phabricator.services.mozilla.com/D136562
2023-06-09 11:18:06 +02:00
Mike Hommey
d32c5ed85f style: Remove MOZ_DIST
As mentioned in bug 1747354, the location of the dist directory is
relied to be $topobjdir/dist, so just use that consistently rather
than getting it from a separate variable for rust build scripts.

Differential Revision: https://phabricator.services.mozilla.com/D136556
2023-06-09 11:18:06 +02:00
Oriol Brufau
54878595b3 Further changes required by Servo 2023-06-09 11:18:06 +02:00
Emily McDonough
199f54342c style: Add style_traits::ToCss for AtomIdent
Differential Revision: https://phabricator.services.mozilla.com/D136290
2023-06-09 11:18:06 +02:00
Oriol Brufau
f39ab4ffc1 Further changes required by Servo 2023-06-09 11:18:06 +02:00
Emily McDonough
01c6eb3556 style: Implement basic @page-rule selector parsing
This does not support any of the pseudo page types.

Differential Revision: https://phabricator.services.mozilla.com/D131532
2023-06-09 11:18:05 +02:00