diff options
author | Bobby Holley <bobbyholley@gmail.com> | 2016-12-10 20:11:36 -1000 |
---|---|---|
committer | Bobby Holley <bobbyholley@gmail.com> | 2016-12-12 18:50:33 -0800 |
commit | 3a5695406939dbe370d7cf467d69be7ee6c38759 (patch) | |
tree | 18c6c62f57978842442121b662fe243e145b2ed4 /ports | |
parent | 75e4c16bc7e1f50a19f52b095d3327462d9c1459 (diff) | |
download | servo-3a5695406939dbe370d7cf467d69be7ee6c38759.tar.gz servo-3a5695406939dbe370d7cf467d69be7ee6c38759.zip |
Bug 1322945 - Change skip_root to unstyled_children_only and use StyleNewChildren in more places. r=heycam
I noticed that our current behavior in ContentRangeInserted is incorrect. Unlike
ContentInserted (where this code lived originally), ContentRangeInserted takes a
start and end element. I'm not sure if we ever take that path for new content that
needs style, but it seemed sketchy. And generally, it seems nice to just always
style new content the same way (though we still need to style NAC by the subtree
root, since it hasn't been attached to the parent yet).
For situations where there is indeed only one unstyled child, the traversal
overhead should be neglible, since we special-case the single-element in
parallel.rs to avoid calling into rayon.
Being more explicit about what we want here also makes us more robust against
the other handful of callpaths that can take us into
nsCSSFrameConstructor::{ContentRangeInserted,ContentAppended}. Currently we
can call StyleNewSubtree on an already-styled element via RecreateFramesForContent,
which triggers an assertion in the servo traversal.
MozReview-Commit-ID: DqCGh90deHH
Diffstat (limited to 'ports')
-rw-r--r-- | ports/geckolib/glue.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 3e6bcdbf446..8d832d393a9 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -118,7 +118,7 @@ fn create_shared_context(mut per_doc_data: &mut AtomicRefMut<PerDocumentStyleDat } fn traverse_subtree(element: GeckoElement, raw_data: RawServoStyleSetBorrowed, - skip_root: bool) { + unstyled_children_only: bool) { // Force the creation of our lazily-constructed initial computed values on // the main thread, since it's not safe to call elsewhere. // @@ -139,7 +139,7 @@ fn traverse_subtree(element: GeckoElement, raw_data: RawServoStyleSetBorrowed, let mut per_doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut(); - let token = RecalcStyleOnly::pre_traverse(element, &per_doc_data.stylist, skip_root); + let token = RecalcStyleOnly::pre_traverse(element, &per_doc_data.stylist, unstyled_children_only); if !token.should_traverse() { error!("Unnecessary call to traverse_subtree"); return; @@ -160,10 +160,11 @@ fn traverse_subtree(element: GeckoElement, raw_data: RawServoStyleSetBorrowed, #[no_mangle] pub extern "C" fn Servo_TraverseSubtree(root: RawGeckoElementBorrowed, raw_data: RawServoStyleSetBorrowed, - skip_root: structs::SkipRootBehavior) -> () { + behavior: structs::TraversalRootBehavior) -> () { let element = GeckoElement(root); debug!("Servo_TraverseSubtree: {:?}", element); - traverse_subtree(element, raw_data, skip_root == structs::SkipRootBehavior::Skip); + traverse_subtree(element, raw_data, + behavior == structs::TraversalRootBehavior::UnstyledChildrenOnly); } #[no_mangle] |