Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Unified Diff: third_party/WebKit/Source/core/css/StylePropertySerializer.cpp

Issue 2228313002: Make a function to query whether a CSSPropertyID is valid and whether it has a name. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@asan
Patch Set: Revert spurious change Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/StylePropertySerializer.cpp
diff --git a/third_party/WebKit/Source/core/css/StylePropertySerializer.cpp b/third_party/WebKit/Source/core/css/StylePropertySerializer.cpp
index d7230a72cecd3ee9c6e53c049119e56fa71b6e3b..433d6a439262f270828bacce62d0438a18e93209 100644
--- a/third_party/WebKit/Source/core/css/StylePropertySerializer.cpp
+++ b/third_party/WebKit/Source/core/css/StylePropertySerializer.cpp
@@ -57,7 +57,7 @@ StylePropertySerializer::StylePropertySetForSerializer::
continue;
m_needToExpandAll = true;
}
- if (property.id() < firstCSSProperty || property.id() > lastCSSProperty)
+ if (!isCSSPropertyIDWithName(property.id()))
continue;
m_longhandPropertyUsed.set(property.id() - firstCSSProperty);
}
@@ -83,10 +83,10 @@ StylePropertySerializer::StylePropertySetForSerializer::propertyAt(
CSSPropertyID propertyID =
static_cast<CSSPropertyID>(index + firstCSSProperty);
- ASSERT(firstCSSProperty <= propertyID && propertyID <= lastCSSProperty);
+ DCHECK(isCSSPropertyIDWithName(propertyID));
if (m_longhandPropertyUsed.test(index)) {
int index = m_propertySet->findPropertyIndex(propertyID);
- ASSERT(index != -1);
+ DCHECK_NE(index, -1);
return StylePropertySerializer::PropertyValueForSerializer(
m_propertySet->propertyAt(index));
}
@@ -111,14 +111,14 @@ bool StylePropertySerializer::StylePropertySetForSerializer::
if (property.id() == CSSPropertyAll ||
!CSSProperty::isAffectedByAllProperty(property.id()))
return true;
- if (property.id() < firstCSSProperty || property.id() > lastCSSProperty)
+ if (!isCSSPropertyIDWithName(property.id()))
return false;
return m_longhandPropertyUsed.test(property.id() - firstCSSProperty);
}
CSSPropertyID propertyID =
static_cast<CSSPropertyID>(index + firstCSSProperty);
- ASSERT(firstCSSProperty <= propertyID && propertyID <= lastCSSProperty);
+ DCHECK(isCSSPropertyIDWithName(propertyID));
// Since "all" is expanded, we don't need to process "all".
// We should not process expanded shorthands (e.g. font, background,
@@ -168,7 +168,7 @@ StylePropertySerializer::StylePropertySerializer(
String StylePropertySerializer::getCustomPropertyText(
const PropertyValueForSerializer& property,
bool isNotFirstDecl) const {
- ASSERT(property.id() == CSSPropertyVariable);
+ DCHECK_EQ(property.id(), CSSPropertyVariable);
StringBuilder result;
if (isNotFirstDecl)
result.append(' ');
@@ -227,10 +227,10 @@ String StylePropertySerializer::asText() const {
m_propertySet.propertyAt(n);
CSSPropertyID propertyID = property.id();
// Only enabled properties should be part of the style.
- ASSERT(CSSPropertyMetadata::isEnabledProperty(propertyID));
+ DCHECK(CSSPropertyMetadata::isEnabledProperty(propertyID));
// Shorthands with variable references are not expanded at parse time
// and hence may still be observed during serialization.
- ASSERT(!isShorthandProperty(propertyID) ||
+ DCHECK(!isShorthandProperty(propertyID) ||
property.value()->isVariableReferenceValue());
switch (propertyID) {
@@ -302,7 +302,7 @@ String StylePropertySerializer::asText() const {
property.isImportant(), numDecls++));
}
- ASSERT(!numDecls ^ !result.isEmpty());
+ DCHECK(!numDecls ^ !result.isEmpty());
return result.toString();
}
@@ -532,7 +532,7 @@ void StylePropertySerializer::appendFontLonghandValueIfNotNormal(
CSSPropertyID propertyID,
StringBuilder& result) const {
int foundPropertyIndex = m_propertySet.findPropertyIndex(propertyID);
- ASSERT(foundPropertyIndex != -1);
+ DCHECK_NE(foundPropertyIndex, -1);
const CSSValue* val = m_propertySet.propertyAt(foundPropertyIndex).value();
if (val->isIdentifierValue() &&
@@ -555,7 +555,7 @@ void StylePropertySerializer::appendFontLonghandValueIfNotNormal(
prefix = '/';
break;
default:
- ASSERT_NOT_REACHED();
+ NOTREACHED();
}
if (prefix && !result.isEmpty())
@@ -752,7 +752,7 @@ String StylePropertySerializer::getLayeredShorthandValue(
m_propertySet.isPropertyImplicit(property)) &&
(property == CSSPropertyBackgroundRepeatX ||
property == CSSPropertyWebkitMaskRepeatX)) {
- ASSERT(shorthand.properties()[propertyIndex + 1] ==
+ DCHECK(shorthand.properties()[propertyIndex + 1] ==
CSSPropertyBackgroundRepeatY ||
shorthand.properties()[propertyIndex + 1] ==
CSSPropertyWebkitMaskRepeatY);
« no previous file with comments | « third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp ('k') | third_party/WebKit/Source/core/frame/Deprecation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698