Optimize a > b ~ c as well as a b ~ c in SelectorMatchesTree

RESOLVED FIXED in mozilla1.9.3a1

Status

()

P4
normal
RESOLVED FIXED
9 years ago
9 years ago

People

(Reporter: zwol, Assigned: zwol)

Tracking

Trunk
mozilla1.9.3a1
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

9 years ago
I noticed this while working on bug 508466.  In one branch of SelectorMatchesTree, there is this logic:

      // to avoid greedy matching, we need to recur if this is a
      // descendant or general sibling combinator and the next
      // combinator is different, but we can make an exception for
      // sibling, then parent, since a sibling's parent is always the
      // same.
      if ((NS_IS_GREEDY_OPERATOR(selector->mOperator)) &&
          (selector->mNext) &&
          (selector->mNext->mOperator != selector->mOperator) &&
          !(selector->mOperator == '~' &&
            selector->mNext->mOperator == PRUnichar(0))) {

The last part of the condition exempts 'a b ~ c' from recursion, but the rationale in the comment applies equally to 'a > b ~ c'.  In testing, adding an additional exemption for selector->mNext->mOperator == '>' seems to be safe.

Patch to follow shortly.  Blocking 508466 only because both this and that need to modify this part of the code.
(Assignee)

Comment 1

9 years ago
Created attachment 395098 [details] [diff] [review]
patch
Attachment #395098 - Flags: review?(dbaron)
Comment on attachment 395098 [details] [diff] [review]
patch

r=dbaron
Attachment #395098 - Flags: review?(dbaron) → review+
(Assignee)

Updated

9 years ago
Keywords: checkin-needed
I'll land this later today.
http://hg.mozilla.org/mozilla-central/rev/2c20ec236783
Status: ASSIGNED → RESOLVED
Last Resolved: 9 years ago
Keywords: checkin-needed
OS: Linux → All
Priority: -- → P4
Hardware: x86 → All
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a1
You need to log in before you can comment on or make changes to this bug.