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

style: Split the invalidation processing from the invalidator step. #18847

Merged
merged 7 commits into from Oct 13, 2017

Conversation

emilio
Copy link
Member

@emilio emilio commented Oct 12, 2017

This is the first step in reusing the invalidation machinery for other stuff,
potentially including QuerySelector / QuerySelectorAll.


This change is Reviewable

@highfive
Copy link

Heads up! This PR modifies the following files:

  • @bholley: components/style/data.rs, components/style/invalidation/element/collector.rs, components/style/invalidation/element/invalidator.rs, components/style/invalidation/element/mod.rs
  • @canaltinova: components/style/data.rs, components/style/invalidation/element/collector.rs, components/style/invalidation/element/invalidator.rs, components/style/invalidation/element/mod.rs

@highfive
Copy link

warning Warning warning

  • These commits modify style code, but no tests are modified. Please consider adding a test!

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Oct 12, 2017
@emilio
Copy link
Member Author

emilio commented Oct 12, 2017

r? @heycam or @SimonSapin

This is just moving code around, no behavior change (apart from introducing the InvalidatorCollector trait).

@highfive highfive assigned heycam and unassigned KiChjang Oct 12, 2017
@emilio emilio changed the title style: Split the invalidation collection from the invalidator step. style: Split the invalidation processing from the invalidator step. Oct 12, 2017
@emilio
Copy link
Member Author

emilio commented Oct 12, 2017

I ended up working more on top of this, so please review each commit individually.

Thanks a lot!

Copy link
Contributor

@heycam heycam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@@ -49,10 +49,11 @@ where
}

/// A collector for state and attribute invalidations.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update this comment now that these things are called processors rather than collectors?

@@ -33,12 +33,61 @@ pub trait InvalidationCollector {
) -> bool
where
E: TElement;

/// Returns whether a given element should process its descendants.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I guess it's the process that processes the descendants, not the element. So maybe "Returns whether the invalidation process should process the descendants of the given element."

Also, document what data is, here and on the other functions?

/// any).
fn recursion_limit_exceeded<E>(
&self,
_element: E,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: odd to use "_" in a trait function declaration.

let invalidated_descendants = child_invalidator.invalidate_descendants(
&invalidations_for_descendants
);

// The child may not be a flattened tree child of the current element,
// but may be arbitrarily deep.
//
// Since we keep the traversal flags in terms of the flattened tree,
// we need to propagate it as appropriate.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment seems to be describing what we do inside the invalidated_descendants implementation, which could be anything on some abritrary InvalidationProcessor. This comment is already duplicated in the (one) invalidated_descendants implementation so I think we should just drop this comment here.

@@ -22,6 +22,11 @@ pub trait InvalidationProcessor<E>
where
E: TElement,
{
/// Whether an invalidation that only leaves an eager pseudo-element like
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Not sure what you mean by "leaves".)

This is the first step in reusing the invalidation machinery for other stuff,
potentially including QuerySelector / QuerySelectorAll.
…an InvalidationProcessor trait.

Ditto, no change in behavior.
I think invalidated_descendants was buggy, and this fixes it.
This would allow querySelector / querySelectorAll to mutate the list of matched
nodes as it sees fit.
@emilio
Copy link
Member Author

emilio commented Oct 13, 2017

@bors-servo r=heycam p=1

@bors-servo
Copy link
Contributor

📌 Commit e447f81 has been approved by heycam

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Oct 13, 2017
@bors-servo
Copy link
Contributor

⌛ Testing commit e447f81 with merge a89a76e...

bors-servo pushed a commit that referenced this pull request Oct 13, 2017
style: Split the invalidation processing from the invalidator step.

This is the first step in reusing the invalidation machinery for other stuff,
potentially including QuerySelector / QuerySelectorAll.

<!-- 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/18847)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev
Approved by: heycam
Pushing a89a76e to master...

@bors-servo bors-servo merged commit e447f81 into servo:master Oct 13, 2017
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Oct 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants