Commit graph

124 commits

Author SHA1 Message Date
Simon Sapin
a5bb55790f Untry style 2017-06-18 13:18:13 +02:00
Emilio Cobos Álvarez
cb06375fe2
style: Implement a more fine-grained invalidation method.
This commit also removes the old restyle_hints module and splits it into
multiple modules under components/style/invalidation/element/.

The basic approach is to walk down the tree using compound selectors as needed,
in order to do as little selector-matching as possible.

Bug: 1368240
MozReview-Commit-ID: 2YO8fKFygZI
2017-06-13 13:26:41 +02:00
Nazım Can Altınova
15fe48f3f6
stylo: Support :hover and :active quirk 2017-06-10 22:18:32 +03:00
Kenan Rhoton
8aeb512670 Adapt LRUCache to use ArrayDeque crate instead of VecDeque 2017-06-03 20:59:01 +02:00
Bobby Holley
f40c45fe1a Reduce the number of places where we need to enumerate ValidationData members.
MozReview-Commit-ID: 9m2ebknBFSE
2017-05-31 06:48:33 -07:00
Emilio Cobos Álvarez
7db2776348
s/CachedStyleSharingData/ValidationData.
I still think CachedStyleSharingData should be the name, but not going to fight
over it.
2017-05-30 11:23:59 +02:00
Emilio Cobos Álvarez
0adc02a317
style: Avoid some cfg checks in context.rs 2017-05-29 23:24:06 +02:00
Emilio Cobos Álvarez
03952a0c27
style: Also cache the class list in the CurrentElementInfo.
This patch also removes all notion of style sharing from matching.rs, which is
nice.
2017-05-29 22:54:17 +02:00
Emilio Cobos Álvarez
fb6339bbf9
style: rewrap some comments to 80 columns for consistency with the rest of the code. 2017-05-29 21:39:41 +02:00
bors-servo
1306b16d5a Auto merge of #16968 - HeyZoos:stylist-accessors, r=emilio
Stylist accessors

<!-- Please describe your changes on the following line: -->
Add accessor methods for the `device` and `ruleset` fields in the `Stylist` struct.

---
<!-- 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 #16857 (github issue number if applicable).
<!-- Either: -->
- [X] There are tests for these changes

<!-- 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/16968)
<!-- Reviewable:end -->
2017-05-22 20:12:46 -05:00
Emilio Cobos Álvarez
311c403522
style: Move all the style sharing code outside matching.rs
This is just a code health change. I want to move it away to keep matching.rs as
simple as possible.
2017-05-21 02:30:51 +02:00
heyzoos
4196156bb9 Change device and rule_set references to accessors 2017-05-18 22:18:16 -05: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
Emilio Cobos Álvarez
46bf5d61f0
Bug 1355343: Take all the snapshots into account. r=bholley
I've chosen this approach mainly because there's no other good way to guarantee
the model is correct than holding the snapshots alive until a style refresh.

What I tried before this (storing them in a sort of "immutable element data") is
a pain, since we call into style from the frame constructor and other content
notifications, which makes keeping track of which snapshots should be cleared an
which shouldn't an insane task.

Ideally we'd have a single entry-point for style, but that's not the case right
now, and changing that requires pretty non-trivial changes to the frame
constructor.

MozReview-Commit-ID: FF1KWZv2iBM
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-05-10 12:05:39 +02:00
Bobby Holley
552bff8fd1 Re-enable the style sharing cache.
MozReview-Commit-ID: C39vdHjPM7J
2017-05-05 10:48:30 -07:00
Bobby Holley
d78ca4c4f9 Use StyleArc in the style system.
MozReview-Commit-ID: flF0fv9E9M
2017-05-02 17:35:44 -07:00
Emilio Cobos Álvarez
be0139ff3c
Bug 1331047: Implement the new traversal semantics for stylo. r=bholley,hiro
MozReview-Commit-ID: 4BXx9JpGZKX
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-04-27 14:26:48 +02:00
Bobby Holley
d7e121961f Disable the style sharing cache on opt builds to avoid regressing Talos by matching too many revalidation selectors.
MozReview-Commit-ID: 10qSho1gXjw
2017-04-23 12:43:17 -07:00
Boris Chiou
eb8db7b892 Bug 1341372 - Part 6: Trigger transitions.
1. We need to call get_after_change_style, which is the computed styles
   without transition rules, while process_animations.
2. If we have after-change style, we may replace the new computed values with
   after-change style, according to whether we really need to update
   transitions.
3. There are some cases we don't update transitions, so we need to early
   return. might_needs_transitions_update() will check it first and it
   will filter out most common cases.
4. needs_transitions_update() will check each property and existing running
   transitions to make sure we really don't need to update transitions.
   The logic of this function is similar with that of
   nsTransitionManager::DoUpdateTransitions().

MozReview-Commit-ID: 2ccdPjgrxKz
2017-04-17 17:08:54 +08:00
Bobby Holley
297dc33a9f Store slow selector flags in a hashmap.
This reduces the flag setting overhead on a pessimal testcase from over a
second to ~20ms.
2017-04-13 21:52:47 +08:00
Bobby Holley
687ea0ef9e Add more useful statistics to DUMP_STYLE_STATISTICS. 2017-04-13 13:43:05 +08:00
Bobby Holley
591733408d Limit traversal statistics dumps to subtrees of 50 or more elements.
On Gecko, we get tons of console spam from 1-element traversals if we
don't do this.
2017-04-13 13:41:52 +08:00
Bobby Holley
dc5dbd5542 Store style system options in the global style data and shared style context.
I wanted to add an environmental variable to disable the style sharing
cache for gecko, but the current pattern involves lazy_static!, which
involves an atomic operation on lookup, which is a bit hot to do each
time we try to share styles. This makes that work happen once per
process.
2017-04-12 14:34:42 +08:00
Bobby Holley
1663bf6e5d Cache the results of cache entry revalidation and use the bloom filter. 2017-04-12 10:35:42 +08:00
Manish Goregaokar
e402c72d0e stylo: Store font metrics provider in thread local style context 2017-04-09 19:15:35 +08:00
Cameron McCormack
2bbeb21551 style: Move TraversalFlags into SharedStyleContext. 2017-04-08 23:07:35 +08:00
Xidorn Quan
c857878ce9 Remove servo_config dependency for geckolib 2017-04-07 17:20:42 +10:00
Bobby Holley
788d9ad0aa Hoist possibly_expired_animations into CurrentElementInfo.
The current mechanism requires threading a lot of this state through a bunch of
callsites that are several layers of abstraction above the code that actually
uses this vector (which is only compiled for servo). Putting it in
CurrentElementInfo gets it nicely out of the way.

MozReview-Commit-ID: 9PLBKcJreN0
2017-04-06 17:51:59 -07:00
Hiroyuki Ikezoe
4183b0dff2 Introduce UpdateAnimationTasks to perform a bunch of animation's tasks in a SequentialTask.
The UpdateAnimationsTasks is a bitflags and each bit is generated from
Gecko's UpdateAnimationsTasks (enum class) values for matching values
between C++ and Rust. For this reason, the bitflags is annotated as
(feature = "gecko"), as a result update_animations() which uses this bitflags
also became gecko-only function.
2017-03-27 17:38:09 +09:00
Hiroyuki Ikezoe
be332fe5a4 Add flag that represents the traversal is only for animation-only restyle.
We will set the flag when the root node of the traversal has
has-animation-only-dirty-descendants flag or has animation restyle hints.
Also we will use this flag to detect whether we need to trigger CSS transitions
or not.
2017-03-27 06:19:51 +09:00
Simon Sapin
d5074136e3 Rename ReadGuards to StylesheetGuards 2017-03-19 22:30:42 +01:00
Simon Sapin
aeffca2a59 Replace RwLock<StyleRule> with Locked<StyleRule> 2017-03-19 22:30:37 +01:00
Emilio Cobos Álvarez
b4de69e3eb
style: Avoid cloning all over the error reporter. 2017-03-14 00:49:18 +01:00
Emilio Cobos Álvarez
eaf27ccfa0
style: Kill SharedStyleContext::default_computed_values.
Now that cascade() gets a Device, we can use the default computed values from
there to avoid propagating that state all over the place.

Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-03-14 00:49:16 +01:00
bors-servo
06f99c13f2 Auto merge of #15913 - emilio:viewport-size, r=heycam,hiro
Use the proper viewport size for stylo

Reviewed upstream at [bug 1303229](https://bugzil.la/1303229).

<!-- 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/15913)
<!-- Reviewable:end -->
2017-03-11 04:40:31 -08:00
Emilio Cobos Álvarez
95ccfa748e
Bug 1303229: Get the proper viewport size for stylo. r=heycam
At least until we support scrollbars properly, this size is going to be the
correct one. I've left a TODO to grab the proper one once we support it.

This allows to trivially test viewport units for now.

MozReview-Commit-ID: JdaZ6WlZ2C6
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-03-11 11:54:12 +01:00
Emilio Cobos Álvarez
58c6aad1f0
style: Add the traversal kind to the style stats. 2017-03-11 11:31:11 +01:00
Hiroyuki Ikezoe
9ff99d4608 Update CSS animations in a SequentialTask.
We create the SequentialTask only if:

* We have no old computed values and we have animation name style in the new
  computed values.
* Any animation properties is changed.
* display property is changed from 'none' and we have animation name style.
* display property is changed to 'none'.

In a subsequent patch we skip the SequentialTask if we have no running
animations and the display propery is changed to 'none'.
2017-03-10 11:36:58 +09:00
Emilio Cobos Álvarez
71997e6ed9
style: Remove unused goal field from SharedStyleContext. 2017-03-03 03:46:10 +01:00
Emilio Cobos Álvarez
b4daadf7f2
style: Remove unused screen_size_changed layout context field. 2017-03-03 01:01:44 +01:00
Bobby Holley
d7d6979144 Dump traversal time with other style statistics. 2017-02-14 17:17:45 -08:00
Bobby Holley
9e860df9df Bug 1336646 - Apply selector flags during traversal. r=emilio 2017-02-08 19:21:05 -08:00
Bobby Holley
37b8d5231d Bug 1336646 - Move opts check for statistics into should_dump. r=emilio
This makes things more consistent between the parallel and sequential traversal drivers.
2017-02-08 17:09:41 -08:00
Bobby Holley
5370224877 Bug 1331856 - Add style performance statistics to Servo. r=emilio
MozReview-Commit-ID: ECHZgYNA8nb
2017-01-19 15:05:19 -08:00
Bobby Holley
3fcfc9c5fc Bug 1325734 - Simplify ElementData and eliminate the concept of consuming styles. r=emilio 2017-01-09 11:51:37 -08:00
Bobby Holley
4558efbca5 Bug 1325734 - Explicitly track whether we're performing the initial style. r=emilio 2017-01-09 11:51:37 -08:00
Boris Zbarsky
56941d61a7 Bug 1298588 part 5. Store a ComputedValues on SharedStyleContext. r=bholley 2017-01-04 23:13:40 -05:00
Emilio Cobos Álvarez
c7bcbad3b9
style: Document the StyleContext module. 2017-01-02 12:57:53 +01:00
Bobby Holley
940cda1d15 Remove generation, remove filter pop, and add size tests. 2016-12-22 11:09:55 -08:00
Bobby Holley
b3cb786c81 Stop using UnsafeNode in the bloom filter. 2016-12-22 10:42:53 -08:00