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

Unified Diff: Source/core/css/resolver/StyleBuilderConverter.cpp

Issue 1318543010: Change first() and second() in CSSPairValue to return const references (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Review feedback Created 5 years, 4 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/resolver/CSSToStyleMap.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/resolver/StyleBuilderConverter.cpp
diff --git a/Source/core/css/resolver/StyleBuilderConverter.cpp b/Source/core/css/resolver/StyleBuilderConverter.cpp
index fa1e67bdf00a06827f6069ce38529d66ab80c0f0..d0683518e72437f921956d5e62aaa5389bf1b636 100644
--- a/Source/core/css/resolver/StyleBuilderConverter.cpp
+++ b/Source/core/css/resolver/StyleBuilderConverter.cpp
@@ -337,12 +337,12 @@ StyleSelfAlignmentData StyleBuilderConverter::convertSelfOrDefaultAlignmentData(
StyleSelfAlignmentData alignmentData = ComputedStyle::initialSelfAlignment();
if (value->isValuePair()) {
const CSSValuePair* pair = toCSSValuePair(value);
- if (toCSSPrimitiveValue(pair->first())->getValueID() == CSSValueLegacy) {
+ if (toCSSPrimitiveValue(pair->first()).getValueID() == CSSValueLegacy) {
alignmentData.setPositionType(LegacyPosition);
- alignmentData.setPosition(*toCSSPrimitiveValue(pair->second()));
+ alignmentData.setPosition(toCSSPrimitiveValue(pair->second()));
} else {
- alignmentData.setPosition(*toCSSPrimitiveValue(pair->first()));
- alignmentData.setOverflow(*toCSSPrimitiveValue(pair->second()));
+ alignmentData.setPosition(toCSSPrimitiveValue(pair->first()));
+ alignmentData.setOverflow(toCSSPrimitiveValue(pair->second()));
}
} else {
alignmentData.setPosition(*toCSSPrimitiveValue(value));
@@ -536,10 +536,10 @@ UnzoomedLength StyleBuilderConverter::convertUnzoomedLength(const StyleResolverS
Length StyleBuilderConverter::convertLengthOrAuto(const StyleResolverState& state, CSSValue* value)
{
- CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
- if (primitiveValue->getValueID() == CSSValueAuto)
+ const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(*value);
+ if (primitiveValue.getValueID() == CSSValueAuto)
return Length(Auto);
- return primitiveValue->convertToLength(state.cssToLengthConversionData());
+ return primitiveValue.convertToLength(state.cssToLengthConversionData());
}
Length StyleBuilderConverter::convertLengthSizing(StyleResolverState& state, CSSValue* value)
@@ -637,11 +637,11 @@ template <CSSValueID cssValueFor0, CSSValueID cssValueFor100>
static Length convertPositionLength(StyleResolverState& state, CSSValue* value)
{
if (value->isValuePair()) {
- const CSSValuePair* pair = toCSSValuePair(value);
- Length length = StyleBuilderConverter::convertLength(state, pair->second());
- if (toCSSPrimitiveValue(pair->first())->getValueID() == cssValueFor0)
+ CSSValuePair* pair = toCSSValuePair(value);
+ Length length = StyleBuilderConverter::convertLength(state, &pair->second());
+ if (toCSSPrimitiveValue(pair->first()).getValueID() == cssValueFor0)
return length;
- ASSERT(toCSSPrimitiveValue(pair->first())->getValueID() == cssValueFor100);
+ ASSERT(toCSSPrimitiveValue(pair->first()).getValueID() == cssValueFor100);
return length.subtractFromOneHundredPercent();
}
@@ -650,10 +650,10 @@ static Length convertPositionLength(StyleResolverState& state, CSSValue* value)
LengthPoint StyleBuilderConverter::convertPosition(StyleResolverState& state, CSSValue* value)
{
- const CSSValuePair* pair = toCSSValuePair(value);
+ CSSValuePair* pair = toCSSValuePair(value);
return LengthPoint(
- convertPositionLength<CSSValueLeft, CSSValueRight>(state, pair->first()),
- convertPositionLength<CSSValueTop, CSSValueBottom>(state, pair->second())
+ convertPositionLength<CSSValueLeft, CSSValueRight>(state, &pair->first()),
+ convertPositionLength<CSSValueTop, CSSValueBottom>(state, &pair->second())
);
}
@@ -753,8 +753,8 @@ PassRefPtr<QuotesData> StyleBuilderConverter::convertQuotes(StyleResolverState&,
LengthSize StyleBuilderConverter::convertRadius(StyleResolverState& state, CSSValue* value)
{
const CSSValuePair* pair = toCSSValuePair(value);
- Length radiusWidth = toCSSPrimitiveValue(pair->first())->convertToLength(state.cssToLengthConversionData());
- Length radiusHeight = toCSSPrimitiveValue(pair->second())->convertToLength(state.cssToLengthConversionData());
+ Length radiusWidth = toCSSPrimitiveValue(pair->first()).convertToLength(state.cssToLengthConversionData());
+ Length radiusHeight = toCSSPrimitiveValue(pair->second()).convertToLength(state.cssToLengthConversionData());
float width = radiusWidth.value();
float height = radiusHeight.value();
ASSERT(width >= 0 && height >= 0);
@@ -834,8 +834,7 @@ PassRefPtr<SVGDashArray> StyleBuilderConverter::convertStrokeDasharray(StyleReso
RefPtr<SVGDashArray> array = SVGDashArray::create();
size_t length = dashes->length();
for (size_t i = 0; i < length; ++i) {
- CSSPrimitiveValue* dash = toCSSPrimitiveValue(dashes->item(i));
- array->append(convertLength(state, dash));
+ array->append(convertLength(state, toCSSPrimitiveValue(dashes->item(i))));
}
return array.release();
« no previous file with comments | « Source/core/css/resolver/CSSToStyleMap.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698