| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/animation/ImageSliceStyleInterpolation.h" | 6 #include "core/animation/ImageSliceStyleInterpolation.h" |
| 7 | 7 |
| 8 #include "core/css/CSSBorderImageSliceValue.h" | 8 #include "core/css/CSSBorderImageSliceValue.h" |
| 9 #include "core/css/CSSPrimitiveValue.h" | 9 #include "core/css/CSSPrimitiveValue.h" |
| 10 #include "core/css/Rect.h" | 10 #include "core/css/Rect.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 bool isPercentage = quad.top()->isPercentage(); | 48 bool isPercentage = quad.top()->isPercentage(); |
| 49 ASSERT(quad.bottom()->isPercentage() == isPercentage | 49 ASSERT(quad.bottom()->isPercentage() == isPercentage |
| 50 && quad.left()->isPercentage() == isPercentage | 50 && quad.left()->isPercentage() == isPercentage |
| 51 && quad.right()->isPercentage() == isPercentage); | 51 && quad.right()->isPercentage() == isPercentage); |
| 52 | 52 |
| 53 interpolableValue = interpolableList.release(); | 53 interpolableValue = interpolableList.release(); |
| 54 metadata = ImageSliceStyleInterpolation::Metadata {isPercentage, value.m
_fill}; | 54 metadata = ImageSliceStyleInterpolation::Metadata {isPercentage, value.m
_fill}; |
| 55 } | 55 } |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 PassRefPtrWillBeRawPtr<CSSBorderImageSliceValue> compose(const InterpolableValue
& value, const ImageSliceStyleInterpolation::Metadata& metadata) | 58 PassRefPtr<CSSBorderImageSliceValue> compose(const InterpolableValue& value, con
st ImageSliceStyleInterpolation::Metadata& metadata) |
| 59 { | 59 { |
| 60 const InterpolableList& interpolableList = toInterpolableList(value); | 60 const InterpolableList& interpolableList = toInterpolableList(value); |
| 61 CSSPrimitiveValue::UnitType type = metadata.isPercentage ? CSSPrimitiveValue
::UnitType::Percentage : CSSPrimitiveValue::UnitType::Number; | 61 CSSPrimitiveValue::UnitType type = metadata.isPercentage ? CSSPrimitiveValue
::UnitType::Percentage : CSSPrimitiveValue::UnitType::Number; |
| 62 RefPtrWillBeRawPtr<Quad> quad = Quad::create(); | 62 RefPtr<Quad> quad = Quad::create(); |
| 63 quad->setTop(CSSPrimitiveValue::create(clampTo<double>(toInterpolableNumber(
interpolableList.get(0))->value(), 0), type)); | 63 quad->setTop(CSSPrimitiveValue::create(clampTo<double>(toInterpolableNumber(
interpolableList.get(0))->value(), 0), type)); |
| 64 quad->setRight(CSSPrimitiveValue::create(clampTo<double>(toInterpolableNumbe
r(interpolableList.get(1))->value(), 0), type)); | 64 quad->setRight(CSSPrimitiveValue::create(clampTo<double>(toInterpolableNumbe
r(interpolableList.get(1))->value(), 0), type)); |
| 65 quad->setBottom(CSSPrimitiveValue::create(clampTo<double>(toInterpolableNumb
er(interpolableList.get(2))->value(), 0), type)); | 65 quad->setBottom(CSSPrimitiveValue::create(clampTo<double>(toInterpolableNumb
er(interpolableList.get(2))->value(), 0), type)); |
| 66 quad->setLeft(CSSPrimitiveValue::create(clampTo<double>(toInterpolableNumber
(interpolableList.get(3))->value(), 0), type)); | 66 quad->setLeft(CSSPrimitiveValue::create(clampTo<double>(toInterpolableNumber
(interpolableList.get(3))->value(), 0), type)); |
| 67 return CSSBorderImageSliceValue::create(CSSPrimitiveValue::create(quad.relea
se()), metadata.fill); | 67 return CSSBorderImageSliceValue::create(CSSPrimitiveValue::create(quad.relea
se()), metadata.fill); |
| 68 } | 68 } |
| 69 | 69 |
| 70 } // namespace | 70 } // namespace |
| 71 | 71 |
| 72 PassRefPtrWillBeRawPtr<ImageSliceStyleInterpolation> ImageSliceStyleInterpolatio
n::maybeCreate(const CSSValue& start, const CSSValue& end, CSSPropertyID propert
y) | 72 PassRefPtrWillBeRawPtr<ImageSliceStyleInterpolation> ImageSliceStyleInterpolatio
n::maybeCreate(const CSSValue& start, const CSSValue& end, CSSPropertyID propert
y) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 91 { | 91 { |
| 92 StyleBuilder::applyProperty(m_id, state, compose(*m_cachedValue, m_metadata)
.get()); | 92 StyleBuilder::applyProperty(m_id, state, compose(*m_cachedValue, m_metadata)
.get()); |
| 93 } | 93 } |
| 94 | 94 |
| 95 DEFINE_TRACE(ImageSliceStyleInterpolation) | 95 DEFINE_TRACE(ImageSliceStyleInterpolation) |
| 96 { | 96 { |
| 97 StyleInterpolation::trace(visitor); | 97 StyleInterpolation::trace(visitor); |
| 98 } | 98 } |
| 99 | 99 |
| 100 } // namespace blink | 100 } // namespace blink |
| OLD | NEW |