зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1086883 - Convert writing modes where necessary for orthogonal flows when collapsing margins in nsBlockReflowContext methods. r=smontagu
This commit is contained in:
Родитель
80761c3ec8
Коммит
bb857cabb0
|
@ -3065,10 +3065,10 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
|||
// Now compute the collapsed margin-block-start value into
|
||||
// aState.mPrevBEndMargin, assuming that all child margins
|
||||
// collapse down to clearanceFrame.
|
||||
nsBlockReflowContext::ComputeCollapsedBStartMargin(reflowState,
|
||||
&aState.mPrevBEndMargin,
|
||||
clearanceFrame,
|
||||
&mayNeedRetry);
|
||||
brc.ComputeCollapsedBStartMargin(reflowState,
|
||||
&aState.mPrevBEndMargin,
|
||||
clearanceFrame,
|
||||
&mayNeedRetry);
|
||||
|
||||
// XXX optimization; we could check the collapsing children to see if they are sure
|
||||
// to require clearance, and so avoid retrying them
|
||||
|
@ -3101,10 +3101,10 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
|||
|
||||
// Compute the collapsed margin again, ignoring the incoming margin this time
|
||||
mayNeedRetry = false;
|
||||
nsBlockReflowContext::ComputeCollapsedBStartMargin(reflowState,
|
||||
&aState.mPrevBEndMargin,
|
||||
clearanceFrame,
|
||||
&mayNeedRetry);
|
||||
brc.ComputeCollapsedBStartMargin(reflowState,
|
||||
&aState.mPrevBEndMargin,
|
||||
clearanceFrame,
|
||||
&mayNeedRetry);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5855,9 +5855,9 @@ nsBlockFrame::ReflowFloat(nsBlockReflowState& aState,
|
|||
floatRS.mDiscoveredClearance = nullptr;
|
||||
// Only first in flow gets a top margin.
|
||||
if (!aFloat->GetPrevInFlow()) {
|
||||
nsBlockReflowContext::ComputeCollapsedBStartMargin(floatRS, &margin,
|
||||
clearanceFrame,
|
||||
&mayNeedRetry);
|
||||
brc.ComputeCollapsedBStartMargin(floatRS, &margin,
|
||||
clearanceFrame,
|
||||
&mayNeedRetry);
|
||||
|
||||
if (mayNeedRetry && !clearanceFrame) {
|
||||
floatRS.mDiscoveredClearance = &clearanceFrame;
|
||||
|
|
|
@ -57,8 +57,10 @@ nsBlockReflowContext::ComputeCollapsedBStartMargin(const nsHTMLReflowState& aRS,
|
|||
bool* aBlockIsEmpty)
|
||||
{
|
||||
WritingMode wm = aRS.GetWritingMode();
|
||||
// Include frame's block-start margin
|
||||
aMargin->Include(aRS.ComputedLogicalMargin().BStart(wm));
|
||||
WritingMode parentWM = mMetrics.GetWritingMode();
|
||||
|
||||
// Include block-start element of frame's margin
|
||||
aMargin->Include(aRS.ComputedLogicalMargin().ConvertTo(parentWM, wm).BStart(parentWM));
|
||||
|
||||
// The inclusion of the block-end margin when empty is done by the caller
|
||||
// since it doesn't need to be done by the top-level (non-recursive)
|
||||
|
@ -174,8 +176,8 @@ nsBlockReflowContext::ComputeCollapsedBStartMargin(const nsHTMLReflowState& aRS,
|
|||
if (isEmpty) {
|
||||
WritingMode innerWM = innerReflowState.GetWritingMode();
|
||||
LogicalMargin innerMargin =
|
||||
innerReflowState.ComputedLogicalMargin().ConvertTo(wm, innerWM);
|
||||
aMargin->Include(innerMargin.BEnd(wm));
|
||||
innerReflowState.ComputedLogicalMargin().ConvertTo(parentWM, innerWM);
|
||||
aMargin->Include(innerMargin.BEnd(parentWM));
|
||||
}
|
||||
}
|
||||
if (outerReflowState != &aRS) {
|
||||
|
|
|
@ -54,9 +54,11 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Computes the collapsed block-start margin for a block whose reflow state
|
||||
* is in aRS.
|
||||
* The computed margin is added into aMargin.
|
||||
* Computes the collapsed block-start margin (in the context's parent's
|
||||
* writing mode) for a block whose reflow state is in aRS.
|
||||
* The computed margin is added into aMargin, whose writing mode is the
|
||||
* parent's mode as found in mMetrics.GetWritingMode(); note this may not be
|
||||
* the block's own writing mode as found in aRS.
|
||||
* If aClearanceFrame is null then this is the first optimistic pass which
|
||||
* shall assume that no frames have clearance, and we clear the HasClearance
|
||||
* on all frames encountered.
|
||||
|
@ -70,11 +72,11 @@ public:
|
|||
* We return true if we changed the clearance state of any line and marked it
|
||||
* dirty.
|
||||
*/
|
||||
static bool ComputeCollapsedBStartMargin(const nsHTMLReflowState& aRS,
|
||||
nsCollapsingMargin* aMargin,
|
||||
nsIFrame* aClearanceFrame,
|
||||
bool* aMayNeedRetry,
|
||||
bool* aIsEmpty = nullptr);
|
||||
bool ComputeCollapsedBStartMargin(const nsHTMLReflowState& aRS,
|
||||
nsCollapsingMargin* aMargin,
|
||||
nsIFrame* aClearanceFrame,
|
||||
bool* aMayNeedRetry,
|
||||
bool* aIsEmpty = nullptr);
|
||||
|
||||
protected:
|
||||
nsPresContext* mPresContext;
|
||||
|
|
Загрузка…
Ссылка в новой задаче