Bug 1326407 Part 4 - Extract a function to convert a rect to float manager's logical coordinate. r=dbaron

MozReview-Commit-ID: Ag6V6XmlHIU

--HG--
extra : rebase_source : e47c6673a22c9e2de595e86a519c927546f68a96
This commit is contained in:
Ting-Yu Lin 2017-02-16 10:51:48 +08:00
Родитель be522fca9a
Коммит 80b589bbdc
2 изменённых файлов: 14 добавлений и 8 удалений

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

@ -650,10 +650,8 @@ nsFloatManager::FloatInfo::FloatInfo(nsIFrame* aFrame,
WritingMode aWM,
const nsSize& aContainerSize)
: mFrame(aFrame)
, mRect(aMarginRect.LineLeft(aWM, aContainerSize) + aLineLeft,
aMarginRect.BStart(aWM) + aBlockStart,
aMarginRect.ISize(aWM),
aMarginRect.BSize(aWM))
, mRect(ShapeInfo::ConvertToFloatLogical(aMarginRect, aWM, aContainerSize) +
nsPoint(aLineLeft, aBlockStart))
{
MOZ_COUNT_CTOR(nsFloatManager::FloatInfo);
@ -675,10 +673,8 @@ nsFloatManager::FloatInfo::FloatInfo(nsIFrame* aFrame,
ShapeInfo::ComputeShapeBoxRect(shapeOutside, mFrame, aMarginRect, aWM);
if (shapeOutside.GetType() == StyleShapeSourceType::Box) {
nsRect rect(shapeBoxRect.LineLeft(aWM, aContainerSize),
shapeBoxRect.BStart(aWM),
shapeBoxRect.ISize(aWM),
shapeBoxRect.BSize(aWM));
nsRect rect = ShapeInfo::ConvertToFloatLogical(shapeBoxRect, aWM,
aContainerSize);
mShapeInfo = MakeUnique<BoxShapeInfo>(rect, mFrame);
} else if (shapeOutside.GetType() == StyleShapeSourceType::Shape) {
StyleBasicShape* const basicShape = shapeOutside.GetBasicShape();

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

@ -367,6 +367,16 @@ private:
const mozilla::LogicalRect& aMarginRect,
mozilla::WritingMode aWM);
// Convert the LogicalRect to the special logical coordinate space used
// in float manager.
static nsRect ConvertToFloatLogical(const mozilla::LogicalRect& aRect,
mozilla::WritingMode aWM,
const nsSize& aContainerSize)
{
return nsRect(aRect.LineLeft(aWM, aContainerSize), aRect.BStart(aWM),
aRect.ISize(aWM), aRect.BSize(aWM));
}
static mozilla::UniquePtr<ShapeInfo> CreateCircleOrEllipse(
mozilla::StyleBasicShape* const aBasicShape,
const mozilla::LogicalRect& aShapeBoxRect,