Commit graph

23801 commits

Author SHA1 Message Date
Philipp Zech
9fd243bb39 style: Convert control-character-visibility #defines to an enum class.
Differential Revision: https://phabricator.services.mozilla.com/D68705
2020-04-16 16:35:07 +02:00
Tim Nguyen
d17b3cc202 style: Omit center positions in conic/radial gradient serialization.
Differential Revision: https://phabricator.services.mozilla.com/D67461
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
414edb5a4a style: Simplify the implementation of HasAuthorSpecifiedRules.
This patch computes the author-specified properties during the CSS cascade, and
removes the complex rule-tree-based implementation that tries to do the cascade
again.

This changes behavior in two ways, one of them which is not observable to
content, I believe:

 * revert now re-enables the native styling. This was brought up in
   https://github.com/w3c/csswg-drafts/issues/4777 and I think it is a bug-fix.

   This is observable to content, and I'm adding a test for it.

 * We don't look at inherited styles from our ancestors when `inherit` is
   specified in a non-author stylesheet. This was introduced for bug 452969 but
   we don't seem to inherit background anymore for file controls or such. It
   seems back then file controls used to have a text-field.

   I audited forms.css and ua.css and we don't explicitly inherit
   padding / border / background-color into any nested form control.

We keep the distinction between border/background and padding, because the later
has some callers. I think we should try to align with Chromium in the long run
and remove the padding bit.

We need to give an appearance to the range-thumb and such so that we can assert
that we don't call HasAuthorSpecifiedRules on non-themed stuff. I used a new
internal value for that.

Differential Revision: https://phabricator.services.mozilla.com/D67722
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
7d438cd816 style: Ensure that derived types are right for optimized-away implementations.
We have this optimization where, for non-generic structs, we generate just a
clone / move as the ToComputedValue / ToResolvedValue implementation.

This moves the optimization a bit further down, and refines it so that we still
generate all the relevant where clauses that make it sound, that is, that all
the ToComputedValue implementations of the fields return the same type.

Otherwise this wouldn't be sound and the type would need to become generic.

We add an escape hatch (no_field_bound) for fields that need to be cloned but
which don't implement the trait. This is right now only for the RefPtr<> in the
shared font-family list, and a piece of code in PaintWorklet which looks kinda
fishy, and probably should be fixed (but we don't ship it in Firefox and there's
a pre-existing FIXME for servo, so I punted on it for now).

The other thing this patch does is adding a bunch of ToComputedValue /
ToResolvedValue implementations that are trivial and were missing.

Differential Revision: https://phabricator.services.mozilla.com/D67913
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
0514059618 style: Don't append the default namespace for featureless host selectors.
Per the spec it shouldn't match, and the front-end has been bitten by this
multiple times.

Differential Revision: https://phabricator.services.mozilla.com/D68213
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
3004286308 style: Custom properties with invalid variable references should be unset, not invalid.
See https://github.com/w3c/csswg-drafts/issues/4075.

There are tests that will get updated and this will make pass in bug 1623347.

Differential Revision: https://phabricator.services.mozilla.com/D67373
2020-04-16 16:35:07 +02:00
Emily McDonough
e0b4619fa5 style: Enable multiple grid repeat values in Servo.
Differential Revision: https://phabricator.services.mozilla.com/D60931
2020-04-16 16:35:07 +02:00
Emily McDonough
b85b6ac16f style: Add auto-fill length field to line name lists returned from Servo.
Rename fill_idx to fill_start, to indicate it is not a single value but a
range. Also change a numeric_limits<>::max() involving the fill_start to use
decltype() to ensure its type matches that of the auto-generated structure's
field, while we're touching that code.

The test to ensure only a single repeat value is allowed will be removed by a
later commit.

Differential Revision: https://phabricator.services.mozilla.com/D60929
2020-04-16 16:35:07 +02:00
Philipp Zech
bac5248135 style: Convert mask-composite #defines to an enum class.
Differential Revision: https://phabricator.services.mozilla.com/D67394
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
decc648c46 style: Fix number input so that it honors overflow-clip-box-block.
This never worked, but it's more visible with the new form controls which have
more padding.

Make the anonymous div and co a pseudo-element, so that they inherit from the
<input> properly in all cases. This works for non-number inputs because the
editor root is a direct child of the <input>, but it doesn't for number inputs
because there's a flex wrapper in between.

This way overflow-clip-box: inherit does what we want. Reset the padding in the
inline direction, as the padding for <input type=number> applies to the arrow
boxes as well, and thus we'd double-apply it.

Differential Revision: https://phabricator.services.mozilla.com/D65271
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
ece146988c style: Change the parsing order of border shorthands.
It's not ambiguous, and <width> <style> <color> seems like a more common order.

This is just a minor perf tweak, as the CSS parser token cache will most often
kick in to avoid re-tokenizing values.

Also remove a redundant continue statement.

Differential Revision: https://phabricator.services.mozilla.com/D67224
2020-04-16 16:35:07 +02:00
Sam Mauldin
ccc41dd89d style: Unprefix existing CSS4 system colors.
Expect forced-colors-mode-backplate tests to fail because they were passing for the wrong reason,
and the backplate is now properly applied, causing them to fail.

Remove tests for field and fieldtext from color-valid.html because they are tested again
in system-color-valid.html.

Differential Revision: https://phabricator.services.mozilla.com/D66879
2020-04-16 16:35:07 +02:00
Erik Nordin
edddf9e503 style: Disallow @import rules for all Constructable StyleSheets functions.
- Add enum AllowImportRules to CSS parsing.
- `replaceSync()` will skip over @import rules and continue parsing.
- `replace()` will skip over @import rules and continue parsing.
- `insertRule()` will throw a syntax error on @import rules.
- Modify WPT test cases to reflect these changes.

Differential Revision: https://phabricator.services.mozilla.com/D61882
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
635f5fbf1b style: Allow to export a shadow part under multiple names.
Other browsers allow this and the spec doesn't really disallow it, so fix it,
add a test and carry on.

Differential Revision: https://phabricator.services.mozilla.com/D65107
2020-04-16 16:35:07 +02:00
Philipp Zech
614d3e746f style: Convert vector-effect #defines to an enum class.
Differential Revision: https://phabricator.services.mozilla.com/D65718
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
4a19074664 style: Rename -moz-menulist-button to -moz-menulist-arrow-button.
This should be less confusing. This is not supported outside of chrome:// or
user-agent stylesheets so we can name this however we want.

Differential Revision: https://phabricator.services.mozilla.com/D65605
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
a73e4353fe style: Respect the cascade properly when in high-contrast mode.
Differential Revision: https://phabricator.services.mozilla.com/D65345
2020-04-16 16:35:07 +02:00
Makoto Kato
c5b74bf001 style: Get safe area insets from Gecko.
Add binding to get safe area insets from Gecko.

Differential Revision: https://phabricator.services.mozilla.com/D52509
2020-04-16 16:35:07 +02:00
Morgan Reschenberg
45cc310f7f style: Modify background image styling to only apply URL-sourced images when backplate is enabled.
Differential Revision: https://phabricator.services.mozilla.com/D64200
2020-04-16 16:35:07 +02:00
Philipp Zech
b9bf5fb868 style: Convert color-interpolation #defines to an enum class.
Differential Revision: https://phabricator.services.mozilla.com/D64813
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
1bd551ddc2 style: Add an inherited style bit to know whether an element is in an opacity: 0 subtree.
I think this should work for the animation throttling stuff.

Opacity works on the element tree, so I think this is sound.

Differential Revision: https://phabricator.services.mozilla.com/D64441
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
3460f71205 style: Minor cleanup of ServoStyleSet.
Removing unused arguments and so on.

The origin can always be inferred from the stylesheet so it wasn't being used.

Differential Revision: https://phabricator.services.mozilla.com/D64150
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
225e0000f0 style: Remove no-longer-used argument to pseudo-class-list-macro.
This used to be needed for Gecko interop, but now all this is in the Rust side
so we no longer need it.

Depends on D63861

Differential Revision: https://phabricator.services.mozilla.com/D63863
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
d8cb4c4647 style: Prototype :focus-visible behind a flag.
The heuristic is that we show focus outlines for unknown or key focus, and not
for mouse / touch.

This is probably not the final heuristic we take, but this allows people to play
with it and file bugs.

Once this is mature enough we should remove :-moz-focusring in favor of
:focus-visible.

Differential Revision: https://phabricator.services.mozilla.com/D63861
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
7af9a087aa style: Use enums for text-align / text-align-last.
This also fixes some backwards logic in nsBlockFrame::ReflowDirtyLines, and adds
some static assertions to nsGenericHTMLElement that almost cause a very subtle
bug.

Depends on D63792

Differential Revision: https://phabricator.services.mozilla.com/D63793
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
37c382a74b style: Minor LengthPercentage improvements.
* Use debug_unreachable for really unreachable code (having a release
   unreachable!() there gives us little to no benefit, as a borked union can
   already confuse us into reading an arbitrary pointer as a CalcPercentage).

 * Avoid a clone of the calc variant when clamping. We only need to mutate the
   clamping mode. This was the only clamp_to_non_negative function that didn't
   consume the value.

Differential Revision: https://phabricator.services.mozilla.com/D63584
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
582ccf4778 style: Minor cleanup of gecko.mako.rs.
Differential Revision: https://phabricator.services.mozilla.com/D63779
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
76e9cb44f0 style: Use cbindgen for SVG lengths.
Depends on D63777

Differential Revision: https://phabricator.services.mozilla.com/D63778
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
18570bf077 style: Use cbindgen for cursors.
Pretty straight-forward.

Differential Revision: https://phabricator.services.mozilla.com/D63777
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
787ac98d18 style: Properly reject numbers as part of <length-percentage>.
We never fast-reject numbers (because they could be part of a product). Without
this refactoring we'd accept stuff like calc(10) and crash during the evaluation
for obvious reasons.

Differential Revision: https://phabricator.services.mozilla.com/D63401
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
039ef3dd53 style: Fix one minor serialization issue which was causing test failures.
We were serializing calc(10% + 4px) as calc(10% + calc(4px)).

Differential Revision: https://phabricator.services.mozilla.com/D63400
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
c0f2a4e785 style: Simplify math function resolution.
So as to avoid allocating an intermediate tree in Rust to resolve
`<length-percentage>` values.

Differential Revision: https://phabricator.services.mozilla.com/D63399
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
280402b2a1 style: Fix C++ side of <length-percentage> values.
Differential Revision: https://phabricator.services.mozilla.com/D63398
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
7e8dbd0896 style: Make CalcNode the specified representation of <length> and <length-percentage> values.
This is the meat of the patch. There are a couple improvements done in a couple
later patches which should hopefully be straight-forward.

Differential Revision: https://phabricator.services.mozilla.com/D63397
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
426edbd991 style: Move the guts of calc nodes into a generic enum.
We'll have different leaf nodes as we progress in the value computation stage.

Differential Revision: https://phabricator.services.mozilla.com/D63396
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
869553357d style: Implement ToCss for CalcNode.
We'll use `CalcNode` as the specified value representation for <length> and
<length-percentage> values, so they'll have to implement ToCss.

There's one minor issue (two calls to to_css() instead of to_css_impl() which
are addressed later in the series).

Differential Revision: https://phabricator.services.mozilla.com/D63395
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
c52bae1923 style: Remove an invalid assert.
This assert was wrong. The assert may fire if we resurrect the node from a
different thread and insert a kid fast enough.

We allow resurrecting nodes (bumping the nodes from zero to one) to avoid
allocation churn.

In particular, while the thread dropping the node gets to read the children (so
after the fetch_sub from the refcount, but before the read() of the children),
another thread could plausibly bumped the refcount back, and added a children.

This is a very big edge case of course, but I'm kinda sad I hadn't realized
before.

Differential Revision: https://phabricator.services.mozilla.com/D63286
2020-04-16 16:35:07 +02:00
Jonathan Kew
471e491a89 style: Add support for the 'all' value of text-decoration-skip-ink.
Differential Revision: https://phabricator.services.mozilla.com/D61184
2020-04-16 16:35:07 +02:00
Tim Nguyen
61712d1a03 style: Implement parsing for CSS conic-gradient syntax.
Differential Revision: https://phabricator.services.mozilla.com/D62148
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
31187b0180 style: Remove layout.css.webkit-appearance.enabled.
I don't think we want to keep the ugly widget hacks forever. Let me know if
you'd rather keep the property behind a pref but I don't think there's a point
in doing that.

Differential Revision: https://phabricator.services.mozilla.com/D62649
2020-04-16 16:35:07 +02:00
Cameron McCormack
47db01f793 style: Change initial value of image-orientation to from-image.
Differential Revision: https://phabricator.services.mozilla.com/D62826
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
f25e0b77e9 style: Minor gradient parsing cleanup.
I suggested the compat_mode bit in D62923 but it was somehow only applied to one
of the branches.

Also rustfmt the code for consistency, and add a local alias.

Differential Revision: https://phabricator.services.mozilla.com/D63015
2020-04-16 16:35:07 +02:00
Tim Nguyen
25b265a10f style: Refactor GenericGradient for conic-gradient support.
Differential Revision: https://phabricator.services.mozilla.com/D62923
2020-04-16 16:35:07 +02:00
Tim Nguyen
fc88e908d5 style: Re-introduce display: -moz-stack; as <legacy-stack>.
Differential Revision: https://phabricator.services.mozilla.com/D62758
2020-04-16 16:35:07 +02:00
Martin McNickle
28d8565f38 style: Use the cbindgen output for GridAutoFlow directly in gecko.
Depends on D62787

Differential Revision: https://phabricator.services.mozilla.com/D62910
2020-04-16 16:35:07 +02:00
Martin McNickle
cf20c627b5 style: Replace existing GridAutoFlow struct with a bitflags! backed one.
Differential Revision: https://phabricator.services.mozilla.com/D62787
2020-04-16 16:35:07 +02:00
Tim Nguyen
0e3c122890 style: Make GradientItem and ColorStop support angular color stops.
Differential Revision: https://phabricator.services.mozilla.com/D62544
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
5cedc45858 style: Make font-family serialization algorithm a bit more conservative.
So as to avoid serializing as identifiers font-families with spaces as part of
the identifier. This avoids serializing confusing escaped sequences if the
beginning of the stuff after the space happens to not be a valid ident start.

This is an slightly more restrictive version of the existing logic, which
happens to also match other browsers in my testing.

Differential Revision: https://phabricator.services.mozilla.com/D62376
2020-04-16 16:35:07 +02:00
Boris Chiou
ef2d934dac style: Drop fallback attribute from animate and distance.
Still keep the discriminant checks to avoid generating terrible code.

Differential Revision: https://phabricator.services.mozilla.com/D62329
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
239302b1ed style: Split clip-path and shape-outside values.
We don't actually share _that_ much code across them. This makes callers clearer
and code less confusing, IMHO.

This also has the benefit of not autocompleting path from devtools for
shape-outside.

Differential Revision: https://phabricator.services.mozilla.com/D62373
2020-04-16 16:35:07 +02:00