Commit graph

45781 commits

Author SHA1 Message Date
bors-servo
68879b883d
Auto merge of #29740 - mrobinson:refactor-2020-layout-for-scroll-tree, r=mukilan
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.

<!-- 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-05-17 10:59:18 +02: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
Oriol Brufau
773ddf31fe style: Support the type() function in image-set
Differential Revision: https://phabricator.services.mozilla.com/D109201
2023-05-17 02:12:40 +02:00
Oriol Brufau
7567ddd262 style: Hide -moz-outline-radius behind a pref
This property does nothing since bug 315209 got implemented.

Every single user that I checked was doing the same math by hand, so
hooray for good defaults :-)

Differential Revision: https://phabricator.services.mozilla.com/D112253
2023-05-17 02:12:40 +02:00
Oriol Brufau
90a2687545 style: Add a CSS error to the console when using non-featureless :host selectors
(which would never match by definition).

Differential Revision: https://phabricator.services.mozilla.com/D111610
2023-05-17 02:12:40 +02:00
Oriol Brufau
7425f2d922 style: Enable forced-colors in UA and chrome always
Differential Revision: https://phabricator.services.mozilla.com/D112069
2023-05-17 02:12:40 +02:00
Oriol Brufau
b5dcb5c961 Further changes required by Servo 2023-05-17 02:12:21 +02:00
Oriol Brufau
e23a8bf0ad style: Add attribute names to the bloom filter
Safari does this. This reduces the runtime in the example linked from
comment 0 quite a lot (40ms on a local opt build, from ~130ms on a
release nightly build).

I added a pref because there's a slight chance of performance
regressions on pages that do not use attribute selectors, as we're now
doing more unconditional work per element (adding the attributes to the
bloom filter). But the trade-off should be worth it, I think.

Differential Revision: https://phabricator.services.mozilla.com/D111689
2023-05-16 23:40:23 +02:00
Oriol Brufau
a7ca8022d3 style: [css-pseudo] Use 'white-space: pre' by default in ::marker
Differential Revision: https://phabricator.services.mozilla.com/D107359
2023-05-16 23:40:23 +02:00
Oriol Brufau
d8993eef7e Further changes required by Servo 2023-05-16 23:40:17 +02:00
Oriol Brufau
743f213c25 style: Move moz-control-character-visibility out of mako, and remove support for gecko_pref_controlled_initial_value
No behavior change, just cleanup. Actually seem this technically _adds_ some code even
though it's a cleanup, but that's mostly because of the wrapping of the
derive list.  The resulting code is simpler (more in-line with our usual
things, so I think it's an improvement).

Differential Revision: https://phabricator.services.mozilla.com/D111551
2023-05-16 23:17:16 +02:00
Oriol Brufau
fac547276f style: Remove various image-orientation related prefs
These shipped in 77.

Differential Revision: https://phabricator.services.mozilla.com/D111550
2023-05-16 23:16:24 +02:00
Oriol Brufau
693c2f0d27 style: Remove -moz-proton-infobars media query support
Differential Revision: https://phabricator.services.mozilla.com/D110963
2023-05-16 23:15:26 +02:00
Oriol Brufau
b40f4b6fec style: Clean up text-justify, and make distribute a parse-time alias
Since it's simpler, as discussed in the CSSWG issue.

Differential Revision: https://phabricator.services.mozilla.com/D111346
2023-05-16 23:14:19 +02:00
Oriol Brufau
bbc03a2577 style: Enable Proton Urlbar
Differential Revision: https://phabricator.services.mozilla.com/D110998
2023-05-16 23:13:14 +02:00
Oriol Brufau
7bb15f19f1 style: Remove dead prefers-color-scheme: no preference code
It was removed in bug 1643656.

Differential Revision: https://phabricator.services.mozilla.com/D111461
2023-05-16 23:12:19 +02:00
Oriol Brufau
3da3d76a08 style: Clean up NPAPI plugin fallback behavior
Similifies use of EventStates and ObjectType/FallbackType enums since most states they represented are no longer valid with the removal of NPAPI plugins.  The state machine for (unsupported) plugin elements is now much simpler but still distinguishes between HTML fallbacks, fallbacks leading to a "BROKEN" state (e.g. failing to load the image the element refers to), and fallbacks that would simply lead the element to occupy an empty region.  The last type of fallback is behind a pref "layout.use-plugin-fallback" and is disabled by default.

Simplifying the state machine allows us to clean up nsObjectLoadingContent.  We also update many of the enums which refered to plugins, which would otherwise get confusing.

Differential Revision: https://phabricator.services.mozilla.com/D107158
2023-05-16 23:03:45 +02:00
Oriol Brufau
f44a6909df style: Reduce boilerplate needed to add system-metric media features
There's no reason we can't just query LookAndFeel and we need to use
sSystemMetrics. In the past, LookAndFeel queries were not cached, but
this is no longer the case, so perf wise should be pretty equivalent.

Note that we don't need the NS_SUCCEEDED checks because the default
value from GetInt if the platform doesn't support it is 0 anyways.

Differential Revision: https://phabricator.services.mozilla.com/D110805
2023-05-16 23:02:50 +02:00
Oriol Brufau
3d9eabcccb style: Convert proton pref checks from @supports rules to media features
This means that dynamic changes will be handled correctly, we can use
StaticPrefs, etc.

Differential Revision: https://phabricator.services.mozilla.com/D110816
2023-05-16 23:01:29 +02:00
Oriol Brufau
7c26fb82b1 style: add an appearance type that forces a dropshadow on menus on Windows, and uses SetWindowRgn to clip the popup to the border radius
Differential Revision: https://phabricator.services.mozilla.com/D109833
2023-05-16 23:00:33 +02:00
Oriol Brufau
8a16ba74ec Further changes required by Servo 2023-05-16 22:58:48 +02:00
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