Commit graph

93 commits

Author SHA1 Message Date
Manish Goregaokar
44f16452b6
Replace manual iteration with retain() 2017-10-23 14:24:16 -07:00
Manish Goregaokar
f61151a726
Revert diagnostics code from 1251537459 2017-10-23 14:10:52 -07:00
Manish Goregaokar
b118ba72d0 Revert "Diagnostic map semantics."
This reverts commit f5c5be00a7.
2017-10-23 13:51:08 -07:00
Nicholas Nethercote
4506f0d30c Replace all uses of the heapsize crate with malloc_size_of.
Servo currently uses `heapsize`, but Stylo/Gecko use `malloc_size_of`.
`malloc_size_of` is better -- it handles various cases that `heapsize` does not
-- so this patch changes Servo to use `malloc_size_of`.

This patch makes the following changes to the `malloc_size_of` crate.

- Adds `MallocSizeOf` trait implementations for numerous types, some built-in
  (e.g. `VecDeque`), some external and Servo-only (e.g. `string_cache`).

- Makes `enclosing_size_of_op` optional, because vanilla jemalloc doesn't
  support that operation.

- For `HashSet`/`HashMap`, falls back to a computed estimate when
  `enclosing_size_of_op` isn't available.

- Adds an extern "C" `malloc_size_of` function that does the actual heap
  measurement; this is based on the same functions from the `heapsize` crate.

This patch makes the following changes elsewhere.

- Converts all the uses of `heapsize` to instead use `malloc_size_of`.

- Disables the "heapsize"/"heap_size" feature for the external crates that
  provide it.

- Removes the `HeapSizeOf` implementation from `hashglobe`.

- Adds `ignore` annotations to a few `Rc`/`Arc`, because `malloc_size_of`
  doesn't derive those types, unlike `heapsize`.
2017-10-18 22:20:37 +11:00
Matt Brubeck
efc3683cc7 Fix commonmark Markdown warnings in docs, part 1
Fixes warnings from rust-lang/rust#44229 when `--enable-commonmark` is
passed to rustdoc.

This is mostly a global find-and-replace for bare URIs on lines by
themselves in doc comments.
2017-10-17 11:24:57 -07:00
Xidorn Quan
1251537459 Rewrite cycle removal algorithm of custom properties and integrate it with substitution 2017-10-13 10:55:24 +11:00
Cameron McCormack
51c1fb681d style: Avoid cloning inherited CustomPropertiesMap when cascading properties with the same value. 2017-10-12 10:33:34 +08:00
Simon Sapin
c0f8f15f39 Update to cssparser 0.22 (source location in error types) 2017-10-10 13:28:17 +02:00
Emilio Cobos Álvarez
1d2e9e3ef7
style: Optimize custom properties cycle removal.
After #18791, this is the major custom_properties perf bottleneck in the
testcase from bug 1405411.

I'm looking into how to efficiently merge this into `substitute_all`, but
meanwhile this is worth landing, and makes most of the overhead go away.

MozReview-Commit-ID: LMUGc8kPhhE
2017-10-09 21:47:20 +02:00
Emilio Cobos Álvarez
a6eaa0812a
style: Share custom property declarations if they don't contain variable references. 2017-10-09 12:29:50 +02:00
Emilio Cobos Álvarez
7e143372bd
style: Don't go through remove_cycles if there are no references in the specified values. 2017-10-09 09:22:28 +02:00
Emilio Cobos Álvarez
c354f224ff
style: Refactor the custom properties map to have less temporary hashmap entries. 2017-10-09 09:22:28 +02:00
Emilio Cobos Álvarez
1ecd942384
style: Rename CustomPropertiesBuilder::custom_properties to something more descriptive. 2017-10-09 09:22:27 +02:00
Emilio Cobos Álvarez
4914351f2b
style: Hoist cascade() to CustomPropertyBuilder. 2017-10-09 09:22:27 +02:00
Emilio Cobos Álvarez
d0f080d5dd
style: Introduce CustomPropertiesBuilder.
I'm about to introduce more state here to implement optimizations for custom
property cascading, so this abstraction is useful to encapsulate that state.
2017-10-08 15:01:21 +02:00
Emilio Cobos Álvarez
8ea275a376
style: Avoid unused context argument.
In custom_properties::SpecifiedValue::parse.

It's not a big deal now, but it's useful to simplify testing this stuff, since
it avoids forcing us to mock it.
2017-10-08 12:56:24 +02:00
Bobby Holley
f5c5be00a7 Diagnostic map semantics.
MozReview-Commit-ID: C0a5g6xMPY0
2017-10-07 12:54:15 -07:00
Emilio Cobos Álvarez
72497330a9
style: Iterate in the expected order in the custom_properties module.
In #18745, I replaced a few manual iterations over `index` with the iterator,
and it changed the behavior of `layout/style/test/test_variables_order.html`,
since it turns out that the iterator iterates right to left.

I think this is just an accident that happened due to inconsistencies in how we
were iterating over it, and that our behavior was inconsistent (since we
iterated rtl in some cases, but ltr in others seems like it'd be inconsistent
depending on the depth of the tree and different stuff).

This brings back the expected behavior again, and ensures we iterate over a
consistent order every time.
2017-10-05 14:08:04 +02:00
Emilio Cobos Álvarez
089d5eecb7
style: Reformat the substitute_block function. 2017-10-04 14:55:23 +02:00
Emilio Cobos Álvarez
c4dbbf0656
style: Use map_or instead of map(..) == Some(false). 2017-10-04 14:53:05 +02:00
Emilio Cobos Álvarez
583d89ac08
style: Use the OrderedMap iterator instead of doing our own thing. 2017-10-04 14:51:53 +02:00
Emilio Cobos Álvarez
f072c0bb05
style: Use the hashmap indexed getter in the custom props iterator code.
This will give a nicer error message, plus it's more compact.
2017-10-04 14:51:52 +02:00
Emilio Cobos Álvarez
08fd5ba8c1
style: Use Option<&mut> instead of &mut Option in custom_properties.rs 2017-10-04 14:51:51 +02:00
Emilio Cobos Álvarez
2adfd84636
style: Avoid being so Arc-happy in the custom properties code. 2017-10-01 13:27:15 +02:00
Emilio Cobos Álvarez
b7b22b76a8
style: Use PrecomputedHasher for custom properties. 2017-09-30 14:35:38 +02:00
Xidorn Quan
dba19f53f5 Don't use inherited custom properties for substitution 2017-09-28 19:46:53 +10: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
Manish Goregaokar
3ddb1fda74 Tidy fixes 2017-09-01 09:53:18 -07:00
Manish Goregaokar
5cd296a264
stylo: Replace all hashtable collections with ones from style::hash 2017-08-31 16:28:30 -07:00
Emilio Cobos Álvarez
36ff89bd28
style: Remove HasViewportPercentage.
It's not needed since #18268
2017-08-29 23:51:21 +02:00
Clément DAVID
c5fe235112 order derivable traits lists
Ignoring :
 - **generated**.rs
 - python/tidy/servo_tidy_tests/rust_tidy.rs
2017-08-23 21:38:44 +02:00
bors-servo
845131c425 Auto merge of #18025 - servo:line-counting, r=jdm
Update to cssparser 0.19, count line numbers during tokenization

https://github.com/servo/rust-cssparser/pull/177

Also simplify the `ParseErrorReporter` trait a bit.

<!-- 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/18025)
<!-- Reviewable:end -->
2017-08-09 16:16:33 -05:00
Simon Sapin
7382dad939 Update to cssparser 0.19, count line numbers during tokenization 2017-08-09 22:37:16 +02:00
Fernando Jiménez Moreno
ff1e701fa6 style: Implement OrderedMapIterator 2017-08-08 12:26:45 +02:00
Emilio Cobos Álvarez
fd1f14a41e style: Use OrderedMap for specified values too. 2017-08-08 11:55:33 +02:00
Emilio Cobos Álvarez
6d61d62bf4 style: Make the OrderedMap also generic on the value. 2017-08-08 11:55:32 +02:00
Emilio Cobos Álvarez
d48fd2964d style: Make ComputedValuesMap a bit more generic. 2017-08-08 11:55:32 +02:00
Simon Sapin
eb98ae6e04 Update cssparser to 0.18
https://github.com/servo/rust-cssparser/pull/171
2017-07-24 11:39:12 +02:00
Michael Partheil
b07ebbae6b Replace all uses of the style::stylearc alias with servo_arc.
The alias is left there temporarilly and will be removed completely in a later commit where
also components/style/gecko/generated/structs_{debug|release}.rs are re-generated (they still
use the old alias).
2017-07-19 09:29:05 +02:00
Josh Matthews
0b43d0072c stylo: Update rust-cssparser; extract more specific error types when reporting (bug 1352669). 2017-07-10 20:46:12 -04:00
Gecko Backout
32269fa7cc Backed out changeset fec394734f83 (bug 17624) for build bustage a=backout CLOSED TREE
Backs out https://github.com/servo/servo/pull/17624
2017-07-06 21:58:15 +00:00
Josh Matthews
f5a3830ea2 stylo: Update rust-cssparser; extract more specific error types when reporting (bug 1352669). 2017-07-06 14:32:37 -04:00
Fernando Jiménez Moreno
0335c09810 Derive Eq and PartialEq for CustomPropertiesMap 2017-06-28 19:50:29 -07:00
Fernando Jiménez Moreno
93f0de7899 stylo: implement indexed and count getters for custom properties 2017-06-28 12:29:56 -07:00
Simon Sapin
a5bb55790f Untry style 2017-06-18 13:18:13 +02:00
bors-servo
81275234aa Auto merge of #17284 - jyc:custom-properties-cascade, r=emilio
Propagate changes in custom properties' computed values to descendants

If ComputedValues.custom_properties differs between the old and new
ComputedValues, indicate that we have to propogate changes to
descendants by setting child_cascade_requirement to
MustCascadeDescendants in cascade_primary.

style::matching::TElement::cascade_primary already calls
accumulate_damage, which eventually calls
ServoRestyleDamage::compute_style_difference in order to check if other
properties' computed values changed. If any of those change, we signal
that we need to propogate changes for inherited properties.

With Properties & Values, some custom properties will not be inherited,
and we will need to revisit this.

---
<!-- 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 #17283

<!-- 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/17284)
<!-- Reviewable:end -->
2017-06-16 11:04:51 -07:00
Simon Sapin
b83afdedc8 Upgrade cssparser to 0.15 2017-06-16 15:05:46 +02:00
Jonathan Chan
32f62a5ac6 style: Propagate changes in custom properties' computed values to descendants.
If ComputedValues.custom_properties differs between the old and new
ComputedValues, indicate that we have to propogate changes to
descendants by setting child_cascade_requirement to
MustCascadeDescendants in cascade_primary.

style::matching::TElement::cascade_primary already calls
accumulate_damage, which eventually calls
ServoRestyleDamage::compute_style_difference in order to check if other
properties' computed values changed. If any of those change, we signal
that we need to propogate changes for inherited properties.

With Properties & Values, some custom properties will not be inherited,
and we will need to revisit this.
2017-06-13 13:39:37 -07:00
Josh Matthews
27ae1ef2e7 Thread ParseError return values through CSS parsing. 2017-06-09 16:46:25 -04:00
Anthony Ramine
cb2e04acf6 Remove style::values::HasViewportPercentage reexport 2017-05-20 22:00:05 +02:00