Commit graph

25052 commits

Author SHA1 Message Date
Bastien Orivel
3c895666e1 Dedupe the dirs dependency 2020-04-19 13:54:02 +02:00
bors-servo
306e8ac5f9
Auto merge of #25853 - asajeffrey:surfmanup, r=jdm
Replace glutin by winit + surfman 0.2

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

This PR updates surfman to 0.2, and replaces glutin with winit+surfman.

---
<!-- 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 do not require tests because this should all be invisible

<!-- 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 21:03:25 -04: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
Alan Jeffrey
8bb1732258 Update surfman to 0.2 and remove glutin 2020-04-17 23:44:53 -05: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
Daniel Alley
232df236a7 Fix combination of border and border-radius being drawn incorrectly
fixes #20922
2020-04-17 16:30:30 -04:00
bors-servo
c9480c8e07
Auto merge of #23661 - julientregoat:i-21289, r=jdm
Refactor ImageCache::find_image_or_metadata -> ImageCache::{get_image, track_image}

<!-- Please describe your changes on the following line: -->
Updated the `ImageCache` trait to replace `find_image_or_metadata` with two new functions `track_image` and `get_image`, as well as a new enum (`ImageCacheResult`).

As a result, I was able to refactor the functions that previously called `find_image_or_metadata` pretty cleanly. For a list of these functions, please see the commit information.

---
<!-- 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 #21289  (GitHub issue number if applicable)

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because tests already exist for these components. I ran `cargo test` in `net`, `net_traits`, `layout`, and `script` successfully.

<!-- 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. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23661)
<!-- Reviewable:end -->
2020-04-17 15:56:30 -04:00
Josh Matthews
d4e85f9a90 Don't continually re-request completed requests that had load errors. 2020-04-17 11:59:00 -04:00
Julien Tregoat
2742fd2bea Refactor ImageCache::find_image_or_metadata API. 2020-04-17 11:58:18 -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
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