Commit graph

23819 commits

Author SHA1 Message Date
Martin Robinson
a0b495750e Eliminate AnimationFrame
This intermediate data structure doesn't really buy us anything and is a
bit confusing.
2020-04-18 13:48:52 +02:00
Martin Robinson
fad79a724c Add an iterator for transition properties
This simplifies the code a bit and also will allow us to more easily
make improvements to servo's animation implementation in the future.
2020-04-17 15:11:49 +02:00
Emilio Cobos Álvarez
3d1df8dce7 style: Fix two regressions from #26113. 2020-04-16 21:16:02 +02:00
Emilio Cobos Álvarez
35f872e2d9 style: appease tidy. 2020-04-16 18:34:36 +02:00
Emilio Cobos Álvarez
e6b4ceca07 Fix Gecko build. 2020-04-16 18:29:34 +02:00
Emilio Cobos Álvarez
848a6203de Some servo build fixes. 2020-04-16 18:29:30 +02:00
Emilio Cobos Álvarez
f76acc84c6 style: Reformat recent changes. 2020-04-16 17:50:17 +02:00
Emilio Cobos Álvarez
7c96aed31d style: Sync some other changes. 2020-04-16 17:50:17 +02:00
Mike Hommey
7ec0e56848 style: Build mako-generated stylo rust sources deterministically.
Differential Revision: https://phabricator.services.mozilla.com/D70633
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
3aa38ff4c5 style: Update mako in the style system.
This uses Mako-1.1.2 wheel format, rather than zip, and works with py3 and py2.

It'd be great to make mako more like other third party python dependencies but
this allows me to build central again.

This is downloaded from:

  https://files.pythonhosted.org/packages/50/78/f6ade1e18aebda570eed33b7c534378d9659351cadce2fcbc7b31be5f615/Mako-1.1.2-py2.py3-none-any.whl

Via pip-download.

Differential Revision: https://phabricator.services.mozilla.com/D70517
2020-04-16 16:35:07 +02:00
Mike Hommey
07c1b39637 style: Convert GenerateServoCSSPropList.py to py3.
Differential Revision: https://phabricator.services.mozilla.com/D70308
2020-04-16 16:35:07 +02:00
Erik Nordin
87139a3ea2 style: Add CSS Error for DisallowedImportRule.
- Add new CSS Error
- Add new test case for error
- Ensure that test cases use `replace()` and `replaceSync()`

Differential Revision: https://phabricator.services.mozilla.com/D69423
2020-04-16 16:35:07 +02:00
Cameron McCormack
c55cd22339 style: Assert that initial values in style structs match those in property definitions.
Differential Revision: https://phabricator.services.mozilla.com/D67930
2020-04-16 16:35:07 +02:00
Cameron McCormack
fa733ecb72 style: Fix a few initial values in Rust property definitions.
Differential Revision: https://phabricator.services.mozilla.com/D67929
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
846996ae7e style: Make :host::part work in the same shadow tree as the part.
Differential Revision: https://phabricator.services.mozilla.com/D68249
2020-04-16 16:35:07 +02:00
Cameron McCormack
257b96c549 style: Make image-orientation initial value change be Nightly only.
We'll let this ride the trains once Chrome 81 is set to be released.

Differential Revision: https://phabricator.services.mozilla.com/D67932
2020-04-16 16:35:07 +02:00
Cameron McCormack
53f7e45285 style: Add support for pref-controlled initial values.
Differential Revision: https://phabricator.services.mozilla.com/D67931
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
3cb019ac1e style: Tweak background: transparent handling so that color: transparent doesn't override UA sheet backgrounds.
Differential Revision: https://phabricator.services.mozilla.com/D68408
2020-04-16 16:35:07 +02:00
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