Sibling combinators should work on roots of anonymous content subtrees

RESOLVED FIXED in mozilla29

Status

()

Core
CSS Parsing and Computation
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: bz, Assigned: bz)

Tracking

unspecified
mozilla29
x86
Mac OS X
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

Right now they don't because we implement them on top of IndexOf().  But we don't want to use IndexOf anyway, and I think that if your anon content looks like this:

  <span class="a"></span>
  <span class="b"></span>

then ".a + .b" should match the second span.
Created attachment 8363719 [details] [diff] [review]
Make '+' and '~' combinators work at the top level of an anonymous content forest.

Cameron, are you OK reviewing this?  If not, please punt to dbaron.
Attachment #8363719 - Flags: review?(cam)
Comment on attachment 8363719 [details] [diff] [review]
Make '+' and '~' combinators work at the top level of an anonymous content forest.

Review of attachment 8363719 [details] [diff] [review]:
-----------------------------------------------------------------

No, I'm happy with this.  Maybe replace the for loop entirely with a GetPreviousSiblingElement call?  And a test that exercises the NODE_HAS_SLOW_SELECTOR_LATER_SIBLINGS flag having been set on the parent, e.g. starting with #a having some text content, using script to remove the text content, and having this rule:

  .a:empty + .b { ... }
Attachment #8363719 - Flags: review?(cam) → review+
> Maybe replace the for loop entirely with a GetPreviousSiblingElement call?

Good call.  It's _maybe_ a tiny bit slower due to not being inlined, but seems totally worth it.
Attachment #8363719 - Attachment is obsolete: true
https://hg.mozilla.org/integration/mozilla-inbound/rev/f88b13e2ae0a
Flags: in-testsuite+
Whiteboard: [need review]
Target Milestone: --- → mozilla29
https://hg.mozilla.org/mozilla-central/rev/f88b13e2ae0a
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.