Bug 1326407 Part 0 - Add assertion to ShapeUtils functions. r=me

Address Bug 1326407 comment 11.

MozReview-Commit-ID: 8Iy5q3f4yPd

--HG--
extra : rebase_source : b640816e4e06ad172a9322780886fcb47f94507c
This commit is contained in:
Ting-Yu Lin 2017-02-16 10:51:47 +08:00
Родитель fc793df53d
Коммит a43fbc3c79
1 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -40,6 +40,10 @@ nsPoint
ShapeUtils::ComputeCircleOrEllipseCenter(StyleBasicShape* const aBasicShape,
const nsRect& aRefBox)
{
MOZ_ASSERT(aBasicShape->GetShapeType() == StyleBasicShapeType::Circle ||
aBasicShape->GetShapeType() == StyleBasicShapeType::Ellipse,
"The basic shape must be circle() or ellipse!");
nsPoint topLeft, anchor;
nsSize size(aRefBox.Size());
nsImageRenderer::ComputeObjectAnchorPoint(aBasicShape->GetPosition(),
@ -53,6 +57,9 @@ ShapeUtils::ComputeCircleRadius(StyleBasicShape* const aBasicShape,
const nsPoint& aCenter,
const nsRect& aRefBox)
{
MOZ_ASSERT(aBasicShape->GetShapeType() == StyleBasicShapeType::Circle,
"The basic shape must be circle()!");
const nsTArray<nsStyleCoord>& coords = aBasicShape->Coordinates();
MOZ_ASSERT(coords.Length() == 1, "wrong number of arguments");
nscoord r = 0;
@ -82,6 +89,9 @@ ShapeUtils::ComputeEllipseRadii(StyleBasicShape* const aBasicShape,
const nsPoint& aCenter,
const nsRect& aRefBox)
{
MOZ_ASSERT(aBasicShape->GetShapeType() == StyleBasicShapeType::Ellipse,
"The basic shape must be ellipse()!");
const nsTArray<nsStyleCoord>& coords = aBasicShape->Coordinates();
MOZ_ASSERT(coords.Length() == 2, "wrong number of arguments");
nsSize radii;