Commit graph

16246 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
cdbb5b56aa
style: Convert the visited dependentness of a dependency in a binary enum. 2017-09-05 19:43:52 +02:00
Emilio Cobos Álvarez
cc31397a2e
style: Don't waste a whole selector map for each class / id in the document.
It's just useless.
2017-09-05 19:43:51 +02:00
Nicholas Nethercote
d880efcab3
Measure the stylist during memory reporting. 2017-09-05 19:43:50 +02:00
bors-servo
f648e12935 Auto merge of #18365 - chenpighead:stylo-keyframe-location, r=upsuper,emilio
stylo: Store location information for keyframe rules.

So far, we only store location info for the whole Keyframes block, not for each
of the keyframe rule. Without this info, the devtool can't present the rules
on the devtool panel properly.

In this patch, we collect the source location info while parsing keyframe selector.
The binding function, Servo_KeyframesRule_GetKeyframe, is also fixed (and renamed
to Servo_KeyframesRule_GetKeyframeAt to match the fix) to accept line and column
parameters from Gecko, so we can pass/set them with the source location from Servo.

This is the servo part of [Bug 1394994](https://bugzilla.mozilla.org/show_bug.cgi?id=1394994).

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix [Bug 1394994](https://bugzilla.mozilla.org/show_bug.cgi?id=1394994)

<!-- 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/18365)
<!-- Reviewable:end -->
2017-09-05 11:22:20 -05:00
bors-servo
34e0805b12 Auto merge of #18363 - paulrouget:fix_style_build, r=SimonSapin
use cargo manifest path to find build.py

Without this, build.py can't be found when servo is built as a dependency.

---
<!-- 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/18363)
<!-- Reviewable:end -->
2017-09-05 09:22:28 -05:00
Paul Rouget
cd13888a1b use cargo manifest path to find build.py script 2017-09-05 09:31:37 +02:00
Daisuke Akatsuka
3ed71c4283 Make font-variation-settings animatable 2017-09-05 16:12:47 +09:00
Daisuke Akatsuka
653bced7a5 Implement Animate for FontSettings 2017-09-05 16:12:20 +09:00
Daisuke Akatsuka
951662848f Implement clone_font_variation_settings method 2017-09-05 15:56:15 +09:00
bors-servo
e97f28e2a6 Auto merge of #18367 - aethanyc:media-change-xbl-stylset, r=emilio
style: Expose stylist::set_device() for gecko

This was reviewed in bug https://bugzilla.mozilla.org/show_bug.cgi?id=1382078

<!-- 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/18367)
<!-- Reviewable:end -->
2017-09-04 15:19:06 -05:00
bors-servo
c60dd53210 Auto merge of #18355 - servo:no-fmt, r=emilio
Reduce usage of fmt in serialization and error reporting

`format!` and `write!` create a somewhat-heavyweight `Formatting` struct and use dynamic dispatch to call into impls of `Dispaly` and related traits. The former also allocates an intermediate string that is sometimes unnecessary.

I started looking into this from https://bugzilla.mozilla.org/show_bug.cgi?id=1355599, but I expect the impact there will be small to insignificant. It might be a slightly less so on parsing (error reporting).

<!-- 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/18355)
<!-- Reviewable:end -->
2017-09-04 13:14:44 -05:00
Simon Sapin
5d06c9959f Replace some more uses of write! in components/style 2017-09-04 19:01:43 +02:00
bors-servo
4608955949 Auto merge of #18366 - emilio:fix-statistics-crash, r=bholley
style: Avoid dropping the other threads' TLS contexts too early.

When collecting style statistics, we have this path that moves the TLS contexts
to be dropped before the local context.

Since destroying the TLS context runs the sequential task queue, that means that
sequential tasks would be executed sooner than usual, before we drop the main
thread TLS context.

Since we have that reuse of the main thread context's bloom filter, and some
tasks end up creating one (Servo_StyleSet_GetBaseComputedValuesForElement, I'm
looking at you), we may borrow the bloom filter before we're done with it on the
traversal code path.

This was hitting on YouTube, when DUMP_STYLE_STATISTICS was used.

<!-- 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/18366)
<!-- Reviewable:end -->
2017-09-04 11:54:15 -05:00
Jeremy Chen
28d48242d3 stylo: Store location information for keyframe rules.
So far, we only store location info for the whole Keyframes block, not for each
of the keyframe rule. Without this info, the devtool can't present the rules
on the devtool panel properly.

In this patch, we collect the source location info while parsing keyframe selector.
The binding function, Servo_KeyframesRule_GetKeyframe, is also fixed (and renamed
to Servo_KeyframesRule_GetKeyframeAt to match the fix) to accept line and column
parameters from Gecko, so we can pass/set them with the source location from Servo.
2017-09-04 23:16:43 +08:00
bors-servo
293ffa06da Auto merge of #18368 - servo:media-event-cleanup, r=emilio
Do not NIH queueing a task to fire an event in htmlmediaelement

<!-- 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/18368)
<!-- Reviewable:end -->
2017-09-04 09:20:53 -05:00
Anthony Ramine
62c73b61b7 Do not NIH queueing a task to fire an event in htmlmediaelement 2017-09-04 16:14:04 +02:00
Ting-Yu Lin
4b096486e7 style: Expose stylist::set_device() for gecko
MozReview-Commit-ID: L655tvOwyKH
2017-09-04 21:07:15 +08:00
Emilio Cobos Álvarez
b81f6b3286
style: Avoid unnecessarily using Borrow. 2017-09-04 13:23:56 +02:00
Emilio Cobos Álvarez
2d1b387a4c
style: Avoid dropping the other threads' TLS contexts too early.
When collecting style statistics, we have this path that moves the TLS contexts
to be dropped before the local context.

Since destroying the TLS context runs the sequential task queue, that means that
sequential tasks would be executed sooner than usual, before we drop the main
thread TLS context.

Since we have that reuse of the main thread context's bloom filter, and some
tasks end up creating one (Servo_StyleSet_GetBaseComputedValuesForElement, I'm
looking at you), we may borrow the bloom filter before we're done with it on the
traversal code path.

This was hitting on YouTube, when DUMP_STYLE_STATISTICS was used.
2017-09-04 13:17:45 +02:00
Anthony Ramine
6168e898c1 Alphabetically sort the damn atom list 2017-09-04 12:06:59 +02:00
Emilio Cobos Álvarez
862f3b4369
style: Move color to use predefined_type.
I want to play with autogenerating style structs, and color is the smallest
struct out there.

However, moving it out of the mako file is a requirement. This patch does that.
2017-09-04 11:43:50 +02:00
Mantaroh Yoshinaga
d37b5c3553 Don't allow interpolating SVGPaintKind::None.
PR #18103 disallowed interpolation between fill:none and fill:none, but that change was regressed by the refactoring in PR #18239.
This patch restores the intended behavior, disabling animation of SVGPaintKind::None.
2017-09-04 16:33:40 +09:00
Xidorn Quan
42411eba66 Update binding files from autoland 2017-09-04 11:37:46 +10:00
bors-servo
887b011288 Auto merge of #18361 - toidiu:ak-18354, r=emilio
change function signature to get type name via intrinsics

<!-- Please describe your changes on the following line: -->
change function signature to get type name via intrinsics

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

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because stated in the PR that it was not required

<!-- 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/18361)
<!-- Reviewable:end -->
2017-09-03 16:28:25 -05:00
toidiu
99e4504f85 move name implementation as default implementation to the trait and remove overrides. 2017-09-03 16:30:48 -04:00
toidiu
a3df0cf4de change function signature to get type name via intrinsics 2017-09-03 15:45:18 -04:00
bors-servo
096912101b Auto merge of #18358 - servo:change-attr-kind, r=emilio
Properly change the kind of the given attribute in SetAttributeNode

Fixes #18357.

<!-- 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/18358)
<!-- Reviewable:end -->
2017-09-03 13:05:00 -05:00
Anthony Ramine
86285e542a Properly change the kind of the given attribute in SetAttributeNode
The given argument may have special meaning for the element to which we add it,
and thus may have a specific representation to which we should switch the
attribute current's value.

Fixes #18357.
2017-09-03 15:00:47 +02:00
Simon Sapin
e94d8d5bc1 Remove usage of write! in components/style/properties/longhand/box.mako.rs 2017-09-02 18:37:57 +02:00
bors-servo
f36580cb91 Auto merge of #18349 - canaltinova:media-calc, r=emilio
stylo: Remove calc support from media queries

Gecko currently doesn't support calc inside media queries. We should
also remove the calc support temporarily for parity with gecko. We can
add this support back in next releases.

Reviewed by emilio in Bugzilla.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix [Bug 1390339](https://bugzilla.mozilla.org/show_bug.cgi?id=1390339)

<!-- 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/18349)
<!-- Reviewable:end -->
2017-09-02 09:37:11 -05:00
Simon Sapin
3a34b21b63 Reformat another match expression 2017-09-02 10:57:21 +02:00
bors-servo
7dcd3ae50d Auto merge of #18351 - mateon1:profile-sort_by-partial_cmp, r=emilio
Refactor `.sort_by()` calls to use `.partial_cmp()`

Changes the closures passed to `sort_by` in this file with a simpler, and more correct version.

Previously, potential NaNs in the array would float to the top. Either way, the program would crash, as the `get_statistics` function asserts the array it gets is sorted, which always fails with a NaN.
Because of that, this change should not affect functionality.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [ ] `./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 statistics collected by --profile should not have NaN values in the first place.

<!-- 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/18351)
<!-- Reviewable:end -->
2017-09-02 03:54:49 -05:00
Simon Sapin
37722838c6 Remove uses of write! in components/style_traits 2017-09-02 10:49:24 +02:00
Simon Sapin
38043a71de Remove some uses of write! in components/style 2017-09-02 10:27:17 +02:00
Simon Sapin
17aa04b712 Remove uses of format! in components/style/error_reporting.rs 2017-09-02 10:15:36 +02:00
Simon Sapin
f6d20e6461 Reformat a couple match expressions 2017-09-02 10:15:35 +02:00
bors-servo
e0e09538fa Auto merge of #18350 - emilio:ship-system-metric-stuff, r=bholley,manishearth
stylo: Expose -moz-system-metric and -moz-empty-except-children-with-localname

They don't have the flag in Gecko.

Though I wonder if we could unship them from non-UA sheets.

Bug: 1396048
Reviewed-by: bholley
MozReview-Commit-ID: LGzGDjCZpJC

<!-- 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/18350)
<!-- Reviewable:end -->
2017-09-02 02:49:29 -05:00
bors-servo
32b04b3f51 Auto merge of #18340 - servo:dom-struct-errors, r=SimonSapin
Use the better TokenStream API in dom_struct

Before:

```rust
error[E0412]: cannot find type `SourceBuffer` in this scope
  --> /Users/nox/src/servo/components/script/dom/mediasource.rs:25:1
   |
25 | #[dom_struct]
   | ^^^^^^^^^^^^^ did you mean `SourceBufferList`?
```

After:

```rust
error[E0412]: cannot find type `SourceBuffer` in this scope
  --> /Users/nox/src/servo/components/script/dom/mediasource.rs:28:39
   |
28 |     source_buffers: DOMRefCell<Vec<JS<SourceBuffer>>>,
   |                                       ^^^^^^^^^^^^ did you mean `SourceBufferList`?
```

<!-- 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/18340)
<!-- Reviewable:end -->
2017-09-02 00:48:29 -05:00
bors-servo
fd95696d31 Auto merge of #18344 - bradwerth:selectorSerialize, r=SimonSapin
Change selector::to_css function to handle combinators in between universal selectors.

https://bugzilla.mozilla.org/show_bug.cgi?id=1391169
https://reviewboard.mozilla.org/r/172368/

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

<!-- 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/18344)
<!-- Reviewable:end -->
2017-09-01 23:41:10 -05:00
bors-servo
7e3c8dee71 Auto merge of #18339 - glennw:update-wr-misc, r=jdm
Update WR (mac driver crash, box shadow sharing).

* Works around a driver / kernel crash on some mac machines.
* Allow more sharing of box shadow and clip render tasks.
* Some shader tidy ups.

<!-- 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/18339)
<!-- Reviewable:end -->
2017-09-01 21:42:28 -05:00
bors-servo
3a4b98ad38 Auto merge of #18242 - joone:ellipse, r=jdm
Implement Ellipse Canvas 2D API

This patch needs to update rust-azure to 0.21.0.

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #17598

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

<!-- 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/18242)
<!-- Reviewable:end -->
2017-09-01 20:25:57 -05:00
bors-servo
60daf54352 Auto merge of #18335 - Manishearth:stylo-calc-anim, r=birtles
stylo: Compute font-size calcs against appropriate base size

r=birtles https://bugzilla.mozilla.org/show_bug.cgi?id=1394302

<!-- 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/18335)
<!-- Reviewable:end -->
2017-09-01 19:17:03 -05:00
Joone Hur
57e283aaab Implement Ellipse Canvas 2D API
* Update rust-azure to 0.21.0
* Mark the following test case as fail:
  tests/wpt/mozilla/tests/mozilla/css-paint-api/background-image-tiled.html
* Make the ellipse test case pass.

BUG: https://github.com/servo/servo/issues/17598
2017-09-01 16:04:06 -07:00
bors-servo
f2e5b49926 Auto merge of #18336 - upsuper:two-stage-at-rule, r=SimonSapin
Parse at-rule without block in two stages

This is the Servo side change necessary for servo/rust-cssparser#180.

----

This also pulls in other changes from cssparser 0.20.0.

<!-- 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/18336)
<!-- Reviewable:end -->
2017-09-01 17:56:57 -05:00
bors-servo
ac7cf53692 Auto merge of #18334 - Manishearth:hashglobe, r=emilio,Gankro
Add fallible hashmaps from HashGlobe for stylo

HashGlobe code is r=emilio,Gankro

integration code is r=emilio from https://bugzilla.mozilla.org/show_bug.cgi?id=1393656

<!-- 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/18334)
<!-- Reviewable:end -->
2017-09-01 16:09:53 -05:00
Mateusz Naściszewski
699681d800
Refactor .sort_by() calls to use .partial_cmp() 2017-09-01 22:34:46 +02:00
Nazım Can Altınova
7ba0667ed9 Remove calc support from media queries
Gecko currently doesn't support calc inside media queries. We should
also remove the calc support temporarily for parity with gecko. We can
add this support back in next releases.
2017-09-01 13:22:18 -07:00
bors-servo
2550b47dec Auto merge of #18272 - mateon1:fix/profile-sorted-assert, r=emilio
Correct "is sorted" check in profile statistics

<!-- Please describe your changes on the following line: -->
Correct the debug_assert check for whether or not statistics collected by the --profile flag are sorted.
I'm not sure how I could add a test for this change, and whether that is necessary.

I also wonder if it makes sense to replace the sort_by calls (currently using explicit comparisons) in this file with something like
```
data.sort_by(|a, b| a.partial_cmp(b).expect("no NaN in collected statistics"))
```

---
<!-- 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 #18270 (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/18272)
<!-- Reviewable:end -->
2017-09-01 15:04:56 -05:00
Emilio Cobos Álvarez
480314a26e
stylo: Expose -moz-system-metric and -moz-empty-except-children-with-localname.
They don't have the flag in Gecko.

Though I wonder if we could unship them from non-UA sheets.

Bug: 1396048
Reviewed-by: bholley
MozReview-Commit-ID: LGzGDjCZpJC
2017-09-01 21:42:53 +02:00
bors-servo
fd833d9f18 Auto merge of #18327 - servo:rustup, r=nox
Upgrade to rustc 1.21.0-nightly (7eeac1b81 2017-08-30)

Fix this error in the new Rust Nightly:

```rust
   Compiling script v0.0.1 (file:///home/simon/servo2/components/script)
error[E0599]: no method named `trace` found for type `&fn(&dom::node::Node) -> u16` in the current scope
   --> /home/simon/servo2/components/script/dom/treewalker.rs:464:10
    |
464 | #[derive(JSTraceable)]
    |          ^^^^^^^^^^^
    |
    = note: JSTraceable is a function, perhaps you wish to call it
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `trace`, perhaps you need to implement it:
            candidate #1: `dom::bindings::trace::JSTraceable`

error: aborting due to previous error

error: Could not compile `script`.
```

~I’ve tried to reproduce it in a minimal test case, but `impl<A, B> SomeTrait for fn(A) -> B` did not apply for `fn(&u32) -> u32` even on Rust 1.19.0 stable. So I don’t know what changed.~ This is very likely https://github.com/servo/servo/pull/18327.

<!-- 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/18327)
<!-- Reviewable:end -->
2017-09-01 13:54:08 -05:00