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

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

Issue 1317523002: Changed Pair to be a CSSValue (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@add_const_to_primvalue
Patch Set: Fixed some callsites from bad rebase 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
Index: Source/core/css/resolver/StyleBuilderConverter.cpp
diff --git a/Source/core/css/resolver/StyleBuilderConverter.cpp b/Source/core/css/resolver/StyleBuilderConverter.cpp
index 7e062acd2763ede8b2590fc24d513d93b1e9aba2..9f77e6de866acd31aa923ec61ea7263bfe531d8f 100644
--- a/Source/core/css/resolver/StyleBuilderConverter.cpp
+++ b/Source/core/css/resolver/StyleBuilderConverter.cpp
@@ -36,7 +36,7 @@
#include "core/css/CSSQuadValue.h"
#include "core/css/CSSReflectValue.h"
#include "core/css/CSSShadowValue.h"
-#include "core/css/Pair.h"
+#include "core/css/CSSValuePair.h"
#include "core/svg/SVGElement.h"
#include "core/svg/SVGURIReference.h"
#include "platform/transforms/RotateTransformOperation.h"
@@ -335,17 +335,18 @@ EGlyphOrientation StyleBuilderConverter::convertGlyphOrientation(StyleResolverSt
StyleSelfAlignmentData StyleBuilderConverter::convertSelfOrDefaultAlignmentData(StyleResolverState&, CSSValue* value)
{
StyleSelfAlignmentData alignmentData = ComputedStyle::initialSelfAlignment();
- CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
- if (Pair* pairValue = primitiveValue->getPairValue()) {
- if (pairValue->first()->getValueID() == CSSValueLegacy) {
+ if (value->isValuePair()) {
+ const CSSValuePair* pair = toCSSValuePair(value);
+ if (toCSSPrimitiveValue(pair->first())->getValueID() == CSSValueLegacy) {
alignmentData.setPositionType(LegacyPosition);
- alignmentData.setPosition(*pairValue->second());
+ alignmentData.setPosition(*toCSSPrimitiveValue(pair->second()));
} else {
- alignmentData.setPosition(*pairValue->first());
- alignmentData.setOverflow(*pairValue->second());
+ alignmentData.setPosition(*toCSSPrimitiveValue(pair->first()));
+ alignmentData.setOverflow(*toCSSPrimitiveValue(pair->second()));
}
} else {
- alignmentData.setPosition(*primitiveValue);
+ ASSERT(value->isPrimitiveValue());
Timothy Loh 2015/08/28 05:51:46 toCSSPrimitiveValue will do this assertion
sashab 2015/08/31 00:33:51 Just wanted to make it explicit, but you're right.
+ alignmentData.setPosition(*toCSSPrimitiveValue(value));
}
return alignmentData;
}
@@ -634,23 +635,24 @@ float StyleBuilderConverter::convertNumberOrPercentage(StyleResolverState& state
}
template <CSSValueID cssValueFor0, CSSValueID cssValueFor100>
-static Length convertPositionLength(StyleResolverState& state, CSSPrimitiveValue* primitiveValue)
+static Length convertPositionLength(StyleResolverState& state, CSSValue* value)
{
- if (Pair* pair = primitiveValue->getPairValue()) {
+ if (value->isValuePair()) {
+ const CSSValuePair* pair = toCSSValuePair(value);
Length length = StyleBuilderConverter::convertLength(state, pair->second());
- if (pair->first()->getValueID() == cssValueFor0)
+ if (toCSSPrimitiveValue(pair->first())->getValueID() == cssValueFor0)
return length;
- ASSERT(pair->first()->getValueID() == cssValueFor100);
+ ASSERT(toCSSPrimitiveValue(pair->first())->getValueID() == cssValueFor100);
return length.subtractFromOneHundredPercent();
}
- return StyleBuilderConverter::convertLength(state, primitiveValue);
+ ASSERT(value->isPrimitiveValue());
Timothy Loh 2015/08/28 05:51:46 convertLength will do all the relevant assertions
sashab 2015/08/31 00:33:51 Done.
+ return StyleBuilderConverter::convertLength(state, value);
}
LengthPoint StyleBuilderConverter::convertPosition(StyleResolverState& state, CSSValue* value)
{
- CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
- Pair* pair = primitiveValue->getPairValue();
+ const CSSValuePair* pair = toCSSValuePair(value);
return LengthPoint(
convertPositionLength<CSSValueLeft, CSSValueRight>(state, pair->first()),
convertPositionLength<CSSValueTop, CSSValueBottom>(state, pair->second())
@@ -752,10 +754,9 @@ PassRefPtr<QuotesData> StyleBuilderConverter::convertQuotes(StyleResolverState&,
LengthSize StyleBuilderConverter::convertRadius(StyleResolverState& state, CSSValue* value)
{
- CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
- Pair* pair = primitiveValue->getPairValue();
- Length radiusWidth = pair->first()->convertToLength(state.cssToLengthConversionData());
- Length radiusHeight = pair->second()->convertToLength(state.cssToLengthConversionData());
+ const CSSValuePair* pair = toCSSValuePair(value);
+ 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);

Powered by Google App Engine
This is Rietveld 408576698