Граф коммитов

14057 Коммитов

Автор SHA1 Сообщение Дата
Emilio Cobos Álvarez f4a133a1fd Bug 1747037 - Shrink maps if needed after stylist rebuilds. r=bholley
Hashbrown grows a lot sometimes making us waste a lot of memory. Shrink
some of these maps after CascadeData rebuild / stylesheet collection
invalidation.

Differential Revision: https://phabricator.services.mozilla.com/D134716
2021-12-28 17:19:31 +00:00
Emilio Cobos Álvarez 149bb0ed03 Bug 1747349 - Remove ThinBoxedSlice. r=xidorn
The only remaining consumers are ::-moz-tree pseudo-elements (we used to
use ThinBoxedSlice for other data structures in the past).

Those are not particularly performance sensitive so I think just
double-boxing is fine. In the future, if we wanted to avoid the double
indirection, we could probably use the "thin" crate
(https://docs.rs/thin) or similar, which stores the length of the slice
along with the allocation, making the pointer thin in all
configurations, much like "ThinArc" does:

  https://searchfox.org/mozilla-central/rev/1ce2eea39442190a71a1f8f650d098f286bf4a01/servo/components/servo_arc/lib.rs#891

In practice though, I don't think it's particularly worth it for this
specific case.

Differential Revision: https://phabricator.services.mozilla.com/D134672
2021-12-25 06:25:35 +00:00
Emilio Cobos Álvarez 2ac050afaa Bug 1746920 - Use ThreadPool::scope_fifo in style. r=TYLin
It does the same, but it saves an indentation level:

  https://searchfox.org/mozilla-central/rev/a11b63915bd7810a03635d733123448ab5bfcad3/third_party/rust/rayon-core/src/thread_pool/mod.rs#217

Differential Revision: https://phabricator.services.mozilla.com/D134321
2021-12-20 23:55:36 +00:00
Emilio Cobos Álvarez 461f89a0bb Bug 1746683 - Remove hwba since it's not a thing (hwb function supports alpha).
Partially backs out the previous patch.

Differential Revision: https://phabricator.services.mozilla.com/D134256
2021-12-20 02:53:31 +00:00
Emilio Cobos Álvarez 61ea030cc4 Bug 1746683 - Add hwb/a to devtools autocomplete lists. r=dholbert
The changes to the devtools directory were written automatically via ./mach devtools-css-db

Differential Revision: https://phabricator.services.mozilla.com/D134197
2021-12-18 20:09:29 +00:00
Emilio Cobos Álvarez be1a744435 Bug 1744102 - Remove servo/components/{hashglobe,fallible} in favor of try_reserve. r=xidorn
Differential Revision: https://phabricator.services.mozilla.com/D134194
2021-12-18 09:54:24 +00:00
Sandor Molnar e45ac2363d Backed out changeset e9782fd301cc (bug 1746683) for causing mochitest failures in layout/inspector/tests/test_bug877690.html CLOSED TREE 2021-12-18 05:58:39 +02:00
Emilio Cobos Álvarez bd470ae24f Bug 1746683 - Add hwb/a to devtools autocomplete lists. r=dholbert
The changes to the devtools directory were written automatically via ./mach devtools-css-db

Differential Revision: https://phabricator.services.mozilla.com/D134197
2021-12-18 01:09:00 +00:00
Emilio Cobos Álvarez 8fdcc6a236 Bug 1746391 - Deal with layers and at-rules. r=boris
Differential Revision: https://phabricator.services.mozilla.com/D134010
2021-12-17 12:58:32 +00:00
Jonathan Kew 20ec7ce89f Bug 1746187 - Add CSS support for the hyphenate-character property. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D133889
2021-12-16 13:47:55 +00:00
Marian-Vasile Laza e3ec8630b1 Backed out 4 changesets (bug 1746187) for causing xpcshell failures on test_css-properties-db.js.
Backed out changeset fa4f889dd0d3 (bug 1746187)
Backed out changeset e3fce2273109 (bug 1746187)
Backed out changeset 6733677ad35d (bug 1746187)
Backed out changeset a4375ff93414 (bug 1746187)
2021-12-16 04:51:13 +02:00
Jonathan Kew 83df1246c1 Bug 1746187 - Add CSS support for the hyphenate-character property. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D133889
2021-12-15 23:16:49 +00:00
Emilio Cobos Álvarez b4eb3f9643 Bug 1745894 - Don't draw window decorations when painting headerbar on wayland. r=stransky
This is a better fix for the double decorations than clipping them using
CSS.

Differential Revision: https://phabricator.services.mozilla.com/D133871
2021-12-15 13:12:01 +00:00
Emilio Cobos Álvarez f13595acc8 Bug 1745233 - Update CSSOM for layer rules to the spec. r=firefox-style-system-reviewers,layout-reviewers,boris
Pretty mechanical.

Tests are in https://wpt.live/css/css-cascade/layer-rules-cssom.html
which (with a fix for @import tests which I'll submit separately) we
pass.

Sync for that is bug 1743936.

Differential Revision: https://phabricator.services.mozilla.com/D133387
2021-12-14 15:39:38 +00:00
Emilio Cobos Álvarez d84300e6e7 Bug 1699220 - Fix style attribute important and revert-layer behavior. r=firefox-style-system-reviewers,layout-reviewers,boris
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
2021-12-14 15:38:34 +00:00
Emilio Cobos Álvarez dae5c87696 Bug 1699220 - Add support for the revert-layer keyword. r=boris
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
2021-12-14 15:38:34 +00:00
Jonathan Kew 9477e32f16 Bug 1531223 - Add support for the 'ic' font-relative unit. r=emilio
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
2021-12-08 17:07:05 +00:00
Jonathan Kew 719dd66863 Bug 1702924 - Add support for the 'cap' font-relative unit. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D133101
2021-12-08 12:20:40 +00:00
Boris Chiou 1ce11d0155 Bug 1676791 - Part 10: Make source and scroll-offsets accept only default value. r=emilio
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
2021-12-08 01:16:31 +00:00
Boris Chiou 74f0bd8a0c Bug 1676791 - Part 8: Hook scroll-timeline rule into Cascade data and use it for CSS animations. r=emilio,hiro
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
2021-12-08 01:16:31 +00:00
Boris Chiou 470f574f58 Bug 1676791 - Part 1: Add ScrollTimeline class. r=hiro
Define a simple version of ScrollTimeline.

Differential Revision: https://phabricator.services.mozilla.com/D129099
2021-12-08 01:16:28 +00:00
Emily McDonough c4d55a9374 Bug 1741973 - Implement parsing of the page property r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D131531
2021-12-07 22:11:53 +00:00
Alexandru Michis 40430b0cce Backed out changeset 66eb52e5da74 (bug 1741973) for causing mochitest failures in test_animation-type-longhand.html
CLOSED TREE
2021-12-07 00:01:55 +02:00
Emily McDonough bd3b879775 Bug 1741973 - Implement parsing of the page property r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D131531
2021-12-06 19:34:43 +00:00
Butkovits Atila 21676cf030 Backed out changeset 145c64b7ac17 (bug 1531223) for causing failures at gfxFontEntry.cpp. CLOSED TREE 2021-12-06 14:57:31 +02:00
Jonathan Kew ed3fd395ba Bug 1531223 - Add support for the 'ic' and 'cap' font-relative units. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D132818
2021-12-06 12:22:09 +00:00
Sandor Molnar 0d095a62b5 Backed out changeset 8fac157c354a (bug 1741973) for causing xpc failures in devtools/shared/tests/xpcshell/test_css-properties-db. CLOSED TREE 2021-12-03 04:17:36 +02:00
Emily McDonough 1de10c57f2 Bug 1741973 - Implement parsing of the page property r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D131531
2021-12-02 23:37:28 +00:00
Emilio Cobos Álvarez 2abc89c41e Bug 1509931 - Use titlebar radius on Linux and make titlebar set-up work for lightweight themes. r=stransky,dao
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
2021-12-01 18:15:12 +00:00
Emilio Cobos Álvarez a9b6db8e3f Bug 1743803 - Remove unnecessary button-focus appearance value on Linux. r=dao
This always draws transparent. Only real thing it does is forcing 0px
padding.

Differential Revision: https://phabricator.services.mozilla.com/D132563
2021-12-01 13:33:02 +00:00
Emilio Cobos Álvarez 4354146592 Bug 1432090 - Honor GTK button layout. r=stransky,desktop-theme-reviewers,dao
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
2021-11-26 11:37:52 +00:00
Emilio Cobos Álvarez 2dca36cb25 Bug 502258 - Add a Show Password button to <input type=password> controls. r=Gijs
It's controlled by the pref:
layout.forms.input-type-show-password-button.enabled

Differential Revision: https://phabricator.services.mozilla.com/D130407
2021-11-25 20:12:05 +00:00
Emilio Cobos Álvarez 24be48359c Bug 1742574 - Keep system fonts when prioritizing user fonts. r=jfkthame,layout-reviewers
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
2021-11-23 12:41:19 +00:00
Emilio Cobos Álvarez e120f9b2b2 Bug 1742393 - Correctly report animation status of pseudo-elements that are not stored in the parent element. r=hiro
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
2021-11-23 12:36:22 +00:00
lamoure6 3478e8ae47 Bug 1719938 - Removed remaining (non-negated) -moz-proton media queries. r=mhowell,mtigley,emilio
Differential Revision: https://phabricator.services.mozilla.com/D125328
2021-11-22 22:10:33 +00:00
Emilio Cobos Álvarez ff07ef7e17 Bug 1739464 - Simplify language-dependent font fallback code. r=jfkthame
.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
2021-11-19 16:11:55 +00:00
Emilio Cobos Álvarez 2f4e4df679 Bug 1739464 - Use first generic rather than only generic to determine fallback font family. r=jfkthame
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
2021-11-19 16:11:54 +00:00
Emilio Cobos Alvarez eef21610c6 Bug 1725721 - Top layer elements that are display:contents should be display: block. r=hiro
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
2021-11-19 04:46:42 +00:00
Ting-Yu Lin 5d4998ecf4 Bug 1741774 - Support scrollbar-gutter in the style system. r=emilio
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
2021-11-19 01:48:07 +00:00
Ting-Yu Lin ca1b688007 Bug 1741990 - Run rustfmt on servo/components/style and servo/ports/geckolib. r=emilio,layout-reviewers
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
2021-11-19 00:14:27 +00:00
Norisz Fay 09cb6f5caa Backed out changeset 00651c04ba31 (bug 1741990) for causing build bustages CLOSED TREE 2021-11-19 01:03:56 +02:00
Ting-Yu Lin 6d43b0f7b8 Bug 1741990 - Run rustfmt on servo/components/style and servo/ports/geckolib. r=emilio,layout-reviewers
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)

Differential Revision: https://phabricator.services.mozilla.com/D131556
2021-11-18 22:46:24 +00:00
Emilio Cobos Álvarez 1cc0113008 Bug 1740924 - Partially back out bug 1105364. r=morgan
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
2021-11-18 21:20:49 +00:00
Emilio Cobos Álvarez 2d8ab09b73 Bug 1739699 - Use preferred color scheme when forcing colors with system colors (except windows HCM). r=morgan
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
2021-11-16 22:30:26 +00:00
Mats Palmgren a36baa4d58 Bug 1706346 part 3 - [css-lists] Remove the internal '-moz-list-reversed' CSS property that is no longer needed. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D129957
2021-11-14 03:49:36 +00:00
Mats Palmgren 2e0a36d04d Bug 1706346 part 1 - [css-lists] Style system changes to support 'reversed(<counter-name>)'. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D129955
2021-11-14 03:49:35 +00:00
Alexandru Michis ef8f129df5 Backed out changeset 82c80c6c8090 (Bug 1739464) for causing mochitest plain failures in test_bug496275.html
CLOSED TREE
2021-11-12 03:45:59 +02:00
Emilio Cobos Álvarez 3b4c3ed152 Bug 1739464 - Use first generic rather than only generic to determine fallback font family. r=jfkthame
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
2021-11-11 17:48:55 +00:00
Emilio Cobos Álvarez 4d6ee249dc Bug 1739925 - Add a foreground color to attention selection. r=jfkthame
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
2021-11-11 11:14:13 +00:00
Marian-Vasile Laza 6d3bafd66a Backed out changeset 2ed757d5dd76 (bug 1739464) for causing reftest failures on brackets-3b-rtl.html. CLOSED TREE 2021-11-10 22:54:06 +02:00
Emilio Cobos Álvarez 4dabed3c51 Bug 1739464 - Use first generic rather than only generic to determine fallback font family. r=jfkthame
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
2021-11-10 17:58:18 +00:00
Emilio Cobos Álvarez a5f66c95e1 Bug 1740230 - Remove some prefs for pseudo-classes that we have shipped/unshipped successfully. r=dholbert
And remove code for :-moz-submit-invalid completely.

Differential Revision: https://phabricator.services.mozilla.com/D130737
2021-11-10 13:27:47 +00:00
Emilio Cobos Álvarez f2318b3299 Bug 1740230 - Unexpose :-moz-locale-dir and :-moz-lwtheme* from content. r=dholbert
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
2021-11-10 13:00:17 +00:00
Emilio Cobos Álvarez bd406d8841 Bug 1740230 - 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
2021-11-10 12:56:35 +00:00
Butkovits Atila 3a33d047e8 Backed out 2 changesets (bug 1740230) for causing build bustages.
Backed out changeset ba8e644ee9d2 (bug 1740230)
Backed out changeset 180d03015fd1 (bug 1740230)
2021-11-10 02:12:26 +02:00
Emilio Cobos Álvarez 620bd78775 Bug 1740230 - 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
2021-11-09 23:28:48 +00:00
Emilio Cobos Álvarez c11619252a Bug 1740230 - Unexpose :-moz-locale-dir and :-moz-lwtheme* from content. r=dholbert
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
2021-11-09 22:51:05 +00:00
Emilio Cobos Álvarez a3a1b27924 Bug 1740230 - Refactor :-moz-lwtheme pseudo-classes to get invalidated correctly. r=dholbert
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
2021-11-09 20:59:11 +00:00
Emilio Cobos Álvarez 9b27f32101 Bug 1740230 - Simplify :dir() implementation. r=dholbert
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
2021-11-09 20:53:13 +00:00
Butkovits Atila 4af43f1399 Backed out changeset da181def7b07 (bug 1739464) for causing failures at test_dont_use_document_fonts.html. 2021-11-09 21:10:28 +02:00
Emilio Cobos Álvarez 4c24a1ca7d Bug 1739464 - Use first generic rather than only generic to determine fallback font family. r=jfkthame
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
2021-11-09 17:22:07 +00:00
Emilio Cobos Álvarez 890026f19b Bug 1739357 - Merge branches in some ComputedValues functions. r=boris
This should mitigate the code size impact. Also make get_resolved_value
non-generic to avoid monomorphizing it multiple times.

Differential Revision: https://phabricator.services.mozilla.com/D130354
2021-11-06 10:14:40 +00:00
Mats Palmgren 039e1146f4 Bug 1738520 - Make #[css(field_bound)] and #[css(iterable)] work properly. r=mats
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
2021-11-04 18:31:55 +00:00
Emilio Cobos Álvarez c308704902 Bug 1738614 - Remove other Widget* colors. r=mstange
These are only used for frameset painting and the non-e10s <select>
dropdown focus codepath. We have other more appropriate standard
colors for this.

Differential Revision: https://phabricator.services.mozilla.com/D129992
2021-11-02 18:08:07 +00:00
Emilio Cobos Álvarez 923cf5df84 Bug 1738614 - Remove TextForeground/Background system colors. r=mstange
Same thing, there's nor reason these should be different from other
CSS-exposed colors.

Differential Revision: https://phabricator.services.mozilla.com/D129991
2021-11-02 18:08:07 +00:00
Emilio Cobos Álvarez ac14d7e42d Bug 1738614 - Remove WindowBackground/Foreground system colors. r=mstange
There's no reason for these to be different to the CSS-exposed
Window/WindowText.

Differential Revision: https://phabricator.services.mozilla.com/D129990
2021-11-02 18:08:07 +00:00
Emilio Cobos Álvarez 7c1b2c19fd Bug 1738658 - Serialize text-decoration using Servo. r=layout-reviewers,mats
The code introduced in the preceding patch deals with currentColor correctly,
so we should be able to do this now.

This uncovers a bug in the existing serialization code when a non-auto
text-decoration-thickness was used, caught by
css/css-text-decor/parsing/text-decoration-computed.html.

Differential Revision: https://phabricator.services.mozilla.com/D130018
2021-11-02 14:21:38 +00:00
Emilio Cobos Álvarez ac72dbe343 Bug 1738658 - Generalize resolved style code to deal with all shorthands. r=jwatt
This removes the various assumptions that the animation code does.

Code size might be a concern, we can optimize if it is a problem,
but let's do the obvious thing for now.

Differential Revision: https://phabricator.services.mozilla.com/D130017
2021-11-02 14:21:38 +00:00
Emilio Cobos Álvarez e7fd7303e1 Bug 1738791 - Treat empty root margin as zero as per spec. r=AlaskanEmily
Differential Revision: https://phabricator.services.mozilla.com/D130131
2021-11-02 10:44:17 +00:00
Noemi Erli d6a163adba Backed out changeset f8c0561be4db (bug 1738791) for causing failures in observer-attributes.html CLOSED TREE 2021-11-02 04:30:37 +02:00
Emilio Cobos Álvarez 7dc130a7a8 Bug 1738791 - Treat empty root margin as zero as per spec. r=AlaskanEmily
Differential Revision: https://phabricator.services.mozilla.com/D130131
2021-11-01 22:46:02 +00:00
Emilio Cobos Álvarez 69eeb9cb6c Bug 1738608 - Make autofill background configurable via system color prefs. r=mstange
And remove the autofill.background pref for 95 (or 96, depending on
when this lands) assuming nothing terrible causes us to turn it off on
94.

Differential Revision: https://phabricator.services.mozilla.com/D129988
2021-10-31 21:28:58 +00:00
Emilio Cobos Álvarez 1421e7f545 Bug 1525107 - Make Canvas/CanvasText and Link colors color-scheme-aware. r=dholbert
For that, add `.dark` version of the browser.display* prefs that control
the light version of these colors.

The default for background/foreground colors are taken from the
GenericDarkColors used in LookAndFeel.

The defaults for links are based on this discussion:

  https://github.com/whatwg/html/issues/5426#issuecomment-904021675

(So they effectively match Chrome).

Whether the dark colors should be exposed in about:preferences (like the
light colors are) is TBD.

With this patch, we pass all the tests in:

  /html/semantics/document-metadata/the-meta-element/color-scheme/

Use the colors to paint the default canvas background and the default
colors.

There are three "regressions", though they are really progressions: we
now render the reference as the test expects (before we rendered a light
canvas background even for the reference).

Apart of these iframe tests (which we should look into, I filed
https://bugzilla.mozilla.org/show_bug.cgi?id=1738380), there are three
remaining test failures.

Two of them are due to `color: initial` not changing based on the
color-scheme. Safari also fails these tests, and the thing they're
really testing is whether system colors are preserved at computed-value
time:

  https://github.com/w3c/csswg-drafts/issues/3847

Regarding that change, I'm not so sure the trade-offs there are worth
it, as that not only complicates interpolation (we wouldn't be able to
use system colors in color-mix among others, see
https://github.com/w3c/csswg-drafts/issues/5780) plus it changes
inheritance behavior in sorta unexpected ways, see:

  https://github.com/w3c/csswg-drafts/issues/6773

Which I just filed because apparently no browser implements this
correctly. So for now will punt on those (keep matching Safari).

There's an svg-as-image test:

  https://searchfox.org/mozilla-central/rev/f8576fec48d866c5f988baaf1fa8d2f8cce2a82f/testing/web-platform/tests/css/css-color-adjust/rendering/dark-color-scheme/svg-as-image.html

Which isn't using the feature at all and I'm not sure why is it supposed
to pass (why prefers-color-scheme: dark is supposed to match that SVG
image). This test fails in all browsers apparently:

  https://wpt.fyi/results/css/css-color-adjust/rendering/dark-color-scheme/svg-as-image.html?label=master&label=experimental&aligned

I sent https://github.com/web-platform-tests/wpt/pull/31407 to remove
it and hopefully get it reviewed by some Chromium folks.

Differential Revision: https://phabricator.services.mozilla.com/D129746
2021-10-29 19:58:25 +00:00
Emilio Cobos Álvarez 933c5ad884 Bug 1525107 - Move Canvas/Link color computation to C++-land. r=dholbert
This doesn't change behavior but will allow us to deduplicate some
logic given we compute the effective color-scheme in C++.

Differential Revision: https://phabricator.services.mozilla.com/D129744
2021-10-29 19:58:24 +00:00
Emilio Cobos Álvarez f85c48f96d Bug 1525107 - Implement <meta name=color-scheme>. r=dholbert
There are still tests failing because
https://bugzilla.mozilla.org/show_bug.cgi?id=1736034 hasn't been synced
yet.

Once that lands, they will still fail because we don't change
Canvas/CanvasText based on color-scheme, but that I'm attaching
patches for after this one.

Differential Revision: https://phabricator.services.mozilla.com/D129743
2021-10-29 19:58:24 +00:00
Mats Palmgren 1169c0cdc1 Bug 1738296 - Fix broken 'list-style' serialization. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D129847
2021-10-28 17:06:53 +00:00
Emilio Cobos Álvarez 5b31eea4fd Bug 1737676 - Use GTK menu radius on native context menus and panels. r=stransky
Differential Revision: https://phabricator.services.mozilla.com/D129439
2021-10-28 10:52:31 +00:00
Emilio Cobos Álvarez f488c2d7b8 Bug 1737654 - Allow parsing layer statements inside nested rules. r=boris
This fixes https://wpt.live/css/css-cascade/layer-media-query.html once
it syncs.

Differential Revision: https://phabricator.services.mozilla.com/D129424
2021-10-26 23:03:19 +00:00
Emilio Cobos Álvarez 8b39ce0241 Bug 1734570 - Update layer ordering to follow the spec. r=boris
The bitfield approach worked when the layer order was in pre-order, but
the spec was changed to make it work like post-order and I don't think
there's a way to keep it working like that, so keep the layer order in a
separate data structure that we look up when going from Rule to
ApplicableDeclarationBlock.

This is just a vector index operation so hopefully shouldn't be too bad.

This patch intentionally regresses @keyframe handling to some extent,
since we need a bit more complicated approach and it seemed worth
implementing in a separate patch.

Depends on D129380

Differential Revision: https://phabricator.services.mozilla.com/D129381
2021-10-26 23:00:29 +00:00
Emilio Cobos Álvarez aacd5cb566 Bug 1734570 - Store a LayerOrder in ApplicableDeclarationBlock. r=boris
This shouldn't change behavior jut yet.

Differential Revision: https://phabricator.services.mozilla.com/D129380
2021-10-26 23:00:29 +00:00
Emilio Cobos Álvarez f317384568 Bug 1736518 - Make browser.tabs.drawInTitlebar a tri-state. r=stransky,Gijs
To more properly support Linux having a different default at runtime.

Expose the resolved value in appinfo for convenience, and use it in the
front-end as needed.

Differential Revision: https://phabricator.services.mozilla.com/D129004
2021-10-21 09:07:12 +00:00
stransky aecdcaacb9 Bug 1736795 [Linux] Export titlebar radius as int from LookAndFeel, r=emilio
Titlebar radius is exported as integer from Gtk so there's no need to use floats here.

Differential Revision: https://phabricator.services.mozilla.com/D128993
2021-10-20 18:01:02 +00:00
Emilio Cobos Álvarez 9ec6b27649 Bug 1736848 - Don't use nsContentUtils::sNamespaceManager in servo. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D129030
2021-10-20 15:25:10 +00:00
Mike Hommey 4aa571147f Bug 1736477 - Remove unused import_rule::PendingSheet. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D128823
2021-10-19 23:31:04 +00:00
Emilio Cobos Álvarez db97a652b6 Bug 1509931 - Fix rebase mistake.
MANUAL PUSH: Bustage fix CLOSED TREE
2021-10-18 21:16:07 +02:00
Emilio Cobos Álvarez 2cdb78d6a6 Bug 1509931 - Remove -moz-gtk-csd-transparent-background. r=stransky,desktop-theme-reviewers,dao
We always use alpha visual for WebRender, and appearance: none is
unnecessary (root element has no intrinsic appearance).

Differential Revision: https://phabricator.services.mozilla.com/D128682
2021-10-18 18:51:41 +00:00
Emilio Cobos Álvarez b742f680db Bug 1509931 - Expose titlebar radius as a chrome-only CSS environment variable. r=stransky
Mostly plumbing.

Differential Revision: https://phabricator.services.mozilla.com/D128680
2021-10-18 16:22:13 +00:00
Emilio Cobos Álvarez c676353b72 Bug 1509931 - Add support for chrome-only environment variables. r=stransky
This bit is taken straight from D73454 (I reviewed it but I guess
another pair of eyes is ok, it's really straight-forward).

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

Differential Revision: https://phabricator.services.mozilla.com/D128679
2021-10-18 16:22:13 +00:00
Mats Palmgren cce3f3a286 Bug 1736129 - Make #[css(represents_keyword)] convert underscore in the field name to dash. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D128668
2021-10-16 20:09:24 +00:00
Emilio Cobos Álvarez c4b7109fac Bug 1736038 - Remove -moz-toolbar-prefers-color-scheme. r=dao
By making prefers-color-scheme return the ColorSchemeForChrome(), which
accounts for the Firefox theme.

Differential Revision: https://phabricator.services.mozilla.com/D128611
2021-10-15 16:53:08 +00:00
Emilio Cobos Álvarez 37660aa996 Bug 1730503 - Make anonymous scrollbar caching work on mac by default, and unify scrollbars.css across platforms. r=mstange,desktop-theme-reviewers,dao
We make it work on macOS by setting pointer-events: none + opacity: 0 rather
than visibility: hidden, and tweaking the caching setup to be Android-like.

Now that the scrollbars sheet is the same across platforms, move it to where
the rest of the UA sheets are. This way we guarantee that the RDM vs. Android
difference is less (just the ifdef at the top of the sheet).

Depends on D128084

Differential Revision: https://phabricator.services.mozilla.com/D128085
2021-10-12 09:21:18 +00:00
Emilio Cobos Álvarez ca970e3818 Bug 1735083 - Clean up GTK titlebar colors. r=desktop-theme-reviewers,dao
Apparently ActiveCaption/CaptionText/InactiveCaption/InactiveCaptionText
are supposed to be used for titlebars, so implement them properly and
remove the GTK-specific colors.

Differential Revision: https://phabricator.services.mozilla.com/D128028
2021-10-11 22:16:58 +00:00
Boris Chiou 33ba1b4ed4 Bug 1734472 - Tweak the serialization of rotate property. r=emilio
The serialization of rotate should be updated to match the current spec.

1. If a rotation about the z axis (that is, in 2D) is specified, the property
   must serialize as just an <angle>.

2. If any other rotation is specified, the property must serialize with an axis
   specified. If the axis is parallel with the x or y axes, it must serialize
   as the appropriate keyword.

Also, we need to handle the zero length vector separately because it is
parallel to every other vector but different from x axis, y axis, or z axis.

Differential Revision: https://phabricator.services.mozilla.com/D127747
2021-10-07 20:05:10 +00:00
Emilio Cobos Álvarez 9fbc18ca4c Bug 1733384 - Make inert not modify the computed style. r=sefeng,layout-reviewers,jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D127422
2021-10-07 17:00:36 +00:00
Butkovits Atila 4d927c1fb4 Backed out 4 changesets (bug 1733384) for causing failures at browser_windowPrompt.js. CLOSED TREE
Backed out changeset fa609fadac26 (bug 1733384)
Backed out changeset dd1936d9fe17 (bug 1733384)
Backed out changeset 1a073e40ab1a (bug 1733384)
Backed out changeset 65708a4c708f (bug 1733384)
2021-10-07 17:52:51 +03:00
Emilio Cobos Álvarez 445c7b4297 Bug 1734455 - Remove support for -moz-system-color() as chrome code no longer uses it (in favor of color-scheme). r=xidorn
Differential Revision: https://phabricator.services.mozilla.com/D127802
2021-10-07 11:56:17 +00:00
Emilio Cobos Álvarez bfdd0fcc77 Bug 1733384 - Make inert not modify the computed style. r=sefeng,layout-reviewers,jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D127422
2021-10-07 11:47:34 +00:00
Glenn Watson a9ef6ad97d Bug 1734282 - Remove some unused scroll frame APIs and code r=gfx-reviewers,jrmuizel
ScrollSensitivity is not used by Gecko. Also remove some remnants
of the old code to combine scroll frames when display lists swap.

Differential Revision: https://phabricator.services.mozilla.com/D127609
2021-10-06 06:43:03 +00:00
Emilio Cobos Álvarez e50c80851e Bug 1734115 - Add basic support for dark form controls to nsNativeBasicTheme. r=mstange
For that:

 * Tweak the standin system colors to match the non-native theme.

 * Use those system colors for button and field backgrounds.

 * Rename the "should use system colors" bit to "is high contrast",
   which is what it really is (specially now that we use system colors
   also in non-high-contrast).

Border colors and other colors like the <input type=range> and such
might need some extra tweaking perhaps, but this is a decent start and
looks good in https://crisal.io/tmp/form-controls.html afaict (dark mode
toggle needs the color-scheme pref enabled of course).

Differential Revision: https://phabricator.services.mozilla.com/D127533
2021-10-05 14:40:52 +00:00
Harry Twyford 5a88e54daf Bug 1732322 - Part 1 - Enable color-scheme CSS property in chrome sheets. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D127300
2021-10-03 00:10:17 +00:00
Emilio Cobos Álvarez 3899f8f87d Bug 1733475 - Ensure to copy over the viewport/font units invalidation bits when reusing reset properties. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D127262
2021-10-01 19:53:30 +00:00
Emilio Cobos Alvarez 21a3f0049f Bug 1733565 - Clean up button active system colors. r=mstange,desktop-theme-reviewers,dao
This patch does three things:

 * Unifies mac and gtk's buttonactivetext system colors (unships mac's from
   content, but it was never meant to be exposed).

 * Simplifies the forms.css rules, since <input type=color>'s color property
   value doesn't affect its rendering in any meaningful way.

 * Adds a buttonactiveface color, which we'll use to provide dark backgrounds
   for buttons in Windows dark mode (and is good practice, since generally
   every text system color should have a corresponding background).

So as-is it shouldn't change content-exposed behavior (except we stop exposing
the -moz-mac-buttonactivetext to content), but it's a worthy cleanup.

Depends on D127246

Differential Revision: https://phabricator.services.mozilla.com/D127259
2021-10-01 19:42:16 +00:00
Emilio Cobos Álvarez 390ddc27d6 Bug 1733339 - Remove NS_AUTHOR_SPECIFIED_PADDING. r=mstange
There's only one meaningful usage of it, which is to disable native
appearance of the <input type=range> (the windows native theme is no
longer exposed to content).

<input type=range> is inconsistent with every other native widget, which
only disables native appearance if the author specifies backgrounds or
borders. So make it match literally all other widgets and simplify a bit
the code.

We had no tests for this special behavior, let me know if you think it's
worth adding one (but I don't feel very strongly about it).

Differential Revision: https://phabricator.services.mozilla.com/D127082
2021-10-01 11:48:17 +00:00
Cristian Tuns b56ca950cf Backed out changeset a19e4f8a75d7 (bug 1733339) for causing reftest failures. CLOSED TREE 2021-10-01 03:54:08 -04:00
Emilio Cobos Álvarez b53a78f446 Bug 1733339 - Remove NS_AUTHOR_SPECIFIED_PADDING. r=mstange
There's only one meaningful usage of it, which is to disable native
appearance of the <input type=range> (the windows native theme is no
longer exposed to content).

<input type=range> is inconsistent with every other native widget, which
only disables native appearance if the author specifies backgrounds or
borders. So make it match literally all other widgets and simplify a bit
the code.

We had no tests for this special behavior, let me know if you think it's
worth adding one (but I don't feel very strongly about it).

Differential Revision: https://phabricator.services.mozilla.com/D127082
2021-10-01 06:31:09 +00:00
Boris Chiou ac12e63d6f Bug 1676784 - Part 2: Add animation-timeline into animation shorthand. r=emilio
We use the same rule as blink: serialize the animation-timeline if
it is not the default value.

Differential Revision: https://phabricator.services.mozilla.com/D126451
2021-10-01 00:38:55 +00:00
Boris Chiou 397e076032 Bug 1676784 - Part 1: Add animation-timeline longhand property in style system. r=emilio
This patch adds the animation-timeline longhand property. For
shorthand, we will do that in the next patch.

This patch includes the aut-generated code in
devtools/shared/css/generated/properties-db.js, by `./mach devtools-css-db`.

Note:
1. we will use this property in Bug 1676791. For now, only make sure
   we parse it and serialize it correctly.
2. The syntax of animation-timeline may be updated, based on the spec
   issue: https://github.com/w3c/csswg-drafts/issues/6674.
   However, it's not a big problem to update it later, so we still can
   prototype this property based on the current version of spec.

Differential Revision: https://phabricator.services.mozilla.com/D126450
2021-10-01 00:38:54 +00:00
Emilio Cobos Álvarez a74c41b569 Bug 1732523 - Order keyframe rules by layer. r=firefox-style-system-reviewers,boris
@counter-style/@font-face/@scroll-timeline need similar fixes, but tests
for those haven't been synced yet so waiting for that before writing
them.

Differential Revision: https://phabricator.services.mozilla.com/D126616
2021-09-30 09:59:14 +00:00
Emilio Cobos Álvarez e5a8824eaf Bug 1732759 - Unprefix -moz-fit-content. r=dholbert
I'm not aware of any reason we shouldn't do this, as it is interoperable
with other browsers, and it causes compat issues from sites that forget
to use the prefixed version.

Note this removes some #[parse(aliases)]. These only affect devtools
autocomplete behavior, and we avoid autocompleting -moz-prefixed
keywords when possible, so even though it's a slight behavior change,
it's worth it.

Differential Revision: https://phabricator.services.mozilla.com/D126718
2021-09-28 11:44:33 +00:00
Stephen A Pohl 87f63ab1b8 Bug 1633860: Place window control buttons on the right side on macOS when using an RTL system locale, regardless of the Firefox locale. r=mstange,emilio,harry
Differential Revision: https://phabricator.services.mozilla.com/D116921
2021-09-22 18:51:20 +00:00
Emilio Cobos Álvarez a2247a143d Bug 1731142 - Print lock address on assert. r=firefox-style-system-reviewers,layout-reviewers,boris
Note that the crash reason is sanitized so we're not exposing anything
sensitive.

I think my patch just changed the signature of the stack, as it didn't
change anything related to guards or what not. But without knowing why
is failing or a repro it's hard to know what's going on.

Printing the address at list would give us some indication of what might
be going wrong (perhaps we're using a static lock when we don't expect
one or such?).

Differential Revision: https://phabricator.services.mozilla.com/D125948
2021-09-21 01:56:30 +00:00
Csoregi Natalia 5232f16dc4 Backed out changeset 5523334143d9 (bug 1719938) for failures on browser_parsable_css.js. CLOSED TREE 2021-09-21 02:39:55 +03:00
lamoure6 5c23ae0374 Bug 1719938 - Removed remaining (non-negated) -moz-proton media queries. r=mhowell,mtigley,emilio
Differential Revision: https://phabricator.services.mozilla.com/D125328
2021-09-20 22:40:42 +00:00
Csoregi Natalia 592741b7e0 Backed out changeset 0711ae54877b (bug 1719938) for bustages on media_features.rs. CLOSED TREE 2021-09-20 23:29:05 +03:00
lamoure6 a4e720c69d Bug 1719938 - Removed remaining (non-negated) -moz-proton media queries. r=mhowell,mtigley,emilio
Differential Revision: https://phabricator.services.mozilla.com/D125328
2021-09-20 19:21:50 +00:00
Emilio Cobos Álvarez 0873ed43bc Bug 1596184 - Get rid of nsStackFrame. r=layout-reviewers,mats
There are no legacy-stack uses anymore.

Differential Revision: https://phabricator.services.mozilla.com/D126077
2021-09-20 12:05:32 +00:00
Boris Chiou 27c108353e Bug 1676782 - Part 5: Drop the unused effective_xxx_rules. r=emilio
It seems only effective_style_rules() and effective_viewport_rules() are
used. Let's drop the unused ones.

Differential Revision: https://phabricator.services.mozilla.com/D125905
2021-09-17 20:25:37 +00:00
Boris Chiou b9289ab606 Bug 1676782 - Part 3: Add CSSScrollTimelineRule for CSSOM. r=emilio
Implement CSSScrollTimelineRule CSSOM API.
https://drafts.csswg.org/scroll-animations-1/#the-css-scroll-timeline-rule-interface

We rely on the CSSOM API for testing. However, the wpt doesn't match the
current spec and it has some errors. We update the wpt and enable the
preference for testing in the next patch.

Differential Revision: https://phabricator.services.mozilla.com/D125766
2021-09-17 20:25:36 +00:00
Boris Chiou 63df6026b6 Bug 1676782 - Part 2: Hook @scroll-timeline rule into style system. r=emilio
We add scroll-timeline rule into the stylesheet rule type, and add a new
perference to protect it: layout.css.scroll-linked-animations.enabled.

We will use this perference for animation-timeline property as well.

Differential Revision: https://phabricator.services.mozilla.com/D125765
2021-09-17 20:25:36 +00:00
Boris Chiou 9bf39f52dc Bug 1676782 - Part 1: Implement @scroll-timeline in style system. r=emilio
Define the data structure for @scroll-timeline rule, the parsing code,
and the serialization.

Differential Revision: https://phabricator.services.mozilla.com/D125764
2021-09-17 20:25:35 +00:00
Mike Hommey 7e36533f7a Bug 1730397 - Remove unnecessary semi-colons in some macros. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D125503
2021-09-15 07:53:20 +00:00
Chris Peterson c9530ebe28 Bug 1729598 - Replace MOZ_MUST_USE_TYPE with [[nodiscard]]. r=static-analysis-reviewers,andi
Differential Revision: https://phabricator.services.mozilla.com/D125504
2021-09-15 05:10:51 +00:00
criss 54043ff723 Backed out changeset 4c5f2e282204 (bug 1729421) for bc failures 2021-09-14 17:42:03 +03:00
Emilio Cobos Álvarez 5f285c94eb Bug 1729421 - Do not key rule tree children by cascade level. r=jwatt
This was needed before, since we used to optimize empty style rules away
(and thus we could get confused between the important and non-important
block for two different elements).

But now we always keep them, and thus there's no way for the same
declaration block to appear in two similar paths of the rule tree
without different cascade levels.

I found this because if we want to implement the revert-layer CSS-wide
keyword, we need to put the layer order in the rule tree. However the
same thing applies: The same style source will always have the same
layer for a given cascade-data rebuild, so I believe this should be
fine.

Differential Revision: https://phabricator.services.mozilla.com/D124740
2021-09-14 13:24:37 +00:00
Emilio Cobos Álvarez e53d06167c Bug 1730123 - Fix anonymous name handling in presence of stylesheet sharing. r=firefox-style-system-reviewers,boris
We need to compute the anonymous name on the fly while building the
CascadeData, otherwise we may see the same layer rule in two places due
to stylehseet sharing and make them incorrectly share a name.

Differential Revision: https://phabricator.services.mozilla.com/D125175
2021-09-11 00:04:18 +00:00
Emilio Cobos Álvarez b31a2c497f Bug 1730134 - Add some parsing and serialization tests for @layer. r=boris
This uncovers some serialization bugs, and some missing null-checks
given the statement layer doesn't have a rule list.

Differential Revision: https://phabricator.services.mozilla.com/D125176
2021-09-10 23:16:02 +00:00
Emilio Cobos Álvarez c2b9557652 Bug 1729804 - Add experimental support for "e", "pi", and various trigonometric functions in calc(). r=firefox-style-system-reviewers,boris
I'll add some tests before enabling. Also, WebKit folks (who have
implemented cos() / tan() / sin()) said they will upstream their tests
to WPT, so I'll extend those with the inverse functions before landing
as well.

Differential Revision: https://phabricator.services.mozilla.com/D124990
2021-09-10 18:22:36 +00:00
Emilio Cobos Álvarez ba14a8c91c Bug 1730098 - Don't consider system-ui valid for user font prioritization. r=jfkthame
Since the user can't configure it, at least from the UI (we could add UI
for it but it's unclear it'd be worth it).

Differential Revision: https://phabricator.services.mozilla.com/D125182
2021-09-10 12:08:19 +00:00
Emilio Cobos Álvarez 597b7bc37d Bug 1729330 - Add a simple CSSLayerRule implementation. r=smaug
The specifics of how this is going to work are still getting spec'd /
discussed in https://github.com/w3c/csswg-drafts/issues/6576, but this
allows DevTools to work fine and the feature to be complete enough for
Nightly experimentation (with the other in-flight patches).

Otherwise devtools crashes when trying to inspect pages that use them.

Differential Revision: https://phabricator.services.mozilla.com/D124656
2021-09-08 11:18:32 +00:00
Emilio Cobos Álvarez 1fc2475b41 Bug 1729289 - Fix layer statement with nested layer names. r=boris
When we had:

  @layer A.B;

We were registering "A" and "B", not "A" and "A.B", which was the intention.

Fix is trivial.

Depends on D124620

Differential Revision: https://phabricator.services.mozilla.com/D124621
2021-09-08 11:17:04 +00:00
Emilio Cobos Álvarez f4095b3242 Bug 1729289 - Fix out of order child layer registration, and enable the tests. r=boris
This makes layer order use a fixed set of bits per nesting level, to "reserve"
bits for children before they are registered.

See the comment in LayerOrder for the implementation limits it imposes, and
potential alternatives if these limits are not enough (but I think they should
be).

Enable the tests, as they mostly pass now (commit incoming to fix the remaining
ones).

Differential Revision: https://phabricator.services.mozilla.com/D124620
2021-09-08 11:17:04 +00:00
Jonathan Kew 6dbef6ba5d Bug 1729147 - Fix the serialization order for the text-decoration shorthand to match the canonical order in the spec. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D124536
2021-09-06 18:22:37 +00:00
Emilio Cobos Álvarez 9309bf97fc Bug 1699217 - Implement @import layer|layer(<name>). r=boris
This works modulo the existing nested layer order bug. Will be covered
by WPT /css/css-cascade/layer-import.html once the feature is enabled (I
can probably enable it right away for those tests, but I'd rather fix
the obvious bugs first).

Differential Revision: https://phabricator.services.mozilla.com/D124538
2021-09-06 16:43:04 +00:00
Sandor Molnar b2955e8a9d Backed out changeset 34c1b1078f03 (bug 1699217) for causing wpt failures in /css/css-cascade/layer-import. CLOSED TREE 2021-09-06 19:32:53 +03:00
Emilio Cobos Álvarez 1bd2094286 Bug 1699217 - Implement @import layer|layer(<name>). r=boris
This works modulo the existing nested layer order bug. Will be covered
by WPT /css/css-cascade/layer-import.html once the feature is enabled (I
can probably enable it right away for those tests, but I'd rather fix
the obvious bugs first).

Differential Revision: https://phabricator.services.mozilla.com/D124538
2021-09-06 11:15:57 +00:00
Emilio Cobos Álvarez d71b30b35d Bug 1728754 - Plumb layer order through ApplicableDeclarationBlock, and make it have an effect. r=boris
Same, I want to land this separately to see if it affects
micro-benchmarks. If so, we might want to pack the layer order
_somewhere_ (though in this case I'm not sure where, tbh).

With this, layer rules should have an effect on the page. There are
a few things missing before being able to enable them:

 * Fix nested layer order in some cases (when parent layers are declared
   out of order, see the previous commit mentioning this).
 * Some kind of OM representation, perhaps.
 * Tests of course, which are coming in bug 1728722 and bug 1727276.

But this should be enough to allow playing with them.

Depends on D124337

Differential Revision: https://phabricator.services.mozilla.com/D124338
2021-09-06 10:02:07 +00:00
Emilio Cobos Álvarez 13245e72d6 Bug 1728754 - Add layer_order to rules. r=boris
I want to land this separately because we might want to get smarter with
the size of the Rule struct (maybe restricting layer order to a u8 per
scope and packing it with the source order, since 255 layers seem
plenty), but I'd rather do the obvious thing for now.

Depends on D124336

Differential Revision: https://phabricator.services.mozilla.com/D124337
2021-09-06 09:54:02 +00:00
Emilio Cobos Álvarez 56d7403b70 Bug 1728754 - Tweak recursion in add_rule to only cause a function call per recursion level. r=boris
This code is really hot, and we've had perf regressions in the past for
introducing function calls in the hot path.

After the previous patch, add_rule is recursive and thus it can't be
inlined, causing a function call for each CSS rule.

This reduces the overhead by making the function take a rule list
instead, causing a function call per rule _list_, which should be
unnoticeable in practice.

Depends on D124335

Differential Revision: https://phabricator.services.mozilla.com/D124336
2021-09-04 07:42:46 +00:00
Emilio Cobos Álvarez bb807d90de Bug 1728754 - Compute layer order during CascadeData rebuild. r=boris
For that, deal with children in add_rule recursively, to keep the
current layer name up-to-date in block layer rules.

This is not the final version of this code, as right now something like
this:

  @layer A {
    ...
  }

  @layer B {
    ...
  }

  @layer A.A {
    ...
  }

Would give A.A more priority over B, which is not correct. There are
tests for this incoming in wpt sync and such, but that can be tweaked
later.

Differential Revision: https://phabricator.services.mozilla.com/D124335
2021-09-04 07:42:46 +00:00
Emilio Cobos Álvarez 367ee8048d Bug 1728754 - Factor out adding a rule in CascadeData::add_rule. r=boris
This shouldn't have any behavior change, but is necessary because for
cascade layers we are going to need to handle the child rules / sheets
ourselves, in order to handle nested layers properly.

Differential Revision: https://phabricator.services.mozilla.com/D124334
2021-09-04 07:42:45 +00:00
Emilio Cobos Álvarez 7bd3a20ff4 Bug 1728851 - Add attributes to the rule hash. r=boris
See the discussion here: https://twitter.com/Rich_Harris/status/1433153204678799365

This should make attribute selectors roughly as fast as class selectors.

I think it's worth trying and see if perf bots complain on
micro-benchmarks and stylebench and such.

I made attributes more specific than local names, but less specific than
classes, which I think makes sense. When doing something like
foo[data-bar], filtering by data-bar seems likely to yield less elements
than filtering by foo.

While at it, remove the bloom filter pref since we shipped it in
bug 1704551 for 87 and we haven't heard complaints.

Differential Revision: https://phabricator.services.mozilla.com/D124383
2021-09-03 15:57:30 +00:00
Emilio Cobos Álvarez c112357ea9 Bug 1728633 - Hook up basic @layer rule parsing. r=boris
Disabled, and of course doing nothing for now still, but this is another
piece that is useful to get reviewed separately.

Don't allow layers to be interleaved with @import / @namespace rules as
per https://github.com/w3c/csswg-drafts/issues/6522.

Differential Revision: https://phabricator.services.mozilla.com/D124229
2021-09-03 09:28:08 +00:00
Emilio Cobos Álvarez 4b3dc20891 Bug 1728617 - Tweak at-rule parsing APIs to support cascade layers. r=boris
This needs https://github.com/servo/rust-cssparser/pull/287 and a
cssparser update.

Differential Revision: https://phabricator.services.mozilla.com/D124216
2021-09-03 09:26:10 +00:00
Emilio Cobos Álvarez fdb57614e0 Bug 1728348 - Restore an #[allow] that will otherwise cause warnings.
MANUAL PUSH: Trivial no-behavior-change CLOSED TREE
2021-09-03 11:20:25 +02:00
Emilio Cobos Álvarez 0f945d081b Bug 1728348 - Add some scaffolding for @layer rules. r=boris
Not hooked anywhere yet, so this doesn't change behavior, but adds the
basic data model etc.

Adding parsing support requires some changes to cssparser to allow the
same at rule to be block and statement-like at the same time, so better
done separately.

Differential Revision: https://phabricator.services.mozilla.com/D124079
2021-09-03 09:12:43 +00:00
criss c6ef85e3b3 Backed out changeset 876e53ec90c4 (bug 1728851) as requested by Emilio. CLOSED TREE 2021-09-03 12:13:11 +03:00
Emilio Cobos Álvarez f28b5935c0 Bug 1728851 - Add attributes to the rule hash. r=boris
See the discussion here: https://twitter.com/Rich_Harris/status/1433153204678799365

This should make attribute selectors roughly as fast as class selectors.

I think it's worth trying and see if perf bots complain on
micro-benchmarks and stylebench and such.

I made attributes more specific than local names, but less specific than
classes, which I think makes sense. When doing something like
foo[data-bar], filtering by data-bar seems likely to yield less elements
than filtering by foo.

While at it, remove the bloom filter pref since we shipped it in
bug 1704551 for 87 and we haven't heard complaints.

Differential Revision: https://phabricator.services.mozilla.com/D124383
2021-09-03 08:58:20 +00:00
Emilio Cobos Álvarez 70f53c85d4 Bug 856337 - Implement image-rendering: smooth and image-rendering: pixelated. r=jrmuizel,dholbert,longsonr
Also, more directly go from StyleImageRendering to wr::ImageRendering.

 * image-rendering: smooth the non-deprecated version of
   OptimizeQuality, which maps to SamplingFilter::LINEAR /
   wr::ImageRendering::Auto (which uses gl::LINEAR).

 * image-rendering: pixelated maps to wr::ImageRendering::Pixelated /
   SamplingFilter::POINT which is the same crisp-edges does.

Note that this uncovers that we were mapping image-rendering:
crisp-edges to wr::ImageRendering::Pixelated.

I'm going to preserve behavior on this patch but we should consider
switching that to map to wr::ImageRendering::CrispEdges on a
follow-up (filed bug 1728831 for this).

Differential Revision: https://phabricator.services.mozilla.com/D124378
2021-09-03 08:56:43 +00:00
Emilio Cobos Álvarez 58c214fd32 Bug 856337 - Move image-rendering out of mako. r=dholbert
It's easier to touch in the future that way, even though the derive list is
massive.

Differential Revision: https://phabricator.services.mozilla.com/D124377
2021-09-03 08:56:42 +00:00
Noemi Erli f3a236c514 Backed out 2 changesets (bug 856337) for causing xpcshell failures in test_css-properties-db.js CLOSED TREE
Backed out changeset 7070c7cea8ec (bug 856337)
Backed out changeset edc12b36439f (bug 856337)
2021-09-03 01:36:17 +03:00