float BasicShapeEllipse::floatValueForRadiusInBox(const BasicShapeRadius& radius, float center, float boxWidthOrHeight) const { if (radius.type() == BasicShapeRadius::Value) return floatValueForLength(radius.value(), boxWidthOrHeight); if (radius.type() == BasicShapeRadius::ClosestSide) return std::min(center, boxWidthOrHeight - center); ASSERT(radius.type() == BasicShapeRadius::FarthestSide); return std::max(center, boxWidthOrHeight - center); }
static PassRefPtr<CSSPrimitiveValue> basicShapeRadiusToCSSValue(CSSValuePool& pool, const RenderStyle& style, const BasicShapeRadius& radius) { switch (radius.type()) { case BasicShapeRadius::Value: return pool.createValue(radius.value(), style); case BasicShapeRadius::ClosestSide: return pool.createIdentifierValue(CSSValueClosestSide); case BasicShapeRadius::FarthestSide: return pool.createIdentifierValue(CSSValueFarthestSide); } ASSERT_NOT_REACHED(); return 0; }