Commit graph

1737 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
55d0636fe5 style: Remove layout.css.is-and-where-better-error-recovery.enabled
We shipped this in 84

Differential Revision: https://phabricator.services.mozilla.com/D123623
2023-05-24 18:32:43 +02:00
Nazım Can Altınova
5a9fae3fb5 style: Remove the old profiler label frames code in the servo codebase and replace it with the new API
Differential Revision: https://phabricator.services.mozilla.com/D120795
2023-05-24 18:32:40 +02:00
Emilio Cobos Álvarez
eca66dba72 style: Factor PreferenceSheet colors to its own struct
This will come handy in the next patch.

Depends on D120678

Differential Revision: https://phabricator.services.mozilla.com/D120679
2023-05-24 18:32:39 +02:00
Emilio Cobos Álvarez
8f4d782952 style: Don't EnsureUniqueInner from the cssRules getter
Instead, fix up the various content data structures when the stylesheet
is mutated. This makes reading a stylesheet not disable style sharing.

Differential Revision: https://phabricator.services.mozilla.com/D115203
2023-05-24 18:32:38 +02:00
Emilio Cobos Álvarez
1918c1c203 style: Inline GeckoNode::prev_sibling
It's very hot when matching some kind of selectors like the ones in bug
1717267, and the two function calls show up in the profiles.

Differential Revision: https://phabricator.services.mozilla.com/D119505
2023-05-24 18:32:37 +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
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
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
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
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
Oriol Brufau
773ddf31fe style: Support the type() function in image-set
Differential Revision: https://phabricator.services.mozilla.com/D109201
2023-05-17 02:12:40 +02:00
Oriol Brufau
e23a8bf0ad style: Add attribute names to the bloom filter
Safari does this. This reduces the runtime in the example linked from
comment 0 quite a lot (40ms on a local opt build, from ~130ms on a
release nightly build).

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

Differential Revision: https://phabricator.services.mozilla.com/D111689
2023-05-16 23:40:23 +02:00
Oriol Brufau
693c2f0d27 style: Remove -moz-proton-infobars media query support
Differential Revision: https://phabricator.services.mozilla.com/D110963
2023-05-16 23:15:26 +02:00
Oriol Brufau
bbc03a2577 style: Enable Proton Urlbar
Differential Revision: https://phabricator.services.mozilla.com/D110998
2023-05-16 23:13:14 +02:00
Oriol Brufau
7bb15f19f1 style: Remove dead prefers-color-scheme: no preference code
It was removed in bug 1643656.

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

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

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

Differential Revision: https://phabricator.services.mozilla.com/D110816
2023-05-16 23:01:29 +02:00
Oriol Brufau
060d74ba3b style: Share CascadeData instances across ShadowRoots
This should be both a memory and speed win for pages using a lot of
Shadow DOM.

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

Differential Revision: https://phabricator.services.mozilla.com/D107266
2023-05-16 13:00:08 +02:00
Oriol Brufau
ab2ba273e3 Simplify our setup for font metric queries from style
This is a backport of https://phabricator.services.mozilla.com/D157589,
by Emilio Cobos Álvarez, plus some additions so that Servo compiles,
and some parts from https://phabricator.services.mozilla.com/D144455.

Should have no change in behavior.
2023-05-11 21:02:15 +02:00
Oriol Brufau
6785c57c78 Add support for the 'cap' font-relative unit
This is a backport of https://phabricator.services.mozilla.com/D133101,
by Jonathan Kew.

Note that Servo isn't using font metrics yet, so the unit still won't
really work.
2023-05-10 03:02:30 +02:00
Emilio Cobos Álvarez
31e8e418ea Miscellaneous build / tidy fixes. 2021-02-26 17:53:55 +01:00
Emilio Cobos Álvarez
80dae5bc59 Rustfmt. 2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
a5cb6c6927 style: Remove prefers-contrast: forced as per CSSWG resolution.
Differential Revision: https://phabricator.services.mozilla.com/D106485
2021-02-26 16:44:05 +01:00
Boris Chiou
52d39fc1bc style: Move Ratio into independent files.
Based on https://drafts.csswg.org/css-values/#ratios, <ratio> should be
a general types in css values, and now the media query and the position use
this type, so let's move it into the independent files.

Differential Revision: https://phabricator.services.mozilla.com/D106218
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
35b080e021 style: Implement :user-valid and :user-invalid.
And alias :-moz-ui-valid and :-moz-ui-invalid to them.

There are CSSWG resolutions for these for quite a while, and spec for
user-invalid.

Differential Revision: https://phabricator.services.mozilla.com/D105966
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
b90f5f099f style: Hide :-moz-submit-invalid behind a pref.
No other browser supports anything like this and we don't even have
internal users. Only uses of this I've found on the wild were just
resetting the box shadow internal styling we added in bug 582277 (and
since removed in bug 600151).

Differential Revision: https://phabricator.services.mozilla.com/D105955
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
e084d8e9d2 style: Remove focus-visible feature flag.
This shipped in 85, we can remove the feature flag now. Keep
:-moz-focusring as an alias to :focus-visible at parse time.

Differential Revision: https://phabricator.services.mozilla.com/D103752
2021-02-26 16:44:05 +01:00
Mats Palmgren
1927a676fd Bug 1687239 part 3 - Remove the PluginProblem UA Widget and related CSS pseudos.
Differential Revision: https://phabricator.services.mozilla.com/D102901
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
f4a8acc558 style: Add a non-native-theme media query.
Differential Revision: https://phabricator.services.mozilla.com/D102457
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
f16305d25a style: Remove layout.css.unknown-webkit-pseudo-element.
Enabled since bug 1486325 (Firefox 64).

Depends on D101290

Differential Revision: https://phabricator.services.mozilla.com/D101291
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
70edd2318c style: Remove layout.css.file-selector-button.enabled pref.
On by default since bug 1662478 (Firefox 82)

Depends on D101289

Differential Revision: https://phabricator.services.mozilla.com/D101290
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
ad8ac70ae8 style: Remove the moz-focus-outer code.
This pseudo does nothing and we successfully removed it in bug 1655859
(firefox 81).

Differential Revision: https://phabricator.services.mozilla.com/D101289
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
4f28a8cd31 style: Implement parsing and serialization for most of image-set().
This implements the basic image-set notation without the format()
function (for simplicity).

There's a remaining serialization issue (we should probably skip 1x
resolutions), but that's fine for now, I'll address this in a follow-up
when the feature is testable.

The intention is to do the image selection at computed value time
(keeping a selected index or such), but same, follow-up.

This also fixes an issue where the cors-mode for -moz-image-rect and
cross-fade() was getting ignored when parsing.

Differential Revision: https://phabricator.services.mozilla.com/D100640
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
a4506d94ec style: Remove some dead plugins code.
Differential Revision: https://phabricator.services.mozilla.com/D100472
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
892b0ffb5d style: Use an AutoTArray for atom arrays in attributes (class / part).
These are never empty, and storing 4 elements inline seems worth it
given we also heap-allocate the array itself.

Depends on D100592

Differential Revision: https://phabricator.services.mozilla.com/D100593
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
610ebe2e25 style: Reorder some conditions when handling class/part attributes.
Empty class attributes are uncommon.

Differential Revision: https://phabricator.services.mozilla.com/D100592
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
a3f84f85e3 style: Remove layout.css.moz-any-is-is.enabled.
We shipped this, let's remove the MozAny code.

Differential Revision: https://phabricator.services.mozilla.com/D99607
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
72a0dbacc7 style: Expose :autofill behind a pref to content, and add :-webkit-autofill as a compat alias.
Nightly only until we get resolutions on the relevant spec issues.

Differential Revision: https://phabricator.services.mozilla.com/D99296
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
019e6a3e2a style: Rename -moz-autofill to just autofill.
No compat impact, as this remains an internal pseudo-class for the time
being.

Differential Revision: https://phabricator.services.mozilla.com/D99295
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
45af831c82 style: Remove layout.css.xul-tree-pseudos.content.enabled.
We unshipped these a while ago and left the pref just for testing
purposes. But now all the reftests using it were conveniently migrated
to chrome:// tests, so we no longer need it.

Differential Revision: https://phabricator.services.mozilla.com/D56950
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
5277275263 style: Make CssUrl::is_fragment marginally more efficient.
No need to do utf8 shenanigans for what this function does.

Differential Revision: https://phabricator.services.mozilla.com/D97473
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
9f40b9ba38 style: Avoid some allocations in selector serialization.
The allocations in display_to_css_identifier show up in the profiles of
bug 1675628.

Differential Revision: https://phabricator.services.mozilla.com/D97856
2021-02-26 16:44:05 +01:00
David Parks
178e627500 style: Replace plugin behavior with a basic fallback
The browser currently only enables plugin behavior for Flash and our internal test plugins.  This patch replaces support for those plugins with a simple fallback that shows a transparent region where the plugin would have been.  It removes the file system search(es) for the plugin dynamic libraries and short-circuits the logic to determine if plugins should do something special -- all implementations now behave the same in the presence of plugin elements.

The new behavior is:
1. If the <object> or <embed> element lists a type of something other than "x-shockwave-flash" or "x-test" then the behavior is unchanged.  This means that non-plugin types behave properly and unknown types (for example, typos) are also unaffected (they reduce to 0x0 elements).
2. If the <object> element has an HTML fallback in the DOM (see spec for <object> elements) then the fallback is always shown.
3. Otherwise, the element is shown as a transparent region with the size specified in attributes.

Differential Revision: https://phabricator.services.mozilla.com/D95902
2021-02-26 16:44:05 +01:00
Markus Stange
1e815ab3c3 style: Replace obsolete -moz-mac-yosemite-theme media query with a new -moz-mac-big-sur-theme media query.
Differential Revision: https://phabricator.services.mozilla.com/D97089
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
4771d7ddf0 style: Make focus-visible match the spec more closely.
The spec text has been improved a while ago, so I think we should do
this. This keeps the current moz-focusring behavior when the pref is
disabled, but when enabled it becomes effectively an alias of
focus-visible.

Differential Revision: https://phabricator.services.mozilla.com/D96697
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
20d2a06967 style: Use document quirks mode rather than sheet quirks mode for stylesheet invalidation.
In order to determine whether classes or ids are case insensitive we
need the document quirks mode. The sheet quirks mode almost always
matches, but may not match when sheets are added by privileged APIs.

Differential Revision: https://phabricator.services.mozilla.com/D95061
2021-02-26 16:44:05 +01:00
Ricky Stewart
8a723d48d5 Standardize on Black for Python code in mozilla-central.
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.

To produce this patch I did all of the following:

1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.

2. Run ./mach lint --linter black --fix

3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.

4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).


Differential Revision: https://phabricator.services.mozilla.com/D94045
2021-02-26 16:44:05 +01:00
Boris Chiou
61685ca9b3 style: Serialize a 0/0 ratio as 0/0 in all value stages.
Based on the update of github.com/w3c/csswg-drafts/issues/5084,
a 0/0 ratio will serialize as 0/0 in all value stages.

Differential Revision: https://phabricator.services.mozilla.com/D93182
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
384fd59ad0 style: Use Option::as_deref() in style code.
And drive-by simplify another function that was only doing
Option::clone().

Differential Revision: https://phabricator.services.mozilla.com/D92839
2021-02-26 16:44:05 +01:00
tobar2018
4a625be8ad style: Remove all references to the preference 'layout.css.moz-touch-enabled.enabled'.
Differential Revision: https://phabricator.services.mozilla.com/D91401
2021-02-26 16:44:05 +01:00