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 upAllow style sharing for elements with ids as long as the ID is not being used for styling #17055
Conversation
highfive
commented
May 26, 2017
|
Heads up! This PR modifies the following files: |
highfive
commented
May 26, 2017
|
r=me with that bit. The patch you had on IRC seemed fine. Thanks! |
| /// Checks whether we have rules for either of the two ids. | ||
| #[inline] | ||
| pub fn have_rules_for_ids(shared_context: &SharedStyleContext, | ||
| element_id: Option<Atom>, |
This comment has been minimized.
This comment has been minimized.
emilio
May 26, 2017
Member
This could better take a reference for its arguments, as discussed on IRC.
|
@bors-servo r=emilio |
|
|
Allow style sharing for elements with ids as long as the ID is not being used for styling <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix part of the problem we're seeing in https://bugzilla.mozilla.org/show_bug.cgi?id=1367862 <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because the only impact is on performance and memory. <!-- 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/17055) <!-- Reviewable:end -->
|
|
|
@bors-servo retry Looks like at least #16627 intermittently failing. |
|
|
|
|
|
@bors-servo retry |
|
|
|
|
|
The filtered log from the filter-intermittents log shows a bunch of tests that used to fail are now reliably passing. |
|
Right. That's actually due to a bug this patch introduces. Specifically, with this patch, this testcase:
fails with servo, or with stylo and STYLO_THREADS=1. I'm sorting through whether I can construct a similar testcase that fails without this patch. |
|
For those following along, some notes: First, the testcase fails because the patch violates an invariant that the style sharing cache depends on. That invariant goes something like this: "Every simple selector must either trigger revalidation or have its matching result guaranteed by the pre-checks done in test_candidate". With this patch, the pre-checks no longer guarantee matching results for id selectors, because they only check that the id is not used in the rightmost compound selector of a complex selector. So in the testcase above, the two divs share style (because the pre-checks don't prevent them from doing that), and then the two forms end up sharing style (because all pre-checks pass for them, their parents are sharing style, and no revalidation gets done). Conclusion: if we want to do this optimization in this form, we need to make selectors involving an id revalidation selectors. But we only need to do that if they're not in the rightmost compound selector, really. Not sure how best to do that in our current revalidation setup. Second, if you reverse the order of those two divs, and add text to the form without an id, you will notice that sharing is no longer happening. That's because relations_are_shareable does not insert an element into the style cache if it was matched by a selector that had an id simple selector somewhere in it. This seems pretty weird to me; in particular it means that a Still digging into some other weirdness I'm seeing. |
|
Oh, and the patch has another bug: it checks element_id both times in have_rules_for_ids. The second check should be for candidate_id. I'll fix that. |
|
@emilio review ping? That said, I'm not sure how much the visitor bits here will bitrot as a result of https://bugzilla.mozilla.org/show_bug.cgi?id=1370107 and whether I should wait for that to land first... |
|
Per IRC discussion, that work will not bitrot these patches. |
|
r=me |
| /// of our rule maps. | ||
| #[inline] | ||
| pub fn may_have_rules_for_id(&self, | ||
| id: &Atom) -> bool { |
This comment has been minimized.
This comment has been minimized.
| //! both selectors targeting element and selectors targeting pseudo-elements. | ||
| //! This relies on matching an element against a pseudo-element-targeting | ||
| //! selector being a sensible operation that will effectively check whether that | ||
| //! element is a matching originating element for the selector. |
This comment has been minimized.
This comment has been minimized.
|
@bors-servo r=emilio |
|
|
Allow style sharing for elements with ids as long as the ID is not being used for styling <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix part of the problem we're seeing in https://bugzilla.mozilla.org/show_bug.cgi?id=1367862 <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because the only impact is on performance and memory. <!-- 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/17055) <!-- Reviewable:end -->
|
|
|
@bors-servo r=emilio |
|
|
Allow style sharing for elements with ids as long as the ID is not being used for styling <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix part of the problem we're seeing in https://bugzilla.mozilla.org/show_bug.cgi?id=1367862 <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because the only impact is on performance and memory. <!-- 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/17055) <!-- Reviewable:end -->
|
|
bzbarsky commentedMay 26, 2017
•
edited by larsbergstrom
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is