Commit graph

25052 commits

Author SHA1 Message Date
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
108f61928b style: Use a more precise rule start for sanitization.
Differential Revision: https://phabricator.services.mozilla.com/D98710
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
bd2566d391 style: Update cssparser to get ParserState in rule parser.
The changes should be trivial.

The third_party changes are up for review in
https://github.com/servo/rust-cssparser/pull/277 (and of course I'll
land with a bump to 0.28 rather than the override after that gets r+'d).

The basic idea is that with this we have the actual start offset of the
rule, so we wouldn't include html comments or other invalid stuff we
discard during sanitization in bug 1680084. But that's a separate
change.

Differential Revision: https://phabricator.services.mozilla.com/D98677
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
Emily McDonough
eb257a4dc3 style: Separate out some of the declaration precedence components from @viewport rules
Differential Revision: https://phabricator.services.mozilla.com/D97817
2021-02-26 16:44:05 +01:00
Tim Nguyen
55e9d8c214 style: Remove layout.css.conic-gradient.enabled preference.
Differential Revision: https://phabricator.services.mozilla.com/D98126
2021-02-26 16:44:05 +01:00
Sunita Sen
9f20a24e4c style: Add support for touch-action:pinch-zoom - Add pinch-zoom support to touchAction.
Differential Revision: https://phabricator.services.mozilla.com/D97815
2021-02-26 16:44:05 +01:00
Sunita Sen
85b45cd615 style: Add support for touch-action:pinch-zoom - Rewrite to_css and parse for touchAction
Differential Revision: https://phabricator.services.mozilla.com/D97650
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
Tim Nguyen
4ea378a6ae style: Remove support for XUL grid display values.
Differential Revision: https://phabricator.services.mozilla.com/D53297
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
e1bf1648c7 style: Fix declaration block serialization and logical properties.
As per https://github.com/w3c/csswg-drafts/issues/3030.

Also remove a system font special-case. It's generally handled in
shorthands/font.mako.rs, and when it's not, it's really the same issue
as https://github.com/w3c/csswg-drafts/issues/2515.

Browsers are all over the place for the system font case, so I think
it's fine.

Differential Revision: https://phabricator.services.mozilla.com/D96045
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
42abdb99c4 style: Fix font loading invalidation to account for metrics coming from the parent style.
We were only looking at the given frame's style, which is not
sufficient for this case.

Differential Revision: https://phabricator.services.mozilla.com/D96237
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
bdbe8fde42 style: Shrink custom property maps before making them immutable.
Differential Revision: https://phabricator.services.mozilla.com/D96132
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
5d388745d8 style: Don't waste string space before making values immutable.
Differential Revision: https://phabricator.services.mozilla.com/D96130
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
Markus Stange
e2545ee95d style: Use the -moz-default-appearance values "scrollbar-horizontal" and "scrollbar-vertical" on macOS and remove the now-unused value "scrollbar".
Other platforms were already converted to scrollbar-horizontal and scrollbar-vertical in bug 1205643.

Differential Revision: https://phabricator.services.mozilla.com/D94674
2021-02-26 16:44:05 +01:00
Markus Stange
d246b9e4c3 style: Remove "scrollbar-small" -moz-default-appearance value and replace its single use with scrollbar-width: thin.
Differential Revision: https://phabricator.services.mozilla.com/D94673
2021-02-26 16:44:05 +01:00
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