Fix consume CSS identifier input stream method
http://www.w3.org/TR/CSS21/syndata.html#characters https://drafts.csswg.org/css-syntax/#consume-name
This commit is contained in:
@@ -113,6 +113,25 @@ NS_INLINE BOOL isValidEscapedCodePoint(UTF32Char codePoint)
|
||||
codePoint <= 0x10FFFF);
|
||||
}
|
||||
|
||||
NS_INLINE BOOL isValidIdentifierStart(UTF32Char first, UTF32Char second, UTF32Char third)
|
||||
{
|
||||
if (first == HYPHEN_MINUS) {
|
||||
if (isNameStart(second) ||
|
||||
second == HYPHEN_MINUS ||
|
||||
isValidEscape(second, third)) {
|
||||
return YES;
|
||||
} else {
|
||||
return NO;
|
||||
}
|
||||
} else if (isNameStart(first)) {
|
||||
return YES;
|
||||
} else if (first == REVERSE_SOLIDUS) {
|
||||
return isValidEscape(first, second);
|
||||
} else {
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
NS_INLINE void AppendCodePoint(CFMutableStringRef string, UTF32Char codePoint)
|
||||
{
|
||||
UniChar pair[2];
|
||||
|
||||
@@ -26,6 +26,12 @@
|
||||
{
|
||||
CFMutableStringRef value = CFStringCreateMutable(kCFAllocatorDefault, 0);
|
||||
|
||||
if (!isValidIdentifierStart([self inputCharacterPointAtOffset:0],
|
||||
[self inputCharacterPointAtOffset:1],
|
||||
[self inputCharacterPointAtOffset:2])) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
while (YES) {
|
||||
UTF32Char codePoint = [self consumeNextInputCharacter];
|
||||
if (codePoint == EOF) {
|
||||
|
||||
Reference in New Issue
Block a user