Commit graph

7995 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
2fd13b302b
style: Minor build fixes 2020-04-23 05:14:55 +02:00
Emilio Cobos Álvarez
ad602a0fa8
style: Export a size to fix a test that was trying to use a now-private type. 2020-04-23 05:07:02 +02:00
bors-servo
610991bdfc
Auto merge of #26244 - mrobinson:animation-cancel, r=jdm
Add support for canceling CSS transitions

This change adds support for canceling CSS transitions when a property is
no longer transitionable. Support for canceling and replacing CSS
transitions when the end value changes is still pending. This change
also takes advantage of updating the constellation message to fix a bug
where transition events could be sent for closed pipelines.

Fixes #15079.

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #15079.

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
2020-04-22 15:34:06 -04:00
Martin Robinson
453b252a65 Add support for canceling CSS transitions
This change adds support for canceling CSS transitions when a property
is no longer transitionable or when an element becomes styled with
display:none. Support for canceling and replacing CSS transitions when
the end value changes is still pending. This change also takes advantage
of updating the constellation message to fix a bug where transition
events could be sent for closed pipelines.

Fixes #15079.
2020-04-22 17:23:26 +02:00
Anthony Ramine
7f54d14904 Make the rule tree actually threadsafe
RuleTree::gc is now a safe method that any thread can call
at any time, and StrongRuleNode values can all be dropped
whenever their owner want to, on any thread.
2020-04-20 17:39:19 +02:00
Anthony Ramine
1c2de5641c Change Map::get_or_insert_with to Map::entry 2020-04-20 14:17:14 +02:00
bors-servo
00ac447966
Auto merge of #26220 - servo:layout-2020-rule-tree-new-on-write, r=emilio
Always upgrade existing weak child references in the rule tree

Just because we didn't find a child when read-locking a node children list
doesn't mean it still won't exist while we wait to upgrade the read lock
into a write lock to create the child.
2020-04-18 14:06:19 -04:00
bors-servo
3a1531f18f
Auto merge of #26214 - mrobinson:animation-eliminate-animation-frame, r=emilio
Eliminate `AnimationFrame`

This intermediate data structure doesn't really buy us anything and is a
bit confusing.

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (GitHub issue number if applicable)

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because they do not change behavior.

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
2020-04-18 10:34:44 -04:00
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
Anthony Ramine
c113fbb640 Always upgrade existing weak child references in the rule tree
Just because we didn't find a child when read-locking a node children list
doesn't mean it still won't exist while we wait to upgrade the read lock
into a write lock to create the child.
2020-04-18 12:11:34 +02:00
Emilio Cobos Álvarez
ee8e98bc04 style: Run rustfmt. 2020-04-18 03:48:22 +02:00
Emilio Cobos Álvarez
b80d79863c style: Fix some rebase messups from the rule tree refactoring.
This code was all long gone already from Gecko :)
2020-04-18 03:48:21 +02:00
Emilio Cobos Álvarez
83ea321096 style: Implement parsing / selector-matching for :is() and :where().
This implements the easy / straight-forward parts of the :where / :is
selectors.

The biggest missing piece is to handle properly invalidation when there
are combinators present inside the :where. That's the hard part of this,
actually.

But this is probably worth landing in the interim. This fixes some of
the visitors that were easy to fix.

Differential Revision: https://phabricator.services.mozilla.com/D70788
2020-04-18 03:48:15 +02:00
bors-servo
37c53c4ea8
Auto merge of #26201 - servo:layout-2020-fix-rule-tree, r=emilio
Refactor style rule tree, without actually fixing its !Send behaviour yet
2020-04-17 17:24:22 -04: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
Anthony Ramine
a30da7ad8e Introduce a new type UnsafeBox<T> in the rule tree
This lets us rely less on raw pointers, thus better tracking the lifetime
of the rule node values while dropping strong references etc.
2020-04-17 12:41:10 +02:00
Anthony Ramine
bc4e2942bf Make StrongRuleNode::downgrade be unsafe 2020-04-17 12:41:09 +02:00
Anthony Ramine
fb28ce6bbe Make StrongRuleNode::ensure_child take a StrongRuleNode for the root 2020-04-17 12:41:09 +02:00
Anthony Ramine
37c70609f9 Remove WeakRuleNode::clone
MallocSizeOf for RuleTree should not keep around weak references in
case someone runs a GC meanwhile.
2020-04-17 12:41:09 +02:00
Anthony Ramine
e06e164571 Make WeakRuleNode::from_ptr be unsafe 2020-04-17 12:41:09 +02:00
Anthony Ramine
05accaa7bd Make StrongRuleNode::from_ptr be unsafe 2020-04-17 12:41:08 +02:00
Anthony Ramine
e5cb3d2a4c Move the meat of the rule tree to a submodule "core" 2020-04-17 12:41:08 +02:00
Anthony Ramine
1ea6a0cdd4 Move CascadeLevel to its own rule_tree submodule 2020-04-17 11:43:39 +02:00
Anthony Ramine
13db0c1584 Refactor rule tree children
We move the data structure to its own module for better
encapsulation of unsafe code.
2020-04-17 11:43:38 +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
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