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

Side by Side Diff: third_party/WebKit/Source/core/animation/SizeListPropertyFunctions.cpp

Issue 2280553002: Allow interpolation of background-size values with keywords in CSS Animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove DCHECK Created 4 years, 3 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "core/animation/SizeListPropertyFunctions.h"
6
7 #include "core/style/ComputedStyle.h"
8
9 namespace blink {
10
11 static const FillLayer* getFillLayer(CSSPropertyID property, const ComputedStyle & style)
12 {
13 switch (property) {
14 case CSSPropertyBackgroundSize:
15 return &style.backgroundLayers();
16 case CSSPropertyWebkitMaskSize:
17 return &style.maskLayers();
18 default:
19 NOTREACHED();
20 return nullptr;
21 }
22 }
23
24 static FillLayer* accessFillLayer(CSSPropertyID property, ComputedStyle& style)
25 {
26 switch (property) {
27 case CSSPropertyBackgroundSize:
28 return &style.accessBackgroundLayers();
29 case CSSPropertyWebkitMaskSize:
30 return &style.accessMaskLayers();
31 default:
32 NOTREACHED();
33 return nullptr;
34 }
35 }
36
37 SizeList SizeListPropertyFunctions::getInitialSizeList(CSSPropertyID property)
38 {
39 return getSizeList(property, ComputedStyle::initialStyle());
40 }
41
42 SizeList SizeListPropertyFunctions::getSizeList(CSSPropertyID property, const Co mputedStyle& style)
43 {
44 SizeList result;
45 for (const FillLayer* fillLayer = getFillLayer(property, style); fillLayer & & fillLayer->isSizeSet(); fillLayer = fillLayer->next())
46 result.append(fillLayer->size());
47 return result;
48 }
49
50 void SizeListPropertyFunctions::setSizeList(CSSPropertyID property, ComputedStyl e& style, const SizeList& sizeList)
51 {
52 FillLayer* fillLayer = accessFillLayer(property, style);
53 FillLayer* prev = nullptr;
54 for (const FillSize& size : sizeList) {
55 if (!fillLayer)
56 fillLayer = prev->ensureNext();
57 fillLayer->setSize(size);
58 prev = fillLayer;
59 fillLayer = fillLayer->next();
60 }
61 while (fillLayer) {
62 fillLayer->clearSize();
63 fillLayer = fillLayer->next();
64 }
65 }
66
67 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698