Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split descriptors out of properties dictionary in CSSProperties.json #7832

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
597 changes: 385 additions & 212 deletions Source/WebCore/css/CSSProperties.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions Source/WebCore/css/parser/CSSParserFastPaths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,14 +586,14 @@ std::optional<SRGBA<uint8_t>> CSSParserFastPaths::parseNamedColor(StringView str
return parseNamedColorInternal(string.characters16(), string.length());
}

bool CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyID property, CSSValueID value, const CSSParserContext& context)
bool CSSParserFastPaths::isKeywordValidForStyleProperty(CSSPropertyID property, CSSValueID value, const CSSParserContext& context)
{
return CSSPropertyParsing::isKeywordValidForProperty(property, value, context);
return CSSPropertyParsing::isKeywordValidForStyleProperty(property, value, context);
}

bool CSSParserFastPaths::isKeywordPropertyID(CSSPropertyID property)
bool CSSParserFastPaths::isKeywordFastPathEligibleStyleProperty(CSSPropertyID property)
{
return CSSPropertyParsing::isKeywordProperty(property);
return CSSPropertyParsing::isKeywordFastPathEligibleStyleProperty(property);
}

static bool isUniversalKeyword(StringView string)
Expand All @@ -614,7 +614,7 @@ static RefPtr<CSSValue> parseKeywordValue(CSSPropertyID propertyId, StringView s
// FIXME: The "!context.enclosingRuleType" is suspicious.
ASSERT(!CSSProperty::isDescriptorOnly(propertyId) || parsingDescriptor || !context.enclosingRuleType);

if (!CSSParserFastPaths::isKeywordPropertyID(propertyId)) {
if (!CSSParserFastPaths::isKeywordFastPathEligibleStyleProperty(propertyId)) {
// All properties, including non-keyword properties, accept the CSS-wide keywords.
if (!isUniversalKeyword(string))
return nullptr;
Expand All @@ -636,7 +636,7 @@ static RefPtr<CSSValue> parseKeywordValue(CSSPropertyID propertyId, StringView s
if (!parsingDescriptor && isCSSWideKeyword(valueID))
return CSSValuePool::singleton().createIdentifierValue(valueID);

if (CSSParserFastPaths::isValidKeywordPropertyAndValue(propertyId, valueID, context))
if (CSSParserFastPaths::isKeywordValidForStyleProperty(propertyId, valueID, context))
return CSSValuePool::singleton().createIdentifierValue(valueID);
return nullptr;
}
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/css/parser/CSSParserFastPaths.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ class CSSParserFastPaths {
static RefPtr<CSSValue> maybeParseValue(CSSPropertyID, StringView, const CSSParserContext&);

// Properties handled here shouldn't be explicitly handled in CSSPropertyParser.
static bool isKeywordPropertyID(CSSPropertyID);
static bool isValidKeywordPropertyAndValue(CSSPropertyID, CSSValueID, const CSSParserContext&);
static bool isKeywordFastPathEligibleStyleProperty(CSSPropertyID);
static bool isKeywordValidForStyleProperty(CSSPropertyID, CSSValueID, const CSSParserContext&);

// Parses numeric and named colors.
static std::optional<SRGBA<uint8_t>> parseSimpleColor(StringView, bool strict = false);
Expand Down