mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 00:08:39 +09:00
Issue #2691: Improve token handling for selectors
This commit is contained in:
parent
fcb4b3d01f
commit
69556b7b1b
1 changed files with 25 additions and 1 deletions
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include <algorithm> // for std::stable_sort
|
||||
#include <limits> // for std::numeric_limits
|
||||
#include <cmath> // for std::floor
|
||||
|
||||
#include "nsCSSParser.h"
|
||||
#include "nsAlgorithm.h"
|
||||
|
|
@ -4902,8 +4903,12 @@ CSSParserImpl::ParseSupportsSelector(bool& aConditionMet)
|
|||
selectorText.Append(mToken.mIdent);
|
||||
break;
|
||||
|
||||
case eCSSToken_ID:
|
||||
selectorText.Append('#');
|
||||
selectorText.Append(mToken.mIdent);
|
||||
break;
|
||||
|
||||
case eCSSToken_Hash:
|
||||
if (needSpace) selectorText.Append(' ');
|
||||
selectorText.Append('#');
|
||||
selectorText.Append(mToken.mIdent);
|
||||
break;
|
||||
|
|
@ -4926,6 +4931,25 @@ CSSParserImpl::ParseSupportsSelector(bool& aConditionMet)
|
|||
parenDepth++;
|
||||
break;
|
||||
|
||||
case eCSSToken_Number:
|
||||
if (needSpace) selectorText.Append(' ');
|
||||
if (mToken.mNumber == floor(mToken.mNumber)) {
|
||||
selectorText.AppendInt(int32_t(mToken.mNumber));
|
||||
} else {
|
||||
selectorText.AppendFloat(mToken.mNumber);
|
||||
}
|
||||
break;
|
||||
|
||||
case eCSSToken_Dimension:
|
||||
if (needSpace) selectorText.Append(' ');
|
||||
if (mToken.mNumber == floor(mToken.mNumber)) {
|
||||
selectorText.AppendInt(int32_t(mToken.mNumber));
|
||||
} else {
|
||||
selectorText.AppendFloat(mToken.mNumber);
|
||||
}
|
||||
selectorText.Append(mToken.mIdent);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!mToken.mIdent.IsEmpty()) {
|
||||
if (needSpace) selectorText.Append(' ');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue