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

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

Issue 1387113002: Change StyleResolverState.styleImage() to take a const CSSValue& (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added TODOs to replace the members with const members Created 5 years, 2 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 FillLayer* fillLayer = &fillLayers; 161 FillLayer* fillLayer = &fillLayers;
162 FillLayer* prev = 0; 162 FillLayer* prev = 0;
163 for (size_t i = 0; i < values.size(); ++i) { 163 for (size_t i = 0; i < values.size(); ++i) {
164 if (!fillLayer) 164 if (!fillLayer)
165 fillLayer = prev->ensureNext(); 165 fillLayer = prev->ensureNext();
166 const AnimatableValue* layerValue = values[i].get(); 166 const AnimatableValue* layerValue = values[i].get();
167 switch (property) { 167 switch (property) {
168 case CSSPropertyBackgroundImage: 168 case CSSPropertyBackgroundImage:
169 case CSSPropertyWebkitMaskImage: 169 case CSSPropertyWebkitMaskImage:
170 if (layerValue->isImage()) { 170 if (layerValue->isImage()) {
171 fillLayer->setImage(state.styleImage(property, toAnimatableImage (layerValue)->toCSSValue())); 171 fillLayer->setImage(state.styleImage(property, *toAnimatableImag e(layerValue)->toCSSValue()));
172 } else { 172 } else {
173 ASSERT(toAnimatableUnknown(layerValue)->toCSSValueID() == CSSVal ueNone); 173 ASSERT(toAnimatableUnknown(layerValue)->toCSSValueID() == CSSVal ueNone);
174 fillLayer->setImage(nullptr); 174 fillLayer->setImage(nullptr);
175 } 175 }
176 break; 176 break;
177 case CSSPropertyBackgroundPositionX: 177 case CSSPropertyBackgroundPositionX:
178 case CSSPropertyWebkitMaskPositionX: 178 case CSSPropertyWebkitMaskPositionX:
179 fillLayer->setXPosition(animatableValueToLength(layerValue, state)); 179 fillLayer->setXPosition(animatableValueToLength(layerValue, state));
180 break; 180 break;
181 case CSSPropertyBackgroundPositionY: 181 case CSSPropertyBackgroundPositionY:
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 style->setBorderBottomWidth(animatableValueClampTo<unsigned>(value)); 318 style->setBorderBottomWidth(animatableValueClampTo<unsigned>(value));
319 return; 319 return;
320 case CSSPropertyBorderImageOutset: 320 case CSSPropertyBorderImageOutset:
321 style->setBorderImageOutset(animatableValueToBorderImageLengthBox(value, state)); 321 style->setBorderImageOutset(animatableValueToBorderImageLengthBox(value, state));
322 return; 322 return;
323 case CSSPropertyBorderImageSlice: 323 case CSSPropertyBorderImageSlice:
324 style->setBorderImageSlices(animatableValueToLengthBox(toAnimatableLengt hBoxAndBool(value)->box(), state, ValueRangeNonNegative)); 324 style->setBorderImageSlices(animatableValueToLengthBox(toAnimatableLengt hBoxAndBool(value)->box(), state, ValueRangeNonNegative));
325 style->setBorderImageSlicesFill(toAnimatableLengthBoxAndBool(value)->fla g()); 325 style->setBorderImageSlicesFill(toAnimatableLengthBoxAndBool(value)->fla g());
326 return; 326 return;
327 case CSSPropertyBorderImageSource: 327 case CSSPropertyBorderImageSource:
328 style->setBorderImageSource(state.styleImage(property, toAnimatableImage (value)->toCSSValue())); 328 style->setBorderImageSource(state.styleImage(property, *toAnimatableImag e(value)->toCSSValue()));
329 return; 329 return;
330 case CSSPropertyBorderImageWidth: 330 case CSSPropertyBorderImageWidth:
331 style->setBorderImageWidth(animatableValueToBorderImageLengthBox(value, state)); 331 style->setBorderImageWidth(animatableValueToBorderImageLengthBox(value, state));
332 return; 332 return;
333 case CSSPropertyBorderLeftColor: 333 case CSSPropertyBorderLeftColor:
334 style->setBorderLeftColor(toAnimatableColor(value)->color()); 334 style->setBorderLeftColor(toAnimatableColor(value)->color());
335 style->setVisitedLinkBorderLeftColor(toAnimatableColor(value)->visitedLi nkColor()); 335 style->setVisitedLinkBorderLeftColor(toAnimatableColor(value)->visitedLi nkColor());
336 return; 336 return;
337 case CSSPropertyBorderLeftWidth: 337 case CSSPropertyBorderLeftWidth:
338 style->setBorderLeftWidth(animatableValueClampTo<unsigned>(value)); 338 style->setBorderLeftWidth(animatableValueClampTo<unsigned>(value));
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 case CSSPropertyLightingColor: 416 case CSSPropertyLightingColor:
417 style->setLightingColor(toAnimatableColor(value)->color()); 417 style->setLightingColor(toAnimatableColor(value)->color());
418 return; 418 return;
419 case CSSPropertyLineHeight: 419 case CSSPropertyLineHeight:
420 if (value->isLength()) 420 if (value->isLength())
421 style->setLineHeight(animatableValueToLength(value, state, ValueRang eNonNegative)); 421 style->setLineHeight(animatableValueToLength(value, state, ValueRang eNonNegative));
422 else 422 else
423 style->setLineHeight(Length(clampTo<float>(toAnimatableDouble(value) ->toDouble(), 0), Percent)); 423 style->setLineHeight(Length(clampTo<float>(toAnimatableDouble(value) ->toDouble(), 0), Percent));
424 return; 424 return;
425 case CSSPropertyListStyleImage: 425 case CSSPropertyListStyleImage:
426 style->setListStyleImage(state.styleImage(property, toAnimatableImage(va lue)->toCSSValue())); 426 style->setListStyleImage(state.styleImage(property, *toAnimatableImage(v alue)->toCSSValue()));
427 return; 427 return;
428 case CSSPropertyLetterSpacing: 428 case CSSPropertyLetterSpacing:
429 style->setLetterSpacing(clampTo<float>(toAnimatableDouble(value)->toDoub le())); 429 style->setLetterSpacing(clampTo<float>(toAnimatableDouble(value)->toDoub le()));
430 return; 430 return;
431 case CSSPropertyMarginBottom: 431 case CSSPropertyMarginBottom:
432 style->setMarginBottom(animatableValueToLength(value, state)); 432 style->setMarginBottom(animatableValueToLength(value, state));
433 return; 433 return;
434 case CSSPropertyMarginLeft: 434 case CSSPropertyMarginLeft:
435 style->setMarginLeft(animatableValueToLength(value, state)); 435 style->setMarginLeft(animatableValueToLength(value, state));
436 return; 436 return;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 style->setBackdropFilter(toAnimatableFilterOperations(value)->operations ()); 560 style->setBackdropFilter(toAnimatableFilterOperations(value)->operations ());
561 return; 561 return;
562 case CSSPropertyWebkitMaskBoxImageOutset: 562 case CSSPropertyWebkitMaskBoxImageOutset:
563 style->setMaskBoxImageOutset(animatableValueToBorderImageLengthBox(value , state)); 563 style->setMaskBoxImageOutset(animatableValueToBorderImageLengthBox(value , state));
564 return; 564 return;
565 case CSSPropertyWebkitMaskBoxImageSlice: 565 case CSSPropertyWebkitMaskBoxImageSlice:
566 style->setMaskBoxImageSlices(animatableValueToLengthBox(toAnimatableLeng thBoxAndBool(value)->box(), state, ValueRangeNonNegative)); 566 style->setMaskBoxImageSlices(animatableValueToLengthBox(toAnimatableLeng thBoxAndBool(value)->box(), state, ValueRangeNonNegative));
567 style->setMaskBoxImageSlicesFill(toAnimatableLengthBoxAndBool(value)->fl ag()); 567 style->setMaskBoxImageSlicesFill(toAnimatableLengthBoxAndBool(value)->fl ag());
568 return; 568 return;
569 case CSSPropertyWebkitMaskBoxImageSource: 569 case CSSPropertyWebkitMaskBoxImageSource:
570 style->setMaskBoxImageSource(state.styleImage(property, toAnimatableImag e(value)->toCSSValue())); 570 style->setMaskBoxImageSource(state.styleImage(property, *toAnimatableIma ge(value)->toCSSValue()));
571 return; 571 return;
572 case CSSPropertyWebkitMaskBoxImageWidth: 572 case CSSPropertyWebkitMaskBoxImageWidth:
573 style->setMaskBoxImageWidth(animatableValueToBorderImageLengthBox(value, state)); 573 style->setMaskBoxImageWidth(animatableValueToBorderImageLengthBox(value, state));
574 return; 574 return;
575 case CSSPropertyWebkitMaskImage: 575 case CSSPropertyWebkitMaskImage:
576 setOnFillLayers<CSSPropertyWebkitMaskImage>(style->accessMaskLayers(), v alue, state); 576 setOnFillLayers<CSSPropertyWebkitMaskImage>(style->accessMaskLayers(), v alue, state);
577 return; 577 return;
578 case CSSPropertyWebkitMaskPositionX: 578 case CSSPropertyWebkitMaskPositionX:
579 setOnFillLayers<CSSPropertyWebkitMaskPositionX>(style->accessMaskLayers( ), value, state); 579 setOnFillLayers<CSSPropertyWebkitMaskPositionX>(style->accessMaskLayers( ), value, state);
580 return; 580 return;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 case CSSPropertyRy: 694 case CSSPropertyRy:
695 style->setRy(animatableValueToLength(value, state, ValueRangeNonNegative )); 695 style->setRy(animatableValueToLength(value, state, ValueRangeNonNegative ));
696 return; 696 return;
697 697
698 default: 698 default:
699 ASSERT_NOT_REACHED(); 699 ASSERT_NOT_REACHED();
700 } 700 }
701 } 701 }
702 702
703 } // namespace blink 703 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698