Commit graph

16487 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
33fa32ab25
style: Reformat a few GeckoElement methods. 2017-09-15 10:12:16 +02:00
Emilio Cobos Álvarez
91ae73a9bd
style: Trivially reformat a few TElement declarations. 2017-09-15 10:12:15 +02: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
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
Markus Stange
d6380188e9 style: Add system colors from bug 1387594. 2017-09-14 13:43:39 +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
Bobby Holley
729db5ccec Cache the parent CV identity on ValidationData.
This will make the linear probing faster. If we end up implementing the two-tier
cache setup, this code will be unnecessary and can go away.

MozReview-Commit-ID: BRfV5ump34n
2017-09-13 22:06:17 -07:00
Bobby Holley
7b019f807b Use inheritance_parent to control style_sharing.
Using traversal_parent here is wrong.

MozReview-Commit-ID: GHCIjkgx4VE
2017-09-13 22:06:09 -07:00
Emilio Cobos Álvarez
46288f9c46 Share more code for the primary style resolution.
The code before predated the existence of CascadeInputs, I believe.

MozReview-Commit-ID: 2zPVfWZkgoh
2017-09-13 22:06:02 -07:00
Emilio Cobos Álvarez
2d66301e9c Be consistent about pseudo-elements in cascade_style.
Fortunately the checks were done in such a way that no incorrect behavior is
exposed. But worth doing it anyway.

MozReview-Commit-ID: 8873FkMXXKo
2017-09-13 22:05:55 -07:00
Nicholas Nethercote
c5aa2cb986 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.
2017-09-14 13:18:03 +10:00
bors-servo
bb2030a493 Auto merge of #18494 - frewsxcv:frewsxcv-size-hint, r=jdm
Implement `size_hint` for more iterators.

```
implement size hint for
more iterators because why
not we like fast things
```

<!-- 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/18494)
<!-- Reviewable:end -->
2017-09-13 19:38:32 -05:00
Corey Farwell
9cd4535364 Implement size_hint for more iterators.
```
implement size hint for
more iterators because why
not we like fast things
```
2017-09-13 20:29:27 -04:00
Emilio Cobos Álvarez
541977efb3
style: Move ExtraStyleData into CascadeData.
It logically belongs there, and the only reason it wasn't there before we were
working around it.

MozReview-Commit-ID: 5a5iksHAIdN
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-09-13 23:43:09 +02:00
bors-servo
d461347adf Auto merge of #18484 - emilio:per-origin-sheets, r=SimonSapin
style: Store stylesheets per origin

This is the first step that will allow us to cache UA sheets 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/18484)
<!-- Reviewable:end -->
2017-09-13 14:59:16 -05:00
Emilio Cobos Álvarez
d7a3bec6d7
style: Add a comment about why the raw pointer is ok. 2017-09-13 19:52:49 +02:00
Emilio Cobos Álvarez
31079e2e3d
style: Disable "removed" assertion in Gecko. 2017-09-13 19:12:49 +02:00
bors-servo
e50341d4a9 Auto merge of #18352 - jdm:serialize-fun, r=emilio
Make serialization match Gecko in a few corner cases

This addresses the testcases from https://bugzilla.mozilla.org/show_bug.cgi?id=1345218. Gecko differs from the specification by doing the following:
* reusing longhands that have previously been serialized in order to serialize shorthands
* immediately breaking out of the shorthand loop for the current property as soon as a shorthand is successfully serialized

https://github.com/w3c/csswg-drafts/issues/1774 is filed to track ways that the standard could be made more clear on these points.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix [bug 1345218](https://bugzilla.mozilla.org/show_bug.cgi?id=1345218).
- [X] There are tests for these changes

<!-- 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/18352)
<!-- Reviewable:end -->
2017-09-13 10:51:00 -05:00
Emilio Cobos Álvarez
82c58d0a05
script: Fix stylesheet adoption. 2017-09-13 17:11:24 +02:00