Commit graph

152 commits

Author SHA1 Message Date
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
Manish Goregaokar
2091981db8 Some fixes in style 2016-07-12 20:00:24 +05:30
Ms2ger
79e0d18a1d Add some documentation to the style crate. 2016-06-27 17:33:14 +02:00
Simon Sapin
00b6210519 Make the style crate almost build on stable Rust.
`discriminant_value` will need to be replaced with something else later.
2016-06-22 15:44:13 +02:00
Pawel Kondzior
db2e10a70f Report memory usage from LayoutThreadData Stylist [#7038] 2016-03-19 11:53:13 -07:00
Anthony Ramine
cb5cd8d881 Say farewell to in-tree HeapSizeOf 2016-02-04 22:03:32 +01:00
Alan Jeffrey
3dec6edd10 Update string_cache to 0.2.
Updated string_cache, html5ever, xml5ever and selectors in Cargo.toml files and Cargo.lock.
Removed references to string_cache_plugin.
Import atom! and ns! from string_cache.
Replaced ns!("") by ns!().
Replaced ns!(XML) and co by ns!(xml) and co.
Replaced atom!(foo) by atom!("foo").
Replaced Atom::from_slice by Atom::from.
Replaced atom.as_slice() by &*atom.
2015-11-25 10:13:21 -06:00
Simon Sapin
3973085cb6 Fix double /**//**/ 2015-11-06 23:01:55 +01:00
Simon Sapin
40e6cc118e Detect var() in shorthand declarations. 2015-11-06 23:01:54 +01:00
Simon Sapin
6ed5b561df Derive more Debug impls. 2015-11-06 23:01:12 +01:00
Simon Sapin
020d03b656 Custom properties: handle premature EOF correctly. 2015-11-06 23:01:10 +01:00
Ravi Shankar
889eec364b sorted the extern crate, mod & use declarations 2015-09-24 02:12:45 +05:30
Simon Sapin
feaf6f4c3f Initial support for custom properties in CSSStyleDeclaration 2015-09-17 14:48:56 +02:00
Simon Sapin
d56ea10770 var() substitution: insert /**/ between tokens that would be parse as one token. 2015-09-17 14:48:20 +02:00
Simon Sapin
81dd1ab363 Record first and last token type of custom property values. 2015-09-17 14:48:19 +02:00
Simon Sapin
54ef8055ec The function name var() is case-insensitive. 2015-09-17 14:48:15 +02:00
Simon Sapin
ab9e1af206 Allow whitespace-only custom property values. 2015-09-17 14:48:14 +02:00
Simon Sapin
c7622bf22f Fix !important in custom properties.
Test changes are also in https://github.com/w3c/csswg-test/pull/847/files
2015-09-17 14:48:13 +02:00
Simon Sapin
c651c2f3db Remove obsolete FIXME comment.
See https://lists.w3.org/Archives/Public/www-style/2015Jul/0360.html
2015-09-03 23:02:25 +02:00
Simon Sapin
a9db4eef14 Factor out custom property name parsing. 2015-09-03 23:02:24 +02:00
Simon Sapin
b4fdb5d803 Substitute var() in longhand property declarations. 2015-09-03 23:02:22 +02:00
Simon Sapin
b2ee828520 [T]::position_elem is deprecated. 2015-09-03 23:02:22 +02:00
Simon Sapin
1d47857be9 Invalid at computed-value time customp properties get their inherited value. 2015-09-03 23:02:21 +02:00
Simon Sapin
a18a1a8d79 Add a FIXME comment of EOF handling in custom properties. 2015-09-03 23:02:20 +02:00
Simon Sapin
c3b8b39437 An empty <declaration-value> is invalid. 2015-09-03 23:02:19 +02:00
Simon Sapin
4bf28417b4 Make custom property substitution do less work.
When var() is substituted, record that result rather than re-compute it later.
2015-09-03 23:02:18 +02:00
Simon Sapin
1c1a9379a3 Substitute var() in custom properties at computed value time. 2015-09-03 23:02:17 +02:00
Simon Sapin
7bcf9f0c9a Use nested parsers as appropritate 2015-09-03 23:02:16 +02:00
Simon Sapin
3fcd8938f3 Support CSS-wide keywords in custom properties 2015-09-02 18:32:38 +02:00