Commit graph

45810 commits

Author SHA1 Message Date
Oriol Brufau
4b973885a3 style: Add the size-adjust descriptor to the style system
Differential Revision: https://phabricator.services.mozilla.com/D110022
2023-05-16 22:58:04 +02:00
Oriol Brufau
3024516019 Further changes required by Servo 2023-05-16 22:43:09 +02:00
Oriol Brufau
4d2ccaf445 style: Use a single system font definition rather than two
Follow the pattern we use for system colors.

Differential Revision: https://phabricator.services.mozilla.com/D108822
2023-05-16 13:16:53 +02:00
Oriol Brufau
7da6d525ac Further changes required by Servo 2023-05-16 13:04:55 +02:00
Oriol Brufau
1cd257d54f style: Add ascent-, descent- and line-gap-override descriptors to the style system
Differential Revision: https://phabricator.services.mozilla.com/D109287
2023-05-16 13:04:36 +02:00
Oriol Brufau
5ef832b778 style: Convert the font-stretch descriptor to use NonNegativePercentage
Depends on D109285

Differential Revision: https://phabricator.services.mozilla.com/D109286
2023-05-16 13:04:14 +02:00
Oriol Brufau
4d4fb4b414 style: Create a NonNegativePercentage type in values:specified
Differential Revision: https://phabricator.services.mozilla.com/D109285
2023-05-16 13:03:52 +02:00
Oriol Brufau
3b2eef3d7d style: Part 2 - Add page-size attribute to nsStyleStruct and property parsing
This parsing is hidden behind the pref layout.css.page-size.enabled.

It isn't ideal that we parse this as a property, but we can't treat it as a
descriptor because of compatibility issues with other browsers. There are also
outstanding spec issues related to how descriptors like page-size are cascaded,
and whether the !important specifier is valid or not.

Differential Revision: https://phabricator.services.mozilla.com/D103958
2023-05-16 13:02:53 +02:00
Oriol Brufau
cdce0d3b34 style: Part 1 - Ignore any properties which aren't valid for a style rule when generating CSS2Properties and testing propertie
To know the valid rules for each property, we need to put this information
into the Servo prop list and add an appropriate getter to Longhand/Shorthand.

Differential Revision: https://phabricator.services.mozilla.com/D105825
2023-05-16 13:02:34 +02:00
Oriol Brufau
cbf2a91ec8 style: Remove unused -moz-default-appearance values -moz-mac-vibrancy-light/dark, and the system colors of the same name
Starting with macOS 10.14, the generic light/dark vibrancy is deprecated, and semantic vibrancy names are preferred.
If we ever need more vibrancy, we can add new values with semantic names.

Depends on D107910

Differential Revision: https://phabricator.services.mozilla.com/D108152
2023-05-16 13:02:17 +02:00
Oriol Brufau
261dcf1f6d Further changes required by Servo 2023-05-16 13:01:58 +02:00
Oriol Brufau
b0a1eaebaa style: Respect system colors in the color and background-color properties
The reason why this doesn't work is because these styles come from
datetimebox.css, which is really an author style.

We could special-case these elements, but the approach that the CSSWG resolved
on for the new forced-colors spec is to respect system colors specified by
authors, see:

https://drafts.csswg.org/css-color-adjust-1/#forced-colors-properties

So this moves us towards that, and fixes the issue nicely.

Differential Revision: https://phabricator.services.mozilla.com/D108321
2023-05-16 13:01:35 +02:00
Oriol Brufau
ed19da405f style: Invalidate a bit more aggressively when a pseudo-element matches, in order to also invalidate the cached pseudo-styles on the parent
This should probably be fine. If it becomes a perf issue somehow we can
implement the RESTYLE_PSEUDOS hint or what not.

Differential Revision: https://phabricator.services.mozilla.com/D108338
2023-05-16 13:01:18 +02:00
Oriol Brufau
1be19485bb style: Make -moz-accent-color reflect the windows accent color
And remove the windows-specific versions of this color.

Also fix the hard-coded defaults by the colors I get in the default windows
theme.

Differential Revision: https://phabricator.services.mozilla.com/D108325
2023-05-16 13:00:51 +02:00
Oriol Brufau
60e206143c Further changes required by Servo 2023-05-16 13:00:18 +02:00
Oriol Brufau
060d74ba3b style: Share CascadeData instances across ShadowRoots
This should be both a memory and speed win for pages using a lot of
Shadow DOM.

In order to make the cache properly work we need to start keying media query
results on the actual StyleSheetContents, as that's what we share on Gecko, but
that should all be fine.

Differential Revision: https://phabricator.services.mozilla.com/D107266
2023-05-16 13:00:08 +02:00
Oriol Brufau
11153c63fa style: Make the cascade data cache generic
We're going to use it both for UA sheets and for author styles in Shadow
DOM.

Differential Revision: https://phabricator.services.mozilla.com/D107265
2023-05-16 12:59:46 +02:00
Oriol Brufau
b38517757f style: Remove layout.css.ruby.position-alternate.enabled pref
Differential Revision: https://phabricator.services.mozilla.com/D114044
2023-05-16 12:59:19 +02:00
Oriol Brufau
17ae374c65 style: part 1 - Support parsing ruby-position: alternate
Differential Revision: https://phabricator.services.mozilla.com/D107382
2023-05-16 12:56:06 +02:00
Oriol Brufau
b222bd3162 style: Paper over a crash in non-nightly
Differential Revision: https://phabricator.services.mozilla.com/D107400
2023-05-16 12:55:42 +02:00
Oriol Brufau
108c50c6df Further changes required by Servo 2023-05-16 12:54:55 +02:00
Oriol Brufau
4cee8cf937 style: Support image-set in the content property
Differential Revision: https://phabricator.services.mozilla.com/D107397
2023-05-16 12:54:05 +02:00
Oriol Brufau
5c3be71f25 style: Have collect_completion_keywords return url and image-set for CursorImage
Differential Revision: https://phabricator.services.mozilla.com/D107381
2023-05-16 12:53:17 +02:00
Oriol Brufau
2bafbb46f5 style: Address spec changes re. color-mix
It was clarified that the percentages are weights, and two weights are
now allowed. Missing percentages are computed as 100% - the other or
50%. Other than that, commas are required etc, which is good since
that's how I implemented it originally.

Differential Revision: https://phabricator.services.mozilla.com/D107295
2023-05-16 12:51:27 +02:00
Oriol Brufau
685d269e31 style: Support image-set() on the cursor property
Differential Revision: https://phabricator.services.mozilla.com/D106745
2023-05-16 12:50:55 +02:00
Oriol Brufau
e1f254854d Further changes required by Servo 2023-05-16 12:50:25 +02:00
Oriol Brufau
980d10fc17 style: Implement basic color-mix() functionality, behind a pref, but exposed to chrome code
This is straight-forward and builds on the color animation code. This
implements only the <percentage> syntax, not the whole <color-adjuster>
syntax, which seems fairly more complex.

Of course, this only uses sRGB because that's all the colors we support,
but it should be feasible to extend to lab() / lch() colors once we
support those.

I believe this subset of syntax is useful and worth implementing, so
people can play with it and say if it's useful.

Differential Revision: https://phabricator.services.mozilla.com/D106698
2023-05-16 12:50:01 +02:00
Oriol Brufau
252b50931d Further changes required by Servo 2023-05-16 12:49:39 +02:00
Oriol Brufau
291b3ee573 style: Move extremum lengths to the individual Size / MaxSize types
This will prevent growing them when introducing fit-content(<length>).

This can _almost_ be derived, if it wasn't because of the quirky stuff.
I think the macro is probably good enough for now but let me know if you
disagree.

Differential Revision: https://phabricator.services.mozilla.com/D106713
2023-05-16 12:48:55 +02:00
Oriol Brufau
320f12aa07 style: Simplify StyleColor representation
There's no need for CurrentColor / Numeric variants when we can
represent them with the complex form.

Differential Revision: https://phabricator.services.mozilla.com/D106690
2023-05-16 12:48:27 +02:00
Oriol Brufau
efea71ff9b style: Cherry-pick various servo changes
All formatting and not-part-of-the-gecko-build changes.

Differential Revision: https://phabricator.services.mozilla.com/D106634
2023-05-16 08:14:58 +02:00
bors-servo
c5d31c3ab6
Auto merge of #29743 - Loirooriol:disable-style-fmt, r=mrobinson
Disable formatting for components/style/

Gecko doesn't enforce proper formatting, so disabling it will make it easier to backport changes from there.

<!-- 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: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because there is no change in 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-05-15 20:33:39 +02:00
Oriol Brufau
e6ace3acae Disable formatting for components/style/
Gecko doesn't enforce proper formatting, so disabling it will make it
easier to backport changes from there.
2023-05-15 17:45:25 +02:00
bors-servo
17e1582ed4
Auto merge of #29737 - servo:wpt_update_14-05-2023, r=servo-wpt-sync
Sync WPT with upstream (14-05-2023)

Automated downstream sync of changes from upstream as of 14-05-2023
[no-wpt-sync]
r? @servo-wpt-sync
2023-05-15 07:11:20 +02:00
WPT Sync Bot
06e9d5a631 Update web-platform-tests to revision b'c9946198c9ee19db3b4974a388fae45da844a94a' 2023-05-14 01:39:34 +00:00
bors-servo
8dfd613aa1
Auto merge of #29727 - mrobinson:more-layout-dom-cleanup, r=jdm
More cleanup of the layout DOM wrappers

This PR includes two commits which continue to clean up the layout DOM wrappers.
 - in the first the unused `DangerousThreadSafeLayoutNode` trait is removed
 - in the second DOM-related code is combined into one source file in Layout 2020 and some traits are combined and removed.

---
<!-- 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 #29688
- [x] These changes fix #29722
- [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-05-13 16:32:55 +02:00
Martin Robinson
72b5fcd0b6 Combine DOM-related concepts in Layout 2020 into dom.rs 2023-05-13 11:52:59 +02:00
bors-servo
45dd2764af
Auto merge of #29733 - mukilan:workaround-gstreamer-dylib-issue, r=mrobinson
Workaround bug in gstreamer binaries

The official gstreamer .pkg distribution should contain 'relocatable' dylibs, but as discovered in #29732, some dylibs have absolute links to liblzma.5.dylib ("/usr/local/opt/xz/lib/liblzma.5.dylib")

Since /opt/homebrew is the default install location on Apple Silicion, this will cause the packaging & build steps to fail, even if 'xz' package is installed via homebrew.

This is a temporary fix until upstream fixes the bug and makes the package truly 'relocatable'. Users
with non-default homebrew prefixes will still have the issue.

Thanks to @atbrakhi  for helping me debug and test the patch on her mac.

<!-- 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 #29732 (GitHub issue number if applicable)

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because they fix the broken build process.

<!-- 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-13 05:48:04 +02:00
bors-servo
84982ff1ff
Auto merge of #29730 - stshine:flexbox-align-content, r=Loirooriol
layout_2020: Implement align-content in flexbox

Align all flex lines per `align-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

<!-- 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-05-12 17:31:46 +02:00
Pu Xingyu
ea599c88df Update wpt expectations 2023-05-12 22:29:17 +08:00
Mukilan Thiyagarajan
80087f31c8 Workaround bug in gstreamer binaries
The official gstreamer .pkg distribution should contain
'relocatable' dylibs, but as discovered in #29732,
some dylibs have absolute links to liblzma.5.dylibs

Since /opt/homebrew is the default install location
on Apple Silicion, this will cause the packaging &
build steps to fail, even if 'xz' package is installed
via homebrew.

This is a temporary fix until upstream fixes the bug
and makes the package truly 'relocatable'.

Signed-off-by: Mukilan Thiyagarajan <me@mukilan.in>
2023-05-12 19:03:47 +05:30
Martin Robinson
ab4bd2a133 Remove DangerousThreadSafeLayoutNode
Remove this trait and replace it by two non-public functions on
ServoThreadSafeLayoutNode. This requires making the iterator not
generic, which simplifies things a little bit as well.
2023-05-12 08:18:31 +02:00
bors-servo
d798376d7c
Auto merge of #29731 - mukilan:consumer-offical-gstreamer-for-macos, r=mrobinson
Consume official GStreamer binaries on MacOS

This PR re-enables support for the gstreamer mediastack in macOS by consuming the official binary '.pkg' files from gstreamer.freedesktop.org

To maintain symmetry with other platforms, the '.pkg' files are uploaded to servo-build-deps and fetched from there using the new script 'etc/install_macos_gstreamer.sh'.

Unlike the Homebrew version, the official GStreamer is distributed as a 'relocatable' framework i.e the dylibs all have @rpath-relative install names and also link to other dylibs using @rpath relative path. To address this difference the 'servo' binary needs to be patched with 'install_name_tool' to add an LC_RPATH command that sets the relative paths that the dynamic linker should search when trying to satify dependencies. In Servo's case, this will be a path relative to the 'servo' binary itself i.e '@executable_path/lib/'

The additional 'lib' is due to a flaw in the gstreamer packaging where the install names of some of the dylibs have the prefix '@rpath/lib' and some of them just have '@rpath'.

This PR also fixes a couple of issues present in the `mach build` process on MacOS:
1. `mach build` process was not copying transitive dependencies of servo binary but only the first level dylibs
2. `mach build` process didn't patch the links to dylibs in servo binary (and dependencies). This meant though (some) dylibs were copied to local path, the binary still loaded the dylibs from system GStreamer installation i.e homebrew instead of the copieds dylibs

The build and runtime dependencies in etc/homebrew/Brewfile and etc/homebrew/Brewfile-build have also been removed in This PR.

<!-- 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 #29653 me

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because they broken build and package process.

<!-- 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-12 08:15:52 +02:00
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
bors-servo
9bec0d0f8e
Auto merge of #29728 - Loirooriol:sync-fontprovider-D157589, r=mrobinson
Simplify our setup for font metric queries from style

This is a backport of https://phabricator.services.mozilla.com/D157589,
by Emilio Cobos Álvarez, plus some additions so that Servo compiles,
and some parts from https://phabricator.services.mozilla.com/D144455.

Should have no change in behavior.

<!-- 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: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because there should be no change in 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-05-11 21:04:45 +02:00
Oriol Brufau
ab2ba273e3 Simplify our setup for font metric queries from style
This is a backport of https://phabricator.services.mozilla.com/D157589,
by Emilio Cobos Álvarez, plus some additions so that Servo compiles,
and some parts from https://phabricator.services.mozilla.com/D144455.

Should have no change in behavior.
2023-05-11 21:02:15 +02:00
Mukilan Thiyagarajan
8cfb19a8fb Consume official GStreamer binaries on MacOS
This PR re-enables support for the gstreamer mediastack
in macOS by consuming the official binary '.pkg' files
from gstreamer.freedesktop.org

To maintain symmetry with other platforms, the '.pkg'
files are uploaded to servo-build-deps and fetched from
there using the new script 'etc/install_macos_gstreamer.sh'.

Unlike the Homebrew version, the official GStreamer is
distributed as a 'relocatable' framework i.e the dylibs all
have @rpath-relative install names and also link to other
dylibs using @rpath relative path. To address this difference
the 'servo' binary needs to be patched with 'install_name_tool'
to add an LC_RPATH command that sets the relative paths
that the dynamic linker should search when trying to satify
dependencies. In Servo's case, this will be a path relative to
the 'servo' binary itself i.e '@executable_path/lib/'

The additional 'lib' is due to a flaw in the gstreamer
packaging where the install names of some of the dylibs
have the prefix '@rpath/lib' and some of them just have '@rpath'.

This PR also fixes a couple of issues present in the
`mach build` process on MacOS:
1. `mach build` process was not copying transitive dependencies
   of servo binary but only the first level dylibs
2. `mach build` process didn't patch the links to dylibs
   in servo binary (and dependencies). This meant though
   (some) dylibs were copied to local path, the binary
   still loaded the dylibs from system GStreamer installation
   i.e homebrew instead of the copieds dylibs

The build and runtime dependencies in etc/homebrew/Brewfile
and etc/homebrew/Brewfile-build have also been removed in This
PR.

Signed-off-by: Mukilan Thiyagarajan <me@mukilan.in>
2023-05-12 00:14:38 +05:30
bors-servo
feaa66b597
Auto merge of #29729 - Loirooriol:sync-cap-D133101, r=mrobinson
Add support for the 'cap' font-relative unit

This is a backport of https://phabricator.services.mozilla.com/D133101, by Jonathan Kew.

Note that Servo isn't using font metrics yet, so the unit still won't really work.

<!-- 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: -->
- [ ] 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 18:41:09 +02:00
bors-servo
425b0fe641
Auto merge of #29726 - paricbat:urlsearchparams-has-delete, r=mrobinson
Add value argument to URLSearchParams's has() and delete()

<!-- Please describe your changes on the following line: -->
My first attempt at contributing Rust code!
Add the value argument to `has()` and `done()` as in [the spec](https://url.spec.whatwg.org/#dom-urlsearchparams-delete).

---
<!-- 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  #29725 (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 08:36:09 +02:00