Commit graph

2720 commits

Author SHA1 Message Date
Hiroyuki Ikezoe
03d354afba Rename animatable to animation_type.
animation_type takes following values:

animation_type="none" for non-animatable properties
animation_type="normal" for animatable properties
animation_type="discrete" for animatable but discrete type of animations

We use string value to distinguish the case where no animation_type is
specified.
animation_type="discrete" will be used in a subsequent patch to make a property
animatable as discrete type.
2017-04-07 10:38:28 +09:00
bors-servo
3beaa8d2e9 Auto merge of #16289 - bholley:primary_before_pseudos, r=emilio
Cascade the primary style before matching pseudos

https://bugzilla.mozilla.org/show_bug.cgi?id=1353960

<!-- 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/16289)
<!-- Reviewable:end -->
2017-04-06 16:32:14 -05:00
Bobby Holley
8acb4ed87c Match eager pseudos after the primary cascade.
This is necessary in order to make the computation of eager pseudos depend on
the primary ComputedValues, which we want to do for ::first-letter/::first-line.

This also fixes a bug where the behavior of EagerPseudoStyles::is_empty was reversed
in both the implementation and the callsite.

MozReview-Commit-ID: EXBxclyHWXu
2017-04-06 14:31:16 -07:00
Emilio Cobos Álvarez
846c950b6b
style: More cleanups around length parsing and viewport rule parsing. 2017-04-06 20:56:24 +02:00
Emilio Cobos Álvarez
705ecb4557
style: Multiple style nits across parsing code. 2017-04-06 20:56:23 +02:00
Emilio Cobos Álvarez
726f918b46
style: Cleanup viewport rule parsing. 2017-04-06 20:56:22 +02:00
Bobby Holley
19743a67ba Rearrange compute_style and eliminate MatchResults.
This simplifies things by avoiding the computation of MatchResults when we
don't need them.

We continue to compute rule_nodes_changed, even though we don't use it
for the moment, since we will need it soon for various incremental restyle
optimizations.

MozReview-Commit-ID: 4qsUYaD5Bs2
2017-04-06 11:28:24 -07:00
Bobby Holley
42f5aea76a Remove shareable boolean from ComputedValues and simplify code.
This code is all vestigial at this point, presumably after a refactoring.

MozReview-Commit-ID: CV0lKMStq13
2017-04-06 11:28:18 -07:00
Bobby Holley
f9de1dedd8 Factor out the application of selector flags into a helper.
MozReview-Commit-ID: 2FZxnBxvaOb
2017-04-06 11:28:07 -07:00
bors-servo
d7fb2cc27f Auto merge of #16280 - hiikezoe:handle-base-style, r=heycam,birtles
Handle base style

<!-- Please describe your changes on the following line: -->
This is a PR for https://bugzilla.mozilla.org/show_bug.cgi?id=1311257

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

<!-- Either: -->
- [X] These changes do not require tests because it's for stylo.

<!-- 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/16280)
<!-- Reviewable:end -->
2017-04-05 22:53:30 -05:00
Xidorn Quan
ed5c49c102 Add std::atomic to opaque_types in build_gecko
Recent change in bug 1277709 makes ThreadSafeAutoRefCnt start using std::atomic, which somehow doesn't not have #[derive(Debug)] on Windows, which makes all objects which includes ThreadSafeAutoRefCnt to stop having #[derive(Debug)]. This breaks stylo build on Windows.

By adding it as an opaque type, std::atomic would derive Debug again.
2017-04-06 13:06:51 +10:00
Hiroyuki Ikezoe
3da46d9f79 Update bindings. 2017-04-06 11:27:29 +09:00
Hiroyuki Ikezoe
56dc7294e5 Add FFI functions to get progress value and current position in a segment.
Two functions added in this patch get progress value from ComputedTiming
or get the position in a given AnimationPropertySegment.
Without these FFIs, we need to expose Maybe<> and Nullable<> and handle
them in Rust.
2017-04-06 10:30:39 +09:00
Hiroyuki Ikezoe
f1d3f23bfa Expose ComputedTiming to FFI.
This will be also used for animation value composition in Rust.
2017-04-06 10:30:38 +09:00
Hiroyuki Ikezoe
68be131165 Move AnimationPropertySegment in a separate header and expose it in FFI.
This will be used for animation value composition in Rust.
2017-04-06 10:30:37 +09:00
Hiroyuki Ikezoe
97aacb242e Add an FFI function that returns an AnimationValue for a given nsCSSPropertyID from computed values.
When we compose style for a given nsCSSPropertyID in the case where
we have no specified values in target keyframe, we use this AnimationValue
for composition as if it's specified.
2017-04-06 10:30:28 +09:00
Hiroyuki Ikezoe
fb6aceba31 Add a function that returns a base computed values (i.e. computed values without any animations rules).
This base value will be used for additive, accumulative animations
and also SMIL.
2017-04-06 10:08:52 +09:00
Hiroyuki Ikezoe
2c0b821564 Make cascade_with_rules() take a boolean representing whether the cascade is for pseudo element or not.
cascade_with_rules() doesn't mutate any already-computed styles.
2017-04-06 10:08:51 +09:00
Hiroyuki Ikezoe
c22d4e518c Make cascade_with_rules take SharedStyleContext instead StyleContext. 2017-04-06 10:08:50 +09:00
Hiroyuki Ikezoe
4516d25889 Make TransitionProperty::from_declaration() convert PropertyDeclaration::{CSSWideKeyword,WithVariables} as well. 2017-04-06 10:08:43 +09:00
Hiroyuki Ikezoe
b801e07ec5 Make letter-spacing animatable.
From the spec: 'normal' value computes to zero.
2017-04-06 08:38:04 +09:00
Carlos Martinez
b85f1a0240 Reject negative values of flex-basis.
Fixes #15902
2017-04-05 18:59:09 +02:00
bors-servo
a55cb8425d Auto merge of #16269 - heycam:atom-already-addrefed, r=upsuper
Add an Atom::from_addrefed function.

<!-- 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/16269)
<!-- Reviewable:end -->
2017-04-05 05:10:07 -05:00
Cameron McCormack
581cefccfe stylo: Don't leak the nsIAtom we get back from Gecko_GetXMLLangValue. 2017-04-05 17:39:40 +08:00
Cameron McCormack
f3dcef8c81 style: Add an Atom::from_addrefed function. 2017-04-05 17:39:26 +08:00
bors-servo
42f58503c0 Auto merge of #16169 - servo:stylo-heapsize, r=emilio
Remove heapsize for Stylo

It doesn’t seem to be used, and is causing compilation trouble for Gecko: https://bugzilla.mozilla.org/show_bug.cgi?id=1350581

<!-- 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/16169)
<!-- Reviewable:end -->
2017-04-05 03:59:26 -05:00
Manish Goregaokar
5d6bc8177e stylo: Add support for xml:lang
MozReview-Commit-ID: E0GpyPKES3k
2017-04-04 21:21:28 -07:00
Manish Goregaokar
8dea66e6f1
stylo: Add support for <math> default language
MozReview-Commit-ID: LhhSBzYjow5
2017-04-04 21:17:06 -07:00
Manish Goregaokar
1c23296d8a
stylo: Add support for <table> color quirk
MozReview-Commit-ID: 56IKARwfbhw
2017-04-04 21:17:04 -07:00
Manish Goregaokar
0392e58a2f
stylo: Add support for text-align match-parent and the <th> -moz-center-or-inherit behavior
MozReview-Commit-ID: GEDM7JfJB8A
2017-04-04 21:16:57 -07:00
Hiroyuki Ikezoe
ec40d1db91 Make AnimationValue::from_declaration return computed CSS variable.
In Gecko, we resolve CSS variables when we generate keyframes for each
animations (i.e. when we create script animations, when we create/update CSS
animations). AnimationValue::from_declaration is only called in both cases.
2017-04-05 09:09:13 +09:00
bors-servo
8747c4e04c Auto merge of #16242 - pyfisch:transform-one, r=emilio
Implement serialization for transform functions.

Preserve more information from transform function parsing.
Preserve angle unit while parsing.
Simplify SpecifiedMatrix.
Use the write! macro for formatting with a helper called Css.
Implement ToCss for &T if T implements ToCss.
Add some tests and update others.

closes #15194

<!-- 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
- [x] These changes fix #15194 (github issue number if applicable).

<!-- 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/16242)
<!-- Reviewable:end -->
2017-04-04 15:30:23 -05:00
Pyfisch
480f59c880 Implement serialization for transform functions.
Preserve more information from transform function parsing.
Preserve angle unit while parsing.
Simplify SpecifiedMatrix.
Use the write! macro for formatting with a helper called Css.
Implement ToCss for &T if T implements ToCss.
Add some tests and update others.

closes #15194
2017-04-04 19:04:19 +02:00
Hiroyuki Ikezoe
97e27ca3a7 Serialize baseline values correctly. 2017-04-04 11:10:48 +09:00
Hiroyuki Ikezoe
e37e170c50 Parse "first baseline" and "last baseline". 2017-04-04 11:10:23 +09:00
bors-servo
eee25e2313 Auto merge of #16250 - bholley:pseudo_repr, r=emilio
Don't use a HashMap for pseudo-element styles

Reviewed in https://bugzilla.mozilla.org/show_bug.cgi?id=1335708

@bors-servo try

<!-- 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/16250)
<!-- Reviewable:end -->
2017-04-03 18:04:34 -05:00
bors-servo
806584da9a Auto merge of #16247 - servo:for_cssom, r=jdm
ParserContext::new_for_cssom is used for author origin, not user.

This probably doesn’t make any difference since the only thing we do with this origin is test whether it is user-agent (for internal properties), but this is more correct.

<!-- 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/16247)
<!-- Reviewable:end -->
2017-04-03 17:10:50 -05:00
Bobby Holley
3f0d022ba2 Use a more compact representation to store eager pseudo-elements.
This means that ElementStyles only need a single word to store eager pseudos.

MozReview-Commit-ID: 5bDXlDweN46
2017-04-03 14:34:23 -07:00
bors-servo
dc8ed0d740 Auto merge of #15562 - emilio:rule-mem-order, r=bholley
style: Tweak rule tree memory ordering.

I've commented on the ones that I think are the most tricky. Note that this code
is stress-tested in the style tests (tests/unit/style/rule_tree/bench.rs).

<!-- 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/15562)
<!-- Reviewable:end -->
2017-04-03 15:15:49 -05:00
Emilio Cobos Álvarez
1d94a68e54
style: Tweak rule tree memory ordering.
I've commented on the ones that I think are the most tricky. Note that this code
is stress-tested in the style tests (tests/unit/style/rule_tree/bench.rs).
2017-04-03 21:47:39 +02:00
Bobby Holley
1ff008caa3 Improve some ergonomics around pseudo-elements.
I think a lot of the current indirection predates the crate merge.

MozReview-Commit-ID: FM28dgZa5go
2017-04-03 12:35:14 -07:00
Simon Sapin
3ac0dd05cf ParserContext::new_for_cssom is used for author origin, not user.
This probably doesn’t make any difference since the only thing we do
with this origin is test whether it is user-agent (for internal properties),
but this is more correct.
2017-04-03 18:28:47 +02:00
bors-servo
679b418937 Auto merge of #16241 - upsuper:bug1352763-bug1352025, r=Manishearth,emilio
Stop passing url as string into Servo side

This is the Servo side changes of [bug 1352763](https://bugzilla.mozilla.org/show_bug.cgi?id=1352763) and [bug 1352025](https://bugzilla.mozilla.org/show_bug.cgi?id=1352025) which have been reviewed on Bugzilla.
2017-04-03 07:05:42 -05:00
Xidorn Quan
35b638e50b Update binding files. 2017-04-03 22:02:58 +10:00
Xidorn Quan
3d483a986d Move DUMMY_URL_DATA to glue and use static to avoid shutdown leak. 2017-04-03 22:02:57 +10:00
Xidorn Quan
2628ebe612 Use final url for updating stylesheet from @import rule. 2017-04-03 21:57:17 +10:00
Xidorn Quan
37585309e9 Use a UrlExtraData type alias to unify url handling logic. 2017-04-03 21:57:16 +10:00
Xidorn Quan
a097a293b5 Pass CSS loader to Servo for insertRule. 2017-04-03 21:18:09 +10:00
bors-servo
a5a5abd9f4 Auto merge of #16239 - servo:cascade-collect, r=emilio
Remove a memory allocation (`iter.collect::<Vec<_>>()`) in `cascade()`

This vector was there to pre-acquire locks and give all declarations the same lifetime (which is necessary for custom properties cascading).

https://github.com/servo/servo/pull/16014 introduce a guard to a shared pre-acquired lock, making this vector unnecessary.

<!-- 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
- [ ] 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/16239)
<!-- Reviewable:end -->
2017-04-03 05:35:19 -05:00
Simon Sapin
510bcc6186 Remove a memory allocation (iter.collect::<Vec<_>>()) in cascade()
This vector was there to pre-acquire locks and give all declarations
the same lifetime (which is necessary for custom properties cascading).

https://github.com/servo/servo/pull/16014 introduce a guard to a shared
pre-acquired lock, making this vector unnecessary.
2017-04-03 11:39:10 +02:00