Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incremental restyle: Introduce StylingMode and deprecate explicit dirtiness #13913

Merged
merged 1 commit into from Oct 26, 2016

Conversation

@bholley
Copy link
Contributor

bholley commented Oct 25, 2016

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 Reviewable

@highfive
Copy link

highfive commented Oct 25, 2016

Heads up! This PR modifies the following files:

  • @KiChjang: components/script/layout_wrapper.rs
  • @fitzgen: components/script/layout_wrapper.rs
  • @emilio: components/layout/traversal.rs, ports/geckolib/glue.rs, components/style/parallel.rs, components/style/data.rs, components/style/sequential.rs, components/style/dom.rs, components/style/gecko/traversal.rs, components/style/gecko/wrapper.rs, components/style/traversal.rs
@highfive
Copy link

highfive commented Oct 25, 2016

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
  • These commits modify style, layout, and script code, but no tests are modified. Please consider adding a test!
@bholley
Copy link
Contributor Author

bholley commented Oct 25, 2016

r? @emilio

@highfive highfive assigned emilio and unassigned mbrubeck Oct 25, 2016
@bholley
Copy link
Contributor Author

bholley commented Oct 25, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Oct 25, 2016

Trying commit 87a6ed0 with merge bc16c39...

bors-servo added a commit that referenced this pull request Oct 25, 2016
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
Copy link
Contributor

bors-servo commented Oct 25, 2016

💔 Test failed - mac-rel-css

@jdm
Copy link
Member

jdm commented Oct 25, 2016

  ▶ FAIL [expected PASS] /css21_dev/html4/cascade-import-dynamic-002.htm
  └   → /css21_dev/html4/cascade-import-dynamic-002.htm f56352da93639a2cc2b3d31b071a73c459b8b396
/css21_dev/html4/reference/ref-this-text-should-be-green.htm 28d8045f7834b63ec9aa27d6aee5f8c94c5b86e7
Testing f56352da93639a2cc2b3d31b071a73c459b8b396 == 28d8045f7834b63ec9aa27d6aee5f8c94c5b86e7

  ▶ FAIL [expected PASS] /css21_dev/html4/cascade-import-dynamic-004.htm
  └   → /css21_dev/html4/cascade-import-dynamic-004.htm f56352da93639a2cc2b3d31b071a73c459b8b396
/css21_dev/html4/reference/ref-this-text-should-be-green.htm 28d8045f7834b63ec9aa27d6aee5f8c94c5b86e7
Testing f56352da93639a2cc2b3d31b071a73c459b8b396 == 28d8045f7834b63ec9aa27d6aee5f8c94c5b86e7
@bholley bholley force-pushed the bholley:styling_mode branch from 87a6ed0 to 9d8e321 Oct 25, 2016
@bholley
Copy link
Contributor Author

bholley commented Oct 25, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Oct 25, 2016

Trying commit 9d8e321 with merge 61d3604...

bors-servo added a commit that referenced this pull request Oct 25, 2016
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
Copy link
Contributor

bors-servo commented Oct 25, 2016

💔 Test failed - mac-rel-css

@bholley
Copy link
Contributor Author

bholley commented Oct 25, 2016

@bors-servo retry

@bors-servo
Copy link
Contributor

bors-servo commented Oct 25, 2016

Trying commit 9d8e321 with merge cc6ed99...

bors-servo added a commit that referenced this pull request Oct 25, 2016
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 -->
@emilio
Copy link
Member

emilio commented Oct 25, 2016

Super excited to review this!

The last test failures are #13887 and a new pass (!):

  ▶ PASS [expected FAIL] /css21_dev/html4/c5525-fltblck-000.htm
@bors-servo
Copy link
Contributor

bors-servo commented Oct 25, 2016

💔 Test failed - linux-dev

@emilio
Copy link
Member

emilio commented Oct 25, 2016

./components/layout/traversal.rs:113: Line is longer than 120 characters

@bholley bholley force-pushed the bholley:styling_mode branch from 9d8e321 to 97a9741 Oct 25, 2016
@bholley
Copy link
Contributor Author

bholley commented Oct 25, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Oct 25, 2016

💔 Test failed - linux-dev

@bholley
Copy link
Contributor Author

bholley commented Oct 25, 2016

@bors-servo retry

error: linking with cc failed: exit code: 1

@bors-servo
Copy link
Contributor

bors-servo commented Oct 25, 2016

Trying commit 97a9741 with merge e20b584...

bors-servo added a commit that referenced this pull request Oct 25, 2016
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
Copy link
Contributor

bors-servo commented Oct 25, 2016

@@ -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.

@emilio

emilio Oct 26, 2016

Member

hm... This seems clunky, but I guess it's ok.

This comment has been minimized.

@bholley

bholley Oct 26, 2016

Author Contributor

Yes, it will go away soon anyway.

@@ -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.

@emilio

emilio Oct 26, 2016

Member

Probably the two first parameters can be inferred, right? (using _).

This comment has been minimized.

@bholley

bholley Oct 26, 2016

Author Contributor

Oh nice, I didn't know that worked.


for kid in parent.children() {
if kid.styling_mode() != StylingMode::Stop {
if !marked_dirty_descendants {

This comment has been minimized.

@emilio

emilio Oct 26, 2016

Member

seems like set_dirty_descendants should be cheap enough we shouldn't need this?

This comment has been minimized.

@bholley

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.

@emilio

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.

@emilio

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.

@bholley

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.

@emilio

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.

@bholley

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.

@emilio

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.

@bholley

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
@bholley bholley force-pushed the bholley:styling_mode branch from 97a9741 to 05c1f1e Oct 26, 2016
@emilio
Copy link
Member

emilio commented Oct 26, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Oct 26, 2016

📌 Commit 05c1f1e has been approved by emilio

@bors-servo
Copy link
Contributor

bors-servo commented Oct 26, 2016

Testing commit 05c1f1e with merge c8b6ece...

bors-servo added a commit that referenced this pull request Oct 26, 2016
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
Copy link
Contributor

bors-servo commented Oct 26, 2016

💔 Test failed - linux-dev

@bholley
Copy link
Contributor Author

bholley commented Oct 26, 2016

@bors-servo retry p=1

LLVM ERROR: IO failure on output stream

@bors-servo
Copy link
Contributor

bors-servo commented Oct 26, 2016

Previous build results for arm32, arm64, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-dev are reusable. Rebuilding only linux-dev...

@bors-servo
Copy link
Contributor

bors-servo commented Oct 26, 2016

💔 Test failed - linux-dev

@bholley
Copy link
Contributor Author

bholley commented Oct 26, 2016

@bors-servo retry

note: collect2: error: ld returned 1 exit status

@bors-servo
Copy link
Contributor

bors-servo commented Oct 26, 2016

Previous build results for arm32, arm64, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-dev are reusable. Rebuilding only linux-dev...

@bors-servo
Copy link
Contributor

bors-servo commented Oct 26, 2016

@bors-servo bors-servo merged commit 05c1f1e into servo:master Oct 26, 2016
2 of 3 checks passed
2 of 3 checks passed
continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@bholley bholley deleted the bholley:styling_mode branch Oct 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants
You can’t perform that action at this time.