| OLD | NEW |
| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 127 |
| 128 template <CSSPropertyID property> | 128 template <CSSPropertyID property> |
| 129 void setFillSize(FillLayer* fillLayer, const AnimatableValue* value, const Style
ResolverState& state) | 129 void setFillSize(FillLayer* fillLayer, const AnimatableValue* value, const Style
ResolverState& state) |
| 130 { | 130 { |
| 131 if (value->isLengthSize()) | 131 if (value->isLengthSize()) |
| 132 fillLayer->setSize(FillSize(SizeLength, animatableValueToLengthSize(valu
e, state, NonNegativeValues))); | 132 fillLayer->setSize(FillSize(SizeLength, animatableValueToLengthSize(valu
e, state, NonNegativeValues))); |
| 133 else | 133 else |
| 134 state.styleMap().mapFillSize(property, fillLayer, toAnimatableUnknown(va
lue)->toCSSValue().get()); | 134 state.styleMap().mapFillSize(property, fillLayer, toAnimatableUnknown(va
lue)->toCSSValue().get()); |
| 135 } | 135 } |
| 136 | 136 |
| 137 SVGLength animatableValueToNonNegativeSVGLength(const AnimatableValue* value) | 137 PassRefPtr<SVGLength> animatableValueToNonNegativeSVGLength(const AnimatableValu
e* value) |
| 138 { | 138 { |
| 139 SVGLength length = toAnimatableSVGLength(value)->toSVGLength(); | 139 RefPtr<SVGLength> length = toAnimatableSVGLength(value)->toSVGLength(); |
| 140 if (length.valueInSpecifiedUnits() < 0) | 140 if (length->valueInSpecifiedUnits() < 0) |
| 141 length.setValueInSpecifiedUnits(0); | 141 length->setValueInSpecifiedUnits(0); |
| 142 return length; | 142 return length.release(); |
| 143 } | 143 } |
| 144 | 144 |
| 145 template <CSSPropertyID property> | 145 template <CSSPropertyID property> |
| 146 void setOnFillLayers(FillLayer* fillLayer, const AnimatableValue* value, StyleRe
solverState& state) | 146 void setOnFillLayers(FillLayer* fillLayer, const AnimatableValue* value, StyleRe
solverState& state) |
| 147 { | 147 { |
| 148 const Vector<RefPtr<AnimatableValue> >& values = toAnimatableRepeatable(valu
e)->values(); | 148 const Vector<RefPtr<AnimatableValue> >& values = toAnimatableRepeatable(valu
e)->values(); |
| 149 ASSERT(!values.isEmpty()); | 149 ASSERT(!values.isEmpty()); |
| 150 FillLayer* prev = 0; | 150 FillLayer* prev = 0; |
| 151 for (size_t i = 0; i < values.size(); ++i) { | 151 for (size_t i = 0; i < values.size(); ++i) { |
| 152 if (!fillLayer) { | 152 if (!fillLayer) { |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 case CSSPropertyStrokeWidth: | 437 case CSSPropertyStrokeWidth: |
| 438 style->setStrokeWidth(animatableValueToNonNegativeSVGLength(value)); | 438 style->setStrokeWidth(animatableValueToNonNegativeSVGLength(value)); |
| 439 return; | 439 return; |
| 440 case CSSPropertyStopColor: | 440 case CSSPropertyStopColor: |
| 441 style->setStopColor(toAnimatableColor(value)->color()); | 441 style->setStopColor(toAnimatableColor(value)->color()); |
| 442 return; | 442 return; |
| 443 case CSSPropertyStopOpacity: | 443 case CSSPropertyStopOpacity: |
| 444 style->setStopOpacity(clampTo<float>(toAnimatableDouble(value)->toDouble
(), 0, 1)); | 444 style->setStopOpacity(clampTo<float>(toAnimatableDouble(value)->toDouble
(), 0, 1)); |
| 445 return; | 445 return; |
| 446 case CSSPropertyStrokeDasharray: | 446 case CSSPropertyStrokeDasharray: |
| 447 style->setStrokeDashArray(toAnimatableStrokeDasharrayList(value)->toSVGL
engthVector()); | 447 style->setStrokeDashArray(toAnimatableStrokeDasharrayList(value)->toSVGL
engthList()); |
| 448 return; | 448 return; |
| 449 case CSSPropertyStrokeDashoffset: | 449 case CSSPropertyStrokeDashoffset: |
| 450 style->setStrokeDashOffset(toAnimatableSVGLength(value)->toSVGLength()); | 450 style->setStrokeDashOffset(toAnimatableSVGLength(value)->toSVGLength()); |
| 451 return; | 451 return; |
| 452 case CSSPropertyStrokeMiterlimit: | 452 case CSSPropertyStrokeMiterlimit: |
| 453 style->setStrokeMiterLimit(clampTo<float>(toAnimatableDouble(value)->toD
ouble(), 1)); | 453 style->setStrokeMiterLimit(clampTo<float>(toAnimatableDouble(value)->toD
ouble(), 1)); |
| 454 return; | 454 return; |
| 455 case CSSPropertyStrokeOpacity: | 455 case CSSPropertyStrokeOpacity: |
| 456 style->setStrokeOpacity(clampTo<float>(toAnimatableDouble(value)->toDoub
le(), 0, 1)); | 456 style->setStrokeOpacity(clampTo<float>(toAnimatableDouble(value)->toDoub
le(), 0, 1)); |
| 457 return; | 457 return; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 return; | 588 return; |
| 589 case CSSPropertyZoom: | 589 case CSSPropertyZoom: |
| 590 style->setZoom(clampTo<float>(toAnimatableDouble(value)->toDouble(), std
::numeric_limits<float>::denorm_min())); | 590 style->setZoom(clampTo<float>(toAnimatableDouble(value)->toDouble(), std
::numeric_limits<float>::denorm_min())); |
| 591 return; | 591 return; |
| 592 default: | 592 default: |
| 593 ASSERT_NOT_REACHED(); | 593 ASSERT_NOT_REACHED(); |
| 594 } | 594 } |
| 595 } | 595 } |
| 596 | 596 |
| 597 } // namespace WebCore | 597 } // namespace WebCore |
| OLD | NEW |