Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upincremental restyle: Introduce StylingMode and deprecate explicit dirtiness #13913
Conversation
highfive
commented
Oct 25, 2016
|
Heads up! This PR modifies the following files:
|
highfive
commented
Oct 25, 2016
|
r? @emilio |
|
@bors-servo try |
incremental restyle: Introduce StylingMode and deprecate explicit dirtiness This is another chunk of work to move us toward the new incremental restyle architecture. Eventually, we'll make a fine-grained decision at each node about what style to recompute based on the RestyleHint on the node data (along with other things). For now, we use the existence of RestyleData as a coarse-grained approximation of this.
|
|
|
|
@bors-servo try |
incremental restyle: Introduce StylingMode and deprecate explicit dirtiness This is another chunk of work to move us toward the new incremental restyle architecture. Eventually, we'll make a fine-grained decision at each node about what style to recompute based on the RestyleHint on the node data (along with other things). For now, we use the existence of RestyleData as a coarse-grained approximation of this. <!-- 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/13913) <!-- Reviewable:end -->
|
|
|
@bors-servo retry |
incremental restyle: Introduce StylingMode and deprecate explicit dirtiness This is another chunk of work to move us toward the new incremental restyle architecture. Eventually, we'll make a fine-grained decision at each node about what style to recompute based on the RestyleHint on the node data (along with other things). For now, we use the existence of RestyleData as a coarse-grained approximation of this. <!-- 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/13913) <!-- Reviewable:end -->
|
Super excited to review this! The last test failures are #13887 and a new pass (!):
|
|
|
|
|
@bors-servo try |
|
|
|
@bors-servo retry
|
incremental restyle: Introduce StylingMode and deprecate explicit dirtiness This is another chunk of work to move us toward the new incremental restyle architecture. Eventually, we'll make a fine-grained decision at each node about what style to recompute based on the RestyleHint on the node data (along with other things). For now, we use the existence of RestyleData as a coarse-grained approximation of this. <!-- 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/13913) <!-- Reviewable:end -->
|
|
| @@ -212,7 +274,7 @@ pub trait TElement : PartialEq + Debug + Sized + Copy + Clone + ElementExt + Pre | |||
| fn attr_equals(&self, namespace: &Namespace, attr: &Atom, value: &Atom) -> bool; | |||
|
|
|||
| /// Properly marks nodes as dirty in response to restyle hints. | |||
| fn note_restyle_hint(&self, hint: RestyleHint) { | |||
| fn note_restyle_hint<C: DomTraversalContext<Self::ConcreteNode>>(&self, hint: RestyleHint) { | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| @@ -29,7 +31,7 @@ impl<'lc, 'ln> DomTraversalContext<GeckoNode<'ln>> for RecalcStyleOnly<'lc> { | |||
| } | |||
|
|
|||
| fn process_preorder(&self, node: GeckoNode<'ln>) -> RestyleResult { | |||
| recalc_style_at(&self.context, self.root, node) | |||
| recalc_style_at::<GeckoNode<'ln>, StandaloneStyleContext, Self>(&self.context, self.root, node) | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
||
| for kid in parent.children() { | ||
| if kid.styling_mode() != StylingMode::Stop { | ||
| if !marked_dirty_descendants { |
This comment has been minimized.
This comment has been minimized.
emilio
Oct 26, 2016
Member
seems like set_dirty_descendants should be cheap enough we shouldn't need this?
This comment has been minimized.
This comment has been minimized.
bholley
Oct 26, 2016
Author
Contributor
In Gecko it's an FFI call, so seems like we might as well avoid it when we can.
This comment has been minimized.
This comment has been minimized.
emilio
Oct 26, 2016
Member
Seems like we can check that flag before the FFI call only in the gecko side.
| @@ -175,25 +175,24 @@ impl NodeData { | |||
| self.styles = match mem::replace(&mut self.styles, Uninitialized) { | |||
| Uninitialized => Previous(f()), | |||
| Current(x) => Previous(Some(x)), | |||
| _ => panic!("Already have previous styles"), | |||
This comment has been minimized.
This comment has been minimized.
emilio
Oct 26, 2016
Member
I guess this change is because we call gather_previous_styles unconditionally on all the children even if we end up not styling them, is that right?
This comment has been minimized.
This comment has been minimized.
bholley
Oct 26, 2016
Author
Contributor
Yeah, at least for now it's more convenient for gather_previous_styles to be idempotent.
| if d.restyle_data.is_some() || self.deprecated_dirty_bit_is_set() { | ||
| Restyle | ||
| } else { | ||
| debug_assert!(!self.frame_has_style()); // display:none etc |
This comment has been minimized.
This comment has been minimized.
emilio
Oct 26, 2016
Member
Seems like mode_for_descendants could be stop in the display: none case for example. I see we're still using RestyleResult, but it'd be nice to leave a single mechanism in place.
This comment has been minimized.
This comment has been minimized.
bholley
Oct 26, 2016
Author
Contributor
Refactoring the code to remove the usage of RestyleResult is on my list, but I'm trying to keep the patches small-ish.
| parent.set_dirty_descendants(); | ||
| /// Helper for the traversal implementations to select the children that | ||
| /// should be enqueued for processing. | ||
| fn traverse_children<F: FnMut(N)>(parent: N, mut f: F) |
This comment has been minimized.
This comment has been minimized.
emilio
Oct 26, 2016
Member
Maybe rename this to traverse_children_needing_restyle or something like that that implies that it's more than a for loop?
This comment has been minimized.
This comment has been minimized.
bholley
Oct 26, 2016
Author
Contributor
Per IRC discussion, this name doesn't work, because the nodes might be StylingMode::Traverse (in which case they don't need a restyle) or StylingMode::Initial (In which case it's not a restyle). The eventual terminology I'm trying to move to is that 'traverse' means visiting in some capacity, and 'process' means doing actual work.
MozReview-Commit-ID: 5tF075EJKBa
|
@bors-servo: r+ |
|
|
incremental restyle: Introduce StylingMode and deprecate explicit dirtiness This is another chunk of work to move us toward the new incremental restyle architecture. Eventually, we'll make a fine-grained decision at each node about what style to recompute based on the RestyleHint on the node data (along with other things). For now, we use the existence of RestyleData as a coarse-grained approximation of this. <!-- 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/13913) <!-- Reviewable:end -->
|
|
|
@bors-servo retry p=1
|
|
|
|
|
|
@bors-servo retry
|
|
|
|
|
bholley commentedOct 25, 2016
•
edited by larsbergstrom
This is another chunk of work to move us toward the new incremental restyle architecture.
Eventually, we'll make a fine-grained decision at each node about what style to recompute based on the RestyleHint on the node data (along with other things). For now, we use the existence of RestyleData as a coarse-grained approximation of this.
This change is