Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Unified Diff: third_party/WebKit/Source/core/animation/PaintInterpolationType.cpp

Issue 1409073009: Prefix CSSInterpolationType subclasses with "CSS" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_unCSSInterpolationType
Patch Set: CSSNIVs Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/animation/PaintInterpolationType.cpp
diff --git a/third_party/WebKit/Source/core/animation/PaintInterpolationType.cpp b/third_party/WebKit/Source/core/animation/PaintInterpolationType.cpp
deleted file mode 100644
index ae64029f44d2e0f9f376ec2eadf2bd2ab97dd589..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/core/animation/PaintInterpolationType.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "config.h"
-#include "core/animation/PaintInterpolationType.h"
-
-#include "core/animation/ColorInterpolationType.h"
-#include "core/animation/PaintPropertyFunctions.h"
-#include "core/css/resolver/StyleResolverState.h"
-
-namespace blink {
-
-PassOwnPtr<InterpolationValue> PaintInterpolationType::maybeConvertNeutral(const UnderlyingValue&, ConversionCheckers&) const
-{
- return InterpolationValue::create(*this, ColorInterpolationType::createInterpolableColor(Color::transparent));
-}
-
-PassOwnPtr<InterpolationValue> PaintInterpolationType::maybeConvertInitial() const
-{
- StyleColor initialColor;
- if (!PaintPropertyFunctions::getInitialColor(cssProperty(), initialColor))
- return nullptr;
- return InterpolationValue::create(*this, ColorInterpolationType::createInterpolableColor(initialColor));
-}
-
-class ParentPaintChecker : public InterpolationType::ConversionChecker {
-public:
- static PassOwnPtr<ParentPaintChecker> create(const InterpolationType& type, CSSPropertyID property, const StyleColor& color)
- {
- return adoptPtr(new ParentPaintChecker(type, property, color));
- }
- static PassOwnPtr<ParentPaintChecker> create(const InterpolationType& type, CSSPropertyID property)
- {
- return adoptPtr(new ParentPaintChecker(type, property));
- }
-
-private:
- ParentPaintChecker(const InterpolationType& type, CSSPropertyID property)
- : ConversionChecker(type)
- , m_property(property)
- , m_validColor(false)
- { }
- ParentPaintChecker(const InterpolationType& type, CSSPropertyID property, const StyleColor& color)
- : ConversionChecker(type)
- , m_property(property)
- , m_validColor(true)
- , m_color(color)
- { }
-
- bool isValid(const InterpolationEnvironment& environment, const UnderlyingValue&) const final
- {
- StyleColor parentColor;
- if (!PaintPropertyFunctions::getColor(m_property, *environment.state().parentStyle(), parentColor))
- return !m_validColor;
- return m_validColor && parentColor == m_color;
- }
-
- DEFINE_INLINE_VIRTUAL_TRACE()
- {
- ConversionChecker::trace(visitor);
- }
-
- const CSSPropertyID m_property;
- const bool m_validColor;
- const StyleColor m_color;
-};
-
-PassOwnPtr<InterpolationValue> PaintInterpolationType::maybeConvertInherit(const StyleResolverState* state, ConversionCheckers& conversionCheckers) const
-{
- if (!state || !state->parentStyle())
- return nullptr;
- StyleColor parentColor;
- if (!PaintPropertyFunctions::getColor(cssProperty(), *state->parentStyle(), parentColor)) {
- conversionCheckers.append(ParentPaintChecker::create(*this, cssProperty()));
- return nullptr;
- }
- conversionCheckers.append(ParentPaintChecker::create(*this, cssProperty(), parentColor));
- return InterpolationValue::create(*this, ColorInterpolationType::createInterpolableColor(parentColor));
-}
-
-PassOwnPtr<InterpolationValue> PaintInterpolationType::maybeConvertValue(const CSSValue& value, const StyleResolverState*, ConversionCheckers&) const
-{
- OwnPtr<InterpolableValue> interpolableColor = ColorInterpolationType::maybeCreateInterpolableColor(value);
- if (!interpolableColor)
- return nullptr;
- return InterpolationValue::create(*this, interpolableColor.release());
-}
-
-PassOwnPtr<InterpolationValue> PaintInterpolationType::maybeConvertUnderlyingValue(const InterpolationEnvironment& environment) const
-{
- // TODO(alancutter): Support capturing and animating with the visited paint color.
- StyleColor underlyingColor;
- if (!PaintPropertyFunctions::getColor(cssProperty(), *environment.state().style(), underlyingColor))
- return nullptr;
- return InterpolationValue::create(*this, ColorInterpolationType::createInterpolableColor(underlyingColor));
-}
-
-void PaintInterpolationType::apply(const InterpolableValue& interpolableColor, const NonInterpolableValue*, InterpolationEnvironment& environment) const
-{
- PaintPropertyFunctions::setColor(cssProperty(), *environment.state().style(), ColorInterpolationType::resolveInterpolableColor(interpolableColor, environment.state()));
-}
-
-} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698