mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 15:28:39 +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 <limits> // for std::numeric_limits
|
||||
#include <cmath> // for std::floor
|
||||
#include <cmath> // for std::floor and std::abs
|
||||
|
||||
#include "nsCSSParser.h"
|
||||
#include "nsAlgorithm.h"
|
||||
|
|
@ -4989,11 +4989,24 @@ CSSParserImpl::ParseSupportsSelector(bool& aConditionMet)
|
|||
break;
|
||||
|
||||
case eCSSToken_Number:
|
||||
if (needSpace) selectorText.Append(' ');
|
||||
if (mToken.mNumber == floor(mToken.mNumber)) {
|
||||
selectorText.AppendInt(int32_t(mToken.mNumber));
|
||||
if (mToken.mHasSign && parenDepth > 0) {
|
||||
if (mToken.mNumber >= 0) {
|
||||
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 {
|
||||
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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue