diff options
Diffstat (limited to 'chromium/third_party/blink/renderer/core/animation/animatable')
8 files changed, 6 insertions, 248 deletions
diff --git a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_double.cc b/chromium/third_party/blink/renderer/core/animation/animatable/animatable_double.cc deleted file mode 100644 index a06df5ca9bf..00000000000 --- a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_double.cc +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "third_party/blink/renderer/core/animation/animatable/animatable_double.h" - -#include <math.h> -#include "third_party/blink/renderer/platform/animation/animation_utilities.h" - -namespace blink { - -AnimatableValue* AnimatableDouble::InterpolateTo(const AnimatableValue* value, - double fraction) const { - const AnimatableDouble* other = ToAnimatableDouble(value); - return AnimatableDouble::Create(Blend(number_, other->number_, fraction)); -} - -} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_double.h b/chromium/third_party/blink/renderer/core/animation/animatable/animatable_double.h index d9c379963d6..ea88b224b89 100644 --- a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_double.h +++ b/chromium/third_party/blink/renderer/core/animation/animatable/animatable_double.h @@ -47,10 +47,6 @@ class CORE_EXPORT AnimatableDouble final : public AnimatableValue { double ToDouble() const { return number_; } - protected: - AnimatableValue* InterpolateTo(const AnimatableValue*, - double fraction) const override; - private: AnimatableType GetType() const override { return kTypeDouble; } diff --git a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_filter_operations.cc b/chromium/third_party/blink/renderer/core/animation/animatable/animatable_filter_operations.cc deleted file mode 100644 index 06359996b13..00000000000 --- a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_filter_operations.cc +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "third_party/blink/renderer/core/animation/animatable/animatable_filter_operations.h" - -#include <algorithm> - -namespace blink { - -AnimatableValue* AnimatableFilterOperations::InterpolateTo( - const AnimatableValue* value, - double fraction) const { - const AnimatableFilterOperations* target = - ToAnimatableFilterOperations(value); - - if (!Operations().CanInterpolateWith(target->Operations())) - return DefaultInterpolateTo(this, value, fraction); - - FilterOperations result; - wtf_size_t from_size = Operations().size(); - wtf_size_t to_size = target->Operations().size(); - wtf_size_t size = std::max(from_size, to_size); - for (wtf_size_t i = 0; i < size; i++) { - FilterOperation* from = - (i < from_size) ? operation_wrapper_->Operations().Operations()[i].Get() - : nullptr; - FilterOperation* to = - (i < to_size) - ? target->operation_wrapper_->Operations().Operations()[i].Get() - : nullptr; - FilterOperation* blended_op = FilterOperation::Blend(from, to, fraction); - if (blended_op) - result.Operations().push_back(blended_op); - else - NOTREACHED(); - } - return AnimatableFilterOperations::Create(result); -} - -void AnimatableFilterOperations::Trace(Visitor* visitor) { - visitor->Trace(operation_wrapper_); - AnimatableValue::Trace(visitor); -} - -} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_filter_operations.h b/chromium/third_party/blink/renderer/core/animation/animatable/animatable_filter_operations.h index cdb0ab7378f..a657b0b54b6 100644 --- a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_filter_operations.h +++ b/chromium/third_party/blink/renderer/core/animation/animatable/animatable_filter_operations.h @@ -45,18 +45,18 @@ class AnimatableFilterOperations final : public AnimatableValue { } AnimatableFilterOperations(const FilterOperations& operations) - : operation_wrapper_(FilterOperationsWrapper::Create(operations)) {} + : operation_wrapper_( + MakeGarbageCollected<FilterOperationsWrapper>(operations)) {} ~AnimatableFilterOperations() override = default; const FilterOperations& Operations() const { return operation_wrapper_->Operations(); } - void Trace(Visitor*) override; - - protected: - AnimatableValue* InterpolateTo(const AnimatableValue*, - double fraction) const override; + void Trace(Visitor* visitor) override { + visitor->Trace(operation_wrapper_); + AnimatableValue::Trace(visitor); + } private: AnimatableType GetType() const override { return kTypeFilterOperations; } diff --git a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_transform.cc b/chromium/third_party/blink/renderer/core/animation/animatable/animatable_transform.cc deleted file mode 100644 index 247a8acd7e2..00000000000 --- a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_transform.cc +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "third_party/blink/renderer/core/animation/animatable/animatable_transform.h" - -#include "third_party/blink/renderer/platform/animation/animation_utilities.h" - -namespace blink { - -AnimatableValue* AnimatableTransform::InterpolateTo( - const AnimatableValue* value, - double fraction) const { - const AnimatableTransform& transform = ToAnimatableTransform(*value); - return AnimatableTransform::Create( - transform.transform_.Blend(transform_, fraction), - Blend(zoom_, transform.zoom_, fraction)); -} - -} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_transform.h b/chromium/third_party/blink/renderer/core/animation/animatable/animatable_transform.h index 817c57a7a71..bda9b7c1fa7 100644 --- a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_transform.h +++ b/chromium/third_party/blink/renderer/core/animation/animatable/animatable_transform.h @@ -53,10 +53,6 @@ class CORE_EXPORT AnimatableTransform final : public AnimatableValue { } double Zoom() const { return zoom_; } - protected: - AnimatableValue* InterpolateTo(const AnimatableValue*, - double fraction) const override; - private: AnimatableType GetType() const override { return kTypeTransform; } diff --git a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_value.cc b/chromium/third_party/blink/renderer/core/animation/animatable/animatable_value.cc deleted file mode 100644 index 322b1e41dc0..00000000000 --- a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_value.cc +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "third_party/blink/renderer/core/animation/animatable/animatable_value.h" - -#include <algorithm> -#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" - -namespace blink { - -AnimatableValue* AnimatableValue::Interpolate(const AnimatableValue* left, - const AnimatableValue* right, - double fraction) { - DCHECK(left); - DCHECK(right); - - if (fraction && fraction != 1 && left->IsSameType(right)) - return left->InterpolateTo(right, fraction); - - return DefaultInterpolateTo(left, right, fraction); -} - -} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_value.h b/chromium/third_party/blink/renderer/core/animation/animatable/animatable_value.h index 6d62f1cf45b..f18b38a9738 100644 --- a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_value.h +++ b/chromium/third_party/blink/renderer/core/animation/animatable/animatable_value.h @@ -42,19 +42,11 @@ class CORE_EXPORT AnimatableValue public: virtual ~AnimatableValue() = default; - static AnimatableValue* Interpolate(const AnimatableValue*, - const AnimatableValue*, - double fraction); bool IsDouble() const { return GetType() == kTypeDouble; } bool IsFilterOperations() const { return GetType() == kTypeFilterOperations; } bool IsTransform() const { return GetType() == kTypeTransform; } bool IsUnknown() const { return GetType() == kTypeUnknown; } - bool IsSameType(const AnimatableValue* value) const { - DCHECK(value); - return value->GetType() == GetType(); - } - virtual void Trace(Visitor*) {} protected: @@ -65,22 +57,8 @@ class CORE_EXPORT AnimatableValue kTypeUnknown, }; - virtual AnimatableValue* InterpolateTo(const AnimatableValue*, - double fraction) const { - NOTREACHED(); - return nullptr; - } - static AnimatableValue* DefaultInterpolateTo(const AnimatableValue* left, - const AnimatableValue* right, - double fraction) { - return const_cast<AnimatableValue*>((fraction < 0.5) ? left : right); - } - private: virtual AnimatableType GetType() const = 0; - - template <class Keyframe> - friend class KeyframeEffectModel; }; #define DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(thisType, predicate) \ |