aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/traversal.rs
Commit message (Collapse)AuthorAgeFilesLines
...
* Move clearing of dirty descendants bit closer to the last place it's needed.Bobby Holley2017-07-151-4/+3
| | | | | | | | 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
* style: Remove some no longer needed type arguments.Emilio Cobos Álvarez2017-07-151-7/+4
|
* script: Move the layout_wrapper outside of script.Emilio Cobos Álvarez2017-07-151-25/+5
| | | | | | | | 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.
* style: Move comment to a closer location.Emilio Cobos Álvarez2017-07-141-3/+3
|
* style: Don't use the current element info for cached validation data.Emilio Cobos Álvarez2017-07-131-19/+3
| | | | We can take it straight from the validation target.
* style: Kill some style sharing code.Emilio Cobos Álvarez2017-07-131-39/+43
| | | | MozReview-Commit-ID: 42MyHx3QHuu
* style: Remove unnecessary TraversalFlags::FOR_DEFAULT_STYLES.Emilio Cobos Álvarez2017-07-121-8/+0
| | | | | | Yay MozReview-Commit-ID: JiWTEz63AlE
* style: Rewrite restyling to split between resolving styles and handling changes.Emilio Cobos Álvarez2017-07-121-21/+50
| | | | MozReview-Commit-ID: 4BzjbLbFebF
* style: Rewrite get*Style using StyleResolverForElement.Emilio Cobos Álvarez2017-07-121-129/+67
| | | | | | Removing the ugly. MozReview-Commit-ID: BvahbMKS7QU
* Rip out the generic abstractions around ThreadLocalStyleContext.Bobby Holley2017-07-051-22/+13
| | | | MozReview-Commit-ID: 5WTLuk323Ac
* style: Cleanup traversal.rsEmilio Cobos Álvarez2017-06-261-142/+189
| | | | | Mostly reflowing comments that have become too long or two short with refactorings, and using consistent indentation.
* Move match and cascade temporaries to CurrentElementInfoJ. Ryan Stinnett2017-06-221-13/+21
| | | | | | | | | | | | | | | | | 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
* Don't traverse any elements that needed only for animation-only restyles in ↵Hiroyuki Ikezoe2017-06-191-1/+5
| | | | | | | | 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).
* Check the child is unstyled without creating element data in ↵Hiroyuki Ikezoe2017-06-191-4/+4
| | | | | | | | 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.
* Don't traverse elements that have no style data in animation-only restyle.Hiroyuki Ikezoe2017-06-191-4/+11
| | | | Animation-only restyle only works with elements that have already been styled.
* style: Inline RestyleData.Emilio Cobos Álvarez2017-06-161-54/+40
| | | | | Bug: 1368236 MozReview-Commit-ID: 49s3SO0PMHf
* style: Remove damage_handled, and use a reconstructed_ancestor bit instead.Emilio Cobos Álvarez2017-06-141-21/+22
| | | | | | Reviewed-By: bholley Bug: 1368236 MozReview-Commit-ID: 8KK0YfhiS2
* style: Kill StoredRestyleHint.Emilio Cobos Álvarez2017-06-141-3/+3
| | | | | | Reviewed-By: bholley Bug: 1368236 MozReview-Commit-ID: 43Cf0rJyhzO
* Don't process RestyleKind::MatchAndCascade during animation-only restyle.Hiroyuki Ikezoe2017-06-141-1/+6
|
* style: Implement a more fine-grained invalidation method.Emilio Cobos Álvarez2017-06-131-52/+27
| | | | | | | | | | | 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
* style: Distinguish between the tree structures used for traversal and ↵Cameron McCormack2017-06-091-9/+9
| | | | | | | | | | | | 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.
* style: always re-cascade in native anonymous subtreesCameron McCormack2017-06-071-0/+6
|
* Fix the handling of the Bloom filter in the style sharing cache.Boris Zbarsky2017-06-051-13/+12
|
* style: Recascade the document when rem units are used and the root font-size ↵Cameron McCormack2017-06-041-11/+13
| | | | changes.
* Auto merge of #17063 - emilio:pres-hints-sharing, r=bholleybors-servo2017-05-301-4/+4
|\ | | | | | | | | | | | | | | 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 -->
| * style: Also cache the class list in the CurrentElementInfo.Emilio Cobos Álvarez2017-05-291-4/+4
| | | | | | | | | | This patch also removes all notion of style sharing from matching.rs, which is nice.
* | style: Support a restyle hint that indicates all descendants must be recascaded.Cameron McCormack2017-05-301-24/+16
|/ | | | | This also moves the result of deciding whether to recascade from the RestyleData into the RestyleHint.
* style: Add support for resolving default computed styles.Cameron McCormack2017-05-251-4/+57
|
* Make replace_rules returning boolean.Hiroyuki Ikezoe2017-05-241-2/+2
| | | | | | | | | 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.
* style: Remove unneeded indirection in traversal code.Emilio Cobos Álvarez2017-05-211-10/+11
|
* Add a new TraversalRestyleBehavior that represents the traversal is ↵Hiroyuki Ikezoe2017-05-211-0/+9
| | | | | | triggered by CSS rule changes. And propagate the new flag to servo if mRestyleForCSSRuleChanges is set.
* style: Move all the style sharing code outside matching.rsEmilio Cobos Álvarez2017-05-211-2/+3
| | | | | This is just a code health change. I want to move it away to keep matching.rs as simple as possible.
* style: Make a bloom filter arrive to restyle hint computation.Emilio Cobos Álvarez2017-05-211-13/+27
|
* style: Refactor RestyleHint to be a struct.Cameron McCormack2017-05-201-4/+4
| | | | | Later PRs will add additional data to it that is not so easy to represent using bitflags.
* style: Use RestyleDamage to determine whether we must continue cascading ↵Cameron McCormack2017-05-201-15/+28
| | | | style changes to children.
* Trigger restyle if important rules are changed.Boris Chiou2017-05-201-4/+4
| | | | | | | | | | | | | | If we add/remove important rules, we may need to update a list of all important rules (in Gecko) which overrides animation properties. Therefore, we need to set a flag if we update the primary rules which includes important ones. If we have animations on this element, we update its effect properties, and also send a task to update cascade results. Calling get_properties_overriding_animations() might cases some impact on performance because we need to walk the rule tree, so if possible, we could just store this set into TNode to avoid finding the properties for both old and new rules each time. This could be a future work if necessary.
* Bug 1364412: Properly handle state restyle hints for pseudo-elements. r=bholleyEmilio Cobos Álvarez2017-05-161-1/+2
|
* Bug 1355343: Take all the snapshots into account. r=bholleyEmilio Cobos Álvarez2017-05-101-27/+39
| | | | | | | | | | | | | | | | | 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>
* Bug 1331047: Implement the new traversal semantics for stylo. r=bholley,hiroEmilio Cobos Álvarez2017-04-271-76/+112
| | | | | MozReview-Commit-ID: 4BXx9JpGZKX Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
* Clear animation-only dirty descendants bit on display:none descendantsBrian Birtles2017-04-261-2/+8
| | | | | | | | | When an element has a display:none ancestor we don't traverse it during restyle. However, at the end of restyling we expect the tree to be free of dirty bits. We currently take special care to clear the regular (non-animation) dirty bit on nodes in display:none subtrees in order to preserve this invariant. This patch applies the same handling to the animation-only dirty descendants bit.
* style: Remove useless deny(missing_docs).Emilio Cobos Álvarez2017-04-141-2/+0
| | | | | MozReview-Commit-ID: FEvY3ZlJEnc Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
* Preserve restyle hints other than animation hints in propagate() during ↵Hiroyuki Ikezoe2017-04-131-1/+1
| | | | animation-only restyle.
* Cache the results of cache entry revalidation and use the bloom filter.Bobby Holley2017-04-121-3/+1
|
* Rename cascade_with_replacements to replace_rules.Hiroyuki Ikezoe2017-04-111-1/+1
| | | | That's because the function does not invoke cascade() at all.
* Auto merge of #16312 - bholley:breadth_first_sequential, r=emiliobors-servo2017-04-091-16/+58
|\ | | | | | | | | | | | | | | | | | | | | Make the sequential traversal breadth-first Reviewed in https://bugzilla.mozilla.org/show_bug.cgi?id=1354806 <!-- 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/16312) <!-- Reviewable:end -->
| * Do the sequential traversal breadth-first.Bobby Holley2017-04-091-15/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | While we're at it, we also eliminate the 'unknown' dom depth for the bloom filter. Computing depth has negligible cost relative to the amount of work we do setting up the bloom filter at a given depth. Doing it once per traversal should be totally fine. I originally separated the elimination of unknown dom depth from the traversal changes, but I got bloom filter crashes on the intermediate patch, presumably because I didn't properly fix the sequential traversal for this case. Given that the final state is green, I just decided to squash and move on.
| * Factor out the bottom-up postorder traversal logic.Bobby Holley2017-04-091-1/+51
| |
* | style: Handle TraversalRestyleBehavior::ForReconstruct in the Servo restyle.Cameron McCormack2017-04-081-16/+59
| |
* | style: Move TraversalFlags into SharedStyleContext.Cameron McCormack2017-04-081-8/+9
| |
* | style: Don't traverse children if the root of the restyle is display:none.Cameron McCormack2017-04-081-0/+6
|/ | | | | If we append a child to a display:none element, and we use StyleNewChildren on that parent, we should skip restyling the children.