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

Unified Diff: Source/core/animation/css/CSSAnimatableValueFactory.cpp

Issue 57643004: Pass RenderStyle / RenderObject by reference in more places (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase on master Created 7 years, 1 month 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/animation/css/CSSAnimatableValueFactory.h ('k') | Source/core/animation/css/CSSAnimations.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/css/CSSAnimatableValueFactory.cpp
diff --git a/Source/core/animation/css/CSSAnimatableValueFactory.cpp b/Source/core/animation/css/CSSAnimatableValueFactory.cpp
index 2fd7dba3afc9942aac8efcec0ca66870a668ad43..5a733f81dc18ba4ce88b87473c38d55f310003c7 100644
--- a/Source/core/animation/css/CSSAnimatableValueFactory.cpp
+++ b/Source/core/animation/css/CSSAnimatableValueFactory.cpp
@@ -61,7 +61,7 @@
namespace WebCore {
-static PassRefPtr<AnimatableValue> createFromLength(const Length& length, const RenderStyle* style)
+static PassRefPtr<AnimatableValue> createFromLength(const Length& length, const RenderStyle& style)
{
switch (length.type()) {
case Fixed:
@@ -77,7 +77,7 @@ static PassRefPtr<AnimatableValue> createFromLength(const Length& length, const
case ViewportPercentageMax:
return AnimatableLength::create(length.value(), AnimatableLength::UnitTypeViewportMax);
case Calculated:
- return AnimatableLength::create(CSSCalcValue::createExpressionNode(length.calculationValue()->expression(), style->effectiveZoom()));
+ return AnimatableLength::create(CSSCalcValue::createExpressionNode(length.calculationValue()->expression(), style.effectiveZoom()));
case Auto:
case Intrinsic:
case MinIntrinsic:
@@ -97,7 +97,7 @@ static PassRefPtr<AnimatableValue> createFromLength(const Length& length, const
return 0;
}
-static PassRefPtr<AnimatableValue> createFromLineHeight(const Length& length, const RenderStyle* style)
+static PassRefPtr<AnimatableValue> createFromLineHeight(const Length& length, const RenderStyle& style)
{
double value = length.value();
switch (length.type()) {
@@ -119,7 +119,7 @@ inline static PassRefPtr<AnimatableValue> createFromDouble(double value, Animata
return AnimatableDouble::create(value, constraint);
}
-inline static PassRefPtr<AnimatableValue> createFromLengthBox(const LengthBox& lengthBox, const RenderStyle* style)
+inline static PassRefPtr<AnimatableValue> createFromLengthBox(const LengthBox& lengthBox, const RenderStyle& style)
{
return AnimatableLengthBox::create(
createFromLength(lengthBox.left(), style),
@@ -128,21 +128,21 @@ inline static PassRefPtr<AnimatableValue> createFromLengthBox(const LengthBox& l
createFromLength(lengthBox.bottom(), style));
}
-inline static PassRefPtr<AnimatableValue> createFromLengthBoxAndBool(const LengthBox lengthBox, const bool flag, const RenderStyle *style)
+inline static PassRefPtr<AnimatableValue> createFromLengthBoxAndBool(const LengthBox lengthBox, const bool flag, const RenderStyle& style)
{
return AnimatableLengthBoxAndBool::create(
createFromLengthBox(lengthBox, style),
flag);
}
-inline static PassRefPtr<AnimatableValue> createFromLengthPoint(const LengthPoint& lengthPoint, const RenderStyle* style)
+inline static PassRefPtr<AnimatableValue> createFromLengthPoint(const LengthPoint& lengthPoint, const RenderStyle& style)
{
return AnimatableLengthPoint::create(
createFromLength(lengthPoint.x(), style),
createFromLength(lengthPoint.y(), style));
}
-inline static PassRefPtr<AnimatableValue> createFromLengthSize(const LengthSize& lengthSize, const RenderStyle* style)
+inline static PassRefPtr<AnimatableValue> createFromLengthSize(const LengthSize& lengthSize, const RenderStyle& style)
{
return AnimatableLengthSize::create(
createFromLength(lengthSize.width(), style),
@@ -156,7 +156,7 @@ inline static PassRefPtr<AnimatableValue> createFromStyleImage(StyleImage* image
return AnimatableUnknown::create(CSSValueNone);
}
-inline static PassRefPtr<AnimatableValue> createFromFillSize(const FillSize& fillSize, const RenderStyle* style)
+inline static PassRefPtr<AnimatableValue> createFromFillSize(const FillSize& fillSize, const RenderStyle& style)
{
switch (fillSize.type) {
case SizeLength:
@@ -172,7 +172,7 @@ inline static PassRefPtr<AnimatableValue> createFromFillSize(const FillSize& fil
}
template<CSSPropertyID property>
-inline static PassRefPtr<AnimatableValue> createFromFillLayers(const FillLayer* fillLayer, const RenderStyle* style)
+inline static PassRefPtr<AnimatableValue> createFromFillLayers(const FillLayer* fillLayer, const RenderStyle& style)
{
ASSERT(fillLayer);
Vector<RefPtr<AnimatableValue> > values;
@@ -201,12 +201,12 @@ inline static PassRefPtr<AnimatableValue> createFromFillLayers(const FillLayer*
return AnimatableRepeatable::create(values);
}
-PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::createFromColor(CSSPropertyID property, const RenderStyle* style)
+PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::createFromColor(CSSPropertyID property, const RenderStyle& style)
{
- Color color = style->colorIncludingFallback(property, false);
- Color visitedLinkColor = style->colorIncludingFallback(property, true);
- Color fallbackColor = style->color();
- Color fallbackVisitedLinkColor = style->visitedLinkColor();
+ Color color = style.colorIncludingFallback(property, false);
+ Color visitedLinkColor = style.colorIncludingFallback(property, true);
+ Color fallbackColor = style.color();
+ Color fallbackVisitedLinkColor = style.visitedLinkColor();
Color resolvedColor;
if (color.isValid())
resolvedColor = color;
@@ -221,229 +221,229 @@ PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::createFromColor(CSSProper
}
// FIXME: Generate this function.
-PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::create(CSSPropertyID property, const RenderStyle* style)
+PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::create(CSSPropertyID property, const RenderStyle& style)
{
switch (property) {
case CSSPropertyBackgroundColor:
return createFromColor(property, style);
case CSSPropertyBackgroundImage:
- return createFromFillLayers<CSSPropertyBackgroundImage>(style->backgroundLayers(), style);
+ return createFromFillLayers<CSSPropertyBackgroundImage>(style.backgroundLayers(), style);
case CSSPropertyBackgroundPositionX:
- return createFromFillLayers<CSSPropertyBackgroundPositionX>(style->backgroundLayers(), style);
+ return createFromFillLayers<CSSPropertyBackgroundPositionX>(style.backgroundLayers(), style);
case CSSPropertyBackgroundPositionY:
- return createFromFillLayers<CSSPropertyBackgroundPositionY>(style->backgroundLayers(), style);
+ return createFromFillLayers<CSSPropertyBackgroundPositionY>(style.backgroundLayers(), style);
case CSSPropertyBackgroundSize:
case CSSPropertyWebkitBackgroundSize:
- return createFromFillLayers<CSSPropertyBackgroundSize>(style->backgroundLayers(), style);
+ return createFromFillLayers<CSSPropertyBackgroundSize>(style.backgroundLayers(), style);
case CSSPropertyBaselineShift:
- return AnimatableSVGLength::create(style->baselineShiftValue());
+ return AnimatableSVGLength::create(style.baselineShiftValue());
case CSSPropertyBorderBottomColor:
return createFromColor(property, style);
case CSSPropertyBorderBottomLeftRadius:
- return createFromLengthSize(style->borderBottomLeftRadius(), style);
+ return createFromLengthSize(style.borderBottomLeftRadius(), style);
case CSSPropertyBorderBottomRightRadius:
- return createFromLengthSize(style->borderBottomRightRadius(), style);
+ return createFromLengthSize(style.borderBottomRightRadius(), style);
case CSSPropertyBorderBottomWidth:
- return createFromDouble(style->borderBottomWidth());
+ return createFromDouble(style.borderBottomWidth());
case CSSPropertyBorderImageOutset:
- return createFromLengthBox(style->borderImageOutset(), style);
+ return createFromLengthBox(style.borderImageOutset(), style);
case CSSPropertyBorderImageSlice:
- return createFromLengthBox(style->borderImageSlices(), style);
+ return createFromLengthBox(style.borderImageSlices(), style);
case CSSPropertyBorderImageSource:
- return createFromStyleImage(style->borderImageSource());
+ return createFromStyleImage(style.borderImageSource());
case CSSPropertyBorderImageWidth:
- return createFromLengthBox(style->borderImageWidth(), style);
+ return createFromLengthBox(style.borderImageWidth(), style);
case CSSPropertyBorderLeftColor:
return createFromColor(property, style);
case CSSPropertyBorderLeftWidth:
- return createFromDouble(style->borderLeftWidth());
+ return createFromDouble(style.borderLeftWidth());
case CSSPropertyBorderRightColor:
return createFromColor(property, style);
case CSSPropertyBorderRightWidth:
- return createFromDouble(style->borderRightWidth());
+ return createFromDouble(style.borderRightWidth());
case CSSPropertyBorderTopColor:
return createFromColor(property, style);
case CSSPropertyBorderTopLeftRadius:
- return createFromLengthSize(style->borderTopLeftRadius(), style);
+ return createFromLengthSize(style.borderTopLeftRadius(), style);
case CSSPropertyBorderTopRightRadius:
- return createFromLengthSize(style->borderTopRightRadius(), style);
+ return createFromLengthSize(style.borderTopRightRadius(), style);
case CSSPropertyBorderTopWidth:
- return createFromDouble(style->borderTopWidth());
+ return createFromDouble(style.borderTopWidth());
case CSSPropertyBottom:
- return createFromLength(style->bottom(), style);
+ return createFromLength(style.bottom(), style);
case CSSPropertyBoxShadow:
case CSSPropertyWebkitBoxShadow:
- return AnimatableShadow::create(style->boxShadow());
+ return AnimatableShadow::create(style.boxShadow());
case CSSPropertyClip:
- if (style->hasClip())
- return createFromLengthBox(style->clip(), style);
+ if (style.hasClip())
+ return createFromLengthBox(style.clip(), style);
return AnimatableUnknown::create(CSSPrimitiveValue::create(CSSValueAuto));
case CSSPropertyColor:
return createFromColor(property, style);
case CSSPropertyFillOpacity:
- return createFromDouble(style->fillOpacity());
+ return createFromDouble(style.fillOpacity());
case CSSPropertyFill:
- return AnimatableSVGPaint::create(style->svgStyle()->fillPaintType(), style->svgStyle()->fillPaintColor(), style->svgStyle()->fillPaintUri());
+ return AnimatableSVGPaint::create(style.svgStyle()->fillPaintType(), style.svgStyle()->fillPaintColor(), style.svgStyle()->fillPaintUri());
case CSSPropertyFlexGrow:
- return createFromDouble(style->flexGrow(), AnimatableDouble::InterpolationIsNonContinuousWithZero);
+ return createFromDouble(style.flexGrow(), AnimatableDouble::InterpolationIsNonContinuousWithZero);
case CSSPropertyFlexShrink:
- return createFromDouble(style->flexShrink(), AnimatableDouble::InterpolationIsNonContinuousWithZero);
+ return createFromDouble(style.flexShrink(), AnimatableDouble::InterpolationIsNonContinuousWithZero);
case CSSPropertyFlexBasis:
- return createFromLength(style->flexBasis(), style);
+ return createFromLength(style.flexBasis(), style);
case CSSPropertyFloodColor:
return createFromColor(property, style);
case CSSPropertyFloodOpacity:
- return createFromDouble(style->floodOpacity());
+ return createFromDouble(style.floodOpacity());
case CSSPropertyFontSize:
// Must pass a specified size to setFontSize if Text Autosizing is enabled, but a computed size
// if text zoom is enabled (if neither is enabled it's irrelevant as they're probably the same).
// FIXME: Should we introduce an option to pass the computed font size here, allowing consumers to
// enable text zoom rather than Text Autosizing? See http://crbug.com/227545.
- return createFromDouble(style->specifiedFontSize());
+ return createFromDouble(style.specifiedFontSize());
case CSSPropertyHeight:
- return createFromLength(style->height(), style);
+ return createFromLength(style.height(), style);
case CSSPropertyKerning:
- return AnimatableSVGLength::create(style->kerning());
+ return AnimatableSVGLength::create(style.kerning());
case CSSPropertyLightingColor:
return createFromColor(property, style);
case CSSPropertyListStyleImage:
- return createFromStyleImage(style->listStyleImage());
+ return createFromStyleImage(style.listStyleImage());
case CSSPropertyLeft:
- return createFromLength(style->left(), style);
+ return createFromLength(style.left(), style);
case CSSPropertyLetterSpacing:
- return createFromDouble(style->letterSpacing());
+ return createFromDouble(style.letterSpacing());
case CSSPropertyLineHeight:
- return createFromLineHeight(style->specifiedLineHeight(), style);
+ return createFromLineHeight(style.specifiedLineHeight(), style);
case CSSPropertyMarginBottom:
- return createFromLength(style->marginBottom(), style);
+ return createFromLength(style.marginBottom(), style);
case CSSPropertyMarginLeft:
- return createFromLength(style->marginLeft(), style);
+ return createFromLength(style.marginLeft(), style);
case CSSPropertyMarginRight:
- return createFromLength(style->marginRight(), style);
+ return createFromLength(style.marginRight(), style);
case CSSPropertyMarginTop:
- return createFromLength(style->marginTop(), style);
+ return createFromLength(style.marginTop(), style);
case CSSPropertyMaxHeight:
- return createFromLength(style->maxHeight(), style);
+ return createFromLength(style.maxHeight(), style);
case CSSPropertyMaxWidth:
- return createFromLength(style->maxWidth(), style);
+ return createFromLength(style.maxWidth(), style);
case CSSPropertyMinHeight:
- return createFromLength(style->minHeight(), style);
+ return createFromLength(style.minHeight(), style);
case CSSPropertyMinWidth:
- return createFromLength(style->minWidth(), style);
+ return createFromLength(style.minWidth(), style);
case CSSPropertyObjectPosition:
- return createFromLengthPoint(style->objectPosition(), style);
+ return createFromLengthPoint(style.objectPosition(), style);
case CSSPropertyOpacity:
- return createFromDouble(style->opacity());
+ return createFromDouble(style.opacity());
case CSSPropertyOrphans:
- return createFromDouble(style->orphans());
+ return createFromDouble(style.orphans());
case CSSPropertyOutlineColor:
return createFromColor(property, style);
case CSSPropertyOutlineOffset:
- return createFromDouble(style->outlineOffset());
+ return createFromDouble(style.outlineOffset());
case CSSPropertyOutlineWidth:
- return createFromDouble(style->outlineWidth());
+ return createFromDouble(style.outlineWidth());
case CSSPropertyPaddingBottom:
- return createFromLength(style->paddingBottom(), style);
+ return createFromLength(style.paddingBottom(), style);
case CSSPropertyPaddingLeft:
- return createFromLength(style->paddingLeft(), style);
+ return createFromLength(style.paddingLeft(), style);
case CSSPropertyPaddingRight:
- return createFromLength(style->paddingRight(), style);
+ return createFromLength(style.paddingRight(), style);
case CSSPropertyPaddingTop:
- return createFromLength(style->paddingTop(), style);
+ return createFromLength(style.paddingTop(), style);
case CSSPropertyRight:
- return createFromLength(style->right(), style);
+ return createFromLength(style.right(), style);
case CSSPropertyStrokeWidth:
- return AnimatableSVGLength::create(style->strokeWidth());
+ return AnimatableSVGLength::create(style.strokeWidth());
case CSSPropertyStopColor:
return createFromColor(property, style);
case CSSPropertyStopOpacity:
- return createFromDouble(style->stopOpacity());
+ return createFromDouble(style.stopOpacity());
case CSSPropertyStrokeDasharray:
- return AnimatableStrokeDasharrayList::create(style->strokeDashArray());
+ return AnimatableStrokeDasharrayList::create(style.strokeDashArray());
case CSSPropertyStrokeDashoffset:
- return AnimatableSVGLength::create(style->strokeDashOffset());
+ return AnimatableSVGLength::create(style.strokeDashOffset());
case CSSPropertyStrokeMiterlimit:
- return createFromDouble(style->strokeMiterLimit());
+ return createFromDouble(style.strokeMiterLimit());
case CSSPropertyStrokeOpacity:
- return createFromDouble(style->strokeOpacity());
+ return createFromDouble(style.strokeOpacity());
case CSSPropertyStroke:
- return AnimatableSVGPaint::create(style->svgStyle()->strokePaintType(), style->svgStyle()->strokePaintColor(), style->svgStyle()->strokePaintUri());
+ return AnimatableSVGPaint::create(style.svgStyle()->strokePaintType(), style.svgStyle()->strokePaintColor(), style.svgStyle()->strokePaintUri());
case CSSPropertyTextDecorationColor:
return createFromColor(property, style);
case CSSPropertyTextIndent:
- return createFromLength(style->textIndent(), style);
+ return createFromLength(style.textIndent(), style);
case CSSPropertyTextShadow:
- return AnimatableShadow::create(style->textShadow());
+ return AnimatableShadow::create(style.textShadow());
case CSSPropertyTop:
- return createFromLength(style->top(), style);
+ return createFromLength(style.top(), style);
case CSSPropertyWebkitBorderHorizontalSpacing:
- return createFromDouble(style->horizontalBorderSpacing());
+ return createFromDouble(style.horizontalBorderSpacing());
case CSSPropertyWebkitBorderVerticalSpacing:
- return createFromDouble(style->verticalBorderSpacing());
+ return createFromDouble(style.verticalBorderSpacing());
case CSSPropertyWebkitClipPath:
- return AnimatableClipPathOperation::create(style->clipPath());
+ return AnimatableClipPathOperation::create(style.clipPath());
case CSSPropertyWebkitColumnCount:
- return createFromDouble(style->columnCount());
+ return createFromDouble(style.columnCount());
case CSSPropertyWebkitColumnGap:
- return createFromDouble(style->columnGap());
+ return createFromDouble(style.columnGap());
case CSSPropertyWebkitColumnRuleColor:
return createFromColor(property, style);
case CSSPropertyWebkitColumnRuleWidth:
- return createFromDouble(style->columnRuleWidth());
+ return createFromDouble(style.columnRuleWidth());
case CSSPropertyWebkitColumnWidth:
- return createFromDouble(style->columnWidth());
+ return createFromDouble(style.columnWidth());
case CSSPropertyWebkitFilter:
- return AnimatableFilterOperations::create(style->filter());
+ return AnimatableFilterOperations::create(style.filter());
case CSSPropertyWebkitMaskBoxImageOutset:
- return createFromLengthBox(style->maskBoxImageOutset(), style);
+ return createFromLengthBox(style.maskBoxImageOutset(), style);
case CSSPropertyWebkitMaskBoxImageSlice:
- return createFromLengthBoxAndBool(style->maskBoxImageSlices(), style->maskBoxImageSlicesFill(), style);
+ return createFromLengthBoxAndBool(style.maskBoxImageSlices(), style.maskBoxImageSlicesFill(), style);
case CSSPropertyWebkitMaskBoxImageSource:
- return createFromStyleImage(style->maskBoxImageSource());
+ return createFromStyleImage(style.maskBoxImageSource());
case CSSPropertyWebkitMaskBoxImageWidth:
- return createFromLengthBox(style->maskBoxImageWidth(), style);
+ return createFromLengthBox(style.maskBoxImageWidth(), style);
case CSSPropertyWebkitMaskImage:
- return createFromFillLayers<CSSPropertyWebkitMaskImage>(style->maskLayers(), style);
+ return createFromFillLayers<CSSPropertyWebkitMaskImage>(style.maskLayers(), style);
case CSSPropertyWebkitMaskPositionX:
- return createFromFillLayers<CSSPropertyWebkitMaskPositionX>(style->maskLayers(), style);
+ return createFromFillLayers<CSSPropertyWebkitMaskPositionX>(style.maskLayers(), style);
case CSSPropertyWebkitMaskPositionY:
- return createFromFillLayers<CSSPropertyWebkitMaskPositionY>(style->maskLayers(), style);
+ return createFromFillLayers<CSSPropertyWebkitMaskPositionY>(style.maskLayers(), style);
case CSSPropertyWebkitMaskSize:
- return createFromFillLayers<CSSPropertyWebkitMaskSize>(style->maskLayers(), style);
+ return createFromFillLayers<CSSPropertyWebkitMaskSize>(style.maskLayers(), style);
case CSSPropertyWebkitPerspective:
- return createFromDouble(style->perspective());
+ return createFromDouble(style.perspective());
case CSSPropertyWebkitPerspectiveOriginX:
- return createFromLength(style->perspectiveOriginX(), style);
+ return createFromLength(style.perspectiveOriginX(), style);
case CSSPropertyWebkitPerspectiveOriginY:
- return createFromLength(style->perspectiveOriginY(), style);
+ return createFromLength(style.perspectiveOriginY(), style);
case CSSPropertyShapeInside:
- return AnimatableShapeValue::create(style->shapeInside());
+ return AnimatableShapeValue::create(style.shapeInside());
case CSSPropertyShapeOutside:
- return AnimatableShapeValue::create(style->shapeOutside());
+ return AnimatableShapeValue::create(style.shapeOutside());
case CSSPropertyShapeMargin:
- return createFromLength(style->shapeMargin(), style);
+ return createFromLength(style.shapeMargin(), style);
case CSSPropertyWebkitTextStrokeColor:
return createFromColor(property, style);
case CSSPropertyWebkitTransform:
- return AnimatableTransform::create(style->transform());
+ return AnimatableTransform::create(style.transform());
case CSSPropertyWebkitTransformOriginX:
- return createFromLength(style->transformOriginX(), style);
+ return createFromLength(style.transformOriginX(), style);
case CSSPropertyWebkitTransformOriginY:
- return createFromLength(style->transformOriginY(), style);
+ return createFromLength(style.transformOriginY(), style);
case CSSPropertyWebkitTransformOriginZ:
- return createFromDouble(style->transformOriginZ());
+ return createFromDouble(style.transformOriginZ());
case CSSPropertyWidows:
- return createFromDouble(style->widows());
+ return createFromDouble(style.widows());
case CSSPropertyWidth:
- return createFromLength(style->width(), style);
+ return createFromLength(style.width(), style);
case CSSPropertyWordSpacing:
- return createFromDouble(style->wordSpacing());
+ return createFromDouble(style.wordSpacing());
case CSSPropertyVisibility:
- return AnimatableVisibility::create(style->visibility());
+ return AnimatableVisibility::create(style.visibility());
case CSSPropertyZIndex:
- return createFromDouble(style->zIndex());
+ return createFromDouble(style.zIndex());
case CSSPropertyZoom:
- return createFromDouble(style->zoom());
+ return createFromDouble(style.zoom());
default:
ASSERT_WITH_MESSAGE(!CSSAnimations::isAnimatableProperty(property), "Web Animations not yet implemented: Create AnimatableValue from render style: %s", getPropertyNameString(property).utf8().data());
ASSERT_NOT_REACHED();
« no previous file with comments | « Source/core/animation/css/CSSAnimatableValueFactory.h ('k') | Source/core/animation/css/CSSAnimations.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698