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

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

Issue 1708303002: Revert of Add additive animation support for CSS property background-position (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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/LengthListPropertyFunctions.cpp
diff --git a/third_party/WebKit/Source/core/animation/LengthListPropertyFunctions.cpp b/third_party/WebKit/Source/core/animation/LengthListPropertyFunctions.cpp
deleted file mode 100644
index 62680c3450d5a13992161e2c35fd823e47a464e1..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/core/animation/LengthListPropertyFunctions.cpp
+++ /dev/null
@@ -1,139 +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 "core/animation/LengthListPropertyFunctions.h"
-
-#include "core/style/ComputedStyle.h"
-
-namespace blink {
-
-namespace {
-
-const FillLayer* getFillLayer(CSSPropertyID property, const ComputedStyle& style)
-{
- switch (property) {
- case CSSPropertyBackgroundPositionX:
- case CSSPropertyBackgroundPositionY:
- return &style.backgroundLayers();
- case CSSPropertyWebkitMaskPositionX:
- case CSSPropertyWebkitMaskPositionY:
- return &style.maskLayers();
- default:
- ASSERT_NOT_REACHED();
- return nullptr;
- }
-}
-
-FillLayer* accessFillLayer(CSSPropertyID property, ComputedStyle& style)
-{
- switch (property) {
- case CSSPropertyBackgroundPositionX:
- case CSSPropertyBackgroundPositionY:
- return &style.accessBackgroundLayers();
- case CSSPropertyWebkitMaskPositionX:
- case CSSPropertyWebkitMaskPositionY:
- return &style.accessMaskLayers();
- default:
- ASSERT_NOT_REACHED();
- return nullptr;
- }
-}
-
-struct FillLayerMethods {
- FillLayerMethods(CSSPropertyID property)
- {
- switch (property) {
- case CSSPropertyBackgroundPositionX:
- case CSSPropertyWebkitMaskPositionX:
- isSet = &FillLayer::isXPositionSet;
- get = &FillLayer::xPosition;
- set = &FillLayer::setXPosition;
- clear = &FillLayer::clearXPosition;
- break;
- case CSSPropertyBackgroundPositionY:
- case CSSPropertyWebkitMaskPositionY:
- isSet = &FillLayer::isYPositionSet;
- get = &FillLayer::yPosition;
- set = &FillLayer::setYPosition;
- clear = &FillLayer::clearYPosition;
- break;
- default:
- break;
- }
- }
-
- bool (FillLayer::*isSet)() const;
- const Length& (FillLayer::*get)() const;
- void (FillLayer::*set)(const Length&);
- void (FillLayer::*clear)();
-};
-
-} // namespace
-
-ValueRange LengthListPropertyFunctions::valueRange(CSSPropertyID property)
-{
- switch (property) {
- case CSSPropertyBackgroundPositionX:
- case CSSPropertyBackgroundPositionY:
- case CSSPropertyWebkitMaskPositionX:
- case CSSPropertyWebkitMaskPositionY:
- return ValueRangeAll;
-
- case CSSPropertyStrokeDasharray:
- return ValueRangeNonNegative;
-
- default:
- ASSERT_NOT_REACHED();
- return ValueRangeAll;
- }
-}
-
-Vector<Length> LengthListPropertyFunctions::getInitialLengthList(CSSPropertyID property)
-{
- return getLengthList(property, *ComputedStyle::initialStyle());
-}
-
-Vector<Length> LengthListPropertyFunctions::getLengthList(CSSPropertyID property, const ComputedStyle& style)
-{
- Vector<Length> result;
-
- if (property == CSSPropertyStrokeDasharray) {
- if (style.strokeDashArray())
- result.appendVector(style.strokeDashArray()->vector());
- return result;
- }
-
- const FillLayer* fillLayer = getFillLayer(property, style);
- FillLayerMethods fillLayerMethods(property);
- while (fillLayer && (fillLayer->*fillLayerMethods.isSet)()) {
- result.append((fillLayer->*fillLayerMethods.get)());
- fillLayer = fillLayer->next();
- }
- return result;
-}
-
-void LengthListPropertyFunctions::setLengthList(CSSPropertyID property, ComputedStyle& style, Vector<Length>&& lengthList)
-{
- if (property == CSSPropertyStrokeDasharray) {
- style.setStrokeDashArray(lengthList.isEmpty() ? nullptr : RefVector<Length>::create(std::move(lengthList)));
- return;
- }
-
- FillLayer* fillLayer = accessFillLayer(property, style);
- FillLayer* prev = nullptr;
- FillLayerMethods fillLayerMethods(property);
- for (size_t i = 0; i < lengthList.size(); i++) {
- if (!fillLayer)
- fillLayer = prev->ensureNext();
- (fillLayer->*fillLayerMethods.set)(lengthList[i]);
- prev = fillLayer;
- fillLayer = fillLayer->next();
- }
- while (fillLayer) {
- (fillLayer->*fillLayerMethods.clear)();
- fillLayer = fillLayer->next();
- }
-}
-
-} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698