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

Side by Side Diff: Source/core/css/resolver/AnimatedStyleBuilder.cpp

Issue 405093002: Slightly simplify building FillLayer objects (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
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
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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } 144 }
145 145
146 template <CSSPropertyID property> 146 template <CSSPropertyID property>
147 void setOnFillLayers(FillLayer& fillLayers, const AnimatableValue* value, StyleR esolverState& state) 147 void setOnFillLayers(FillLayer& fillLayers, const AnimatableValue* value, StyleR esolverState& state)
148 { 148 {
149 const WillBeHeapVector<RefPtrWillBeMember<AnimatableValue> >& values = toAni matableRepeatable(value)->values(); 149 const WillBeHeapVector<RefPtrWillBeMember<AnimatableValue> >& values = toAni matableRepeatable(value)->values();
150 ASSERT(!values.isEmpty()); 150 ASSERT(!values.isEmpty());
151 FillLayer* fillLayer = &fillLayers; 151 FillLayer* fillLayer = &fillLayers;
152 FillLayer* prev = 0; 152 FillLayer* prev = 0;
153 for (size_t i = 0; i < values.size(); ++i) { 153 for (size_t i = 0; i < values.size(); ++i) {
154 if (!fillLayer) { 154 if (!fillLayer)
155 switch (property) { 155 fillLayer = prev->ensureNext();
156 case CSSPropertyBackgroundImage:
157 case CSSPropertyBackgroundPositionX:
158 case CSSPropertyBackgroundPositionY:
159 case CSSPropertyBackgroundSize:
160 case CSSPropertyWebkitBackgroundSize:
161 fillLayer = new FillLayer(BackgroundFillLayer);
162 break;
163 case CSSPropertyWebkitMaskImage:
164 case CSSPropertyWebkitMaskPositionX:
165 case CSSPropertyWebkitMaskPositionY:
166 case CSSPropertyWebkitMaskSize:
167 fillLayer = new FillLayer(MaskFillLayer);
168 break;
169 default:
170 ASSERT_NOT_REACHED();
171 }
172 prev->setNext(fillLayer);
173 }
174 const AnimatableValue* layerValue = values[i].get(); 156 const AnimatableValue* layerValue = values[i].get();
175 switch (property) { 157 switch (property) {
176 case CSSPropertyBackgroundImage: 158 case CSSPropertyBackgroundImage:
177 case CSSPropertyWebkitMaskImage: 159 case CSSPropertyWebkitMaskImage:
178 if (layerValue->isImage()) { 160 if (layerValue->isImage()) {
179 fillLayer->setImage(state.styleImage(property, toAnimatableImage (layerValue)->toCSSValue())); 161 fillLayer->setImage(state.styleImage(property, toAnimatableImage (layerValue)->toCSSValue()));
180 } else { 162 } else {
181 ASSERT(toAnimatableUnknown(layerValue)->toCSSValueID() == CSSVal ueNone); 163 ASSERT(toAnimatableUnknown(layerValue)->toCSSValueID() == CSSVal ueNone);
182 fillLayer->setImage(nullptr); 164 fillLayer->setImage(nullptr);
183 } 165 }
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 return; 613 return;
632 case CSSPropertyZoom: 614 case CSSPropertyZoom:
633 style->setZoom(clampTo<float>(toAnimatableDouble(value)->toDouble(), std ::numeric_limits<float>::denorm_min())); 615 style->setZoom(clampTo<float>(toAnimatableDouble(value)->toDouble(), std ::numeric_limits<float>::denorm_min()));
634 return; 616 return;
635 default: 617 default:
636 ASSERT_NOT_REACHED(); 618 ASSERT_NOT_REACHED();
637 } 619 }
638 } 620 }
639 621
640 } // namespace blink 622 } // namespace blink
OLDNEW
« no previous file with comments | « Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl ('k') | Source/core/rendering/style/FillLayer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698