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

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

Issue 1233363002: CSSValue Immediates: Replace CSSPrimitiveValue usage with const references (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cssvalue_patch_4_attempt_2
Patch Set: Rebase Created 5 years, 5 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
« no previous file with comments | « Source/core/css/StylePropertySerializer.h ('k') | Source/core/css/StylePropertySet.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/StylePropertySerializer.cpp
diff --git a/Source/core/css/StylePropertySerializer.cpp b/Source/core/css/StylePropertySerializer.cpp
index e2843e9247ec4d717869be55404e1516cefe6c7b..4b4c156f0c0b0f38570c5ef41cc3953264c99c41 100644
--- a/Source/core/css/StylePropertySerializer.cpp
+++ b/Source/core/css/StylePropertySerializer.cpp
@@ -142,7 +142,7 @@ String StylePropertySerializer::StylePropertySetForSerializer::getPropertyValue(
if (!hasExpandedAllProperty())
return m_propertySet.getPropertyValue(propertyID);
- const NullableCSSValue value = getPropertyCSSValue(propertyID);
+ const NullableCSSValue& value = getPropertyCSSValue(propertyID);
if (!value)
return String();
return value->cssText();
@@ -449,7 +449,7 @@ String StylePropertySerializer::getPropertyValue(CSSPropertyID propertyID) const
case CSSPropertyWebkitTextStroke:
return getShorthandValue(webkitTextStrokeShorthand());
case CSSPropertyMarker: {
- if (const NullableCSSValue value = m_propertySet.getPropertyCSSValue(CSSPropertyMarkerStart))
+ if (const NullableCSSValue& value = m_propertySet.getPropertyCSSValue(CSSPropertyMarkerStart))
return value->cssText();
return String();
}
@@ -462,8 +462,8 @@ String StylePropertySerializer::getPropertyValue(CSSPropertyID propertyID) const
String StylePropertySerializer::borderSpacingValue(const StylePropertyShorthand& shorthand) const
{
- const NullableCSSValue horizontalValue = m_propertySet.getPropertyCSSValue(shorthand.properties()[0]);
- const NullableCSSValue verticalValue = m_propertySet.getPropertyCSSValue(shorthand.properties()[1]);
+ const NullableCSSValue& horizontalValue = m_propertySet.getPropertyCSSValue(shorthand.properties()[0]);
+ const NullableCSSValue& verticalValue = m_propertySet.getPropertyCSSValue(shorthand.properties()[1]);
// While standard border-spacing property does not allow specifying border-spacing-vertical without
// specifying border-spacing-horizontal <http://www.w3.org/TR/CSS21/tables.html#separated-borders>,
@@ -522,8 +522,8 @@ String StylePropertySerializer::fontValue() const
if (fontSizePropertyIndex == -1 || fontFamilyPropertyIndex == -1)
return emptyString();
- PropertyValueForSerializer fontSizeProperty = m_propertySet.propertyAt(fontSizePropertyIndex);
- PropertyValueForSerializer fontFamilyProperty = m_propertySet.propertyAt(fontFamilyPropertyIndex);
+ const PropertyValueForSerializer& fontSizeProperty = m_propertySet.propertyAt(fontSizePropertyIndex);
+ const PropertyValueForSerializer& fontFamilyProperty = m_propertySet.propertyAt(fontFamilyPropertyIndex);
String commonValue = fontSizeProperty.value().cssText();
StringBuilder result;
@@ -727,7 +727,7 @@ String StylePropertySerializer::getShorthandValue(const StylePropertyShorthand&
String commonValue;
StringBuilder result;
for (unsigned i = 0; i < shorthand.length(); ++i) {
- const NullableCSSValue value = m_propertySet.getPropertyCSSValue(shorthand.properties()[i]);
+ const NullableCSSValue& value = m_propertySet.getPropertyCSSValue(shorthand.properties()[i]);
if (!value)
return String();
String valueText = value->cssText();
@@ -752,7 +752,7 @@ String StylePropertySerializer::getCommonValue(const StylePropertyShorthand& sho
String res;
bool lastPropertyWasImportant = false;
for (unsigned i = 0; i < shorthand.length(); ++i) {
- const NullableCSSValue value = m_propertySet.getPropertyCSSValue(shorthand.properties()[i]);
+ const NullableCSSValue& value = m_propertySet.getPropertyCSSValue(shorthand.properties()[i]);
// FIXME: CSSInitialValue::cssText should generate the right value.
if (!value)
return String();
@@ -804,8 +804,8 @@ static void appendBackgroundRepeatValue(StringBuilder& builder, const CSSValue&
{
// FIXME: Ensure initial values do not appear in CSS_VALUE_LISTS.
CSSPrimitiveValue initialRepeatValue = CSSPrimitiveValue::create(CSSValueRepeat);
- const CSSPrimitiveValue repeatX = repeatXCSSValue.isInitialValue() ? initialRepeatValue : toCSSPrimitiveValue(repeatXCSSValue);
- const CSSPrimitiveValue repeatY = repeatYCSSValue.isInitialValue() ? initialRepeatValue : toCSSPrimitiveValue(repeatYCSSValue);
+ const CSSPrimitiveValue& repeatX = repeatXCSSValue.isInitialValue() ? initialRepeatValue : toCSSPrimitiveValue(repeatXCSSValue);
+ const CSSPrimitiveValue& repeatY = repeatYCSSValue.isInitialValue() ? initialRepeatValue : toCSSPrimitiveValue(repeatYCSSValue);
CSSValueID repeatXValueId = repeatX.getValueID();
CSSValueID repeatYValueId = repeatY.getValueID();
if (repeatXValueId == repeatYValueId) {
@@ -823,8 +823,8 @@ static void appendBackgroundRepeatValue(StringBuilder& builder, const CSSValue&
String StylePropertySerializer::backgroundRepeatPropertyValue() const
{
- const NullableCSSValue repeatX = m_propertySet.getPropertyCSSValue(CSSPropertyBackgroundRepeatX);
- const NullableCSSValue repeatY = m_propertySet.getPropertyCSSValue(CSSPropertyBackgroundRepeatY);
+ const NullableCSSValue& repeatX = m_propertySet.getPropertyCSSValue(CSSPropertyBackgroundRepeatX);
+ const NullableCSSValue& repeatY = m_propertySet.getPropertyCSSValue(CSSPropertyBackgroundRepeatY);
if (!repeatX || !repeatY)
return String();
if (m_propertySet.propertyIsImportant(CSSPropertyBackgroundRepeatX) != m_propertySet.propertyIsImportant(CSSPropertyBackgroundRepeatY))
@@ -872,7 +872,7 @@ void StylePropertySerializer::appendBackgroundPropertyAsText(StringBuilder& resu
return;
}
if (shorthandHasOnlyInitialOrInheritedValue(backgroundShorthand())) {
- const NullableCSSValue value = m_propertySet.getPropertyCSSValue(CSSPropertyBackgroundImage);
+ const NullableCSSValue& value = m_propertySet.getPropertyCSSValue(CSSPropertyBackgroundImage);
ASSERT(value);
bool isImportant = m_propertySet.propertyIsImportant(CSSPropertyBackgroundImage);
result.append(getPropertyText(CSSPropertyBackground, value->cssText(), isImportant, numDecls++));
@@ -891,7 +891,7 @@ void StylePropertySerializer::appendBackgroundPropertyAsText(StringBuilder& resu
for (unsigned i = 0; i < WTF_ARRAY_LENGTH(backgroundPropertyIds); ++i) {
CSSPropertyID propertyID = backgroundPropertyIds[i];
- const NullableCSSValue value = m_propertySet.getPropertyCSSValue(propertyID);
+ const NullableCSSValue& value = m_propertySet.getPropertyCSSValue(propertyID);
if (!value)
continue;
result.append(getPropertyText(propertyID, value->cssText(), m_propertySet.propertyIsImportant(propertyID), numDecls++));
@@ -902,7 +902,7 @@ void StylePropertySerializer::appendBackgroundPropertyAsText(StringBuilder& resu
// would not work in Firefox (<rdar://problem/5143183>)
// It would be a better solution if background-position was CSS_PAIR.
if (shorthandHasOnlyInitialOrInheritedValue(backgroundPositionShorthand())) {
- const NullableCSSValue value = m_propertySet.getPropertyCSSValue(CSSPropertyBackgroundPositionX);
+ const NullableCSSValue& value = m_propertySet.getPropertyCSSValue(CSSPropertyBackgroundPositionX);
ASSERT(value);
bool isImportant = m_propertySet.propertyIsImportant(CSSPropertyBackgroundPositionX);
result.append(getPropertyText(CSSPropertyBackgroundPosition, value->cssText(), isImportant, numDecls++));
@@ -913,13 +913,13 @@ void StylePropertySerializer::appendBackgroundPropertyAsText(StringBuilder& resu
result.append(getPropertyText(CSSPropertyBackgroundPosition, positionValue, isImportant, numDecls++));
} else {
// should check background-position-x or background-position-y.
- if (const NullableCSSValue value = m_propertySet.getPropertyCSSValue(CSSPropertyBackgroundPositionX)) {
+ if (const NullableCSSValue& value = m_propertySet.getPropertyCSSValue(CSSPropertyBackgroundPositionX)) {
if (value && !value->isImplicitInitialValue()) {
bool isImportant = m_propertySet.propertyIsImportant(CSSPropertyBackgroundPositionX);
result.append(getPropertyText(CSSPropertyBackgroundPositionX, value->cssText(), isImportant, numDecls++));
}
}
- if (const NullableCSSValue value = m_propertySet.getPropertyCSSValue(CSSPropertyBackgroundPositionY)) {
+ if (const NullableCSSValue& value = m_propertySet.getPropertyCSSValue(CSSPropertyBackgroundPositionY)) {
if (value && !value->isImplicitInitialValue()) {
bool isImportant = m_propertySet.propertyIsImportant(CSSPropertyBackgroundPositionY);
result.append(getPropertyText(CSSPropertyBackgroundPositionY, value->cssText(), isImportant, numDecls++));
@@ -938,7 +938,7 @@ bool StylePropertySerializer::isPropertyShorthandAvailable(const StylePropertySh
bool isImportant = m_propertySet.propertyIsImportant(shorthand.properties()[0]);
for (unsigned i = 0; i < shorthand.length(); ++i) {
- const NullableCSSValue value = m_propertySet.getPropertyCSSValue(shorthand.properties()[i]);
+ const NullableCSSValue& value = m_propertySet.getPropertyCSSValue(shorthand.properties()[i]);
if (!value || (value->isInitialValue() && !value->isImplicitInitialValue()) || value->isInheritedValue())
return false;
if (isImportant != m_propertySet.propertyIsImportant(shorthand.properties()[i]))
@@ -954,7 +954,7 @@ bool StylePropertySerializer::shorthandHasOnlyInitialOrInheritedValue(const Styl
bool isInitialValue = true;
bool isInheritedValue = true;
for (unsigned i = 0; i < shorthand.length(); ++i) {
- const NullableCSSValue value = m_propertySet.getPropertyCSSValue(shorthand.properties()[i]);
+ const NullableCSSValue& value = m_propertySet.getPropertyCSSValue(shorthand.properties()[i]);
if (!value)
return false;
if (!value->isInitialValue())
« no previous file with comments | « Source/core/css/StylePropertySerializer.h ('k') | Source/core/css/StylePropertySet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698