Commit graph

8385 commits

Author SHA1 Message Date
Oriol Brufau
2c5aa34bb0 Further changes required by Servo 2023-05-24 18:32:36 +02:00
Mats Palmgren
d92f66246e style: [css-content] Implement 'content: none' for elements
Differential Revision: https://phabricator.services.mozilla.com/D114130
2023-05-24 18:32:36 +02:00
Mats Palmgren
183ec78be5 style: Implement 'content: none' for ::marker
Differential Revision: https://phabricator.services.mozilla.com/D111707
2023-05-24 18:32:36 +02:00
Emily McDonough
c9d4f812e5 style: Use a computed type for page-size which converts paper sizes to a Size2D
Differential Revision: https://phabricator.services.mozilla.com/D115842
2023-05-24 18:32:36 +02:00
Oriol Brufau
4f0e0c888c Further changes required by Servo 2023-05-24 18:32:36 +02:00
Emilio Cobos Álvarez
67f9b97735 style: Unify font-family storage
This changes font-family storage to reuse the rust types, removing a
bunch of code while at it. This allows us to, for example, use a single
static font family for -moz-bullet and clone it, rather than creating a
lot of expensive copies.

Differential Revision: https://phabricator.services.mozilla.com/D118011
2023-05-24 18:32:35 +02:00
Emilio Cobos Álvarez
837e41c8eb style: Remove -moz-outline-radius
It does nothing since 88 and we unshipped it in 89.

Differential Revision: https://phabricator.services.mozilla.com/D117532
2023-05-24 18:32:35 +02:00
Emilio Cobos Álvarez
ed806afe52 style: Expose text selection foreground / background colors to chrome code
Differential Revision: https://phabricator.services.mozilla.com/D117417
2023-05-24 18:32:35 +02:00
Oriol Brufau
2bf074e434 Further changes required by Servo 2023-05-24 18:32:35 +02:00
Emilio Cobos Álvarez
9eb244fc0c style: Add an internal -moz-system-color() function to expose both light and dark system colors
Differential Revision: https://phabricator.services.mozilla.com/D117416
2023-05-24 18:32:35 +02:00
Oriol Brufau
0ebad03ab5 Further changes required by Servo 2023-05-24 18:32:35 +02:00
Jonathan Kew
16168fe4e7 style: Implement CSS support for the optional adjustment-basis metric keywords for the font-size-adjust property (enabled on Nightly only for now)
Differential Revision: https://phabricator.services.mozilla.com/D115596
2023-05-24 18:32:34 +02:00
Oriol Brufau
d1936e6a4a Further changes required by Servo 2023-05-24 18:32:34 +02:00
Mats Palmgren
d7e00ba03d style: Add some style quirks for legacy ::markers created from list-style-type/list-style-image
Specifically:
For "bullets", i.e. 'list-style-type:disc|circle|square|
disclosure-closed|disclosure-open', we use a built-in font
(-moz-bullet-font, which has glyphs for those symbols + space) to
retain mostly backwards compatible rendering for those.  Authors may
override that with an explicit 'font-family' ::marker style though.
We also use this font for 'list-style-image' in case it would
fallback to one of the above when the image fails to load (so that
we get the same width space).

When the -moz-bullet-font is used we also set 'font-synthesis' to
avoid synthesizing italic/bold for this font. Authors may override
this with an explicit ::marker declaration.

We also set 'letter-spacing' and 'word-spacing' to the initial value
for bullets for web-compat reasons.  Again, authors may override
this with an explicit ::marker declaration. (This breaks backwards-
compat slightly but makes us compatible with Chrome.  We used to
ignore these for list-style-type:<string> too.)

Differential Revision: https://phabricator.services.mozilla.com/D111693
2023-05-24 18:32:34 +02:00
Michelle Goossens
d2a7ebf789 style: Remove browser.proton.modals.enabled pref
Differential Revision: https://phabricator.services.mozilla.com/D116903
2023-05-24 18:32:34 +02:00
Emilio Cobos Álvarez
6d9580fef0 style: Specify has_no_effect_on_gecko_scrollbars on inherited internal properties
Otherwise we assert due to the styles being different from the cached
ones, but it doesn't matter as these don't influence Gecko scrollbars.

Differential Revision: https://phabricator.services.mozilla.com/D117147
2023-05-24 18:32:34 +02:00
Jonathan Kew
f0a178b56a style: Un-prefix -moz-tab-size (keeping the prefixed version as an alias for now)
This results in lots of new WPT test passes.

There were also a couple of WPT tests that turned out to be broken;
tab-size-inline-001 and -002 had errors in their reference files such
that they'd never pass anywhere. So those are fixed here.

Depends on D117331

Differential Revision: https://phabricator.services.mozilla.com/D117332
2023-05-24 18:32:33 +02:00
Oriol Brufau
4353d31cb0 Further changes required by Servo 2023-05-24 18:32:33 +02:00
Boris Chiou
11cadd8c42 style: Part 7: Notify style system when SMIL animation changes d attribute
So we update d property in the style system as well. This makes sure we
have the correct computed style and the correct rendering result.

Differential Revision: https://phabricator.services.mozilla.com/D115570
2023-05-24 18:32:33 +02:00
Boris Chiou
fa6ab91acd style: Part 1: Add SVG d property in CSS
Add d property for style system. d property only supports path() for now
and it has the functional notation without fill rule.

https://github.com/w3c/svgwg/issues/320#issuecomment-414462645

Differential Revision: https://phabricator.services.mozilla.com/D81237
2023-05-24 18:32:33 +02:00
Oriol Brufau
4c7ddd63b3 Further changes required by Servo 2023-05-24 18:32:33 +02:00
Nazım Can Altınova
8ca41ccf9e style: Replace the old profiler thread registration FFIs with the new API in servo
Differential Revision: https://phabricator.services.mozilla.com/D116517
2023-05-24 18:32:32 +02:00
Oriol Brufau
9273921fd3 Further changes required by Servo 2023-05-24 18:32:32 +02:00
Boris Chiou
d103785c4b style: Part 2: Support fit-content() in style
Support fit-content for preferred size, min size, and max size. This
patch only implement the style system. For layout part, we will do that
in the following patches.

Differential Revision: https://phabricator.services.mozilla.com/D107161
2023-05-24 18:32:32 +02:00
Michelle Goossens
77cab0edc3 style: Remove browser.proton.doorhangers.enabled pref
Differential Revision: https://phabricator.services.mozilla.com/D117091
2023-05-24 18:32:32 +02:00
Xidorn Quan
4934b747ef style: Make predefined symbolic counter styles not overridable
Differential Revision: https://phabricator.services.mozilla.com/D116938
2023-05-24 18:32:32 +02:00
Emilio Cobos Álvarez
b4546993b4 style: Fix whitespace handling inside CSS variables
As per w3c/csswg-drafts#881 and w3c/csswg-drafts#774.

Differential Revision: https://phabricator.services.mozilla.com/D116459
2023-05-24 18:32:31 +02:00
Emilio Cobos Álvarez
832807f15f style: Reserve -- as a custom property name
I think this should be fairly low risk, let's try to get it done sooner
rather than later.

Differential Revision: https://phabricator.services.mozilla.com/D116456
2023-05-24 18:32:31 +02:00
Emilio Cobos Álvarez
44b94f66f9 style: Use a nicer media query for proton context menus
Differential Revision: https://phabricator.services.mozilla.com/D116736
2023-05-24 18:32:31 +02:00
Emilio Cobos Álvarez
908c952ab0 style: Don't simplify percentages that resolve to lengths in min/max/clamp
Those can't be ordered at specified / computed value time, since the
percentage basis could be negative.

Needs tests of course, running through try atm.

Differential Revision: https://phabricator.services.mozilla.com/D115591
2023-05-24 18:32:31 +02:00
Emilio Cobos Álvarez
204cb7a9c0 style: Look at the right element for exportparts in each_applicable_non_document_style_rule_data
Otherwise we might not find those rules for invalidation.

Differential Revision: https://phabricator.services.mozilla.com/D115130
2023-05-24 18:32:31 +02:00
Emilio Cobos Álvarez
1ddd3b09c2 style: Refactor the author sheet cache to keep alive the relevant StylesheetContents
This prevents incorrectly reusing cached results when the contents go
away and new contents are allocated with the same address.

Note that these keep alive transitively everything else under them, so
all other medialist keys don't need this.

By making this a proper hashmap it should also improve cache lookup
times if the cache grows too big.

Differential Revision: https://phabricator.services.mozilla.com/D115202
2023-05-24 18:32:30 +02:00
Emilio Cobos Álvarez
9c32836913 style: Avoid returning fmt::Errors for things that are not formatting errors
They are not. The serialization code already checks if the result is
empty, which can happen for other reasons. This makes the code a bit
more resilient to misuse.

Differential Revision: https://phabricator.services.mozilla.com/D115133
2023-05-24 18:32:30 +02:00
Emilio Cobos Álvarez
4bcf4573db style: Avoid trying to serialize 'all' with stuff that isn't variable references or CSS wide keywords
All is special, and that'd cause an error later on.

Differential Revision: https://phabricator.services.mozilla.com/D115132
2023-05-24 18:32:30 +02:00
Emilio Cobos Álvarez
dd28d22cee style: Use titlebar colors when using CSD rather than -moz-menubartext
As the titlebar may be different when active / inactive, and have
other colors than a menubar.

Differential Revision: https://phabricator.services.mozilla.com/D114875
2023-05-24 18:32:30 +02:00
Emilio Cobos Álvarez
55f20759b2 style: Properly hide -moz-context-properties from content
Depends on D114481

Differential Revision: https://phabricator.services.mozilla.com/D114482
2023-05-24 18:32:30 +02:00
Emilio Cobos Álvarez
87a3f2598a style: Properly hide -moz-control-character-visibility from content
Differential Revision: https://phabricator.services.mozilla.com/D114481
2023-05-24 18:32:30 +02:00
Emilio Cobos Álvarez
6d6ea6cfe4 style: Remove support for unused gtk infobar widget and colors
Presumably they were for notifications and now we use native notifications?

Differential Revision: https://phabricator.services.mozilla.com/D114874
2023-05-24 18:32:29 +02:00
Emilio Cobos Álvarez
3cf8c19313 style: Support -webkit-image-set as a parse-time alias to image-set()
The webkit syntax is an strict subset of the modern one, so this should
be doable, and is the simplest.

If my reading of the WebKit code is correct it should also be the way
WebKit deals with this (except they restrict -webkit-image-set() syntax
artificially).

 * https://github.com/w3c/csswg-drafts/issues/6285
 * https://github.com/whatwg/compat/issues/144

Differential Revision: https://phabricator.services.mozilla.com/D114912
2023-05-24 18:32:29 +02:00
Oriol Brufau
aea14a2470 Further changes required by Servo 2023-05-19 19:06:09 +02:00
Oriol Brufau
1cc44bd065 style: Will-change should only create stacking contexts / containing blocks / etc if the property it'd change would apply
As per https://drafts.csswg.org/css-will-change/#will-change.

> If any non-initial value of a property would cause the element to
> generate a containing block for absolutely positioned elements,
> specifying that property in will-change must cause the element to
> generate a containing block for absolutely positioned elements.

But in this case the transform property wouldn't apply to the element so
there's no reason to create a stacking-context.

Differential Revision: https://phabricator.services.mozilla.com/D114121
2023-05-19 19:06:09 +02:00
Oriol Brufau
60867bbe7e style: Remove unused NS_CHANGE_COLOR_IF_SAME_AS_BG
It was introduced in bug 1024930, but it is unused since.

Differential Revision: https://phabricator.services.mozilla.com/D114389
2023-05-19 19:06:09 +02:00
Oriol Brufau
516c7a304a style: Use saturating addition for math-depth
Differential Revision: https://phabricator.services.mozilla.com/D114070
2023-05-19 19:06:08 +02:00
Oriol Brufau
43cec05c04 style: Don't allow whitespace between media query operator delim tokens
Differential Revision: https://phabricator.services.mozilla.com/D113648
2023-05-19 19:06:08 +02:00
Oriol Brufau
fb9d8ddc73 style: Make sure to consume the flusher when we hit the cascade data cache
So that sheets are properly marked as committed. The issue is that we
have this "committed" optimization, to avoid doing work if somebody adds
and removes an stylesheet without us flushing in the meantime:

  https://searchfox.org/mozilla-central/rev/f018480dfed4fc583703a5770a6db9ab9dc0fb99/servo/components/style/stylesheet_set.rs#308-319

The "committed" bit is set when we consume the flusher (in each(..)).

However when we hit the cache, before this patch, we wouldn't consume
it, which means that we may fail to do some full rebuilds even though we
need them.

Fix it by making sure we call each() in that case.

We add a test (the test would show a red square before this patch, and a
lime square with the fix).

Differential Revision: https://phabricator.services.mozilla.com/D113206
2023-05-19 19:06:08 +02:00
Oriol Brufau
90781493fc style: Make the -moz-toolbar-prefers-color-scheme a tri-state
This will allow detecting the system theme, which allows fixing some of
the blocked bugs.

Note that when using the system theme we will still match light or dark
appropriately, so this shouldn't change behavior just yet.

Differential Revision: https://phabricator.services.mozilla.com/D113516
2023-05-19 19:06:08 +02:00
Oriol Brufau
ab445a02b0 style: Implement accent-color in nsNativeBasicTheme
This is a new addition for CSS UI Level 4:

  https://drafts.csswg.org/css-ui-4/#widget-accent

I want to provide feedback on some spec issues, and thought it was a
kinda neat thing to prototype (it also makes testing contrast and such
with random GTK themes easier).

For now enable for Nightly only.

Differential Revision: https://phabricator.services.mozilla.com/D112312
2023-05-19 19:06:08 +02:00
Oriol Brufau
69fc5ca9fd style: Garbage-collect event state bits
We had about 9 gaps / unused bits. I moved the devtools ones at the end
because I think we should be able to remove them (but separate bug).

Differential Revision: https://phabricator.services.mozilla.com/D113365
2023-05-19 19:06:07 +02:00
Oriol Brufau
54965bbcb9 style: Fix whitespace handling in clamp() parsing
We should just restore the state when seeing whitespace and an unknown
token like when we do when finding any other token a few lines below.

This is not an issue for most callers (it's only an issue for clamp())
because the other callers use either `parse_comma_separated()` (for
min/max), or `parse_nested_block()` (for parens / nested calc()).

Both of those functions restrict the input in such a way that
is_exhausted returns true (a few lines above) and thus we parse
successfully.

Differential Revision: https://phabricator.services.mozilla.com/D112681
2023-05-19 19:06:07 +02:00
Oriol Brufau
d12cb17d73 style: -moz-toolbar-prefers-color-scheme for dark theme detection
This adds a new @media query -moz-toolbar-prefers-color-scheme which works like
prefers-color-scheme but is set based on the browser theme rather than the OS
theme. The background colour of the toolbar is used to determine the theme
dark/light preference. This will be used for in-content common.css pages and
other UI elements that include that stylesheet in the browser-chrome through
shadow DOM.

The end result is that about: pages, infobars, and modals will now "match" the
browser theme (just light/dark mode, not LWT theming support).

Differential Revision: https://phabricator.services.mozilla.com/D111486
2023-05-19 19:06:07 +02:00