Commit graph

45973 commits

Author SHA1 Message Date
Oriol Brufau
1ac55889bb Further changes required by Servo 2023-06-09 10:22:23 +02:00
Emilio Cobos Álvarez
50510715a2 style: Fix style attribute important and revert-layer behavior
By modeling it as a separate layer that behaves somewhat specially.

See https://github.com/w3c/csswg-drafts/issues/6872.

The remaining revert-layer tests that we fail are because either we
don't implement a feature (like @property) or because it's used in
keyframes (where revert is a bit unspecified and we have existing
issues with it).

Differential Revision: https://phabricator.services.mozilla.com/D133373
2023-06-09 10:22:23 +02:00
Oriol Brufau
5c0f044d39 Further changes required by Servo 2023-06-09 10:22:23 +02:00
Emilio Cobos Álvarez
8bb7d98f0c style: Add support for the revert-layer keyword
This patch looks bigger than it is, but it's mostly because
of plumbing.

To implement revert-layer we need not only the cascade origin of the
declaration, but the whole cascade level, plus also the layer order.

In order to do this, encapsulate these two things inside a 32-bit
`CascadePriority` struct and plumb it through the rule tree and so on.
This allows us to remove the packing and unpacking of CascadeLevel,
though I kept the ShadowCascadeOrder limit for now in case we need to
reintroduce it.

Fix `!important` behavior of layers while at it (implementing it in
`CascadeLevel::cmp`, spec quote included since it was tricky to find)
since some revert-layer tests were depending on it.

The style attribute test is failing now, but follow-up commit fixes
it, see spec issue.

In terms of the actual keyword implementation, it's sort of
straight-forward: We implement revert and revert-layer in a shared
way, by storing the cascade priority that reverted it.

Differential Revision: https://phabricator.services.mozilla.com/D133372
2023-06-09 10:22:22 +02:00
Jonathan Kew
26c10339e3 style: Add support for the 'ic' font-relative unit
This is a "simplified" implementation of 'ic', similar to what Safari Preview
currently supports: it only considers the advance of U+6C34 if found in the
first available font, and otherwise falls back to the default of 1em.

(The spec allows for this "in cases where it is impossible or impractical to
determine the ideographic advance measure".)

Differential Revision: https://phabricator.services.mozilla.com/D132818
2023-06-09 10:22:22 +02:00
Boris Chiou
9430287183 style: Part 10: Make source and scroll-offsets accept only default value
Based on our previous patches, we only support default behavior for
source and scroll-offsets:
1. source:auto
2. scroll-offsets: none
3. scroll-offsets: auto, auto, ...

So update the parser for them. We expect to remove whole
@scroll-timeline in Bug 1733260, so now only do a tiny update in parser.

Differential Revision: https://phabricator.services.mozilla.com/D132417
2023-06-09 10:22:22 +02:00
Boris Chiou
e66bcf2cc5 style: Part 8: Hook scroll-timeline rule into Cascade data and use it for CSS animations
We hook the rule into cascade data, and so we can look it up by timeline
name. Now we only use StyleScrollDirection from @scroll-timeline rule.
`source` and `scroll-offsets` are skipped now and use the default values
instead because I'm pretty sure the syntax will be changed in Bug 1733260,
and `scroll-offsets` may be obsolete because the spec proposal intents to
make it be always 0% ~ 100%.

Also, add some reftests for the default `source` and `scroll-offsets`,
and different `orientation`s.

Besides, we disable at-scroll-timeline-start-end.html in Gecko because
we don't support start/end descriptors, and there are too many
intermittents in it.

Differential Revision: https://phabricator.services.mozilla.com/D126452
2023-06-09 10:22:22 +02:00
Boris Chiou
84cd22c3e0 style: Part 1: Add ScrollTimeline class
Define a simple version of ScrollTimeline.

Differential Revision: https://phabricator.services.mozilla.com/D129099
2023-06-09 10:22:22 +02:00
Emily McDonough
d1bb131acc style: Implement parsing of the page property
Differential Revision: https://phabricator.services.mozilla.com/D131531
2023-06-09 10:22:22 +02:00
Emilio Cobos Álvarez
4fe31d5d84 style: Use titlebar radius on Linux and make titlebar set-up work for lightweight themes
To do this, we always draw the native titlebar behind the toolbox, and
then make the toolbox adapt to it by using the titlebar radius. This
makes us preserve the shadow properly.

On Wayland we'd double-draw the shadow (see bug 1509931 comment 4) so
this fixes it by trimming it as well using border-radius.

Differential Revision: https://phabricator.services.mozilla.com/D128681
2023-06-09 10:22:22 +02:00
Emilio Cobos Álvarez
a8bcfc7f77 style: Remove unnecessary button-focus appearance value on Linux
This always draws transparent. Only real thing it does is forcing 0px
padding.

Differential Revision: https://phabricator.services.mozilla.com/D132563
2023-06-09 10:22:21 +02:00
Oriol Brufau
a95a742599 Further changes required by Servo 2023-06-09 10:22:21 +02:00
Emilio Cobos Álvarez
bcd0b74838 style: Honor GTK button layout
This is based off work by smurfd. But this patch doesn't support buttons
both at the left and right, which simplifies a lot the implementation.

Also, clean-up the existing env variables while at it.

Co-authored-by: Nicklas Boman <smurfd@gmail.com>

Differential Revision: https://phabricator.services.mozilla.com/D132073
2023-06-09 10:22:21 +02:00
Emilio Cobos Álvarez
09a0edefb8 style: Add a Show Password button to <input type=password> controls
It's controlled by the pref:
layout.forms.input-type-show-password-button.enabled

Differential Revision: https://phabricator.services.mozilla.com/D130407
2023-06-09 10:22:21 +02:00
Emilio Cobos Álvarez
b08701529f style: Keep system fonts when prioritizing user fonts
This was a subtle behavior change in bug 1739464. The early-return here:

  https://hg.mozilla.org/mozilla-central/rev/2fb74c67b0c5#l11.40

Meant we also bailed out from user font prioritization for system fonts.

It's unclear whether that's really the best behavior but since the
intention of the regressing patch was not to change behavior, preserving
the old behavior seems better.

Differential Revision: https://phabricator.services.mozilla.com/D131899
2023-06-09 10:22:21 +02:00
Emilio Cobos Álvarez
4904a97111 style: Correctly report animation status of pseudo-elements that are not stored in the parent element
We allow animating pseudo-elements like ::-moz-progress-bar (and we
treat them like regular elements).

Ideally we should store animations for these in the parent element as
well, so they survive reframes and such. But treating them as regular
elements right now means that we do animate them, but we never update
animations for them correctly because wrapper.rs assumed them to be
non-animatable.

Since it seems reasonable to keep allowing the animations to happen,
let's just correct the update code and add a test.

Differential Revision: https://phabricator.services.mozilla.com/D131794
2023-06-09 10:22:21 +02:00
lamoure6
204317b1e6 style: Removed remaining (non-negated) -moz-proton media queries
Differential Revision: https://phabricator.services.mozilla.com/D125328
2023-06-09 10:22:20 +02:00
Oriol Brufau
1d18b3a028 Further changes required by Servo 2023-06-09 10:22:20 +02:00
Emilio Cobos Álvarez
19aa8842c2 style: Simplify language-dependent font fallback code
.fallback is always the default font for the lang group unless we're a
system font (in which case it's "none").

The only reason we need that is because we need to react to
language changes (which affect the initial font).

Simplify the model a bit doing the language lookup in gfxTextRun (this
should avoid allocating a few nsStyleFont structs too.

Depends on D130732

Differential Revision: https://phabricator.services.mozilla.com/D131312
2023-06-09 10:22:20 +02:00
Oriol Brufau
f911fb4f0f Further changes required by Servo 2023-06-09 10:22:20 +02:00
Emilio Cobos Álvarez
a9baf5fe3d style: Use first generic rather than only generic to determine fallback font family
This seems like more sensible behavior. We have another use of
only_generic(), but that affects font sizing and other browsers agree
with us there:

  <div style="font-family: monospace">Should be 13px</div>
  <div style="font-family: something, monospace">Should be 16px</div>

So not touching that one.

Differential Revision: https://phabricator.services.mozilla.com/D130732
2023-06-09 10:22:20 +02:00
Emilio Cobos Álvarez
88b82f569b style: Top layer elements that are display:contents should be display: block
As per https://fullscreen.spec.whatwg.org/#new-stacking-layer:

    If its specified display property is contents, it computes to block.

Differential Revision: https://phabricator.services.mozilla.com/D131585
2023-06-09 10:22:20 +02:00
Ting-Yu Lin
2dbc89d1f5 style: Support scrollbar-gutter in the style system
This patch adds `scrollbar-gutter` property in CSS Overflow level 3 [1] to the
style system.

`devtools/shared/css/generated/properties-db.js` is generated by
`./mach devtools-css-db`.

[1] https://drafts.csswg.org/css-overflow-3/#scrollbar-gutter-property

Differential Revision: https://phabricator.services.mozilla.com/D131460
2023-06-09 10:22:19 +02:00
Ting-Yu Lin
a0617bff0d style: Run rustfmt on servo/components/style and servo/ports/geckolib
This patch is generated by running `cargo +nightly fmt` under
`servo/components/style/` and `servo/ports/geckolib` against mozilla-central
https://hg.mozilla.org/mozilla-central/rev/b193f2e7a6a5d1f042c957ea4acd5c89bf210512

My nightly version is: 1.58.0-nightly (c9c4b5d72 2021-11-17)

Manually remove the redundant braces in author_styles.rs to fix a warning.

Differential Revision: https://phabricator.services.mozilla.com/D131556
2023-06-09 10:22:19 +02:00
Emilio Cobos Álvarez
33ad82c3da style: Make custom properties that are IACVT guaranteed-invalid
This effectively backs out bug 1623396.

See:

  https://github.com/w3c/csswg-drafts/pull/6006
  https://drafts.csswg.org/css-variables/#guaranteed-invalid-value

And related discussion. Matches Chrome stable as per https://groups.google.com/a/chromium.org/g/blink-dev/c/0xrbzYe_vxU/m/7bsL76n9CgAJ

Depends on D116459

Differential Revision: https://phabricator.services.mozilla.com/D116460
2023-06-09 10:22:19 +02:00
Emilio Cobos Álvarez
71ec52f140 style: Partially back out bug 1105364
Apparently using transparent borders and outlines is a common
accessibility technique to make those visible in HCM.

Bug 1740924 comment 9 seemed to indicate we were the only browser
rendering those browsers, but I just confirmed that Edge at least does
show them.

Keep respecting system colors as that's per spec.

Differential Revision: https://phabricator.services.mozilla.com/D131412
2023-06-09 10:22:19 +02:00
Oriol Brufau
7797a19c70 Further changes required by Servo 2023-06-09 10:22:19 +02:00
Emilio Cobos Álvarez
c232cd49b4 style: Use preferred color scheme when forcing colors with system colors (except windows HCM)
This causes (among other things) pages to be dark when using regular
windows system colors and forcing colors to "always", which is nice.

Differential Revision: https://phabricator.services.mozilla.com/D131165
2023-06-09 10:22:19 +02:00
Mats Palmgren
71c04d1d3c style: [css-lists] Remove the internal '-moz-list-reversed' CSS property that is no longer needed
Differential Revision: https://phabricator.services.mozilla.com/D129957
2023-06-09 10:22:19 +02:00
Mats Palmgren
82c0673881 style: [css-lists] Style system changes to support 'reversed(<counter-name>)'
Differential Revision: https://phabricator.services.mozilla.com/D129955
2023-06-09 10:22:18 +02:00
Emilio Cobos Álvarez
53b657e97b style: Add a foreground color to attention selection
In some platforms (like macOS, windows dark mode, android, and some gtk
themes) the foreground selection color might be `currentcolor`, and that
doesn't generally guarantee enough contrast with the attention
background.

Remove HeadlessLookAndFeelGTK's handling of this color since it's
useless (always overridden by prefs in all.js)

Differential Revision: https://phabricator.services.mozilla.com/D130617
2023-06-09 10:22:18 +02:00
Emilio Cobos Álvarez
063d736837 style: Remove some prefs for pseudo-classes that we have shipped/unshipped successfully
And remove code for :-moz-submit-invalid completely.

Differential Revision: https://phabricator.services.mozilla.com/D130737
2023-06-09 10:22:18 +02:00
Emilio Cobos Álvarez
6d887b96bc style: Unexpose :-moz-locale-dir and :-moz-lwtheme* from content
Behind a pref for now. Given these selectors do nothing on non-chrome
documents (they just don't match) it seems worth trying.

A cursory search seems to indicate they're not used for UA detection or
something like that (or at least I haven't found such an usage).

Differential Revision: https://phabricator.services.mozilla.com/D130736
2023-06-09 10:22:18 +02:00
Oriol Brufau
07dbd9d637 Further changes required by Servo 2023-06-09 10:22:18 +02:00
Emilio Cobos Álvarez
04282ff04c style: Allow matches() / querySelector() / etc on chrome docs to access chrome-only selectors. r=boris
Without this some tests fail with the previous patch because code like:

  https://searchfox.org/mozilla-central/rev/267682a8f45221bf0bfe999d4a0239706a43bc56/browser/base/content/browser-gestureSupport.js#651

starts throwing. Unfortunately I had missed that on my try run, because
the error message didn't include that exception (it seemed like an
intermittent browser-chrome failure instead).

We could expose a ChromeOnly API for this, but this seems better. This
fixes it trivially, and also removes the "no url data" situation from
the selector parser, which is nice.

Differential Revision: https://phabricator.services.mozilla.com/D130818
2023-06-09 10:22:18 +02:00
Emilio Cobos Álvarez
a0e29d7032 style: Refactor :-moz-lwtheme pseudo-classes to get invalidated correctly
Use the same document state mechanism we have for :moz-locale-dir. Also,
simplify the setup of the later to be the same as :dir(), allowing the
matching code to be less repetitive.

This should fix some flakiness in chrome mochitests, but we have no existing
tests for these pseudo-classes more generally and since they're just
chrome-only I'm not super-excited about adding more.

Differential Revision: https://phabricator.services.mozilla.com/D130735
2023-06-09 10:22:17 +02:00
Emilio Cobos Álvarez
5b68241958 style: Simplify :dir() implementation
This I noticed while working on the following patches. Shouldn't have
any behavior change: the behavior does in fact match the element state
flag semantics correctly if we do this. We did split the dir flags into
two element bits a while ago.

:not(:dir()) still behaves correctly of course, and we have tests for that.

Differential Revision: https://phabricator.services.mozilla.com/D130734
2023-06-09 10:22:17 +02:00
Emilio Cobos Álvarez
327812e3eb style: Make #[css(field_bound)] and #[css(iterable)] work properly
For now, use IntoIterator to figure the right type to add the bound.

If we need this on types that are iterable but don't provide
IntoIterator, we can add another attribute field or something.

Differential Revision: https://phabricator.services.mozilla.com/D129962
2023-06-09 10:22:17 +02:00
Mats Palmgren
155fbf8804 style: Make #[css(represents_keyword)] convert underscore in the field name to dash
Differential Revision: https://phabricator.services.mozilla.com/D128668
2023-06-09 10:20:04 +02:00
bors-servo
1bd1441d0b
Auto merge of #29841 - mrobinson:update-mozjs, r=jdm
Update mozjs to get new mach version

The mozjs repository now has a version of mach that works more consistently with newer versions of Python.

Fixes #29142.

<!-- 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 #29142
- [x] These changes do not require tests

<!-- 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-05 10:54:44 +02:00
Martin Robinson
019b88770a Update mozjs to get new mach version
The mozjs repository now has a version of mach that works more
consistently with newer versions of Python.

Fixes #29142.
2023-06-04 23:52:33 +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
bors-servo
a16295720d
Auto merge of #29839 - stshine:collapse-through, r=mrobinson
layout_2020: Allow end margin to collapse with children if height is set to 0

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

Previously, end margin was allowed to collapse only when block size is not set.

---
<!-- 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-04 17:55:50 +02:00
Pu Xingyu
e96c63916b Update test expectations 2023-06-04 22:33:53 +08: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
bors-servo
9950c28ee2
Auto merge of #29837 - servo:wpt_update_04-06-2023, r=servo-wpt-sync
Sync WPT with upstream (04-06-2023)

Automated downstream sync of changes from upstream as of 04-06-2023
[no-wpt-sync]
r? @servo-wpt-sync
2023-06-04 10:40:46 +02:00
WPT Sync Bot
e01fdde3cc Update web-platform-tests to revision b'4d1dc1971a0688048c804261711c639fe96ee187' 2023-06-04 01:59:47 +00:00
bors-servo
f26d17096d
Auto merge of #29757 - Loirooriol:sequential-context-2020, r=Loirooriol
Lay out floats and handle clearance in layout 2020, but don't flow text around them yet

This is a crude rebase of #27539

<!-- 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-03 13:43:17 +02:00
bors-servo
0f8824da6d
Auto merge of #29755 - stshine:automatic-min-size, r=Loirooriol
layout_2020: Implement automatic minimum size of flex items

Implement the algorithm described in
https://drafts.csswg.org/css-flexbox/#min-size-auto.

<!-- 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-06-03 10:43:48 +02:00