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

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

Issue 55813002: Convert animation and renderer code to know about BorderImageLength (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@length-relative-die-step-1-4
Patch Set: Rebased on top of patch set #2 of https://codereview.chromium.org/55783002/ 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 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 } 95 }
96 ASSERT_NOT_REACHED(); 96 ASSERT_NOT_REACHED();
97 return 0; 97 return 0;
98 } 98 }
99 99
100 inline static PassRefPtr<AnimatableValue> createFromDouble(double value, Animata bleDouble::Constraint constraint = AnimatableDouble::Unconstrained) 100 inline static PassRefPtr<AnimatableValue> createFromDouble(double value, Animata bleDouble::Constraint constraint = AnimatableDouble::Unconstrained)
101 { 101 {
102 return AnimatableDouble::create(value, constraint); 102 return AnimatableDouble::create(value, constraint);
103 } 103 }
104 104
105 static PassRefPtr<AnimatableValue> createFromBorderImageLength(const BorderImage Length& borderImageLength, const RenderStyle* style)
106 {
107 if (borderImageLength.isNumber())
108 return createFromDouble(borderImageLength.number());
109 return createFromLength(borderImageLength.length(), style);
110 }
111
112 inline static PassRefPtr<AnimatableValue> createFromBorderImageLengthBox(const B orderImageLengthBox& borderImageLengthBox, const RenderStyle* style)
113 {
114 return AnimatableLengthBox::create(
115 createFromBorderImageLength(borderImageLengthBox.left(), style),
116 createFromBorderImageLength(borderImageLengthBox.right(), style),
117 createFromBorderImageLength(borderImageLengthBox.top(), style),
118 createFromBorderImageLength(borderImageLengthBox.bottom(), style));
119 }
120
105 inline static PassRefPtr<AnimatableValue> createFromLengthBox(const LengthBox& l engthBox, const RenderStyle* style) 121 inline static PassRefPtr<AnimatableValue> createFromLengthBox(const LengthBox& l engthBox, const RenderStyle* style)
106 { 122 {
107 return AnimatableLengthBox::create( 123 return AnimatableLengthBox::create(
108 createFromLength(lengthBox.left(), style), 124 createFromLength(lengthBox.left(), style),
109 createFromLength(lengthBox.right(), style), 125 createFromLength(lengthBox.right(), style),
110 createFromLength(lengthBox.top(), style), 126 createFromLength(lengthBox.top(), style),
111 createFromLength(lengthBox.bottom(), style)); 127 createFromLength(lengthBox.bottom(), style));
112 } 128 }
113 129
114 inline static PassRefPtr<AnimatableValue> createFromLengthBoxAndBool(const Lengt hBox lengthBox, const bool flag, const RenderStyle *style) 130 inline static PassRefPtr<AnimatableValue> createFromLengthBoxAndBool(const Lengt hBox lengthBox, const bool flag, const RenderStyle *style)
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 return AnimatableSVGLength::create(style->baselineShiftValue()); 238 return AnimatableSVGLength::create(style->baselineShiftValue());
223 case CSSPropertyBorderBottomColor: 239 case CSSPropertyBorderBottomColor:
224 return createFromColor(property, style); 240 return createFromColor(property, style);
225 case CSSPropertyBorderBottomLeftRadius: 241 case CSSPropertyBorderBottomLeftRadius:
226 return createFromLengthSize(style->borderBottomLeftRadius(), style); 242 return createFromLengthSize(style->borderBottomLeftRadius(), style);
227 case CSSPropertyBorderBottomRightRadius: 243 case CSSPropertyBorderBottomRightRadius:
228 return createFromLengthSize(style->borderBottomRightRadius(), style); 244 return createFromLengthSize(style->borderBottomRightRadius(), style);
229 case CSSPropertyBorderBottomWidth: 245 case CSSPropertyBorderBottomWidth:
230 return createFromDouble(style->borderBottomWidth()); 246 return createFromDouble(style->borderBottomWidth());
231 case CSSPropertyBorderImageOutset: 247 case CSSPropertyBorderImageOutset:
232 return createFromLengthBox(style->borderImageOutset(), style); 248 return createFromBorderImageLengthBox(style->borderImageOutset(), style) ;
233 case CSSPropertyBorderImageSlice: 249 case CSSPropertyBorderImageSlice:
234 return createFromLengthBox(style->borderImageSlices(), style); 250 return createFromLengthBox(style->borderImageSlices(), style);
235 case CSSPropertyBorderImageSource: 251 case CSSPropertyBorderImageSource:
236 return createFromStyleImage(style->borderImageSource()); 252 return createFromStyleImage(style->borderImageSource());
237 case CSSPropertyBorderImageWidth: 253 case CSSPropertyBorderImageWidth:
238 return createFromLengthBox(style->borderImageWidth(), style); 254 return createFromBorderImageLengthBox(style->borderImageWidth(), style);
239 case CSSPropertyBorderLeftColor: 255 case CSSPropertyBorderLeftColor:
240 return createFromColor(property, style); 256 return createFromColor(property, style);
241 case CSSPropertyBorderLeftWidth: 257 case CSSPropertyBorderLeftWidth:
242 return createFromDouble(style->borderLeftWidth()); 258 return createFromDouble(style->borderLeftWidth());
243 case CSSPropertyBorderRightColor: 259 case CSSPropertyBorderRightColor:
244 return createFromColor(property, style); 260 return createFromColor(property, style);
245 case CSSPropertyBorderRightWidth: 261 case CSSPropertyBorderRightWidth:
246 return createFromDouble(style->borderRightWidth()); 262 return createFromDouble(style->borderRightWidth());
247 case CSSPropertyBorderTopColor: 263 case CSSPropertyBorderTopColor:
248 return createFromColor(property, style); 264 return createFromColor(property, style);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 return createFromDouble(style->columnGap()); 385 return createFromDouble(style->columnGap());
370 case CSSPropertyWebkitColumnRuleColor: 386 case CSSPropertyWebkitColumnRuleColor:
371 return createFromColor(property, style); 387 return createFromColor(property, style);
372 case CSSPropertyWebkitColumnRuleWidth: 388 case CSSPropertyWebkitColumnRuleWidth:
373 return createFromDouble(style->columnRuleWidth()); 389 return createFromDouble(style->columnRuleWidth());
374 case CSSPropertyWebkitColumnWidth: 390 case CSSPropertyWebkitColumnWidth:
375 return createFromDouble(style->columnWidth()); 391 return createFromDouble(style->columnWidth());
376 case CSSPropertyWebkitFilter: 392 case CSSPropertyWebkitFilter:
377 return AnimatableFilterOperations::create(style->filter()); 393 return AnimatableFilterOperations::create(style->filter());
378 case CSSPropertyWebkitMaskBoxImageOutset: 394 case CSSPropertyWebkitMaskBoxImageOutset:
379 return createFromLengthBox(style->maskBoxImageOutset(), style); 395 return createFromBorderImageLengthBox(style->maskBoxImageOutset(), style );
380 case CSSPropertyWebkitMaskBoxImageSlice: 396 case CSSPropertyWebkitMaskBoxImageSlice:
381 return createFromLengthBoxAndBool(style->maskBoxImageSlices(), style->ma skBoxImageSlicesFill(), style); 397 return createFromLengthBoxAndBool(style->maskBoxImageSlices(), style->ma skBoxImageSlicesFill(), style);
382 case CSSPropertyWebkitMaskBoxImageSource: 398 case CSSPropertyWebkitMaskBoxImageSource:
383 return createFromStyleImage(style->maskBoxImageSource()); 399 return createFromStyleImage(style->maskBoxImageSource());
384 case CSSPropertyWebkitMaskBoxImageWidth: 400 case CSSPropertyWebkitMaskBoxImageWidth:
385 return createFromLengthBox(style->maskBoxImageWidth(), style); 401 return createFromBorderImageLengthBox(style->maskBoxImageWidth(), style) ;
386 case CSSPropertyWebkitMaskImage: 402 case CSSPropertyWebkitMaskImage:
387 return createFromFillLayers<CSSPropertyWebkitMaskImage>(style->maskLayer s(), style); 403 return createFromFillLayers<CSSPropertyWebkitMaskImage>(style->maskLayer s(), style);
388 case CSSPropertyWebkitMaskPositionX: 404 case CSSPropertyWebkitMaskPositionX:
389 return createFromFillLayers<CSSPropertyWebkitMaskPositionX>(style->maskL ayers(), style); 405 return createFromFillLayers<CSSPropertyWebkitMaskPositionX>(style->maskL ayers(), style);
390 case CSSPropertyWebkitMaskPositionY: 406 case CSSPropertyWebkitMaskPositionY:
391 return createFromFillLayers<CSSPropertyWebkitMaskPositionY>(style->maskL ayers(), style); 407 return createFromFillLayers<CSSPropertyWebkitMaskPositionY>(style->maskL ayers(), style);
392 case CSSPropertyWebkitMaskSize: 408 case CSSPropertyWebkitMaskSize:
393 return createFromFillLayers<CSSPropertyWebkitMaskSize>(style->maskLayers (), style); 409 return createFromFillLayers<CSSPropertyWebkitMaskSize>(style->maskLayers (), style);
394 case CSSPropertyWebkitPerspective: 410 case CSSPropertyWebkitPerspective:
395 return createFromDouble(style->perspective()); 411 return createFromDouble(style->perspective());
(...skipping 30 matching lines...) Expand all
426 case CSSPropertyZoom: 442 case CSSPropertyZoom:
427 return createFromDouble(style->zoom()); 443 return createFromDouble(style->zoom());
428 default: 444 default:
429 RELEASE_ASSERT_WITH_MESSAGE(!CSSAnimations::isAnimatableProperty(propert y), "Web Animations not yet implemented: Create AnimatableValue from render styl e: %s", getPropertyNameString(property).utf8().data()); 445 RELEASE_ASSERT_WITH_MESSAGE(!CSSAnimations::isAnimatableProperty(propert y), "Web Animations not yet implemented: Create AnimatableValue from render styl e: %s", getPropertyNameString(property).utf8().data());
430 ASSERT_NOT_REACHED(); 446 ASSERT_NOT_REACHED();
431 return 0; 447 return 0;
432 } 448 }
433 } 449 }
434 450
435 } // namespace WebCore 451 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/css/resolver/AnimatedStyleBuilder.cpp » ('j') | Source/core/frame/animation/CSSPropertyAnimation.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698