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

Side by Side Diff: third_party/WebKit/Source/core/animation/LengthListPropertyFunctions.cpp

Issue 2794013002: Fewer reused duplicate symbol names in animation. (Closed)
Patch Set: Created 3 years, 8 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/animation/LengthListPropertyFunctions.h" 5 #include "core/animation/LengthListPropertyFunctions.h"
6 6
7 #include "core/style/ComputedStyle.h" 7 #include "core/style/ComputedStyle.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
11 namespace { 11 namespace {
12 12
13 const FillLayer* getFillLayer(CSSPropertyID property, 13 const FillLayer* getFillLayerForPos(CSSPropertyID property,
alancutter (OOO until 2018) 2017/04/04 00:15:20 s/Pos/Position/
14 const ComputedStyle& style) { 14 const ComputedStyle& style) {
15 switch (property) { 15 switch (property) {
16 case CSSPropertyBackgroundPositionX: 16 case CSSPropertyBackgroundPositionX:
17 case CSSPropertyBackgroundPositionY: 17 case CSSPropertyBackgroundPositionY:
18 return &style.backgroundLayers(); 18 return &style.backgroundLayers();
19 case CSSPropertyWebkitMaskPositionX: 19 case CSSPropertyWebkitMaskPositionX:
20 case CSSPropertyWebkitMaskPositionY: 20 case CSSPropertyWebkitMaskPositionY:
21 return &style.maskLayers(); 21 return &style.maskLayers();
22 default: 22 default:
23 NOTREACHED(); 23 NOTREACHED();
24 return nullptr; 24 return nullptr;
25 } 25 }
26 } 26 }
27 27
28 FillLayer* accessFillLayer(CSSPropertyID property, ComputedStyle& style) { 28 FillLayer* accessFillLayerForPos(CSSPropertyID property, ComputedStyle& style) {
alancutter (OOO until 2018) 2017/04/04 00:15:20 s/Pos/Position/
29 switch (property) { 29 switch (property) {
30 case CSSPropertyBackgroundPositionX: 30 case CSSPropertyBackgroundPositionX:
31 case CSSPropertyBackgroundPositionY: 31 case CSSPropertyBackgroundPositionY:
32 return &style.accessBackgroundLayers(); 32 return &style.accessBackgroundLayers();
33 case CSSPropertyWebkitMaskPositionX: 33 case CSSPropertyWebkitMaskPositionX:
34 case CSSPropertyWebkitMaskPositionY: 34 case CSSPropertyWebkitMaskPositionY:
35 return &style.accessMaskLayers(); 35 return &style.accessMaskLayers();
36 default: 36 default:
37 NOTREACHED(); 37 NOTREACHED();
38 return nullptr; 38 return nullptr;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 return appendToVector(style.borderTopLeftRadius(), result); 152 return appendToVector(style.borderTopLeftRadius(), result);
153 case CSSPropertyBorderTopRightRadius: 153 case CSSPropertyBorderTopRightRadius:
154 return appendToVector(style.borderTopRightRadius(), result); 154 return appendToVector(style.borderTopRightRadius(), result);
155 case CSSPropertyTransformOrigin: 155 case CSSPropertyTransformOrigin:
156 return appendToVector(style.transformOrigin(), result); 156 return appendToVector(style.transformOrigin(), result);
157 157
158 case CSSPropertyBackgroundPositionX: 158 case CSSPropertyBackgroundPositionX:
159 case CSSPropertyBackgroundPositionY: 159 case CSSPropertyBackgroundPositionY:
160 case CSSPropertyWebkitMaskPositionX: 160 case CSSPropertyWebkitMaskPositionX:
161 case CSSPropertyWebkitMaskPositionY: { 161 case CSSPropertyWebkitMaskPositionY: {
162 const FillLayer* fillLayer = getFillLayer(property, style); 162 const FillLayer* fillLayer = getFillLayerForPos(property, style);
163 FillLayerMethods fillLayerMethods(property); 163 FillLayerMethods fillLayerMethods(property);
164 while (fillLayer && (fillLayer->*fillLayerMethods.isSet)()) { 164 while (fillLayer && (fillLayer->*fillLayerMethods.isSet)()) {
165 result.push_back((fillLayer->*fillLayerMethods.getLength)()); 165 result.push_back((fillLayer->*fillLayerMethods.getLength)());
166 switch ((fillLayer->*fillLayerMethods.getEdge)()) { 166 switch ((fillLayer->*fillLayerMethods.getEdge)()) {
167 case RightEdge: 167 case RightEdge:
168 case BottomEdge: 168 case BottomEdge:
169 result.back() = result.back().subtractFromOneHundredPercent(); 169 result.back() = result.back().subtractFromOneHundredPercent();
170 break; 170 break;
171 default: 171 default:
172 break; 172 break;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 return; 234 return;
235 235
236 case CSSPropertyTransformOrigin: 236 case CSSPropertyTransformOrigin:
237 style.setTransformOrigin(transformOriginFromVector(lengthList)); 237 style.setTransformOrigin(transformOriginFromVector(lengthList));
238 return; 238 return;
239 239
240 case CSSPropertyBackgroundPositionX: 240 case CSSPropertyBackgroundPositionX:
241 case CSSPropertyBackgroundPositionY: 241 case CSSPropertyBackgroundPositionY:
242 case CSSPropertyWebkitMaskPositionX: 242 case CSSPropertyWebkitMaskPositionX:
243 case CSSPropertyWebkitMaskPositionY: { 243 case CSSPropertyWebkitMaskPositionY: {
244 FillLayer* fillLayer = accessFillLayer(property, style); 244 FillLayer* fillLayer = accessFillLayerForPos(property, style);
245 FillLayer* prev = nullptr; 245 FillLayer* prev = nullptr;
246 FillLayerMethods fillLayerMethods(property); 246 FillLayerMethods fillLayerMethods(property);
247 for (size_t i = 0; i < lengthList.size(); i++) { 247 for (size_t i = 0; i < lengthList.size(); i++) {
248 if (!fillLayer) 248 if (!fillLayer)
249 fillLayer = prev->ensureNext(); 249 fillLayer = prev->ensureNext();
250 (fillLayer->*fillLayerMethods.setLength)(lengthList[i]); 250 (fillLayer->*fillLayerMethods.setLength)(lengthList[i]);
251 prev = fillLayer; 251 prev = fillLayer;
252 fillLayer = fillLayer->next(); 252 fillLayer = fillLayer->next();
253 } 253 }
254 while (fillLayer) { 254 while (fillLayer) {
255 (fillLayer->*fillLayerMethods.clear)(); 255 (fillLayer->*fillLayerMethods.clear)();
256 fillLayer = fillLayer->next(); 256 fillLayer = fillLayer->next();
257 } 257 }
258 return; 258 return;
259 } 259 }
260 260
261 default: 261 default:
262 NOTREACHED(); 262 NOTREACHED();
263 break; 263 break;
264 } 264 }
265 } 265 }
266 266
267 } // namespace blink 267 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698