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

Side by Side Diff: Source/core/animation/css/CSSAnimatableValueFactory.cpp

Issue 381473002: Use reference for FillLayer if possible (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 } 177 }
178 178
179 inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromBackgroundPositi on(const Length& length, bool originIsSet, BackgroundEdgeOrigin origin, const Re nderStyle& style) 179 inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromBackgroundPositi on(const Length& length, bool originIsSet, BackgroundEdgeOrigin origin, const Re nderStyle& style)
180 { 180 {
181 if (!originIsSet || origin == LeftEdge || origin == TopEdge) 181 if (!originIsSet || origin == LeftEdge || origin == TopEdge)
182 return createFromLength(length, style); 182 return createFromLength(length, style);
183 return createFromLength(length.subtractFromOneHundredPercent(), style); 183 return createFromLength(length.subtractFromOneHundredPercent(), style);
184 } 184 }
185 185
186 template<CSSPropertyID property> 186 template<CSSPropertyID property>
187 inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromFillLayers(const FillLayer* fillLayer, const RenderStyle& style) 187 inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromFillLayers(const FillLayer& fillLayers, const RenderStyle& style)
188 { 188 {
189 ASSERT(fillLayer);
190 WillBeHeapVector<RefPtrWillBeMember<AnimatableValue> > values; 189 WillBeHeapVector<RefPtrWillBeMember<AnimatableValue> > values;
191 while (fillLayer) { 190 for (const FillLayer* fillLayer = &fillLayers; fillLayer; fillLayer = fillLa yer->next()) {
192 if (property == CSSPropertyBackgroundImage || property == CSSPropertyWeb kitMaskImage) { 191 if (property == CSSPropertyBackgroundImage || property == CSSPropertyWeb kitMaskImage) {
193 if (!fillLayer->isImageSet()) 192 if (!fillLayer->isImageSet())
194 break; 193 break;
195 values.append(createFromStyleImage(fillLayer->image())); 194 values.append(createFromStyleImage(fillLayer->image()));
196 } else if (property == CSSPropertyBackgroundPositionX || property == CSS PropertyWebkitMaskPositionX) { 195 } else if (property == CSSPropertyBackgroundPositionX || property == CSS PropertyWebkitMaskPositionX) {
197 if (!fillLayer->isXPositionSet()) 196 if (!fillLayer->isXPositionSet())
198 break; 197 break;
199 values.append(createFromBackgroundPosition(fillLayer->xPosition(), f illLayer->isBackgroundXOriginSet(), fillLayer->backgroundXOrigin(), style)); 198 values.append(createFromBackgroundPosition(fillLayer->xPosition(), f illLayer->isBackgroundXOriginSet(), fillLayer->backgroundXOrigin(), style));
200 } else if (property == CSSPropertyBackgroundPositionY || property == CSS PropertyWebkitMaskPositionY) { 199 } else if (property == CSSPropertyBackgroundPositionY || property == CSS PropertyWebkitMaskPositionY) {
201 if (!fillLayer->isYPositionSet()) 200 if (!fillLayer->isYPositionSet())
202 break; 201 break;
203 values.append(createFromBackgroundPosition(fillLayer->yPosition(), f illLayer->isBackgroundYOriginSet(), fillLayer->backgroundYOrigin(), style)); 202 values.append(createFromBackgroundPosition(fillLayer->yPosition(), f illLayer->isBackgroundYOriginSet(), fillLayer->backgroundYOrigin(), style));
204 } else if (property == CSSPropertyBackgroundSize || property == CSSPrope rtyWebkitMaskSize) { 203 } else if (property == CSSPropertyBackgroundSize || property == CSSPrope rtyWebkitMaskSize) {
205 if (!fillLayer->isSizeSet()) 204 if (!fillLayer->isSizeSet())
206 break; 205 break;
207 values.append(createFromFillSize(fillLayer->size(), style)); 206 values.append(createFromFillSize(fillLayer->size(), style));
208 } else { 207 } else {
209 ASSERT_NOT_REACHED(); 208 ASSERT_NOT_REACHED();
210 } 209 }
211 fillLayer = fillLayer->next();
212 } 210 }
213 return AnimatableRepeatable::create(values); 211 return AnimatableRepeatable::create(values);
214 } 212 }
215 213
216 PassRefPtrWillBeRawPtr<AnimatableValue> CSSAnimatableValueFactory::createFromCol or(CSSPropertyID property, const RenderStyle& style) 214 PassRefPtrWillBeRawPtr<AnimatableValue> CSSAnimatableValueFactory::createFromCol or(CSSPropertyID property, const RenderStyle& style)
217 { 215 {
218 Color color = style.colorIncludingFallback(property, false); 216 Color color = style.colorIncludingFallback(property, false);
219 Color visitedLinkColor = style.colorIncludingFallback(property, true); 217 Color visitedLinkColor = style.colorIncludingFallback(property, true);
220 return AnimatableColor::create(color, visitedLinkColor); 218 return AnimatableColor::create(color, visitedLinkColor);
221 } 219 }
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 case CSSPropertyZoom: 511 case CSSPropertyZoom:
514 return createFromDouble(style.zoom()); 512 return createFromDouble(style.zoom());
515 default: 513 default:
516 ASSERT_NOT_REACHED(); 514 ASSERT_NOT_REACHED();
517 // This return value is to avoid a release crash if possible. 515 // This return value is to avoid a release crash if possible.
518 return AnimatableUnknown::create(nullptr); 516 return AnimatableUnknown::create(nullptr);
519 } 517 }
520 } 518 }
521 519
522 } // namespace WebCore 520 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl ('k') | Source/core/animation/css/CSSPropertyEquality.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698