Commit graph

160 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
da5283d066
style: Fix Gecko build. 2018-09-15 19:19:18 +02:00
Simon Sapin
2a996fbc8f Replace mpsc with crossbeam/servo channel, update ipc-channel
Co-authored-by: Gregory Terzian <gterzian@users.noreply.github.com>
2018-09-12 13:33:32 +08:00
chansuke
8dab4d659a
Format style component. 2018-09-09 16:24:45 +02:00
Emilio Cobos Álvarez
4e1606bfaf
style: Push visited style computation a bit further down.
Bug: 1474959
Reviewed-by: xidorn
MozReview-Commit-ID: 1DILenWIw4D
2018-07-24 03:28:50 +02:00
Emilio Cobos Álvarez
90ef5607e4
style: Move TransitionProperty where it belongs.
Bug: 1419695
Reviewed-by: xidorn
MozReview-Commit-ID: 9PN6VfbDbLA
2018-06-12 12:15:05 -07:00
Emilio Cobos Álvarez
6940787916
style: Make the transition-property code make more sense.
We were working around the lack of alias support during parsing in
TransitionProperty by doing a Gecko lookup. That's a hack and is now gone.

Bug: 1419695
Reviewed-by: xidorn
MozReview-Commit-ID: EptUvJNTrZr
2018-06-12 12:15:04 -07:00
Emilio Cobos Álvarez
921c389247
style: Remove some unneeded cfg(..).
The less not-compiled code in common builds, the better for everybody.
2018-05-05 17:53:22 +02:00
Emilio Cobos Álvarez
cb48a837bf
style: Implement Debug for KeyframeAnimationStyle by hand.
The ComputedValues format is huge and unneeded.
2018-05-05 17:42:58 +02:00
Emilio Cobos Álvarez
33b593d32e
style: Fix servo build. 2018-05-05 17:19:06 +02:00
Bobby Holley
c99bcdd4b8 Run rustfmt on selectors, servo_arc, and style.
This was generated with:

./mach cargo fmt --package selectors &&
./mach cargo fmt --package servo_arc &&
./mach cargo fmt --package style

Using rustfmt 0.4.1-nightly (a4462d1 2018-03-26)
2018-04-10 17:35:15 -07:00
Emilio Cobos Álvarez
8c4b401dd3
style: Only expose longhands to rust via iterators.
The key here is that we only filter longhands if the shorthand is accessible to
content and vice-versa. This prevents the bug that prevented me to land this
patch before, which was us not expanding properly chrome-only shorthands.

Again, this is incomplete, and I need to teach LonghandsToSerialize to get a
potentially incomplete list of properties, and all that.
2018-02-28 00:19:31 +01:00
Anthony Ramine
e2a6d07dad Remove TransitionProperty::All 2018-02-26 14:30:53 +01:00
Emilio Cobos Álvarez
e5bd8fc5d8
style: Return early instead of indenting in animation code.
And also leave some WTF comments, because they make no sense so far.
2018-02-24 22:45:46 +01:00
Emilio Cobos Álvarez
5ac12b5df4
style: Make the TElement type arrive to the cascade function.
Not super-proud of this one, but it's the easiest way I could think of.

The changeset looks bigger than what it is, because while at it I've rewrapped a
fair amount of functions around to use proper block indentation.

Alternatives are parameterizing Stylist by <E>, which is not fun, or moving the
concrete element from layout_thread to layout, but that implies layout depending
on script, which isn't fun either.

Other alternative is implementing an empty enum and making anon boxes work on
it. It has the advantage of removing the annoying type parameter, but the
disadvantage of instantiating `cascade` twice, which isn't great, and having to
maintain all the boilerplate of a `TElement` implementation that just does
nothing.
2018-01-23 00:57:54 +01:00
Xidorn Quan
3593392788 Skip rule node which contains only inherited properties for rule cache. 2018-01-05 11:29:01 +11:00
Matt Brubeck
3005a26daf style: Use the ? operator for Option 2017-12-09 08:29:53 -08:00
Emilio Cobos Álvarez
af879523ea
style: Make all keywords CamelCase for consistency.
This prevents confusion and paves the ground for derive(Parse) of them.
2017-12-06 02:35:10 +01:00
Emilio Cobos Álvarez
dc414134bf
style: Move animation-iteration-count outside of mako. 2017-10-24 22:28:34 +02:00
Emilio Cobos Álvarez
3215e36b5b
style: Cleanup the animated value setup.
We have three different enums to represent slightly different things. Reuse them
properly, and kill some code in the animated_properties module while at it.

MozReview-Commit-ID: 5ZAly8f4lWy
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-09-29 13:20:50 +02:00
Hiroyuki Ikezoe
e3232f5c36 Filter out !important property in keyframes for servo. 2017-09-20 15:59:05 +09:00
Emilio Cobos Álvarez
c34c92e904 style: Add a TLS-based style struct caching mechanism. 2017-09-14 17:13:39 +08:00
bors-servo
e7f45028dc Auto merge of #18431 - mbrubeck:pdb-size, r=SimonSapin
Use SmallBitVec to optimize size of PropertyDeclarationBlock

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

<!-- 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/18431)
<!-- Reviewable:end -->
2017-09-11 08:57:07 -05:00
Matt Brubeck
a5a0e9ffe8 Use SmallBitVec for important flags in PDB 2017-09-11 06:53:05 -07:00
Emilio Cobos Álvarez
d5a24b79d9
style: Remove another stale todo in animation.rs
There's no mutex anymore.
2017-09-09 00:09:59 +02:00
Emilio Cobos Álvarez
2291ce4767
style: Remove CascadeInfo. 2017-08-28 14:40:47 +02:00
Emilio Cobos Álvarez
723d31a4d8
style: Remove SharedStyleContext::quirks_mode. 2017-08-25 12:23:30 +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
Emilio Cobos Álvarez
293274fa5e
style: Make sure to set the initial value of the transition even if we don't start it.
Otherwise we may get to the end of it directly, which is far from what we want.
2017-08-21 17:58:45 +02:00
Cameron McCormack
68268226ea style: Tweak Stylist API for getting animations to avoid exposing the hash table. 2017-08-09 16:24:49 +08:00
Boris Zbarsky
048044f98b Make it possible to construct StyleBuilder with two different inherited styles.
Part 3 of Gecko bug 1382806.  r=emilio
2017-07-26 15:25:34 -04: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
5ffa523ccd Don't use Point2D<f32> for cubic curves anymore 2017-07-19 10:19:41 +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
Josh Matthews
a08371e8eb stylo: Create error reporters linked to documents (bug 1352669) 2017-07-10 20:46:08 -04:00
J. Ryan Stinnett
2b5c56e6a8 Move match and cascade temporaries to CurrentElementInfo
Before this change, the `ComputedStyle` struct that is part of permanent style
data per element holds 2 `StrongRuleNode`s (unvisited and visited) and 2
`Arc<ComputedValues>` (unvisited and visited).

Both rule nodes and the visited values don't actually need to be here.  This
patch moves these 3 to new temporary storage in `CascadeInputs` on
`CurrentElementInfo` during the match and cascade process.  Rule nodes are
pushed down inside the `ComputedValues` for later access after the cascade.
(Visited values were already available there.)

The permanent style data per element now has just the `Arc<ComputedValues>` for
itself and eager pseudo-elements (plus the `RestyleHint`).

MozReview-Commit-ID: 3wq52ERMpdi
2017-06-22 15:47:32 -05:00
Emilio Cobos Álvarez
1b2fd3fe85
style: Be more strict when setting the root font size.
Before this commit, we assumed that if the element had no parent element, it was
the root of the document, which is plain false, since we can arrive there from,
let's say, getComputedStyle on a detached node.

Bug: 1374062
Reviewed-By: heycam
MozReview-Commit-ID: 65DxdzXgd0J
2017-06-21 13:28:57 +02:00
Brian Birtles
8f3dad598f Use AnimatableLonghand for AnimationValueMap and related code
In the next few patches we move all non-transition related code over to
using AnimatableLonghand instead of TransitionProperty. This will allow
us to re-purpose TransitionProperty to represent only properties that
can be transitioned (i.e. excluding discrete properties) as well as
simplifying the code by removing the need to deal with shorthands and
the "all" value in places that do not need to handle those values.
2017-06-15 10:18:18 +09:00
Nicolas Silva
8617320500 Bump euclid to 0.14. 2017-06-14 16:00:59 +02:00
Anthony Ramine
874885e235 Use generics for transition-timing-function 📈 2017-06-05 16:49:55 +02:00
Emilio Cobos Álvarez
58fd80e282
style: Split stylesheets.rs
This file has become quite bloated lately. This commit deletes that file in
favor of a set of submodules.

The only noticeable change apart from code move, is converting deep_clone_foo
methods into a trait.

It also unifies logic related to different style rules in the same place.

There's some missing work, specially related to font-face and counter-style, but
I think this is worth landing in the meantime.
2017-06-04 21:50:09 +02:00
Cameron McCormack
c768169149 style: Add support for disabled document colors. 2017-05-30 16:25:08 +08:00
J. Ryan Stinnett
a7882cfeb9 Match and cascade visited styles
To support visited styles, we match and cascade a separate set of styles any
time we notice that an element has a relevant link.

The visited rules and values are held in `ComputedStyle` alongside the
regular rules and values, which simplifies supporting various APIs like
`cascade_primary_and_pseudos` which expect easy access to previously matched
rules.

To simplify passing the additional values around, an additional reference to the
visited `ComputedValues` is placed inside the regular `ComputedValues`.

MozReview-Commit-ID: 2ebbjcfkfWf
2017-05-24 18:07:44 -05:00
heyzoos
4196156bb9 Change device and rule_set references to accessors 2017-05-18 22:18:16 -05:00
Josh Matthews
dabebdfbf5 Root nodes for the duration of their CSS transitions.
This ensures that we can pass a node address as part of the asynchronous
transition end notification, making it safe to fire the corresponding
DOM event on the node from the script thread. Without explicitly rooting
this node when the transition starts, we risk the node being GCed before
the transition is complete.
2017-05-15 14:07:41 -04:00
Emilio Cobos Álvarez
ebd9bf8181
style: Slim down SharedStyleContext.
This slims down SharedStyleContext, in preparation for a few things.

First, I would like to eventually move the stylist to the document in Servo, in
order for it to hold the StyleSheetSet.

Also, this gets rid of a fair amount of overhead while creating it in stylo.

Fixes bug 1363245.
2017-05-11 21:05:41 +02:00
Bobby Holley
d78ca4c4f9 Use StyleArc in the style system.
MozReview-Commit-ID: flF0fv9E9M
2017-05-02 17:35:44 -07:00
bors-servo
93a513c06f Auto merge of #16640 - hiikezoe:timing-function, r=xidorn
Use FunctionKeyword for computed_value of timing function

<!-- Please describe your changes on the following line: -->
https://bugzilla.mozilla.org/show_bug.cgi?id=1358330

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

<!-- Either: -->
- [X] These changes do not require tests because mozilla-central has test cases.  There might be some test cases in servo tree.

<!-- 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/16640)
<!-- Reviewable:end -->
2017-04-28 22:49:26 -05:00