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
Conversation
Heads up! This PR modifies the following files:
|
r? @emilio |
(This is the first patch from https://bugzilla.mozilla.org/show_bug.cgi?id=1382925.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice :-)
components/style/stylist.rs
Outdated
/// 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 |
There was a problem hiding this comment.
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> { |
There was a problem hiding this comment.
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 :-)
components/style/stylist.rs
Outdated
} | ||
|
||
fn has_rules_for_pseudo(&self, pseudo: &PseudoElement) -> bool { | ||
self.pseudos_map.contains_key(pseudo) |
There was a problem hiding this comment.
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.
804b634
to
39f2034
Compare
@bors-servo r=emilio |
📌 Commit 39f2034 has been approved by |
@bors-servo p=10 |
This is on top of servo#17990, and it's intended to help with bug 1386045.
… in the cascade data. This is on top of servo#17990, and it's intended to help with bug 1386045.
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 -->
☀️ 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 |
… in the cascade data. This is on top of servo#17990, and it's intended to help with bug 1386045.
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 -->
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 errorsThis change is