Closed Bug 962628 Opened 10 years ago Closed 10 years ago

Sibling combinators should work on roots of anonymous content subtrees

Categories

(Core :: CSS Parsing and Computation, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla29

People

(Reporter: bzbarsky, Assigned: bzbarsky)

Details

Attachments

(1 file, 1 obsolete file)

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.
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
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: