Bug 1387905 part 1 - Count pseudo-element into specificity. r=heycam

MozReview-Commit-ID: IWlINaYAhql

--HG--
extra : rebase_source : f0d12277ecda1c7e498ba208cec0e0cde6fc5a25
This commit is contained in:
Xidorn Quan 2017-09-04 12:05:56 +10:00
parent 76c1b26215
commit 441c9db551
2 changed files with 4 additions and 1 deletions

View File

@ -35,7 +35,7 @@ Test that css-logic calculates CSS specificity properly
{text: "* body#home div#warning p.message", expected: 131331},
{text: "#footer :not(nav) li", expected: 65538},
{text: "bar:nth-child(n)", expected: 257},
{text: "li::-moz-list-number", expected: 1},
{text: "li::-moz-list-number", expected: 2},
{text: "a:hover", expected: 257}
];

View File

@ -503,6 +503,9 @@ int32_t nsCSSSelector::CalcWeightWithoutNegations() const
"If pseudo-elements can have id or attribute selectors "
"after them, specificity calculation must be updated");
if (IsPseudoElement()) {
weight += 0x000001;
}
if (nullptr != mCasedTag) {
weight += 0x000001;
}