Commit graph

170 commits

Author SHA1 Message Date
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
Anthony Ramine
7ee124b1ed Derive the most trivial Animate impls 2017-08-22 19:12:47 +02:00
Anthony Ramine
aea0cd7ec7 Introduce values::animated::Animate
This replaces the Animatable trait and merges its three former methods into a single one.
2017-08-22 09:41:01 +02:00
Anthony Ramine
277351da35 Derive ComputeSquaredDistance 2017-08-13 13:34:04 +02:00
Anthony Ramine
51b740033b Introduce ComputeSquaredDistance
This allows us to merge the former Animatable methods compute_distance and
compute_squared_distance, reducing code size.
2017-08-13 00:51:09 +02:00
Anthony Ramine
b14e68f915 Remove impl_animatable_for_option_tuple 2017-08-13 00:51:08 +02:00
Boris Chiou
ebedea5860 Bug 1374233 - Part 11: Implement ToAnimatedValue for background-size.
MozReview-Commit-ID: DMcvpaqHdy9
2017-08-04 14:23:26 +08:00
Emilio Cobos Álvarez
0e4c7c3722
style: Standardize different methods to inherit and reset properties.
This avoids special-casing justify-items.

MozReview-Commit-ID: FoEs2IHC1t6
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-07-31 11:55:05 +02:00
Emilio Cobos Álvarez
e374a54050
style: Cleanup the cascade a good bit. 2017-07-20 11:20:37 +02:00
bors-servo
31228c1849 Auto merge of #17775 - michael-p:rename-stylearc-to-servo-arc, r=emilio
Replace all uses of the style::stylearc alias with servo_arc.

The `stylearc` alias is left there temporarilly and will be removed completely in a later commit/PR where also `components/style/gecko/generated/structs_{debug|release}.rs` are re-generated (they still use the old alias).

---
<!-- 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 #17768  (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because no new features / only refactoring

<!-- 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/17775)
<!-- Reviewable:end -->
2017-07-19 06:03:17 -07:00
bors-servo
d76d097891 Auto merge of #17774 - servo:derive-all-the-things, r=emilio
Prepare some code for future derivation 🌊

<!-- 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/17774)
<!-- Reviewable:end -->
2017-07-19 01:56:05 -07:00
Anthony Ramine
98bf832169 Move Animatable::get_zero_value to ToAnimatedZero::to_animated_zero 2017-07-19 10:19:44 +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
Emilio Cobos Álvarez
655c842d2e
style: Cleanup most of the Inner mess.
MozReview-Commit-ID: Ieg2GJT0yUl
2017-07-18 17:34:57 +02:00
Manish Goregaokar
808b1f509b stylo: Use ComputedValuesInner instead of ComputedValues when we don't need it 2017-07-17 18:02:25 -07:00
Simon Sapin
34c5a21691 Merge per-property substitute_variables* functions into one. 2017-07-13 16:23:36 +02:00
Simon Sapin
3d3c196d90 Fix shorthand parsing pushing declarations when parse_entirely returns Err 2017-07-13 16:23:35 +02:00
Simon Sapin
54f1325a49 var() functions in longhands: use a single code path with IDs
… rather than generating similar code for every longhand property
2017-07-13 16:23:12 +02:00
Simon Sapin
252e52e24e var() functions in shorthands: use a single code path with IDs
… rather than generating similar code for each shorthand.
2017-07-13 16:23:11 +02:00
Simon Sapin
8a8614eccd CSS-wide keywords parsing in longhands: use a single code path with IDs
… rather than generating similar code for every longhand property.
2017-07-13 16:23:10 +02:00
Xidorn Quan
0e91f033cb Serialize font longhands to -moz-use-system-font when using system font like what Gecko does. 2017-07-11 17:19:12 +10:00
Josh Matthews
a08371e8eb stylo: Create error reporters linked to documents (bug 1352669) 2017-07-10 20:46:08 -04:00
Anthony Ramine
4a2ede9b3a Kill delegate_animate from vector_longhand
The impl is now always generated if animation_value_type is ComputedValue.
2017-07-05 11:22:00 +02:00
Anthony Ramine
6c7c00f4c8 Kill gecko_only from vector_longhand 2017-07-05 11:21:59 +02:00
Xidorn Quan
9299a0dc2c Handle prefixed value of -moz-user-select properly 2017-06-29 14:37:28 -07:00
Anthony Ramine
395f6be0a6 Use the Separator trait for the filter property 2017-06-27 23:40:16 +02:00
Anthony Ramine
813883e1bd Don't use SmallVec<[T; 1]> for computed values with an empty default 2017-06-27 23:37:51 +02:00
Anthony Ramine
da9d2001db Change space_separated_allowed into separator 2017-06-27 23:37:49 +02:00
Anthony Ramine
c03f5f19ab Introduce CommaWithSpace
This allows us to support stroke-dasharray the same way as comma-separated
values.
2017-06-27 23:37:48 +02:00
bors-servo
92679480b1 Auto merge of #17469 - nox:empty-vs-initial, r=emilio
Distinguish the emptiness of a property from its initial value

<!-- 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/17469)
<!-- Reviewable:end -->
2017-06-23 05:59:49 -07:00
Anthony Ramine
f01ea53ac1 Distinguish the emptiness of a property from its initial value 2017-06-23 12:39:44 +02:00
Simon Sapin
837cb6ddb2 Pass some 48-bytes closures by references instead of by value. 2017-06-22 02:02:31 +02:00
Simon Sapin
a5bb55790f Untry style 2017-06-18 13:18:13 +02:00
Anthony Ramine
a568f7752f Derive ToCss for some shorthand properties 2017-06-17 13:46:34 +02:00
Xidorn Quan
08c12062c7 Resolve counter style during parallel traversal when possible. 2017-06-14 20:05:38 +10:00
Josh Matthews
27ae1ef2e7 Thread ParseError return values through CSS parsing. 2017-06-09 16:46:25 -04:00
Anthony Ramine
c4f1d647a0 Derive the most trivial ToCss implementations 🌋
For now, all variants get serialised as the space-separated serialisations
of their fields. Unit variants are not supported.
2017-06-04 16:17:56 +02:00
bors-servo
433d68955b Auto merge of #17071 - servo:derive-all-the-things, r=emilio
Reuse Rect<T> some more

<!-- 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/17071)
<!-- Reviewable:end -->
2017-05-30 05:11:28 -05:00
Xidorn Quan
acb7242304 Set flex-basis to 0% when omitted in flex shorthand. 2017-05-30 08:58:11 +10:00
Anthony Ramine
4144dc74db Make Rect<T> a struct tuple
It makes no sense to have named fields in some cases, notably to reuse
Rect<T> in BorderRadius<T>.
2017-05-28 14:36:36 +02:00
Anthony Ramine
6f3c46ca61 Remove uses of parse_four_sides and serialize_four_sides 2017-05-25 17:27:17 +02:00
bors-servo
b428a94326 Auto merge of #16962 - hiikezoe:prefixed-intrinsic-size-value, r=Manishearth
Prefixed intrinsic size value

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

This is a PR for https://bugzilla.mozilla.org/show_bug.cgi?id=1355402
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #16788
- [X] These changes do not require tests because it's for stylo

<!-- 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/16962)
<!-- Reviewable:end -->
2017-05-22 01:46:01 -05:00
Hiroyuki Ikezoe
d06af8971d Support prefixed intrinsic size value for flex-basis.
auto() and zero() are used in the parser for flex shorthand property.
2017-05-21 08:33:12 +09:00
Hiroyuki Ikezoe
3a3bc03eb8 Support prefixed intrinsic size value for {width,height,{inline,block}-size}}. 2017-05-21 08:33:12 +09:00
Hiroyuki Ikezoe
aba0db0943 Factor out implemantations for {min,max} size properties as a macro. 2017-05-21 08:33:12 +09:00
Anthony Ramine
cb2e04acf6 Remove style::values::HasViewportPercentage reexport 2017-05-20 22:00:05 +02:00
bors-servo
4f0b24ac0c Auto merge of #16960 - servo:derive-all-the-things, r=emilio
Derive HasViewportPercentage 🍷

<!-- 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/16960)
<!-- Reviewable:end -->
2017-05-20 11:34:36 -05:00
Anthony Ramine
00bfc6b172 Remove a lot of unused imports 2017-05-20 15:23:19 +02:00
Anthony Ramine
90bae7f802 Derive HasViewportPercentage 🍷 2017-05-20 14:48:04 +02:00
Simon Sapin
d2be5239f5 Avoid returning / passing around a huge ParsedDeclaration type
This enum type used to contain the result of parsing
one CSS source declaration (`name: value;`) and expanding shorthands.
Enum types are as big as the biggest of their variant (plus discriminant),
which was quite big because some shorthands
expand to many longhand properties.
This type was returned through many functions and methods,
wrapped and rewrapped in `Result` with different error types.
This presumably caused significant `memmove` traffic.

Instead, we now allocate an `ArrayVec` on the stack
and pass `&mut` references to it for various functions to push into it.
This type is also very big, but we never move it.

We still use an intermediate data structure because we sometimes decide
after shorthand expansion that a declaration is invalid after all
and that we’re gonna drop it.
Only later do we push to a `PropertyDeclarationBlock`,
with an entire `ArrayVec` or nothing.

In future work we can try to avoid a large stack-allocated array,
and instead writing directly to the heap allocation
of the `Vec` inside `PropertyDeclarationBlock`.
However this is tricky:
we need to preserve this "all or nothing" aspect
of parsing one source declaration,
and at the same time we want to make it as little error-prone as possible
for the various call sites.
`PropertyDeclarationBlock` curently does property deduplication
incrementally: as each `PropertyDeclaration` is pushed,
we check if an existing declaration of the same property exists
and if so overwrite it.
To get rid of the stack allocated array we’d need to somehow
deduplicate separately after pushing multiple `PropertyDeclaration`.
2017-05-19 18:53:25 +02:00