| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 #include "core/animation/animatable/AnimatablePath.h" | 46 #include "core/animation/animatable/AnimatablePath.h" |
| 47 #include "core/animation/animatable/AnimatableRepeatable.h" | 47 #include "core/animation/animatable/AnimatableRepeatable.h" |
| 48 #include "core/animation/animatable/AnimatableSVGPaint.h" | 48 #include "core/animation/animatable/AnimatableSVGPaint.h" |
| 49 #include "core/animation/animatable/AnimatableShadow.h" | 49 #include "core/animation/animatable/AnimatableShadow.h" |
| 50 #include "core/animation/animatable/AnimatableShapeValue.h" | 50 #include "core/animation/animatable/AnimatableShapeValue.h" |
| 51 #include "core/animation/animatable/AnimatableStrokeDasharrayList.h" | 51 #include "core/animation/animatable/AnimatableStrokeDasharrayList.h" |
| 52 #include "core/animation/animatable/AnimatableTransform.h" | 52 #include "core/animation/animatable/AnimatableTransform.h" |
| 53 #include "core/animation/animatable/AnimatableUnknown.h" | 53 #include "core/animation/animatable/AnimatableUnknown.h" |
| 54 #include "core/animation/animatable/AnimatableVisibility.h" | 54 #include "core/animation/animatable/AnimatableVisibility.h" |
| 55 #include "core/css/CSSCalculationValue.h" | 55 #include "core/css/CSSCalculationValue.h" |
| 56 #include "core/css/CSSIdentifierValue.h" |
| 56 #include "core/css/CSSPrimitiveValue.h" | 57 #include "core/css/CSSPrimitiveValue.h" |
| 57 #include "core/css/CSSPrimitiveValueMappings.h" | 58 #include "core/css/CSSPrimitiveValueMappings.h" |
| 58 #include "core/css/CSSPropertyMetadata.h" | 59 #include "core/css/CSSPropertyMetadata.h" |
| 59 #include "core/style/ComputedStyle.h" | 60 #include "core/style/ComputedStyle.h" |
| 60 #include "platform/Length.h" | 61 #include "platform/Length.h" |
| 61 #include "platform/LengthBox.h" | 62 #include "platform/LengthBox.h" |
| 62 #include "wtf/StdLibExtras.h" | 63 #include "wtf/StdLibExtras.h" |
| 63 | 64 |
| 64 namespace blink { | 65 namespace blink { |
| 65 | 66 |
| 66 static PassRefPtr<AnimatableValue> createFromLengthWithZoom(const Length& length
, float zoom) | 67 static PassRefPtr<AnimatableValue> createFromLengthWithZoom(const Length& length
, float zoom) |
| 67 { | 68 { |
| 68 switch (length.type()) { | 69 switch (length.type()) { |
| 69 case Fixed: | 70 case Fixed: |
| 70 case Percent: | 71 case Percent: |
| 71 case Calculated: | 72 case Calculated: |
| 72 return AnimatableLength::create(length, zoom); | 73 return AnimatableLength::create(length, zoom); |
| 73 case Auto: | 74 case Auto: |
| 74 case MinContent: | 75 case MinContent: |
| 75 case MaxContent: | 76 case MaxContent: |
| 76 case FillAvailable: | 77 case FillAvailable: |
| 77 case FitContent: | 78 case FitContent: |
| 78 return AnimatableUnknown::create(CSSPrimitiveValue::create(length, 1)); | 79 return AnimatableUnknown::create(CSSValue::create(length, 1)); |
| 79 case MaxSizeNone: | 80 case MaxSizeNone: |
| 80 return AnimatableUnknown::create(CSSValueNone); | 81 return AnimatableUnknown::create(CSSValueNone); |
| 81 case ExtendToZoom: // Does not apply to elements. | 82 case ExtendToZoom: // Does not apply to elements. |
| 82 case DeviceWidth: | 83 case DeviceWidth: |
| 83 case DeviceHeight: | 84 case DeviceHeight: |
| 84 NOTREACHED(); | 85 NOTREACHED(); |
| 85 return nullptr; | 86 return nullptr; |
| 86 } | 87 } |
| 87 NOTREACHED(); | 88 NOTREACHED(); |
| 88 return nullptr; | 89 return nullptr; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 } | 185 } |
| 185 | 186 |
| 186 inline static PassRefPtr<AnimatableValue> createFromFillSize(const FillSize& fil
lSize, const ComputedStyle& style) | 187 inline static PassRefPtr<AnimatableValue> createFromFillSize(const FillSize& fil
lSize, const ComputedStyle& style) |
| 187 { | 188 { |
| 188 switch (fillSize.type) { | 189 switch (fillSize.type) { |
| 189 case SizeLength: | 190 case SizeLength: |
| 190 return createFromLengthSize(fillSize.size, style); | 191 return createFromLengthSize(fillSize.size, style); |
| 191 case Contain: | 192 case Contain: |
| 192 case Cover: | 193 case Cover: |
| 193 case SizeNone: | 194 case SizeNone: |
| 194 return AnimatableUnknown::create(CSSPrimitiveValue::create(fillSize.type
)); | 195 return AnimatableUnknown::create(CSSIdentifierValue::create(fillSize.typ
e)); |
| 195 default: | 196 default: |
| 196 NOTREACHED(); | 197 NOTREACHED(); |
| 197 return nullptr; | 198 return nullptr; |
| 198 } | 199 } |
| 199 } | 200 } |
| 200 | 201 |
| 201 inline static PassRefPtr<AnimatableValue> createFromBackgroundPosition(const Len
gth& length, bool originIsSet, BackgroundEdgeOrigin origin, const ComputedStyle&
style) | 202 inline static PassRefPtr<AnimatableValue> createFromBackgroundPosition(const Len
gth& length, bool originIsSet, BackgroundEdgeOrigin origin, const ComputedStyle&
style) |
| 202 { | 203 { |
| 203 if (!originIsSet || origin == LeftEdge || origin == TopEdge) | 204 if (!originIsSet || origin == LeftEdge || origin == TopEdge) |
| 204 return createFromLength(length, style); | 205 return createFromLength(length, style); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 return createFromFillLayers<CSSPropertyBackgroundImage>(style.background
Layers(), style); | 319 return createFromFillLayers<CSSPropertyBackgroundImage>(style.background
Layers(), style); |
| 319 case CSSPropertyBackgroundPositionX: | 320 case CSSPropertyBackgroundPositionX: |
| 320 return createFromFillLayers<CSSPropertyBackgroundPositionX>(style.backgr
oundLayers(), style); | 321 return createFromFillLayers<CSSPropertyBackgroundPositionX>(style.backgr
oundLayers(), style); |
| 321 case CSSPropertyBackgroundPositionY: | 322 case CSSPropertyBackgroundPositionY: |
| 322 return createFromFillLayers<CSSPropertyBackgroundPositionY>(style.backgr
oundLayers(), style); | 323 return createFromFillLayers<CSSPropertyBackgroundPositionY>(style.backgr
oundLayers(), style); |
| 323 case CSSPropertyBackgroundSize: | 324 case CSSPropertyBackgroundSize: |
| 324 return createFromFillLayers<CSSPropertyBackgroundSize>(style.backgroundL
ayers(), style); | 325 return createFromFillLayers<CSSPropertyBackgroundSize>(style.backgroundL
ayers(), style); |
| 325 case CSSPropertyBaselineShift: | 326 case CSSPropertyBaselineShift: |
| 326 switch (style.svgStyle().baselineShift()) { | 327 switch (style.svgStyle().baselineShift()) { |
| 327 case BS_SUPER: | 328 case BS_SUPER: |
| 328 return AnimatableUnknown::create(CSSPrimitiveValue::createIdentifier
(CSSValueSuper)); | 329 return AnimatableUnknown::create(CSSIdentifierValue::create(CSSValue
Super)); |
| 329 case BS_SUB: | 330 case BS_SUB: |
| 330 return AnimatableUnknown::create(CSSPrimitiveValue::createIdentifier
(CSSValueSub)); | 331 return AnimatableUnknown::create(CSSIdentifierValue::create(CSSValue
Sub)); |
| 331 default: | 332 default: |
| 332 return createFromLength(style.baselineShiftValue(), style); | 333 return createFromLength(style.baselineShiftValue(), style); |
| 333 } | 334 } |
| 334 case CSSPropertyBorderBottomColor: | 335 case CSSPropertyBorderBottomColor: |
| 335 return createFromColor(property, style); | 336 return createFromColor(property, style); |
| 336 case CSSPropertyBorderBottomLeftRadius: | 337 case CSSPropertyBorderBottomLeftRadius: |
| 337 return createFromLengthSize(style.borderBottomLeftRadius(), style); | 338 return createFromLengthSize(style.borderBottomLeftRadius(), style); |
| 338 case CSSPropertyBorderBottomRightRadius: | 339 case CSSPropertyBorderBottomRightRadius: |
| 339 return createFromLengthSize(style.borderBottomRightRadius(), style); | 340 return createFromLengthSize(style.borderBottomRightRadius(), style); |
| 340 case CSSPropertyBorderBottomWidth: | 341 case CSSPropertyBorderBottomWidth: |
| (...skipping 21 matching lines...) Expand all Loading... |
| 362 case CSSPropertyBorderTopRightRadius: | 363 case CSSPropertyBorderTopRightRadius: |
| 363 return createFromLengthSize(style.borderTopRightRadius(), style); | 364 return createFromLengthSize(style.borderTopRightRadius(), style); |
| 364 case CSSPropertyBorderTopWidth: | 365 case CSSPropertyBorderTopWidth: |
| 365 return createFromDouble(style.borderTopWidth()); | 366 return createFromDouble(style.borderTopWidth()); |
| 366 case CSSPropertyBottom: | 367 case CSSPropertyBottom: |
| 367 return createFromLength(style.bottom(), style); | 368 return createFromLength(style.bottom(), style); |
| 368 case CSSPropertyBoxShadow: | 369 case CSSPropertyBoxShadow: |
| 369 return AnimatableShadow::create(style.boxShadow(), style.color()); | 370 return AnimatableShadow::create(style.boxShadow(), style.color()); |
| 370 case CSSPropertyClip: | 371 case CSSPropertyClip: |
| 371 if (style.hasAutoClip()) | 372 if (style.hasAutoClip()) |
| 372 return AnimatableUnknown::create(CSSPrimitiveValue::createIdentifier
(CSSValueAuto)); | 373 return AnimatableUnknown::create(CSSIdentifierValue::create(CSSValue
Auto)); |
| 373 return createFromLengthBox(style.clip(), style); | 374 return createFromLengthBox(style.clip(), style); |
| 374 case CSSPropertyColor: | 375 case CSSPropertyColor: |
| 375 return createFromColor(property, style); | 376 return createFromColor(property, style); |
| 376 case CSSPropertyFillOpacity: | 377 case CSSPropertyFillOpacity: |
| 377 return createFromDouble(style.fillOpacity()); | 378 return createFromDouble(style.fillOpacity()); |
| 378 case CSSPropertyFill: | 379 case CSSPropertyFill: |
| 379 return AnimatableSVGPaint::create( | 380 return AnimatableSVGPaint::create( |
| 380 normalizeSVGPaintType(style.svgStyle().fillPaintType()), normalizeSV
GPaintType(style.svgStyle().visitedLinkFillPaintType()), | 381 normalizeSVGPaintType(style.svgStyle().fillPaintType()), normalizeSV
GPaintType(style.svgStyle().visitedLinkFillPaintType()), |
| 381 style.svgStyle().fillPaintColor(), style.svgStyle().visitedLinkFillP
aintColor(), | 382 style.svgStyle().fillPaintColor(), style.svgStyle().visitedLinkFillP
aintColor(), |
| 382 style.svgStyle().fillPaintUri(), style.svgStyle().visitedLinkFillPai
ntUri()); | 383 style.svgStyle().fillPaintUri(), style.svgStyle().visitedLinkFillPai
ntUri()); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 case CSSPropertyWebkitMaskImage: | 517 case CSSPropertyWebkitMaskImage: |
| 517 return createFromFillLayers<CSSPropertyWebkitMaskImage>(style.maskLayers
(), style); | 518 return createFromFillLayers<CSSPropertyWebkitMaskImage>(style.maskLayers
(), style); |
| 518 case CSSPropertyWebkitMaskPositionX: | 519 case CSSPropertyWebkitMaskPositionX: |
| 519 return createFromFillLayers<CSSPropertyWebkitMaskPositionX>(style.maskLa
yers(), style); | 520 return createFromFillLayers<CSSPropertyWebkitMaskPositionX>(style.maskLa
yers(), style); |
| 520 case CSSPropertyWebkitMaskPositionY: | 521 case CSSPropertyWebkitMaskPositionY: |
| 521 return createFromFillLayers<CSSPropertyWebkitMaskPositionY>(style.maskLa
yers(), style); | 522 return createFromFillLayers<CSSPropertyWebkitMaskPositionY>(style.maskLa
yers(), style); |
| 522 case CSSPropertyWebkitMaskSize: | 523 case CSSPropertyWebkitMaskSize: |
| 523 return createFromFillLayers<CSSPropertyWebkitMaskSize>(style.maskLayers(
), style); | 524 return createFromFillLayers<CSSPropertyWebkitMaskSize>(style.maskLayers(
), style); |
| 524 case CSSPropertyPerspective: | 525 case CSSPropertyPerspective: |
| 525 if (style.perspective() == 0) | 526 if (style.perspective() == 0) |
| 526 return AnimatableUnknown::create(CSSPrimitiveValue::createIdentifier
(CSSValueNone)); | 527 return AnimatableUnknown::create(CSSIdentifierValue::create(CSSValue
None)); |
| 527 return createFromDouble(style.perspective()); | 528 return createFromDouble(style.perspective()); |
| 528 case CSSPropertyPerspectiveOrigin: | 529 case CSSPropertyPerspectiveOrigin: |
| 529 return createFromLengthPoint(style.perspectiveOrigin(), style); | 530 return createFromLengthPoint(style.perspectiveOrigin(), style); |
| 530 case CSSPropertyShapeOutside: | 531 case CSSPropertyShapeOutside: |
| 531 return createFromShapeValue(style.shapeOutside()); | 532 return createFromShapeValue(style.shapeOutside()); |
| 532 case CSSPropertyShapeMargin: | 533 case CSSPropertyShapeMargin: |
| 533 return createFromLength(style.shapeMargin(), style); | 534 return createFromLength(style.shapeMargin(), style); |
| 534 case CSSPropertyShapeImageThreshold: | 535 case CSSPropertyShapeImageThreshold: |
| 535 return createFromDouble(style.shapeImageThreshold()); | 536 return createFromDouble(style.shapeImageThreshold()); |
| 536 case CSSPropertyWebkitTextStrokeColor: | 537 case CSSPropertyWebkitTextStrokeColor: |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 return createFromDouble(style.transformOriginZ()); | 572 return createFromDouble(style.transformOriginZ()); |
| 572 case CSSPropertyWidows: | 573 case CSSPropertyWidows: |
| 573 return createFromDouble(style.widows()); | 574 return createFromDouble(style.widows()); |
| 574 case CSSPropertyWidth: | 575 case CSSPropertyWidth: |
| 575 return createFromLength(style.width(), style); | 576 return createFromLength(style.width(), style); |
| 576 case CSSPropertyWordSpacing: | 577 case CSSPropertyWordSpacing: |
| 577 return createFromDouble(style.wordSpacing()); | 578 return createFromDouble(style.wordSpacing()); |
| 578 case CSSPropertyVerticalAlign: | 579 case CSSPropertyVerticalAlign: |
| 579 if (style.verticalAlign() == VerticalAlignLength) | 580 if (style.verticalAlign() == VerticalAlignLength) |
| 580 return createFromLength(style.getVerticalAlignLength(), style); | 581 return createFromLength(style.getVerticalAlignLength(), style); |
| 581 return AnimatableUnknown::create(CSSPrimitiveValue::create(style.vertica
lAlign())); | 582 return AnimatableUnknown::create(CSSIdentifierValue::create(style.vertic
alAlign())); |
| 582 case CSSPropertyVisibility: | 583 case CSSPropertyVisibility: |
| 583 return AnimatableVisibility::create(style.visibility()); | 584 return AnimatableVisibility::create(style.visibility()); |
| 584 case CSSPropertyD: | 585 case CSSPropertyD: |
| 585 return createFromPath(style.svgStyle().d()); | 586 return createFromPath(style.svgStyle().d()); |
| 586 case CSSPropertyCx: | 587 case CSSPropertyCx: |
| 587 return createFromLength(style.svgStyle().cx(), style); | 588 return createFromLength(style.svgStyle().cx(), style); |
| 588 case CSSPropertyCy: | 589 case CSSPropertyCy: |
| 589 return createFromLength(style.svgStyle().cy(), style); | 590 return createFromLength(style.svgStyle().cy(), style); |
| 590 case CSSPropertyX: | 591 case CSSPropertyX: |
| 591 return createFromLength(style.svgStyle().x(), style); | 592 return createFromLength(style.svgStyle().x(), style); |
| 592 case CSSPropertyY: | 593 case CSSPropertyY: |
| 593 return createFromLength(style.svgStyle().y(), style); | 594 return createFromLength(style.svgStyle().y(), style); |
| 594 case CSSPropertyR: | 595 case CSSPropertyR: |
| 595 return createFromLength(style.svgStyle().r(), style); | 596 return createFromLength(style.svgStyle().r(), style); |
| 596 case CSSPropertyRx: | 597 case CSSPropertyRx: |
| 597 return createFromLength(style.svgStyle().rx(), style); | 598 return createFromLength(style.svgStyle().rx(), style); |
| 598 case CSSPropertyRy: | 599 case CSSPropertyRy: |
| 599 return createFromLength(style.svgStyle().ry(), style); | 600 return createFromLength(style.svgStyle().ry(), style); |
| 600 case CSSPropertyZIndex: | 601 case CSSPropertyZIndex: |
| 601 if (style.hasAutoZIndex()) | 602 if (style.hasAutoZIndex()) |
| 602 return AnimatableUnknown::create(CSSValueAuto); | 603 return AnimatableUnknown::create(CSSValueAuto); |
| 603 return createFromDouble(style.zIndex()); | 604 return createFromDouble(style.zIndex()); |
| 604 default: | 605 default: |
| 605 NOTREACHED(); | 606 NOTREACHED(); |
| 606 return nullptr; | 607 return nullptr; |
| 607 } | 608 } |
| 608 } | 609 } |
| 609 | 610 |
| 610 } // namespace blink | 611 } // namespace blink |
| OLD | NEW |