Commit graph

130 commits

Author SHA1 Message Date
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
Bobby Holley
d78ca4c4f9 Use StyleArc in the style system.
MozReview-Commit-ID: flF0fv9E9M
2017-05-02 17:35:44 -07:00
Bobby Holley
8cf331a498 Rearrange PropertyDeclaration to avoid embedding DeclaredValue.
From https://bugzilla.mozilla.org/show_bug.cgi?id=1347719

This effectively combines the discriminants of the two enums and reduces the
size of PropertyDeclaration by one word.

MozReview-Commit-ID: 9rCRiSVZTQT
2017-03-16 14:40:55 -07:00
Xidorn Quan
03f6d21cb5 Make DeclaredValue store CSSWideKeyword
Rather than having separate variant for each CSS-wide keyword.
2017-03-02 11:09:05 +11:00
Nazım Can Altınova
adb6d20293 Box DeclaredValue::WithVariables 2017-02-09 11:10:10 +01:00
Nazım Can Altınova
43731c5757 Box custom property 2017-02-09 11:10:09 +01:00
Emilio Cobos Álvarez
369c2f299e
style: Simplify the cascade function in the custom_properties module. 2017-01-02 12:57:56 +01:00
Emilio Cobos Álvarez
c44826f1cc
style: Document the custom_properties module. 2017-01-02 12:57:56 +01:00
Xidorn Quan
2a502d7377 Store unset keyword as specified value 2016-12-21 10:43:26 +11:00
Ravi Shankar
dee1a65a69 Use the ParserContext along with Parser in the parse function 2016-11-27 08:49:20 +05:30
Artem Biryukov
9564673b5a Fix related to #14101
Add Parse trait implementation for some structures
2016-11-12 05:26:15 +03:00
Ravi Shankar
6061985898 Prefer Servo-specific ToCss for all types 2016-11-07 09:14:22 +05:30
Simon Sapin
53b638c0e2 Update to string-cache 0.3 2016-11-03 16:23:05 +01:00
Emilio Cobos Álvarez
9e88a495c8
style: Introduce a generic way of gathering information from the cascade, and use it for viewport units. 2016-08-16 10:58:16 -07:00