Commit graph

237 commits

Author SHA1 Message Date
Alexandrov Sergey
512764b7da force style calculation/element construction for non-incremental mode 2016-08-23 01:45:18 +03:00
Ms2ger
4ede9f679a Remove unused imports; handle IO failure in append_serialization. 2016-08-18 18:05:36 +02:00
Emilio Cobos Álvarez
173ec260e6
Tidy up, make the cache a bit more performant.
Haven't measured a lot, will do tomorrow, but I want a test run.
2016-08-17 14:16:20 -07:00
Emilio Cobos Álvarez
3af774bd75
Rewrite the style sharing candidate cache.
The style candidate cache had regressed a few times (see #12534), and my
intuition is that being able to disable all style sharing with a single rule in
the page is really unfortunate.

This commit redesigns the style sharing cache in order to be a optimistic cache,
but then reject candidates if they match different sibling-affecting selectors
in the page, for example.

So far the numbers have improved, but not so much as I'd wanted (~10%/20% of
non-incremental restyling time in general). The current implementation is really
dumb though (we recompute and re-match a lot of stuff), so we should be able to
optimise it quite a bit.

I have different ideas for improving it (that may or may not work), apart of the
low-hanging fruit like don't re-matching candidates all the time but I have to
measure the real impact.

Also, I need to verify it against try.
2016-08-17 14:16:16 -07:00
Emilio Cobos Álvarez
fc12841cd3
style: Remove the block that explicitly checked for the style attribute, since now it's useless. 2016-08-16 10:58:17 -07:00
Emilio Cobos Álvarez
6b60383f24
layout: Ensure a element's style is up to date when processing queries. 2016-08-10 18:26:23 -07:00
Emilio Cobos Álvarez
544a117911
style: Force to stop computing children if we find the parent has display: none. 2016-08-10 18:26:21 -07:00
Emilio Cobos Álvarez
436c1b3089
stylo: Allow bypassing the bottom-up traversal. 2016-08-10 18:26:20 -07:00
Simon Sapin
f419db834c Replace the SelectorImplExt trait with inherent methods. 2016-08-09 18:17:13 +02:00
Emilio Cobos Álvarez
1470d5b174
stylo: Allow computing change hints during the traversal. 2016-08-03 13:31:11 -07:00
bors-servo
27d8fb3807 Auto merge of #12623 - notriddle:master, r=emilio
Complete animations whether or not cascade needs done

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #12554 (github issue number if applicable).
- [x] There are tests for these changes

<!-- 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/12623)
<!-- Reviewable:end -->
2016-07-28 14:54:36 -05:00
Michael Howell
6a37877734 Complete animations whether or not cascade is done
Fixes #12554
2016-07-28 11:22:20 -07:00
Emilio Cobos Álvarez
c3a727ebda
style: Remove a few more unuseful traversals now we can. 2016-07-27 11:14:45 -07:00
Emilio Cobos Álvarez
d81fe27b11
style: Avoid propagating the restyle flag all through the dom when a node gets dirty.
This puts us in pair with stylo.
2016-07-25 10:50:04 -07:00
Emilio Cobos Álvarez
96ea1a335c
stylo: don't double check that the root node is dirty in restyle_tree, since now we ensure it in the caller. 2016-07-24 12:51:58 -07:00
Emilio Cobos Álvarez
a3020419d9
stylo: Don't traverse the whole dom every restyle, propagate the dirty flag down the DOM.
This commit adds hooks to the Servo style traversal to avoid traversing all the
DOM for every restyle. Additionally it changes the behavior of the dirty flag to
be propagated top down, to prevent extra overhead when an element is dirtied.

This commit doesn't aim to change the behavior on Servo just yet, since Servo
might rely on a full bottom up reconstruction of the flows. I'll need to double
check and implement that separately.
2016-07-24 12:51:58 -07:00
Simon Sapin
5c70dfab01 Have a concrete SelectorImpl type everywhere in the style crate.
It is conditionally compiled to one implementation or the other
(Gecko or Servo) with `#[cfg(…)]`.
2016-07-20 08:42:46 +02:00
Simon Sapin
789807b7b0 Remove the ComputedValue traits and style_struct_traits 2016-07-20 08:42:40 +02:00
Shing Lyu
f754cacbd5 Only restyle viewport-relative nodes on viewport size change 2016-07-18 11:01:42 +08:00
Anthony Ramine
744b94346a Move util::tid to style 2016-07-05 10:36:38 +02:00
Emilio Cobos Álvarez
203d2a62c2
style: Remove the Mutex from new_animations_sender by moving it to the local StyleContext.
As a follow-up, we could move all the data living under a mutex in the
SharedLayoutContext only in order to create the local context to the same place.

This should increase animation performance when there are multiple animations in
one page that happen to be on different threads.
2016-07-01 13:48:06 -07:00
Emilio Cobos Álvarez
60192bb830
style: Refactor to pass animations cleanly, land animation-name parsing as experimental 2016-06-28 15:09:53 +00:00
Ms2ger
79e0d18a1d Add some documentation to the style crate. 2016-06-27 17:33:14 +02:00
Ms2ger
4381107c21 Make the STYLE_BLOOM global private. 2016-06-23 13:52:26 +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
Ms2ger
ae5cb0ceb0 Move the TNode::initialize_data() call from recalc_style_at to its callers.
This will allow us to make it an inherent method.
2016-06-13 15:11:21 +01:00
Cameron McCormack
2c9cfae830 Look past restyle root for parent node when restyling.
Currently when traversing a the tree to restyle, we look at whether a
given element to restyle is the root.  This seems to always be the root
of the entire document, since we start our processing from the top.  If
the current element being restyled is the root of the restyle, then we
use None as the parent node for restyling purposes.

In stylo we want to invoke restyling starting from an arbitrary node in
the document, not just the root of the document, so this change looks
for the parent element regardless of whether we're at the root of the
restyle.
2016-05-25 11:52:42 +10:00
Emilio Cobos Álvarez
2a499d5a0b
layout: Stop storing PrecomputedStyleData in LayoutNode
Use the SharedStyleContext instead.
2016-04-29 22:54:48 +02:00
Emilio Cobos Álvarez
b6402a81d0
style: Add infrastructure for non-eagerly-cascaded pseudo-elements
This commit also removes StylistWrapper and uses Arc::get_mut instead.
2016-04-29 22:54:45 +02:00
Bobby Holley
c2daea2c9c Parameterize the rest of the style system on TNode. 2016-03-24 11:50:57 -07:00
Bobby Holley
b1878bd925 Remove lifetimes from T{Node,Element,Document}. 2016-03-14 14:31:57 -07:00
Emilio Cobos Álvarez
dd503dfacb Refactor style to be completely backend-independent
This commit refactors the style crate to be completely independent of
the actual implementation and pseudo-elements supported.

This also adds a gecko backend which introduces parsing for the
anonymous box pseudo-elements[1], although there's still no way of
querying them.

https://mxr.mozilla.org/mozilla-central/source/layout/style/nsCSSAnonBoxList.h
2016-02-13 16:05:14 +01:00
Bobby Holley
cafc0aabdf Hoist style-only traversal into geckolib.
Implementing StandaloneStyleContext::new is going to require a TLS key (just
like LayoutContext::new), and we don't want that key in shared code.
2016-02-03 18:39:16 -08:00
Bobby Holley
84f24a04a4 Basic wrappers and glue for GeckoLib. 2016-01-13 12:14:00 -08:00
rohan.prinja
1f02c4ebbb task -> thread 2016-01-10 17:58:13 +09:00
Bobby Holley
3b33174163 Review nits: Narrowly scoping unsafety, and expanding comment. 2016-01-07 11:17:31 -08:00
Bobby Holley
f9a02f0aba Hoist the style parts of traversal.rs into style/. 2016-01-06 18:50:16 -08:00