mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 02:25:34 +00:00
Bug 1497990 Part 2 - Do not carry block-end margin out of ColumnSetFrame. r=dbaron
Also, remove the unused NS_BLOCK_MARGIN_ROOT flag set on nsColumnSetFrame. Differential Revision: https://phabricator.services.mozilla.com/D8783 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
fe4ef80141
commit
5a22a68c3c
@ -107,7 +107,7 @@ nsContainerFrame*
|
||||
NS_NewColumnSetFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle, nsFrameState aStateFlags)
|
||||
{
|
||||
nsColumnSetFrame* it = new (aPresShell) nsColumnSetFrame(aStyle);
|
||||
it->AddStateBits(aStateFlags | NS_BLOCK_MARGIN_ROOT);
|
||||
it->AddStateBits(aStateFlags);
|
||||
return it;
|
||||
}
|
||||
|
||||
@ -481,12 +481,11 @@ nsColumnSetFrame::ReflowColumns(ReflowOutput& aDesiredSize,
|
||||
nsReflowStatus& aReflowStatus,
|
||||
ReflowConfig& aConfig,
|
||||
bool aLastColumnUnbounded,
|
||||
nsCollapsingMargin* aCarriedOutBEndMargin,
|
||||
ColumnBalanceData& aColData)
|
||||
{
|
||||
bool feasible = ReflowChildren(aDesiredSize, aReflowInput,
|
||||
aReflowStatus, aConfig, aLastColumnUnbounded,
|
||||
aCarriedOutBEndMargin, aColData);
|
||||
aColData);
|
||||
|
||||
if (aColData.mHasExcessBSize) {
|
||||
aConfig = ChooseColumnStrategy(aReflowInput, true);
|
||||
@ -495,8 +494,7 @@ nsColumnSetFrame::ReflowColumns(ReflowOutput& aDesiredSize,
|
||||
// end up with a stale column height for some of our columns, since we
|
||||
// bailed out of balancing.
|
||||
feasible = ReflowChildren(aDesiredSize, aReflowInput, aReflowStatus,
|
||||
aConfig, aLastColumnUnbounded,
|
||||
aCarriedOutBEndMargin, aColData);
|
||||
aConfig, aLastColumnUnbounded, aColData);
|
||||
}
|
||||
|
||||
return feasible;
|
||||
@ -595,7 +593,6 @@ nsColumnSetFrame::ReflowChildren(ReflowOutput& aDesiredSize,
|
||||
nsReflowStatus& aStatus,
|
||||
const ReflowConfig& aConfig,
|
||||
bool aUnboundedLastColumn,
|
||||
nsCollapsingMargin* aCarriedOutBEndMargin,
|
||||
ColumnBalanceData& aColData)
|
||||
{
|
||||
aColData.Reset();
|
||||
@ -807,7 +804,7 @@ nsColumnSetFrame::ReflowChildren(ReflowOutput& aDesiredSize,
|
||||
reflowNext = aStatus.NextInFlowNeedsReflow();
|
||||
|
||||
COLUMN_SET_LOG("%s: Reflowed child #%d %p: status=%s,"
|
||||
" desiredSize=(%d,%d), CarriedOutBEndMargin=%d",
|
||||
" desiredSize=(%d,%d), CarriedOutBEndMargin=%d (ignored)",
|
||||
__func__,
|
||||
columnCount,
|
||||
child,
|
||||
@ -816,9 +813,23 @@ nsColumnSetFrame::ReflowChildren(ReflowOutput& aDesiredSize,
|
||||
kidDesiredSize.BSize(wm),
|
||||
kidDesiredSize.mCarriedOutBEndMargin.get());
|
||||
|
||||
NS_FRAME_TRACE_REFLOW_OUT("Column::Reflow", aStatus);
|
||||
// The carried-out block-end margin of column content might be non-zero
|
||||
// when we try to find the best column balancing block size, but it should
|
||||
// never affect the size column set nor be further carried out. Set it to
|
||||
// zero.
|
||||
//
|
||||
// FIXME: For some types of fragmentation, we should carry the margin into
|
||||
// the next column. Also see
|
||||
// https://drafts.csswg.org/css-break-4/#break-margins
|
||||
//
|
||||
// FIXME: This should never happen for the last column, since it should be
|
||||
// a margin root; see nsBlockFrame::IsMarginRoot(). However, sometimes the
|
||||
// last column has an empty continuation while searching for the best
|
||||
// column balancing bsize, which prevents the last column from being a
|
||||
// margin root.
|
||||
kidDesiredSize.mCarriedOutBEndMargin.Zero();
|
||||
|
||||
*aCarriedOutBEndMargin = kidDesiredSize.mCarriedOutBEndMargin;
|
||||
NS_FRAME_TRACE_REFLOW_OUT("Column::Reflow", aStatus);
|
||||
|
||||
FinishReflowChild(child, PresContext(), kidDesiredSize,
|
||||
&kidReflowInput, wm, childOrigin, containerSize, 0);
|
||||
@ -1032,7 +1043,6 @@ nsColumnSetFrame::FindBestBalanceBSize(const ReflowInput& aReflowInput,
|
||||
ReflowConfig& aConfig,
|
||||
ColumnBalanceData& aColData,
|
||||
ReflowOutput& aDesiredSize,
|
||||
nsCollapsingMargin& aOutMargin,
|
||||
bool& aUnboundedLastColumn,
|
||||
bool& aRunWasFeasible,
|
||||
nsReflowStatus& aStatus)
|
||||
@ -1144,7 +1154,7 @@ nsColumnSetFrame::FindBestBalanceBSize(const ReflowInput& aReflowInput,
|
||||
aUnboundedLastColumn = false;
|
||||
MarkPrincipalChildrenDirty(this);
|
||||
feasible = ReflowColumns(aDesiredSize, aReflowInput, aStatus, aConfig, false,
|
||||
&aOutMargin, aColData);
|
||||
aColData);
|
||||
|
||||
if (!aConfig.mIsBalancing) {
|
||||
// Looks like we had excess height when balancing, so we gave up on
|
||||
@ -1174,7 +1184,7 @@ nsColumnSetFrame::FindBestBalanceBSize(const ReflowInput& aReflowInput,
|
||||
MarkPrincipalChildrenDirty(this);
|
||||
feasible = ReflowColumns(aDesiredSize, aReflowInput, aStatus, aConfig,
|
||||
availableContentBSize == NS_UNCONSTRAINEDSIZE,
|
||||
&aOutMargin, aColData);
|
||||
aColData);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1238,20 +1248,17 @@ nsColumnSetFrame::Reflow(nsPresContext* aPresContext,
|
||||
// content back here and then have to push it out again!
|
||||
nsIFrame* nextInFlow = GetNextInFlow();
|
||||
bool unboundedLastColumn = config.mIsBalancing && !nextInFlow;
|
||||
nsCollapsingMargin carriedOutBottomMargin;
|
||||
ColumnBalanceData colData;
|
||||
|
||||
bool feasible = ReflowColumns(aDesiredSize, aReflowInput, aStatus, config,
|
||||
unboundedLastColumn, &carriedOutBottomMargin,
|
||||
colData);
|
||||
unboundedLastColumn, colData);
|
||||
|
||||
// If we're not balancing, then we're already done, since we should have
|
||||
// reflown all of our children, and there is no need for a binary search to
|
||||
// determine proper column height.
|
||||
if (config.mIsBalancing && !aPresContext->HasPendingInterrupt()) {
|
||||
FindBestBalanceBSize(aReflowInput, aPresContext, config, colData,
|
||||
aDesiredSize, carriedOutBottomMargin,
|
||||
unboundedLastColumn, feasible, aStatus);
|
||||
aDesiredSize, unboundedLastColumn, feasible, aStatus);
|
||||
}
|
||||
|
||||
if (aPresContext->HasPendingInterrupt() &&
|
||||
@ -1271,8 +1278,6 @@ nsColumnSetFrame::Reflow(nsPresContext* aPresContext,
|
||||
|
||||
FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize, aReflowInput, aStatus, false);
|
||||
|
||||
aDesiredSize.mCarriedOutBEndMargin = carriedOutBottomMargin;
|
||||
|
||||
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,6 @@ protected:
|
||||
nsReflowStatus& aReflowStatus,
|
||||
ReflowConfig& aConfig,
|
||||
bool aLastColumnUnbounded,
|
||||
nsCollapsingMargin* aCarriedOutBEndMargin,
|
||||
ColumnBalanceData& aColData);
|
||||
|
||||
/**
|
||||
@ -198,8 +197,6 @@ protected:
|
||||
* successive iterations of the balancing process.
|
||||
* @param aDesiredSize The final output size of the column set frame (output
|
||||
* of reflow procedure).
|
||||
* @param aOutMargin The bottom margin of the column set frame that may be
|
||||
* carried out from reflow (and thus collapsed).
|
||||
* @param aUnboundedLastColumn A boolean value indicating that the last column
|
||||
* can be of any height. Used during the first iteration of the
|
||||
* balancing procedure to measure the height of all content in
|
||||
@ -215,7 +212,6 @@ protected:
|
||||
ReflowConfig& aConfig,
|
||||
ColumnBalanceData& aColData,
|
||||
ReflowOutput& aDesiredSize,
|
||||
nsCollapsingMargin& aOutMargin,
|
||||
bool& aUnboundedLastColumn,
|
||||
bool& aRunWasFeasible,
|
||||
nsReflowStatus& aStatus);
|
||||
@ -228,7 +224,6 @@ protected:
|
||||
nsReflowStatus& aStatus,
|
||||
const ReflowConfig& aConfig,
|
||||
bool aLastColumnUnbounded,
|
||||
nsCollapsingMargin* aCarriedOutBEndMargin,
|
||||
ColumnBalanceData& aColData);
|
||||
|
||||
void ForEachColumnRule(const std::function<void(const nsRect& lineRect)>& aSetLineRect,
|
||||
|
@ -0,0 +1,47 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Multi-column Layout Test: multi-column and margin bottom of last child</title>
|
||||
<link rel="author" title="Ting-Yu Lin" href="tlin@mozilla.com">
|
||||
<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-multicol-1/#the-multi-column-model">
|
||||
<link rel="match" href="../reference/ref-filled-green-100px-square-only.html">
|
||||
<meta name="assert" content="This test checks the margin-bottom of the last child of a multi-column should not affect its parent's margin-bottom.">
|
||||
|
||||
<style>
|
||||
article {
|
||||
font: 25px/25px Ahem;
|
||||
color: green;
|
||||
background-color: green;
|
||||
width: 100px;
|
||||
column-count: 2;
|
||||
column-gap: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
article div:last-child {
|
||||
margin-bottom: 13px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<body>
|
||||
<p>Test passes if there is a filled green square.</p>
|
||||
<article>
|
||||
<div>a1 a2 a3 a4</div>
|
||||
<div>a5</div>
|
||||
</article>
|
||||
<article>b1 b2</article>
|
||||
|
||||
<!--
|
||||
Expected result:
|
||||
|
||||
|------+------|
|
||||
| a1 | a4 |
|
||||
| a2 | a5 |
|
||||
| a3 |margin|
|
||||
|------+------|
|
||||
| b1 | b2 |
|
||||
|------+------|
|
||||
-->
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user