Commit graph

44085 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
5b42605b79 style: Remove unused DeclarationBlock::get_at_importance.
Differential Revision: https://phabricator.services.mozilla.com/D94693
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
Cameron McCormack
a497b033dc style: Use separate Scrollbar and ThemedScrollbar ColorIDs.
Otherwise on Windows, we have a ColorID::Scrollbar but not any of the other scrollbar part
colors, and the Windows-provided value for Scrollbar doesn't work well
with the default values for the other scrollbar parts that come from the
non-native theme.

Differential Revision: https://phabricator.services.mozilla.com/D93728
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
a4f82712ae style: Always serialize ratio with both components.
Differential Revision: https://phabricator.services.mozilla.com/D93639
2021-02-26 16:44:05 +01:00
Cameron McCormack
a1fa0c610f style: Use LookAndFeelCache to pass Gtk theme-derived scrollbar colors to content processes.
Differential Revision: https://phabricator.services.mozilla.com/D93467
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
436632f378 style: Introduce InspectorUtils.supports().
Which allows to run CSS.supports in chrome/user-agent context. We should
probably add a couple more tweaks for stuff like quirks or what not (the
`ParsingMode` enum), but that seem lower priority.

I only added the one-value version of CSS.supports because it should be enough
and supporting the two value version required a bit of awkward code due to when
we parse the CSS property name right now.

Differential Revision: https://phabricator.services.mozilla.com/D92585
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
2b55918be6 style: Properly distinguish between empty children and no children in rule iterator.
So that skip_children(), which just pops the stack and is used by the
dynamic media query evaluation code, works as it should.

Differential Revision: https://phabricator.services.mozilla.com/D92717
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
Emilio Cobos Álvarez
379fb984f1 style: When resetting background color for high contrast, preserve alpha channel appropriately.
But discard it when backplating behind text, so that text is readable.

This should be uncontroversial... Dealing with widgets is a bit harder
so TBD.

Differential Revision: https://phabricator.services.mozilla.com/D91779
2021-02-26 16:44:05 +01:00
Frederic Wang
1a5f48ba43 style: Implement CSS parsing for the math-depth property.
Differential Revision: https://phabricator.services.mozilla.com/D91500
2021-02-26 16:44:05 +01:00
Frederic Wang
4dfcf583cf style: Rename -moz-math-script-level to math-depth.
This renames the internal -moz-math-script-level property in order to
prepare for full math-depth support. Currently, the property is guarded
under a disabled-by-default flag, so there should be no observable
behavior change.

Differential Revision: https://phabricator.services.mozilla.com/D91285
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
Frederic Wang
dab46fc958 style: Implement displaystyle attribute on all MathML elements.
Gecko implements the displaystyle attribute as defined by MathML 3 i.e.
only on the math, mstyle and mtable elements. This commit follows MathML
Core and instead define it as a global attribute mapped to math-style.
See https://mathml-refresh.github.io/mathml-core/#the-displaystyle-and-scriptlevel-attributes

Differential Revision: https://phabricator.services.mozilla.com/D90786
2021-02-26 16:44:05 +01:00
Frederic Wang
ca03f4df6d style: Implement the math-style property.
This patch renames the internal -moz-math-display to math-style and
exposes it under the layout.css.math-style.enabled preference. The
initial value becomes "normal" but that does not affect the default
MathML behavior since the UA style sheet sets the math-style property
explicitly on <math> tags. WPT tests are updated to use the syntax
approved by the CSSWG.

Intent to prototype: https://groups.google.com/forum/#!msg/mozilla.dev.platform/1hQQ7ISudGo/_yLEckEeBQAJ

Differential Revision: https://phabricator.services.mozilla.com/D90731
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
74a46d96eb style: Don't optimize ::before/::after away if content/display have been specified via custom properties.
We need to treat them the same way as we treat content: inherit.

Differential Revision: https://phabricator.services.mozilla.com/D90222
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
60d89cfbc0 style: CSSOM should respect rule-level property restrictions.
Differential Revision: https://phabricator.services.mozilla.com/D90729
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
c99d6adf01 style: Consider display: none elements as having current style for animation-only traversal.
This is mostly a band-aid, though it also serves sorta as an
optimization.

The issue here is basically bug 1393323. By re-cascading, right now we
can't come up with the right before-change style if CSSOM has mutated
the rules. We really need a better way to come up with the before-change
style, as the animation-only traversal is not really sustainable (nor
fast, for that matter...).

But this avoids crashing and prevents the regression easily, so let's do
that for now.

Differential Revision: https://phabricator.services.mozilla.com/D90700
2021-02-26 16:44:05 +01:00
Mats Palmgren
1f8c9aec88 style: [css-lists-3][css-pseudo-4] Add support for 'text-transform' on ::marker.
Differential Revision: https://phabricator.services.mozilla.com/D90329
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
f2e765296a style: Allow :is() and :where() to have better error recovery.
Adjust is-where-parsing.html to work with both the new and old behavior,
and add a test for the new behavior.

Depends on D90049

Differential Revision: https://phabricator.services.mozilla.com/D90050
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
83448b6889 style: Remove -moz-suppressed.
Per spec we shouldn't behave differently depending on how we blocked the
image/object/etc.

This may have made sense in the past when ad blockers were implemented
via nsIContentPolicy, but I think nowadays it doesn't make sense, and
showing fallback is preferred.

There's a couple extra cleanups we can do after this lands, like
removing HTMLImageElement.imageBlockingStatus and simplifying a bit that
code. But I'll do that in a separate bug.

Differential Revision: https://phabricator.services.mozilla.com/D89912
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
19c24075b4 style: Remove -moz-user-disabled.
We treat it exactly the same as -moz-broken. The pseudo-class is not
exposed to content, so I don't think we have a reason to keep it around.

Differential Revision: https://phabricator.services.mozilla.com/D89904
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
768db078ef style: Make appearance: button behave like auto.
As per https://github.com/w3c/csswg-drafts/issues/5174.

Differential Revision: https://phabricator.services.mozilla.com/D89119
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
ad0f63769c style: Speed up custom property diffing.
When entering or leaving fullscreen in youtube, we spend most of the
restyle time diffing custom properties, under IndexMap::eq.

Turns out that IndexMap equality is not order-aware, and thus you
actually need to make a hashmap lookup for each entry in the map, which
is unnecessarily inefficient.

Instead, just compare the iterators.

See https://github.com/bluss/indexmap/issues/153.

Differential Revision: https://phabricator.services.mozilla.com/D89434
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
cd7619dbf6 style: Make @font-face and @counter-style serialization closer other browsers and style rules.
Style rules serialize on one line and so should @font-face blocks.

Part of https://github.com/w3c/csswg-drafts/issues/4828.

Differential Revision: https://phabricator.services.mozilla.com/D89302
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
74c449c04c style: Rename ::file-chooser-button to ::file-selector-button, and enable it in all channels.
See https://github.com/w3c/csswg-drafts/issues/5049

Differential Revision: https://phabricator.services.mozilla.com/D88995
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
35716fd514 style: Only apply grayscale filter for printing on print preview.
Differential Revision: https://phabricator.services.mozilla.com/D88065
2021-02-26 16:44:05 +01:00
Masatoshi Kimura
16e0fd3e1f style: Replace :-moz-native-anonymous-no-specificity with :where(:-moz-native-anonymous).
Differential Revision: https://phabricator.services.mozilla.com/D88255
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
f2dfe7f08c style: Bail out when collecting invalidations for nested rules if any of them make us fully invalid.
Differential Revision: https://phabricator.services.mozilla.com/D87446
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
c200b67395 style: Make media queries and viewport units in print be evaluated against the default page size minus margins.
For that, move the default page margin computation to nsPresContext.

See https://github.com/w3c/csswg-drafts/issues/5437 as to why doing this
and other alternatives.

Differential Revision: https://phabricator.services.mozilla.com/D87311
2021-02-26 16:44:05 +01:00
Zeke Medley
9fd3d9a5e9 style: Support forced colors media feature.
Enabled behind layout.css.forced-colors.enabled pending finalization
of the spec:

<https://drafts.csswg.org/mediaqueries-5/#forced-colors>

Differential Revision: https://phabricator.services.mozilla.com/D87147
2021-02-26 16:44:05 +01:00
Sean Feng
cf496e4727 style: Make the document blocked by the topmost element in the top layer.
Spec: https://html.spec.whatwg.org/multipage/#blocked-by-a-modal-dialog

Depends on D86392

Differential Revision: https://phabricator.services.mozilla.com/D86227
2021-02-26 16:44:05 +01:00
Shinichi Morimoto
5d5d4f4429 style: Remove layout.css.offset-logical-properties.enabled.
Differential Revision: https://phabricator.services.mozilla.com/D87297
2021-02-26 16:44:05 +01:00
Zeke Medley
25de2a406e style: Update the prefers-contrast media query to use the new more/less keywords.
Per the resolution here:
https://github.com/w3c/csswg-drafts/issues/2943#issuecomment-672994920

Differential Revision: https://phabricator.services.mozilla.com/D86848
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
9d55296893 style: Fix two minor issues with scrollbar style caching.
Add -moz-inert and -moz-script-level to the set of internal properties
that aren't included in "all".

-moz-inert may need to be uncacheable in the future if we make it not
change the pointer-events computed value. Left a comment to that effect.

Differential Revision: https://phabricator.services.mozilla.com/D87115
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
73a9c57c3b style: Implement :-moz-any() as an alias of :is().
This is strictly better and more flexible, but can change specificity so
have a pref in case it causes trouble. I doubt it will though, the
specificity rules of :is() make more sense, and my gut feeling is that
:-moz-any is not very used on the wild.

Make it early-beta-or-earlier for now to minimize risk, once this is on
nightly for a bit we can enable it everywhere.

Differential Revision: https://phabricator.services.mozilla.com/D86696
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
2167a0c099 style: Remove layout.css.comparison-functions.enabled.
Shipped since FF75 (bug 1519519).

Differential Revision: https://phabricator.services.mozilla.com/D86693
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
5ba426ae6f style: Remove layout.css.is-where-selectors.enabled.
Shipped since 78 (bug 1632646).

Differential Revision: https://phabricator.services.mozilla.com/D86662
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
0d7922cb53 style: Remove layout.css.shadow-parts.enabled.
Shipped since 72 (bug 1559074).

Differential Revision: https://phabricator.services.mozilla.com/D86661
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
ca7e1ecfd8 style: Invalidate for CSSOM changes in a more fine-grained way.
Also, for changes in CSS declarations, like changing
cssRules[i].style.color or something, we end up avoiding a lot of the
work we were doing.

This page still trips us in the sense that they add a stylesheet, then
call getBoundingClientRect(), then insert more rules in the stylesheet,
which causes us to rebuild a lot of the cascade data.

We could try to detect appends to the last stylesheet on the list or
something I guess, and avoid rebuilding the cascade data in some cases.

Depends on D85615

Differential Revision: https://phabricator.services.mozilla.com/D85616
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
dfa715a8d8 style: Fix a silly mistake in which we'd prefer a local name / tag invalidation to an id invalidation.
ID invalidations should always win.

This also prefers invalidations deeper in the subtree to higher up.

Differential Revision: https://phabricator.services.mozilla.com/D85615
2021-02-26 16:44:05 +01:00
Nicolas Silva
1f36216b59 style: Update euclid in stylo.
Differential Revision: https://phabricator.services.mozilla.com/D85762
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
687fc20274 style: Use Overflow::is_scrollable in StyleAdjuster.
It was introduced in the overflow: clip work but this standalone
equivalent remained.

Differential Revision: https://phabricator.services.mozilla.com/D85778
2021-02-26 16:44:05 +01:00
Mats Palmgren
b29824bf75 style: Implement overflow:clip/visible combinations.
Differential Revision: https://phabricator.services.mozilla.com/D73717
2021-02-26 16:44:05 +01:00
Jeremy Ir
9bfcb3d741 style: Rename overflow:-moz-hidden-unscrollable to overflow:clip.
Differential Revision: https://phabricator.services.mozilla.com/D73716
2021-02-26 16:44:05 +01:00
Zeke Medley
8f89ebffec style: Add parsing for cross-fade from CSS Image Values and Replaced Content Module Level 4.
This is the first of what will likely be a couple patches for
cross-fade's implementation. Bug 546052 tracks it's complete
implementation.

Differential Revision: https://phabricator.services.mozilla.com/D81889
2021-02-26 16:44:05 +01:00
Brian Birtles
7c3d815f78 style: Make text-combine-upright not animatable.
Differential Revision: https://phabricator.services.mozilla.com/D84935
2021-02-26 16:44:05 +01:00
Alexander Surkov
32f92d18a8 style: implement -moz-inert CSS property.
-moz-inert CSS property reflects inert subtrees concept and can be used to implement HTML:dialog element and HTML:inert attribute

Differential Revision: https://phabricator.services.mozilla.com/D81701
2021-02-26 16:44:05 +01:00
Philipp Zech
cd8c07abac style: Convert writing-modes #defines to an enum class.
Differential Revision: https://phabricator.services.mozilla.com/D84016
2021-02-26 16:44:05 +01:00
Brian Birtles
ad22c7a369 style: Allow animations and transitions on ::marker
As per the following change to the spec:

6b3d7240b5

The additional failure annotation is added because we don't currently treat
text-combine-upright as non-animatable and this patch exposes the existing bug
(bug 1654195).

Differential Revision: https://phabricator.services.mozilla.com/D84308
2021-02-26 16:44:05 +01:00