Commit graph

25052 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
80dae5bc59 Rustfmt. 2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
c4ad61faa5 style: Don't allow to parse image-set(none).
`none` is not technically part of the `<image>` syntax. Tests in following
patches.

Depends on D100698

Differential Revision: https://phabricator.services.mozilla.com/D100699
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
a0c6628cf2 Miscellaneous rebase fixes. 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
0ef2410ea0 style: Implement Animate trait and ComputeSquaredDistance trait for <ratio>.
I also update the wpt becasue it seems the original one lets <ratio>
support the addition. However, the spec says "Addition of <ratio>s is not
possible".

Differential Revision: https://phabricator.services.mozilla.com/D106219
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
786b08a669 style: Increase custom property size limit a bit.
Differential Revision: https://phabricator.services.mozilla.com/D105978
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
Emily McDonough
4dc475d3a1 style: Rename alias to aliases in Longhand and Shorthand
Differential Revision: https://phabricator.services.mozilla.com/D105810
2021-02-26 16:44:05 +01:00
Emily McDonough
742c5e0d17 style: Use a base class for Shorthand and Longhand
Differential Revision: https://phabricator.services.mozilla.com/D105797
2021-02-26 16:44:05 +01:00
Markus Stange
e6aaafdda5 style: Remove -moz-mac-fullscreen-button value.
Depends on D105379

Differential Revision: https://phabricator.services.mozilla.com/D105380
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
490db1e2bd style: Reduce the amount of code generated by UnparsedValues::substitute_variables.
This reduces the amount of assembly instructions generated by this
function from 18k+ to ~800.

This should make reasoning about its stack space usage sane, and should
fix the ASAN stack overflows, but also we should take this regardless,
because it's saner and makes reading it simpler.

I also think that the writing_mode shenanigans is fixing a bug (I think
before this, we'd pick the first physical value which mapped to any of
the properties, which is wrong), but I haven't bothered looking for a
test-case that fails before my patch. The relevant WPTs
(css/css-logical/animation*) still pass.

Differential Revision: https://phabricator.services.mozilla.com/D105342
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
b0d05d1a5d style: Cache substituted values from shorthand properties during the cascade.
This brings the time down to 1.6ms from 4.8ms on the test-case in the
bug. This should be improvable too, but I think this is a nice
improvement for regular styling as well.

Differential Revision: https://phabricator.services.mozilla.com/D105187
2021-02-26 16:44:05 +01:00
Emily McDonough
1b18b06186 style: Switch properties to use a bitfield to determine validity in rules.
This doesn't use a full bitmap for every single rule type, as we only expect
that keyframe, page, and style rules will be checked.

Differential Revision: https://phabricator.services.mozilla.com/D104949
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
36e6c68c9f style: Rustfmt cascade.rs.
Differential Revision: https://phabricator.services.mozilla.com/D105186
2021-02-26 16:44:05 +01:00
Pierre TALLOTTE
48db30f6e2 style: Hide non-standard values of caption-side.
Differential Revision: https://phabricator.services.mozilla.com/D104321
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
4cb0a781d1 style: Minor cleanup of our @page rule setup.
Actually, there's not so much we can improve right now, in the sense
that:

 * We need the ::-moz-page-content pseudo-element to be able to set
 `display` on the page, since that's a style rule rather than a @page
 rule. We could get away without it.

 * Keeping the current code-path (slightly cleaned up) is less code, for
 now at least. We can have a separate code-path or what not that
 actually performs the @page rule selector-matching and what not if
 needed when we get to named pages or other page selectors. Selectors
 like :first should be pretty trivial to implement, actually.

We make some paged mode anon boxes non-inheriting anon boxes. This
allows us to share the styles and is generally nicer. They don't need to
inherit from anywhere.

We could remove the origin handling and don't look at UA rules or what
not, but it seems pretty harmless to do that.

We also fix the name of the pseudo-elements to match the capitalization.

Differential Revision: https://phabricator.services.mozilla.com/D104772
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
75d6be45f2 style: Make Linux tab bar use the darker of the highlight / highlighttext colors.
Some GTK themes use very soft colors for selection backgrounds, using
darker colors for the text. This makes the tab and focus outlines in the
tab bar not have sufficient contrast with usual backgrounds.

I needed to do this for bug 1690778, but it seems worth doing it on the
front-end as well.

Differential Revision: https://phabricator.services.mozilla.com/D104547
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
3a64fa2006 style: Normalize NaN in some other font-related lengths etc.
Depends on D104563

Differential Revision: https://phabricator.services.mozilla.com/D104565
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
db03b2cf8e style: Normalize NaN to zero as a result of calc().
Differential Revision: https://phabricator.services.mozilla.com/D104563
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
20f5e14bf8 style: Remove the need for needs_context in the mako glue.
It's only used to disambiguate between the one-argument and the trait
version of Keyword::parse. Instead, just explicitly use the trait
version, so that we don't need to specify it.

Differential Revision: https://phabricator.services.mozilla.com/D104328
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
5fe702fa2b style: Move caption-side outside of mako.
Make it an enum class, etc.

Differential Revision: https://phabricator.services.mozilla.com/D103978
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
84cabf2416 style: Support Grid/Flex/Table/Column layout for the rendered legend of a fieldset.
Differential Revision: https://phabricator.services.mozilla.com/D101555
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
4d8f55a7cb style: Add a more sensible scrollbar size API to nsITheme, and use it to replace ScrollbarNonDisappearing.
There's no reason we should need an scrollbar box to query the size of a
scrollbar. I plan to use this in the following patch to make the size of a
resizer not vary depending on whether the container has scrollbars or not,
which is what ultimately causes the reftest failure.

Differential Revision: https://phabricator.services.mozilla.com/D103302
2021-02-26 16:44:05 +01:00
Emily McDonough
96c08d78cf style: Add page-size parsing to Servo
Differential Revision: https://phabricator.services.mozilla.com/D102360
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
longsonr
eec92977f7 style: remove svg.transform-box.enabled pref
It's been default true since Firefox 55 via bug 1208550

Differential Revision: https://phabricator.services.mozilla.com/D102093
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
45b837399f style: Add dark mode to plaintext.css, and a document rule to target plaintext documents.
We add two @-moz-document functions: `plain-text-document()`, matching the
obvious, and `unobservable-document()`, which matches a top-level document with
no opener. This is the equivalent check we do for automatic darkening of
`about:blank` here:

    https://searchfox.org/mozilla-central/rev/014fe72eaba26dcf6082fb9bbaf208f97a38594e/layout/base/PresShell.cpp#5282

The former we don't need to use, but it's nice to let user stylesheets target
plaintext documents properly (rather than relying on extensions or what not).

Note that these are not content-observable.

Add two tests: One showing that we produce different rendering when on dark
mode, and one showing that we produce the same one from an iframe, regardless
of dark mode.

Depends on D101517

Differential Revision: https://phabricator.services.mozilla.com/D101518
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
df7ea837d8 style: Allow resource:// stylesheets to use chrome-only rules.
We'll use it to use @-moz-document from plaintext.css.

Differential Revision: https://phabricator.services.mozilla.com/D101516
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
7ddd46aba4 style: Implement source selection for image-set.
This is based on the logic in ResponsiveImageSelector::SelectImage (just
simplified because there's no viewport-dependent widths here).

Differential Revision: https://phabricator.services.mozilla.com/D100698
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
f27003c810 style: Teach style_derive's map_type_params about mapping self correctly.
Consider the following:

struct Complex<T> {
    something: T,
    #[compute(field_bound)]
    something_else: Generic<Self, T>,
}

That will generate:

impl<T> ToComputedValue for Complex<T>
where
    T: ToComputedValue,
    Generic<Self, T>: ToComputedValue<ComputedValue = Generic<Self, <T as ToComputedValue>::ComputedValue>>,
{
    // ...
}

That last clause is obviously incorrect. map_type_params correctly maps
the T, but it should know also about Self.

Ideally we could just do the same as for T and do:

    <Self as ToComputedValue>::ComputedValue

But that doesn't quite work, because we are in that implementation of
the trait, and the compiler rightfully complains about we don't yet
knowing the computed type. So we need to pass it explicitly, which is
simple enough, if a bit annoying.

Differential Revision: https://phabricator.services.mozilla.com/D83816
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
65a06d5003 style: Support full <image> syntax in list-style-image as per spec.
This allows supporting image-set(), etc, and simplifies the bullet frame
code significantly, too thanks to two changes:

  * Instead of manually managing the image request, use the CSS image
    loader, with the `REQUEST_REQUIRES_REFLOW` flag, to handle image
    loads correctly. This didn't exist when this code was initially
    implemented, but we can nicely use it now.

  * Instead of re-implementing another WebRender command-builder thing,
    we can just reuse the nsImageRenderer code.

Differential Revision: https://phabricator.services.mozilla.com/D100774
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
b8d46406f6 style: Inline nsTArray::deref.
This shaves >50ms if the compiler decides not to inline it, compilers are
sometimes dumb.

Depends on D100593

Differential Revision: https://phabricator.services.mozilla.com/D100594
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
0dc6c32759 style: Make next_in_preorder generate slightly better code.
This avoids the panic code in release builds.

Differential Revision: https://phabricator.services.mozilla.com/D100094
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
f58301ecbc style: Avoid UTF-8 -> UTF-16 conversion during CSSOM serialization.
This lifts a bunch of string conversions higher up the stack, but allows
us to make the servo code use utf-8 unconditionally, and seemed faster
in my benchmarking (see comment 0).

It should also make a bunch of attribute setters faster too (like
setting .cssText), now that we use UTF8String for them (we couldn't
because we couldn't specify different string types for the getter and
setters).

Differential Revision: https://phabricator.services.mozilla.com/D99590
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
Kartik Gautam
54f5b24c69 style: Remove trailing empty lines
Differential Revision: https://phabricator.services.mozilla.com/D99595
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
5f4da63a5e style: Remove some text-decoration prefs that are always on.
Differential Revision: https://phabricator.services.mozilla.com/D99675
2021-02-26 16:44:05 +01:00