Commit graph

18708 commits

Author SHA1 Message Date
Xidorn Quan
368fb574f8 Have servo report traversal statistics to gecko. 2018-03-15 11:57:52 +11:00
Xidorn Quan
d700fa16a1 Split TraversalStatistics into two parts. 2018-03-15 11:57:48 +11:00
Xidorn Quan
afa377acfd Update bindings. 2018-03-15 11:57:47 +11:00
bors-servo
f7ee1befc5
Auto merge of #20267 - Xanewok:typed-arrays-stack-heap-variants, r=Xanewok
Support JS typed arrays as arguments and in WebIDL unions

<!-- Please describe your changes on the following line: -->
Supersedes #20205.
This brings support to receiving typed arrays as function arguments (those are stack-rooted with CustomAutoRooter) and also being a member of a union (which is basically heap-rooted? similarly to other webidl unions).

This is based on my other PR #20265 (which means it has to pull an external rust-mozjs branch and contains some also slightly unrelated changes here) since it shares `RootedTraceableBox::from_box` here and some other additional changes at rust-mozjs, but it can be easily separated if needed.

I tried adding support to nullable typed arrays but couldn't work around an issue of codegen always sticking a "OrNull" at the end of my type (presumably because of [this](https://github.com/servo/servo/blob/master/components/script/dom/bindings/codegen/parser/WebIDL.py#L2241)?). How would I go about avoiding the suffix with nullable arguments?

If we were to add also support for nullable typed arrays then I think we wouldn't be blocked anymore on this in WebGL 1.0.

r? @jdm

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

<!-- 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/20267)
<!-- Reviewable:end -->
2018-03-14 15:43:18 -04:00
Igor Matuszewski
c29fcb80f3 Use helper is_typed_array function 2018-03-14 18:43:27 +01:00
Igor Matuszewski
6beb32e28e Support nullable typed arrays in codegen 2018-03-14 18:43:27 +01:00
Igor Matuszewski
e025bbb079 WIP: Accept typed array arguments in codegen 2018-03-14 18:43:26 +01:00
Igor Matuszewski
a0f2d618ee Use mozjs 2.0 2018-03-14 18:43:26 +01:00
bors-servo
7b326529db
Auto merge of #20224 - emilio:counter-serialization, r=nox
Fix counter() and counters() serialization.

See https://github.com/w3c/csswg-drafts/issues/670 and https://github.com/w3c/web-platform-tests/pull/9862.

<!-- 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/20224)
<!-- Reviewable:end -->
2018-03-14 13:26:00 -04:00
bors-servo
e597cd9e1a
Auto merge of #20265 - Xanewok:fix-js-objects-in-unions, r=jdm
Fix JS object conversion in unions

<!-- Please describe your changes on the following line: -->
Requires safe `Heap::boxed` constructor from https://github.com/servo/rust-mozjs/pull/395 (more info on it is in the PR).

Since unions currently assume that their respective members root themselves and can be stored on heap, I modified the union member object conversion branch to convert to a `RootedTraceableBox<Heap<*mut JSObject>>` (which is the currently generated type for objects in said unions).

I did it only for Unions and not dictionaries, since some dictionaries had bare `*mut JSObject` members - is this a mistake and something that needs further fixing?

Does this need a test, e.g. passing a union with object to a function that returns said object, and comparing the results for equality?

r? @jdm

Generated code with this patch (for `StringOrObject`):
```rust
impl FromJSValConvertible for StringOrObject {
    type Config = ();
    unsafe fn from_jsval(cx: *mut JSContext,
                         value: HandleValue,
                         _option: ())
                         -> Result<ConversionResult<StringOrObject>, ()> {
        if value.get().is_object() {
            match StringOrObject::TryConvertToObject(cx, value) {
                Err(_) => return Err(()),
                Ok(Some(value)) => return Ok(ConversionResult::Success(StringOrObject::Object(value))),
                Ok(None) => (),
            }

        }
        // (...)
    }
}

impl StringOrObject {
    // (...)
    unsafe fn TryConvertToObject(cx: *mut JSContext, value: HandleValue) -> Result<Option<RootedTraceableBox<Heap<*mut JSObject>>>, ()> {
        Ok(Some(RootedTraceableBox::from_box(Heap::boxed(value.get().to_object()))))
    }
}
```

---
<!-- 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 #17011 (github issue number if applicable).

<!-- Either: -->
- [ ] 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. -->

<!-- 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/20265)
<!-- Reviewable:end -->
2018-03-14 12:04:23 -04:00
Emilio Cobos Álvarez
839eda000a
style: Avoid serializing the counter type in counter functions if it's decimal.
See https://github.com/w3c/web-platform-tests/pull/9862 and such.
2018-03-14 16:41:33 +01:00
Emilio Cobos Álvarez
9fa2618197
style: Add infrastructure to match :host. 2018-03-14 15:10:05 +01:00
Emilio Cobos Álvarez
1654f297ca
style: Tidy a couple things. 2018-03-14 15:10:05 +01:00
Igor Matuszewski
712812d441 Add WPT test for WebIDL union conversion containing object values 2018-03-13 22:47:37 +01:00
Igor Matuszewski
17ecbaf8ff Support objects in WebIDL unions
Fixes #17011
2018-03-13 22:47:36 +01:00
OJ Kwon
2ddd105f12
build(cmake): detect python binary for specified version
- closes #20268
2018-03-13 09:25:06 -07:00
Bastien Orivel
b598c14b75 Update libloading to 0.5 2018-03-13 12:33:49 +01:00
Bastien Orivel
2bd99317fb Update toml to 0.4 2018-03-13 10:24:11 +01:00
Igor Gutorov
217c4be2bf style: Fix a typo in Integer struct docs 2018-03-13 02:02:38 +02:00
Emilio Cobos Álvarez
9364cd21b8
style: Don't share style with an element that has a different proto binding than us.
See the lengthy comment about why... XBL sucks.

MozReview-Commit-ID: 8UgeJAVkj6a
2018-03-12 21:47:47 +01:00
Emilio Cobos Álvarez
c338745b17
style: Allow to share style across elements with similar XBL bindings. 2018-03-12 21:47:46 +01:00
bors-servo
5feb13ac66
Auto merge of #20277 - servo:test-webvr, r=jdm
Enable /webvr/ tests

<!-- 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/20277)
<!-- Reviewable:end -->
2018-03-12 10:32:52 -04:00
Anthony Ramine
8013e7801e Properly pref-gate the VR WebIDL interface 2018-03-12 15:32:00 +01:00
bors-servo
345c373192
Auto merge of #20216 - servo:mozangle, r=emilio
Switch from servo/angle to the mozangle crate

https://github.com/servo/mozangle

<!-- 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/20216)
<!-- Reviewable:end -->
2018-03-12 09:23:52 -04:00
Simon Sapin
67d983cb12 Switch from servo/angle to the mozangle crate
https://github.com/servo/mozangle
2018-03-12 14:23:20 +01:00
bors-servo
cdaa36df2d
Auto merge of #20274 - emilio:moz-src, r=xidorn
style: Make the generated bindings really be formatted.

TOOLTOOL_DIR isn't passed down to the rust scripts it seems, per:

  https://treeherder.mozilla.org/#/jobs?repo=try&revision=46854db239166ab3a43d36c7a954debb56968eab

<!-- 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/20274)
<!-- Reviewable:end -->
2018-03-12 07:12:13 -04:00
Anthony Ramine
a6aac0ed5f Document #[animation(no_bound(…))] and #[distance(field_bound)] 2018-03-12 09:51:15 +01:00
Anthony Ramine
dcae5860a8 Share a single #[animation(no_bound(…))] for the animation traits 2018-03-12 09:48:25 +01:00
Anthony Ramine
ba12a344c6 Opt out of bounds on type params for #[derive(ToAnimatedZero)] 2018-03-12 09:48:25 +01:00
Anthony Ramine
6f7425059c Opt out of bounds on type params for #[derive(ComputeSquaredDistance)] 2018-03-12 09:48:24 +01:00
Anthony Ramine
5cc2d7c4b3 Opt out of trait bounds on type params for #[derive(Animate)]
This allows us to not generate trait bounds for field types anymore,
by excluding bounds for type parameters used only in fields annotated
with `#[animation(error)]`.

The syntax is `#[animation(no_bound(Foo, Bar))]` where `Foo` is a type
parameter for the type on which we derive things. Ideally this should
be an attribute on the type parameter but this isn't stable yet.
2018-03-12 09:47:18 +01:00
Emilio Cobos Álvarez
4295bef063
style: Make the generated bindings really be formatted.
TOOLTOOL_DIR isn't passed down to the rust scripts it seems, per:

  https://treeherder.mozilla.org/#/jobs?repo=try&revision=46854db239166ab3a43d36c7a954debb56968eab
2018-03-11 20:14:47 +01:00
Florian Wagner
85bb94be9c Refactor KeyframePercentage::parse. This adresses #20179 2018-03-11 11:41:52 +01:00
bors-servo
aa8fb3a204
Auto merge of #20252 - NeverHappened:extract_text_emphasis_style, r=upsuper
Extract text emphasis style

<!-- Please describe your changes on the following line: -->
Extracted the text-emphasis-style property out of the inherited_text.mako.rs.
This is a part of #19015

---
<!-- 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] `./mach cargo-geckolib check` does not report any errors
- [X] These changes fix #19940 (github issue number if applicable).

<!-- Either: -->
- [X] These changes do not require tests because it's a refactoring

<!-- 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/20252)
<!-- Reviewable:end -->
2018-03-09 19:20:10 -05:00
bors-servo
95f9e14e67
Auto merge of #20262 - emilio:webgl-fallible, r=jdm
constellation: Make setting up the WebGL state fallible.

This fixes a regression caused by the glutin update.

We now are creating EGL contexts in Linux Wayland, instead of X context, so the
GLContextFactory assumption of one GL back-end per platform is broken.

This just works around it, for now, but in general I think not relying on
available WebGL state is a good thing, and we do that already for WebVR anyway.

<!-- 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/20262)
<!-- Reviewable:end -->
2018-03-09 18:24:56 -05:00
bors-servo
909ebff184
Auto merge of #20258 - servo:derive-all-the-things, r=emilio
Continue to improve style_derive

<!-- 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/20258)
<!-- Reviewable:end -->
2018-03-09 17:29:05 -05:00
Emilio Cobos Álvarez
21df4014db
constellation: Make setting up the WebGL state fallible.
This fixes a regression caused by the glutin update.

We now are creating EGL contexts in Linux Wayland, instead of X context, so the
GLContextFactory assumption of one GL back-end per platform is broken.

This just works around it, for now, but in general I think not relying on
available WebGL state is a good thing, and we do that already for WebVR anyway.
2018-03-09 23:27:29 +01:00
Dmitry
a1dd888c23 Rename entities that belong to text-emphasis-style value. Fix order of imports 2018-03-09 20:55:26 +03:00
Anthony Ramine
68be1aae8c Kill fmap_output_type 2018-03-09 18:55:26 +01:00
Anthony Ramine
4d0bf2ddf9 Opt into field bounds for #[derive(ToComputedValue)] 2018-03-09 18:54:59 +01:00
Anthony Ramine
2efd06c12d Remove #[compute(clone)] 2018-03-09 15:45:34 +01:00
Anthony Ramine
92068ca540 Simplify the derived bounds for ToAnimatedValue 2018-03-09 15:11:45 +01:00
Emilio Cobos Álvarez
3fc5bf87d3
style: Fix serialization of place-items.
If the justify-items / align-items value has the `legacy` bit or anything like
that we shouldn't serialize it, just as we don't parse it.

Bug: 1339656
Reviewed-by: xidorn
MozReview-Commit-ID: JsM4NrePEU6
2018-03-09 14:48:43 +01:00
Anthony Ramine
afaa00a344 Remove some uses of trivial_to_computed_value 2018-03-09 11:57:22 +01:00
Anthony Ramine
491a79ee4e Don't bound on Copy to implement Animate for Size2D and Point2D 2018-03-09 11:57:21 +01:00
Anthony Ramine
9f631fd886 Don't derive Animate for Transform<T>
There is a custom implementation already in animated_properties.
2018-03-09 11:57:21 +01:00
Anthony Ramine
c2e4a609a0 Don't generate fancy Clone + PartialEq bounds for #[animation(constant)] 2018-03-09 11:57:20 +01:00
Anthony Ramine
e82d0c20a6 Don't use #[animation(constant)] in ShapeBox
We can just rely on the implementation for the involved fields to return an error
if the values are different.
2018-03-09 11:56:49 +01:00
Anthony Ramine
539c60389e Move some code to its own function in #[derive(Animate)] 2018-03-09 10:12:57 +01:00
Anthony Ramine
02b0f71d45 Simplify some code in #[derive(ToCss)] 2018-03-09 10:12:29 +01:00