| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/animation/BasicShapeInterpolationFunctions.h" | 5 #include "core/animation/BasicShapeInterpolationFunctions.h" |
| 6 | 6 |
| 7 #include "core/animation/CSSLengthInterpolationType.h" | 7 #include "core/animation/CSSLengthInterpolationType.h" |
| 8 #include "core/animation/CSSPositionAxisListInterpolationType.h" | 8 #include "core/animation/CSSPositionAxisListInterpolationType.h" |
| 9 #include "core/css/CSSBasicShapeValues.h" | 9 #include "core/css/CSSBasicShapeValues.h" |
| 10 #include "core/css/resolver/StyleResolverState.h" | 10 #include "core/css/resolver/StyleResolverState.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 return false; | 35 return false; |
| 36 switch (type()) { | 36 switch (type()) { |
| 37 case BasicShape::BasicShapeCircleType: | 37 case BasicShape::BasicShapeCircleType: |
| 38 case BasicShape::BasicShapeEllipseType: | 38 case BasicShape::BasicShapeEllipseType: |
| 39 case BasicShape::BasicShapeInsetType: | 39 case BasicShape::BasicShapeInsetType: |
| 40 return true; | 40 return true; |
| 41 case BasicShape::BasicShapePolygonType: | 41 case BasicShape::BasicShapePolygonType: |
| 42 return windRule() == other.windRule() | 42 return windRule() == other.windRule() |
| 43 && size() == other.size(); | 43 && size() == other.size(); |
| 44 default: | 44 default: |
| 45 ASSERT_NOT_REACHED(); | 45 NOTREACHED(); |
| 46 return false; | 46 return false; |
| 47 } | 47 } |
| 48 } | 48 } |
| 49 | 49 |
| 50 DECLARE_NON_INTERPOLABLE_VALUE_TYPE(); | 50 DECLARE_NON_INTERPOLABLE_VALUE_TYPE(); |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 BasicShapeNonInterpolableValue(BasicShape::ShapeType type) | 53 BasicShapeNonInterpolableValue(BasicShape::ShapeType type) |
| 54 : m_type(type) | 54 : m_type(type) |
| 55 , m_windRule(RULE_NONZERO) | 55 , m_windRule(RULE_NONZERO) |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 switch (shape->type()) { | 442 switch (shape->type()) { |
| 443 case BasicShape::BasicShapeCircleType: | 443 case BasicShape::BasicShapeCircleType: |
| 444 return CircleFunctions::convertBasicShape(toBasicShapeCircle(*shape), zo
om); | 444 return CircleFunctions::convertBasicShape(toBasicShapeCircle(*shape), zo
om); |
| 445 case BasicShape::BasicShapeEllipseType: | 445 case BasicShape::BasicShapeEllipseType: |
| 446 return EllipseFunctions::convertBasicShape(toBasicShapeEllipse(*shape),
zoom); | 446 return EllipseFunctions::convertBasicShape(toBasicShapeEllipse(*shape),
zoom); |
| 447 case BasicShape::BasicShapeInsetType: | 447 case BasicShape::BasicShapeInsetType: |
| 448 return InsetFunctions::convertBasicShape(toBasicShapeInset(*shape), zoom
); | 448 return InsetFunctions::convertBasicShape(toBasicShapeInset(*shape), zoom
); |
| 449 case BasicShape::BasicShapePolygonType: | 449 case BasicShape::BasicShapePolygonType: |
| 450 return PolygonFunctions::convertBasicShape(toBasicShapePolygon(*shape),
zoom); | 450 return PolygonFunctions::convertBasicShape(toBasicShapePolygon(*shape),
zoom); |
| 451 default: | 451 default: |
| 452 ASSERT_NOT_REACHED(); | 452 NOTREACHED(); |
| 453 return nullptr; | 453 return nullptr; |
| 454 } | 454 } |
| 455 } | 455 } |
| 456 | 456 |
| 457 std::unique_ptr<InterpolableValue> BasicShapeInterpolationFunctions::createNeutr
alValue(const NonInterpolableValue& untypedNonInterpolableValue) | 457 std::unique_ptr<InterpolableValue> BasicShapeInterpolationFunctions::createNeutr
alValue(const NonInterpolableValue& untypedNonInterpolableValue) |
| 458 { | 458 { |
| 459 const BasicShapeNonInterpolableValue& nonInterpolableValue = toBasicShapeNon
InterpolableValue(untypedNonInterpolableValue); | 459 const BasicShapeNonInterpolableValue& nonInterpolableValue = toBasicShapeNon
InterpolableValue(untypedNonInterpolableValue); |
| 460 switch (nonInterpolableValue.type()) { | 460 switch (nonInterpolableValue.type()) { |
| 461 case BasicShape::BasicShapeCircleType: | 461 case BasicShape::BasicShapeCircleType: |
| 462 return CircleFunctions::createNeutralValue(); | 462 return CircleFunctions::createNeutralValue(); |
| 463 case BasicShape::BasicShapeEllipseType: | 463 case BasicShape::BasicShapeEllipseType: |
| 464 return EllipseFunctions::createNeutralValue(); | 464 return EllipseFunctions::createNeutralValue(); |
| 465 case BasicShape::BasicShapeInsetType: | 465 case BasicShape::BasicShapeInsetType: |
| 466 return InsetFunctions::createNeutralValue(); | 466 return InsetFunctions::createNeutralValue(); |
| 467 case BasicShape::BasicShapePolygonType: | 467 case BasicShape::BasicShapePolygonType: |
| 468 return PolygonFunctions::createNeutralValue(nonInterpolableValue); | 468 return PolygonFunctions::createNeutralValue(nonInterpolableValue); |
| 469 default: | 469 default: |
| 470 ASSERT_NOT_REACHED(); | 470 NOTREACHED(); |
| 471 return nullptr; | 471 return nullptr; |
| 472 } | 472 } |
| 473 } | 473 } |
| 474 | 474 |
| 475 bool BasicShapeInterpolationFunctions::shapesAreCompatible(const NonInterpolable
Value& a, const NonInterpolableValue& b) | 475 bool BasicShapeInterpolationFunctions::shapesAreCompatible(const NonInterpolable
Value& a, const NonInterpolableValue& b) |
| 476 { | 476 { |
| 477 return toBasicShapeNonInterpolableValue(a).isCompatibleWith(toBasicShapeNonI
nterpolableValue(b)); | 477 return toBasicShapeNonInterpolableValue(a).isCompatibleWith(toBasicShapeNonI
nterpolableValue(b)); |
| 478 } | 478 } |
| 479 | 479 |
| 480 PassRefPtr<BasicShape> BasicShapeInterpolationFunctions::createBasicShape(const
InterpolableValue& interpolableValue, const NonInterpolableValue& untypedNonInte
rpolableValue, const CSSToLengthConversionData& conversionData) | 480 PassRefPtr<BasicShape> BasicShapeInterpolationFunctions::createBasicShape(const
InterpolableValue& interpolableValue, const NonInterpolableValue& untypedNonInte
rpolableValue, const CSSToLengthConversionData& conversionData) |
| 481 { | 481 { |
| 482 const BasicShapeNonInterpolableValue& nonInterpolableValue = toBasicShapeNon
InterpolableValue(untypedNonInterpolableValue); | 482 const BasicShapeNonInterpolableValue& nonInterpolableValue = toBasicShapeNon
InterpolableValue(untypedNonInterpolableValue); |
| 483 switch (nonInterpolableValue.type()) { | 483 switch (nonInterpolableValue.type()) { |
| 484 case BasicShape::BasicShapeCircleType: | 484 case BasicShape::BasicShapeCircleType: |
| 485 return CircleFunctions::createBasicShape(interpolableValue, conversionDa
ta); | 485 return CircleFunctions::createBasicShape(interpolableValue, conversionDa
ta); |
| 486 case BasicShape::BasicShapeEllipseType: | 486 case BasicShape::BasicShapeEllipseType: |
| 487 return EllipseFunctions::createBasicShape(interpolableValue, conversionD
ata); | 487 return EllipseFunctions::createBasicShape(interpolableValue, conversionD
ata); |
| 488 case BasicShape::BasicShapeInsetType: | 488 case BasicShape::BasicShapeInsetType: |
| 489 return InsetFunctions::createBasicShape(interpolableValue, conversionDat
a); | 489 return InsetFunctions::createBasicShape(interpolableValue, conversionDat
a); |
| 490 case BasicShape::BasicShapePolygonType: | 490 case BasicShape::BasicShapePolygonType: |
| 491 return PolygonFunctions::createBasicShape(interpolableValue, nonInterpol
ableValue, conversionData); | 491 return PolygonFunctions::createBasicShape(interpolableValue, nonInterpol
ableValue, conversionData); |
| 492 default: | 492 default: |
| 493 ASSERT_NOT_REACHED(); | 493 NOTREACHED(); |
| 494 return nullptr; | 494 return nullptr; |
| 495 } | 495 } |
| 496 } | 496 } |
| 497 | 497 |
| 498 } // namespace blink | 498 } // namespace blink |
| OLD | NEW |