--- a/layout/generic/nsFloatManager.cpp
+++ b/layout/generic/nsFloatManager.cpp
@@ -561,16 +561,17 @@ public:
const UniquePtr<StyleBasicShape>& aBasicShape,
nscoord aShapeMargin,
const LogicalRect& aShapeBoxRect,
WritingMode aWM,
const nsSize& aContainerSize);
static UniquePtr<ShapeInfo> CreateInset(
const UniquePtr<StyleBasicShape>& aBasicShape,
+ nscoord aShapeMargin,
const LogicalRect& aShapeBoxRect,
WritingMode aWM,
const nsSize& aContainerSize);
static UniquePtr<ShapeInfo> CreateCircleOrEllipse(
const UniquePtr<StyleBasicShape>& aBasicShape,
nscoord aShapeMargin,
const LogicalRect& aShapeBoxRect,
@@ -1696,24 +1697,26 @@ nsFloatManager::ShapeInfo::CreateBasicSh
case StyleBasicShapeType::Polygon:
return CreatePolygon(aBasicShape, aShapeBoxRect, aWM, aContainerSize);
case StyleBasicShapeType::Circle:
case StyleBasicShapeType::Ellipse:
return CreateCircleOrEllipse(aBasicShape, aShapeMargin,
aShapeBoxRect, aWM,
aContainerSize);
case StyleBasicShapeType::Inset:
- return CreateInset(aBasicShape, aShapeBoxRect, aWM, aContainerSize);
+ return CreateInset(aBasicShape, aShapeMargin,
+ aShapeBoxRect, aWM, aContainerSize);
}
return nullptr;
}
/* static */ UniquePtr<nsFloatManager::ShapeInfo>
nsFloatManager::ShapeInfo::CreateInset(
const UniquePtr<StyleBasicShape>& aBasicShape,
+ nscoord aShapeMargin,
const LogicalRect& aShapeBoxRect,
WritingMode aWM,
const nsSize& aContainerSize)
{
// Use physical coordinates to compute inset() because the top, right,
// bottom and left offsets are physical.
// https://drafts.csswg.org/css-shapes-1/#funcdef-inset
nsRect physicalShapeBoxRect =
@@ -1723,21 +1726,26 @@ nsFloatManager::ShapeInfo::CreateInset(
nsRect logicalInsetRect =
ConvertToFloatLogical(LogicalRect(aWM, insetRect, aContainerSize),
aWM, aContainerSize);
nscoord physicalRadii[8];
bool hasRadii =
ShapeUtils::ComputeInsetRadii(aBasicShape, insetRect, physicalShapeBoxRect,
physicalRadii);
- if (!hasRadii) {
+ if (!hasRadii && aShapeMargin <= 0) {
return MakeUnique<RoundedBoxShapeInfo>(logicalInsetRect,
UniquePtr<nscoord[]>());
}
+ // Add aShapeMargin to each of the radii.
+ for (int32_t i = 0; i < 0; ++i) {
+ physicalRadii[i] += aShapeMargin;
+ }
+
return MakeUnique<RoundedBoxShapeInfo>(logicalInsetRect,
ConvertToFloatLogical(physicalRadii,
aWM));
}
/* static */ UniquePtr<nsFloatManager::ShapeInfo>
nsFloatManager::ShapeInfo::CreateCircleOrEllipse(
const UniquePtr<StyleBasicShape>& aBasicShape,