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: Invert storage of selector maps to key off origin first. #17990

Merged
merged 1 commit into from Aug 7, 2017

Conversation

heycam
Copy link
Contributor

@heycam heycam commented Aug 7, 2017

This will make it easier to avoid rebuilding all cascade levels when only a style sheet at a particular level changes.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #__ (github issue number if applicable).
  • There are tests for these changes OR
  • These changes do not require tests because _____

This change is Reviewable

@highfive
Copy link

highfive commented Aug 7, 2017

Heads up! This PR modifies the following files:

@highfive
Copy link

highfive commented Aug 7, 2017

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 Aug 7, 2017
@heycam
Copy link
Contributor Author

heycam commented Aug 7, 2017

r? @emilio

@heycam
Copy link
Contributor Author

heycam commented Aug 7, 2017

(This is the first patch from https://bugzilla.mozilla.org/show_bug.cgi?id=1382925.)

Copy link
Member

@emilio emilio left a comment

Choose a reason for hiding this comment

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

Nice :-)

/// rules against the current device.
element_map: PerPseudoElementSelectorMap,
/// Selector maps for all of the style sheets in the stylist, after
/// evalutaing media rules agains the current device, split out per
Copy link
Member

Choose a reason for hiding this comment

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

nit: against.

}

#[inline]
fn borrow_mut_for_pseudo_or_insert(&mut self, pseudo: Option<&PseudoElement>) -> &mut SelectorMap<Rule> {
Copy link
Member

Choose a reason for hiding this comment

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

I don't particularly love this name, but... I guess :-)

}

fn has_rules_for_pseudo(&self, pseudo: &PseudoElement) -> bool {
self.pseudos_map.contains_key(pseudo)
Copy link
Member

Choose a reason for hiding this comment

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

On another note, we should probably make the pseudos map be an enumerated array, but that's probably ok for now.

@heycam
Copy link
Contributor Author

heycam commented Aug 7, 2017

@bors-servo r=emilio

@bors-servo
Copy link
Contributor

📌 Commit 39f2034 has been approved by emilio

@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 Aug 7, 2017
@emilio
Copy link
Member

emilio commented Aug 7, 2017

@bors-servo p=10

emilio added a commit to emilio/servo that referenced this pull request Aug 7, 2017
This is on top of servo#17990, and it's intended to help with bug 1386045.
emilio added a commit to emilio/servo that referenced this pull request Aug 7, 2017
… in the cascade data.

This is on top of servo#17990, and it's intended to help with bug 1386045.
@bors-servo
Copy link
Contributor

⌛ Testing commit 39f2034 with merge cc1aab3...

bors-servo pushed a commit that referenced this pull request Aug 7, 2017
style: Invert storage of selector maps to key off origin first.

<!-- Please describe your changes on the following line: -->

This will make it easier to avoid rebuilding all cascade levels when only a style sheet at a particular level changes.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/17990)
<!-- 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: emilio
Pushing cc1aab3 to master...

@bors-servo bors-servo merged commit 39f2034 into servo:master Aug 7, 2017
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Aug 7, 2017
emilio added a commit to emilio/servo that referenced this pull request Aug 7, 2017
… in the cascade data.

This is on top of servo#17990, and it's intended to help with bug 1386045.
bors-servo pushed a commit that referenced this pull request Aug 7, 2017
style: Avoid branching on the origin for each selector when inserting in the cascade data.

This is on top of #17990, and it's intended to help with bug 1386045.

<!-- 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/17991)
<!-- Reviewable:end -->
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

4 participants