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

RESOLVED FIXED in Firefox 57

Status

()

enhancement
P3
normal
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: xidorn, Assigned: TYLin)

Tracking

Trunk
mozilla57
Points:
---

Firefox Tracking Flags

(firefox57 fixed)

Details

Attachments

(2 attachments, 1 obsolete attachment)

(Reporter)

Description

2 years ago
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.
(Reporter)

Comment 1

2 years ago
This seems to be XBL-related. TYLin, could you have a look?
Flags: needinfo?(tlin)
(Reporter)

Updated

2 years ago
Priority: -- → P3
Comment hidden (mozreview-request)
Comment hidden (mozreview-request)
(Assignee)

Comment 4

2 years ago
https://treeherder.mozilla.org/#/jobs?repo=try&revision=178a0bfb74909b70336819aa367d9293ba87313d
Assignee: nobody → tlin
Status: NEW → ASSIGNED
Flags: needinfo?(tlin)

Comment 5

2 years ago
mozreview-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

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+

Comment 6

2 years ago
mozreview-review
Comment on attachment 8897423 [details]
Bug 1382102 - Update mochitest expectation.

https://reviewboard.mozilla.org/r/168740/#review174168
Attachment #8897423 - Flags: review?(emilio+bugs) → review+
(Assignee)

Comment 7

2 years ago
mozreview-review-reply
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.
Comment hidden (mozreview-request)
(Assignee)

Updated

2 years ago
Attachment #8897422 - Attachment is obsolete: true
(Assignee)

Comment 9

2 years ago
Posted file Servo PR #18104

Comment 11

2 years ago
Pushed by tlin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a531a8c8f75a
Update mochitest expectation. r=emilio

Comment 12

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/a531a8c8f75a
Status: ASSIGNED → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in before you can comment on or make changes to this bug.