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

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

Issue 2346193002: Split CSSPrimitiveValue into CSSPrimitiveValue and CSSIdentifierValue (Closed)
Patch Set: Rebase please work Created 4 years, 3 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 c067f76c1c233ecc83699205fe30ab7b41faca5f..2b5a8b17ebd3a193196acf012ae38553ac5cd4d7 100644
--- a/third_party/WebKit/Source/core/css/StylePropertySerializer.cpp
+++ b/third_party/WebKit/Source/core/css/StylePropertySerializer.cpp
@@ -25,6 +25,7 @@
#include "core/CSSValueKeywords.h"
#include "core/StylePropertyShorthand.h"
#include "core/css/CSSCustomPropertyDeclaration.h"
+#include "core/css/CSSIdentifierValue.h"
#include "core/css/CSSPendingSubstitutionValue.h"
#include "core/css/CSSPropertyMetadata.h"
#include "core/css/CSSValuePool.h"
@@ -508,7 +509,7 @@ void StylePropertySerializer::appendFontLonghandValueIfNotNormal(CSSPropertyID p
ASSERT(foundPropertyIndex != -1);
const CSSValue* val = m_propertySet.propertyAt(foundPropertyIndex).value();
- if (val->isPrimitiveValue() && toCSSPrimitiveValue(val)->getValueID() == CSSValueNormal)
+ if (val->isIdentifierValue() && toCSSIdentifierValue(val)->getValueID() == CSSValueNormal)
return;
char prefix = '\0';
@@ -536,8 +537,8 @@ void StylePropertySerializer::appendFontLonghandValueIfNotNormal(CSSPropertyID p
String value;
// In the font-variant shorthand a "none" ligatures value needs to be expanded.
if (propertyID == CSSPropertyFontVariantLigatures
- && val->isPrimitiveValue()
- && toCSSPrimitiveValue(val)->getValueID() == CSSValueNone) {
+ && val->isIdentifierValue()
+ && toCSSIdentifierValue(val)->getValueID() == CSSValueNone) {
value = "no-common-ligatures no-discretionary-ligatures no-historical-ligatures no-contextual";
} else {
value = m_propertySet.propertyAt(foundPropertyIndex).value()->cssText();
@@ -568,11 +569,11 @@ String StylePropertySerializer::fontValue() const
// Check that non-initial font-variant subproperties are not conflicting with this serialization.
const CSSValue* ligaturesValue = fontVariantLigaturesProperty.value();
const CSSValue* numericValue = fontVariantNumericProperty.value();
- if ((ligaturesValue->isPrimitiveValue()
- && toCSSPrimitiveValue(ligaturesValue)->getValueID() != CSSValueNormal)
+ if ((ligaturesValue->isIdentifierValue()
+ && toCSSIdentifierValue(ligaturesValue)->getValueID() != CSSValueNormal)
|| ligaturesValue->isValueList()
- || (numericValue->isPrimitiveValue()
- && toCSSPrimitiveValue(numericValue)->getValueID() != CSSValueNormal)
+ || (numericValue->isIdentifierValue()
+ && toCSSIdentifierValue(numericValue)->getValueID() != CSSValueNormal)
|| numericValue->isValueList())
return emptyString();
@@ -580,9 +581,9 @@ String StylePropertySerializer::fontValue() const
appendFontLonghandValueIfNotNormal(CSSPropertyFontStyle, result);
const CSSValue* val = fontVariantCapsProperty.value();
- if (val->isPrimitiveValue()
- && (toCSSPrimitiveValue(val)->getValueID() != CSSValueSmallCaps
- && toCSSPrimitiveValue(val)->getValueID() != CSSValueNormal))
+ if (val->isIdentifierValue()
+ && (toCSSIdentifierValue(val)->getValueID() != CSSValueSmallCaps
+ && toCSSIdentifierValue(val)->getValueID() != CSSValueNormal))
return emptyString();
appendFontLonghandValueIfNotNormal(CSSPropertyFontVariantCaps, result);
@@ -712,11 +713,11 @@ String StylePropertySerializer::getLayeredShorthandValue(const StylePropertyShor
// FIXME: At some point we need to fix this code to avoid returning an invalid shorthand,
// since some longhand combinations are not serializable into a single shorthand.
- if (!value->isPrimitiveValue() || !yValue.isPrimitiveValue())
+ if (!value->isIdentifierValue() || !yValue.isIdentifierValue())
continue;
- CSSValueID xId = toCSSPrimitiveValue(value)->getValueID();
- CSSValueID yId = toCSSPrimitiveValue(yValue).getValueID();
+ CSSValueID xId = toCSSIdentifierValue(value)->getValueID();
+ CSSValueID yId = toCSSIdentifierValue(yValue).getValueID();
// Maybe advance propertyIndex to look at the next CSSValue in the list for the checks below.
if (xId == yId) {
useSingleWordShorthand = true;
@@ -822,9 +823,9 @@ String StylePropertySerializer::borderPropertyValue() const
static void appendBackgroundRepeatValue(StringBuilder& builder, const CSSValue& repeatXCSSValue, const CSSValue& repeatYCSSValue)
{
// FIXME: Ensure initial values do not appear in CSS_VALUE_LISTS.
- DEFINE_STATIC_LOCAL(CSSPrimitiveValue, initialRepeatValue, (CSSPrimitiveValue::createIdentifier(CSSValueRepeat)));
- const CSSPrimitiveValue& repeatX = repeatXCSSValue.isInitialValue() ? initialRepeatValue : toCSSPrimitiveValue(repeatXCSSValue);
- const CSSPrimitiveValue& repeatY = repeatYCSSValue.isInitialValue() ? initialRepeatValue : toCSSPrimitiveValue(repeatYCSSValue);
+ DEFINE_STATIC_LOCAL(CSSIdentifierValue, initialRepeatValue, (CSSIdentifierValue::create(CSSValueRepeat)));
+ const CSSIdentifierValue& repeatX = repeatXCSSValue.isInitialValue() ? initialRepeatValue : toCSSIdentifierValue(repeatXCSSValue);
+ const CSSIdentifierValue& repeatY = repeatYCSSValue.isInitialValue() ? initialRepeatValue : toCSSIdentifierValue(repeatYCSSValue);
CSSValueID repeatXValueId = repeatX.getValueID();
CSSValueID repeatYValueId = repeatY.getValueID();
if (repeatXValueId == repeatYValueId) {
@@ -850,7 +851,7 @@ String StylePropertySerializer::backgroundRepeatPropertyValue() const
if (repeatX.isValueList()) {
repeatXList = &toCSSValueList(repeatX);
repeatXLength = repeatXList->length();
- } else if (!repeatX.isPrimitiveValue()) {
+ } else if (!repeatX.isIdentifierValue()) {
return String();
}
@@ -859,7 +860,7 @@ String StylePropertySerializer::backgroundRepeatPropertyValue() const
if (repeatY.isValueList()) {
repeatYList = &toCSSValueList(repeatY);
repeatYLength = repeatYList->length();
- } else if (!repeatY.isPrimitiveValue()) {
+ } else if (!repeatY.isIdentifierValue()) {
return String();
}
« no previous file with comments | « third_party/WebKit/Source/core/css/MediaQueryExp.cpp ('k') | third_party/WebKit/Source/core/css/StylePropertySet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698