Bug 1418224 Part 2 - Extract ShapeInfo::CreateBasicShape(). r=heycam

MozReview-Commit-ID: DZ1O0CzzsyT

--HG--
extra : rebase_source : d5f03aeea3b10810b07fb001b9ff4dbfc7e03c64
This commit is contained in:
Ting-Yu Lin 2017-11-21 18:24:34 +08:00
Родитель dd54cdcea0
Коммит 56d6b694a2
2 изменённых файлов: 28 добавлений и 18 удалений

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

@ -776,24 +776,8 @@ nsFloatManager::FloatInfo::FloatInfo(nsIFrame* aFrame,
aContainerSize);
} else if (shapeOutside.GetType() == StyleShapeSourceType::Shape) {
const UniquePtr<StyleBasicShape>& basicShape = shapeOutside.GetBasicShape();
switch (basicShape->GetShapeType()) {
case StyleBasicShapeType::Polygon:
mShapeInfo =
ShapeInfo::CreatePolygon(basicShape, shapeBoxRect, aWM,
aContainerSize);
break;
case StyleBasicShapeType::Circle:
case StyleBasicShapeType::Ellipse:
mShapeInfo =
ShapeInfo::CreateCircleOrEllipse(basicShape, shapeBoxRect, aWM,
aContainerSize);
break;
case StyleBasicShapeType::Inset:
mShapeInfo =
ShapeInfo::CreateInset(basicShape, shapeBoxRect, aWM, aContainerSize);
break;
}
mShapeInfo = ShapeInfo::CreateBasicShape(basicShape, shapeBoxRect, aWM,
aContainerSize);
} else {
MOZ_ASSERT_UNREACHABLE("Unknown StyleShapeSourceType!");
}
@ -960,6 +944,26 @@ nsFloatManager::ShapeInfo::CreateShapeBox(
aWM));
}
/* static */ UniquePtr<nsFloatManager::ShapeInfo>
nsFloatManager::ShapeInfo::CreateBasicShape(
const UniquePtr<StyleBasicShape>& aBasicShape,
const LogicalRect& aShapeBoxRect,
WritingMode aWM,
const nsSize& aContainerSize)
{
switch (aBasicShape->GetShapeType()) {
case StyleBasicShapeType::Polygon:
return CreatePolygon(aBasicShape, aShapeBoxRect, aWM, aContainerSize);
case StyleBasicShapeType::Circle:
case StyleBasicShapeType::Ellipse:
return CreateCircleOrEllipse(aBasicShape, aShapeBoxRect, aWM,
aContainerSize);
case StyleBasicShapeType::Inset:
return CreateInset(aBasicShape, aShapeBoxRect, aWM, aContainerSize);
}
return nullptr;
}
/* static */ UniquePtr<nsFloatManager::ShapeInfo>
nsFloatManager::ShapeInfo::CreateInset(
const UniquePtr<StyleBasicShape>& aBasicShape,

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

@ -381,6 +381,12 @@ private:
mozilla::WritingMode aWM,
const nsSize& aContainerSize);
static mozilla::UniquePtr<ShapeInfo> CreateBasicShape(
const mozilla::UniquePtr<mozilla::StyleBasicShape>& aBasicShape,
const mozilla::LogicalRect& aShapeBoxRect,
mozilla::WritingMode aWM,
const nsSize& aContainerSize);
static mozilla::UniquePtr<ShapeInfo> CreateInset(
const mozilla::UniquePtr<mozilla::StyleBasicShape>& aBasicShape,
const mozilla::LogicalRect& aShapeBoxRect,