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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 case Contain: | 168 case Contain: |
169 case Cover: | 169 case Cover: |
170 case SizeNone: | 170 case SizeNone: |
171 return AnimatableUnknown::create(CSSPrimitiveValue::create(fillSize.type
)); | 171 return AnimatableUnknown::create(CSSPrimitiveValue::create(fillSize.type
)); |
172 default: | 172 default: |
173 ASSERT_NOT_REACHED(); | 173 ASSERT_NOT_REACHED(); |
174 return 0; | 174 return 0; |
175 } | 175 } |
176 } | 176 } |
177 | 177 |
| 178 inline static PassRefPtr<AnimatableValue> createFromBackgroundPosition(const Len
gth& length, bool originIsSet, BackgroundEdgeOrigin origin, const RenderStyle& s
tyle) |
| 179 { |
| 180 if (!originIsSet || origin == LeftEdge || origin == TopEdge) |
| 181 return createFromLength(length, style); |
| 182 |
| 183 return AnimatableLength::create(CSSCalcValue::createExpressionNode( |
| 184 CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(100, CSSPri
mitiveValue::CSS_PERCENTAGE), true), |
| 185 CSSCalcValue::createExpressionNode(length, style.effectiveZoom()), |
| 186 CalcSubtract)); |
| 187 } |
| 188 |
178 template<CSSPropertyID property> | 189 template<CSSPropertyID property> |
179 inline static PassRefPtr<AnimatableValue> createFromFillLayers(const FillLayer*
fillLayer, const RenderStyle& style) | 190 inline static PassRefPtr<AnimatableValue> createFromFillLayers(const FillLayer*
fillLayer, const RenderStyle& style) |
180 { | 191 { |
181 ASSERT(fillLayer); | 192 ASSERT(fillLayer); |
182 Vector<RefPtr<AnimatableValue> > values; | 193 Vector<RefPtr<AnimatableValue> > values; |
183 while (fillLayer) { | 194 while (fillLayer) { |
184 if (property == CSSPropertyBackgroundImage || property == CSSPropertyWeb
kitMaskImage) { | 195 if (property == CSSPropertyBackgroundImage || property == CSSPropertyWeb
kitMaskImage) { |
185 if (!fillLayer->isImageSet()) | 196 if (!fillLayer->isImageSet()) |
186 break; | 197 break; |
187 values.append(createFromStyleImage(fillLayer->image())); | 198 values.append(createFromStyleImage(fillLayer->image())); |
188 } else if (property == CSSPropertyBackgroundPositionX || property == CSS
PropertyWebkitMaskPositionX) { | 199 } else if (property == CSSPropertyBackgroundPositionX || property == CSS
PropertyWebkitMaskPositionX) { |
189 if (!fillLayer->isXPositionSet()) | 200 if (!fillLayer->isXPositionSet()) |
190 break; | 201 break; |
191 values.append(createFromLength(fillLayer->xPosition(), style)); | 202 values.append(createFromBackgroundPosition(fillLayer->xPosition(), f
illLayer->isBackgroundXOriginSet(), fillLayer->backgroundXOrigin(), style)); |
192 } else if (property == CSSPropertyBackgroundPositionY || property == CSS
PropertyWebkitMaskPositionY) { | 203 } else if (property == CSSPropertyBackgroundPositionY || property == CSS
PropertyWebkitMaskPositionY) { |
193 if (!fillLayer->isYPositionSet()) | 204 if (!fillLayer->isYPositionSet()) |
194 break; | 205 break; |
195 values.append(createFromLength(fillLayer->yPosition(), style)); | 206 values.append(createFromBackgroundPosition(fillLayer->yPosition(), f
illLayer->isBackgroundYOriginSet(), fillLayer->backgroundYOrigin(), style)); |
196 } else if (property == CSSPropertyBackgroundSize || property == CSSPrope
rtyWebkitMaskSize) { | 207 } else if (property == CSSPropertyBackgroundSize || property == CSSPrope
rtyWebkitMaskSize) { |
197 if (!fillLayer->isSizeSet()) | 208 if (!fillLayer->isSizeSet()) |
198 break; | 209 break; |
199 values.append(createFromFillSize(fillLayer->size(), style)); | 210 values.append(createFromFillSize(fillLayer->size(), style)); |
200 } else { | 211 } else { |
201 ASSERT_NOT_REACHED(); | 212 ASSERT_NOT_REACHED(); |
202 } | 213 } |
203 fillLayer = fillLayer->next(); | 214 fillLayer = fillLayer->next(); |
204 } | 215 } |
205 return AnimatableRepeatable::create(values); | 216 return AnimatableRepeatable::create(values); |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 case CSSPropertyZoom: | 460 case CSSPropertyZoom: |
450 return createFromDouble(style.zoom()); | 461 return createFromDouble(style.zoom()); |
451 default: | 462 default: |
452 ASSERT_NOT_REACHED(); | 463 ASSERT_NOT_REACHED(); |
453 // This return value is to avoid a release crash if possible. | 464 // This return value is to avoid a release crash if possible. |
454 return AnimatableUnknown::create(0); | 465 return AnimatableUnknown::create(0); |
455 } | 466 } |
456 } | 467 } |
457 | 468 |
458 } // namespace WebCore | 469 } // namespace WebCore |
OLD | NEW |