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

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

Issue 2384263003: Reflow comments in core/animation and subdirs (Closed)
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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 "core/animation/CSSSizeListInterpolationType.h" 5 #include "core/animation/CSSSizeListInterpolationType.h"
6 6
7 #include "core/animation/ListInterpolationFunctions.h" 7 #include "core/animation/ListInterpolationFunctions.h"
8 #include "core/animation/SizeInterpolationFunctions.h" 8 #include "core/animation/SizeInterpolationFunctions.h"
9 #include "core/animation/SizeListPropertyFunctions.h" 9 #include "core/animation/SizeListPropertyFunctions.h"
10 #include "core/css/CSSValueList.h" 10 #include "core/css/CSSValueList.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 return m_inheritedSizeList == 66 return m_inheritedSizeList ==
67 SizeListPropertyFunctions::getSizeList( 67 SizeListPropertyFunctions::getSizeList(
68 m_property, *environment.state().parentStyle()); 68 m_property, *environment.state().parentStyle());
69 } 69 }
70 70
71 CSSPropertyID m_property; 71 CSSPropertyID m_property;
72 SizeList m_inheritedSizeList; 72 SizeList m_inheritedSizeList;
73 }; 73 };
74 74
75 InterpolationValue convertSizeList(const SizeList& sizeList, float zoom) { 75 InterpolationValue convertSizeList(const SizeList& sizeList, float zoom) {
76 // Flatten pairs of width/height into individual items, even for contain and c over keywords. 76 // Flatten pairs of width/height into individual items, even for contain and
77 // cover keywords.
77 return ListInterpolationFunctions::createList( 78 return ListInterpolationFunctions::createList(
78 sizeList.size() * 2, 79 sizeList.size() * 2,
79 [&sizeList, zoom](size_t index) -> InterpolationValue { 80 [&sizeList, zoom](size_t index) -> InterpolationValue {
80 bool convertWidth = index % 2 == 0; 81 bool convertWidth = index % 2 == 0;
81 return SizeInterpolationFunctions::convertFillSizeSide( 82 return SizeInterpolationFunctions::convertFillSizeSide(
82 sizeList[index / 2], zoom, convertWidth); 83 sizeList[index / 2], zoom, convertWidth);
83 }); 84 });
84 } 85 }
85 86
86 InterpolationValue maybeConvertCSSSizeList(const CSSValue& value) { 87 InterpolationValue maybeConvertCSSSizeList(const CSSValue& value) {
87 // CSSPropertyParser doesn't put single values in lists so wrap it up in a tem porary list. 88 // CSSPropertyParser doesn't put single values in lists so wrap it up in a
89 // temporary list.
88 const CSSValueList* list = nullptr; 90 const CSSValueList* list = nullptr;
89 if (!value.isBaseValueList()) { 91 if (!value.isBaseValueList()) {
90 CSSValueList* tempList = CSSValueList::createCommaSeparated(); 92 CSSValueList* tempList = CSSValueList::createCommaSeparated();
91 tempList->append(value); 93 tempList->append(value);
92 list = tempList; 94 list = tempList;
93 } else { 95 } else {
94 list = toCSSValueList(&value); 96 list = toCSSValueList(&value);
95 } 97 }
96 98
97 // Flatten pairs of width/height into individual items, even for contain and c over keywords. 99 // Flatten pairs of width/height into individual items, even for contain and
100 // cover keywords.
98 return ListInterpolationFunctions::createList( 101 return ListInterpolationFunctions::createList(
99 list->length() * 2, [list](size_t index) -> InterpolationValue { 102 list->length() * 2, [list](size_t index) -> InterpolationValue {
100 const CSSValue& cssSize = list->item(index / 2); 103 const CSSValue& cssSize = list->item(index / 2);
101 bool convertWidth = index % 2 == 0; 104 bool convertWidth = index % 2 == 0;
102 return SizeInterpolationFunctions::maybeConvertCSSSizeSide( 105 return SizeInterpolationFunctions::maybeConvertCSSSizeSide(
103 cssSize, convertWidth); 106 cssSize, convertWidth);
104 }); 107 });
105 } 108 }
106 109
107 InterpolationValue CSSSizeListInterpolationType::maybeConvertNeutral( 110 InterpolationValue CSSSizeListInterpolationType::maybeConvertNeutral(
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 sizeList[i] = SizeInterpolationFunctions::createFillSize( 187 sizeList[i] = SizeInterpolationFunctions::createFillSize(
185 *interpolableList.get(i * 2), nonInterpolableList.get(i * 2), 188 *interpolableList.get(i * 2), nonInterpolableList.get(i * 2),
186 *interpolableList.get(i * 2 + 1), nonInterpolableList.get(i * 2 + 1), 189 *interpolableList.get(i * 2 + 1), nonInterpolableList.get(i * 2 + 1),
187 environment.state().cssToLengthConversionData()); 190 environment.state().cssToLengthConversionData());
188 } 191 }
189 SizeListPropertyFunctions::setSizeList( 192 SizeListPropertyFunctions::setSizeList(
190 cssProperty(), *environment.state().style(), sizeList); 193 cssProperty(), *environment.state().style(), sizeList);
191 } 194 }
192 195
193 } // namespace blink 196 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698