summaryrefslogtreecommitdiffstats
path: root/layout/generic/nsColumnSetFrame.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'layout/generic/nsColumnSetFrame.cpp')
-rw-r--r--layout/generic/nsColumnSetFrame.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/layout/generic/nsColumnSetFrame.cpp b/layout/generic/nsColumnSetFrame.cpp
index ad36ba1a8..6ea15d4d2 100644
--- a/layout/generic/nsColumnSetFrame.cpp
+++ b/layout/generic/nsColumnSetFrame.cpp
@@ -183,18 +183,15 @@ nsColumnSetFrame::GetAvailableContentBSize(const ReflowInput& aReflowInput)
static nscoord
GetColumnGap(nsColumnSetFrame* aFrame,
- const nsStyleColumn* aColStyle)
+ const nsStyleColumn* aColStyle,
+ nscoord aPercentageBasis)
{
- if (eStyleUnit_Normal == aColStyle->mColumnGap.GetUnit())
+ const auto& columnGap = aColStyle->mColumnGap;
+ if (columnGap.GetUnit() == eStyleUnit_Normal) {
return aFrame->StyleFont()->mFont.size;
- if (eStyleUnit_Coord == aColStyle->mColumnGap.GetUnit()) {
- nscoord colGap = aColStyle->mColumnGap.GetCoordValue();
- NS_ASSERTION(colGap >= 0, "negative column gap");
- return colGap;
}
- NS_NOTREACHED("Unknown gap type");
- return 0;
+ return nsLayoutUtils::ResolveGapToLength(columnGap, aPercentageBasis);
}
nsColumnSetFrame::ReflowConfig
@@ -227,7 +224,7 @@ nsColumnSetFrame::ChooseColumnStrategy(const ReflowInput& aReflowInput,
colBSize = std::min(colBSize, aReflowInput.ComputedMaxBSize());
}
- nscoord colGap = GetColumnGap(this, colStyle);
+ nscoord colGap = GetColumnGap(this, colStyle, aReflowInput.ComputedISize());
int32_t numColumns = colStyle->mColumnCount;
// If column-fill is set to 'balance', then we want to balance the columns.
@@ -403,7 +400,7 @@ nsColumnSetFrame::GetMinISize(nsRenderingContext *aRenderingContext)
// include n-1 column gaps.
colISize = iSize;
iSize *= colStyle->mColumnCount;
- nscoord colGap = GetColumnGap(this, colStyle);
+ nscoord colGap = GetColumnGap(this, colStyle, NS_UNCONSTRAINEDSIZE);
iSize += colGap * (colStyle->mColumnCount - 1);
// The multiplication above can make 'width' negative (integer overflow),
// so use std::max to protect against that.
@@ -424,7 +421,7 @@ nsColumnSetFrame::GetPrefISize(nsRenderingContext *aRenderingContext)
nscoord result = 0;
DISPLAY_PREF_WIDTH(this, result);
const nsStyleColumn* colStyle = StyleColumn();
- nscoord colGap = GetColumnGap(this, colStyle);
+ nscoord colGap = GetColumnGap(this, colStyle, NS_UNCONSTRAINEDSIZE);
nscoord colISize;
if (colStyle->mColumnWidth.GetUnit() == eStyleUnit_Coord) {