mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-24 16:17:29 +09:00
Issue #2691: Add special handling for nth-child expressions
This commit is contained in:
parent
aaae6484ee
commit
224d1724b2
1 changed files with 18 additions and 5 deletions
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
#include <algorithm> // for std::stable_sort
|
#include <algorithm> // for std::stable_sort
|
||||||
#include <limits> // for std::numeric_limits
|
#include <limits> // for std::numeric_limits
|
||||||
#include <cmath> // for std::floor
|
#include <cmath> // for std::floor and std::abs
|
||||||
|
|
||||||
#include "nsCSSParser.h"
|
#include "nsCSSParser.h"
|
||||||
#include "nsAlgorithm.h"
|
#include "nsAlgorithm.h"
|
||||||
|
|
@ -4989,11 +4989,24 @@ CSSParserImpl::ParseSupportsSelector(bool& aConditionMet)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCSSToken_Number:
|
case eCSSToken_Number:
|
||||||
if (needSpace) selectorText.Append(' ');
|
if (mToken.mHasSign && parenDepth > 0) {
|
||||||
if (mToken.mNumber == floor(mToken.mNumber)) {
|
if (mToken.mNumber >= 0) {
|
||||||
selectorText.AppendInt(int32_t(mToken.mNumber));
|
selectorText.Append('+');
|
||||||
|
} else {
|
||||||
|
selectorText.Append('-');
|
||||||
|
}
|
||||||
|
if (std::abs(mToken.mNumber) == floor(std::abs(mToken.mNumber))) {
|
||||||
|
selectorText.AppendInt(int32_t(std::abs(mToken.mNumber)));
|
||||||
|
} else {
|
||||||
|
selectorText.AppendFloat(std::abs(mToken.mNumber));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
selectorText.AppendFloat(mToken.mNumber);
|
if (needSpace) selectorText.Append(' ');
|
||||||
|
if (mToken.mNumber == floor(mToken.mNumber)) {
|
||||||
|
selectorText.AppendInt(int32_t(mToken.mNumber));
|
||||||
|
} else {
|
||||||
|
selectorText.AppendFloat(mToken.mNumber);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue