Commit graph

218 commits

Author SHA1 Message Date
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
Emilio Cobos Álvarez
bd10081919
style: Move comment to a closer location. 2017-07-14 09:24:38 +02:00
Emilio Cobos Álvarez
62310d9bd5
style: Don't use the current element info for cached validation data.
We can take it straight from the validation target.
2017-07-13 15:36:59 +02:00
Emilio Cobos Álvarez
36310e3b66
style: Kill some style sharing code.
MozReview-Commit-ID: 42MyHx3QHuu
2017-07-13 15:32:20 +02:00
Emilio Cobos Álvarez
d3c8844549
style: Remove unnecessary TraversalFlags::FOR_DEFAULT_STYLES.
Yay

MozReview-Commit-ID: JiWTEz63AlE
2017-07-12 09:26:41 +02:00
Emilio Cobos Álvarez
c6d5dbbb01
style: Rewrite restyling to split between resolving styles and handling changes.
MozReview-Commit-ID: 4BzjbLbFebF
2017-07-12 09:26:36 +02:00
Emilio Cobos Álvarez
0ad2d39c30
style: Rewrite get*Style using StyleResolverForElement.
Removing the ugly.

MozReview-Commit-ID: BvahbMKS7QU
2017-07-12 09:26:31 +02:00
Bobby Holley
3330653dc8 Rip out the generic abstractions around ThreadLocalStyleContext.
MozReview-Commit-ID: 5WTLuk323Ac
2017-07-05 16:37:17 -07:00
Emilio Cobos Álvarez
5a481547b8
style: Cleanup traversal.rs
Mostly reflowing comments that have become too long or two short with
refactorings, and using consistent indentation.
2017-06-26 22:48:17 +02: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
Hiroyuki Ikezoe
a3da636f69 Don't traverse any elements that needed only for animation-only restyles in normal traversal.
Before this patch, we were setting the dirty descendants bit in animation-only
restyles and it triggered unnecessary traversal for elements that does not need
the traversal (i.e no need selector matching).
2017-06-19 15:01:17 +09:00
Hiroyuki Ikezoe
5a8e2562d5 Check the child is unstyled without creating element data in preprocess_children.
If we check it and skip the child after ensure_element_data() call,
the child will have an empty element data, so we will succeed
element_data.is_some() check unexpectedly.
2017-06-19 14:56:27 +09:00
Hiroyuki Ikezoe
028c0e4a43 Don't traverse elements that have no style data in animation-only restyle.
Animation-only restyle only works with elements that have already been styled.
2017-06-19 14:55:58 +09:00
Emilio Cobos Álvarez
ffc45e9aaa
style: Inline RestyleData.
Bug: 1368236
MozReview-Commit-ID: 49s3SO0PMHf
2017-06-16 03:36:18 +02:00
Emilio Cobos Álvarez
dc521b2799
style: Remove damage_handled, and use a reconstructed_ancestor bit instead.
Reviewed-By: bholley
Bug: 1368236
MozReview-Commit-ID: 8KK0YfhiS2
2017-06-14 13:15:00 +02:00
Emilio Cobos Álvarez
f9c268922d
style: Kill StoredRestyleHint.
Reviewed-By: bholley
Bug: 1368236
MozReview-Commit-ID: 43Cf0rJyhzO
2017-06-14 13:11:10 +02:00
Hiroyuki Ikezoe
8d519011d8 Don't process RestyleKind::MatchAndCascade during animation-only restyle. 2017-06-14 10:51:53 +09: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
Cameron McCormack
c533097e20 style: Distinguish between the tree structures used for traversal and selector matching.
This patch renames TNode::parent_element to traversal_parent, since it returns
the parent from the perspective of traversal (which in Gecko uses the
flattened tree).  It also renames TNode::children to traversal_children
for the saem reason.

We keep parent_element and children functions on TNode to use for selector
matching, which must be done on the real DOM tree structure.
2017-06-09 18:37:35 +08:00
Cameron McCormack
a1093ea868 style: always re-cascade in native anonymous subtrees 2017-06-07 13:22:00 +08:00
Boris Zbarsky
98f95a32da Fix the handling of the Bloom filter in the style sharing cache. 2017-06-05 12:51:51 -04:00
Cameron McCormack
19b61dfc08 style: Recascade the document when rem units are used and the root font-size changes. 2017-06-04 10:03:11 +08:00
bors-servo
38a6a3bff6 Auto merge of #17063 - emilio:pres-hints-sharing, r=bholley
style: Allow sharing styles across elements with presentational hints.

<!-- 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/17063)
<!-- Reviewable:end -->
2017-05-30 07:28:06 -05:00
Cameron McCormack
d0d43707fb style: Support a restyle hint that indicates all descendants must be recascaded.
This also moves the result of deciding whether to recascade from the
RestyleData into the RestyleHint.
2017-05-30 09:14:23 +08: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
Cameron McCormack
cc44f05f44 style: Add support for resolving default computed styles. 2017-05-25 14:19:59 +08:00
Hiroyuki Ikezoe
a921d1af22 Make replace_rules returning boolean.
We only use whether the return value is IMPORTANT_RULES_CHANGED or not, so we
can just return true if an important rules was changed in the function.
Also, we can just return false in case of animation rules changes sine for
animation we can ensure there is no importan rules.
Because of these changes, replace_rule_node does not borrow |result| so that
we can drop a scope there.
2017-05-24 14:00:17 +09:00
Emilio Cobos Álvarez
d5f8b91d91
style: Remove unneeded indirection in traversal code. 2017-05-21 16:47:22 +02:00
Hiroyuki Ikezoe
dd29fc1f68 Add a new TraversalRestyleBehavior that represents the traversal is triggered by CSS rule changes.
And propagate the new flag to servo if mRestyleForCSSRuleChanges is set.
2017-05-21 15:18:15 +09: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