Closed Bug 1382102 Opened 8 years ago Closed 8 years ago

stylo: :nth-child() shouldn't match element inside XBL anonymous subtree

Categories

(Core :: CSS Parsing and Computation, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: xidorn, Assigned: TYLin)

References

Details

Attachments

(2 files, 1 obsolete file)

Test layout/style/test/test_selectors_on_anonymous_content.html checks that :nth-child() in the outer document doesn't match element inside XBL anonymous subtree.
This seems to be XBL-related. TYLin, could you have a look?
Flags: needinfo?(tlin)
Priority: -- → P3
Assignee: nobody → tlin
Status: NEW → ASSIGNED
Flags: needinfo?(tlin)
Comment on attachment 8897422 [details] style: Skip matching :nth-child if element is the root of anonymous subtree https://reviewboard.mozilla.org/r/168738/#review174164 r=me, with the method renamed. Thanks for fixing this! ::: servo/components/selectors/matching.rs:779 (Diff revision 1) > flags_setter: &mut F) > -> bool > where E: Element, > F: FnMut(&E, ElementSelectorFlags), > { > + if element.is_root_of_anonymous_subtree() { I don't think we should not call `is_root_of_anonymous_subtree` to this. Anon content is a very specific Gecko thing, and `selectors` is supposed to be a generic crate. It's somewhat annoying because they shouldn't match even `:nth-child(1)`, sigh... What about an `ignores_nth_child_selectors` kind of flag, that returns false by default, and returns `is_root_of_anonymous_subtree` in `gecko/wrapper.rs`? I can't think of a really better name, but if you do find one, that'd be great :)
Attachment #8897422 - Flags: review?(emilio+bugs) → review+
Attachment #8897423 - Flags: review?(emilio+bugs) → review+
Comment on attachment 8897422 [details] style: Skip matching :nth-child if element is the root of anonymous subtree https://reviewboard.mozilla.org/r/168738/#review174164 > I don't think we should not call `is_root_of_anonymous_subtree` to this. > > Anon content is a very specific Gecko thing, and `selectors` is supposed to be a generic crate. > > It's somewhat annoying because they shouldn't match even `:nth-child(1)`, sigh... > > What about an `ignores_nth_child_selectors` kind of flag, that returns false by default, and returns `is_root_of_anonymous_subtree` in `gecko/wrapper.rs`? > > I can't think of a really better name, but if you do find one, that'd be great :) > Anon content is a very specific Gecko thing, and selectors is supposed to be a generic crate. You're right. It's better to keep `selectors` generic. I think `ignores_nth_child_selectors` naming is good enough. Let's use that.
Attachment #8897422 - Attachment is obsolete: true
Attached file Servo PR #18104
Pushed by tlin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a531a8c8f75a Update mochitest expectation. r=emilio
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: