diff --git a/layout/generic/nsFloatManager.cpp b/layout/generic/nsFloatManager.cpp index 7b64b9acae2c..bbd039ac6695 100644 --- a/layout/generic/nsFloatManager.cpp +++ b/layout/generic/nsFloatManager.cpp @@ -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(rect, mFrame); } else if (shapeOutside.GetType() == StyleShapeSourceType::Shape) { StyleBasicShape* const basicShape = shapeOutside.GetBasicShape(); diff --git a/layout/generic/nsFloatManager.h b/layout/generic/nsFloatManager.h index 09fae9f8f256..cb08caa4852f 100644 --- a/layout/generic/nsFloatManager.h +++ b/layout/generic/nsFloatManager.h @@ -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 CreateCircleOrEllipse( mozilla::StyleBasicShape* const aBasicShape, const mozilla::LogicalRect& aShapeBoxRect,