Commit graph

197 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
891bc7d174
style: Massage the resolver code so it's cleaner and prevents the problem.
This way all the borrows stay in the sharing code, and prevents an extra borrow
on a cache hit, which is not a big deal but nice.
2017-09-18 04:57:50 +02:00
Bobby Holley
703a5c93d0 Undo #18497 in the MatchAndCascade case.
It's easy to construct examples where not inserting in those cases causes performance
to get worse (for example, any long list of siblings that match the same selectors
while having some non-effectual differences in LocalName/Class/Id/etc). And the LRU
nature of the cache already does the right thing of pruning non-useful entries.

Fixing this causes several hundred more sharing hits on wikipedia.

MozReview-Commit-ID: L7W8vcMnHaq
2017-09-15 23:21:00 -07:00
Emilio Cobos Álvarez
158aa0ffdf
style: Move the check into insert_if_possible. 2017-09-14 11:56:45 +02:00
Emilio Cobos Álvarez
2908c6a266
style: Don't cache styles that got a cache hit.
This avoids doing wasted work, at least in the recascade case, and pretty likely
in the other as well.
2017-09-14 10:00:00 +02:00
Bobby Holley
8e5c1c771e Share styles during recascades.
MozReview-Commit-ID: AFTwtzi4P93
2017-09-13 22:06:46 -07:00
Bobby Holley
7a7070e075 Add some wrapper types to propagate styles out of style resolver.
We'll use these next to propagate information about style reuse to the ElementDataFlags.

MozReview-Commit-ID: Dya6vgzydpL
2017-09-13 22:06:33 -07:00
Bobby Holley
9092e6b4c2 Return the element rather than styles from the style sharing cache.
This gives us more flexibility, and doesn't cost us anything.

MozReview-Commit-ID: CuvOEcLA3My
2017-09-13 22:06:24 -07:00
Bobby Holley
50cee3e133 Eliminate RestyleData entirely.
Without this change, the previous commit increases the size of ElementData.

MozReview-Commit-ID: 87BZuXINiT9
2017-09-12 10:33:51 -07:00
Bobby Holley
61cad869d9 Hoist flags out of RestyleData.
MozReview-Commit-ID: 8emE83lykh3
2017-09-12 10:22:50 -07:00
Bobby Holley
8268217767 Avoid memmoving ValidationData more than necessary.
MozReview-Commit-ID: 70w3bZ2FU0W
2017-09-11 22:39:35 -07:00
Bobby Holley
74b4f95d71 Encapsulate the sharing cache backend better.
MozReview-Commit-ID: 2x9BIhmwH83
2017-09-11 22:39:34 -07:00
Bobby Holley
db67cd1759 Shorten the naming around the style sharing cache.
MozReview-Commit-ID: EcVQDLoxwFP
2017-09-11 22:39:31 -07:00
Emilio Cobos Álvarez
825f623b3c
style: Stop the cascade when only reset structs change.
Bug: 1395227
Reviewed-by: heycam
MozReview-Commit-ID: JCZJl2fmtJ9
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-09-06 12:56:29 +02:00
Emilio Cobos Álvarez
10ba4ead25
style: Remove the for reconstruction traversals.
One less hack, a few more to go.

Bug: 1374235
Reviewed-by: bholley
MozReview-Commit-ID: 6katL1EGn2U
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-09-01 13:13:50 +02:00
Bobby Holley
994074fca6 Clean up bit clearing. 2017-08-26 10:22:03 -07:00
Emilio Cobos Álvarez
8c3cc9ba1f Hook the recursive invalidation traversal up to the stack checker machinery.
MozReview-Commit-ID: 3tX3gHFTBT
2017-08-25 18:39:20 -07:00
Bobby Holley
707ab455bb Eliminate the sequential/traversal parallel distinction in favor of a unified adaptive driver.
MozReview-Commit-ID: ADVTNJntzmp
2017-08-25 10:00:27 -07:00
Emilio Cobos Álvarez
ff700aba75
style: Only store applicable ::before / ::after pseudo styles during the traversal. 2017-08-25 08:46:22 +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
Bobby Holley
d4aa8e3cef Track the restyle root and use it to do less work during the traversal.
MozReview-Commit-ID: A8O3JOpsv4E
2017-08-22 19:34:46 -07:00
Emilio Cobos Álvarez
fcd6e79659
style: Inline a bunch of trivial stuff we're paying calls for in Geckolib. 2017-08-22 12:48:14 +02:00
Bobby Holley
653107d6c4 Avoid recursion in clear_descendant_data.
MozReview-Commit-ID: LeMhhcKoLr9
2017-08-15 23:24:17 -07:00
Bobby Holley
8a3761972d Bonus fix: Be more robust about clearing descendants bits under display:none subtrees.
MozReview-Commit-ID: 9KQVOpdEjwF
2017-08-15 14:25:50 -07:00
Bobby Holley
05a1b682bb Avoid leaving stale ANCESTOR_WAS_RECONSTRUCTED bits in the tree.
MozReview-Commit-ID: 76q5XxK2o2a
2017-08-15 14:25:50 -07:00
Bobby Holley
f4ccbf3687 Hoist StyleNew{Children,Subtree} into their own paths.
The buggy animation handling isn't a regression, since currently we pass
UnstyledChildrenOnly in those cases, which blocks the animation traversal
in Servo_TraverseSubtree.

In general I really wanted to handle these two paths together. But there's
enough broken with the NewChildren path that I wanted to scope the buginess
as tightly as possible. And I really need to separate the handling here from
StyleDocument() to make the restyle root stuff work.

MozReview-Commit-ID: 9F0mcQl7AAX
2017-08-11 10:53:08 -07:00
Bobby Holley
32790be78d Tidy up flags handling in recalc_style_at a bit.
MozReview-Commit-ID: 4BK0JfkgjdC
2017-08-11 10:53:03 -07:00
Bobby Holley
18ad382f00 Only clear the descendants bit for which we're traversing.
Doing anything else is non-sensical, since we're not guaranteed to reach all of
the bits from traversal Y when doing traversal X.

MozReview-Commit-ID: FQliRxBan70
2017-08-11 10:52:56 -07:00
Bobby Holley
49bdb5bb4e Be more careful about the flags we clear for forgetful traversals.
MozReview-Commit-ID: ETDL8KsInAn
2017-08-09 10:52:04 -07:00
Hiroyuki Ikezoe
bdf84510f8 Don't clear animation only dirty bit during style recalc (unless the element is in a display:none subtree).
After bug 1356141, the setup of animation-only dirty bit should have matched
to normal dirty bit's one (Though they don't match in post traversal due to
throttled animation flush). An unset_animation_only_dirty_descendants call
removed in this patch cleared dirty bits which are needed for post traversal if
there is a second animation-only traversal and if there is no need to restyle
for the second animation-only traversal.

The reftest in this patch fails without either this fix or the fix for bug
1367975.

See [Gecko bug 1384435 comment 12](https://bugzilla.mozilla.org/show_bug.cgi?id=1384435#c12)
for more detail what's going on at that time.
2017-08-08 10:01:47 +09:00
Bobby Holley
54c52910e4 Introduce a new flag and use it to be more permissive about cousin sharing.
MozReview-Commit-ID: BCJg0Ycsy6M
2017-08-05 01:07:02 -07:00
bors-servo
ac37f81c1f Auto merge of #17972 - heycam:ignore-existing, r=bholley
style: Allow styles to be computed ignoring existing element data.

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

<!-- 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/17972)
<!-- Reviewable:end -->
2017-08-04 21:33:59 -05:00
Cameron McCormack
bb44c0a6bc style: Allow styles to be computed ignoring existing element data. 2017-08-05 10:33:31 +08:00
Alan Jeffrey
936dd3ef63 Speculatively evaluate paint functions during style. 2017-07-31 13:02:28 -05:00
Bobby Holley
6148db670b Break TraversalFlags::ForReconstruct down into several independent pieces.
These will be useful in followup work.

MozReview-Commit-ID: Dyp9R0PG36v
2017-07-27 14:26:21 -07:00
Bobby Holley
5c6d3b820e Stop unconditionally traversing every element in the subtree on reconstruct traversals.
We already have a more-specific check further down in the file, which was added in the same revision.
I think this one was erroneous.

MozReview-Commit-ID: CnP0zCpBtnp
2017-07-27 14:26:15 -07:00
Bobby Holley
ce295f6daf Pass TraversalFlags from C++ into Rust.
MozReview-Commit-ID: EVUzgnL5coN
2017-07-27 14:25:58 -07:00
Emilio Cobos Álvarez
6e3397b907
style: Remove outdated comments. 2017-07-24 10:07:39 +02:00
Emilio Cobos Álvarez
9d21f9e6ce
style: Remove (mostly) unused has_current_styles.
MozReview-Commit-ID: DV9HfvbUjBY
2017-07-24 10:05:37 +02:00
Emilio Cobos Álvarez
cb4feee34d
style: Unify needs_traversal logic. 2017-07-19 12:58:41 +02:00
Emilio Cobos Álvarez
f8575d97de
style: Remove useless traversal checks.
The callee checks this.
2017-07-19 10:29:11 +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
Hiroyuki Ikezoe
9c05481923 Skip snapshot handling during animation-only restyle. 2017-07-18 19:14:25 +09:00
Hiroyuki Ikezoe
f91126ba86 Add has_current_styles_for_traversal().
In animation-only restyle, we just need to check the element
has animation restyle hints or has recascade self which is a result
of animation-only restyle for ancestors.
has_current_styles() in Servo_ResolveStyle() is intentionally left there,
it will be changed in a subsequent patch.
2017-07-18 19:13:50 +09:00
Manish Goregaokar
89930e7565 stylo: Switch Gecko over to ServoStyleContext 2017-07-17 18:03:23 -07:00
Manish Goregaokar
808b1f509b stylo: Use ComputedValuesInner instead of ComputedValues when we don't need it 2017-07-17 18:02:25 -07:00
Emilio Cobos Álvarez
1316f3640b
style: Fix a typo that makes us resolve styles for the whole spin to the root.
For undisplayed elements, at least.
2017-07-16 16:32:50 +02:00
Bobby Holley
b7de96e702 Pass a callback to recalc_style_at to avoid traversing children twice.
MozReview-Commit-ID: DIHXaVNzbFM
2017-07-15 14:45:51 -07:00
Bobby Holley
e534ec9e47 Move clearing of dirty descendants bit closer to the last place it's needed.
In the next patch, we'll move logic to identify the children for traversal into
preprocess_children (which will be renamed), and the set_dirty_descendants logic
will move along with it. So left as-is, the code here will clobber the flags.

MozReview-Commit-ID: 7ZskKWD4QC3
2017-07-15 14:27:18 -07:00
Emilio Cobos Álvarez
3faba0cfff
style: Remove some no longer needed type arguments. 2017-07-15 19:02:19 +02:00
Emilio Cobos Álvarez
bf9369b29d
script: Move the layout_wrapper outside of script.
This allows us to have ensure_data() and clear_data() functions on the TElement
trait, instead of hacking around it adding methods in random traits.

This also allows us to do some further cleanup, which I'd rather do in a
followup.
2017-07-15 16:41:12 +02:00