Commit graph

19254 commits

Author SHA1 Message Date
Martin Robinson
cedc7ebc53 Rename ScrollRoot to ClipScrollNode
ScrollRoot is an ever increasingly inaccurate name for this thing and
WebRender consistently uses ClipScrollNode nowadays. Stick with the
WebRender terminology to be consistent.
2017-09-15 10:10:22 +02:00
bors-servo
edff65a3b8 Auto merge of #18509 - emilio:ua-sheet-share-cascade-data, r=SimonSapin
style: Share user agent cascade data across documents.

<!-- 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/18509)
<!-- Reviewable:end -->
2017-09-15 02:43:50 -05:00
Emilio Cobos Álvarez
5be81d04a7
style: Clear the UA cache on shutdown.
MozReview-Commit-ID: KAGdhFb67hq
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-09-15 09:26:25 +02:00
Emilio Cobos Álvarez
cb31e782aa
style: Share user agent cascade data across documents.
MozReview-Commit-ID: KcyuTHD0bt9
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-09-15 09:26:23 +02:00
Josh Matthews
1a57bad2a1 Add Rust APIs for interacting with Arc<String> (bug 1397971). 2017-09-15 02:39:09 -04:00
bors-servo
db689094f1 Auto merge of #18515 - nnethercote:bug-1399758, r=heycam
Measure ImageValue objects.

We have about 11,500 of these when loading gmail in a Stylo-enabled build, from
SpecifiedUrls; the objects themselves account for about 1.3 MiB of memory, and
the strings within them about 2.9 MiB.

We also have a very small number of them on the Gecko side.

<!-- 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 tested on Gecko side.

<!-- 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/18515)
<!-- Reviewable:end -->
2017-09-14 22:06:43 -05:00
bors-servo
1b9a5ea719 Auto merge of #18504 - servo:media, r=emilio
Some minor HTMLMediaElement improvements

<!-- 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/18504)
<!-- Reviewable:end -->
2017-09-14 20:51:51 -05:00
Emilio Cobos Álvarez
985c6193eb
style: Factor out whether a stylesheet matches all the existing medium-affected-values in CascadeData.
MozReview-Commit-ID: IE6RFiBXZ8s
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-09-15 01:47:12 +02:00
Nicholas Nethercote
a185393cee Measure ImageValue objects.
We have about 11,500 of these when loading gmail in a Stylo-enabled build, from
SpecifiedUrls; the objects themselves account for about 1.3 MiB of memory, and
the strings within them about 2.9 MiB.

We also have a very small number of them on the Gecko side.
2017-09-15 09:43:35 +10:00
bors-servo
4268037424 Auto merge of #18503 - servo:globalism, r=emilio
Simplify WorkerGlobalScope::process_event

<!-- 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/18503)
<!-- Reviewable:end -->
2017-09-14 18:17:55 -05:00
bors-servo
49f753523a Auto merge of #18466 - mbrubeck:cache, r=SimonSapin
Bug 1398957 - Make LRUCache use a linked list to reduce memmoves.

https://bugzilla.mozilla.org/show_bug.cgi?id=1398957

<!-- 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/18466)
<!-- Reviewable:end -->
2017-09-14 16:48:48 -05:00
bors-servo
75e126f139 Auto merge of #18502 - emilio:ua-sheets-unify, r=simonsapin
style: Unify how servo and Gecko handle UA sheets.

<!-- 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/18502)
<!-- Reviewable:end -->
2017-09-14 15:55:21 -05:00
bors-servo
28b1c3818f Auto merge of #18508 - mstange:add-fsbgc-system-colors, r=emilio
style: Add system colors from bug 1387594.

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

These are the necessary servo changes for https://bugzilla.mozilla.org/show_bug.cgi?id=1387594 .

I'm also re-importing the generated Gecko bindings from my object directory:
 - servo/components/style/gecko/generated/structs_debug.rs
 - servo/components/style/gecko/generated/structs_release.rs

But the number of changes to those files surprises me.

---
<!-- 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're tested by compiling mozilla-central once the patches from https://bugzilla.mozilla.org/show_bug.cgi?id=1387594 land - without this patch, Firefox won't compile.

<!-- 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/18508)
<!-- Reviewable:end -->
2017-09-14 14:20:15 -05:00
Tom Tromey
c48226ff6f Preserve sourceURL comment on style sheets
In addition to the sourceMappingURL comment, there is a second special
comment, "sourceURL", that can be used to set the "display name" of a
style sheet for developer tools.  This name is also used as the base
URL for the source-map URL resolution algorithm.  sourceURL is
described here:
https://blog.getfirebug.com/2009/08/11/give-your-eval-a-name-with-sourceurl/
The devtools feature bug is here:
https://bugzilla.mozilla.org/show_bug.cgi?id=880831

This patch changes servo to preserve and expose this value for use in M-C.
2017-09-14 12:39:18 -06:00
Emilio Cobos Álvarez
0a9309aa96
style: Unify how servo and Gecko handle UA sheets. 2017-09-14 20:33:43 +02:00
Matt Brubeck
286888009f Make LRUCache use a linked list to reduce memmoves.
https://bugzilla.mozilla.org/show_bug.cgi?id=1398957
2017-09-14 11:33:02 -07:00
Markus Stange
82012cbf2b
style: Re-import generated Gecko bindings. 2017-09-14 20:28:14 +02:00
bors-servo
ddf7ad4814 Auto merge of #18415 - jdm:moar-codesize, r=SimonSapin
More codesize reductions for generated code

Bloaty says this shaves off another 20kb from style::properties-based functions. The more limited Debug implementations enable sharing the property name strings between more functions, which saves on code size in the end.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- 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/18415)
<!-- Reviewable:end -->
2017-09-14 13:01:00 -05:00
Josh Matthews
d41baf7f5f Share more strings between Debug implementations for property-based types. 2017-09-14 11:52:46 -04:00
Josh Matthews
ecd8abb178 Reduce code duplication in TransitionProperty::from. 2017-09-14 11:52:00 -04:00
bors-servo
2cbd27c83a Auto merge of #18501 - emilio:cascade-data-rebuild, r=nox
style: Move DocumentCascadeData::add_stylesheet to CascadeData.

More plumbing in preparation for isolating the UA stuff.

<!-- 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/18501)
<!-- Reviewable:end -->
2017-09-14 10:49:16 -05:00
Anthony Ramine
518e34e7c8 Use an enum for the ready state of media elements 2017-09-14 15:30:20 +02:00
Anthony Ramine
86b25cd6b5 Use an enum for the network state of media elements 2017-09-14 14:23:06 +02:00
Anthony Ramine
87bb5ba381 Fix some HTMLMediaElement spec links 2017-09-14 13:52:25 +02:00
Markus Stange
d6380188e9 style: Add system colors from bug 1387594. 2017-09-14 13:43:39 +02:00
Anthony Ramine
35d86afcc8 Simplify WorkerGlobalScope::process_event
This method does not need to dispatch to interfaces derived from
WorkerGlobalScope, given they end up doing exactly the same thing
in all workers.
2017-09-14 13:37:33 +02:00
bors-servo
9dd0513647 Auto merge of #18498 - upsuper:enum-keyword-exhaustive, r=emilio
Use exhaustive match for cloning keyword value by default for property using enum class

rather than casting them to `u8` then do inexhaustive match.

I don't see why we couldn't do this.

<!-- 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/18498)
<!-- Reviewable:end -->
2017-09-14 06:28:16 -05:00
Emilio Cobos Álvarez
7454006d6c
style: Move DocumentCascadeData::add_stylesheet to CascadeData.
More plumbing in preparation for isolating the UA stuff.
2017-09-14 12:49:10 +02:00
bors-servo
988728e9d5 Auto merge of #18497 - emilio:no-cache-if-cached, r=heycam
style: Don't cache styles that got a cache hit on the second pass.

This avoids doing wasted work, at least in the recascade case, and pretty likely
in the other as well.

<!-- 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/18497)
<!-- Reviewable:end -->
2017-09-14 05:23:09 -05:00
Emilio Cobos Álvarez
158aa0ffdf
style: Move the check into insert_if_possible. 2017-09-14 11:56:45 +02:00
bors-servo
874cb0d9df Auto merge of #18499 - heycam:rule-cache, r=emilio
Rule cache

<!-- Please describe your changes on the following line: -->
This adds a TLS-based cache reset styles structs keyed off rule nodes.  Reviewed in https://bugzilla.mozilla.org/show_bug.cgi?id=1367635 by me and Emilio.

---
<!-- 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. -->
2017-09-14 04:28:50 -05:00
Cameron McCormack
8d3f6b116d style: Don't re-cache structs if we just got them from the cache. 2017-09-14 17:13:51 +08:00
Cameron McCormack
fd5fe0a8e3 style: Don't cache structs with custom property references. 2017-09-14 17:13:49 +08:00
Cameron McCormack
30982b92c8 style: Don't use rule cache for property-restricted pseudo-elements. 2017-09-14 17:13:48 +08:00
Cameron McCormack
a7dd19cfb1 style: Don't cache structs if they have been adjusted.
StyleAdjuster looks a bunch of things that we don't record as dependencies.
2017-09-14 17:13:47 +08:00
Cameron McCormack
73ae5ffd94 style: Make structs uncacheable if currentcolor is used on properties not using ComplexColor storage. 2017-09-14 17:13:46 +08:00
Cameron McCormack
1346be59b2 style: Add writing mode dependency if special MozLength keywords are used. 2017-09-14 17:13:45 +08:00
Cameron McCormack
b3ee1c79c0 style: Make structs uncacheable if logical float/clear property values are used. 2017-09-14 17:13:44 +08:00
Cameron McCormack
5f17e2d13c style: Make structs uncacheable if ex/ch units are used.
Computing them depends on font metrics.
2017-09-14 17:13:43 +08:00
Cameron McCormack
1cde26eacb style: Record the property we are computing on computed::Context, if it's a non-inherited one. 2017-09-14 17:13:42 +08:00
Cameron McCormack
9230030daa style: Set writing mode dependency and uncacheable state only for non-inherited properties. 2017-09-14 17:13:40 +08:00
Emilio Cobos Álvarez
c34c92e904 style: Add a TLS-based style struct caching mechanism. 2017-09-14 17:13:39 +08:00
Xidorn Quan
53a786cea6 Use exhaustive match for cloning keyword value by default for property using enum class 2017-09-14 18:48:12 +10:00
Emilio Cobos Álvarez
2908c6a266
style: Don't cache styles that got a cache hit.
This avoids doing wasted work, at least in the recascade case, and pretty likely
in the other as well.
2017-09-14 10:00:00 +02:00
Emilio Cobos Álvarez
9d671058df
style: Reformat the signature of insert_if_possible. 2017-09-14 09:59:48 +02:00
bors-servo
097cea240f Auto merge of #18495 - nnethercote:derive-PropertyDeclaration, r=jdm
Measure PropertyDeclaration more thoroughly.

This patch replaces the handwritten MallocSizeOf implementation for
PropertyDeclaration with a derived one, which gives much more thorough
measurement.

This requires (a) deriving MallocSizeOf for a *lot* of additional types (most
of which already have `derive(HeapSizeOf)` in Servo builds), and (b)
implementing MallocSizeOf for a few more types in the `malloc_size_of` crate.

These changes would significantly improve the reporting coverage for gmail if
it weren't for the fact that SpecifiedUrl isn't measured due to a lack of
clarity about its fields; that can be fixed as a follow-up once bug 1397971 has
landed.

<!-- 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 testing is on the Gecko side.

<!-- 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/18495)
<!-- Reviewable:end -->
2017-09-14 02:10:40 -05:00
Bobby Holley
8e5c1c771e Share styles during recascades.
MozReview-Commit-ID: AFTwtzi4P93
2017-09-13 22:06:46 -07:00
Bobby Holley
1c9b39a8e8 Do a second pass on the sharing cache to reuse style by rule node identity.
MozReview-Commit-ID: H67j3Sbt3gr
2017-09-13 22:06:39 -07:00
Bobby Holley
7a7070e075 Add some wrapper types to propagate styles out of style resolver.
We'll use these next to propagate information about style reuse to the ElementDataFlags.

MozReview-Commit-ID: Dya6vgzydpL
2017-09-13 22:06:33 -07:00
Bobby Holley
9092e6b4c2 Return the element rather than styles from the style sharing cache.
This gives us more flexibility, and doesn't cost us anything.

MozReview-Commit-ID: CuvOEcLA3My
2017-09-13 22:06:24 -07:00