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

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

Issue 1682843003: Add additive animation support for border-radius CSS properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_positionInterpolation
Patch Set: Rebased 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
index ace98e122848de0036b402b52b45eefd608051f8..247797fb14508ddab0fe0754060ee222f49d3408 100644
--- a/third_party/WebKit/Source/core/animation/LengthListPropertyFunctions.cpp
+++ b/third_party/WebKit/Source/core/animation/LengthListPropertyFunctions.cpp
@@ -87,6 +87,10 @@ ValueRange LengthListPropertyFunctions::valueRange(CSSPropertyID property)
case CSSPropertyWebkitMaskPositionY:
return ValueRangeAll;
+ case CSSPropertyBorderBottomLeftRadius:
+ case CSSPropertyBorderBottomRightRadius:
+ case CSSPropertyBorderTopLeftRadius:
+ case CSSPropertyBorderTopRightRadius:
case CSSPropertyStrokeDasharray:
return ValueRangeNonNegative;
@@ -101,27 +105,47 @@ Vector<Length> LengthListPropertyFunctions::getInitialLengthList(CSSPropertyID p
return getLengthList(property, *ComputedStyle::initialStyle());
}
-Vector<Length> LengthListPropertyFunctions::getLengthList(CSSPropertyID property, const ComputedStyle& style)
+static Vector<Length> toVector(const LengthPoint& point)
{
- Vector<Length> result;
+ Vector<Length> result(2);
+ result[0] = point.x();
+ result[1] = point.y();
+ return result;
+}
+
+static Vector<Length> toVector(const LengthSize& size)
+{
+ Vector<Length> result(2);
+ result[0] = size.width();
+ result[1] = size.height();
+ return result;
+}
+Vector<Length> LengthListPropertyFunctions::getLengthList(CSSPropertyID property, const ComputedStyle& style)
+{
switch (property) {
- case CSSPropertyStrokeDasharray:
+ case CSSPropertyStrokeDasharray: {
if (style.strokeDashArray())
- result.appendVector(style.strokeDashArray()->vector());
- return result;
+ return style.strokeDashArray()->vector();
+ return Vector<Length>();
+ }
case CSSPropertyObjectPosition:
- result.append(style.objectPosition().x());
- result.append(style.objectPosition().y());
- return result;
+ return toVector(style.objectPosition());
case CSSPropertyPerspectiveOrigin:
- result.append(style.perspectiveOrigin().x());
- result.append(style.perspectiveOrigin().y());
- return result;
+ return toVector(style.perspectiveOrigin());
+ case CSSPropertyBorderBottomLeftRadius:
+ return toVector(style.borderBottomLeftRadius());
+ case CSSPropertyBorderBottomRightRadius:
+ return toVector(style.borderBottomRightRadius());
+ case CSSPropertyBorderTopLeftRadius:
+ return toVector(style.borderTopLeftRadius());
+ case CSSPropertyBorderTopRightRadius:
+ return toVector(style.borderTopRightRadius());
default:
break;
}
+ Vector<Length> result;
const FillLayer* fillLayer = getFillLayer(property, style);
FillLayerMethods fillLayerMethods(property);
while (fillLayer && (fillLayer->*fillLayerMethods.isSet)()) {
@@ -131,6 +155,18 @@ Vector<Length> LengthListPropertyFunctions::getLengthList(CSSPropertyID property
return result;
}
+static LengthPoint pointFromVector(const Vector<Length>& list)
+{
+ ASSERT(list.size() == 2);
+ return LengthPoint(list[0], list[1]);
+}
+
+static LengthSize sizeFromVector(const Vector<Length>& list)
+{
+ ASSERT(list.size() == 2);
+ return LengthSize(list[0], list[1]);
+}
+
void LengthListPropertyFunctions::setLengthList(CSSPropertyID property, ComputedStyle& style, Vector<Length>&& lengthList)
{
switch (property) {
@@ -138,10 +174,22 @@ void LengthListPropertyFunctions::setLengthList(CSSPropertyID property, Computed
style.setStrokeDashArray(lengthList.isEmpty() ? nullptr : RefVector<Length>::create(std::move(lengthList)));
return;
case CSSPropertyObjectPosition:
- style.setObjectPosition(LengthPoint(lengthList[0], lengthList[1]));
+ style.setObjectPosition(pointFromVector(lengthList));
return;
case CSSPropertyPerspectiveOrigin:
- style.setPerspectiveOrigin(LengthPoint(lengthList[0], lengthList[1]));
+ style.setPerspectiveOrigin(pointFromVector(lengthList));
+ return;
+ case CSSPropertyBorderBottomLeftRadius:
+ style.setBorderBottomLeftRadius(sizeFromVector(lengthList));
+ return;
+ case CSSPropertyBorderBottomRightRadius:
+ style.setBorderBottomRightRadius(sizeFromVector(lengthList));
+ return;
+ case CSSPropertyBorderTopLeftRadius:
+ style.setBorderTopLeftRadius(sizeFromVector(lengthList));
+ return;
+ case CSSPropertyBorderTopRightRadius:
+ style.setBorderTopRightRadius(sizeFromVector(lengthList));
return;
default:
break;

Powered by Google App Engine
This is Rietveld 408576698