Bug 1277129 Part 7b - Rename various ReflowState variables to ReflowInput. r=dbaron

This patch is generated by the following script:

function rename() {
find .\
     -type f\
     ! -path "./obj*"\
     ! -path "./.git"\
     ! -path "./.hg"\
     \( -name "*.cpp" -or\
        -name "*.h" \)\
        -exec sed -i -r "s/$1/$2/g" "{}" \;
}

rename "([[:alpha:]]*)([rR])eflowState(s?)" "\1\2eflowInput\3"

MozReview-Commit-ID: ITFO7uMTkSb

--HG--
extra : rebase_source : c91a2e174a0baec60c1b0111ac7636295004ab35
This commit is contained in:
Ting-Yu Lin 2016-07-21 18:36:39 +08:00
Родитель 7a5825e82f
Коммит 40fcd21b9a
154 изменённых файлов: 2412 добавлений и 2412 удалений

Просмотреть файл

@ -489,55 +489,55 @@ RestyleManager::RecomputePosition(nsIFrame* aFrame)
LogicalSize parentSize = parentFrame->GetLogicalSize();
nsFrameState savedState = parentFrame->GetStateBits();
ReflowInput parentReflowState(aFrame->PresContext(), parentFrame,
ReflowInput parentReflowInput(aFrame->PresContext(), parentFrame,
&rc, parentSize);
parentFrame->RemoveStateBits(~nsFrameState(0));
parentFrame->AddStateBits(savedState);
// The bogus parent state here was created with no parent state of its own,
// and therefore it won't have an mCBReflowState set up.
// But we may need one (for InitCBReflowState in a child state), so let's
// and therefore it won't have an mCBReflowInput set up.
// But we may need one (for InitCBReflowInput in a child state), so let's
// try to create one here for the cases where it will be needed.
Maybe<ReflowInput> cbReflowState;
Maybe<ReflowInput> cbReflowInput;
nsIFrame* cbFrame = parentFrame->GetContainingBlock();
if (cbFrame && (aFrame->GetContainingBlock() != parentFrame ||
parentFrame->GetType() == nsGkAtoms::tableFrame)) {
LogicalSize cbSize = cbFrame->GetLogicalSize();
cbReflowState.emplace(cbFrame->PresContext(), cbFrame, &rc, cbSize);
cbReflowState->ComputedPhysicalMargin() = cbFrame->GetUsedMargin();
cbReflowState->ComputedPhysicalPadding() = cbFrame->GetUsedPadding();
cbReflowState->ComputedPhysicalBorderPadding() =
cbReflowInput.emplace(cbFrame->PresContext(), cbFrame, &rc, cbSize);
cbReflowInput->ComputedPhysicalMargin() = cbFrame->GetUsedMargin();
cbReflowInput->ComputedPhysicalPadding() = cbFrame->GetUsedPadding();
cbReflowInput->ComputedPhysicalBorderPadding() =
cbFrame->GetUsedBorderAndPadding();
parentReflowState.mCBReflowState = cbReflowState.ptr();
parentReflowInput.mCBReflowInput = cbReflowInput.ptr();
}
NS_WARN_IF_FALSE(parentSize.ISize(parentWM) != NS_INTRINSICSIZE &&
parentSize.BSize(parentWM) != NS_INTRINSICSIZE,
"parentSize should be valid");
parentReflowState.SetComputedISize(std::max(parentSize.ISize(parentWM), 0));
parentReflowState.SetComputedBSize(std::max(parentSize.BSize(parentWM), 0));
parentReflowState.ComputedPhysicalMargin().SizeTo(0, 0, 0, 0);
parentReflowInput.SetComputedISize(std::max(parentSize.ISize(parentWM), 0));
parentReflowInput.SetComputedBSize(std::max(parentSize.BSize(parentWM), 0));
parentReflowInput.ComputedPhysicalMargin().SizeTo(0, 0, 0, 0);
parentReflowState.ComputedPhysicalPadding() = parentFrame->GetUsedPadding();
parentReflowState.ComputedPhysicalBorderPadding() =
parentReflowInput.ComputedPhysicalPadding() = parentFrame->GetUsedPadding();
parentReflowInput.ComputedPhysicalBorderPadding() =
parentFrame->GetUsedBorderAndPadding();
LogicalSize availSize = parentSize.ConvertTo(frameWM, parentWM);
availSize.BSize(frameWM) = NS_INTRINSICSIZE;
ViewportFrame* viewport = do_QueryFrame(parentFrame);
nsSize cbSize = viewport ?
viewport->AdjustReflowStateAsContainingBlock(&parentReflowState).Size()
viewport->AdjustReflowInputAsContainingBlock(&parentReflowInput).Size()
: aFrame->GetContainingBlock()->GetSize();
const nsMargin& parentBorder =
parentReflowState.mStyleBorder->GetComputedBorder();
parentReflowInput.mStyleBorder->GetComputedBorder();
cbSize -= nsSize(parentBorder.LeftRight(), parentBorder.TopBottom());
LogicalSize lcbSize(frameWM, cbSize);
ReflowInput reflowState(aFrame->PresContext(), parentReflowState,
ReflowInput reflowInput(aFrame->PresContext(), parentReflowInput,
aFrame, availSize, &lcbSize);
nsSize computedSize(reflowState.ComputedWidth(), reflowState.ComputedHeight());
computedSize.width += reflowState.ComputedPhysicalBorderPadding().LeftRight();
nsSize computedSize(reflowInput.ComputedWidth(), reflowInput.ComputedHeight());
computedSize.width += reflowInput.ComputedPhysicalBorderPadding().LeftRight();
if (computedSize.height != NS_INTRINSICSIZE) {
computedSize.height += reflowState.ComputedPhysicalBorderPadding().TopBottom();
computedSize.height += reflowInput.ComputedPhysicalBorderPadding().TopBottom();
}
nsSize size = aFrame->GetSize();
// The RecomputePosition hint is not used if any offset changed between auto
@ -550,27 +550,27 @@ RestyleManager::RecomputePosition(nsIFrame* aFrame)
(computedSize.height == NS_INTRINSICSIZE || computedSize.height == size.height)) {
// If we're solving for 'left' or 'top', then compute it here, in order to
// match the reflow code path.
if (NS_AUTOOFFSET == reflowState.ComputedPhysicalOffsets().left) {
reflowState.ComputedPhysicalOffsets().left = cbSize.width -
reflowState.ComputedPhysicalOffsets().right -
reflowState.ComputedPhysicalMargin().right -
if (NS_AUTOOFFSET == reflowInput.ComputedPhysicalOffsets().left) {
reflowInput.ComputedPhysicalOffsets().left = cbSize.width -
reflowInput.ComputedPhysicalOffsets().right -
reflowInput.ComputedPhysicalMargin().right -
size.width -
reflowState.ComputedPhysicalMargin().left;
reflowInput.ComputedPhysicalMargin().left;
}
if (NS_AUTOOFFSET == reflowState.ComputedPhysicalOffsets().top) {
reflowState.ComputedPhysicalOffsets().top = cbSize.height -
reflowState.ComputedPhysicalOffsets().bottom -
reflowState.ComputedPhysicalMargin().bottom -
if (NS_AUTOOFFSET == reflowInput.ComputedPhysicalOffsets().top) {
reflowInput.ComputedPhysicalOffsets().top = cbSize.height -
reflowInput.ComputedPhysicalOffsets().bottom -
reflowInput.ComputedPhysicalMargin().bottom -
size.height -
reflowState.ComputedPhysicalMargin().top;
reflowInput.ComputedPhysicalMargin().top;
}
// Move the frame
nsPoint pos(parentBorder.left + reflowState.ComputedPhysicalOffsets().left +
reflowState.ComputedPhysicalMargin().left,
parentBorder.top + reflowState.ComputedPhysicalOffsets().top +
reflowState.ComputedPhysicalMargin().top);
nsPoint pos(parentBorder.left + reflowInput.ComputedPhysicalOffsets().left +
reflowInput.ComputedPhysicalMargin().left,
parentBorder.top + reflowInput.ComputedPhysicalOffsets().top +
reflowInput.ComputedPhysicalMargin().top);
aFrame->SetPosition(pos);
return true;

Просмотреть файл

@ -22,12 +22,12 @@ class nsIPercentBSizeObserver
public:
NS_DECL_QUERYFRAME_TARGET(nsIPercentBSizeObserver)
// Notify the observer that aReflowState has no computed bsize,
// Notify the observer that aReflowInput has no computed bsize,
// but it has a percent bsize
virtual void NotifyPercentBSize(const mozilla::ReflowInput& aReflowState) = 0;
virtual void NotifyPercentBSize(const mozilla::ReflowInput& aReflowInput) = 0;
// Ask the observer if it should observe aReflowState.frame
virtual bool NeedsToObserve(const mozilla::ReflowInput& aReflowState) = 0;
// Ask the observer if it should observe aReflowInput.frame
virtual bool NeedsToObserve(const mozilla::ReflowInput& aReflowInput) = 0;
};
#endif // nsIPercentBSizeObserver_h___

Просмотреть файл

@ -9545,12 +9545,12 @@ PresShell::DoReflow(nsIFrame* target, bool aInterruptible)
// Don't pass size directly to the reflow state, since a
// constrained height implies page/column breaking.
LogicalSize reflowSize(wm, size.ISize(wm), NS_UNCONSTRAINEDSIZE);
ReflowInput reflowState(mPresContext, target, &rcx, reflowSize,
ReflowInput reflowInput(mPresContext, target, &rcx, reflowSize,
ReflowInput::CALLER_WILL_INIT);
reflowState.mOrthogonalLimit = size.BSize(wm);
reflowInput.mOrthogonalLimit = size.BSize(wm);
if (rootFrame == target) {
reflowState.Init(mPresContext);
reflowInput.Init(mPresContext);
// When the root frame is being reflowed with unconstrained block-size
// (which happens when we're called from
@ -9562,7 +9562,7 @@ PresShell::DoReflow(nsIFrame* target, bool aInterruptible)
bool hasUnconstrainedBSize = size.BSize(wm) == NS_UNCONSTRAINEDSIZE;
if (hasUnconstrainedBSize || mLastRootReflowHadUnconstrainedBSize) {
reflowState.SetBResize(true);
reflowInput.SetBResize(true);
}
mLastRootReflowHadUnconstrainedBSize = hasUnconstrainedBSize;
@ -9572,29 +9572,29 @@ PresShell::DoReflow(nsIFrame* target, bool aInterruptible)
// was reflowed by its parent.
nsMargin currentBorder = target->GetUsedBorder();
nsMargin currentPadding = target->GetUsedPadding();
reflowState.Init(mPresContext, nullptr, &currentBorder, &currentPadding);
reflowInput.Init(mPresContext, nullptr, &currentBorder, &currentPadding);
}
// fix the computed height
NS_ASSERTION(reflowState.ComputedPhysicalMargin() == nsMargin(0, 0, 0, 0),
NS_ASSERTION(reflowInput.ComputedPhysicalMargin() == nsMargin(0, 0, 0, 0),
"reflow state should not set margin for reflow roots");
if (size.BSize(wm) != NS_UNCONSTRAINEDSIZE) {
nscoord computedBSize =
size.BSize(wm) - reflowState.ComputedLogicalBorderPadding().BStartEnd(wm);
size.BSize(wm) - reflowInput.ComputedLogicalBorderPadding().BStartEnd(wm);
computedBSize = std::max(computedBSize, 0);
reflowState.SetComputedBSize(computedBSize);
reflowInput.SetComputedBSize(computedBSize);
}
NS_ASSERTION(reflowState.ComputedISize() ==
NS_ASSERTION(reflowInput.ComputedISize() ==
size.ISize(wm) -
reflowState.ComputedLogicalBorderPadding().IStartEnd(wm),
reflowInput.ComputedLogicalBorderPadding().IStartEnd(wm),
"reflow state computed incorrect inline size");
mPresContext->ReflowStarted(aInterruptible);
mIsReflowing = true;
nsReflowStatus status;
ReflowOutput desiredSize(reflowState);
target->Reflow(mPresContext, desiredSize, reflowState, status);
ReflowOutput desiredSize(reflowInput);
target->Reflow(mPresContext, desiredSize, reflowInput, status);
// If an incremental reflow is initiated at a frame other than the
// root frame, then its desired size had better not change! If it's

Просмотреть файл

@ -418,12 +418,12 @@ public:
void
nsComboboxControlFrame::ReflowDropdown(nsPresContext* aPresContext,
const ReflowInput& aReflowState)
const ReflowInput& aReflowInput)
{
// All we want out of it later on, really, is the block size of a row, so we
// don't even need to cache mDropdownFrame's ascent or anything. If we don't
// need to reflow it, just bail out here.
if (!aReflowState.ShouldReflowAllKids() &&
if (!aReflowInput.ShouldReflowAllKids() &&
!NS_SUBTREE_DIRTY(mDropdownFrame)) {
return;
}
@ -432,19 +432,19 @@ nsComboboxControlFrame::ReflowDropdown(nsPresContext* aPresContext,
// on the appropriate edge for the scrollbar we don't show... but
// that's the best we can do here for now.
WritingMode wm = mDropdownFrame->GetWritingMode();
LogicalSize availSize = aReflowState.AvailableSize(wm);
LogicalSize availSize = aReflowInput.AvailableSize(wm);
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
ReflowInput kidReflowState(aPresContext, aReflowState, mDropdownFrame,
ReflowInput kidReflowInput(aPresContext, aReflowInput, mDropdownFrame,
availSize);
// If the dropdown's intrinsic inline size is narrower than our
// specified inline size, then expand it out. We want our border-box
// inline size to end up the same as the dropdown's so account for
// both sets of mComputedBorderPadding.
nscoord forcedISize = aReflowState.ComputedISize() +
aReflowState.ComputedLogicalBorderPadding().IStartEnd(wm) -
kidReflowState.ComputedLogicalBorderPadding().IStartEnd(wm);
kidReflowState.SetComputedISize(std::max(kidReflowState.ComputedISize(),
nscoord forcedISize = aReflowInput.ComputedISize() +
aReflowInput.ComputedLogicalBorderPadding().IStartEnd(wm) -
kidReflowInput.ComputedLogicalBorderPadding().IStartEnd(wm);
kidReflowInput.SetComputedISize(std::max(kidReflowInput.ComputedISize(),
forcedISize));
// ensure we start off hidden
@ -470,14 +470,14 @@ nsComboboxControlFrame::ReflowDropdown(nsPresContext* aPresContext,
// by AbsolutelyPositionDropDown().
WritingMode outerWM = GetWritingMode();
const nsSize dummyContainerSize;
ReflowOutput desiredSize(aReflowState);
ReflowOutput desiredSize(aReflowInput);
nsReflowStatus ignoredStatus;
ReflowChild(mDropdownFrame, aPresContext, desiredSize,
kidReflowState, outerWM, LogicalPoint(outerWM),
kidReflowInput, outerWM, LogicalPoint(outerWM),
dummyContainerSize, flags, ignoredStatus);
// Set the child's width and height to its desired size
FinishReflowChild(mDropdownFrame, aPresContext, desiredSize, &kidReflowState,
FinishReflowChild(mDropdownFrame, aPresContext, desiredSize, &kidReflowInput,
outerWM, LogicalPoint(outerWM), dummyContainerSize, flags);
}
@ -809,7 +809,7 @@ nsComboboxControlFrame::GetPrefISize(nsRenderingContext *aRenderingContext)
void
nsComboboxControlFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
@ -848,7 +848,7 @@ nsComboboxControlFrame::Reflow(nsPresContext* aPresContext,
}
// First reflow our dropdown so that we know how tall we should be.
ReflowDropdown(aPresContext, aReflowState);
ReflowDropdown(aPresContext, aReflowInput);
RefPtr<nsResizeDropdownAtFinalPosition> resize =
new nsResizeDropdownAtFinalPosition(this);
if (NS_SUCCEEDED(aPresContext->PresShell()->PostReflowCallback(resize))) {
@ -859,7 +859,7 @@ nsComboboxControlFrame::Reflow(nsPresContext* aPresContext,
// Get the width of the vertical scrollbar. That will be the inline
// size of the dropdown button.
WritingMode wm = aReflowState.GetWritingMode();
WritingMode wm = aReflowInput.GetWritingMode();
nscoord buttonISize;
const nsStyleDisplay *disp = StyleDisplay();
if ((IsThemed(disp) && !aPresContext->GetTheme()->ThemeNeedsComboboxDropmarker()) ||
@ -870,25 +870,25 @@ nsComboboxControlFrame::Reflow(nsPresContext* aPresContext,
nsIScrollableFrame* scrollable = do_QueryFrame(mListControlFrame);
NS_ASSERTION(scrollable, "List must be a scrollable frame");
buttonISize = scrollable->GetNondisappearingScrollbarWidth(
PresContext(), aReflowState.mRenderingContext, wm);
if (buttonISize > aReflowState.ComputedISize()) {
PresContext(), aReflowInput.mRenderingContext, wm);
if (buttonISize > aReflowInput.ComputedISize()) {
buttonISize = 0;
}
}
mDisplayISize = aReflowState.ComputedISize() - buttonISize;
mDisplayISize = aReflowInput.ComputedISize() - buttonISize;
nsBlockFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
nsBlockFrame::Reflow(aPresContext, aDesiredSize, aReflowInput, aStatus);
// The button should occupy the same space as a scrollbar
nsSize containerSize = aDesiredSize.PhysicalSize();
LogicalRect buttonRect = mButtonFrame->GetLogicalRect(containerSize);
buttonRect.IStart(wm) =
aReflowState.ComputedLogicalBorderPadding().IStartEnd(wm) +
aReflowInput.ComputedLogicalBorderPadding().IStartEnd(wm) +
mDisplayISize -
(aReflowState.ComputedLogicalBorderPadding().IEnd(wm) -
aReflowState.ComputedLogicalPadding().IEnd(wm));
(aReflowInput.ComputedLogicalBorderPadding().IEnd(wm) -
aReflowInput.ComputedLogicalPadding().IEnd(wm));
buttonRect.ISize(wm) = buttonISize;
buttonRect.BStart(wm) = this->GetLogicalUsedBorder(wm).BStart(wm);
@ -1287,7 +1287,7 @@ public:
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
@ -1309,17 +1309,17 @@ nsComboboxDisplayFrame::GetType() const
void
nsComboboxDisplayFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
ReflowInput state(aReflowState);
ReflowInput state(aReflowInput);
if (state.ComputedBSize() == NS_INTRINSICSIZE) {
// Note that the only way we can have a computed block size here is
// if the combobox had a specified block size. If it didn't, size
// based on what our rows look like, for lack of anything better.
state.SetComputedBSize(mComboBox->mListControlFrame->GetBSizeOfARow());
}
WritingMode wm = aReflowState.GetWritingMode();
WritingMode wm = aReflowInput.GetWritingMode();
nscoord computedISize = mComboBox->mDisplayISize -
state.ComputedLogicalBorderPadding().IStartEnd(wm);
if (computedISize < 0) {

Просмотреть файл

@ -81,7 +81,7 @@ public:
virtual void Reflow(nsPresContext* aCX,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsresult HandleEvent(nsPresContext* aPresContext,
@ -217,7 +217,7 @@ protected:
// Utilities
void ReflowDropdown(nsPresContext* aPresContext,
const ReflowInput& aReflowState);
const ReflowInput& aReflowInput);
enum DropDownPositionState {
// can't show the dropdown at its current position

Просмотреть файл

@ -384,14 +384,14 @@ nsFieldSetFrame::ComputeSize(nsRenderingContext *aRenderingContext,
void
nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsFieldSetFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
NS_PRECONDITION(aReflowState.ComputedISize() != NS_INTRINSICSIZE,
NS_PRECONDITION(aReflowInput.ComputedISize() != NS_INTRINSICSIZE,
"Should have a precomputed inline-size!");
// Initialize OUT parameter
@ -400,7 +400,7 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
nsOverflowAreas ocBounds;
nsReflowStatus ocStatus = NS_FRAME_COMPLETE;
if (GetPrevInFlow()) {
ReflowOverflowContainerChildren(aPresContext, aReflowState, ocBounds, 0,
ReflowOverflowContainerChildren(aPresContext, aReflowInput, ocBounds, 0,
ocStatus);
}
@ -409,7 +409,7 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
bool reflowLegend;
nsIFrame* legend = GetLegend();
nsIFrame* inner = GetInner();
if (aReflowState.ShouldReflowAllKids()) {
if (aReflowInput.ShouldReflowAllKids()) {
reflowInner = inner != nullptr;
reflowLegend = legend != nullptr;
} else {
@ -424,43 +424,43 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
WritingMode wm = GetWritingMode();
WritingMode innerWM = inner ? inner->GetWritingMode() : wm;
WritingMode legendWM = legend ? legend->GetWritingMode() : wm;
LogicalSize innerAvailSize = aReflowState.ComputedSizeWithPadding(innerWM);
LogicalSize legendAvailSize = aReflowState.ComputedSizeWithPadding(legendWM);
LogicalSize innerAvailSize = aReflowInput.ComputedSizeWithPadding(innerWM);
LogicalSize legendAvailSize = aReflowInput.ComputedSizeWithPadding(legendWM);
innerAvailSize.BSize(innerWM) = legendAvailSize.BSize(legendWM) =
NS_UNCONSTRAINEDSIZE;
NS_ASSERTION(!inner ||
nsLayoutUtils::IntrinsicForContainer(aReflowState.mRenderingContext,
nsLayoutUtils::IntrinsicForContainer(aReflowInput.mRenderingContext,
inner,
nsLayoutUtils::MIN_ISIZE) <=
innerAvailSize.ISize(innerWM),
"Bogus availSize.ISize; should be bigger");
NS_ASSERTION(!legend ||
nsLayoutUtils::IntrinsicForContainer(aReflowState.mRenderingContext,
nsLayoutUtils::IntrinsicForContainer(aReflowInput.mRenderingContext,
legend,
nsLayoutUtils::MIN_ISIZE) <=
legendAvailSize.ISize(legendWM),
"Bogus availSize.ISize; should be bigger");
// get our border and padding
LogicalMargin border = aReflowState.ComputedLogicalBorderPadding() -
aReflowState.ComputedLogicalPadding();
LogicalMargin border = aReflowInput.ComputedLogicalBorderPadding() -
aReflowInput.ComputedLogicalPadding();
// Figure out how big the legend is if there is one.
// get the legend's margin
LogicalMargin legendMargin(wm);
// reflow the legend only if needed
Maybe<ReflowInput> legendReflowState;
Maybe<ReflowInput> legendReflowInput;
if (legend) {
legendReflowState.emplace(aPresContext, aReflowState, legend,
legendReflowInput.emplace(aPresContext, aReflowInput, legend,
legendAvailSize);
}
if (reflowLegend) {
ReflowOutput legendDesiredSize(aReflowState);
ReflowOutput legendDesiredSize(aReflowInput);
// We'll move the legend to its proper place later, so the position
// and containerSize passed here are unimportant.
const nsSize dummyContainerSize;
ReflowChild(legend, aPresContext, legendDesiredSize, *legendReflowState,
ReflowChild(legend, aPresContext, legendDesiredSize, *legendReflowInput,
wm, LogicalPoint(wm), dummyContainerSize,
NS_FRAME_NO_MOVE_FRAME, aStatus);
#ifdef NOISY_REFLOW
@ -490,7 +490,7 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
}
FinishReflowChild(legend, aPresContext, legendDesiredSize,
legendReflowState.ptr(), wm, LogicalPoint(wm),
legendReflowInput.ptr(), wm, LogicalPoint(wm),
dummyContainerSize, NS_FRAME_NO_MOVE_FRAME);
} else if (!legend) {
mLegendRect.SetEmpty();
@ -507,34 +507,34 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
border.Size(wm)).GetPhysicalSize(wm);
// reflow the content frame only if needed
if (reflowInner) {
ReflowInput kidReflowState(aPresContext, aReflowState, inner,
ReflowInput kidReflowInput(aPresContext, aReflowInput, inner,
innerAvailSize, nullptr,
ReflowInput::CALLER_WILL_INIT);
// Override computed padding, in case it's percentage padding
kidReflowState.Init(aPresContext, nullptr, nullptr,
&aReflowState.ComputedPhysicalPadding());
kidReflowInput.Init(aPresContext, nullptr, nullptr,
&aReflowInput.ComputedPhysicalPadding());
// Our child is "height:100%" but we actually want its height to be reduced
// by the amount of content-height the legend is eating up, unless our
// height is unconstrained (in which case the child's will be too).
if (aReflowState.ComputedBSize() != NS_UNCONSTRAINEDSIZE) {
kidReflowState.SetComputedBSize(
std::max(0, aReflowState.ComputedBSize() - mLegendSpace));
if (aReflowInput.ComputedBSize() != NS_UNCONSTRAINEDSIZE) {
kidReflowInput.SetComputedBSize(
std::max(0, aReflowInput.ComputedBSize() - mLegendSpace));
}
if (aReflowState.ComputedMinBSize() > 0) {
kidReflowState.ComputedMinBSize() =
std::max(0, aReflowState.ComputedMinBSize() - mLegendSpace);
if (aReflowInput.ComputedMinBSize() > 0) {
kidReflowInput.ComputedMinBSize() =
std::max(0, aReflowInput.ComputedMinBSize() - mLegendSpace);
}
if (aReflowState.ComputedMaxBSize() != NS_UNCONSTRAINEDSIZE) {
kidReflowState.ComputedMaxBSize() =
std::max(0, aReflowState.ComputedMaxBSize() - mLegendSpace);
if (aReflowInput.ComputedMaxBSize() != NS_UNCONSTRAINEDSIZE) {
kidReflowInput.ComputedMaxBSize() =
std::max(0, aReflowInput.ComputedMaxBSize() - mLegendSpace);
}
ReflowOutput kidDesiredSize(kidReflowState,
ReflowOutput kidDesiredSize(kidReflowInput,
aDesiredSize.mFlags);
// Reflow the frame
NS_ASSERTION(kidReflowState.ComputedPhysicalMargin() == nsMargin(0,0,0,0),
NS_ASSERTION(kidReflowInput.ComputedPhysicalMargin() == nsMargin(0,0,0,0),
"Margins on anonymous fieldset child not supported!");
LogicalPoint pt(wm, border.IStart(wm), border.BStart(wm) + mLegendSpace);
@ -542,14 +542,14 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
// so we use a dummy value for now; FinishReflowChild will fix the position
// if necessary.
const nsSize dummyContainerSize;
ReflowChild(inner, aPresContext, kidDesiredSize, kidReflowState,
ReflowChild(inner, aPresContext, kidDesiredSize, kidReflowInput,
wm, pt, dummyContainerSize, 0, aStatus);
// Update containerSize to account for size of the inner frame, so that
// FinishReflowChild can position it correctly.
containerSize += kidDesiredSize.PhysicalSize();
FinishReflowChild(inner, aPresContext, kidDesiredSize,
&kidReflowState, wm, pt, containerSize, 0);
&kidReflowInput, wm, pt, containerSize, 0);
NS_FRAME_TRACE_REFLOW_OUT("FieldSet::Reflow", aStatus);
} else if (inner) {
// |inner| didn't need to be reflowed but we do need to include its size
@ -566,7 +566,7 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
}
// Our content rect must fill up the available width
LogicalSize availSize = aReflowState.ComputedSizeWithPadding(wm);
LogicalSize availSize = aReflowInput.ComputedSizeWithPadding(wm);
if (availSize.ISize(wm) > contentRect.ISize(wm)) {
contentRect.ISize(wm) = innerAvailSize.ISize(wm);
}
@ -575,7 +575,7 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
// The legend is positioned inline-wards within the inner's content rect
// (so that padding on the fieldset affects the legend position).
LogicalRect innerContentRect = contentRect;
innerContentRect.Deflate(wm, aReflowState.ComputedLogicalPadding());
innerContentRect.Deflate(wm, aReflowInput.ComputedLogicalPadding());
// If the inner content rect is larger than the legend, we can align the
// legend.
if (innerContentRect.ISize(wm) > mLegendRect.ISize(wm)) {
@ -607,7 +607,7 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
mLegendRect.IStart(wm) = innerContentRect.IStart(wm);
innerContentRect.ISize(wm) = mLegendRect.ISize(wm);
contentRect.ISize(wm) = mLegendRect.ISize(wm) +
aReflowState.ComputedLogicalPadding().IStartEnd(wm);
aReflowInput.ComputedLogicalPadding().IStartEnd(wm);
}
// place the legend
@ -618,8 +618,8 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
// Note that legend's writing mode may be different from the fieldset's,
// so we need to convert offsets before applying them to it (bug 1134534).
LogicalMargin offsets =
legendReflowState->ComputedLogicalOffsets().
ConvertTo(wm, legendReflowState->GetWritingMode());
legendReflowInput->ComputedLogicalOffsets().
ConvertTo(wm, legendReflowInput->GetWritingMode());
ReflowInput::ApplyRelativePositioning(legend, wm, offsets,
&actualLegendPos,
containerSize);
@ -647,11 +647,11 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
aDesiredSize.mOverflowAreas.UnionWith(ocBounds);
NS_MergeReflowStatusInto(&aStatus, ocStatus);
FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize, aReflowState, aStatus);
FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize, aReflowInput, aStatus);
InvalidateFrame();
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
#ifdef DEBUG

Просмотреть файл

@ -43,7 +43,7 @@ public:
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,

Просмотреть файл

@ -115,23 +115,23 @@ nsFormControlFrame::GetLogicalBaseline(WritingMode aWritingMode) const
void
nsFormControlFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsFormControlFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("enter nsFormControlFrame::Reflow: aMaxSize=%d,%d",
aReflowState.AvailableWidth(), aReflowState.AvailableHeight()));
aReflowInput.AvailableWidth(), aReflowInput.AvailableHeight()));
if (mState & NS_FRAME_FIRST_REFLOW) {
RegUnRegAccessKey(static_cast<nsIFrame*>(this), true);
}
aStatus = NS_FRAME_COMPLETE;
aDesiredSize.SetSize(aReflowState.GetWritingMode(),
aReflowState.ComputedSizeWithBorderPadding());
aDesiredSize.SetSize(aReflowInput.GetWritingMode(),
aReflowInput.ComputedSizeWithBorderPadding());
if (nsLayoutUtils::FontSizeInflationEnabled(aPresContext)) {
float inflation = nsLayoutUtils::FontSizeInflationFor(this);
@ -142,7 +142,7 @@ nsFormControlFrame::Reflow(nsPresContext* aPresContext,
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("exit nsFormControlFrame::Reflow: size=%d,%d",
aDesiredSize.Width(), aDesiredSize.Height()));
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
aDesiredSize.SetOverflowAreasToDesiredBounds();
FinishAndStoreOverflow(&aDesiredSize);

Просмотреть файл

@ -83,7 +83,7 @@ public:
*/
virtual void Reflow(nsPresContext* aCX,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;

Просмотреть файл

@ -185,14 +185,14 @@ nsHTMLButtonControlFrame::GetPrefISize(nsRenderingContext* aRenderingContext)
void
nsHTMLButtonControlFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsHTMLButtonControlFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
NS_PRECONDITION(aReflowState.ComputedISize() != NS_INTRINSICSIZE,
NS_PRECONDITION(aReflowInput.ComputedISize() != NS_INTRINSICSIZE,
"Should have real computed inline-size by now");
if (mState & NS_FRAME_FIRST_REFLOW) {
@ -210,14 +210,14 @@ nsHTMLButtonControlFrame::Reflow(nsPresContext* aPresContext,
"Button's child frame has unexpected pseudo type!");
// XXXbz Eventually we may want to check-and-bail if
// !aReflowState.ShouldReflowAllKids() &&
// !aReflowInput.ShouldReflowAllKids() &&
// !NS_SUBTREE_DIRTY(firstKid).
// We'd need to cache our ascent for that, of course.
// Reflow the contents of the button.
// (This populates our aDesiredSize, too.)
ReflowButtonContents(aPresContext, aDesiredSize,
aReflowState, firstKid);
aReflowInput, firstKid);
if (!ShouldClipPaintingToBorderBox()) {
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, firstKid);
@ -227,14 +227,14 @@ nsHTMLButtonControlFrame::Reflow(nsPresContext* aPresContext,
aStatus = NS_FRAME_COMPLETE;
FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize,
aReflowState, aStatus);
aReflowInput, aStatus);
// We're always complete and we don't support overflow containers
// so we shouldn't have a next-in-flow ever.
aStatus = NS_FRAME_COMPLETE;
MOZ_ASSERT(!GetNextInFlow());
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
// Helper-function that lets us clone the button's reflow state, but with its
@ -243,22 +243,22 @@ nsHTMLButtonControlFrame::Reflow(nsPresContext* aPresContext,
// appropriate content-box size for descendents' percent sizes to resolve
// against.)
static ReflowInput
CloneReflowStateWithReducedContentBox(
const ReflowInput& aButtonReflowState,
CloneReflowInputWithReducedContentBox(
const ReflowInput& aButtonReflowInput,
const nsMargin& aFocusPadding)
{
nscoord adjustedWidth =
aButtonReflowState.ComputedWidth() - aFocusPadding.LeftRight();
aButtonReflowInput.ComputedWidth() - aFocusPadding.LeftRight();
adjustedWidth = std::max(0, adjustedWidth);
// (Only adjust height if it's an actual length.)
nscoord adjustedHeight = aButtonReflowState.ComputedHeight();
nscoord adjustedHeight = aButtonReflowInput.ComputedHeight();
if (adjustedHeight != NS_INTRINSICSIZE) {
adjustedHeight -= aFocusPadding.TopBottom();
adjustedHeight = std::max(0, adjustedHeight);
}
ReflowInput clone(aButtonReflowState);
ReflowInput clone(aButtonReflowInput);
clone.SetComputedWidth(adjustedWidth);
clone.SetComputedHeight(adjustedHeight);
@ -268,11 +268,11 @@ CloneReflowStateWithReducedContentBox(
void
nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext,
ReflowOutput& aButtonDesiredSize,
const ReflowInput& aButtonReflowState,
const ReflowInput& aButtonReflowInput,
nsIFrame* aFirstKid)
{
WritingMode wm = GetWritingMode();
LogicalSize availSize = aButtonReflowState.ComputedSize(wm);
LogicalSize availSize = aButtonReflowInput.ComputedSize(wm);
availSize.BSize(wm) = NS_INTRINSICSIZE;
// Buttons have some bonus renderer-determined border/padding,
@ -286,8 +286,8 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext,
// focuspadding (which other browsers don't have) so that there's a
// little more space for it.
// Note that GetMinISize includes the focusPadding.
nscoord IOverflow = GetMinISize(aButtonReflowState.mRenderingContext) -
aButtonReflowState.ComputedISize();
nscoord IOverflow = GetMinISize(aButtonReflowInput.mRenderingContext) -
aButtonReflowInput.ComputedISize();
nscoord IFocusPadding = focusPadding.IStartEnd(wm);
nscoord focusPaddingReduction = std::min(IFocusPadding,
std::max(IOverflow, 0));
@ -303,7 +303,7 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext,
}
// shorthand for a value we need to use in a bunch of places
const LogicalMargin& clbp = aButtonReflowState.ComputedLogicalBorderPadding();
const LogicalMargin& clbp = aButtonReflowInput.ComputedLogicalBorderPadding();
// Indent the child inside us by the focus border. We must do this separate
// from the regular border.
@ -315,16 +315,16 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext,
// Give child a clone of the button's reflow state, with height/width reduced
// by focusPadding, so that descendants with height:100% don't protrude.
ReflowInput adjustedButtonReflowState =
CloneReflowStateWithReducedContentBox(aButtonReflowState,
ReflowInput adjustedButtonReflowInput =
CloneReflowInputWithReducedContentBox(aButtonReflowInput,
focusPadding.GetPhysicalMargin(wm));
ReflowInput contentsReflowState(aPresContext,
adjustedButtonReflowState,
ReflowInput contentsReflowInput(aPresContext,
adjustedButtonReflowInput,
aFirstKid, availSize);
nsReflowStatus contentsReflowStatus;
ReflowOutput contentsDesiredSize(aButtonReflowState);
ReflowOutput contentsDesiredSize(aButtonReflowInput);
childPos.B(wm) = 0; // This will be set properly later, after reflowing the
// child to determine its size.
@ -332,7 +332,7 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext,
// repositioned later by FinishReflowChild.
nsSize dummyContainerSize;
ReflowChild(aFirstKid, aPresContext,
contentsDesiredSize, contentsReflowState,
contentsDesiredSize, contentsReflowInput,
wm, childPos, dummyContainerSize, 0, contentsReflowStatus);
MOZ_ASSERT(NS_FRAME_IS_COMPLETE(contentsReflowStatus),
"We gave button-contents frame unconstrained available height, "
@ -340,9 +340,9 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext,
// Compute the button's content-box size:
LogicalSize buttonContentBox(wm);
if (aButtonReflowState.ComputedBSize() != NS_INTRINSICSIZE) {
if (aButtonReflowInput.ComputedBSize() != NS_INTRINSICSIZE) {
// Button has a fixed block-size -- that's its content-box bSize.
buttonContentBox.BSize(wm) = aButtonReflowState.ComputedBSize();
buttonContentBox.BSize(wm) = aButtonReflowInput.ComputedBSize();
} else {
// Button is intrinsically sized -- it should shrinkwrap the
// button-contents' bSize, plus any focus-padding space:
@ -351,23 +351,23 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext,
// Make sure we obey min/max-bSize in the case when we're doing intrinsic
// sizing (we get it for free when we have a non-intrinsic
// aButtonReflowState.ComputedBSize()). Note that we do this before
// aButtonReflowInput.ComputedBSize()). Note that we do this before
// adjusting for borderpadding, since mComputedMaxBSize and
// mComputedMinBSize are content bSizes.
buttonContentBox.BSize(wm) =
NS_CSS_MINMAX(buttonContentBox.BSize(wm),
aButtonReflowState.ComputedMinBSize(),
aButtonReflowState.ComputedMaxBSize());
aButtonReflowInput.ComputedMinBSize(),
aButtonReflowInput.ComputedMaxBSize());
}
if (aButtonReflowState.ComputedISize() != NS_INTRINSICSIZE) {
buttonContentBox.ISize(wm) = aButtonReflowState.ComputedISize();
if (aButtonReflowInput.ComputedISize() != NS_INTRINSICSIZE) {
buttonContentBox.ISize(wm) = aButtonReflowInput.ComputedISize();
} else {
buttonContentBox.ISize(wm) =
contentsDesiredSize.ISize(wm) + focusPadding.IStartEnd(wm);
buttonContentBox.ISize(wm) =
NS_CSS_MINMAX(buttonContentBox.ISize(wm),
aButtonReflowState.ComputedMinISize(),
aButtonReflowState.ComputedMaxISize());
aButtonReflowInput.ComputedMinISize(),
aButtonReflowInput.ComputedMaxISize());
}
// Center child in the block-direction in the button
@ -387,13 +387,13 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext,
// Place the child
FinishReflowChild(aFirstKid, aPresContext,
contentsDesiredSize, &contentsReflowState,
contentsDesiredSize, &contentsReflowInput,
wm, childPos, containerSize, 0);
// Make sure we have a useful 'ascent' value for the child
if (contentsDesiredSize.BlockStartAscent() ==
ReflowOutput::ASK_FOR_BASELINE) {
WritingMode wm = aButtonReflowState.GetWritingMode();
WritingMode wm = aButtonReflowInput.GetWritingMode();
contentsDesiredSize.SetBlockStartAscent(aFirstKid->GetLogicalBaseline(wm));
}
@ -401,7 +401,7 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext,
// Use what we learned to populate the button frame's reflow metrics.
// * Button's height & width are content-box size + border-box contribution:
aButtonDesiredSize.SetSize(wm,
LogicalSize(wm, aButtonReflowState.ComputedISize() + clbp.IStartEnd(wm),
LogicalSize(wm, aButtonReflowInput.ComputedISize() + clbp.IStartEnd(wm),
buttonContentBox.BSize(wm) + clbp.BStartEnd(wm)));
// * Button's ascent is its child's ascent, plus the child's block-offset

Просмотреть файл

@ -36,7 +36,7 @@ public:
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsresult HandleEvent(nsPresContext* aPresContext,
@ -102,7 +102,7 @@ protected:
// of the button itself from the results.
void ReflowButtonContents(nsPresContext* aPresContext,
ReflowOutput& aButtonDesiredSize,
const ReflowInput& aButtonReflowState,
const ReflowInput& aButtonReflowInput,
nsIFrame* aFirstKid);
nsButtonFrameRenderer mRenderer;

Просмотреть файл

@ -32,7 +32,7 @@ public:
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsresult HandleEvent(nsPresContext* aPresContext,
@ -127,15 +127,15 @@ nsImageControlFrame::GetType() const
void
nsImageControlFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsImageControlFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
if (!GetPrevInFlow() && (mState & NS_FRAME_FIRST_REFLOW)) {
nsFormControlFrame::RegUnRegAccessKey(this, true);
}
return nsImageFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
return nsImageFrame::Reflow(aPresContext, aDesiredSize, aReflowInput, aStatus);
}
nsresult

Просмотреть файл

@ -50,15 +50,15 @@ NS_QUERYFRAME_TAIL_INHERITING(nsBlockFrame)
void
nsLegendFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsLegendFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
if (mState & NS_FRAME_FIRST_REFLOW) {
nsFormControlFrame::RegUnRegAccessKey(static_cast<nsIFrame*>(this), true);
}
return nsBlockFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
return nsBlockFrame::Reflow(aPresContext, aDesiredSize, aReflowInput, aStatus);
}
int32_t

Просмотреть файл

@ -19,7 +19,7 @@ public:
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;

Просмотреть файл

@ -356,10 +356,10 @@ nsListControlFrame::GetMinISize(nsRenderingContext *aRenderingContext)
void
nsListControlFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
NS_PRECONDITION(aReflowState.ComputedISize() != NS_UNCONSTRAINEDSIZE,
NS_PRECONDITION(aReflowInput.ComputedISize() != NS_UNCONSTRAINEDSIZE,
"Must have a computed inline size");
SchedulePaint();
@ -382,7 +382,7 @@ nsListControlFrame::Reflow(nsPresContext* aPresContext,
}
if (IsInDropDownMode()) {
ReflowAsDropdown(aPresContext, aDesiredSize, aReflowState, aStatus);
ReflowAsDropdown(aPresContext, aDesiredSize, aReflowInput, aStatus);
return;
}
@ -409,12 +409,12 @@ nsListControlFrame::Reflow(nsPresContext* aPresContext,
* the old one.
*/
bool autoBSize = (aReflowState.ComputedBSize() == NS_UNCONSTRAINEDSIZE);
bool autoBSize = (aReflowInput.ComputedBSize() == NS_UNCONSTRAINEDSIZE);
mMightNeedSecondPass = autoBSize &&
(NS_SUBTREE_DIRTY(this) || aReflowState.ShouldReflowAllKids());
(NS_SUBTREE_DIRTY(this) || aReflowInput.ShouldReflowAllKids());
ReflowInput state(aReflowState);
ReflowInput state(aReflowInput);
int32_t length = GetNumberOfRows();
nscoord oldBSizeOfARow = BSizeOfARow();
@ -494,23 +494,23 @@ nsListControlFrame::Reflow(nsPresContext* aPresContext,
void
nsListControlFrame::ReflowAsDropdown(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
NS_PRECONDITION(aReflowState.ComputedBSize() == NS_UNCONSTRAINEDSIZE,
NS_PRECONDITION(aReflowInput.ComputedBSize() == NS_UNCONSTRAINEDSIZE,
"We should not have a computed block size here!");
mMightNeedSecondPass = NS_SUBTREE_DIRTY(this) ||
aReflowState.ShouldReflowAllKids();
aReflowInput.ShouldReflowAllKids();
WritingMode wm = aReflowState.GetWritingMode();
WritingMode wm = aReflowInput.GetWritingMode();
#ifdef DEBUG
nscoord oldBSizeOfARow = BSizeOfARow();
nscoord oldVisibleBSize = (GetStateBits() & NS_FRAME_FIRST_REFLOW) ?
NS_UNCONSTRAINEDSIZE : GetScrolledFrame()->BSize(wm);
#endif
ReflowInput state(aReflowState);
ReflowInput state(aReflowInput);
if (!(GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
// When not doing an initial reflow, and when the block size is
@ -583,7 +583,7 @@ nsListControlFrame::ReflowAsDropdown(nsPresContext* aPresContext,
mNumDisplayRows = 1;
mDropdownCanGrow = GetNumberOfRows() > 1;
} else {
nscoord bp = aReflowState.ComputedLogicalBorderPadding().BStartEnd(wm);
nscoord bp = aReflowInput.ComputedLogicalBorderPadding().BStartEnd(wm);
nscoord availableBSize = std::max(before, after) - bp;
nscoord newBSize;
uint32_t rows;
@ -1494,13 +1494,13 @@ nsListControlFrame::AboutToRollup()
void
nsListControlFrame::DidReflow(nsPresContext* aPresContext,
const ReflowInput* aReflowState,
const ReflowInput* aReflowInput,
nsDidReflowStatus aStatus)
{
bool wasInterrupted = !mHasPendingInterruptAtStartOfReflow &&
aPresContext->HasPendingInterrupt();
nsHTMLScrollFrame::DidReflow(aPresContext, aReflowState, aStatus);
nsHTMLScrollFrame::DidReflow(aPresContext, aReflowInput, aStatus);
if (mNeedToReset && !wasInterrupted) {
mNeedToReset = false;

Просмотреть файл

@ -68,7 +68,7 @@ public:
virtual void Reflow(nsPresContext* aCX,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual void Init(nsIContent* aContent,
@ -76,7 +76,7 @@ public:
nsIFrame* aPrevInFlow) override;
virtual void DidReflow(nsPresContext* aPresContext,
const ReflowInput* aReflowState,
const ReflowInput* aReflowInput,
nsDidReflowStatus aStatus) override;
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
@ -346,7 +346,7 @@ protected:
*/
void ReflowAsDropdown(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus);
// Selection

Просмотреть файл

@ -105,12 +105,12 @@ NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
void
nsMeterFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsMeterFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
NS_ASSERTION(mBarDiv, "Meter bar div must exist!");
NS_ASSERTION(!GetPrevContinuation(),
@ -124,10 +124,10 @@ nsMeterFrame::Reflow(nsPresContext* aPresContext,
nsIFrame* barFrame = mBarDiv->GetPrimaryFrame();
NS_ASSERTION(barFrame, "The meter frame should have a child with a frame!");
ReflowBarFrame(barFrame, aPresContext, aReflowState, aStatus);
ReflowBarFrame(barFrame, aPresContext, aReflowInput, aStatus);
aDesiredSize.SetSize(aReflowState.GetWritingMode(),
aReflowState.ComputedSizeWithBorderPadding());
aDesiredSize.SetSize(aReflowInput.GetWritingMode(),
aReflowInput.ComputedSizeWithBorderPadding());
aDesiredSize.SetOverflowAreasToDesiredBounds();
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, barFrame);
@ -135,25 +135,25 @@ nsMeterFrame::Reflow(nsPresContext* aPresContext,
aStatus = NS_FRAME_COMPLETE;
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
void
nsMeterFrame::ReflowBarFrame(nsIFrame* aBarFrame,
nsPresContext* aPresContext,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
bool vertical = ResolvedOrientationIsVertical();
WritingMode wm = aBarFrame->GetWritingMode();
LogicalSize availSize = aReflowState.ComputedSize(wm);
LogicalSize availSize = aReflowInput.ComputedSize(wm);
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
ReflowInput reflowState(aPresContext, aReflowState,
ReflowInput reflowInput(aPresContext, aReflowInput,
aBarFrame, availSize);
nscoord size = vertical ? aReflowState.ComputedHeight()
: aReflowState.ComputedWidth();
nscoord xoffset = aReflowState.ComputedPhysicalBorderPadding().left;
nscoord yoffset = aReflowState.ComputedPhysicalBorderPadding().top;
nscoord size = vertical ? aReflowInput.ComputedHeight()
: aReflowInput.ComputedWidth();
nscoord xoffset = aReflowInput.ComputedPhysicalBorderPadding().left;
nscoord yoffset = aReflowInput.ComputedPhysicalBorderPadding().top;
// NOTE: Introduce a new function getPosition in the content part ?
HTMLMeterElement* meterElement = static_cast<HTMLMeterElement*>(mContent);
@ -168,32 +168,32 @@ nsMeterFrame::ReflowBarFrame(nsIFrame* aBarFrame,
size = NSToCoordRound(size * position);
if (!vertical && (wm.IsVertical() ? wm.IsVerticalRL() : !wm.IsBidiLTR())) {
xoffset += aReflowState.ComputedWidth() - size;
xoffset += aReflowInput.ComputedWidth() - size;
}
// The bar position is *always* constrained.
if (vertical) {
// We want the bar to begin at the bottom.
yoffset += aReflowState.ComputedHeight() - size;
yoffset += aReflowInput.ComputedHeight() - size;
size -= reflowState.ComputedPhysicalMargin().TopBottom() +
reflowState.ComputedPhysicalBorderPadding().TopBottom();
size -= reflowInput.ComputedPhysicalMargin().TopBottom() +
reflowInput.ComputedPhysicalBorderPadding().TopBottom();
size = std::max(size, 0);
reflowState.SetComputedHeight(size);
reflowInput.SetComputedHeight(size);
} else {
size -= reflowState.ComputedPhysicalMargin().LeftRight() +
reflowState.ComputedPhysicalBorderPadding().LeftRight();
size -= reflowInput.ComputedPhysicalMargin().LeftRight() +
reflowInput.ComputedPhysicalBorderPadding().LeftRight();
size = std::max(size, 0);
reflowState.SetComputedWidth(size);
reflowInput.SetComputedWidth(size);
}
xoffset += reflowState.ComputedPhysicalMargin().left;
yoffset += reflowState.ComputedPhysicalMargin().top;
xoffset += reflowInput.ComputedPhysicalMargin().left;
yoffset += reflowInput.ComputedPhysicalMargin().top;
ReflowOutput barDesiredSize(reflowState);
ReflowChild(aBarFrame, aPresContext, barDesiredSize, reflowState, xoffset,
ReflowOutput barDesiredSize(reflowInput);
ReflowChild(aBarFrame, aPresContext, barDesiredSize, reflowInput, xoffset,
yoffset, 0, aStatus);
FinishReflowChild(aBarFrame, aPresContext, barDesiredSize, &reflowState,
FinishReflowChild(aBarFrame, aPresContext, barDesiredSize, &reflowInput,
xoffset, yoffset, 0);
}

Просмотреть файл

@ -30,7 +30,7 @@ public:
virtual void Reflow(nsPresContext* aCX,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsIAtom* GetType() const override;
@ -82,7 +82,7 @@ protected:
// Helper function which reflow the anonymous div frame.
void ReflowBarFrame(nsIFrame* aBarFrame,
nsPresContext* aPresContext,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus);
/**
* The div used to show the meter bar.

Просмотреть файл

@ -106,12 +106,12 @@ nsNumberControlFrame::GetPrefISize(nsRenderingContext* aRenderingContext)
void
nsNumberControlFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsNumberControlFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
NS_ASSERTION(mOuterWrapper, "Outer wrapper div must exist!");
@ -127,22 +127,22 @@ nsNumberControlFrame::Reflow(nsPresContext* aPresContext,
nsFormControlFrame::RegUnRegAccessKey(this, true);
}
const WritingMode myWM = aReflowState.GetWritingMode();
const WritingMode myWM = aReflowInput.GetWritingMode();
// The ISize of our content box, which is the available ISize
// for our anonymous content:
const nscoord contentBoxISize = aReflowState.ComputedISize();
nscoord contentBoxBSize = aReflowState.ComputedBSize();
const nscoord contentBoxISize = aReflowInput.ComputedISize();
nscoord contentBoxBSize = aReflowInput.ComputedBSize();
// Figure out our border-box sizes as well (by adding borderPadding to
// content-box sizes):
const nscoord borderBoxISize = contentBoxISize +
aReflowState.ComputedLogicalBorderPadding().IStartEnd(myWM);
aReflowInput.ComputedLogicalBorderPadding().IStartEnd(myWM);
nscoord borderBoxBSize;
if (contentBoxBSize != NS_INTRINSICSIZE) {
borderBoxBSize = contentBoxBSize +
aReflowState.ComputedLogicalBorderPadding().BStartEnd(myWM);
aReflowInput.ComputedLogicalBorderPadding().BStartEnd(myWM);
} // else, we'll figure out borderBoxBSize after we resolve contentBoxBSize.
nsIFrame* outerWrapperFrame = mOuterWrapper->GetPrimaryFrame();
@ -151,30 +151,30 @@ nsNumberControlFrame::Reflow(nsPresContext* aPresContext,
if (contentBoxBSize == NS_INTRINSICSIZE) {
contentBoxBSize = 0;
borderBoxBSize =
aReflowState.ComputedLogicalBorderPadding().BStartEnd(myWM);
aReflowInput.ComputedLogicalBorderPadding().BStartEnd(myWM);
}
} else {
NS_ASSERTION(outerWrapperFrame == mFrames.FirstChild(), "huh?");
ReflowOutput wrappersDesiredSize(aReflowState);
ReflowOutput wrappersDesiredSize(aReflowInput);
WritingMode wrapperWM = outerWrapperFrame->GetWritingMode();
LogicalSize availSize = aReflowState.ComputedSize(wrapperWM);
LogicalSize availSize = aReflowInput.ComputedSize(wrapperWM);
availSize.BSize(wrapperWM) = NS_UNCONSTRAINEDSIZE;
ReflowInput wrapperReflowState(aPresContext, aReflowState,
ReflowInput wrapperReflowInput(aPresContext, aReflowInput,
outerWrapperFrame, availSize);
// Convert wrapper margin into my own writing-mode (in case it differs):
LogicalMargin wrapperMargin =
wrapperReflowState.ComputedLogicalMargin().ConvertTo(myWM, wrapperWM);
wrapperReflowInput.ComputedLogicalMargin().ConvertTo(myWM, wrapperWM);
// offsets of wrapper frame within this frame:
LogicalPoint
wrapperOffset(myWM,
aReflowState.ComputedLogicalBorderPadding().IStart(myWM) +
aReflowInput.ComputedLogicalBorderPadding().IStart(myWM) +
wrapperMargin.IStart(myWM),
aReflowState.ComputedLogicalBorderPadding().BStart(myWM) +
aReflowInput.ComputedLogicalBorderPadding().BStart(myWM) +
wrapperMargin.BStart(myWM));
nsReflowStatus childStatus;
@ -182,7 +182,7 @@ nsNumberControlFrame::Reflow(nsPresContext* aPresContext,
// will be fixed later.
const nsSize dummyContainerSize;
ReflowChild(outerWrapperFrame, aPresContext, wrappersDesiredSize,
wrapperReflowState, myWM, wrapperOffset, dummyContainerSize, 0,
wrapperReflowInput, myWM, wrapperOffset, dummyContainerSize, 0,
childStatus);
MOZ_ASSERT(NS_FRAME_IS_FULLY_COMPLETE(childStatus),
"We gave our child unconstrained available block-size, "
@ -198,16 +198,16 @@ nsNumberControlFrame::Reflow(nsPresContext* aPresContext,
// Make sure we obey min/max-bsize in the case when we're doing intrinsic
// sizing (we get it for free when we have a non-intrinsic
// aReflowState.ComputedBSize()). Note that we do this before
// aReflowInput.ComputedBSize()). Note that we do this before
// adjusting for borderpadding, since ComputedMaxBSize and
// ComputedMinBSize are content heights.
contentBoxBSize =
NS_CSS_MINMAX(contentBoxBSize,
aReflowState.ComputedMinBSize(),
aReflowState.ComputedMaxBSize());
aReflowInput.ComputedMinBSize(),
aReflowInput.ComputedMaxBSize());
borderBoxBSize = contentBoxBSize +
aReflowState.ComputedLogicalBorderPadding().BStartEnd(myWM);
aReflowInput.ComputedLogicalBorderPadding().BStartEnd(myWM);
}
// Center child in block axis
@ -220,7 +220,7 @@ nsNumberControlFrame::Reflow(nsPresContext* aPresContext,
// Place the child
FinishReflowChild(outerWrapperFrame, aPresContext, wrappersDesiredSize,
&wrapperReflowState, myWM, wrapperOffset,
&wrapperReflowInput, myWM, wrapperOffset,
borderBoxSize, 0);
nsSize contentBoxSize =
@ -228,7 +228,7 @@ nsNumberControlFrame::Reflow(nsPresContext* aPresContext,
GetPhysicalSize(myWM);
aDesiredSize.SetBlockStartAscent(
wrappersDesiredSize.BlockStartAscent() +
outerWrapperFrame->BStart(aReflowState.GetWritingMode(),
outerWrapperFrame->BStart(aReflowInput.GetWritingMode(),
contentBoxSize));
}
@ -245,7 +245,7 @@ nsNumberControlFrame::Reflow(nsPresContext* aPresContext,
aStatus = NS_FRAME_COMPLETE;
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
void

Просмотреть файл

@ -61,7 +61,7 @@ public:
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsresult AttributeChanged(int32_t aNameSpaceID,

Просмотреть файл

@ -110,12 +110,12 @@ nsProgressFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
void
nsProgressFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsProgressFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
NS_ASSERTION(mBarDiv, "Progress bar div must exist!");
NS_ASSERTION(!GetPrevContinuation(),
@ -129,35 +129,35 @@ nsProgressFrame::Reflow(nsPresContext* aPresContext,
nsIFrame* barFrame = mBarDiv->GetPrimaryFrame();
NS_ASSERTION(barFrame, "The progress frame should have a child with a frame!");
ReflowBarFrame(barFrame, aPresContext, aReflowState, aStatus);
ReflowBarFrame(barFrame, aPresContext, aReflowInput, aStatus);
aDesiredSize.SetSize(aReflowState.GetWritingMode(),
aReflowState.ComputedSizeWithBorderPadding());
aDesiredSize.SetSize(aReflowInput.GetWritingMode(),
aReflowInput.ComputedSizeWithBorderPadding());
aDesiredSize.SetOverflowAreasToDesiredBounds();
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, barFrame);
FinishAndStoreOverflow(&aDesiredSize);
aStatus = NS_FRAME_COMPLETE;
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
void
nsProgressFrame::ReflowBarFrame(nsIFrame* aBarFrame,
nsPresContext* aPresContext,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
bool vertical = ResolvedOrientationIsVertical();
WritingMode wm = aBarFrame->GetWritingMode();
LogicalSize availSize = aReflowState.ComputedSize(wm);
LogicalSize availSize = aReflowInput.ComputedSize(wm);
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
ReflowInput reflowState(aPresContext, aReflowState,
ReflowInput reflowInput(aPresContext, aReflowInput,
aBarFrame, availSize);
nscoord size = vertical ? aReflowState.ComputedHeight()
: aReflowState.ComputedWidth();
nscoord xoffset = aReflowState.ComputedPhysicalBorderPadding().left;
nscoord yoffset = aReflowState.ComputedPhysicalBorderPadding().top;
nscoord size = vertical ? aReflowInput.ComputedHeight()
: aReflowInput.ComputedWidth();
nscoord xoffset = aReflowInput.ComputedPhysicalBorderPadding().left;
nscoord yoffset = aReflowInput.ComputedPhysicalBorderPadding().top;
double position = static_cast<HTMLProgressElement*>(mContent)->Position();
@ -168,7 +168,7 @@ nsProgressFrame::ReflowBarFrame(nsIFrame* aBarFrame,
}
if (!vertical && (wm.IsVertical() ? wm.IsVerticalRL() : !wm.IsBidiLTR())) {
xoffset += aReflowState.ComputedWidth() - size;
xoffset += aReflowInput.ComputedWidth() - size;
}
// The bar size is fixed in these cases:
@ -181,32 +181,32 @@ nsProgressFrame::ReflowBarFrame(nsIFrame* aBarFrame,
if (position != -1 || ShouldUseNativeStyle()) {
if (vertical) {
// We want the bar to begin at the bottom.
yoffset += aReflowState.ComputedHeight() - size;
yoffset += aReflowInput.ComputedHeight() - size;
size -= reflowState.ComputedPhysicalMargin().TopBottom() +
reflowState.ComputedPhysicalBorderPadding().TopBottom();
size -= reflowInput.ComputedPhysicalMargin().TopBottom() +
reflowInput.ComputedPhysicalBorderPadding().TopBottom();
size = std::max(size, 0);
reflowState.SetComputedHeight(size);
reflowInput.SetComputedHeight(size);
} else {
size -= reflowState.ComputedPhysicalMargin().LeftRight() +
reflowState.ComputedPhysicalBorderPadding().LeftRight();
size -= reflowInput.ComputedPhysicalMargin().LeftRight() +
reflowInput.ComputedPhysicalBorderPadding().LeftRight();
size = std::max(size, 0);
reflowState.SetComputedWidth(size);
reflowInput.SetComputedWidth(size);
}
} else if (vertical) {
// For vertical progress bars, we need to position the bar specificly when
// the width isn't constrained (position == -1 and !ShouldUseNativeStyle())
// because aReflowState.ComputedHeight() - size == 0.
yoffset += aReflowState.ComputedHeight() - reflowState.ComputedHeight();
// because aReflowInput.ComputedHeight() - size == 0.
yoffset += aReflowInput.ComputedHeight() - reflowInput.ComputedHeight();
}
xoffset += reflowState.ComputedPhysicalMargin().left;
yoffset += reflowState.ComputedPhysicalMargin().top;
xoffset += reflowInput.ComputedPhysicalMargin().left;
yoffset += reflowInput.ComputedPhysicalMargin().top;
ReflowOutput barDesiredSize(aReflowState);
ReflowChild(aBarFrame, aPresContext, barDesiredSize, reflowState, xoffset,
ReflowOutput barDesiredSize(aReflowInput);
ReflowChild(aBarFrame, aPresContext, barDesiredSize, reflowInput, xoffset,
yoffset, 0, aStatus);
FinishReflowChild(aBarFrame, aPresContext, barDesiredSize, &reflowState,
FinishReflowChild(aBarFrame, aPresContext, barDesiredSize, &reflowInput,
xoffset, yoffset, 0);
}

Просмотреть файл

@ -37,7 +37,7 @@ public:
virtual void Reflow(nsPresContext* aCX,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsIAtom* GetType() const override;
@ -89,7 +89,7 @@ protected:
// Helper function which reflow the anonymous div frame.
void ReflowBarFrame(nsIFrame* aBarFrame,
nsPresContext* aPresContext,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus);
/**

Просмотреть файл

@ -315,12 +315,12 @@ nsRangeFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
void
nsRangeFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsRangeFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
NS_ASSERTION(mTrackDiv, "::-moz-range-track div must exist!");
NS_ASSERTION(mProgressDiv, "::-moz-range-progress div must exist!");
@ -333,20 +333,20 @@ nsRangeFrame::Reflow(nsPresContext* aPresContext,
nsFormControlFrame::RegUnRegAccessKey(this, true);
}
WritingMode wm = aReflowState.GetWritingMode();
nscoord computedBSize = aReflowState.ComputedBSize();
WritingMode wm = aReflowInput.GetWritingMode();
nscoord computedBSize = aReflowInput.ComputedBSize();
if (computedBSize == NS_AUTOHEIGHT) {
computedBSize = 0;
}
LogicalSize
finalSize(wm,
aReflowState.ComputedISize() +
aReflowState.ComputedLogicalBorderPadding().IStartEnd(wm),
aReflowInput.ComputedISize() +
aReflowInput.ComputedLogicalBorderPadding().IStartEnd(wm),
computedBSize +
aReflowState.ComputedLogicalBorderPadding().BStartEnd(wm));
aReflowInput.ComputedLogicalBorderPadding().BStartEnd(wm));
aDesiredSize.SetSize(wm, finalSize);
ReflowAnonymousContent(aPresContext, aDesiredSize, aReflowState);
ReflowAnonymousContent(aPresContext, aDesiredSize, aReflowInput);
aDesiredSize.SetOverflowAreasToDesiredBounds();
@ -369,18 +369,18 @@ nsRangeFrame::Reflow(nsPresContext* aPresContext,
aStatus = NS_FRAME_COMPLETE;
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
void
nsRangeFrame::ReflowAnonymousContent(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState)
const ReflowInput& aReflowInput)
{
// The width/height of our content box, which is the available width/height
// for our anonymous content:
nscoord rangeFrameContentBoxWidth = aReflowState.ComputedWidth();
nscoord rangeFrameContentBoxHeight = aReflowState.ComputedHeight();
nscoord rangeFrameContentBoxWidth = aReflowInput.ComputedWidth();
nscoord rangeFrameContentBoxHeight = aReflowInput.ComputedHeight();
if (rangeFrameContentBoxHeight == NS_AUTOHEIGHT) {
rangeFrameContentBoxHeight = 0;
}
@ -397,9 +397,9 @@ nsRangeFrame::ReflowAnonymousContent(nsPresContext* aPresContext,
// box.
WritingMode wm = trackFrame->GetWritingMode();
LogicalSize availSize = aReflowState.ComputedSize(wm);
LogicalSize availSize = aReflowInput.ComputedSize(wm);
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
ReflowInput trackReflowState(aPresContext, aReflowState,
ReflowInput trackReflowInput(aPresContext, aReflowInput,
trackFrame, availSize);
// Find the x/y position of the track frame such that it will be positioned
@ -409,45 +409,45 @@ nsRangeFrame::ReflowAnonymousContent(nsPresContext* aPresContext,
nscoord trackY = rangeFrameContentBoxHeight / 2;
// Account for the track's border and padding (we ignore its margin):
trackX -= trackReflowState.ComputedPhysicalBorderPadding().left +
trackReflowState.ComputedWidth() / 2;
trackY -= trackReflowState.ComputedPhysicalBorderPadding().top +
trackReflowState.ComputedHeight() / 2;
trackX -= trackReflowInput.ComputedPhysicalBorderPadding().left +
trackReflowInput.ComputedWidth() / 2;
trackY -= trackReflowInput.ComputedPhysicalBorderPadding().top +
trackReflowInput.ComputedHeight() / 2;
// Make relative to our border box instead of our content box:
trackX += aReflowState.ComputedPhysicalBorderPadding().left;
trackY += aReflowState.ComputedPhysicalBorderPadding().top;
trackX += aReflowInput.ComputedPhysicalBorderPadding().left;
trackY += aReflowInput.ComputedPhysicalBorderPadding().top;
nsReflowStatus frameStatus;
ReflowOutput trackDesiredSize(aReflowState);
ReflowOutput trackDesiredSize(aReflowInput);
ReflowChild(trackFrame, aPresContext, trackDesiredSize,
trackReflowState, trackX, trackY, 0, frameStatus);
trackReflowInput, trackX, trackY, 0, frameStatus);
MOZ_ASSERT(NS_FRAME_IS_FULLY_COMPLETE(frameStatus),
"We gave our child unconstrained height, so it should be complete");
FinishReflowChild(trackFrame, aPresContext, trackDesiredSize,
&trackReflowState, trackX, trackY, 0);
&trackReflowInput, trackX, trackY, 0);
}
nsIFrame* thumbFrame = mThumbDiv->GetPrimaryFrame();
if (thumbFrame) { // display:none?
WritingMode wm = thumbFrame->GetWritingMode();
LogicalSize availSize = aReflowState.ComputedSize(wm);
LogicalSize availSize = aReflowInput.ComputedSize(wm);
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
ReflowInput thumbReflowState(aPresContext, aReflowState,
ReflowInput thumbReflowInput(aPresContext, aReflowInput,
thumbFrame, availSize);
// Where we position the thumb depends on its size, so we first reflow
// the thumb at {0,0} to obtain its size, then position it afterwards.
nsReflowStatus frameStatus;
ReflowOutput thumbDesiredSize(aReflowState);
ReflowOutput thumbDesiredSize(aReflowInput);
ReflowChild(thumbFrame, aPresContext, thumbDesiredSize,
thumbReflowState, 0, 0, 0, frameStatus);
thumbReflowInput, 0, 0, 0, frameStatus);
MOZ_ASSERT(NS_FRAME_IS_FULLY_COMPLETE(frameStatus),
"We gave our child unconstrained height, so it should be complete");
FinishReflowChild(thumbFrame, aPresContext, thumbDesiredSize,
&thumbReflowState, 0, 0, 0);
&thumbReflowInput, 0, 0, 0);
DoUpdateThumbPosition(thumbFrame, nsSize(aDesiredSize.Width(),
aDesiredSize.Height()));
}
@ -456,9 +456,9 @@ nsRangeFrame::ReflowAnonymousContent(nsPresContext* aPresContext,
if (rangeProgressFrame) { // display:none?
WritingMode wm = rangeProgressFrame->GetWritingMode();
LogicalSize availSize = aReflowState.ComputedSize(wm);
LogicalSize availSize = aReflowInput.ComputedSize(wm);
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
ReflowInput progressReflowState(aPresContext, aReflowState,
ReflowInput progressReflowInput(aPresContext, aReflowInput,
rangeProgressFrame, availSize);
// We first reflow the range-progress frame at {0,0} to obtain its
@ -466,14 +466,14 @@ nsRangeFrame::ReflowAnonymousContent(nsPresContext* aPresContext,
// ends at the thumb.
nsReflowStatus frameStatus;
ReflowOutput progressDesiredSize(aReflowState);
ReflowOutput progressDesiredSize(aReflowInput);
ReflowChild(rangeProgressFrame, aPresContext,
progressDesiredSize, progressReflowState, 0, 0,
progressDesiredSize, progressReflowInput, 0, 0,
0, frameStatus);
MOZ_ASSERT(NS_FRAME_IS_FULLY_COMPLETE(frameStatus),
"We gave our child unconstrained height, so it should be complete");
FinishReflowChild(rangeProgressFrame, aPresContext,
progressDesiredSize, &progressReflowState, 0, 0, 0);
progressDesiredSize, &progressReflowInput, 0, 0, 0);
DoUpdateRangeProgressFrame(rangeProgressFrame, nsSize(aDesiredSize.Width(),
aDesiredSize.Height()));
}

Просмотреть файл

@ -48,7 +48,7 @@ public:
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
#ifdef DEBUG_FRAME_DUMP
@ -159,7 +159,7 @@ private:
// Helper function which reflows the anonymous div frames.
void ReflowAnonymousContent(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState);
const ReflowInput& aReflowInput);
void DoUpdateThumbPosition(nsIFrame* aThumbFrame,
const nsSize& aRangeSize);

Просмотреть файл

@ -161,7 +161,7 @@ nsSelectsAreaFrame::BuildDisplayListInternal(nsDisplayListBuilder* aBuilder,
void
nsSelectsAreaFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
nsListControlFrame* list = GetEnclosingListFrame(this);
@ -173,7 +173,7 @@ nsSelectsAreaFrame::Reflow(nsPresContext* aPresContext,
// See similar logic in nsListControlFrame::Reflow and
// nsListControlFrame::ReflowAsDropdown. We need to match it here.
WritingMode wm = aReflowState.GetWritingMode();
WritingMode wm = aReflowInput.GetWritingMode();
nscoord oldBSize;
if (isInDropdownMode) {
// Store the block size now in case it changes during
@ -185,7 +185,7 @@ nsSelectsAreaFrame::Reflow(nsPresContext* aPresContext,
}
}
nsBlockFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
nsBlockFrame::Reflow(aPresContext, aDesiredSize, aReflowInput, aStatus);
// Check whether we need to suppress scrollbar updates. We want to do
// that if we're in a possible first pass and our block size of a row

Просмотреть файл

@ -27,7 +27,7 @@ public:
virtual void Reflow(nsPresContext* aCX,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
nscoord BSizeOfARow() const { return mBSizeOfARow; }

Просмотреть файл

@ -486,12 +486,12 @@ nsTextControlFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
void
nsTextControlFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsTextControlFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
// make sure that the form registers itself on the initial/first reflow
if (mState & NS_FRAME_FIRST_REFLOW) {
@ -499,17 +499,17 @@ nsTextControlFrame::Reflow(nsPresContext* aPresContext,
}
// set values of reflow's out parameters
WritingMode wm = aReflowState.GetWritingMode();
WritingMode wm = aReflowInput.GetWritingMode();
LogicalSize
finalSize(wm,
aReflowState.ComputedISize() +
aReflowState.ComputedLogicalBorderPadding().IStartEnd(wm),
aReflowState.ComputedBSize() +
aReflowState.ComputedLogicalBorderPadding().BStartEnd(wm));
aReflowInput.ComputedISize() +
aReflowInput.ComputedLogicalBorderPadding().IStartEnd(wm),
aReflowInput.ComputedBSize() +
aReflowInput.ComputedLogicalBorderPadding().BStartEnd(wm));
aDesiredSize.SetSize(wm, finalSize);
// computation of the ascent wrt the input height
nscoord lineHeight = aReflowState.ComputedBSize();
nscoord lineHeight = aReflowInput.ComputedBSize();
float inflation = nsLayoutUtils::FontSizeInflationFor(this);
if (!IsSingleLineTextControl()) {
lineHeight = ReflowInput::CalcLineHeight(GetContent(), StyleContext(),
@ -521,14 +521,14 @@ nsTextControlFrame::Reflow(nsPresContext* aPresContext,
aDesiredSize.SetBlockStartAscent(
nsLayoutUtils::GetCenteredFontBaseline(fontMet, lineHeight,
wm.IsLineInverted()) +
aReflowState.ComputedLogicalBorderPadding().BStart(wm));
aReflowInput.ComputedLogicalBorderPadding().BStart(wm));
// overflow handling
aDesiredSize.SetOverflowAreasToDesiredBounds();
// perform reflow on all kids
nsIFrame* kid = mFrames.FirstChild();
while (kid) {
ReflowTextControlChild(kid, aPresContext, aReflowState, aStatus, aDesiredSize);
ReflowTextControlChild(kid, aPresContext, aReflowInput, aStatus, aDesiredSize);
kid = kid->GetNextSibling();
}
@ -536,45 +536,45 @@ nsTextControlFrame::Reflow(nsPresContext* aPresContext,
FinishAndStoreOverflow(&aDesiredSize);
aStatus = NS_FRAME_COMPLETE;
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
void
nsTextControlFrame::ReflowTextControlChild(nsIFrame* aKid,
nsPresContext* aPresContext,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus,
ReflowOutput& aParentDesiredSize)
{
// compute available size and frame offsets for child
WritingMode wm = aKid->GetWritingMode();
LogicalSize availSize = aReflowState.ComputedSizeWithPadding(wm);
LogicalSize availSize = aReflowInput.ComputedSizeWithPadding(wm);
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
ReflowInput kidReflowState(aPresContext, aReflowState,
ReflowInput kidReflowInput(aPresContext, aReflowInput,
aKid, availSize, nullptr,
ReflowInput::CALLER_WILL_INIT);
// Override padding with our computed padding in case we got it from theming or percentage
kidReflowState.Init(aPresContext, nullptr, nullptr, &aReflowState.ComputedPhysicalPadding());
kidReflowInput.Init(aPresContext, nullptr, nullptr, &aReflowInput.ComputedPhysicalPadding());
// Set computed width and computed height for the child
kidReflowState.SetComputedWidth(aReflowState.ComputedWidth());
kidReflowState.SetComputedHeight(aReflowState.ComputedHeight());
kidReflowInput.SetComputedWidth(aReflowInput.ComputedWidth());
kidReflowInput.SetComputedHeight(aReflowInput.ComputedHeight());
// Offset the frame by the size of the parent's border
nscoord xOffset = aReflowState.ComputedPhysicalBorderPadding().left -
aReflowState.ComputedPhysicalPadding().left;
nscoord yOffset = aReflowState.ComputedPhysicalBorderPadding().top -
aReflowState.ComputedPhysicalPadding().top;
nscoord xOffset = aReflowInput.ComputedPhysicalBorderPadding().left -
aReflowInput.ComputedPhysicalPadding().left;
nscoord yOffset = aReflowInput.ComputedPhysicalBorderPadding().top -
aReflowInput.ComputedPhysicalPadding().top;
// reflow the child
ReflowOutput desiredSize(aReflowState);
ReflowChild(aKid, aPresContext, desiredSize, kidReflowState,
ReflowOutput desiredSize(aReflowInput);
ReflowChild(aKid, aPresContext, desiredSize, kidReflowInput,
xOffset, yOffset, 0, aStatus);
// place the child
FinishReflowChild(aKid, aPresContext, desiredSize,
&kidReflowState, xOffset, yOffset, 0);
&kidReflowInput, xOffset, yOffset, 0);
// consider the overflow
aParentDesiredSize.mOverflowAreas.UnionWith(desiredSize.mOverflowAreas);

Просмотреть файл

@ -59,7 +59,7 @@ public:
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsSize GetXULMinSize(nsBoxLayoutState& aBoxLayoutState) override;
@ -160,7 +160,7 @@ protected:
*/
void ReflowTextControlChild(nsIFrame* aFrame,
nsPresContext* aPresContext,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus,
ReflowOutput& aParentDesiredSize);

Просмотреть файл

@ -28,7 +28,7 @@ using namespace mozilla::layout;
static bool sFloatFragmentsInsideColumnEnabled;
static bool sFloatFragmentsInsideColumnPrefCached;
BlockReflowInput::BlockReflowInput(const ReflowInput& aReflowState,
BlockReflowInput::BlockReflowInput(const ReflowInput& aReflowInput,
nsPresContext* aPresContext,
nsBlockFrame* aFrame,
bool aBStartMarginRoot,
@ -37,11 +37,11 @@ BlockReflowInput::BlockReflowInput(const ReflowInput& aReflowState,
nscoord aConsumedBSize)
: mBlock(aFrame),
mPresContext(aPresContext),
mReflowState(aReflowState),
mContentArea(aReflowState.GetWritingMode()),
mReflowInput(aReflowInput),
mContentArea(aReflowInput.GetWritingMode()),
mPushedFloats(nullptr),
mOverflowTracker(nullptr),
mBorderPadding(mReflowState.ComputedLogicalBorderPadding()),
mBorderPadding(mReflowInput.ComputedLogicalBorderPadding()),
mPrevBEndMargin(),
mLineNumber(0),
mFlags(0),
@ -55,24 +55,24 @@ BlockReflowInput::BlockReflowInput(const ReflowInput& aReflowState,
}
SetFlag(BRS_FLOAT_FRAGMENTS_INSIDE_COLUMN_ENABLED, sFloatFragmentsInsideColumnEnabled);
WritingMode wm = aReflowState.GetWritingMode();
WritingMode wm = aReflowInput.GetWritingMode();
SetFlag(BRS_ISFIRSTINFLOW, aFrame->GetPrevInFlow() == nullptr);
SetFlag(BRS_ISOVERFLOWCONTAINER, IS_TRUE_OVERFLOW_CONTAINER(aFrame));
nsIFrame::LogicalSides logicalSkipSides =
aFrame->GetLogicalSkipSides(&aReflowState);
aFrame->GetLogicalSkipSides(&aReflowInput);
mBorderPadding.ApplySkipSides(logicalSkipSides);
// Note that mContainerSize is the physical size, needed to
// convert logical block-coordinates in vertical-rl writing mode
// (measured from a RHS origin) to physical coordinates within the
// containing block.
// If aReflowState doesn't have a constrained ComputedWidth(), we set
// If aReflowInput doesn't have a constrained ComputedWidth(), we set
// mContainerSize.width to zero, which means lines will be positioned
// (physically) incorrectly; we will fix them up at the end of
// nsBlockFrame::Reflow, after we know the total block-size of the
// frame.
mContainerSize.width = aReflowState.ComputedWidth();
mContainerSize.width = aReflowInput.ComputedWidth();
if (mContainerSize.width == NS_UNCONSTRAINEDSIZE) {
mContainerSize.width = 0;
}
@ -82,7 +82,7 @@ BlockReflowInput::BlockReflowInput(const ReflowInput& aReflowState,
// For now at least, we don't do that fix-up for mContainerHeight.
// It's only used in nsBidiUtils::ReorderFrames for vertical rtl
// writing modes, which aren't fully supported for the time being.
mContainerSize.height = aReflowState.ComputedHeight() +
mContainerSize.height = aReflowInput.ComputedHeight() +
mBorderPadding.TopBottom(wm);
if ((aBStartMarginRoot && !logicalSkipSides.BStart()) ||
@ -98,7 +98,7 @@ BlockReflowInput::BlockReflowInput(const ReflowInput& aReflowState,
SetFlag(BRS_FLOAT_MGR, true);
}
mFloatManager = aReflowState.mFloatManager;
mFloatManager = aReflowInput.mFloatManager;
NS_ASSERTION(mFloatManager,
"FloatManager should be set in BlockReflowInput" );
@ -112,11 +112,11 @@ BlockReflowInput::BlockReflowInput(const ReflowInput& aReflowState,
mNextInFlow = static_cast<nsBlockFrame*>(mBlock->GetNextInFlow());
LAYOUT_WARN_IF_FALSE(NS_UNCONSTRAINEDSIZE != aReflowState.ComputedISize(),
LAYOUT_WARN_IF_FALSE(NS_UNCONSTRAINEDSIZE != aReflowInput.ComputedISize(),
"have unconstrained width; this should only result "
"from very large sizes, not attempts at intrinsic "
"width calculation");
mContentArea.ISize(wm) = aReflowState.ComputedISize();
mContentArea.ISize(wm) = aReflowInput.ComputedISize();
// Compute content area height. Unlike the width, if we have a
// specified style height we ignore it since extra content is
@ -124,11 +124,11 @@ BlockReflowInput::BlockReflowInput(const ReflowInput& aReflowState,
// specified style height then we may end up limiting our height if
// the availableHeight is constrained (this situation occurs when we
// are paginated).
if (NS_UNCONSTRAINEDSIZE != aReflowState.AvailableBSize()) {
if (NS_UNCONSTRAINEDSIZE != aReflowInput.AvailableBSize()) {
// We are in a paginated situation. The bottom edge is just inside
// the bottom border and padding. The content area height doesn't
// include either border or padding edge.
mBEndEdge = aReflowState.AvailableBSize() - mBorderPadding.BEnd(wm);
mBEndEdge = aReflowInput.AvailableBSize() - mBorderPadding.BEnd(wm);
mContentArea.BSize(wm) = std::max(0, mBEndEdge - mBorderPadding.BStart(wm));
}
else {
@ -143,7 +143,7 @@ BlockReflowInput::BlockReflowInput(const ReflowInput& aReflowState,
mPrevChild = nullptr;
mCurrentLine = aFrame->end_lines();
mMinLineHeight = aReflowState.CalcLineHeight();
mMinLineHeight = aReflowInput.CalcLineHeight();
}
nscoord
@ -163,7 +163,7 @@ BlockReflowInput::ComputeReplacedBlockOffsetsForFloats(
nscoord& aIStartResult,
nscoord& aIEndResult) const
{
WritingMode wm = mReflowState.GetWritingMode();
WritingMode wm = mReflowInput.GetWritingMode();
// The frame is clueless about the float manager and therefore we
// only give it free space. An example is a table frame - the
// tables do not flow around floats.
@ -181,7 +181,7 @@ BlockReflowInput::ComputeReplacedBlockOffsetsForFloats(
iEndOffset = 0;
} else {
LogicalMargin frameMargin(wm);
SizeComputationInput os(aFrame, mReflowState.mRenderingContext,
SizeComputationInput os(aFrame, mReflowInput.mRenderingContext,
wm, mContentArea.ISize(wm));
frameMargin =
os.ComputedLogicalMargin().ConvertTo(wm, aFrame->GetWritingMode());
@ -232,12 +232,12 @@ BlockReflowInput::ComputeBlockAvailSpace(nsIFrame* aFrame,
printf("CBAS frame=%p has floats %d\n",
aFrame, aFloatAvailableSpace.mHasFloats);
#endif
WritingMode wm = mReflowState.GetWritingMode();
WritingMode wm = mReflowInput.GetWritingMode();
aResult.BStart(wm) = mBCoord;
aResult.BSize(wm) = GetFlag(BRS_UNCONSTRAINEDBSIZE)
? NS_UNCONSTRAINEDSIZE
: mReflowState.AvailableBSize() - mBCoord
- GetBEndMarginClone(aFrame, mReflowState.mRenderingContext, mContentArea, wm);
: mReflowInput.AvailableBSize() - mBCoord
- GetBEndMarginClone(aFrame, mReflowInput.mRenderingContext, mContentArea, wm);
// mBCoord might be greater than mBEndEdge if the block's top margin pushes
// it off the page/column. Negative available height can confuse other code
// and is nonsense in principle.
@ -312,7 +312,7 @@ BlockReflowInput::ReplacedBlockFitsInAvailSpace(nsIFrame* aReplacedBlock,
// somewhat expensive.
return true;
}
WritingMode wm = mReflowState.GetWritingMode();
WritingMode wm = mReflowInput.GetWritingMode();
nsBlockFrame::ReplacedElementISizeToClear replacedISize =
nsBlockFrame::ISizeToClearPastFloats(*this, aFloatAvailableSpace.mRect,
aReplacedBlock);
@ -334,7 +334,7 @@ BlockReflowInput::GetFloatAvailableSpaceWithState(
nscoord aBCoord,
nsFloatManager::SavedState *aState) const
{
WritingMode wm = mReflowState.GetWritingMode();
WritingMode wm = mReflowInput.GetWritingMode();
#ifdef DEBUG
// Verify that the caller setup the coordinate system properly
nscoord wI, wB;
@ -371,7 +371,7 @@ BlockReflowInput::GetFloatAvailableSpaceForBSize(
nscoord aBCoord, nscoord aBSize,
nsFloatManager::SavedState *aState) const
{
WritingMode wm = mReflowState.GetWritingMode();
WritingMode wm = mReflowInput.GetWritingMode();
#ifdef DEBUG
// Verify that the caller setup the coordinate system properly
nscoord wI, wB;
@ -485,7 +485,7 @@ void
BlockReflowInput::RecoverFloats(nsLineList::iterator aLine,
nscoord aDeltaBCoord)
{
WritingMode wm = mReflowState.GetWritingMode();
WritingMode wm = mReflowInput.GetWritingMode();
if (aLine->HasFloats()) {
// Place the floats into the space-manager again. Also slide
// them, just like the regular frames on the line.
@ -629,7 +629,7 @@ BlockReflowInput::AddFloat(nsLineLayout* aLineLayout,
placed = FlowAndPlaceFloat(aFloat);
if (placed) {
// Pass on updated available space to the current inline reflow engine
WritingMode wm = mReflowState.GetWritingMode();
WritingMode wm = mReflowInput.GetWritingMode();
nsFlowAreaRect floatAvailSpace = GetFloatAvailableSpace(mBCoord);
LogicalRect availSpace(wm, floatAvailSpace.mRect.IStart(wm), mBCoord,
floatAvailSpace.mRect.ISize(wm),
@ -666,7 +666,7 @@ BlockReflowInput::CanPlaceFloat(nscoord aFloatISize,
// been placed.
// FIXME: We should allow overflow by up to half a pixel here (bug 21193).
return !aFloatAvailableSpace.mHasFloats ||
aFloatAvailableSpace.mRect.ISize(mReflowState.GetWritingMode()) >=
aFloatAvailableSpace.mRect.ISize(mReflowInput.GetWritingMode()) >=
aFloatISize;
}
@ -676,7 +676,7 @@ BlockReflowInput::CanPlaceFloat(nscoord aFloatISize,
// has block-size:auto, and we'll need to actually reflow it to find out
// how much inline-size it will occupy in the containing block's mode.
static nscoord
FloatMarginISize(const ReflowInput& aCBReflowState,
FloatMarginISize(const ReflowInput& aCBReflowInput,
nscoord aFloatAvailableISize,
nsIFrame *aFloat,
const SizeComputationInput& aFloatOffsetState)
@ -686,9 +686,9 @@ FloatMarginISize(const ReflowInput& aCBReflowState,
LogicalSize floatSize =
aFloat->ComputeSize(
aCBReflowState.mRenderingContext,
aCBReflowInput.mRenderingContext,
wm,
aCBReflowState.ComputedSize(wm),
aCBReflowInput.ComputedSize(wm),
aFloatAvailableISize,
aFloatOffsetState.ComputedLogicalMargin().Size(wm),
aFloatOffsetState.ComputedLogicalBorderPadding().Size(wm) -
@ -696,7 +696,7 @@ FloatMarginISize(const ReflowInput& aCBReflowState,
aFloatOffsetState.ComputedLogicalPadding().Size(wm),
nsIFrame::ComputeSizeFlags::eShrinkWrap);
WritingMode cbwm = aCBReflowState.GetWritingMode();
WritingMode cbwm = aCBReflowInput.GetWritingMode();
nscoord floatISize = floatSize.ConvertTo(cbwm, wm).ISize(cbwm);
if (floatISize == NS_UNCONSTRAINEDSIZE) {
return NS_UNCONSTRAINEDSIZE; // reflow is needed to get the true size
@ -712,7 +712,7 @@ FloatMarginISize(const ReflowInput& aCBReflowState,
bool
BlockReflowInput::FlowAndPlaceFloat(nsIFrame* aFloat)
{
WritingMode wm = mReflowState.GetWritingMode();
WritingMode wm = mReflowInput.GetWritingMode();
// Save away the Y coordinate before placing the float. We will
// restore mBCoord at the end after placing the float. This is
// necessary because any adjustments to mBCoord during the float
@ -746,10 +746,10 @@ BlockReflowInput::FlowAndPlaceFloat(nsIFrame* aFloat)
NS_ASSERTION(aFloat->GetParent() == mBlock,
"Float frame has wrong parent");
SizeComputationInput offsets(aFloat, mReflowState.mRenderingContext,
wm, mReflowState.ComputedISize());
SizeComputationInput offsets(aFloat, mReflowInput.mRenderingContext,
wm, mReflowInput.ComputedISize());
nscoord floatMarginISize = FloatMarginISize(mReflowState,
nscoord floatMarginISize = FloatMarginISize(mReflowInput,
adjustedAvailableSpace.ISize(wm),
aFloat, offsets);
@ -791,10 +791,10 @@ BlockReflowInput::FlowAndPlaceFloat(nsIFrame* aFloat)
// at the top of the page (to avoid an infinite loop of pushing and
// breaking).
bool mustPlaceFloat =
mReflowState.mFlags.mIsTopOfPage && IsAdjacentWithTop();
mReflowInput.mFlags.mIsTopOfPage && IsAdjacentWithTop();
for (;;) {
if (mReflowState.AvailableHeight() != NS_UNCONSTRAINEDSIZE &&
if (mReflowInput.AvailableHeight() != NS_UNCONSTRAINEDSIZE &&
floatAvailableSpace.mRect.BSize(wm) <= 0 &&
!mustPlaceFloat) {
// No space, nowhere to put anything.
@ -859,7 +859,7 @@ BlockReflowInput::FlowAndPlaceFloat(nsIFrame* aFloat)
floatAvailableSpace = GetFloatAvailableSpace(mBCoord);
adjustedAvailableSpace = mBlock->AdjustFloatAvailableSpace(*this,
floatAvailableSpace.mRect, aFloat);
floatMarginISize = FloatMarginISize(mReflowState,
floatMarginISize = FloatMarginISize(mReflowInput,
adjustedAvailableSpace.ISize(wm),
aFloat, offsets);
}
@ -930,12 +930,12 @@ BlockReflowInput::FlowAndPlaceFloat(nsIFrame* aFloat)
return false;
}
// We can't use aFloat->ShouldAvoidBreakInside(mReflowState) here since
// We can't use aFloat->ShouldAvoidBreakInside(mReflowInput) here since
// its mIsTopOfPage may be true even though the float isn't at the
// top when floatPos.B(wm) > 0.
if (ContentBSize() != NS_UNCONSTRAINEDSIZE &&
!mustPlaceFloat &&
(!mReflowState.mFlags.mIsTopOfPage || floatPos.B(wm) > 0) &&
(!mReflowInput.mFlags.mIsTopOfPage || floatPos.B(wm) > 0) &&
NS_STYLE_PAGE_BREAK_AVOID == aFloat->StyleDisplay()->mBreakInside &&
(!NS_FRAME_IS_FULLY_COMPLETE(reflowStatus) ||
aFloat->BSize(wm) + floatMargin.BStartEnd(wm) >
@ -1037,7 +1037,7 @@ BlockReflowInput::PushFloatPastBreak(nsIFrame *aFloat)
// * don't waste much time trying to reflow this float again until
// after the break
uint8_t floatStyle =
aFloat->StyleDisplay()->PhysicalFloats(mReflowState.GetWritingMode());
aFloat->StyleDisplay()->PhysicalFloats(mReflowInput.GetWritingMode());
if (floatStyle == NS_STYLE_FLOAT_LEFT) {
mFloatManager->SetPushedLeftFloatPastBreak();
} else {

Просмотреть файл

@ -80,7 +80,7 @@ class BlockReflowInput {
using ReflowInput = mozilla::ReflowInput;
public:
BlockReflowInput(const ReflowInput& aReflowState,
BlockReflowInput(const ReflowInput& aReflowInput,
nsPresContext* aPresContext,
nsBlockFrame* aFrame,
bool aBStartMarginRoot, bool aBEndMarginRoot,
@ -137,12 +137,12 @@ public:
// next column/page).
bool AdvanceToNextBand(const mozilla::LogicalRect& aFloatAvailableSpace,
nscoord *aBCoord) const {
mozilla::WritingMode wm = mReflowState.GetWritingMode();
mozilla::WritingMode wm = mReflowInput.GetWritingMode();
if (aFloatAvailableSpace.BSize(wm) > 0) {
// See if there's room in the next band.
*aBCoord += aFloatAvailableSpace.BSize(wm);
} else {
if (mReflowState.AvailableHeight() != NS_UNCONSTRAINEDSIZE) {
if (mReflowInput.AvailableHeight() != NS_UNCONSTRAINEDSIZE) {
// Stop trying to clear here; we'll just get pushed to the
// next column or page and try again there.
return false;
@ -157,7 +157,7 @@ public:
const nsFlowAreaRect& aFloatAvailableSpace) const;
bool IsAdjacentWithTop() const {
return mBCoord == mBorderPadding.BStart(mReflowState.GetWritingMode());
return mBCoord == mBorderPadding.BStart(mReflowInput.GetWritingMode());
}
/**
@ -209,7 +209,7 @@ public:
nsPresContext* mPresContext;
const ReflowInput& mReflowState;
const ReflowInput& mReflowInput;
nsFloatManager* mFloatManager;
@ -242,25 +242,25 @@ public:
// coordinate overflow may occur.
mozilla::LogicalRect mContentArea;
nscoord ContentIStart() const {
return mContentArea.IStart(mReflowState.GetWritingMode());
return mContentArea.IStart(mReflowInput.GetWritingMode());
}
nscoord ContentISize() const {
return mContentArea.ISize(mReflowState.GetWritingMode());
return mContentArea.ISize(mReflowInput.GetWritingMode());
}
nscoord ContentIEnd() const {
return mContentArea.IEnd(mReflowState.GetWritingMode());
return mContentArea.IEnd(mReflowInput.GetWritingMode());
}
nscoord ContentBStart() const {
return mContentArea.BStart(mReflowState.GetWritingMode());
return mContentArea.BStart(mReflowInput.GetWritingMode());
}
nscoord ContentBSize() const {
return mContentArea.BSize(mReflowState.GetWritingMode());
return mContentArea.BSize(mReflowInput.GetWritingMode());
}
nscoord ContentBEnd() const {
return mContentArea.BEnd(mReflowState.GetWritingMode());
return mContentArea.BEnd(mReflowInput.GetWritingMode());
}
mozilla::LogicalSize ContentSize(mozilla::WritingMode aWM) const {
mozilla::WritingMode wm = mReflowState.GetWritingMode();
mozilla::WritingMode wm = mReflowInput.GetWritingMode();
return mContentArea.Size(wm).ConvertTo(aWM, wm);
}

Просмотреть файл

@ -67,7 +67,7 @@ ReflowInput::ReflowInput(nsPresContext* aPresContext,
MOZ_ASSERT(aPresContext, "no pres context");
MOZ_ASSERT(aFrame, "no frame");
MOZ_ASSERT(aPresContext == aFrame->PresContext(), "wrong pres context");
mParentReflowState = nullptr;
mParentReflowInput = nullptr;
AvailableISize() = aAvailableSpace.ISize(mWritingMode);
AvailableBSize() = aAvailableSpace.BSize(mWritingMode);
mFloatManager = nullptr;
@ -76,7 +76,7 @@ ReflowInput::ReflowInput(nsPresContext* aPresContext,
mPercentBSizeObserver = nullptr;
if (aFlags & DUMMY_PARENT_REFLOW_STATE) {
mFlags.mDummyParentReflowState = true;
mFlags.mDummyParentReflowInput = true;
}
if (aFlags & COMPUTE_SIZE_SHRINK_WRAP) {
mFlags.mShrinkWrap = true;
@ -166,7 +166,7 @@ SizeComputationInput::SizeComputationInput(nsIFrame *aFrame,
"padding contribution - see SizeComputationInput::InitOffsets");
LogicalSize cbSize(aContainingBlockWritingMode, aContainingBlockISize,
aContainingBlockISize);
ReflowStateFlags flags;
ReflowInputFlags flags;
InitOffsets(aContainingBlockWritingMode, cbSize, mFrame->GetType(), flags);
}
@ -175,16 +175,16 @@ SizeComputationInput::SizeComputationInput(nsIFrame *aFrame,
// computed.
ReflowInput::ReflowInput(
nsPresContext* aPresContext,
const ReflowInput& aParentReflowState,
const ReflowInput& aParentReflowInput,
nsIFrame* aFrame,
const LogicalSize& aAvailableSpace,
const LogicalSize* aContainingBlockSize,
uint32_t aFlags)
: SizeComputationInput(aFrame, aParentReflowState.mRenderingContext)
: SizeComputationInput(aFrame, aParentReflowInput.mRenderingContext)
, mBlockDelta(0)
, mOrthogonalLimit(NS_UNCONSTRAINEDSIZE)
, mReflowDepth(aParentReflowState.mReflowDepth + 1)
, mFlags(aParentReflowState.mFlags)
, mReflowDepth(aParentReflowInput.mReflowDepth + 1)
, mFlags(aParentReflowInput.mFlags)
{
MOZ_ASSERT(aPresContext, "no pres context");
MOZ_ASSERT(aFrame, "no frame");
@ -193,56 +193,56 @@ ReflowInput::ReflowInput(
!NS_SUBTREE_DIRTY(aFrame),
"frame should be clean when getting special bsize reflow");
mParentReflowState = &aParentReflowState;
mParentReflowInput = &aParentReflowInput;
// If the parent is dirty, then the child is as well.
// XXX Are the other cases where the parent reflows a child a second
// time, as a resize?
if (!mFlags.mSpecialBSizeReflow)
mFrame->AddStateBits(mParentReflowState->mFrame->GetStateBits() &
mFrame->AddStateBits(mParentReflowInput->mFrame->GetStateBits() &
NS_FRAME_IS_DIRTY);
AvailableISize() = aAvailableSpace.ISize(mWritingMode);
AvailableBSize() = aAvailableSpace.BSize(mWritingMode);
if (mWritingMode.IsOrthogonalTo(aParentReflowState.GetWritingMode())) {
if (mWritingMode.IsOrthogonalTo(aParentReflowInput.GetWritingMode())) {
// If we're setting up for an orthogonal flow, and the parent reflow state
// had a constrained ComputedBSize, we can use that as our AvailableISize
// in preference to leaving it unconstrained.
if (AvailableISize() == NS_UNCONSTRAINEDSIZE &&
aParentReflowState.ComputedBSize() != NS_UNCONSTRAINEDSIZE) {
AvailableISize() = aParentReflowState.ComputedBSize();
aParentReflowInput.ComputedBSize() != NS_UNCONSTRAINEDSIZE) {
AvailableISize() = aParentReflowInput.ComputedBSize();
}
}
mFloatManager = aParentReflowState.mFloatManager;
mFloatManager = aParentReflowInput.mFloatManager;
if (mFrame->IsFrameOfType(nsIFrame::eLineParticipant))
mLineLayout = aParentReflowState.mLineLayout;
mLineLayout = aParentReflowInput.mLineLayout;
else
mLineLayout = nullptr;
// Note: mFlags was initialized as a copy of aParentReflowState.mFlags up in
// Note: mFlags was initialized as a copy of aParentReflowInput.mFlags up in
// this constructor's init list, so the only flags that we need to explicitly
// initialize here are those that may need a value other than our parent's.
mFlags.mNextInFlowUntouched = aParentReflowState.mFlags.mNextInFlowUntouched &&
CheckNextInFlowParenthood(aFrame, aParentReflowState.mFrame);
mFlags.mNextInFlowUntouched = aParentReflowInput.mFlags.mNextInFlowUntouched &&
CheckNextInFlowParenthood(aFrame, aParentReflowInput.mFrame);
mFlags.mAssumingHScrollbar = mFlags.mAssumingVScrollbar = false;
mFlags.mIsColumnBalancing = false;
mFlags.mIsFlexContainerMeasuringHeight = false;
mFlags.mDummyParentReflowState = false;
mFlags.mDummyParentReflowInput = false;
mFlags.mShrinkWrap = !!(aFlags & COMPUTE_SIZE_SHRINK_WRAP);
mFlags.mUseAutoBSize = !!(aFlags & COMPUTE_SIZE_USE_AUTO_BSIZE);
mFlags.mStaticPosIsCBOrigin = !!(aFlags & STATIC_POS_IS_CB_ORIGIN);
mDiscoveredClearance = nullptr;
mPercentBSizeObserver = (aParentReflowState.mPercentBSizeObserver &&
aParentReflowState.mPercentBSizeObserver->NeedsToObserve(*this))
? aParentReflowState.mPercentBSizeObserver : nullptr;
mPercentBSizeObserver = (aParentReflowInput.mPercentBSizeObserver &&
aParentReflowInput.mPercentBSizeObserver->NeedsToObserve(*this))
? aParentReflowInput.mPercentBSizeObserver : nullptr;
if ((aFlags & DUMMY_PARENT_REFLOW_STATE) ||
(mParentReflowState->mFlags.mDummyParentReflowState &&
(mParentReflowInput->mFlags.mDummyParentReflowInput &&
mFrame->GetType() == nsGkAtoms::tableFrame)) {
mFlags.mDummyParentReflowState = true;
mFlags.mDummyParentReflowInput = true;
}
if (!(aFlags & CALLER_WILL_INIT)) {
@ -354,8 +354,8 @@ ReflowInput::Init(nsPresContext* aPresContext,
if (AvailableISize() == NS_UNCONSTRAINEDSIZE) {
// Look up the parent chain for an orthogonal inline limit,
// and reset AvailableISize() if found.
for (const ReflowInput *parent = mParentReflowState;
parent != nullptr; parent = parent->mParentReflowState) {
for (const ReflowInput *parent = mParentReflowInput;
parent != nullptr; parent = parent->mParentReflowInput) {
if (parent->GetWritingMode().IsOrthogonalTo(mWritingMode) &&
parent->mOrthogonalLimit != NS_UNCONSTRAINEDSIZE) {
AvailableISize() = parent->mOrthogonalLimit;
@ -380,7 +380,7 @@ ReflowInput::Init(nsPresContext* aPresContext,
nsIAtom* type = mFrame->GetType();
InitFrameType(type);
InitCBReflowState();
InitCBReflowInput();
LogicalSize cbSize(mWritingMode, -1, -1);
if (aContainingBlockSize) {
@ -446,8 +446,8 @@ ReflowInput::Init(nsPresContext* aPresContext,
}
}
if (mParentReflowState &&
mParentReflowState->GetWritingMode().IsOrthogonalTo(mWritingMode)) {
if (mParentReflowInput &&
mParentReflowInput->GetWritingMode().IsOrthogonalTo(mWritingMode)) {
// Orthogonal frames are always reflowed with an unconstrained
// dimension to avoid incomplete reflow across an orthogonal
// boundary. Normally this is the block-size, but for column sets
@ -470,23 +470,23 @@ ReflowInput::Init(nsPresContext* aPresContext,
"intrinsic inline-size calculation");
}
void ReflowInput::InitCBReflowState()
void ReflowInput::InitCBReflowInput()
{
if (!mParentReflowState) {
mCBReflowState = nullptr;
if (!mParentReflowInput) {
mCBReflowInput = nullptr;
return;
}
if (mParentReflowState->mFrame == mFrame->GetContainingBlock()) {
if (mParentReflowInput->mFrame == mFrame->GetContainingBlock()) {
// Inner table frames need to use the containing block of the outer
// table frame.
if (mFrame->GetType() == nsGkAtoms::tableFrame) {
mCBReflowState = mParentReflowState->mCBReflowState;
mCBReflowInput = mParentReflowInput->mCBReflowInput;
} else {
mCBReflowState = mParentReflowState;
mCBReflowInput = mParentReflowInput;
}
} else {
mCBReflowState = mParentReflowState->mCBReflowState;
mCBReflowInput = mParentReflowInput->mCBReflowInput;
}
}
@ -535,7 +535,7 @@ ReflowInput::InitResizeFlags(nsPresContext* aPresContext, nsIAtom* aFrameType)
// (where we shouldn't be inflating anyway, and where
// reflow state construction is probably to construct a
// dummy parent reflow state anyway).
!mFlags.mDummyParentReflowState;
!mFlags.mDummyParentReflowInput;
if (dirty || (!mFrame->GetParent() && isIResize)) {
// When font size inflation is enabled, a change in either:
@ -615,7 +615,7 @@ ReflowInput::InitResizeFlags(nsPresContext* aPresContext, nsIAtom* aFrameType)
SetIResize(!(mFrame->GetStateBits() & NS_FRAME_IS_DIRTY) &&
isIResize);
// XXX Should we really need to null check mCBReflowState? (We do for
// XXX Should we really need to null check mCBReflowInput? (We do for
// at least nsBoxFrame).
if (IS_TABLE_CELL(aFrameType) &&
(mFlags.mSpecialBSizeReflow ||
@ -623,16 +623,16 @@ ReflowInput::InitResizeFlags(nsPresContext* aPresContext, nsIAtom* aFrameType)
NS_TABLE_CELL_HAD_SPECIAL_REFLOW)) &&
(mFrame->GetStateBits() & NS_FRAME_CONTAINS_RELATIVE_BSIZE)) {
// Need to set the bit on the cell so that
// mCBReflowState->IsBResize() is set correctly below when
// mCBReflowInput->IsBResize() is set correctly below when
// reflowing descendant.
SetBResize(true);
} else if (mCBReflowState && mFrame->IsBlockWrapper()) {
} else if (mCBReflowInput && mFrame->IsBlockWrapper()) {
// XXX Is this problematic for relatively positioned inlines acting
// as containing block for absolutely positioned elements?
// Possibly; in that case we should at least be checking
// NS_SUBTREE_DIRTY, I'd think.
SetBResize(mCBReflowState->IsBResizeForWM(wm));
} else if (mCBReflowState && !nsLayoutUtils::GetAsBlock(mFrame)) {
SetBResize(mCBReflowInput->IsBResizeForWM(wm));
} else if (mCBReflowInput && !nsLayoutUtils::GetAsBlock(mFrame)) {
// Some non-block frames (e.g. table frames) aggressively optimize out their
// BSize recomputation when they don't have the BResize flag set. This
// means that if they go from having a computed non-auto height to having an
@ -651,14 +651,14 @@ ReflowInput::InitResizeFlags(nsPresContext* aPresContext, nsIAtom* aFrameType)
// Note that we _also_ need to set the BResize flag if we have auto
// ComputedBSize() and a dirty subtree, since that might require us to
// change BSize due to kids having been added or removed.
SetBResize(mCBReflowState->IsBResizeForWM(wm));
SetBResize(mCBReflowInput->IsBResizeForWM(wm));
if (ComputedBSize() == NS_AUTOHEIGHT) {
SetBResize(IsBResize() || NS_SUBTREE_DIRTY(mFrame));
}
} else if (ComputedBSize() == NS_AUTOHEIGHT) {
if (eCompatibility_NavQuirks == aPresContext->CompatibilityMode() &&
mCBReflowState) {
SetBResize(mCBReflowState->IsBResizeForWM(wm));
mCBReflowInput) {
SetBResize(mCBReflowInput->IsBResizeForWM(wm));
} else {
SetBResize(IsIResize());
}
@ -696,10 +696,10 @@ ReflowInput::InitResizeFlags(nsPresContext* aPresContext, nsIAtom* aFrameType)
// special bsize reflow. However, don't do this if it actually is
// the special bsize reflow, since in that case it will already be
// set correctly above if we need it set.
if (!IsBResize() && mCBReflowState &&
(IS_TABLE_CELL(mCBReflowState->mFrame->GetType()) ||
mCBReflowState->mFlags.mHeightDependsOnAncestorCell) &&
!mCBReflowState->mFlags.mSpecialBSizeReflow &&
if (!IsBResize() && mCBReflowInput &&
(IS_TABLE_CELL(mCBReflowInput->mFrame->GetType()) ||
mCBReflowInput->mFlags.mHeightDependsOnAncestorCell) &&
!mCBReflowInput->mFlags.mSpecialBSizeReflow &&
dependsOnCBBSize) {
SetBResize(true);
mFlags.mHeightDependsOnAncestorCell = true;
@ -714,11 +714,11 @@ ReflowInput::InitResizeFlags(nsPresContext* aPresContext, nsIAtom* aFrameType)
// of table cells) can cause not just a single percentage height to
// become fixed, but an entire descendant chain of percentage height
// to become fixed.
if (dependsOnCBBSize && mCBReflowState) {
if (dependsOnCBBSize && mCBReflowInput) {
const ReflowInput *rs = this;
bool hitCBReflowState = false;
bool hitCBReflowInput = false;
do {
rs = rs->mParentReflowState;
rs = rs->mParentReflowInput;
if (!rs) {
break;
}
@ -729,14 +729,14 @@ ReflowInput::InitResizeFlags(nsPresContext* aPresContext, nsIAtom* aFrameType)
// Keep track of whether we've hit the containing block, because
// we need to go at least that far.
if (rs == mCBReflowState) {
hitCBReflowState = true;
if (rs == mCBReflowInput) {
hitCBReflowInput = true;
}
// XXX What about orthogonal flows? It doesn't make sense to
// keep propagating this bit across an orthogonal boundary,
// where the meaning of BSize changes. Bug 1175517.
} while (!hitCBReflowState ||
} while (!hitCBReflowInput ||
(eCompatibility_NavQuirks == aPresContext->CompatibilityMode() &&
!IsQuirkContainingBlockHeight(rs, rs->mFrame->GetType())));
// Note: We actually don't need to set the
@ -756,12 +756,12 @@ ReflowInput::InitResizeFlags(nsPresContext* aPresContext, nsIAtom* aFrameType)
nscoord
ReflowInput::GetContainingBlockContentISize(WritingMode aWritingMode) const
{
if (!mCBReflowState) {
if (!mCBReflowInput) {
return 0;
}
return mCBReflowState->GetWritingMode().IsOrthogonalTo(aWritingMode)
? mCBReflowState->ComputedBSize()
: mCBReflowState->ComputedISize();
return mCBReflowInput->GetWritingMode().IsOrthogonalTo(aWritingMode)
? mCBReflowInput->ComputedBSize()
: mCBReflowInput->ComputedISize();
}
void
@ -1037,8 +1037,8 @@ ReflowInput::GetHypotheticalBoxContainer(nsIFrame* aFrame,
If so, use the info from the reflow state. */
const ReflowInput* state;
if (aFrame->GetStateBits() & NS_FRAME_IN_REFLOW) {
for (state = mParentReflowState; state && state->mFrame != aFrame;
state = state->mParentReflowState) {
for (state = mParentReflowInput; state && state->mFrame != aFrame;
state = state->mParentReflowInput) {
/* do nothing */
}
} else {
@ -1842,27 +1842,27 @@ ReflowInput::InitAbsoluteConstraints(nsPresContext* aPresContext,
// This will not be converted to abstract coordinates because it's only
// used in CalcQuirkContainingBlockHeight
nscoord
GetBlockMarginBorderPadding(const ReflowInput* aReflowState)
GetBlockMarginBorderPadding(const ReflowInput* aReflowInput)
{
nscoord result = 0;
if (!aReflowState) return result;
if (!aReflowInput) return result;
// zero auto margins
nsMargin margin = aReflowState->ComputedPhysicalMargin();
nsMargin margin = aReflowInput->ComputedPhysicalMargin();
if (NS_AUTOMARGIN == margin.top)
margin.top = 0;
if (NS_AUTOMARGIN == margin.bottom)
margin.bottom = 0;
result += margin.top + margin.bottom;
result += aReflowState->ComputedPhysicalBorderPadding().top +
aReflowState->ComputedPhysicalBorderPadding().bottom;
result += aReflowInput->ComputedPhysicalBorderPadding().top +
aReflowInput->ComputedPhysicalBorderPadding().bottom;
return result;
}
/* Get the height based on the viewport of the containing block specified
* in aReflowState when the containing block has mComputedHeight == NS_AUTOHEIGHT
* in aReflowInput when the containing block has mComputedHeight == NS_AUTOHEIGHT
* This will walk up the chain of containing blocks looking for a computed height
* until it finds the canvas frame, or it encounters a frame that is not a block,
* area, or scroll frame. This handles compatibility with IE (see bug 85016 and bug 219693)
@ -1873,7 +1873,7 @@ GetBlockMarginBorderPadding(const ReflowInput* aReflowState)
* See also IsQuirkContainingBlockHeight.
*/
static nscoord
CalcQuirkContainingBlockHeight(const ReflowInput* aCBReflowState)
CalcQuirkContainingBlockHeight(const ReflowInput* aCBReflowInput)
{
const ReflowInput* firstAncestorRS = nullptr; // a candidate for html frame
const ReflowInput* secondAncestorRS = nullptr; // a candidate for body frame
@ -1883,8 +1883,8 @@ CalcQuirkContainingBlockHeight(const ReflowInput* aCBReflowState)
// don't alter this height especially if we are restricted to one level
nscoord result = NS_AUTOHEIGHT;
const ReflowInput* rs = aCBReflowState;
for (; rs; rs = rs->mParentReflowState) {
const ReflowInput* rs = aCBReflowInput;
for (; rs; rs = rs->mParentReflowInput) {
nsIAtom* frameType = rs->mFrame->GetType();
// if the ancestor is auto height then skip it and continue up if it
// is the first block frame and possibly the body/html
@ -1958,9 +1958,9 @@ CalcQuirkContainingBlockHeight(const ReflowInput* aCBReflowState)
}
// if we got to the html frame (a block child of the canvas) ...
else if (nsGkAtoms::blockFrame == frameType &&
rs->mParentReflowState &&
rs->mParentReflowInput &&
nsGkAtoms::canvasFrame ==
rs->mParentReflowState->mFrame->GetType()) {
rs->mParentReflowInput->mFrame->GetType()) {
// ... then subtract out margin/border/padding for the BODY element
result -= GetBlockMarginBorderPadding(secondAncestorRS);
}
@ -2099,7 +2099,7 @@ ReflowInput::InitConstraints(nsPresContext* aPresContext,
// If this is a reflow root, then set the computed width and
// height equal to the available space
if (nullptr == mParentReflowState || mFlags.mDummyParentReflowState) {
if (nullptr == mParentReflowInput || mFlags.mDummyParentReflowInput) {
// XXXldb This doesn't mean what it used to!
InitOffsets(wm, OffsetPercentBasis(mFrame, wm, aContainingBlockSize),
aFrameType, mFlags, aBorder, aPadding);
@ -2127,7 +2127,7 @@ ReflowInput::InitConstraints(nsPresContext* aPresContext,
ComputedMaxWidth() = ComputedMaxHeight() = NS_UNCONSTRAINEDSIZE;
} else {
// Get the containing block reflow state
const ReflowInput* cbrs = mCBReflowState;
const ReflowInput* cbrs = mCBReflowInput;
NS_ASSERTION(nullptr != cbrs, "no containing block");
// If we weren't given a containing block width and height, then
@ -2143,7 +2143,7 @@ ReflowInput::InitConstraints(nsPresContext* aPresContext,
// See if the containing block is a cell frame which needs
// to use the mComputedHeight of the cell instead of what the cell block passed in.
// XXX It seems like this could lead to bugs with min-height and friends
if (cbrs->mParentReflowState) {
if (cbrs->mParentReflowInput) {
fType = cbrs->mFrame->GetType();
if (IS_TABLE_CELL(fType)) {
// use the cell's computed block size
@ -2336,8 +2336,8 @@ ReflowInput::InitConstraints(nsPresContext* aPresContext,
mFrame->StyleContext()->GetPseudo() != nsCSSAnonBoxes::scrolledContent) ||
(aFrameType == nsGkAtoms::scrollFrame &&
mFrame->GetContentInsertionFrame()->GetType() == nsGkAtoms::legendFrame) ||
(mCBReflowState &&
mCBReflowState->GetWritingMode().IsOrthogonalTo(mWritingMode)))) {
(mCBReflowInput &&
mCBReflowInput->GetWritingMode().IsOrthogonalTo(mWritingMode)))) {
computeSizeFlags =
ComputeSizeFlags(computeSizeFlags | ComputeSizeFlags::eShrinkWrap);
}
@ -2414,7 +2414,7 @@ void
SizeComputationInput::InitOffsets(WritingMode aWM,
const LogicalSize& aPercentBasis,
nsIAtom* aFrameType,
ReflowStateFlags aFlags,
ReflowInputFlags aFlags,
const nsMargin* aBorder,
const nsMargin* aPadding)
{
@ -2567,7 +2567,7 @@ ReflowInput::CalculateBlockSideMargins(nsIAtom* aFrameType)
// the BStart/BEnd margins; those are the "sides" of the block from its
// container's point of view.
WritingMode cbWM =
mCBReflowState ? mCBReflowState->GetWritingMode(): GetWritingMode();
mCBReflowInput ? mCBReflowInput->GetWritingMode(): GetWritingMode();
nscoord availISizeCBWM = AvailableSize(cbWM).ISize(cbWM);
nscoord computedISizeCBWM = ComputedSize(cbWM).ISize(cbWM);
@ -2618,13 +2618,13 @@ ReflowInput::CalculateBlockSideMargins(nsIAtom* aFrameType)
// 'direction' property of the parent to tell which margin to
// ignore
// First check if there is an HTML alignment that we should honor
const ReflowInput* prs = mParentReflowState;
const ReflowInput* prs = mParentReflowInput;
if (aFrameType == nsGkAtoms::tableFrame) {
NS_ASSERTION(prs->mFrame->GetType() == nsGkAtoms::tableWrapperFrame,
"table not inside table wrapper");
// Center the table within the table wrapper based on the alignment
// of the table wrapper's parent.
prs = prs->mParentReflowState;
prs = prs->mParentReflowInput;
}
if (prs &&
(prs->mStyleText->mTextAlign == NS_STYLE_TEXT_ALIGN_MOZ_LEFT ||
@ -2748,7 +2748,7 @@ ReflowInput::CalcLineHeight() const
{
nscoord blockBSize =
nsLayoutUtils::IsNonWrapperBlock(mFrame) ? ComputedBSize() :
(mCBReflowState ? mCBReflowState->ComputedBSize() : NS_AUTOHEIGHT);
(mCBReflowInput ? mCBReflowInput->ComputedBSize() : NS_AUTOHEIGHT);
return CalcLineHeight(mFrame->GetContent(), mFrame->StyleContext(), blockBSize,
nsLayoutUtils::FontSizeInflationFor(mFrame));

Просмотреть файл

@ -175,8 +175,8 @@ public:
mozilla::WritingMode aContainingBlockWritingMode,
nscoord aContainingBlockISize);
struct ReflowStateFlags {
ReflowStateFlags() { memset(this, 0, sizeof(*this)); }
struct ReflowInputFlags {
ReflowInputFlags() { memset(this, 0, sizeof(*this)); }
uint16_t mSpecialBSizeReflow:1; // used by tables to communicate special reflow (in process) to handle
// percent bsize frames inside cells which may not have computed bsizes
uint16_t mNextInFlowUntouched:1; // nothing in the frame's next-in-flow (or its descendants)
@ -206,7 +206,7 @@ public:
uint16_t mIsFlexContainerMeasuringHeight:1; // nsFlexContainerFrame is
// reflowing this child to
// measure its intrinsic height.
uint16_t mDummyParentReflowState:1; // a "fake" reflow state made
uint16_t mDummyParentReflowInput:1; // a "fake" reflow state made
// in order to be the parent
// of a real one
uint16_t mMustReflowPlaceholders:1; // Should this frame reflow its place-
@ -281,7 +281,7 @@ protected:
void InitOffsets(mozilla::WritingMode aWM,
const mozilla::LogicalSize& aPercentBasis,
nsIAtom* aFrameType,
ReflowStateFlags aFlags,
ReflowInputFlags aFlags,
const nsMargin* aBorder = nullptr,
const nsMargin* aPadding = nullptr);
@ -317,7 +317,7 @@ protected:
struct ReflowInput : public SizeComputationInput {
// the reflow states are linked together. this is the pointer to the
// parent's reflow state
const ReflowInput* mParentReflowState;
const ReflowInput* mParentReflowInput;
// pointer to the float manager associated with this area
nsFloatManager* mFloatManager;
@ -327,7 +327,7 @@ struct ReflowInput : public SizeComputationInput {
// The appropriate reflow state for the containing block (for
// percentage widths, etc.) of this reflow state's frame.
const ReflowInput *mCBReflowState;
const ReflowInput *mCBReflowInput;
// The type of frame, from css's perspective. This value is
// initialized by the Init method below.
@ -344,7 +344,7 @@ struct ReflowInput : public SizeComputationInput {
nscoord mBlockDelta;
// If an ReflowInput finds itself initialized with an unconstrained
// inline-size, it will look up its parentReflowState chain for a state
// inline-size, it will look up its parentReflowInput chain for a state
// with an orthogonal writing mode and a non-NS_UNCONSTRAINEDSIZE value for
// orthogonal limit; when it finds such a reflow-state, it will use its
// orthogonal-limit value to constrain inline-size.
@ -591,7 +591,7 @@ public:
// This value keeps track of how deeply nested a given reflow state
// is from the top of the frame tree.
int16_t mReflowDepth;
ReflowStateFlags mFlags;
ReflowInputFlags mFlags;
// Logical and physical accessors for the resize flags. All users should go
// via these accessors, so that in due course we can change the storage from
@ -659,7 +659,7 @@ public:
* state are copied from the parent's reflow state. The remainder is computed.
*
* @param aPresContext Must be equal to aFrame->PresContext().
* @param aParentReflowState A reference to an ReflowInput object that
* @param aParentReflowInput A reference to an ReflowInput object that
* is to be the parent of this object.
* @param aFrame The frame for whose reflow state is being constructed.
* @param aAvailableSpace See comments for availableHeight and availableWidth
@ -671,7 +671,7 @@ public:
* below).
*/
ReflowInput(nsPresContext* aPresContext,
const ReflowInput& aParentReflowState,
const ReflowInput& aParentReflowInput,
nsIFrame* aFrame,
const mozilla::LogicalSize& aAvailableSpace,
const mozilla::LogicalSize* aContainingBlockSize = nullptr,
@ -680,7 +680,7 @@ public:
// Values for |aFlags| passed to constructor
enum {
// Indicates that the parent of this reflow state is "fake" (see
// mDummyParentReflowState in mFlags).
// mDummyParentReflowInput in mFlags).
DUMMY_PARENT_REFLOW_STATE = (1<<0),
// Indicates that the calling function will initialize the reflow state, and
@ -922,7 +922,7 @@ public:
protected:
void InitFrameType(nsIAtom* aFrameType);
void InitCBReflowState();
void InitCBReflowInput();
void InitResizeFlags(nsPresContext* aPresContext, nsIAtom* aFrameType);
void InitConstraints(nsPresContext* aPresContext,

Просмотреть файл

@ -110,7 +110,7 @@ nsAbsoluteContainingBlock::RemoveFrame(nsIFrame* aDelegatingFrame,
void
nsAbsoluteContainingBlock::Reflow(nsContainerFrame* aDelegatingFrame,
nsPresContext* aPresContext,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aReflowStatus,
const nsRect& aContainingBlock,
AbsPosReflowFlags aFlags,
@ -118,7 +118,7 @@ nsAbsoluteContainingBlock::Reflow(nsContainerFrame* aDelegatingFrame,
{
nsReflowStatus reflowStatus = NS_FRAME_COMPLETE;
const bool reflowAll = aReflowState.ShouldReflowAllKids();
const bool reflowAll = aReflowInput.ShouldReflowAllKids();
const bool isGrid = !!(aFlags & AbsPosReflowFlags::eIsGridContainerCB);
nsIFrame* kidFrame;
nsOverflowContinuationTracker tracker(aDelegatingFrame, true);
@ -132,7 +132,7 @@ nsAbsoluteContainingBlock::Reflow(nsContainerFrame* aDelegatingFrame,
nsReflowStatus kidStatus = NS_FRAME_COMPLETE;
const nsRect& cb = isGrid ? nsGridContainerFrame::GridItemCB(kidFrame)
: aContainingBlock;
ReflowAbsoluteFrame(aDelegatingFrame, aPresContext, aReflowState, cb,
ReflowAbsoluteFrame(aDelegatingFrame, aPresContext, aReflowInput, cb,
aFlags, kidFrame, kidStatus, aOverflowAreas);
nsIFrame* nextFrame = kidFrame->GetNextInFlow();
if (!NS_FRAME_IS_FULLY_COMPLETE(kidStatus) &&
@ -343,7 +343,7 @@ nsAbsoluteContainingBlock::DoMarkFramesDirty(bool aMarkAllDirty)
void
nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegatingFrame,
nsPresContext* aPresContext,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
const nsRect& aContainingBlock,
AbsPosReflowFlags aFlags,
nsIFrame* aKidFrame,
@ -360,11 +360,11 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
char width[16];
char height[16];
PrettyUC(aReflowState.AvailableWidth(), width, 16);
PrettyUC(aReflowState.AvailableHeight(), height, 16);
PrettyUC(aReflowInput.AvailableWidth(), width, 16);
PrettyUC(aReflowInput.AvailableHeight(), height, 16);
printf(" a=%s,%s ", width, height);
PrettyUC(aReflowState.ComputedWidth(), width, 16);
PrettyUC(aReflowState.ComputedHeight(), height, 16);
PrettyUC(aReflowInput.ComputedWidth(), width, 16);
PrettyUC(aReflowInput.ComputedHeight(), height, 16);
printf("c=%s,%s \n", width, height);
}
AutoNoisyIndenter indent(nsBlockFrame::gNoisy);
@ -374,11 +374,11 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
LogicalSize logicalCBSize(wm, aContainingBlock.Size());
nscoord availISize = logicalCBSize.ISize(wm);
if (availISize == -1) {
NS_ASSERTION(aReflowState.ComputedSize(wm).ISize(wm) !=
NS_ASSERTION(aReflowInput.ComputedSize(wm).ISize(wm) !=
NS_UNCONSTRAINEDSIZE,
"Must have a useful inline-size _somewhere_");
availISize =
aReflowState.ComputedSizeWithPadding(wm).ISize(wm);
aReflowInput.ComputedSizeWithPadding(wm).ISize(wm);
}
uint32_t rsFlags = 0;
@ -392,45 +392,45 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
rsFlags |= ReflowInput::STATIC_POS_IS_CB_ORIGIN;
}
}
ReflowInput kidReflowState(aPresContext, aReflowState, aKidFrame,
ReflowInput kidReflowInput(aPresContext, aReflowInput, aKidFrame,
LogicalSize(wm, availISize,
NS_UNCONSTRAINEDSIZE),
&logicalCBSize, rsFlags);
// Get the border values
WritingMode outerWM = aReflowState.GetWritingMode();
WritingMode outerWM = aReflowInput.GetWritingMode();
const LogicalMargin border(outerWM,
aReflowState.mStyleBorder->GetComputedBorder());
aReflowInput.mStyleBorder->GetComputedBorder());
const LogicalMargin margin =
kidReflowState.ComputedLogicalMargin().ConvertTo(outerWM, wm);
bool constrainBSize = (aReflowState.AvailableBSize() != NS_UNCONSTRAINEDSIZE)
kidReflowInput.ComputedLogicalMargin().ConvertTo(outerWM, wm);
bool constrainBSize = (aReflowInput.AvailableBSize() != NS_UNCONSTRAINEDSIZE)
&& (aFlags & AbsPosReflowFlags::eConstrainHeight)
// Don't split if told not to (e.g. for fixed frames)
&& (aDelegatingFrame->GetType() != nsGkAtoms::inlineFrame)
//XXX we don't handle splitting frames for inline absolute containing blocks yet
&& (aKidFrame->GetLogicalRect(aContainingBlock.Size()).BStart(wm) <=
aReflowState.AvailableBSize());
aReflowInput.AvailableBSize());
// Don't split things below the fold. (Ideally we shouldn't *have*
// anything totally below the fold, but we can't position frames
// across next-in-flow breaks yet.
if (constrainBSize) {
kidReflowState.AvailableBSize() =
aReflowState.AvailableBSize() - border.ConvertTo(wm, outerWM).BStart(wm) -
kidReflowState.ComputedLogicalMargin().BStart(wm);
if (NS_AUTOOFFSET != kidReflowState.ComputedLogicalOffsets().BStart(wm)) {
kidReflowState.AvailableBSize() -=
kidReflowState.ComputedLogicalOffsets().BStart(wm);
kidReflowInput.AvailableBSize() =
aReflowInput.AvailableBSize() - border.ConvertTo(wm, outerWM).BStart(wm) -
kidReflowInput.ComputedLogicalMargin().BStart(wm);
if (NS_AUTOOFFSET != kidReflowInput.ComputedLogicalOffsets().BStart(wm)) {
kidReflowInput.AvailableBSize() -=
kidReflowInput.ComputedLogicalOffsets().BStart(wm);
}
}
// Do the reflow
ReflowOutput kidDesiredSize(kidReflowState);
aKidFrame->Reflow(aPresContext, kidDesiredSize, kidReflowState, aStatus);
ReflowOutput kidDesiredSize(kidReflowInput);
aKidFrame->Reflow(aPresContext, kidDesiredSize, kidReflowInput, aStatus);
const LogicalSize kidSize = kidDesiredSize.Size(wm).ConvertTo(outerWM, wm);
LogicalMargin offsets =
kidReflowState.ComputedLogicalOffsets().ConvertTo(outerWM, wm);
kidReflowInput.ComputedLogicalOffsets().ConvertTo(outerWM, wm);
// If we're solving for start in either inline or block direction,
// then compute it now that we know the dimensions.
@ -439,8 +439,8 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
if (-1 == logicalCBSize.ISize(wm)) {
// Get the containing block width/height
logicalCBSize =
kidReflowState.ComputeContainingBlockRectangle(aPresContext,
&aReflowState);
kidReflowInput.ComputeContainingBlockRectangle(aPresContext,
&aReflowInput);
}
if (NS_AUTOOFFSET == offsets.IStart(outerWM)) {
@ -457,7 +457,7 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
offsets.BEnd(outerWM) - margin.BStartEnd(outerWM) -
kidSize.BSize(outerWM);
}
kidReflowState.SetComputedLogicalOffsets(offsets.ConvertTo(wm, outerWM));
kidReflowInput.SetComputedLogicalOffsets(offsets.ConvertTo(wm, outerWM));
}
// Position the child relative to our padding edge
@ -476,7 +476,7 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
// positioned based on its containing block and we don't need to offset
// (unless the caller demands it (the STATIC_POS_IS_CB_ORIGIN case)).
if (aContainingBlock.TopLeft() != nsPoint(0, 0)) {
const nsStyleSides& offsets = kidReflowState.mStylePosition->mOffset;
const nsStyleSides& offsets = kidReflowInput.mStylePosition->mOffset;
if (!(offsets.GetLeftUnit() == eStyleUnit_Auto &&
offsets.GetRightUnit() == eStyleUnit_Auto) ||
(rsFlags & ReflowInput::STATIC_POS_IS_CB_ORIGIN)) {
@ -501,7 +501,7 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
nsContainerFrame::PositionChildViews(aKidFrame);
}
aKidFrame->DidReflow(aPresContext, &kidReflowState,
aKidFrame->DidReflow(aPresContext, &kidReflowInput,
nsDidReflowStatus::FINISHED);
#ifdef DEBUG

Просмотреть файл

@ -96,7 +96,7 @@ public:
*/
void Reflow(nsContainerFrame* aDelegatingFrame,
nsPresContext* aPresContext,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aReflowStatus,
const nsRect& aContainingBlock,
AbsPosReflowFlags aFlags,
@ -129,7 +129,7 @@ protected:
void ReflowAbsoluteFrame(nsIFrame* aDelegatingFrame,
nsPresContext* aPresContext,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
const nsRect& aContainingBlockRect,
AbsPosReflowFlags aFlags,
nsIFrame* aKidFrame,

Просмотреть файл

@ -38,7 +38,7 @@ public:
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual void AddInlineMinISize(nsRenderingContext *aRenderingContext,
InlineMinISizeData *aData) override;
@ -81,13 +81,13 @@ BRFrame::~BRFrame()
void
BRFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aMetrics,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("BRFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aStatus);
WritingMode wm = aReflowState.GetWritingMode();
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aMetrics, aStatus);
WritingMode wm = aReflowInput.GetWritingMode();
LogicalSize finalSize(wm);
finalSize.BSize(wm) = 0; // BR frames with block size 0 are ignored in quirks
// mode by nsLineLayout::VerticalAlignFrames .
@ -101,7 +101,7 @@ BRFrame::Reflow(nsPresContext* aPresContext,
// on the *parent's* ShouldSuppressLineBreak() method, instead of our
// own, because we may have custom "display" value that makes our
// ShouldSuppressLineBreak() return false.
nsLineLayout* ll = aReflowState.mLineLayout;
nsLineLayout* ll = aReflowInput.mLineLayout;
if (ll && !GetParent()->StyleContext()->ShouldSuppressLineBreak()) {
// Note that the compatibility mode check excludes AlmostStandards
// mode, since this is the inline box model. See bug 161691.
@ -124,7 +124,7 @@ BRFrame::Reflow(nsPresContext* aPresContext,
RefPtr<nsFontMetrics> fm =
nsLayoutUtils::GetInflatedFontMetricsForFrame(this);
if (fm) {
nscoord logicalHeight = aReflowState.CalcLineHeight();
nscoord logicalHeight = aReflowInput.CalcLineHeight();
finalSize.BSize(wm) = logicalHeight;
aMetrics.SetBlockStartAscent(nsLayoutUtils::GetCenteredFontBaseline(
fm, logicalHeight, wm.IsLineInverted()));
@ -144,7 +144,7 @@ BRFrame::Reflow(nsPresContext* aPresContext,
}
// Return our reflow status
uint32_t breakType = aReflowState.mStyleDisplay->PhysicalBreakType(wm);
uint32_t breakType = aReflowInput.mStyleDisplay->PhysicalBreakType(wm);
if (NS_STYLE_CLEAR_NONE == breakType) {
breakType = NS_STYLE_CLEAR_LINE;
}
@ -162,7 +162,7 @@ BRFrame::Reflow(nsPresContext* aPresContext,
mAscent = aMetrics.BlockStartAscent();
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aMetrics);
}
/* virtual */ void

Просмотреть файл

@ -87,18 +87,18 @@ nsBackdropFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
/* virtual */ void
nsBackdropFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsBackdropFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
// Note that this frame is a child of the viewport frame.
WritingMode wm = aReflowState.GetWritingMode();
LogicalMargin borderPadding = aReflowState.ComputedLogicalBorderPadding();
nscoord isize = aReflowState.ComputedISize() + borderPadding.IStartEnd(wm);
nscoord bsize = aReflowState.ComputedBSize() + borderPadding.BStartEnd(wm);
WritingMode wm = aReflowInput.GetWritingMode();
LogicalMargin borderPadding = aReflowInput.ComputedLogicalBorderPadding();
nscoord isize = aReflowInput.ComputedISize() + borderPadding.IStartEnd(wm);
nscoord bsize = aReflowInput.ComputedBSize() + borderPadding.BStartEnd(wm);
aDesiredSize.SetSize(wm, LogicalSize(wm, isize, bsize));
aStatus = NS_FRAME_COMPLETE;
}

Просмотреть файл

@ -39,7 +39,7 @@ public:
bool aShrinkWrap) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
};

Просмотреть файл

@ -937,20 +937,20 @@ AvailableSpaceShrunk(WritingMode aWM,
static LogicalSize
CalculateContainingBlockSizeForAbsolutes(WritingMode aWM,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
LogicalSize aFrameSize)
{
// The issue here is that for a 'height' of 'auto' the reflow state
// code won't know how to calculate the containing block height
// because it's calculated bottom up. So we use our own computed
// size as the dimensions.
nsIFrame* frame = aReflowState.mFrame;
nsIFrame* frame = aReflowInput.mFrame;
LogicalSize cbSize(aFrameSize);
// Containing block is relative to the padding edge
const LogicalMargin& border =
LogicalMargin(aWM, aReflowState.ComputedPhysicalBorderPadding() -
aReflowState.ComputedPhysicalPadding());
LogicalMargin(aWM, aReflowInput.ComputedPhysicalBorderPadding() -
aReflowInput.ComputedPhysicalPadding());
cbSize.ISize(aWM) -= border.IStartEnd(aWM);
cbSize.BSize(aWM) -= border.BStartEnd(aWM);
@ -968,15 +968,15 @@ CalculateContainingBlockSizeForAbsolutes(WritingMode aWM,
// First, find the reflow state for the outermost frame for this
// content, except for fieldsets where the inner anonymous frame has
// the correct padding area with the legend taken into account.
const ReflowInput* aLastRS = &aReflowState;
const ReflowInput* lastButOneRS = &aReflowState;
while (aLastRS->mParentReflowState &&
aLastRS->mParentReflowState->mFrame->GetContent() == frame->GetContent() &&
aLastRS->mParentReflowState->mFrame->GetType() != nsGkAtoms::fieldSetFrame) {
const ReflowInput* aLastRS = &aReflowInput;
const ReflowInput* lastButOneRS = &aReflowInput;
while (aLastRS->mParentReflowInput &&
aLastRS->mParentReflowInput->mFrame->GetContent() == frame->GetContent() &&
aLastRS->mParentReflowInput->mFrame->GetType() != nsGkAtoms::fieldSetFrame) {
lastButOneRS = aLastRS;
aLastRS = aLastRS->mParentReflowState;
aLastRS = aLastRS->mParentReflowInput;
}
if (aLastRS != &aReflowState) {
if (aLastRS != &aReflowInput) {
// Scrollbars need to be specifically excluded, if present, because they are outside the
// padding-edge. We need better APIs for getting the various boxes from a frame.
nsIScrollableFrame* scrollFrame = do_QueryFrame(aLastRS->mFrame);
@ -1021,19 +1021,19 @@ CalculateContainingBlockSizeForAbsolutes(WritingMode aWM,
void
nsBlockFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aMetrics,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsBlockFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aMetrics, aStatus);
#ifdef DEBUG
if (gNoisyReflow) {
IndentBy(stdout, gNoiseIndent);
ListTag(stdout);
printf(": begin reflow availSize=%d,%d computedSize=%d,%d\n",
aReflowState.AvailableISize(), aReflowState.AvailableBSize(),
aReflowState.ComputedISize(), aReflowState.ComputedBSize());
aReflowInput.AvailableISize(), aReflowInput.AvailableBSize(),
aReflowInput.ComputedISize(), aReflowInput.ComputedBSize());
}
AutoNoisyIndenter indent(gNoisy);
PRTime start = 0; // Initialize these variablies to silence the compiler.
@ -1044,32 +1044,32 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
}
#endif
const ReflowInput *reflowState = &aReflowState;
WritingMode wm = aReflowState.GetWritingMode();
const ReflowInput *reflowInput = &aReflowInput;
WritingMode wm = aReflowInput.GetWritingMode();
nscoord consumedBSize = GetConsumedBSize();
nscoord effectiveComputedBSize = GetEffectiveComputedBSize(aReflowState,
nscoord effectiveComputedBSize = GetEffectiveComputedBSize(aReflowInput,
consumedBSize);
Maybe<ReflowInput> mutableReflowState;
Maybe<ReflowInput> mutableReflowInput;
// If we have non-auto block size, we're clipping our kids and we fit,
// make sure our kids fit too.
if (aReflowState.AvailableBSize() != NS_UNCONSTRAINEDSIZE &&
aReflowState.ComputedBSize() != NS_AUTOHEIGHT &&
ShouldApplyOverflowClipping(this, aReflowState.mStyleDisplay)) {
LogicalMargin blockDirExtras = aReflowState.ComputedLogicalBorderPadding();
if (aReflowInput.AvailableBSize() != NS_UNCONSTRAINEDSIZE &&
aReflowInput.ComputedBSize() != NS_AUTOHEIGHT &&
ShouldApplyOverflowClipping(this, aReflowInput.mStyleDisplay)) {
LogicalMargin blockDirExtras = aReflowInput.ComputedLogicalBorderPadding();
if (GetLogicalSkipSides().BStart()) {
blockDirExtras.BStart(wm) = 0;
} else {
// Block-end margin never causes us to create continuations, so we
// don't need to worry about whether it fits in its entirety.
blockDirExtras.BStart(wm) +=
aReflowState.ComputedLogicalMargin().BStart(wm);
aReflowInput.ComputedLogicalMargin().BStart(wm);
}
if (effectiveComputedBSize + blockDirExtras.BStartEnd(wm) <=
aReflowState.AvailableBSize()) {
mutableReflowState.emplace(aReflowState);
mutableReflowState->AvailableBSize() = NS_UNCONSTRAINEDSIZE;
reflowState = mutableReflowState.ptr();
aReflowInput.AvailableBSize()) {
mutableReflowInput.emplace(aReflowInput);
mutableReflowInput->AvailableBSize() = NS_UNCONSTRAINEDSIZE;
reflowInput = mutableReflowInput.ptr();
}
}
@ -1078,7 +1078,7 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
nsSize oldSize = GetSize();
// Should we create a float manager?
nsAutoFloatManager autoFloatManager(const_cast<ReflowInput&>(*reflowState));
nsAutoFloatManager autoFloatManager(const_cast<ReflowInput&>(*reflowInput));
// XXXldb If we start storing the float manager in the frame rather
// than keeping it around only during reflow then we should create it
@ -1094,7 +1094,7 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
// delete the line with the line cursor.
ClearLineCursor();
if (IsFrameTreeTooDeep(*reflowState, aMetrics, aStatus)) {
if (IsFrameTreeTooDeep(*reflowInput, aMetrics, aStatus)) {
return;
}
@ -1103,7 +1103,7 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
// Cache the consumed height in the block reflow state so that we don't have
// to continually recompute it.
BlockReflowInput state(*reflowState, aPresContext, this,
BlockReflowInput state(*reflowInput, aPresContext, this,
blockStartMarginRoot, blockEndMarginRoot,
needFloatManager, consumedBSize);
@ -1132,7 +1132,7 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
nsOverflowAreas ocBounds;
nsReflowStatus ocStatus = NS_FRAME_COMPLETE;
if (GetPrevInFlow()) {
ReflowOverflowContainerChildren(aPresContext, *reflowState, ocBounds, 0,
ReflowOverflowContainerChildren(aPresContext, *reflowInput, ocBounds, 0,
ocStatus);
}
@ -1150,16 +1150,16 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
// If we're not dirty (which means we'll mark everything dirty later)
// and our inline-size has changed, mark the lines dirty that we need to
// mark dirty for a resize reflow.
if (!(GetStateBits() & NS_FRAME_IS_DIRTY) && reflowState->IsIResize()) {
if (!(GetStateBits() & NS_FRAME_IS_DIRTY) && reflowInput->IsIResize()) {
PrepareResizeReflow(state);
}
// The same for percentage text-indent, except conditioned on the
// parent resizing.
if (!(GetStateBits() & NS_FRAME_IS_DIRTY) &&
reflowState->mCBReflowState &&
reflowState->mCBReflowState->IsIResize() &&
reflowState->mStyleText->mTextIndent.HasPercent() &&
reflowInput->mCBReflowInput &&
reflowInput->mCBReflowInput->IsIResize() &&
reflowInput->mStyleText->mTextIndent.HasPercent() &&
!mLines.empty()) {
mLines.front()->MarkDirty();
}
@ -1201,7 +1201,7 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
// If we end in a BR with clear and affected floats continue,
// we need to continue, too.
if (NS_UNCONSTRAINEDSIZE != reflowState->AvailableBSize() &&
if (NS_UNCONSTRAINEDSIZE != reflowInput->AvailableBSize() &&
NS_FRAME_IS_COMPLETE(state.mReflowStatus) &&
state.mFloatManager->ClearContinues(FindTrailingClear())) {
NS_FRAME_SET_INCOMPLETE(state.mReflowStatus);
@ -1235,15 +1235,15 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
mLines.front() != mLines.back() &&
mLines.begin().next()->IsBlock()))) {
// Reflow the bullet
ReflowOutput metrics(aReflowState);
ReflowOutput metrics(aReflowInput);
// XXX Use the entire line when we fix bug 25888.
nsLayoutUtils::LinePosition position;
WritingMode wm = aReflowState.GetWritingMode();
WritingMode wm = aReflowInput.GetWritingMode();
bool havePosition = nsLayoutUtils::GetFirstLinePosition(wm, this,
&position);
nscoord lineBStart = havePosition ?
position.mBStart :
reflowState->ComputedLogicalBorderPadding().BStart(wm);
reflowInput->ComputedLogicalBorderPadding().BStart(wm);
nsIFrame* bullet = GetOutsideBullet();
ReflowBullet(bullet, state, metrics, lineBStart);
NS_ASSERTION(!BulletIsEmpty() || metrics.BSize(wm) == 0,
@ -1268,7 +1268,7 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
// Compute our final size
nscoord blockEndEdgeOfChildren;
ComputeFinalSize(*reflowState, state, aMetrics, &blockEndEdgeOfChildren);
ComputeFinalSize(*reflowInput, state, aMetrics, &blockEndEdgeOfChildren);
// If the block direction is right-to-left, we need to update the bounds of
// lines that were placed relative to mContainerSize during reflow, as
@ -1305,7 +1305,7 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
}
nsRect areaBounds = nsRect(0, 0, aMetrics.Width(), aMetrics.Height());
ComputeOverflowAreas(areaBounds, reflowState->mStyleDisplay,
ComputeOverflowAreas(areaBounds, reflowInput->mStyleDisplay,
blockEndEdgeOfChildren, aMetrics.mOverflowAreas);
// Factor overflow container child bounds into the overflow area
aMetrics.mOverflowAreas.UnionWith(ocBounds);
@ -1333,7 +1333,7 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
if (HasAbsolutelyPositionedChildren()) {
nsAbsoluteContainingBlock* absoluteContainer = GetAbsoluteContainingBlock();
bool haveInterrupt = aPresContext->HasPendingInterrupt();
if (reflowState->WillReflowAgainForClearance() ||
if (reflowInput->WillReflowAgainForClearance() ||
haveInterrupt) {
// Make sure that when we reflow again we'll actually reflow all the abs
// pos frames that might conceivably depend on our size (or all of them,
@ -1348,7 +1348,7 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
}
} else {
LogicalSize containingBlockSize =
CalculateContainingBlockSizeForAbsolutes(parentWM, *reflowState,
CalculateContainingBlockSizeForAbsolutes(parentWM, *reflowInput,
aMetrics.Size(parentWM));
// Mark frames that depend on changes we just made to this frame as dirty:
@ -1367,7 +1367,7 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
// viewport height, which can't change during incremental
// reflow.
bool cbHeightChanged =
!(isRoot && NS_UNCONSTRAINEDSIZE == reflowState->ComputedHeight()) &&
!(isRoot && NS_UNCONSTRAINEDSIZE == reflowInput->ComputedHeight()) &&
aMetrics.Height() != oldSize.height;
nsRect containingBlock(nsPoint(0, 0),
@ -1384,7 +1384,7 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
// frames. The line cursor is immediately cleared afterward to
// avoid affecting the display list generation.
SetupLineCursor();
absoluteContainer->Reflow(this, aPresContext, *reflowState,
absoluteContainer->Reflow(this, aPresContext, *reflowInput,
state.mReflowStatus,
containingBlock, flags,
&aMetrics.mOverflowAreas);
@ -1452,7 +1452,7 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
}
#endif
NS_FRAME_SET_TRUNCATION(aStatus, (*reflowState), aMetrics);
NS_FRAME_SET_TRUNCATION(aStatus, (*reflowInput), aMetrics);
}
bool
@ -1477,12 +1477,12 @@ nsBlockFrame::CheckForCollapsedBEndMarginFromClearanceLine()
}
void
nsBlockFrame::ComputeFinalSize(const ReflowInput& aReflowState,
nsBlockFrame::ComputeFinalSize(const ReflowInput& aReflowInput,
BlockReflowInput& aState,
ReflowOutput& aMetrics,
nscoord* aBEndEdgeOfChildren)
{
WritingMode wm = aState.mReflowState.GetWritingMode();
WritingMode wm = aState.mReflowInput.GetWritingMode();
const LogicalMargin& borderPadding = aState.BorderPadding();
#ifdef NOISY_FINAL_SIZE
ListTag(stdout);
@ -1496,7 +1496,7 @@ nsBlockFrame::ComputeFinalSize(const ReflowInput& aReflowState,
LogicalSize finalSize(wm);
finalSize.ISize(wm) =
NSCoordSaturatingAdd(NSCoordSaturatingAdd(borderPadding.IStart(wm),
aReflowState.ComputedISize()),
aReflowInput.ComputedISize()),
borderPadding.IEnd(wm));
// Return block-end margin information
@ -1525,19 +1525,19 @@ nsBlockFrame::ComputeFinalSize(const ReflowInput& aReflowState,
nscoord blockEndEdgeOfChildren = aState.mBCoord + nonCarriedOutBDirMargin;
// Shrink wrap our height around our contents.
if (aState.GetFlag(BRS_ISBENDMARGINROOT) ||
NS_UNCONSTRAINEDSIZE != aReflowState.ComputedBSize()) {
NS_UNCONSTRAINEDSIZE != aReflowInput.ComputedBSize()) {
// When we are a block-end-margin root make sure that our last
// childs block-end margin is fully applied. We also do this when
// we have a computed height, since in that case the carried out
// margin is not going to be applied anywhere, so we should note it
// here to be included in the overflow area.
// Apply the margin only if there's space for it.
if (blockEndEdgeOfChildren < aState.mReflowState.AvailableBSize())
if (blockEndEdgeOfChildren < aState.mReflowInput.AvailableBSize())
{
// Truncate block-end margin if it doesn't fit to our available BSize.
blockEndEdgeOfChildren =
std::min(blockEndEdgeOfChildren + aState.mPrevBEndMargin.get(),
aState.mReflowState.AvailableBSize());
aState.mReflowInput.AvailableBSize());
}
}
if (aState.GetFlag(BRS_FLOAT_MGR)) {
@ -1549,10 +1549,10 @@ nsBlockFrame::ComputeFinalSize(const ReflowInput& aReflowState,
blockEndEdgeOfChildren = std::max(blockEndEdgeOfChildren, floatHeight);
}
if (NS_UNCONSTRAINEDSIZE != aReflowState.ComputedBSize()
if (NS_UNCONSTRAINEDSIZE != aReflowInput.ComputedBSize()
&& (GetParent()->GetType() != nsGkAtoms::columnSetFrame ||
aReflowState.mParentReflowState->AvailableBSize() == NS_UNCONSTRAINEDSIZE)) {
ComputeFinalBSize(aReflowState, &aState.mReflowStatus,
aReflowInput.mParentReflowInput->AvailableBSize() == NS_UNCONSTRAINEDSIZE)) {
ComputeFinalBSize(aReflowInput, &aState.mReflowStatus,
aState.mBCoord + nonCarriedOutBDirMargin,
borderPadding, finalSize, aState.mConsumedBSize);
if (!NS_FRAME_IS_COMPLETE(aState.mReflowStatus)) {
@ -1560,11 +1560,11 @@ nsBlockFrame::ComputeFinalSize(const ReflowInput& aReflowState,
// Do extend the height to at least consume the available
// height, otherwise our left/right borders (for example) won't
// extend all the way to the break.
finalSize.BSize(wm) = std::max(aReflowState.AvailableBSize(),
finalSize.BSize(wm) = std::max(aReflowInput.AvailableBSize(),
aState.mBCoord + nonCarriedOutBDirMargin);
// ... but don't take up more block size than is available
nscoord effectiveComputedBSize =
GetEffectiveComputedBSize(aReflowState, aState.GetConsumedBSize());
GetEffectiveComputedBSize(aReflowInput, aState.GetConsumedBSize());
finalSize.BSize(wm) =
std::min(finalSize.BSize(wm),
borderPadding.BStart(wm) + effectiveComputedBSize);
@ -1579,7 +1579,7 @@ nsBlockFrame::ComputeFinalSize(const ReflowInput& aReflowState,
}
else if (NS_FRAME_IS_COMPLETE(aState.mReflowStatus)) {
nscoord contentBSize = blockEndEdgeOfChildren - borderPadding.BStart(wm);
nscoord autoBSize = aReflowState.ApplyMinMaxBSize(contentBSize);
nscoord autoBSize = aReflowInput.ApplyMinMaxBSize(contentBSize);
if (autoBSize != contentBSize) {
// Our min- or max-bsize value made our bsize change. Don't carry out
// our kids' block-end margins.
@ -1589,11 +1589,11 @@ nsBlockFrame::ComputeFinalSize(const ReflowInput& aReflowState,
finalSize.BSize(wm) = autoBSize;
}
else {
NS_ASSERTION(aReflowState.AvailableBSize() != NS_UNCONSTRAINEDSIZE,
NS_ASSERTION(aReflowInput.AvailableBSize() != NS_UNCONSTRAINEDSIZE,
"Shouldn't be incomplete if availableBSize is UNCONSTRAINED.");
finalSize.BSize(wm) = std::max(aState.mBCoord,
aReflowState.AvailableBSize());
if (aReflowState.AvailableBSize() == NS_UNCONSTRAINEDSIZE) {
aReflowInput.AvailableBSize());
if (aReflowInput.AvailableBSize() == NS_UNCONSTRAINEDSIZE) {
// This should never happen, but it does. See bug 414255
finalSize.BSize(wm) = aState.mBCoord;
}
@ -1607,7 +1607,7 @@ nsBlockFrame::ComputeFinalSize(const ReflowInput& aReflowState,
"overflow containers must be zero-block-size");
NS_FRAME_SET_OVERFLOW_INCOMPLETE(aState.mReflowStatus);
}
} else if (aReflowState.AvailableBSize() != NS_UNCONSTRAINEDSIZE &&
} else if (aReflowInput.AvailableBSize() != NS_UNCONSTRAINEDSIZE &&
!NS_INLINE_IS_BREAK_BEFORE(aState.mReflowStatus) &&
NS_FRAME_IS_COMPLETE(aState.mReflowStatus)) {
// Currently only used for grid items, but could be used in other contexts.
@ -1866,18 +1866,18 @@ nsBlockFrame::PrepareResizeReflow(BlockReflowInput& aState)
IndentBy(stdout, gNoiseIndent);
ListTag(stdout);
printf(": marking all lines dirty: availISize=%d\n",
aState.mReflowState.AvailableISize());
aState.mReflowInput.AvailableISize());
}
}
#endif
if (tryAndSkipLines) {
WritingMode wm = aState.mReflowState.GetWritingMode();
WritingMode wm = aState.mReflowInput.GetWritingMode();
nscoord newAvailISize =
aState.mReflowState.ComputedLogicalBorderPadding().IStart(wm) +
aState.mReflowState.ComputedISize();
NS_ASSERTION(NS_UNCONSTRAINEDSIZE != aState.mReflowState.ComputedLogicalBorderPadding().IStart(wm) &&
NS_UNCONSTRAINEDSIZE != aState.mReflowState.ComputedISize(),
aState.mReflowInput.ComputedLogicalBorderPadding().IStart(wm) +
aState.mReflowInput.ComputedISize();
NS_ASSERTION(NS_UNCONSTRAINEDSIZE != aState.mReflowInput.ComputedLogicalBorderPadding().IStart(wm) &&
NS_UNCONSTRAINEDSIZE != aState.mReflowInput.ComputedISize(),
"math on NS_UNCONSTRAINEDSIZE");
#ifdef DEBUG
@ -1956,10 +1956,10 @@ nsBlockFrame::PropagateFloatDamage(BlockReflowInput& aState,
nsLineBox* aLine,
nscoord aDeltaBCoord)
{
nsFloatManager *floatManager = aState.mReflowState.mFloatManager;
NS_ASSERTION((aState.mReflowState.mParentReflowState &&
aState.mReflowState.mParentReflowState->mFloatManager == floatManager) ||
aState.mReflowState.mBlockDelta == 0, "Bad block delta passed in");
nsFloatManager *floatManager = aState.mReflowInput.mFloatManager;
NS_ASSERTION((aState.mReflowInput.mParentReflowInput &&
aState.mReflowInput.mParentReflowInput->mFloatManager == floatManager) ||
aState.mReflowInput.mBlockDelta == 0, "Bad block delta passed in");
// Check to see if there are any floats; if there aren't, there can't
// be any float damage
@ -1974,7 +1974,7 @@ nsBlockFrame::PropagateFloatDamage(BlockReflowInput& aState,
nscoord lineBCoordAfter = lineBCoordBefore + aLine->BSize();
// Scrollable overflow should be sufficient for things that affect
// layout.
WritingMode wm = aState.mReflowState.GetWritingMode();
WritingMode wm = aState.mReflowInput.GetWritingMode();
nsSize containerSize = aState.ContainerSize();
LogicalRect overflow = aLine->GetOverflowArea(eScrollableOverflow, wm,
containerSize);
@ -1993,7 +1993,7 @@ nsBlockFrame::PropagateFloatDamage(BlockReflowInput& aState,
}
// Check if the line is moving relative to the float manager
if (aDeltaBCoord + aState.mReflowState.mBlockDelta != 0) {
if (aDeltaBCoord + aState.mReflowInput.mBlockDelta != 0) {
if (aLine->IsBlock()) {
// Unconditionally reflow sliding blocks; we only really need to reflow
// if there's a float impacting this block, but the current float manager
@ -2083,20 +2083,20 @@ nsBlockFrame::ReflowDirtyLines(BlockReflowInput& aState)
IndentBy(stdout, gNoiseIndent);
ListTag(stdout);
printf(": reflowing dirty lines");
printf(" computedISize=%d\n", aState.mReflowState.ComputedISize());
printf(" computedISize=%d\n", aState.mReflowInput.ComputedISize());
}
AutoNoisyIndenter indent(gNoisyReflow);
#endif
bool selfDirty = (GetStateBits() & NS_FRAME_IS_DIRTY) ||
(aState.mReflowState.IsBResize() &&
(aState.mReflowInput.IsBResize() &&
(GetStateBits() & NS_FRAME_CONTAINS_RELATIVE_BSIZE));
// Reflow our last line if our availableBSize has increased
// so that we (and our last child) pull up content as necessary
if (aState.mReflowState.AvailableBSize() != NS_UNCONSTRAINEDSIZE
&& GetNextInFlow() && aState.mReflowState.AvailableBSize() >
GetLogicalSize().BSize(aState.mReflowState.GetWritingMode())) {
if (aState.mReflowInput.AvailableBSize() != NS_UNCONSTRAINEDSIZE
&& GetNextInFlow() && aState.mReflowInput.AvailableBSize() >
GetLogicalSize().BSize(aState.mReflowInput.GetWritingMode())) {
line_iterator lastLine = end_lines();
if (lastLine != begin_lines()) {
--lastLine;
@ -2207,9 +2207,9 @@ nsBlockFrame::ReflowDirtyLines(BlockReflowInput& aState)
// FIXME: What about a deltaBCoord or block-size change that forces us to
// push lines? Why does that work?
if (!line->IsDirty() &&
aState.mReflowState.AvailableBSize() != NS_UNCONSTRAINEDSIZE &&
(deltaBCoord != 0 || aState.mReflowState.IsBResize() ||
aState.mReflowState.mFlags.mMustReflowPlaceholders) &&
aState.mReflowInput.AvailableBSize() != NS_UNCONSTRAINEDSIZE &&
(deltaBCoord != 0 || aState.mReflowInput.IsBResize() ||
aState.mReflowInput.mFlags.mMustReflowPlaceholders) &&
(line->IsBlock() || line->HasFloats() || line->HadFloatPushed())) {
line->MarkDirty();
}
@ -2235,7 +2235,7 @@ nsBlockFrame::ReflowDirtyLines(BlockReflowInput& aState)
if (line->mWritingMode.IsVertical() ||
!line->mWritingMode.IsBidiLTR() ||
!IsAlignedLeft(align,
aState.mReflowState.mStyleVisibility->mDirection,
aState.mReflowInput.mStyleVisibility->mDirection,
StyleTextReset()->mUnicodeBidi, this)) {
line->MarkDirty();
}
@ -2269,7 +2269,7 @@ nsBlockFrame::ReflowDirtyLines(BlockReflowInput& aState)
// dangling frame pointers! Ugh! This reflow of the line may be
// incorrect because we skipped reflowing previous lines (e.g., floats
// may be placed incorrectly), but that's OK because we'll mark the
// line dirty below under "if (aState.mReflowState.mDiscoveredClearance..."
// line dirty below under "if (aState.mReflowInput.mDiscoveredClearance..."
if (line->IsDirty() && (line->HasFloats() || !willReflowAgain)) {
lastLineMovedUp = true;
@ -2290,7 +2290,7 @@ nsBlockFrame::ReflowDirtyLines(BlockReflowInput& aState)
// it to invalidate the dirty area if necessary
ReflowLine(aState, line, &keepGoing);
if (aState.mReflowState.WillReflowAgainForClearance()) {
if (aState.mReflowInput.WillReflowAgainForClearance()) {
line->MarkDirty();
willReflowAgain = true;
// Note that once we've entered this state, every line that gets here
@ -2470,10 +2470,10 @@ nsBlockFrame::ReflowDirtyLines(BlockReflowInput& aState)
// -- my chain of next-in-flows either has no first line, or its first
// line isn't dirty.
bool heightConstrained =
aState.mReflowState.AvailableBSize() != NS_UNCONSTRAINEDSIZE;
aState.mReflowInput.AvailableBSize() != NS_UNCONSTRAINEDSIZE;
bool skipPull = willReflowAgain && heightConstrained;
if (!skipPull && heightConstrained && aState.mNextInFlow &&
(aState.mReflowState.mFlags.mNextInFlowUntouched &&
(aState.mReflowInput.mFlags.mNextInFlowUntouched &&
!lastLineMovedUp &&
!(GetStateBits() & NS_FRAME_IS_DIRTY) &&
!reflowedFloat)) {
@ -2575,7 +2575,7 @@ nsBlockFrame::ReflowDirtyLines(BlockReflowInput& aState)
while (line != end_lines()) {
ReflowLine(aState, line, &keepGoing);
if (aState.mReflowState.WillReflowAgainForClearance()) {
if (aState.mReflowInput.WillReflowAgainForClearance()) {
line->MarkDirty();
keepGoing = false;
NS_FRAME_SET_INCOMPLETE(aState.mReflowStatus);
@ -2613,11 +2613,11 @@ nsBlockFrame::ReflowDirtyLines(BlockReflowInput& aState)
// Handle an odd-ball case: a list-item with no lines
if (HasOutsideBullet() && mLines.empty()) {
ReflowOutput metrics(aState.mReflowState);
ReflowOutput metrics(aState.mReflowInput);
nsIFrame* bullet = GetOutsideBullet();
WritingMode wm = aState.mReflowState.GetWritingMode();
WritingMode wm = aState.mReflowInput.GetWritingMode();
ReflowBullet(bullet, aState, metrics,
aState.mReflowState.ComputedPhysicalBorderPadding().top);
aState.mReflowInput.ComputedPhysicalBorderPadding().top);
NS_ASSERTION(!BulletIsEmpty() || metrics.BSize(wm) == 0,
"empty bullet took up space");
@ -2627,7 +2627,7 @@ nsBlockFrame::ReflowDirtyLines(BlockReflowInput& aState)
if (metrics.BlockStartAscent() == ReflowOutput::ASK_FOR_BASELINE) {
nscoord ascent;
WritingMode wm = aState.mReflowState.GetWritingMode();
WritingMode wm = aState.mReflowInput.GetWritingMode();
if (nsLayoutUtils::GetFirstLineBaseline(wm, bullet, &ascent)) {
metrics.SetBlockStartAscent(ascent);
} else {
@ -3129,10 +3129,10 @@ nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
// Prepare the block reflow engine
const nsStyleDisplay* display = frame->StyleDisplay();
nsBlockReflowContext brc(aState.mPresContext, aState.mReflowState);
nsBlockReflowContext brc(aState.mPresContext, aState.mReflowInput);
uint8_t breakType =
display->PhysicalBreakType(aState.mReflowState.GetWritingMode());
display->PhysicalBreakType(aState.mReflowInput.GetWritingMode());
if (NS_STYLE_CLEAR_NONE != aState.mFloatBreakType) {
breakType = nsLayoutUtils::CombineBreakType(breakType,
aState.mFloatBreakType);
@ -3171,13 +3171,13 @@ nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
// frame DID NOT need clearance, then we need to check that
// assumption.
if (!treatWithClearance && !applyBStartMargin && mightClearFloats &&
aState.mReflowState.mDiscoveredClearance) {
aState.mReflowInput.mDiscoveredClearance) {
nscoord curBCoord = aState.mBCoord + aState.mPrevBEndMargin.get();
nscoord clearBCoord = aState.ClearFloats(curBCoord, breakType, replacedBlock);
if (clearBCoord != curBCoord) {
// Only record the first frame that requires clearance
if (!*aState.mReflowState.mDiscoveredClearance) {
*aState.mReflowState.mDiscoveredClearance = frame;
if (!*aState.mReflowInput.mDiscoveredClearance) {
*aState.mReflowInput.mDiscoveredClearance = frame;
}
aState.mPrevChild = frame;
// Exactly what we do now is flexible since we'll definitely be
@ -3206,7 +3206,7 @@ nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
// correct available space (there might be a float that's
// already been placed below the aState.mPrevBEndMargin
// Setup a reflowState to get the style computed block-start margin
// Setup a reflowInput to get the style computed block-start margin
// value. We'll use a reason of `resize' so that we don't fudge
// any incremental reflow state.
@ -3217,7 +3217,7 @@ nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
// margin seems like a waste. And we do this for almost every block!
WritingMode wm = frame->GetWritingMode();
LogicalSize availSpace = aState.ContentSize(wm);
ReflowInput reflowState(aState.mPresContext, aState.mReflowState,
ReflowInput reflowInput(aState.mPresContext, aState.mReflowInput,
frame, availSpace);
if (treatWithClearance) {
@ -3228,7 +3228,7 @@ nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
// Now compute the collapsed margin-block-start value into
// aState.mPrevBEndMargin, assuming that all child margins
// collapse down to clearanceFrame.
brc.ComputeCollapsedBStartMargin(reflowState,
brc.ComputeCollapsedBStartMargin(reflowInput,
&aState.mPrevBEndMargin,
clearanceFrame,
&mayNeedRetry);
@ -3264,7 +3264,7 @@ nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
// Compute the collapsed margin again, ignoring the incoming margin this time
mayNeedRetry = false;
brc.ComputeCollapsedBStartMargin(reflowState,
brc.ComputeCollapsedBStartMargin(reflowInput,
&aState.mPrevBEndMargin,
clearanceFrame,
&mayNeedRetry);
@ -3311,17 +3311,17 @@ nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
// Here aState.mBCoord is the block-start border-edge of the block.
// Compute the available space for the block
nsFlowAreaRect floatAvailableSpace = aState.GetFloatAvailableSpace();
WritingMode wm = aState.mReflowState.GetWritingMode();
WritingMode wm = aState.mReflowInput.GetWritingMode();
LogicalRect availSpace(wm);
aState.ComputeBlockAvailSpace(frame, display, floatAvailableSpace,
replacedBlock != nullptr, availSpace);
// The check for
// (!aState.mReflowState.mFlags.mIsTopOfPage || clearedFloats)
// (!aState.mReflowInput.mFlags.mIsTopOfPage || clearedFloats)
// is to some degree out of paranoia: if we reliably eat up block-start
// margins at the top of the page as we ought to, it wouldn't be
// needed.
if ((!aState.mReflowState.mFlags.mIsTopOfPage || clearedFloats) &&
if ((!aState.mReflowInput.mFlags.mIsTopOfPage || clearedFloats) &&
availSpace.BSize(wm) < 0) {
// We know already that this child block won't fit on this
// page/column due to the block-start margin or the clearance. So we
@ -3336,7 +3336,7 @@ nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
aState.mBCoord = startingBCoord;
aState.mPrevBEndMargin = incomingMargin;
*aKeepReflowGoing = false;
if (ShouldAvoidBreakInside(aState.mReflowState)) {
if (ShouldAvoidBreakInside(aState.mReflowInput)) {
aState.mReflowStatus = NS_INLINE_LINE_BREAK_BEFORE();
} else {
PushLines(aState, aLine.prev());
@ -3357,7 +3357,7 @@ nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
// will initialize it.
Maybe<ReflowInput> blockHtmlRS;
blockHtmlRS.emplace(
aState.mPresContext, aState.mReflowState, frame,
aState.mPresContext, aState.mReflowInput, frame,
availSpace.Size(wm).ConvertTo(frame->GetWritingMode(), wm));
nsFloatManager::SavedState floatManagerState;
@ -3374,8 +3374,8 @@ nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
// brc.ReflowBlock() below does, so we need to remember now
// whether it's empty.
const bool shouldStoreClearance =
aState.mReflowState.mDiscoveredClearance &&
!*aState.mReflowState.mDiscoveredClearance;
aState.mReflowInput.mDiscoveredClearance &&
!*aState.mReflowInput.mDiscoveredClearance;
// Reflow the block into the available space
if (mayNeedRetry || replacedBlock) {
@ -3386,7 +3386,7 @@ nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
blockHtmlRS->mDiscoveredClearance = &clearanceFrame;
} else if (!applyBStartMargin) {
blockHtmlRS->mDiscoveredClearance =
aState.mReflowState.mDiscoveredClearance;
aState.mReflowInput.mDiscoveredClearance;
}
frameReflowStatus = NS_FRAME_COMPLETE;
@ -3457,11 +3457,11 @@ nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
aState.mFloatManager->PopState(&floatManagerState);
if (!treatWithClearance && !applyBStartMargin &&
aState.mReflowState.mDiscoveredClearance) {
aState.mReflowInput.mDiscoveredClearance) {
// We set shouldStoreClearance above to record only the first
// frame that requires clearance.
if (shouldStoreClearance) {
*aState.mReflowState.mDiscoveredClearance = frame;
*aState.mReflowInput.mDiscoveredClearance = frame;
}
aState.mPrevChild = frame;
// Exactly what we do now is flexible since we'll definitely be
@ -3481,7 +3481,7 @@ nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
blockHtmlRS.reset();
blockHtmlRS.emplace(
aState.mPresContext, aState.mReflowState, frame,
aState.mPresContext, aState.mReflowInput, frame,
availSpace.Size(wm).ConvertTo(frame->GetWritingMode(), wm));
} while (true);
@ -3512,7 +3512,7 @@ nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
if (NS_INLINE_IS_BREAK_BEFORE(frameReflowStatus)) {
// None of the child block fits.
*aKeepReflowGoing = false;
if (ShouldAvoidBreakInside(aState.mReflowState)) {
if (ShouldAvoidBreakInside(aState.mReflowInput)) {
aState.mReflowStatus = NS_INLINE_LINE_BREAK_BEFORE();
} else {
PushLines(aState, aLine.prev());
@ -3537,7 +3537,7 @@ nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
overflowAreas,
frameReflowStatus);
if (!NS_FRAME_IS_FULLY_COMPLETE(frameReflowStatus) &&
ShouldAvoidBreakInside(aState.mReflowState)) {
ShouldAvoidBreakInside(aState.mReflowInput)) {
*aKeepReflowGoing = false;
}
@ -3683,7 +3683,7 @@ nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
#endif
} else {
if ((aLine == mLines.front() && !GetPrevInFlow()) ||
ShouldAvoidBreakInside(aState.mReflowState)) {
ShouldAvoidBreakInside(aState.mReflowInput)) {
// If it's our very first line *or* we're not at the top of the page
// and we have page-break-inside:avoid, then we need to be pushed to
// our parent's next-in-flow.
@ -3738,7 +3738,7 @@ nsBlockFrame::ReflowInlineFrames(BlockReflowInput& aState,
gfxBreakPriority forceBreakPriority = gfxBreakPriority::eNoBreak;
do {
nsFloatManager::SavedState floatManagerState;
aState.mReflowState.mFloatManager->PushState(&floatManagerState);
aState.mReflowInput.mFloatManager->PushState(&floatManagerState);
// Once upon a time we allocated the first 30 nsLineLayout objects
// on the stack, and then we switched to the heap. At that time
@ -3748,8 +3748,8 @@ nsBlockFrame::ReflowInlineFrames(BlockReflowInput& aState,
// smaller, the complexity of 2 different ways of allocating
// no longer makes sense. Now we always allocate on the stack.
nsLineLayout lineLayout(aState.mPresContext,
aState.mReflowState.mFloatManager,
&aState.mReflowState, &aLine, nullptr);
aState.mReflowInput.mFloatManager,
&aState.mReflowInput, &aLine, nullptr);
lineLayout.Init(&aState, aState.mMinLineHeight, aState.mLineNumber);
if (forceBreakInFrame) {
lineLayout.ForceBreakAtPosition(forceBreakInFrame, forceBreakOffset);
@ -3774,7 +3774,7 @@ nsBlockFrame::ReflowInlineFrames(BlockReflowInput& aState,
forceBreakInFrame = nullptr;
}
// restore the float manager state
aState.mReflowState.mFloatManager->PopState(&floatManagerState);
aState.mReflowInput.mFloatManager->PopState(&floatManagerState);
// Clear out float lists
aState.mCurrentLineFloats.DeleteAll();
aState.mBelowCurrentLineFloats.DeleteAll();
@ -3830,7 +3830,7 @@ nsBlockFrame::DoReflowInlineFrames(BlockReflowInput& aState,
this, aFloatAvailableSpace.mHasFloats);
#endif
WritingMode outerWM = aState.mReflowState.GetWritingMode();
WritingMode outerWM = aState.mReflowInput.GetWritingMode();
WritingMode lineWM = GetWritingMode(aLine->mFirstChild);
LogicalRect lineRect =
aFloatAvailableSpace.mRect.ConvertTo(lineWM, outerWM,
@ -3985,9 +3985,9 @@ nsBlockFrame::DoReflowInlineFrames(BlockReflowInput& aState,
aState.mBCoord += aFloatAvailableSpace.mRect.BSize(outerWM);
aFloatAvailableSpace = aState.GetFloatAvailableSpace();
} else {
NS_ASSERTION(NS_UNCONSTRAINEDSIZE != aState.mReflowState.AvailableBSize(),
NS_ASSERTION(NS_UNCONSTRAINEDSIZE != aState.mReflowInput.AvailableBSize(),
"We shouldn't be running out of height here");
if (NS_UNCONSTRAINEDSIZE == aState.mReflowState.AvailableBSize()) {
if (NS_UNCONSTRAINEDSIZE == aState.mReflowInput.AvailableBSize()) {
// just move it down a bit to try to get out of this mess
aState.mBCoord += 1;
// We should never hit this case if we've placed floats on the
@ -4254,7 +4254,7 @@ nsBlockFrame::SplitFloat(BlockReflowInput& aState,
}
uint8_t floatStyle =
aFloat->StyleDisplay()->PhysicalFloats(aState.mReflowState.GetWritingMode());
aFloat->StyleDisplay()->PhysicalFloats(aState.mReflowInput.GetWritingMode());
if (floatStyle == NS_STYLE_FLOAT_LEFT) {
aState.mFloatManager->SetSplitLeftFloatAcrossBreak();
} else {
@ -4424,7 +4424,7 @@ nsBlockFrame::PlaceLine(BlockReflowInput& aState,
// There are exactly two places a bullet can be placed: near the
// first or second line. It's only placed on the second line in a
// rare case: when the first line is empty.
WritingMode wm = aState.mReflowState.GetWritingMode();
WritingMode wm = aState.mReflowInput.GetWritingMode();
bool addedBullet = false;
if (HasOutsideBullet() &&
((aLine == mLines.front() &&
@ -4432,7 +4432,7 @@ nsBlockFrame::PlaceLine(BlockReflowInput& aState,
(mLines.front() != mLines.back() &&
0 == mLines.front()->BSize() &&
aLine == mLines.begin().next()))) {
ReflowOutput metrics(aState.mReflowState);
ReflowOutput metrics(aState.mReflowInput);
nsIFrame* bullet = GetOutsideBullet();
ReflowBullet(bullet, aState, metrics, aState.mBCoord);
NS_ASSERTION(!BulletIsEmpty() || metrics.BSize(wm) == 0,
@ -4543,7 +4543,7 @@ nsBlockFrame::PlaceLine(BlockReflowInput& aState,
}
if (!NS_FRAME_IS_FULLY_COMPLETE(aState.mReflowStatus) &&
ShouldAvoidBreakInside(aState.mReflowState)) {
ShouldAvoidBreakInside(aState.mReflowInput)) {
aLine->AppendFloats(aState.mCurrentLineFloats);
aState.mReflowStatus = NS_INLINE_LINE_BREAK_BEFORE();
return true;
@ -4554,7 +4554,7 @@ nsBlockFrame::PlaceLine(BlockReflowInput& aState,
newBCoord > aState.mBEndEdge &&
aState.mBEndEdge != NS_UNCONSTRAINEDSIZE) {
NS_ASSERTION(aState.mCurrentLine == aLine, "oops");
if (ShouldAvoidBreakInside(aState.mReflowState)) {
if (ShouldAvoidBreakInside(aState.mReflowInput)) {
// All our content doesn't fit, start on the next page.
aState.mReflowStatus = NS_INLINE_LINE_BREAK_BEFORE();
} else {
@ -6051,7 +6051,7 @@ nsBlockFrame::AdjustFloatAvailableSpace(BlockReflowInput& aState,
// size of the containing block.
nscoord availISize;
const nsStyleDisplay* floatDisplay = aFloatFrame->StyleDisplay();
WritingMode wm = aState.mReflowState.GetWritingMode();
WritingMode wm = aState.mReflowInput.GetWritingMode();
if (NS_STYLE_DISPLAY_TABLE != floatDisplay->mDisplay ||
eCompatibility_NavQuirks != aState.mPresContext->CompatibilityMode() ) {
@ -6095,10 +6095,10 @@ nsBlockFrame::ComputeFloatISize(BlockReflowInput& aState,
aFloatAvailableSpace,
aFloat);
WritingMode blockWM = aState.mReflowState.GetWritingMode();
WritingMode blockWM = aState.mReflowInput.GetWritingMode();
WritingMode floatWM = aFloat->GetWritingMode();
ReflowInput
floatRS(aState.mPresContext, aState.mReflowState, aFloat,
floatRS(aState.mPresContext, aState.mReflowInput, aFloat,
availSpace.Size(blockWM).ConvertTo(floatWM, blockWM));
return floatRS.ComputedSizeWithMarginBorderPadding(blockWM).ISize(blockWM);
@ -6118,7 +6118,7 @@ nsBlockFrame::ReflowFloat(BlockReflowInput& aState,
// Reflow the float.
aReflowStatus = NS_FRAME_COMPLETE;
WritingMode wm = aState.mReflowState.GetWritingMode();
WritingMode wm = aState.mReflowInput.GetWritingMode();
#ifdef NOISY_FLOAT
printf("Reflow Float %p in parent %p, availSpace(%d,%d,%d,%d)\n",
aFloat, this,
@ -6128,7 +6128,7 @@ nsBlockFrame::ReflowFloat(BlockReflowInput& aState,
#endif
ReflowInput
floatRS(aState.mPresContext, aState.mReflowState, aFloat,
floatRS(aState.mPresContext, aState.mReflowInput, aFloat,
aAdjustedAvailableSpace.Size(wm).ConvertTo(aFloat->GetWritingMode(),
wm));
@ -6147,7 +6147,7 @@ nsBlockFrame::ReflowFloat(BlockReflowInput& aState,
}
// Setup a block reflow context to reflow the float.
nsBlockReflowContext brc(aState.mPresContext, aState.mReflowState);
nsBlockReflowContext brc(aState.mPresContext, aState.mReflowInput);
// Reflow the float
bool isAdjacentWithTop = aState.IsAdjacentWithTop();
@ -7177,7 +7177,7 @@ nsBlockFrame::ReflowBullet(nsIFrame* aBulletFrame,
ReflowOutput& aMetrics,
nscoord aLineTop)
{
const ReflowInput &rs = aState.mReflowState;
const ReflowInput &rs = aState.mReflowInput;
// Reflow the bullet now
WritingMode bulletWM = aBulletFrame->GetWritingMode();
@ -7189,10 +7189,10 @@ nsBlockFrame::ReflowBullet(nsIFrame* aBulletFrame,
// Get the reason right.
// XXXwaterson Should this look just like the logic in
// nsBlockReflowContext::ReflowBlock and nsLineLayout::ReflowFrame?
ReflowInput reflowState(aState.mPresContext, rs,
ReflowInput reflowInput(aState.mPresContext, rs,
aBulletFrame, availSize);
nsReflowStatus status;
aBulletFrame->Reflow(aState.mPresContext, aMetrics, reflowState, status);
aBulletFrame->Reflow(aState.mPresContext, aMetrics, reflowInput, status);
// Get the float available space using our saved state from before we
// started reflowing the block, so that we ignore any floats inside
@ -7222,7 +7222,7 @@ nsBlockFrame::ReflowBullet(nsIFrame* aBulletFrame,
// Get the bullet's margin, converted to our writing mode so that we can
// combine it with other logical values here.
LogicalMargin bulletMargin =
reflowState.ComputedLogicalMargin().ConvertTo(wm, bulletWM);
reflowInput.ComputedLogicalMargin().ConvertTo(wm, bulletWM);
nscoord iStart = floatAvailSpace.IStart(wm) -
rs.ComputedLogicalBorderPadding().IStart(wm) -
bulletMargin.IEnd(wm) -
@ -7236,7 +7236,7 @@ nsBlockFrame::ReflowBullet(nsIFrame* aBulletFrame,
aMetrics.ISize(wm),
aMetrics.BSize(wm)),
aState.ContainerSize());
aBulletFrame->DidReflow(aState.mPresContext, &aState.mReflowState,
aBulletFrame->DidReflow(aState.mPresContext, &aState.mReflowInput,
nsDidReflowStatus::FINISHED);
}
@ -7398,8 +7398,8 @@ nsBlockFrame::ISizeToClearPastFloats(const BlockReflowInput& aState,
nsIFrame* aFrame)
{
nscoord inlineStartOffset, inlineEndOffset;
WritingMode wm = aState.mReflowState.GetWritingMode();
SizeComputationInput offsetState(aFrame, aState.mReflowState.mRenderingContext,
WritingMode wm = aState.mReflowInput.GetWritingMode();
SizeComputationInput offsetState(aFrame, aState.mReflowInput.mRenderingContext,
wm, aState.mContentArea.ISize(wm));
ReplacedElementISizeToClear result;
@ -7418,11 +7418,11 @@ nsBlockFrame::ISizeToClearPastFloats(const BlockReflowInput& aState,
WritingMode frWM = aFrame->GetWritingMode();
LogicalSize availSpace = LogicalSize(wm, availISize, NS_UNCONSTRAINEDSIZE).
ConvertTo(frWM, wm);
ReflowInput reflowState(aState.mPresContext, aState.mReflowState,
ReflowInput reflowInput(aState.mPresContext, aState.mReflowInput,
aFrame, availSpace);
result.borderBoxISize =
reflowState.ComputedSizeWithBorderPadding().ConvertTo(wm, frWM).ISize(wm);
// Use the margins from offsetState rather than reflowState so that
reflowInput.ComputedSizeWithBorderPadding().ConvertTo(wm, frWM).ISize(wm);
// Use the margins from offsetState rather than reflowInput so that
// they aren't reduced by ignoring margins in overconstrained cases.
LogicalMargin computedMargin =
offsetState.ComputedLogicalMargin().ConvertTo(wm, frWM);
@ -7449,17 +7449,17 @@ nsBlockFrame::GetNearestAncestorBlock(nsIFrame* aCandidate)
}
void
nsBlockFrame::ComputeFinalBSize(const ReflowInput& aReflowState,
nsBlockFrame::ComputeFinalBSize(const ReflowInput& aReflowInput,
nsReflowStatus* aStatus,
nscoord aContentBSize,
const LogicalMargin& aBorderPadding,
LogicalSize& aFinalSize,
nscoord aConsumed)
{
WritingMode wm = aReflowState.GetWritingMode();
WritingMode wm = aReflowInput.GetWritingMode();
// Figure out how much of the computed height should be
// applied to this frame.
nscoord computedBSizeLeftOver = GetEffectiveComputedBSize(aReflowState,
nscoord computedBSizeLeftOver = GetEffectiveComputedBSize(aReflowInput,
aConsumed);
NS_ASSERTION(!( IS_TRUE_OVERFLOW_CONTAINER(this)
&& computedBSizeLeftOver ),
@ -7471,7 +7471,7 @@ nsBlockFrame::ComputeFinalBSize(const ReflowInput& aReflowState,
aBorderPadding.BEnd(wm));
if (NS_FRAME_IS_NOT_COMPLETE(*aStatus) &&
aFinalSize.BSize(wm) < aReflowState.AvailableBSize()) {
aFinalSize.BSize(wm) < aReflowInput.AvailableBSize()) {
// We fit in the available space - change status to OVERFLOW_INCOMPLETE.
// XXXmats why didn't Reflow report OVERFLOW_INCOMPLETE in the first place?
// XXXmats and why exclude the case when our size == AvailableBSize?
@ -7480,9 +7480,9 @@ nsBlockFrame::ComputeFinalBSize(const ReflowInput& aReflowState,
if (NS_FRAME_IS_COMPLETE(*aStatus)) {
if (computedBSizeLeftOver > 0 &&
NS_UNCONSTRAINEDSIZE != aReflowState.AvailableBSize() &&
aFinalSize.BSize(wm) > aReflowState.AvailableBSize()) {
if (ShouldAvoidBreakInside(aReflowState)) {
NS_UNCONSTRAINEDSIZE != aReflowInput.AvailableBSize() &&
aFinalSize.BSize(wm) > aReflowInput.AvailableBSize()) {
if (ShouldAvoidBreakInside(aReflowInput)) {
*aStatus = NS_INLINE_LINE_BREAK_BEFORE();
return;
}
@ -7491,7 +7491,7 @@ nsBlockFrame::ComputeFinalBSize(const ReflowInput& aReflowState,
// break. If our bottom border/padding straddles the break
// point, then this will increase our height and push the
// border/padding to the next page/column.
aFinalSize.BSize(wm) = std::max(aReflowState.AvailableBSize(),
aFinalSize.BSize(wm) = std::max(aReflowInput.AvailableBSize(),
aContentBSize);
NS_FRAME_SET_INCOMPLETE(*aStatus);
if (!GetNextInFlow())

Просмотреть файл

@ -241,7 +241,7 @@ public:
/**
* Compute the final block size of this frame.
*
* @param aReflowState Data structure passed from parent during reflow.
* @param aReflowInput Data structure passed from parent during reflow.
* @param aReflowStatus A pointer to the reflow status for when we're finished
* doing reflow. this will get set appropriately if the block-size
* causes us to exceed the current available (page) block-size.
@ -255,7 +255,7 @@ public:
* @param aFinalSize Out parameter for final block-size.
* @param aConsumed The block-size already consumed by our previous-in-flows.
*/
void ComputeFinalBSize(const ReflowInput& aReflowState,
void ComputeFinalBSize(const ReflowInput& aReflowInput,
nsReflowStatus* aStatus,
nscoord aContentBSize,
const mozilla::LogicalMargin& aBorderPadding,
@ -264,7 +264,7 @@ public:
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
@ -414,7 +414,7 @@ protected:
// helper for SlideLine and UpdateLineContainerSize
void MoveChildFramesOfLine(nsLineBox* aLine, nscoord aDeltaBCoord);
void ComputeFinalSize(const ReflowInput& aReflowState,
void ComputeFinalSize(const ReflowInput& aReflowInput,
BlockReflowInput& aState,
ReflowOutput& aMetrics,
nscoord* aBottomEdgeOfChildren);

Просмотреть файл

@ -30,7 +30,7 @@ using namespace mozilla;
nsBlockReflowContext::nsBlockReflowContext(nsPresContext* aPresContext,
const ReflowInput& aParentRS)
: mPresContext(aPresContext),
mOuterReflowState(aParentRS),
mOuterReflowInput(aParentRS),
mSpace(aParentRS.GetWritingMode()),
mMetrics(aParentRS)
{
@ -152,19 +152,19 @@ nsBlockReflowContext::ComputeCollapsedBStartMargin(const ReflowInput& aRS,
// we drilled down through a block wrapper. At the moment
// we can only drill down one level so we only have to support
// one extra reflow state.
const ReflowInput* outerReflowState = &aRS;
const ReflowInput* outerReflowInput = &aRS;
if (frame != aRS.mFrame) {
NS_ASSERTION(frame->GetParent() == aRS.mFrame,
"Can only drill through one level of block wrapper");
LogicalSize availSpace = aRS.ComputedSize(frame->GetWritingMode());
outerReflowState = new ReflowInput(prescontext,
outerReflowInput = new ReflowInput(prescontext,
aRS, frame, availSpace);
}
{
LogicalSize availSpace =
outerReflowState->ComputedSize(kid->GetWritingMode());
ReflowInput innerReflowState(prescontext,
*outerReflowState, kid,
outerReflowInput->ComputedSize(kid->GetWritingMode());
ReflowInput innerReflowInput(prescontext,
*outerReflowInput, kid,
availSpace);
// Record that we're being optimistic by assuming the kid
// has no clearance
@ -172,21 +172,21 @@ nsBlockReflowContext::ComputeCollapsedBStartMargin(const ReflowInput& aRS,
!nsBlockFrame::BlockCanIntersectFloats(kid)) {
*aMayNeedRetry = true;
}
if (ComputeCollapsedBStartMargin(innerReflowState, aMargin,
if (ComputeCollapsedBStartMargin(innerReflowInput, aMargin,
aClearanceFrame, aMayNeedRetry,
&isEmpty)) {
line->MarkDirty();
dirtiedLine = true;
}
if (isEmpty) {
WritingMode innerWM = innerReflowState.GetWritingMode();
WritingMode innerWM = innerReflowInput.GetWritingMode();
LogicalMargin innerMargin =
innerReflowState.ComputedLogicalMargin().ConvertTo(parentWM, innerWM);
innerReflowInput.ComputedLogicalMargin().ConvertTo(parentWM, innerWM);
aMargin->Include(innerMargin.BEnd(parentWM));
}
}
if (outerReflowState != &aRS) {
delete const_cast<ReflowInput*>(outerReflowState);
if (outerReflowInput != &aRS) {
delete const_cast<ReflowInput*>(outerReflowInput);
}
}
if (!isEmpty) {
@ -232,7 +232,7 @@ nsBlockReflowContext::ReflowBlock(const LogicalRect& aSpace,
BlockReflowInput& aState)
{
mFrame = aFrameRS.mFrame;
mWritingMode = aState.mReflowState.GetWritingMode();
mWritingMode = aState.mReflowInput.GetWritingMode();
mContainerSize = aState.ContainerSize();
mSpace = aSpace;
@ -244,7 +244,7 @@ nsBlockReflowContext::ReflowBlock(const LogicalRect& aSpace,
mBStartMargin = aPrevMargin;
#ifdef NOISY_BLOCKDIR_MARGINS
nsFrame::ListTag(stdout, mOuterReflowState.mFrame);
nsFrame::ListTag(stdout, mOuterReflowInput.mFrame);
printf(": reflowing ");
nsFrame::ListTag(stdout, mFrame);
printf(" margin => %d, clearance => %d\n", mBStartMargin.get(), aClearance);
@ -294,7 +294,7 @@ nsBlockReflowContext::ReflowBlock(const LogicalRect& aSpace,
if ((mFrame->GetStateBits() & NS_BLOCK_FLOAT_MGR) == 0)
aFrameRS.mBlockDelta =
mOuterReflowState.mBlockDelta + mBCoord - aLine->BStart();
mOuterReflowInput.mBlockDelta + mBCoord - aLine->BStart();
}
#ifdef DEBUG
@ -302,9 +302,9 @@ nsBlockReflowContext::ReflowBlock(const LogicalRect& aSpace,
mMetrics.BSize(mWritingMode) = nscoord(0xdeadbeef);
#endif
mOuterReflowState.mFloatManager->Translate(tI, tB);
mOuterReflowInput.mFloatManager->Translate(tI, tB);
mFrame->Reflow(mPresContext, mMetrics, aFrameRS, aFrameReflowStatus);
mOuterReflowState.mFloatManager->Translate(-tI, -tB);
mOuterReflowInput.mFloatManager->Translate(-tI, -tB);
#ifdef DEBUG
if (!NS_INLINE_IS_BREAK_BEFORE(aFrameReflowStatus)) {
@ -357,7 +357,7 @@ nsBlockReflowContext::ReflowBlock(const LogicalRect& aSpace,
* collapse margins (CSS2 8.3.1). Also apply relative positioning.
*/
bool
nsBlockReflowContext::PlaceBlock(const ReflowInput& aReflowState,
nsBlockReflowContext::PlaceBlock(const ReflowInput& aReflowInput,
bool aForceFit,
nsLineBox* aLine,
nsCollapsingMargin& aBEndMarginResult,
@ -365,11 +365,11 @@ nsBlockReflowContext::PlaceBlock(const ReflowInput& aReflowState,
nsReflowStatus aReflowStatus)
{
// Compute collapsed block-end margin value.
WritingMode wm = aReflowState.GetWritingMode();
WritingMode wm = aReflowInput.GetWritingMode();
WritingMode parentWM = mMetrics.GetWritingMode();
if (NS_FRAME_IS_COMPLETE(aReflowStatus)) {
aBEndMarginResult = mMetrics.mCarriedOutBEndMargin;
aBEndMarginResult.Include(aReflowState.ComputedLogicalMargin().
aBEndMarginResult.Include(aReflowInput.ComputedLogicalMargin().
ConvertTo(parentWM, wm).BEnd(parentWM));
} else {
// The used block-end-margin is set to zero before a break.
@ -395,7 +395,7 @@ nsBlockReflowContext::PlaceBlock(const ReflowInput& aReflowState,
#ifdef NOISY_BLOCKDIR_MARGINS
printf(" ");
nsFrame::ListTag(stdout, mOuterReflowState.mFrame);
nsFrame::ListTag(stdout, mOuterReflowInput.mFrame);
printf(": ");
nsFrame::ListTag(stdout, mFrame);
printf(" -- collapsing block start & end margin together; BStart=%d spaceBStart=%d\n",
@ -431,7 +431,7 @@ nsBlockReflowContext::PlaceBlock(const ReflowInput& aReflowState,
backupContainingBlockAdvance + mMetrics.BSize(mWritingMode);
if (bEnd > mSpace.BEnd(mWritingMode)) {
// didn't fit, we must acquit.
mFrame->DidReflow(mPresContext, &aReflowState,
mFrame->DidReflow(mPresContext, &aReflowInput,
nsDidReflowStatus::FINISHED);
return false;
}
@ -451,11 +451,11 @@ nsBlockReflowContext::PlaceBlock(const ReflowInput& aReflowState,
// ApplyRelativePositioning in right-to-left writing modes needs to
// know the updated frame width
mFrame->SetSize(mWritingMode, mMetrics.Size(mWritingMode));
aReflowState.ApplyRelativePositioning(&logPos, mContainerSize);
aReflowInput.ApplyRelativePositioning(&logPos, mContainerSize);
// Now place the frame and complete the reflow process
nsContainerFrame::FinishReflowChild(mFrame, mPresContext, mMetrics,
&aReflowState, frameWM, logPos,
&aReflowInput, frameWM, logPos,
mContainerSize, 0);
aOverflowAreas = mMetrics.mOverflowAreas + mFrame->GetPosition();

Просмотреть файл

@ -37,11 +37,11 @@ public:
nscoord aClearance,
bool aIsAdjacentWithBStart,
nsLineBox* aLine,
ReflowInput& aReflowState,
ReflowInput& aReflowInput,
nsReflowStatus& aReflowStatus,
BlockReflowInput& aState);
bool PlaceBlock(const ReflowInput& aReflowState,
bool PlaceBlock(const ReflowInput& aReflowInput,
bool aForceFit,
nsLineBox* aLine,
nsCollapsingMargin& aBEndMarginResult /* out */,
@ -83,7 +83,7 @@ public:
protected:
nsPresContext* mPresContext;
const ReflowInput& mOuterReflowState;
const ReflowInput& mOuterReflowInput;
nsIFrame* mFrame;
mozilla::LogicalRect mSpace;

Просмотреть файл

@ -631,24 +631,24 @@ nsBulletFrame::GetDesiredSize(nsPresContext* aCX,
void
nsBulletFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aMetrics,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsBulletFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aMetrics, aStatus);
float inflation = nsLayoutUtils::FontSizeInflationFor(this);
SetFontSizeInflation(inflation);
// Get the base size
GetDesiredSize(aPresContext, aReflowState.mRenderingContext, aMetrics, inflation,
GetDesiredSize(aPresContext, aReflowInput.mRenderingContext, aMetrics, inflation,
&mPadding);
// Add in the border and padding; split the top/bottom between the
// ascent and descent to make things look nice
WritingMode wm = aReflowState.GetWritingMode();
const LogicalMargin& bp = aReflowState.ComputedLogicalBorderPadding();
WritingMode wm = aReflowInput.GetWritingMode();
const LogicalMargin& bp = aReflowInput.ComputedLogicalBorderPadding();
mPadding.BStart(wm) += NSToCoordRound(bp.BStart(wm) * inflation);
mPadding.IEnd(wm) += NSToCoordRound(bp.IEnd(wm) * inflation);
mPadding.BEnd(wm) += NSToCoordRound(bp.BEnd(wm) * inflation);
@ -668,7 +668,7 @@ nsBulletFrame::Reflow(nsPresContext* aPresContext,
aMetrics.SetOverflowAreasToDesiredBounds();
aStatus = NS_FRAME_COMPLETE;
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aMetrics);
}
/* virtual */ nscoord

Просмотреть файл

@ -78,7 +78,7 @@ public:
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aMetrics,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;

Просмотреть файл

@ -573,12 +573,12 @@ nsCanvasFrame::GetPrefISize(nsRenderingContext *aRenderingContext)
void
nsCanvasFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsCanvasFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
NS_FRAME_TRACE_REFLOW_IN("nsCanvasFrame::Reflow");
// Initialize OUT parameter
@ -603,7 +603,7 @@ nsCanvasFrame::Reflow(nsPresContext* aPresContext,
// Set our size up front, since some parts of reflow depend on it
// being already set. Note that the computed height may be
// unconstrained; that's ok. Consumers should watch out for that.
SetSize(nsSize(aReflowState.ComputedWidth(), aReflowState.ComputedHeight()));
SetSize(nsSize(aReflowInput.ComputedWidth(), aReflowInput.ComputedHeight()));
// Reflow our one and only normal child frame. It's either the root
// element's frame or a placeholder for that frame, if the root element
@ -612,7 +612,7 @@ nsCanvasFrame::Reflow(nsPresContext* aPresContext,
// don't need to be reflowed. The normal child is always comes before
// the fixed-pos placeholders, because we insert it at the start
// of the child list, above.
ReflowOutput kidDesiredSize(aReflowState);
ReflowOutput kidDesiredSize(aReflowInput);
if (mFrames.IsEmpty()) {
// We have no child frame, so return an empty size
aDesiredSize.Width() = aDesiredSize.Height() = 0;
@ -621,31 +621,31 @@ nsCanvasFrame::Reflow(nsPresContext* aPresContext,
bool kidDirty = (kidFrame->GetStateBits() & NS_FRAME_IS_DIRTY) != 0;
ReflowInput
kidReflowState(aPresContext, aReflowState, kidFrame,
aReflowState.AvailableSize(kidFrame->GetWritingMode()));
kidReflowInput(aPresContext, aReflowInput, kidFrame,
aReflowInput.AvailableSize(kidFrame->GetWritingMode()));
if (aReflowState.IsBResizeForWM(kidReflowState.GetWritingMode()) &&
if (aReflowInput.IsBResizeForWM(kidReflowInput.GetWritingMode()) &&
(kidFrame->GetStateBits() & NS_FRAME_CONTAINS_RELATIVE_BSIZE)) {
// Tell our kid it's being block-dir resized too. Bit of a
// hack for framesets.
kidReflowState.SetBResize(true);
kidReflowInput.SetBResize(true);
}
WritingMode wm = aReflowState.GetWritingMode();
WritingMode kidWM = kidReflowState.GetWritingMode();
nsSize containerSize = aReflowState.ComputedPhysicalSize();
WritingMode wm = aReflowInput.GetWritingMode();
WritingMode kidWM = kidReflowInput.GetWritingMode();
nsSize containerSize = aReflowInput.ComputedPhysicalSize();
LogicalMargin margin = kidReflowState.ComputedLogicalMargin();
LogicalMargin margin = kidReflowInput.ComputedLogicalMargin();
LogicalPoint kidPt(kidWM, margin.IStart(kidWM), margin.BStart(kidWM));
kidReflowState.ApplyRelativePositioning(&kidPt, containerSize);
kidReflowInput.ApplyRelativePositioning(&kidPt, containerSize);
// Reflow the frame
ReflowChild(kidFrame, aPresContext, kidDesiredSize, kidReflowState,
ReflowChild(kidFrame, aPresContext, kidDesiredSize, kidReflowInput,
kidWM, kidPt, containerSize, 0, aStatus);
// Complete the reflow and position and size the child frame
FinishReflowChild(kidFrame, aPresContext, kidDesiredSize, &kidReflowState,
FinishReflowChild(kidFrame, aPresContext, kidDesiredSize, &kidReflowInput,
kidWM, kidPt, containerSize, 0);
if (!NS_FRAME_IS_FULLY_COMPLETE(aStatus)) {
@ -685,12 +685,12 @@ nsCanvasFrame::Reflow(nsPresContext* aPresContext,
// sometimes we can be given an unconstrained height (when a window
// is sizing-to-content), and we should compute our desired height.
LogicalSize finalSize(wm);
finalSize.ISize(wm) = aReflowState.ComputedISize();
if (aReflowState.ComputedBSize() == NS_UNCONSTRAINEDSIZE) {
finalSize.ISize(wm) = aReflowInput.ComputedISize();
if (aReflowInput.ComputedBSize() == NS_UNCONSTRAINEDSIZE) {
finalSize.BSize(wm) = kidFrame->GetLogicalSize(wm).BSize(wm) +
kidReflowState.ComputedLogicalMargin().BStartEnd(wm);
kidReflowInput.ComputedLogicalMargin().BStartEnd(wm);
} else {
finalSize.BSize(wm) = aReflowState.ComputedBSize();
finalSize.BSize(wm) = aReflowInput.ComputedBSize();
}
aDesiredSize.SetSize(wm, finalSize);
@ -700,15 +700,15 @@ nsCanvasFrame::Reflow(nsPresContext* aPresContext,
}
if (prevCanvasFrame) {
ReflowOverflowContainerChildren(aPresContext, aReflowState,
ReflowOverflowContainerChildren(aPresContext, aReflowInput,
aDesiredSize.mOverflowAreas, 0,
aStatus);
}
FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize, aReflowState, aStatus);
FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize, aReflowInput, aStatus);
NS_FRAME_TRACE_REFLOW_OUT("nsCanvasFrame::Reflow", aStatus);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
nsIAtom*

Просмотреть файл

@ -72,7 +72,7 @@ public:
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual bool IsFrameOfType(uint32_t aFlags) const override
{

Просмотреть файл

@ -155,30 +155,30 @@ nsColumnSetFrame::PaintColumnRule(nsRenderingContext* aCtx,
}
static nscoord
GetAvailableContentISize(const ReflowInput& aReflowState)
GetAvailableContentISize(const ReflowInput& aReflowInput)
{
if (aReflowState.AvailableISize() == NS_INTRINSICSIZE) {
if (aReflowInput.AvailableISize() == NS_INTRINSICSIZE) {
return NS_INTRINSICSIZE;
}
WritingMode wm = aReflowState.GetWritingMode();
WritingMode wm = aReflowInput.GetWritingMode();
nscoord borderPaddingISize =
aReflowState.ComputedLogicalBorderPadding().IStartEnd(wm);
return std::max(0, aReflowState.AvailableISize() - borderPaddingISize);
aReflowInput.ComputedLogicalBorderPadding().IStartEnd(wm);
return std::max(0, aReflowInput.AvailableISize() - borderPaddingISize);
}
nscoord
nsColumnSetFrame::GetAvailableContentBSize(const ReflowInput& aReflowState)
nsColumnSetFrame::GetAvailableContentBSize(const ReflowInput& aReflowInput)
{
if (aReflowState.AvailableBSize() == NS_INTRINSICSIZE) {
if (aReflowInput.AvailableBSize() == NS_INTRINSICSIZE) {
return NS_INTRINSICSIZE;
}
WritingMode wm = aReflowState.GetWritingMode();
LogicalMargin bp = aReflowState.ComputedLogicalBorderPadding();
bp.ApplySkipSides(GetLogicalSkipSides(&aReflowState));
bp.BEnd(wm) = aReflowState.ComputedLogicalBorderPadding().BEnd(wm);
return std::max(0, aReflowState.AvailableBSize() - bp.BStartEnd(wm));
WritingMode wm = aReflowInput.GetWritingMode();
LogicalMargin bp = aReflowInput.ComputedLogicalBorderPadding();
bp.ApplySkipSides(GetLogicalSkipSides(&aReflowInput));
bp.BEnd(wm) = aReflowInput.ComputedLogicalBorderPadding().BEnd(wm);
return std::max(0, aReflowInput.AvailableBSize() - bp.BStartEnd(wm));
}
static nscoord
@ -198,7 +198,7 @@ GetColumnGap(nsColumnSetFrame* aFrame,
}
nsColumnSetFrame::ReflowConfig
nsColumnSetFrame::ChooseColumnStrategy(const ReflowInput& aReflowState,
nsColumnSetFrame::ChooseColumnStrategy(const ReflowInput& aReflowInput,
bool aForceAuto = false,
nscoord aFeasibleBSize = NS_INTRINSICSIZE,
nscoord aInfeasibleBSize = 0)
@ -207,9 +207,9 @@ nsColumnSetFrame::ChooseColumnStrategy(const ReflowInput& aReflowState,
nscoord knownInfeasibleBSize = aInfeasibleBSize;
const nsStyleColumn* colStyle = StyleColumn();
nscoord availContentISize = GetAvailableContentISize(aReflowState);
if (aReflowState.ComputedISize() != NS_INTRINSICSIZE) {
availContentISize = aReflowState.ComputedISize();
nscoord availContentISize = GetAvailableContentISize(aReflowInput);
if (aReflowInput.ComputedISize() != NS_INTRINSICSIZE) {
availContentISize = aReflowInput.ComputedISize();
}
nscoord consumedBSize = GetConsumedBSize();
@ -217,14 +217,14 @@ nsColumnSetFrame::ChooseColumnStrategy(const ReflowInput& aReflowState,
// The effective computed height is the height of the current continuation
// of the column set frame. This should be the same as the computed height
// if we have an unconstrained available height.
nscoord computedBSize = GetEffectiveComputedBSize(aReflowState,
nscoord computedBSize = GetEffectiveComputedBSize(aReflowInput,
consumedBSize);
nscoord colBSize = GetAvailableContentBSize(aReflowState);
nscoord colBSize = GetAvailableContentBSize(aReflowInput);
if (aReflowState.ComputedBSize() != NS_INTRINSICSIZE) {
colBSize = aReflowState.ComputedBSize();
} else if (aReflowState.ComputedMaxBSize() != NS_INTRINSICSIZE) {
colBSize = std::min(colBSize, aReflowState.ComputedMaxBSize());
if (aReflowInput.ComputedBSize() != NS_INTRINSICSIZE) {
colBSize = aReflowInput.ComputedBSize();
} else if (aReflowInput.ComputedMaxBSize() != NS_INTRINSICSIZE) {
colBSize = std::min(colBSize, aReflowInput.ComputedMaxBSize());
}
nscoord colGap = GetColumnGap(this, colStyle);
@ -236,8 +236,8 @@ nsColumnSetFrame::ChooseColumnStrategy(const ReflowInput& aReflowState,
if (isBalancing) {
const uint32_t MAX_NESTED_COLUMN_BALANCING = 2;
uint32_t cnt = 0;
for (const ReflowInput* rs = aReflowState.mParentReflowState;
rs && cnt < MAX_NESTED_COLUMN_BALANCING; rs = rs->mParentReflowState) {
for (const ReflowInput* rs = aReflowInput.mParentReflowInput;
rs && cnt < MAX_NESTED_COLUMN_BALANCING; rs = rs->mParentReflowInput) {
if (rs->mFlags.mIsColumnBalancing) {
++cnt;
}
@ -343,24 +343,24 @@ nsColumnSetFrame::ChooseColumnStrategy(const ReflowInput& aReflowState,
bool
nsColumnSetFrame::ReflowColumns(ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aReflowStatus,
ReflowConfig& aConfig,
bool aLastColumnUnbounded,
nsCollapsingMargin* aCarriedOutBEndMargin,
ColumnBalanceData& aColData)
{
bool feasible = ReflowChildren(aDesiredSize, aReflowState,
bool feasible = ReflowChildren(aDesiredSize, aReflowInput,
aReflowStatus, aConfig, aLastColumnUnbounded,
aCarriedOutBEndMargin, aColData);
if (aColData.mHasExcessBSize) {
aConfig = ChooseColumnStrategy(aReflowState, true);
aConfig = ChooseColumnStrategy(aReflowInput, true);
// We need to reflow our children again one last time, otherwise we might
// end up with a stale column height for some of our columns, since we
// bailed out of balancing.
feasible = ReflowChildren(aDesiredSize, aReflowState, aReflowStatus,
feasible = ReflowChildren(aDesiredSize, aReflowInput, aReflowStatus,
aConfig, aLastColumnUnbounded,
aCarriedOutBEndMargin, aColData);
}
@ -450,7 +450,7 @@ nsColumnSetFrame::GetPrefISize(nsRenderingContext *aRenderingContext)
bool
nsColumnSetFrame::ReflowChildren(ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus,
const ReflowConfig& aConfig,
bool aUnboundedLastColumn,
@ -488,8 +488,8 @@ nsColumnSetFrame::ReflowChildren(ReflowOutput& aDesiredSize,
}
// get our border and padding
LogicalMargin borderPadding = aReflowState.ComputedLogicalBorderPadding();
borderPadding.ApplySkipSides(GetLogicalSkipSides(&aReflowState));
LogicalMargin borderPadding = aReflowInput.ComputedLogicalBorderPadding();
borderPadding.ApplySkipSides(GetLogicalSkipSides(&aReflowInput));
nsRect contentRect(0, 0, 0, 0);
nsOverflowAreas overflowRects;
@ -498,10 +498,10 @@ nsColumnSetFrame::ReflowChildren(ReflowOutput& aDesiredSize,
LogicalPoint childOrigin(wm, borderPadding.IStart(wm),
borderPadding.BStart(wm));
// In vertical-rl mode, columns will not be correctly placed if the
// reflowState's ComputedWidth() is UNCONSTRAINED (in which case we'll get
// reflowInput's ComputedWidth() is UNCONSTRAINED (in which case we'll get
// a containerSize.width of zero here). In that case, the column positions
// will be adjusted later, after our correct contentSize is known.
nsSize containerSize = aReflowState.ComputedSizeAsContainerIfConstrained();
nsSize containerSize = aReflowInput.ComputedSizeAsContainerIfConstrained();
// For RTL, since the columns might not fill the frame exactly, we
// need to account for the slop. Otherwise we'll waste time moving the
@ -511,9 +511,9 @@ nsColumnSetFrame::ReflowChildren(ReflowOutput& aDesiredSize,
// probably won't need to do this hack any more. For now, we
// confine it to the legacy horizontal-rl case
if (!isVertical && isRTL) {
nscoord availISize = aReflowState.AvailableISize();
if (aReflowState.ComputedISize() != NS_INTRINSICSIZE) {
availISize = aReflowState.ComputedISize();
nscoord availISize = aReflowInput.AvailableISize();
if (aReflowInput.ComputedISize() != NS_INTRINSICSIZE) {
availISize = aReflowInput.ComputedISize();
}
if (availISize != NS_INTRINSICSIZE) {
childOrigin.I(wm) = containerSize.width - borderPadding.Left(wm) -
@ -539,7 +539,7 @@ nsColumnSetFrame::ReflowChildren(ReflowOutput& aDesiredSize,
// content from its next sibling. (Note that it might be the last
// column, but not be the last child because the desired number of columns
// has changed.)
bool skipIncremental = !aReflowState.ShouldReflowAllKids()
bool skipIncremental = !aReflowInput.ShouldReflowAllKids()
&& !NS_SUBTREE_DIRTY(child)
&& child->GetNextSibling()
&& !(aUnboundedLastColumn && columnCount == aConfig.mBalanceColCount - 1)
@ -597,24 +597,24 @@ nsColumnSetFrame::ReflowChildren(ReflowOutput& aDesiredSize,
} else {
LogicalSize availSize(wm, aConfig.mColISize, aConfig.mColMaxBSize);
if (aUnboundedLastColumn && columnCount == aConfig.mBalanceColCount - 1) {
availSize.BSize(wm) = GetAvailableContentBSize(aReflowState);
availSize.BSize(wm) = GetAvailableContentBSize(aReflowInput);
}
LogicalSize computedSize = aReflowState.ComputedSize(wm);
LogicalSize computedSize = aReflowInput.ComputedSize(wm);
if (reflowNext)
child->AddStateBits(NS_FRAME_IS_DIRTY);
LogicalSize kidCBSize(wm, availSize.ISize(wm), computedSize.BSize(wm));
ReflowInput kidReflowState(PresContext(), aReflowState, child,
ReflowInput kidReflowInput(PresContext(), aReflowInput, child,
availSize, &kidCBSize);
kidReflowState.mFlags.mIsTopOfPage = true;
kidReflowState.mFlags.mTableIsSplittable = false;
kidReflowState.mFlags.mIsColumnBalancing = aConfig.mBalanceColCount < INT32_MAX;
kidReflowInput.mFlags.mIsTopOfPage = true;
kidReflowInput.mFlags.mTableIsSplittable = false;
kidReflowInput.mFlags.mIsColumnBalancing = aConfig.mBalanceColCount < INT32_MAX;
// We need to reflow any float placeholders, even if our column height
// hasn't changed.
kidReflowState.mFlags.mMustReflowPlaceholders = !colBSizeChanged;
kidReflowInput.mFlags.mMustReflowPlaceholders = !colBSizeChanged;
#ifdef DEBUG_roc
printf("*** Reflowing child #%d %p: availHeight=%d\n",
@ -626,7 +626,7 @@ nsColumnSetFrame::ReflowChildren(ReflowOutput& aDesiredSize,
if (child->GetNextSibling() &&
!(GetStateBits() & NS_FRAME_IS_DIRTY) &&
!(child->GetNextSibling()->GetStateBits() & NS_FRAME_IS_DIRTY)) {
kidReflowState.mFlags.mNextInFlowUntouched = true;
kidReflowInput.mFlags.mNextInFlowUntouched = true;
}
ReflowOutput kidDesiredSize(wm, aDesiredSize.mFlags);
@ -641,10 +641,10 @@ nsColumnSetFrame::ReflowChildren(ReflowOutput& aDesiredSize,
// Reflow the frame
LogicalPoint origin(wm,
childOrigin.I(wm) +
kidReflowState.ComputedLogicalMargin().IStart(wm),
kidReflowInput.ComputedLogicalMargin().IStart(wm),
childOrigin.B(wm) +
kidReflowState.ComputedLogicalMargin().BStart(wm));
ReflowChild(child, PresContext(), kidDesiredSize, kidReflowState,
kidReflowInput.ComputedLogicalMargin().BStart(wm));
ReflowChild(child, PresContext(), kidDesiredSize, kidReflowInput,
wm, origin, containerSize, 0, aStatus);
reflowNext = (aStatus & NS_FRAME_REFLOW_NEXTINFLOW) != 0;
@ -660,7 +660,7 @@ nsColumnSetFrame::ReflowChildren(ReflowOutput& aDesiredSize,
*aCarriedOutBEndMargin = kidDesiredSize.mCarriedOutBEndMargin;
FinishReflowChild(child, PresContext(), kidDesiredSize,
&kidReflowState, wm, childOrigin, containerSize, 0);
&kidReflowInput, wm, childOrigin, containerSize, 0);
childContentBEnd = nsLayoutUtils::CalculateContentBEnd(wm, child);
if (childContentBEnd > aConfig.mColMaxBSize) {
@ -715,8 +715,8 @@ nsColumnSetFrame::ReflowChildren(ReflowOutput& aDesiredSize,
kidNextInFlow->RemoveStateBits(NS_FRAME_IS_OVERFLOW_CONTAINER);
}
if ((contentBEnd > aReflowState.ComputedMaxBSize() ||
contentBEnd > aReflowState.ComputedBSize()) &&
if ((contentBEnd > aReflowInput.ComputedMaxBSize() ||
contentBEnd > aReflowInput.ComputedBSize()) &&
aConfig.mBalanceColCount < INT32_MAX) {
// We overflowed vertically, but have not exceeded the number of
// columns. We're going to go into overflow columns now, so balancing
@ -783,7 +783,7 @@ nsColumnSetFrame::ReflowChildren(ReflowOutput& aDesiredSize,
// Apply computed and min/max values
if (aConfig.mComputedBSize != NS_INTRINSICSIZE) {
if (aReflowState.AvailableBSize() != NS_INTRINSICSIZE) {
if (aReflowInput.AvailableBSize() != NS_INTRINSICSIZE) {
contentSize.BSize(wm) = std::min(contentSize.BSize(wm),
aConfig.mComputedBSize);
} else {
@ -796,14 +796,14 @@ nsColumnSetFrame::ReflowChildren(ReflowOutput& aDesiredSize,
// having a last continuation that is smaller than the min bSize. but which
// has prev-in-flows, trigger a larger bSize than actually required.
contentSize.BSize(wm) =
aReflowState.ApplyMinMaxBSize(contentSize.BSize(wm),
aReflowInput.ApplyMinMaxBSize(contentSize.BSize(wm),
aConfig.mConsumedBSize);
}
if (aReflowState.ComputedISize() != NS_INTRINSICSIZE) {
contentSize.ISize(wm) = aReflowState.ComputedISize();
if (aReflowInput.ComputedISize() != NS_INTRINSICSIZE) {
contentSize.ISize(wm) = aReflowInput.ComputedISize();
} else {
contentSize.ISize(wm) =
aReflowState.ApplyMinMaxISize(contentSize.ISize(wm));
aReflowInput.ApplyMinMaxISize(contentSize.ISize(wm));
}
contentSize.ISize(wm) += borderPadding.IStartEnd(wm);
@ -861,7 +861,7 @@ nsColumnSetFrame::DrainOverflowColumns()
}
void
nsColumnSetFrame::FindBestBalanceBSize(const ReflowInput& aReflowState,
nsColumnSetFrame::FindBestBalanceBSize(const ReflowInput& aReflowInput,
nsPresContext* aPresContext,
ReflowConfig& aConfig,
ColumnBalanceData& aColData,
@ -873,12 +873,12 @@ nsColumnSetFrame::FindBestBalanceBSize(const ReflowInput& aReflowState,
{
bool feasible = aRunWasFeasible;
nsMargin bp = aReflowState.ComputedPhysicalBorderPadding();
nsMargin bp = aReflowInput.ComputedPhysicalBorderPadding();
bp.ApplySkipSides(GetSkipSides());
bp.bottom = aReflowState.ComputedPhysicalBorderPadding().bottom;
bp.bottom = aReflowInput.ComputedPhysicalBorderPadding().bottom;
nscoord availableContentBSize =
GetAvailableContentBSize(aReflowState);
GetAvailableContentBSize(aReflowInput);
// Termination of the algorithm below is guaranteed because
// aConfig.knownFeasibleBSize - aConfig.knownInfeasibleBSize decreases in every
@ -980,7 +980,7 @@ nsColumnSetFrame::FindBestBalanceBSize(const ReflowInput& aReflowState,
aUnboundedLastColumn = false;
AddStateBits(NS_FRAME_IS_DIRTY);
feasible = ReflowColumns(aDesiredSize, aReflowState, aStatus, aConfig, false,
feasible = ReflowColumns(aDesiredSize, aReflowInput, aStatus, aConfig, false,
&aOutMargin, aColData);
if (!aConfig.mIsBalancing) {
@ -1009,7 +1009,7 @@ nsColumnSetFrame::FindBestBalanceBSize(const ReflowInput& aReflowState,
// Otherwise we'd have to split, and it's not clear what we'd do with
// that.
AddStateBits(NS_FRAME_IS_DIRTY);
feasible = ReflowColumns(aDesiredSize, aReflowState, aStatus, aConfig,
feasible = ReflowColumns(aDesiredSize, aReflowInput, aStatus, aConfig,
availableContentBSize == NS_UNCONSTRAINEDSIZE,
&aOutMargin, aColData);
}
@ -1021,7 +1021,7 @@ nsColumnSetFrame::FindBestBalanceBSize(const ReflowInput& aReflowState,
void
nsColumnSetFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
@ -1029,13 +1029,13 @@ nsColumnSetFrame::Reflow(nsPresContext* aPresContext,
nsPresContext::InterruptPreventer noInterrupts(aPresContext);
DO_GLOBAL_REFLOW_COUNT("nsColumnSetFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
// Initialize OUT parameter
aStatus = NS_FRAME_COMPLETE;
// Our children depend on our block-size if we have a fixed block-size.
if (aReflowState.ComputedBSize() != NS_AUTOHEIGHT) {
if (aReflowInput.ComputedBSize() != NS_AUTOHEIGHT) {
AddStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE);
} else {
RemoveStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE);
@ -1055,7 +1055,7 @@ nsColumnSetFrame::Reflow(nsPresContext* aPresContext,
nsOverflowAreas ocBounds;
nsReflowStatus ocStatus = NS_FRAME_COMPLETE;
if (GetPrevInFlow()) {
ReflowOverflowContainerChildren(aPresContext, aReflowState, ocBounds, 0,
ReflowOverflowContainerChildren(aPresContext, aReflowInput, ocBounds, 0,
ocStatus);
}
@ -1066,8 +1066,8 @@ nsColumnSetFrame::Reflow(nsPresContext* aPresContext,
// happens in orthogonal flows where the inline direction is the
// container's block direction).
ReflowConfig config =
ChooseColumnStrategy(aReflowState,
aReflowState.ComputedISize() == NS_UNCONSTRAINEDSIZE);
ChooseColumnStrategy(aReflowInput,
aReflowInput.ComputedISize() == NS_UNCONSTRAINEDSIZE);
// If balancing, then we allow the last column to grow to unbounded
// height during the first reflow. This gives us a way to estimate
@ -1081,7 +1081,7 @@ nsColumnSetFrame::Reflow(nsPresContext* aPresContext,
ColumnBalanceData colData;
colData.mHasExcessBSize = false;
bool feasible = ReflowColumns(aDesiredSize, aReflowState, aStatus, config,
bool feasible = ReflowColumns(aDesiredSize, aReflowInput, aStatus, config,
unboundedLastColumn, &carriedOutBottomMargin,
colData);
@ -1089,31 +1089,31 @@ nsColumnSetFrame::Reflow(nsPresContext* aPresContext,
// 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(aReflowState, aPresContext, config, colData,
FindBestBalanceBSize(aReflowInput, aPresContext, config, colData,
aDesiredSize, carriedOutBottomMargin,
unboundedLastColumn, feasible, aStatus);
}
if (aPresContext->HasPendingInterrupt() &&
aReflowState.AvailableBSize() == NS_UNCONSTRAINEDSIZE) {
aReflowInput.AvailableBSize() == NS_UNCONSTRAINEDSIZE) {
// In this situation, we might be lying about our reflow status, because
// our last kid (the one that got interrupted) was incomplete. Fix that.
aStatus = NS_FRAME_COMPLETE;
}
NS_ASSERTION(NS_FRAME_IS_FULLY_COMPLETE(aStatus) ||
aReflowState.AvailableBSize() != NS_UNCONSTRAINEDSIZE,
aReflowInput.AvailableBSize() != NS_UNCONSTRAINEDSIZE,
"Column set should be complete if the available block-size is unconstrained");
// Merge overflow container bounds and status.
aDesiredSize.mOverflowAreas.UnionWith(ocBounds);
NS_MergeReflowStatusInto(&aStatus, ocStatus);
FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize, aReflowState, aStatus, false);
FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize, aReflowInput, aStatus, false);
aDesiredSize.mCarriedOutBEndMargin = carriedOutBottomMargin;
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
void

Просмотреть файл

@ -26,7 +26,7 @@ public:
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
#ifdef DEBUG
@ -48,7 +48,7 @@ public:
* Retrieve the available height for content of this frame. The available content
* height is the available height for the frame, minus borders and padding.
*/
virtual nscoord GetAvailableContentBSize(const ReflowInput& aReflowState);
virtual nscoord GetAvailableContentBSize(const ReflowInput& aReflowInput);
virtual nsContainerFrame* GetContentInsertionFrame() override {
nsIFrame* frame = PrincipalChildList().FirstChild();
@ -162,7 +162,7 @@ protected:
};
bool ReflowColumns(ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aReflowStatus,
ReflowConfig& aConfig,
bool aLastColumnUnbounded,
@ -176,14 +176,14 @@ protected:
* style. This function will also be responsible for implementing
* the state machine that controls column balancing.
*/
ReflowConfig ChooseColumnStrategy(const ReflowInput& aReflowState,
ReflowConfig ChooseColumnStrategy(const ReflowInput& aReflowInput,
bool aForceAuto, nscoord aFeasibleBSize,
nscoord aInfeasibleBSize);
/**
* Perform the binary search for the best balance height for this column set.
*
* @param aReflowState The input parameters for the current reflow iteration.
* @param aReflowInput The input parameters for the current reflow iteration.
* @param aPresContext The presentation context in which the current reflow
* iteration is occurring.
* @param aConfig The ReflowConfig object associated with this column set
@ -204,7 +204,7 @@ protected:
* @param aStatus A final reflow status of the column set frame, passed in as
* an output parameter.
*/
void FindBestBalanceBSize(const ReflowInput& aReflowState,
void FindBestBalanceBSize(const ReflowInput& aReflowInput,
nsPresContext* aPresContext,
ReflowConfig& aConfig,
ColumnBalanceData& aColData,
@ -218,7 +218,7 @@ protected:
* fit into the mColMaxBSize.
*/
bool ReflowChildren(ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus,
const ReflowConfig& aConfig,
bool aLastColumnUnbounded,

Просмотреть файл

@ -995,7 +995,7 @@ void
nsContainerFrame::ReflowChild(nsIFrame* aKidFrame,
nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
const WritingMode& aWM,
const LogicalPoint& aPos,
const nsSize& aContainerSize,
@ -1003,7 +1003,7 @@ nsContainerFrame::ReflowChild(nsIFrame* aKidFrame,
nsReflowStatus& aStatus,
nsOverflowContinuationTracker* aTracker)
{
NS_PRECONDITION(aReflowState.mFrame == aKidFrame, "bad reflow state");
NS_PRECONDITION(aReflowInput.mFrame == aKidFrame, "bad reflow state");
if (aWM.IsVerticalRL() || (!aWM.IsVertical() && !aWM.IsBidiLTR())) {
NS_ASSERTION(aContainerSize.width != NS_UNCONSTRAINEDSIZE,
"ReflowChild with unconstrained container width!");
@ -1019,7 +1019,7 @@ nsContainerFrame::ReflowChild(nsIFrame* aKidFrame,
}
// Reflow the child frame
aKidFrame->Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
aKidFrame->Reflow(aPresContext, aDesiredSize, aReflowInput, aStatus);
// If the child frame is complete, delete any next-in-flows,
// but only if the NO_DELETE_NEXT_IN_FLOW flag isn't set.
@ -1043,14 +1043,14 @@ void
nsContainerFrame::ReflowChild(nsIFrame* aKidFrame,
nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nscoord aX,
nscoord aY,
uint32_t aFlags,
nsReflowStatus& aStatus,
nsOverflowContinuationTracker* aTracker)
{
NS_PRECONDITION(aReflowState.mFrame == aKidFrame, "bad reflow state");
NS_PRECONDITION(aReflowInput.mFrame == aKidFrame, "bad reflow state");
// Position the child frame and its view if requested.
if (NS_FRAME_NO_MOVE_FRAME != (aFlags & NS_FRAME_NO_MOVE_FRAME)) {
@ -1062,7 +1062,7 @@ nsContainerFrame::ReflowChild(nsIFrame* aKidFrame,
}
// Reflow the child frame
aKidFrame->Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
aKidFrame->Reflow(aPresContext, aDesiredSize, aReflowInput, aStatus);
// If the child frame is complete, delete any next-in-flows,
// but only if the NO_DELETE_NEXT_IN_FLOW flag isn't set.
@ -1136,7 +1136,7 @@ void
nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame,
nsPresContext* aPresContext,
const ReflowOutput& aDesiredSize,
const ReflowInput* aReflowState,
const ReflowInput* aReflowInput,
const WritingMode& aWM,
const LogicalPoint& aPos,
const nsSize& aContainerSize,
@ -1176,7 +1176,7 @@ nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame,
}
}
aKidFrame->DidReflow(aPresContext, aReflowState, nsDidReflowStatus::FINISHED);
aKidFrame->DidReflow(aPresContext, aReflowInput, nsDidReflowStatus::FINISHED);
}
//XXX temporary: hold on to a copy of the old physical version of
@ -1185,7 +1185,7 @@ void
nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame,
nsPresContext* aPresContext,
const ReflowOutput& aDesiredSize,
const ReflowInput* aReflowState,
const ReflowInput* aReflowInput,
nscoord aX,
nscoord aY,
uint32_t aFlags)
@ -1215,12 +1215,12 @@ nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame,
}
}
aKidFrame->DidReflow(aPresContext, aReflowState, nsDidReflowStatus::FINISHED);
aKidFrame->DidReflow(aPresContext, aReflowInput, nsDidReflowStatus::FINISHED);
}
void
nsContainerFrame::ReflowOverflowContainerChildren(nsPresContext* aPresContext,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsOverflowAreas& aOverflowRects,
uint32_t aFlags,
nsReflowStatus& aStatus,
@ -1234,7 +1234,7 @@ nsContainerFrame::ReflowOverflowContainerChildren(nsPresContext* aPres
}
nsOverflowContinuationTracker tracker(this, false, false);
bool shouldReflowAllKids = aReflowState.ShouldReflowAllKids();
bool shouldReflowAllKids = aReflowInput.ShouldReflowAllKids();
for (nsIFrame* frame : *overflowContainers) {
if (frame->GetPrevInFlow()->GetParent() != GetPrevInFlow()) {
@ -1252,14 +1252,14 @@ nsContainerFrame::ReflowOverflowContainerChildren(nsPresContext* aPres
NS_ASSERTION(frame->GetStateBits() & NS_FRAME_IS_OVERFLOW_CONTAINER,
"overflow container frame must have overflow container bit set");
WritingMode wm = frame->GetWritingMode();
nsSize containerSize = aReflowState.AvailableSize(wm).GetPhysicalSize(wm);
nsSize containerSize = aReflowInput.AvailableSize(wm).GetPhysicalSize(wm);
LogicalRect prevRect = prevInFlow->GetLogicalRect(wm, containerSize);
// Initialize reflow params
LogicalSize availSpace(wm, prevRect.ISize(wm),
aReflowState.AvailableSize(wm).BSize(wm));
ReflowOutput desiredSize(aReflowState);
ReflowInput frameState(aPresContext, aReflowState,
aReflowInput.AvailableSize(wm).BSize(wm));
ReflowOutput desiredSize(aReflowInput);
ReflowInput frameState(aPresContext, aReflowInput,
frame, availSpace);
nsReflowStatus frameStatus;
@ -1309,10 +1309,10 @@ nsContainerFrame::ReflowOverflowContainerChildren(nsPresContext* aPres
}
else {
tracker.Skip(frame, aStatus);
if (aReflowState.mFloatManager) {
nsBlockFrame::RecoverFloatsFor(frame, *aReflowState.mFloatManager,
aReflowState.GetWritingMode(),
aReflowState.ComputedPhysicalSize());
if (aReflowInput.mFloatManager) {
nsBlockFrame::RecoverFloatsFor(frame, *aReflowInput.mFloatManager,
aReflowInput.GetWritingMode(),
aReflowInput.ComputedPhysicalSize());
}
}
ConsiderChildOverflow(aOverflowRects, frame);

Просмотреть файл

@ -255,7 +255,7 @@ public:
void ReflowChild(nsIFrame* aChildFrame,
nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
const mozilla::WritingMode& aWM,
const mozilla::LogicalPoint& aPos,
const nsSize& aContainerSize,
@ -285,7 +285,7 @@ public:
static void FinishReflowChild(nsIFrame* aKidFrame,
nsPresContext* aPresContext,
const ReflowOutput& aDesiredSize,
const ReflowInput* aReflowState,
const ReflowInput* aReflowInput,
const mozilla::WritingMode& aWM,
const mozilla::LogicalPoint& aPos,
const nsSize& aContainerSize,
@ -297,7 +297,7 @@ public:
void ReflowChild(nsIFrame* aKidFrame,
nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nscoord aX,
nscoord aY,
uint32_t aFlags,
@ -307,7 +307,7 @@ public:
static void FinishReflowChild(nsIFrame* aKidFrame,
nsPresContext* aPresContext,
const ReflowOutput& aDesiredSize,
const ReflowInput* aReflowState,
const ReflowInput* aReflowInput,
nscoord aX,
nscoord aY,
uint32_t aFlags);
@ -388,7 +388,7 @@ public:
* @param aMergeFunc is passed to DrainExcessOverflowContainersList
*/
void ReflowOverflowContainerChildren(nsPresContext* aPresContext,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsOverflowAreas& aOverflowRects,
uint32_t aFlags,
nsReflowStatus& aStatus,

Просмотреть файл

@ -164,12 +164,12 @@ nsFirstLetterFrame::ComputeSize(nsRenderingContext *aRenderingContext,
void
nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aMetrics,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aReflowStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsFirstLetterFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aReflowStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aMetrics, aReflowStatus);
// Grab overflow list
DrainOverflowFrames(aPresContext);
@ -177,9 +177,9 @@ nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,
nsIFrame* kid = mFrames.FirstChild();
// Setup reflow state for our child
WritingMode wm = aReflowState.GetWritingMode();
LogicalSize availSize = aReflowState.AvailableSize();
const LogicalMargin& bp = aReflowState.ComputedLogicalBorderPadding();
WritingMode wm = aReflowInput.GetWritingMode();
LogicalSize availSize = aReflowInput.AvailableSize();
const LogicalMargin& bp = aReflowInput.ComputedLogicalBorderPadding();
NS_ASSERTION(availSize.ISize(wm) != NS_UNCONSTRAINEDSIZE,
"should no longer use unconstrained inline size");
availSize.ISize(wm) -= bp.IStartEnd(wm);
@ -191,20 +191,20 @@ nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput kidMetrics(lineWM);
// Reflow the child
if (!aReflowState.mLineLayout) {
if (!aReflowInput.mLineLayout) {
// When there is no lineLayout provided, we provide our own. The
// only time that the first-letter-frame is not reflowing in a
// line context is when its floating.
WritingMode kidWritingMode = GetWritingMode(kid);
LogicalSize kidAvailSize = availSize.ConvertTo(kidWritingMode, wm);
ReflowInput rs(aPresContext, aReflowState, kid, kidAvailSize);
nsLineLayout ll(aPresContext, nullptr, &aReflowState, nullptr, nullptr);
ReflowInput rs(aPresContext, aReflowInput, kid, kidAvailSize);
nsLineLayout ll(aPresContext, nullptr, &aReflowInput, nullptr, nullptr);
ll.BeginLineReflow(bp.IStart(wm), bp.BStart(wm),
availSize.ISize(wm), NS_UNCONSTRAINEDSIZE,
false, true, kidWritingMode,
nsSize(aReflowState.AvailableWidth(),
aReflowState.AvailableHeight()));
nsSize(aReflowInput.AvailableWidth(),
aReflowInput.AvailableHeight()));
rs.mLineLayout = &ll;
ll.SetInFirstLetter(true);
ll.SetFirstLetterStyleOK(true);
@ -242,12 +242,12 @@ nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,
}
else {
// Pretend we are a span and reflow the child frame
nsLineLayout* ll = aReflowState.mLineLayout;
nsLineLayout* ll = aReflowInput.mLineLayout;
bool pushedFrame;
ll->SetInFirstLetter(
mStyleContext->GetPseudo() == nsCSSPseudoElements::firstLetter);
ll->BeginSpan(this, &aReflowState, bp.IStart(wm),
ll->BeginSpan(this, &aReflowInput, bp.IStart(wm),
availSize.ISize(wm), &mBaseline);
ll->ReflowFrame(kid, aReflowStatus, &kidMetrics, pushedFrame);
NS_ASSERTION(lineWM.IsVertical() == wm.IsVertical(),
@ -264,8 +264,8 @@ nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,
// Create a continuation or remove existing continuations based on
// the reflow completion status.
if (NS_FRAME_IS_COMPLETE(aReflowStatus)) {
if (aReflowState.mLineLayout) {
aReflowState.mLineLayout->SetFirstLetterStyleOK(false);
if (aReflowInput.mLineLayout) {
aReflowInput.mLineLayout->SetFirstLetterStyleOK(false);
}
nsIFrame* kidNextInFlow = kid->GetNextInFlow();
if (kidNextInFlow) {
@ -294,7 +294,7 @@ nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,
}
}
NS_FRAME_SET_TRUNCATION(aReflowStatus, aReflowState, aMetrics);
NS_FRAME_SET_TRUNCATION(aReflowStatus, aReflowInput, aMetrics);
}
/* virtual */ bool
@ -398,7 +398,7 @@ nsFirstLetterFrame::GetLogicalBaseline(WritingMode aWritingMode) const
}
nsIFrame::LogicalSides
nsFirstLetterFrame::GetLogicalSkipSides(const ReflowInput* aReflowState) const
nsFirstLetterFrame::GetLogicalSkipSides(const ReflowInput* aReflowInput) const
{
if (GetPrevContinuation()) {
// We shouldn't get calls to GetSkipSides for later continuations since

Просмотреть файл

@ -62,12 +62,12 @@ public:
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual bool CanContinueTextRun() const override;
virtual nscoord GetLogicalBaseline(mozilla::WritingMode aWritingMode) const override;
virtual LogicalSides GetLogicalSkipSides(const ReflowInput* aReflowState = nullptr) const override;
virtual LogicalSides GetLogicalSkipSides(const ReflowInput* aReflowInput = nullptr) const override;
//override of nsFrame method
virtual nsresult GetChildFrameContainingOffset(int32_t inContentOffset,

Просмотреть файл

@ -410,7 +410,7 @@ class nsFlexContainerFrame::FlexItem : public LinkedListElement<FlexItem>
{
public:
// Normal constructor:
FlexItem(ReflowInput& aFlexItemReflowState,
FlexItem(ReflowInput& aFlexItemReflowInput,
float aFlexGrow, float aFlexShrink, nscoord aMainBaseSize,
nscoord aMainMinSize, nscoord aMainMaxSize,
nscoord aTentativeCrossSize,
@ -744,7 +744,7 @@ public:
protected:
// Helper called by the constructor, to set mNeedsMinSizeAutoResolution:
void CheckForMinSizeAuto(const ReflowInput& aFlexItemReflowState,
void CheckForMinSizeAuto(const ReflowInput& aFlexItemReflowInput,
const FlexboxAxisTracker& aAxisTracker);
// Our frame:
@ -1181,20 +1181,20 @@ UniquePtr<FlexItem>
nsFlexContainerFrame::GenerateFlexItemForChild(
nsPresContext* aPresContext,
nsIFrame* aChildFrame,
const ReflowInput& aParentReflowState,
const ReflowInput& aParentReflowInput,
const FlexboxAxisTracker& aAxisTracker)
{
// Create temporary reflow state just for sizing -- to get hypothetical
// main-size and the computed values of min / max main-size property.
// (This reflow state will _not_ be used for reflow.)
ReflowInput
childRS(aPresContext, aParentReflowState, aChildFrame,
aParentReflowState.ComputedSize(aChildFrame->GetWritingMode()));
childRS(aPresContext, aParentReflowInput, aChildFrame,
aParentReflowInput.ComputedSize(aChildFrame->GetWritingMode()));
// FLEX GROW & SHRINK WEIGHTS
// --------------------------
float flexGrow, flexShrink;
if (IsLegacyBox(aParentReflowState.mStyleDisplay, mStyleContext)) {
if (IsLegacyBox(aParentReflowInput.mStyleDisplay, mStyleContext)) {
flexGrow = flexShrink = aChildFrame->StyleXUL()->mBoxFlex;
} else {
const nsStylePosition* stylePos = aChildFrame->StylePosition();
@ -1314,16 +1314,16 @@ nsFlexContainerFrame::GenerateFlexItemForChild(
// The logic here should be similar to the logic for isAutoWidth/isAutoHeight
// in nsLayoutUtils::ComputeSizeWithIntrinsicDimensions().
static bool
IsCrossSizeDefinite(const ReflowInput& aItemReflowState,
IsCrossSizeDefinite(const ReflowInput& aItemReflowInput,
const FlexboxAxisTracker& aAxisTracker)
{
const nsStylePosition* pos = aItemReflowState.mStylePosition;
const nsStylePosition* pos = aItemReflowInput.mStylePosition;
if (aAxisTracker.IsCrossAxisHorizontal()) {
return pos->mWidth.GetUnit() != eStyleUnit_Auto;
}
// else, vertical. (We need to use IsAutoHeight() to catch e.g. %-height
// applied to indefinite-height containing block, which counts as auto.)
nscoord cbHeight = aItemReflowState.mCBReflowState->ComputedHeight();
nscoord cbHeight = aItemReflowInput.mCBReflowInput->ComputedHeight();
return !nsLayoutUtils::IsAutoHeight(pos->mHeight, cbHeight);
}
@ -1342,7 +1342,7 @@ IsCrossSizeDefinite(const ReflowInput& aItemReflowState,
// If my understanding there ends up being wrong, we'll need to update this.
static nscoord
CrossSizeToUseWithRatio(const FlexItem& aFlexItem,
const ReflowInput& aItemReflowState,
const ReflowInput& aItemReflowInput,
bool aMinSizeFallback,
const FlexboxAxisTracker& aAxisTracker)
{
@ -1351,19 +1351,19 @@ CrossSizeToUseWithRatio(const FlexItem& aFlexItem,
return aFlexItem.GetCrossSize();
}
if (IsCrossSizeDefinite(aItemReflowState, aAxisTracker)) {
if (IsCrossSizeDefinite(aItemReflowInput, aAxisTracker)) {
// Definite cross size.
return GET_CROSS_COMPONENT_LOGICAL(aAxisTracker, aFlexItem.GetWritingMode(),
aItemReflowState.ComputedISize(),
aItemReflowState.ComputedBSize());
aItemReflowInput.ComputedISize(),
aItemReflowInput.ComputedBSize());
}
if (aMinSizeFallback) {
// Indefinite cross-size, and we're resolving main min-size, so we'll fall
// back to ussing the cross min-size (which should be definite).
return GET_CROSS_COMPONENT_LOGICAL(aAxisTracker, aFlexItem.GetWritingMode(),
aItemReflowState.ComputedMinISize(),
aItemReflowState.ComputedMinBSize());
aItemReflowInput.ComputedMinISize(),
aItemReflowInput.ComputedMinBSize());
}
// Indefinite cross-size.
@ -1398,7 +1398,7 @@ MainSizeFromAspectRatio(nscoord aCrossSize,
// Spec reference: http://dev.w3.org/csswg/css-flexbox/#min-size-auto
static nscoord
PartiallyResolveAutoMinSize(const FlexItem& aFlexItem,
const ReflowInput& aItemReflowState,
const ReflowInput& aItemReflowInput,
const FlexboxAxisTracker& aAxisTracker)
{
MOZ_ASSERT(aFlexItem.NeedsMinSizeAutoResolution(),
@ -1411,7 +1411,7 @@ PartiallyResolveAutoMinSize(const FlexItem& aFlexItem,
// * the used flex-basis, if the computed flex-basis was 'auto':
// XXXdholbert ('auto' might be renamed to 'main-size'; see bug 1032922)
if (eStyleUnit_Auto ==
aItemReflowState.mStylePosition->mFlexBasis.GetUnit() &&
aItemReflowInput.mStylePosition->mFlexBasis.GetUnit() &&
aFlexItem.GetFlexBaseSize() != NS_AUTOHEIGHT) {
// NOTE: We skip this if the flex base size depends on content & isn't yet
// resolved. This is OK, because the caller is responsible for computing
@ -1423,8 +1423,8 @@ PartiallyResolveAutoMinSize(const FlexItem& aFlexItem,
// * the computed max-width (max-height), if that value is definite:
nscoord maxSize =
GET_MAIN_COMPONENT_LOGICAL(aAxisTracker, aFlexItem.GetWritingMode(),
aItemReflowState.ComputedMaxISize(),
aItemReflowState.ComputedMaxBSize());
aItemReflowInput.ComputedMaxISize(),
aItemReflowInput.ComputedMaxBSize());
if (maxSize != NS_UNCONSTRAINEDSIZE) {
minMainSize = std::min(minMainSize, maxSize);
}
@ -1439,7 +1439,7 @@ PartiallyResolveAutoMinSize(const FlexItem& aFlexItem,
// We have a usable aspect ratio. (not going to divide by 0)
const bool useMinSizeIfCrossSizeIsIndefinite = true;
nscoord crossSizeToUseWithRatio =
CrossSizeToUseWithRatio(aFlexItem, aItemReflowState,
CrossSizeToUseWithRatio(aFlexItem, aItemReflowInput,
useMinSizeIfCrossSizeIsIndefinite,
aAxisTracker);
nscoord minMainSizeFromRatio =
@ -1457,7 +1457,7 @@ PartiallyResolveAutoMinSize(const FlexItem& aFlexItem,
// the cross-size is indefinite), returns false.
static bool
ResolveAutoFlexBasisFromRatio(FlexItem& aFlexItem,
const ReflowInput& aItemReflowState,
const ReflowInput& aItemReflowInput,
const FlexboxAxisTracker& aAxisTracker)
{
MOZ_ASSERT(NS_AUTOHEIGHT == aFlexItem.GetFlexBaseSize(),
@ -1472,7 +1472,7 @@ ResolveAutoFlexBasisFromRatio(FlexItem& aFlexItem,
// We have a usable aspect ratio. (not going to divide by 0)
const bool useMinSizeIfCrossSizeIsIndefinite = false;
nscoord crossSizeToUseWithRatio =
CrossSizeToUseWithRatio(aFlexItem, aItemReflowState,
CrossSizeToUseWithRatio(aFlexItem, aItemReflowInput,
useMinSizeIfCrossSizeIsIndefinite,
aAxisTracker);
if (crossSizeToUseWithRatio != NS_AUTOHEIGHT) {
@ -1493,7 +1493,7 @@ void
nsFlexContainerFrame::
ResolveAutoFlexBasisAndMinSize(nsPresContext* aPresContext,
FlexItem& aFlexItem,
const ReflowInput& aItemReflowState,
const ReflowInput& aItemReflowInput,
const FlexboxAxisTracker& aAxisTracker)
{
// (Note: We should never have a used flex-basis of "auto" if our main axis
@ -1518,7 +1518,7 @@ nsFlexContainerFrame::
// have a single-line (nowrap) flex container which itself has a definite
// cross-size. Otherwise, we'll wait to do stretching, since (in other
// cases) we don't know how much the item should stretch yet.
const ReflowInput* flexContainerRS = aItemReflowState.mParentReflowState;
const ReflowInput* flexContainerRS = aItemReflowInput.mParentReflowInput;
MOZ_ASSERT(flexContainerRS,
"flex item's reflow state should have ptr to container's state");
if (NS_STYLE_FLEX_WRAP_NOWRAP == flexContainerRS->mStylePosition->mFlexWrap) {
@ -1542,7 +1542,7 @@ nsFlexContainerFrame::
if (isMainMinSizeAuto) {
// Resolve the min-size, except for considering the min-content size.
// (We'll consider that later, if we need to.)
resolvedMinSize = PartiallyResolveAutoMinSize(aFlexItem, aItemReflowState,
resolvedMinSize = PartiallyResolveAutoMinSize(aFlexItem, aItemReflowInput,
aAxisTracker);
if (resolvedMinSize > 0 &&
aAxisTracker.GetCrossComponent(aFlexItem.IntrinsicRatio()) == 0) {
@ -1557,7 +1557,7 @@ nsFlexContainerFrame::
bool flexBasisNeedsToMeasureContent = false; // assume the best
if (isMainSizeAuto) {
if (!ResolveAutoFlexBasisFromRatio(aFlexItem, aItemReflowState,
if (!ResolveAutoFlexBasisFromRatio(aFlexItem, aItemReflowInput,
aAxisTracker)) {
flexBasisNeedsToMeasureContent = true;
}
@ -1568,7 +1568,7 @@ nsFlexContainerFrame::
if (aAxisTracker.IsMainAxisHorizontal()) {
if (minSizeNeedsToMeasureContent) {
nscoord frameMinISize =
aFlexItem.Frame()->GetMinISize(aItemReflowState.mRenderingContext);
aFlexItem.Frame()->GetMinISize(aItemReflowInput.mRenderingContext);
resolvedMinSize = std::min(resolvedMinSize, frameMinISize);
}
NS_ASSERTION(!flexBasisNeedsToMeasureContent,
@ -1614,14 +1614,14 @@ nsFlexContainerFrame::
MeasureFlexItemContentHeight(nsPresContext* aPresContext,
FlexItem& aFlexItem,
bool aForceVerticalResizeForMeasuringReflow,
const ReflowInput& aParentReflowState)
const ReflowInput& aParentReflowInput)
{
// Set up a reflow state for measuring the flex item's auto-height:
WritingMode wm = aFlexItem.Frame()->GetWritingMode();
LogicalSize availSize = aParentReflowState.ComputedSize(wm);
LogicalSize availSize = aParentReflowInput.ComputedSize(wm);
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
ReflowInput
childRSForMeasuringHeight(aPresContext, aParentReflowState,
childRSForMeasuringHeight(aPresContext, aParentReflowInput,
aFlexItem.Frame(), availSize,
nullptr, ReflowInput::CALLER_WILL_INIT);
childRSForMeasuringHeight.mFlags.mIsFlexContainerMeasuringHeight = true;
@ -1669,18 +1669,18 @@ nsFlexContainerFrame::
return std::max(0, childDesiredHeight);
}
FlexItem::FlexItem(ReflowInput& aFlexItemReflowState,
FlexItem::FlexItem(ReflowInput& aFlexItemReflowInput,
float aFlexGrow, float aFlexShrink, nscoord aFlexBaseSize,
nscoord aMainMinSize, nscoord aMainMaxSize,
nscoord aTentativeCrossSize,
nscoord aCrossMinSize, nscoord aCrossMaxSize,
const FlexboxAxisTracker& aAxisTracker)
: mFrame(aFlexItemReflowState.mFrame),
: mFrame(aFlexItemReflowInput.mFrame),
mFlexGrow(aFlexGrow),
mFlexShrink(aFlexShrink),
mIntrinsicRatio(mFrame->GetIntrinsicRatio()),
mBorderPadding(aFlexItemReflowState.ComputedPhysicalBorderPadding()),
mMargin(aFlexItemReflowState.ComputedPhysicalMargin()),
mBorderPadding(aFlexItemReflowInput.ComputedPhysicalBorderPadding()),
mMargin(aFlexItemReflowInput.ComputedPhysicalMargin()),
mMainMinSize(aMainMinSize),
mMainMaxSize(aMainMaxSize),
mCrossMinSize(aCrossMinSize),
@ -1697,7 +1697,7 @@ FlexItem::FlexItem(ReflowInput& aFlexItemReflowState,
mIsStretched(false),
mIsStrut(false),
// mNeedsMinSizeAutoResolution is initialized in CheckForMinSizeAuto()
mWM(aFlexItemReflowState.GetWritingMode())
mWM(aFlexItemReflowInput.GetWritingMode())
// mAlignSelf, see below
{
MOZ_ASSERT(mFrame, "expecting a non-null child frame");
@ -1706,7 +1706,7 @@ FlexItem::FlexItem(ReflowInput& aFlexItemReflowState,
MOZ_ASSERT(!(mFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW),
"out-of-flow frames should not be treated as flex items");
const ReflowInput* containerRS = aFlexItemReflowState.mParentReflowState;
const ReflowInput* containerRS = aFlexItemReflowInput.mParentReflowInput;
if (IsLegacyBox(containerRS->mStyleDisplay,
containerRS->mFrame->StyleContext())) {
// For -webkit-box/-webkit-inline-box, we need to:
@ -1719,7 +1719,7 @@ FlexItem::FlexItem(ReflowInput& aFlexItemReflowState,
const nsStyleXUL* containerStyleXUL = containerRS->mFrame->StyleXUL();
mAlignSelf = ConvertLegacyStyleToAlignItems(containerStyleXUL);
} else {
mAlignSelf = aFlexItemReflowState.mStylePosition->ComputedAlignSelf(
mAlignSelf = aFlexItemReflowInput.mStylePosition->ComputedAlignSelf(
mFrame->StyleContext()->GetParent());
if (MOZ_LIKELY(mAlignSelf == NS_STYLE_ALIGN_NORMAL)) {
mAlignSelf = NS_STYLE_ALIGN_STRETCH;
@ -1730,14 +1730,14 @@ FlexItem::FlexItem(ReflowInput& aFlexItemReflowState,
}
SetFlexBaseSizeAndMainSize(aFlexBaseSize);
CheckForMinSizeAuto(aFlexItemReflowState, aAxisTracker);
CheckForMinSizeAuto(aFlexItemReflowInput, aAxisTracker);
// Assert that any "auto" margin components are set to 0.
// (We'll resolve them later; until then, we want to treat them as 0-sized.)
#ifdef DEBUG
{
const nsStyleSides& styleMargin =
aFlexItemReflowState.mStyleMargin->mMargin;
aFlexItemReflowInput.mStyleMargin->mMargin;
NS_FOR_CSS_SIDES(side) {
if (styleMargin.GetUnit(side) == eStyleUnit_Auto) {
MOZ_ASSERT(GetMarginComponentForSide(side) == 0,
@ -1806,11 +1806,11 @@ FlexItem::FlexItem(nsIFrame* aChildFrame, nscoord aCrossSize,
}
void
FlexItem::CheckForMinSizeAuto(const ReflowInput& aFlexItemReflowState,
FlexItem::CheckForMinSizeAuto(const ReflowInput& aFlexItemReflowInput,
const FlexboxAxisTracker& aAxisTracker)
{
const nsStylePosition* pos = aFlexItemReflowState.mStylePosition;
const nsStyleDisplay* disp = aFlexItemReflowState.mStyleDisplay;
const nsStylePosition* pos = aFlexItemReflowInput.mStylePosition;
const nsStyleDisplay* disp = aFlexItemReflowInput.mStyleDisplay;
// We'll need special behavior for "min-[width|height]:auto" (whichever is in
// the main axis) iff:
@ -3363,7 +3363,7 @@ AddNewFlexLineToList(LinkedList<FlexLine>& aLines,
void
nsFlexContainerFrame::GenerateFlexLines(
nsPresContext* aPresContext,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nscoord aContentBoxMainSize,
nscoord aAvailableBSizeForContent,
const nsTArray<StrutInfo>& aStruts,
@ -3373,7 +3373,7 @@ nsFlexContainerFrame::GenerateFlexLines(
MOZ_ASSERT(aLines.isEmpty(), "Expecting outparam to start out empty");
const bool isSingleLine =
NS_STYLE_FLEX_WRAP_NOWRAP == aReflowState.mStylePosition->mFlexWrap;
NS_STYLE_FLEX_WRAP_NOWRAP == aReflowInput.mStylePosition->mFlexWrap;
// If we're transparently reversing axes, then we'll need to link up our
// FlexItems and FlexLines in the reverse order, so that the rest of flex
@ -3401,8 +3401,8 @@ nsFlexContainerFrame::GenerateFlexLines(
if (wrapThreshold == NS_UNCONSTRAINEDSIZE) {
const nscoord flexContainerMaxMainSize =
GET_MAIN_COMPONENT_LOGICAL(aAxisTracker, aAxisTracker.GetWritingMode(),
aReflowState.ComputedMaxISize(),
aReflowState.ComputedMaxBSize());
aReflowInput.ComputedMaxISize(),
aReflowInput.ComputedMaxBSize());
wrapThreshold = flexContainerMaxMainSize;
}
@ -3437,11 +3437,11 @@ nsFlexContainerFrame::GenerateFlexLines(
// Use the simplified "strut" FlexItem constructor:
item = MakeUnique<FlexItem>(childFrame, aStruts[nextStrutIdx].mStrutCrossSize,
aReflowState.GetWritingMode());
aReflowInput.GetWritingMode());
nextStrutIdx++;
} else {
item = GenerateFlexItemForChild(aPresContext, childFrame,
aReflowState, aAxisTracker);
aReflowInput, aAxisTracker);
}
nscoord itemInnerHypotheticalMainSize = item->GetMainSize();
@ -3477,8 +3477,8 @@ nsFlexContainerFrame::GenerateFlexLines(
// reflow state (specifically, the main-size of *this continuation* of the
// flex container).
nscoord
nsFlexContainerFrame::GetMainSizeFromReflowState(
const ReflowInput& aReflowState,
nsFlexContainerFrame::GetMainSizeFromReflowInput(
const ReflowInput& aReflowInput,
const FlexboxAxisTracker& aAxisTracker)
{
if (aAxisTracker.IsRowOriented()) {
@ -3487,15 +3487,15 @@ nsFlexContainerFrame::GetMainSizeFromReflowState(
// XXXdholbert ISize may be (wrongly) unconstrained right now: bug 1163238
// Uncomment when that's fixed:
/*
NS_WARN_IF_FALSE(aReflowState.ComputedISize() != NS_UNCONSTRAINEDSIZE,
NS_WARN_IF_FALSE(aReflowInput.ComputedISize() != NS_UNCONSTRAINEDSIZE,
"Unconstrained inline size; this should only result from "
"huge sizes (not intrinsic sizing w/ orthogonal flows)");
*/
return aReflowState.ComputedISize();
return aReflowInput.ComputedISize();
}
// Note: This may be unconstrained, if our block size is "auto":
return GetEffectiveComputedBSize(aReflowState);
return GetEffectiveComputedBSize(aReflowInput);
}
// Returns the largest outer hypothetical main-size of any line in |aLines|.
@ -3521,14 +3521,14 @@ GetLargestLineMainSize(const FlexLine* aFirstLine)
* Guaranteed to return a definite length, i.e. not NS_UNCONSTRAINEDSIZE,
* aside from cases with huge lengths which happen to compute to that value.
* XXXdholbert (this^ isn't quite true, if we're row-oriented and in an
* orthogonal flow, per mentions of bug 1163238 in GetMainSizeFromReflowState.)
* orthogonal flow, per mentions of bug 1163238 in GetMainSizeFromReflowInput.)
*
* (Note: This function should be structurally similar to 'ComputeCrossSize()',
* except that here, the caller has already grabbed the tentative size from the
* reflow state.)
*/
static nscoord
ResolveFlexContainerMainSize(const ReflowInput& aReflowState,
ResolveFlexContainerMainSize(const ReflowInput& aReflowInput,
const FlexboxAxisTracker& aAxisTracker,
nscoord aTentativeMainSize,
nscoord aAvailableBSizeForContent,
@ -3576,12 +3576,12 @@ ResolveFlexContainerMainSize(const ReflowInput& aReflowState,
// XXXdholbert Handle constrained-aAvailableBSizeForContent case here.
nscoord largestLineOuterSize = GetLargestLineMainSize(aFirstLine);
return NS_CSS_MINMAX(largestLineOuterSize,
aReflowState.ComputedMinBSize(),
aReflowState.ComputedMaxBSize());
aReflowInput.ComputedMinBSize(),
aReflowInput.ComputedMaxBSize());
}
nscoord
nsFlexContainerFrame::ComputeCrossSize(const ReflowInput& aReflowState,
nsFlexContainerFrame::ComputeCrossSize(const ReflowInput& aReflowInput,
const FlexboxAxisTracker& aAxisTracker,
nscoord aSumLineCrossSizes,
nscoord aAvailableBSizeForContent,
@ -3596,15 +3596,15 @@ nsFlexContainerFrame::ComputeCrossSize(const ReflowInput& aReflowState,
// XXXdholbert ISize may be (wrongly) unconstrained right now: bug 1163238.
// Uncomment when that's fixed:
/*
NS_WARN_IF_FALSE(aReflowState.ComputedISize() != NS_UNCONSTRAINEDSIZE,
NS_WARN_IF_FALSE(aReflowInput.ComputedISize() != NS_UNCONSTRAINEDSIZE,
"Unconstrained inline size; this should only result from "
"huge sizes (not intrinsic sizing w/ orthogonal flows)");
*/
*aIsDefinite = true;
return aReflowState.ComputedISize();
return aReflowInput.ComputedISize();
}
nscoord effectiveComputedBSize = GetEffectiveComputedBSize(aReflowState);
nscoord effectiveComputedBSize = GetEffectiveComputedBSize(aReflowInput);
if (effectiveComputedBSize != NS_INTRINSICSIZE) {
// Row-oriented case (cross axis is block-axis), with fixed BSize:
*aIsDefinite = true;
@ -3637,8 +3637,8 @@ nsFlexContainerFrame::ComputeCrossSize(const ReflowInput& aReflowState,
// XXXdholbert Handle constrained-aAvailableBSizeForContent case here.
*aIsDefinite = false;
return NS_CSS_MINMAX(aSumLineCrossSizes,
aReflowState.ComputedMinBSize(),
aReflowState.ComputedMaxBSize());
aReflowInput.ComputedMinBSize(),
aReflowInput.ComputedMaxBSize());
}
void
@ -3680,10 +3680,10 @@ static nscoord
ComputePhysicalAscentFromFlexRelativeAscent(
nscoord aFlexRelativeAscent,
nscoord aContentBoxCrossSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
const FlexboxAxisTracker& aAxisTracker)
{
return aReflowState.ComputedPhysicalBorderPadding().top +
return aReflowInput.ComputedPhysicalBorderPadding().top +
PhysicalCoordFromFlexRelativeCoord(aFlexRelativeAscent,
aContentBoxCrossSize,
aAxisTracker.GetCrossAxis());
@ -3693,7 +3693,7 @@ void
nsFlexContainerFrame::SizeItemInCrossAxis(
nsPresContext* aPresContext,
const FlexboxAxisTracker& aAxisTracker,
ReflowInput& aChildReflowState,
ReflowInput& aChildReflowInput,
FlexItem& aItem)
{
if (aAxisTracker.IsCrossAxisHorizontal()) {
@ -3708,7 +3708,7 @@ nsFlexContainerFrame::SizeItemInCrossAxis(
// For now, we only expect to get here for items with an intrinsic aspect
// ratio; and for those items, we can just read the size off of the reflow
// state, without performing reflow.
aItem.SetCrossSize(aChildReflowState.ComputedWidth());
aItem.SetCrossSize(aChildReflowInput.ComputedWidth());
return;
}
@ -3721,13 +3721,13 @@ nsFlexContainerFrame::SizeItemInCrossAxis(
// not imposing that height for *this* measuring reflow, so we need to
// tell it to treat this reflow as a vertical resize (regardless of
// whether any of its ancestors are being resized).
aChildReflowState.SetVResize(true);
aChildReflowInput.SetVResize(true);
}
ReflowOutput childDesiredSize(aChildReflowState);
ReflowOutput childDesiredSize(aChildReflowInput);
nsReflowStatus childReflowStatus;
const uint32_t flags = NS_FRAME_NO_MOVE_FRAME;
ReflowChild(aItem.Frame(), aPresContext,
childDesiredSize, aChildReflowState,
childDesiredSize, aChildReflowInput,
0, 0, flags, childReflowStatus);
aItem.SetHadMeasuringReflow();
@ -3741,7 +3741,7 @@ nsFlexContainerFrame::SizeItemInCrossAxis(
// Tell the child we're done with its initial reflow.
// (Necessary for e.g. GetBaseline() to work below w/out asserting)
FinishReflowChild(aItem.Frame(), aPresContext,
childDesiredSize, &aChildReflowState, 0, 0, flags);
childDesiredSize, &aChildReflowInput, 0, 0, flags);
// Save the sizing info that we learned from this reflow
// -----------------------------------------------------
@ -3808,16 +3808,16 @@ FlexLine::PositionItemsInCrossAxis(nscoord aLineStartPosition,
void
nsFlexContainerFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsFlexContainerFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
MOZ_LOG(gFlexContainerLog, LogLevel::Debug,
("Reflow() for nsFlexContainerFrame %p\n", this));
if (IsFrameTreeTooDeep(aReflowState, aDesiredSize, aStatus)) {
if (IsFrameTreeTooDeep(aReflowInput, aDesiredSize, aStatus)) {
return;
}
@ -3826,7 +3826,7 @@ nsFlexContainerFrame::Reflow(nsPresContext* aPresContext,
// set and have block-size:auto. (There are actually other cases, too -- e.g. if
// our parent is itself a block-dir flex container and we're flexible -- but
// we'll let our ancestors handle those sorts of cases.)
WritingMode wm = aReflowState.GetWritingMode();
WritingMode wm = aReflowInput.GetWritingMode();
const nsStylePosition* stylePos = StylePosition();
const nsStyleCoord& bsize = stylePos->BSize(wm);
if (bsize.HasPercent() ||
@ -3855,32 +3855,32 @@ nsFlexContainerFrame::Reflow(nsPresContext* aPresContext,
SortChildrenIfNeeded<IsOrderLEQWithDOMFallback>();
}
const FlexboxAxisTracker axisTracker(this, aReflowState.GetWritingMode());
const FlexboxAxisTracker axisTracker(this, aReflowInput.GetWritingMode());
// If we're being fragmented into a constrained BSize, then subtract off
// borderpadding BStart from that constrained BSize, to get the available
// BSize for our content box. (No need to subtract the borderpadding BStart
// if we're already skipping it via GetLogicalSkipSides, though.)
nscoord availableBSizeForContent = aReflowState.AvailableBSize();
nscoord availableBSizeForContent = aReflowInput.AvailableBSize();
if (availableBSizeForContent != NS_UNCONSTRAINEDSIZE &&
!(GetLogicalSkipSides(&aReflowState).BStart())) {
!(GetLogicalSkipSides(&aReflowInput).BStart())) {
availableBSizeForContent -=
aReflowState.ComputedLogicalBorderPadding().BStart(wm);
aReflowInput.ComputedLogicalBorderPadding().BStart(wm);
// (Don't let that push availableBSizeForContent below zero, though):
availableBSizeForContent = std::max(availableBSizeForContent, 0);
}
nscoord contentBoxMainSize = GetMainSizeFromReflowState(aReflowState,
nscoord contentBoxMainSize = GetMainSizeFromReflowInput(aReflowInput,
axisTracker);
AutoTArray<StrutInfo, 1> struts;
DoFlexLayout(aPresContext, aDesiredSize, aReflowState, aStatus,
DoFlexLayout(aPresContext, aDesiredSize, aReflowInput, aStatus,
contentBoxMainSize, availableBSizeForContent,
struts, axisTracker);
if (!struts.IsEmpty()) {
// We're restarting flex layout, with new knowledge of collapsed items.
DoFlexLayout(aPresContext, aDesiredSize, aReflowState, aStatus,
DoFlexLayout(aPresContext, aDesiredSize, aReflowInput, aStatus,
contentBoxMainSize, availableBSizeForContent,
struts, axisTracker);
}
@ -3951,7 +3951,7 @@ private:
void
nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus,
nscoord aContentBoxMainSize,
nscoord aAvailableBSizeForContent,
@ -3963,13 +3963,13 @@ nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext,
LinkedList<FlexLine> lines;
AutoFlexLineListClearer cleanupLines(lines);
GenerateFlexLines(aPresContext, aReflowState,
GenerateFlexLines(aPresContext, aReflowInput,
aContentBoxMainSize,
aAvailableBSizeForContent,
aStruts, aAxisTracker, lines);
aContentBoxMainSize =
ResolveFlexContainerMainSize(aReflowState, aAxisTracker,
ResolveFlexContainerMainSize(aReflowInput, aAxisTracker,
aContentBoxMainSize, aAvailableBSizeForContent,
lines.getFirst(), aStatus);
@ -3999,21 +3999,21 @@ nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext,
}
WritingMode wm = item->Frame()->GetWritingMode();
LogicalSize availSize = aReflowState.ComputedSize(wm);
LogicalSize availSize = aReflowInput.ComputedSize(wm);
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
ReflowInput childReflowState(aPresContext, aReflowState,
ReflowInput childReflowInput(aPresContext, aReflowInput,
item->Frame(), availSize);
if (!sizeOverride) {
// Directly override the computed main-size, by tweaking reflow state:
if (aAxisTracker.IsMainAxisHorizontal()) {
childReflowState.SetComputedWidth(item->GetMainSize());
childReflowInput.SetComputedWidth(item->GetMainSize());
} else {
childReflowState.SetComputedHeight(item->GetMainSize());
childReflowInput.SetComputedHeight(item->GetMainSize());
}
}
SizeItemInCrossAxis(aPresContext, aAxisTracker,
childReflowState, *item);
childReflowInput, *item);
}
}
// Now that we've finished with this line's items, size the line itself:
@ -4023,14 +4023,14 @@ nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext,
bool isCrossSizeDefinite;
const nscoord contentBoxCrossSize =
ComputeCrossSize(aReflowState, aAxisTracker, sumLineCrossSizes,
ComputeCrossSize(aReflowInput, aAxisTracker, sumLineCrossSizes,
aAvailableBSizeForContent, &isCrossSizeDefinite, aStatus);
// Set up state for cross-axis alignment, at a high level (outside the
// scope of a particular flex line)
CrossAxisPositionTracker
crossAxisPosnTracker(lines.getFirst(),
aReflowState.mStylePosition->ComputedAlignContent(),
aReflowInput.mStylePosition->ComputedAlignContent(),
contentBoxCrossSize, isCrossSizeDefinite,
aAxisTracker);
@ -4061,14 +4061,14 @@ nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext,
flexContainerAscent =
ComputePhysicalAscentFromFlexRelativeAscent(
crossAxisPosnTracker.GetPosition() + firstLineBaselineOffset,
contentBoxCrossSize, aReflowState, aAxisTracker);
contentBoxCrossSize, aReflowInput, aAxisTracker);
}
}
const auto justifyContent = IsLegacyBox(aReflowState.mStyleDisplay,
const auto justifyContent = IsLegacyBox(aReflowInput.mStyleDisplay,
mStyleContext) ?
ConvertLegacyStyleToJustifyContent(StyleXUL()) :
aReflowState.mStylePosition->ComputedJustifyContent();
aReflowInput.mStylePosition->ComputedJustifyContent();
for (FlexLine* line = lines.getFirst(); line; line = line->getNext()) {
// Main-Axis Alignment - Flexbox spec section 9.5
@ -4099,15 +4099,15 @@ nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext,
flexContainerAscent =
ComputePhysicalAscentFromFlexRelativeAscent(
crossAxisPosnTracker.GetPosition() - lastLineBaselineOffset,
contentBoxCrossSize, aReflowState, aAxisTracker);
contentBoxCrossSize, aReflowInput, aAxisTracker);
}
}
// Before giving each child a final reflow, calculate the origin of the
// flex container's content box (with respect to its border-box), so that
// we can compute our flex item's final positions.
WritingMode flexWM = aReflowState.GetWritingMode();
LogicalMargin containerBP = aReflowState.ComputedLogicalBorderPadding();
WritingMode flexWM = aReflowInput.GetWritingMode();
LogicalMargin containerBP = aReflowInput.ComputedLogicalBorderPadding();
// Unconditionally skip block-end border & padding for now, regardless of
// writing-mode/GetLogicalSkipSides. We add it lower down, after we've
@ -4115,7 +4115,7 @@ nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext,
// we're fragmented).
const nscoord blockEndContainerBP = containerBP.BEnd(flexWM);
const LogicalSides skipSides =
GetLogicalSkipSides(&aReflowState) | LogicalSides(eLogicalSideBitsBEnd);
GetLogicalSkipSides(&aReflowInput) | LogicalSides(eLogicalSideBitsBEnd);
containerBP.ApplySkipSides(skipSides);
const LogicalPoint containerContentBoxOrigin(flexWM,
@ -4126,7 +4126,7 @@ nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext,
LogicalSize logSize =
aAxisTracker.LogicalSizeFromFlexRelativeSizes(aContentBoxMainSize,
contentBoxCrossSize);
logSize += aReflowState.ComputedLogicalBorderPadding().Size(flexWM);
logSize += aReflowInput.ComputedLogicalBorderPadding().Size(flexWM);
nsSize containerSize = logSize.GetPhysicalSize(flexWM);
// FINAL REFLOW: Give each child frame another chance to reflow, now that
@ -4169,13 +4169,13 @@ nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext,
// it's now "definite"). Let's just make sure it's at the right
// position.
itemNeedsReflow = false;
MoveFlexItemToFinalPosition(aReflowState, *item, framePos,
MoveFlexItemToFinalPosition(aReflowInput, *item, framePos,
containerSize);
}
}
}
if (itemNeedsReflow) {
ReflowFlexItem(aPresContext, aAxisTracker, aReflowState,
ReflowFlexItem(aPresContext, aAxisTracker, aReflowInput,
*item, framePos, containerSize);
}
@ -4229,10 +4229,10 @@ nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext,
nscoord desiredBSizeWithBEndBP =
desiredSizeInFlexWM.BSize(flexWM) + blockEndContainerBP;
if (aReflowState.AvailableBSize() == NS_UNCONSTRAINEDSIZE ||
if (aReflowInput.AvailableBSize() == NS_UNCONSTRAINEDSIZE ||
desiredSizeInFlexWM.BSize(flexWM) == 0 ||
desiredBSizeWithBEndBP <= aReflowState.AvailableBSize() ||
aReflowState.ComputedBSize() == NS_INTRINSICSIZE) {
desiredBSizeWithBEndBP <= aReflowInput.AvailableBSize() ||
aReflowInput.ComputedBSize() == NS_INTRINSICSIZE) {
// Update desired height to include block-end border/padding
desiredSizeInFlexWM.BSize(flexWM) = desiredBSizeWithBEndBP;
} else {
@ -4251,19 +4251,19 @@ nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext,
}
FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize,
aReflowState, aStatus);
aReflowInput, aStatus);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize)
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize)
}
void
nsFlexContainerFrame::MoveFlexItemToFinalPosition(
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
const FlexItem& aItem,
LogicalPoint& aFramePos,
const nsSize& aContainerSize)
{
WritingMode outerWM = aReflowState.GetWritingMode();
WritingMode outerWM = aReflowInput.GetWritingMode();
// If item is relpos, look up its offsets (cached from prev reflow)
LogicalMargin logicalOffsets(outerWM);
@ -4285,16 +4285,16 @@ nsFlexContainerFrame::MoveFlexItemToFinalPosition(
void
nsFlexContainerFrame::ReflowFlexItem(nsPresContext* aPresContext,
const FlexboxAxisTracker& aAxisTracker,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
const FlexItem& aItem,
LogicalPoint& aFramePos,
const nsSize& aContainerSize)
{
WritingMode outerWM = aReflowState.GetWritingMode();
WritingMode outerWM = aReflowInput.GetWritingMode();
WritingMode wm = aItem.Frame()->GetWritingMode();
LogicalSize availSize = aReflowState.ComputedSize(wm);
LogicalSize availSize = aReflowInput.ComputedSize(wm);
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
ReflowInput childReflowState(aPresContext, aReflowState,
ReflowInput childReflowInput(aPresContext, aReflowInput,
aItem.Frame(), availSize);
// Keep track of whether we've overriden the child's computed height
@ -4304,10 +4304,10 @@ nsFlexContainerFrame::ReflowFlexItem(nsPresContext* aPresContext,
// Override computed main-size
if (aAxisTracker.IsMainAxisHorizontal()) {
childReflowState.SetComputedWidth(aItem.GetMainSize());
childReflowInput.SetComputedWidth(aItem.GetMainSize());
didOverrideComputedWidth = true;
} else {
childReflowState.SetComputedHeight(aItem.GetMainSize());
childReflowInput.SetComputedHeight(aItem.GetMainSize());
didOverrideComputedHeight = true;
}
@ -4323,10 +4323,10 @@ nsFlexContainerFrame::ReflowFlexItem(nsPresContext* aPresContext,
if (aItem.IsStretched() ||
aItem.HasIntrinsicRatio()) {
if (aAxisTracker.IsCrossAxisHorizontal()) {
childReflowState.SetComputedWidth(aItem.GetCrossSize());
childReflowInput.SetComputedWidth(aItem.GetCrossSize());
didOverrideComputedWidth = true;
} else {
childReflowState.SetComputedHeight(aItem.GetCrossSize());
childReflowInput.SetComputedHeight(aItem.GetCrossSize());
didOverrideComputedHeight = true;
}
}
@ -4348,20 +4348,20 @@ nsFlexContainerFrame::ReflowFlexItem(nsPresContext* aPresContext,
// sets mHResize whenever our computed width has changed since the
// previous reflow. Still, it's nice for symmetry, and it may become
// necessary once we support orthogonal flows.)
childReflowState.SetHResize(true);
childReflowInput.SetHResize(true);
}
if (didOverrideComputedHeight) {
childReflowState.SetVResize(true);
childReflowInput.SetVResize(true);
}
}
// NOTE: Be very careful about doing anything else with childReflowState
// NOTE: Be very careful about doing anything else with childReflowInput
// after this point, because some of its methods (e.g. SetComputedWidth)
// internally call InitResizeFlags and stomp on mVResize & mHResize.
ReflowOutput childDesiredSize(childReflowState);
ReflowOutput childDesiredSize(childReflowInput);
nsReflowStatus childReflowStatus;
ReflowChild(aItem.Frame(), aPresContext,
childDesiredSize, childReflowState,
childDesiredSize, childReflowInput,
outerWM, aFramePos, aContainerSize,
0, childReflowStatus);
@ -4374,13 +4374,13 @@ nsFlexContainerFrame::ReflowFlexItem(nsPresContext* aPresContext,
"should be complete");
LogicalMargin offsets =
childReflowState.ComputedLogicalOffsets().ConvertTo(outerWM, wm);
childReflowInput.ComputedLogicalOffsets().ConvertTo(outerWM, wm);
ReflowInput::ApplyRelativePositioning(aItem.Frame(), outerWM,
offsets, &aFramePos,
aContainerSize);
FinishReflowChild(aItem.Frame(), aPresContext,
childDesiredSize, &childReflowState,
childDesiredSize, &childReflowInput,
outerWM, aFramePos, aContainerSize, 0);
// Save the first child's ascent; it may establish container's baseline.

Просмотреть файл

@ -64,7 +64,7 @@ public:
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nscoord
@ -102,7 +102,7 @@ protected:
*/
void DoFlexLayout(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus,
nscoord aContentBoxMainSize,
nscoord aAvailableBSizeForContent,
@ -139,7 +139,7 @@ protected:
*/
mozilla::UniquePtr<FlexItem> GenerateFlexItemForChild(nsPresContext* aPresContext,
nsIFrame* aChildFrame,
const ReflowInput& aParentReflowState,
const ReflowInput& aParentReflowInput,
const FlexboxAxisTracker& aAxisTracker);
/**
@ -151,7 +151,7 @@ protected:
nscoord MeasureFlexItemContentHeight(nsPresContext* aPresContext,
FlexItem& aFlexItem,
bool aForceVerticalResizeForMeasuringReflow,
const ReflowInput& aParentReflowState);
const ReflowInput& aParentReflowInput);
/**
* This method resolves an "auto" flex-basis and/or min-main-size value
@ -160,7 +160,7 @@ protected:
*/
void ResolveAutoFlexBasisAndMinSize(nsPresContext* aPresContext,
FlexItem& aFlexItem,
const ReflowInput& aItemReflowState,
const ReflowInput& aItemReflowInput,
const FlexboxAxisTracker& aAxisTracker);
// Creates FlexItems for all of our child frames, arranged in a list of
@ -168,17 +168,17 @@ protected:
// return value has to be |nsresult|, in case we have to reflow a child
// to establish its flex base size and that reflow fails.
void GenerateFlexLines(nsPresContext* aPresContext,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nscoord aContentBoxMainSize,
nscoord aAvailableBSizeForContent,
const nsTArray<StrutInfo>& aStruts,
const FlexboxAxisTracker& aAxisTracker,
mozilla::LinkedList<FlexLine>& aLines);
nscoord GetMainSizeFromReflowState(const ReflowInput& aReflowState,
nscoord GetMainSizeFromReflowInput(const ReflowInput& aReflowInput,
const FlexboxAxisTracker& aAxisTracker);
nscoord ComputeCrossSize(const ReflowInput& aReflowState,
nscoord ComputeCrossSize(const ReflowInput& aReflowInput,
const FlexboxAxisTracker& aAxisTracker,
nscoord aSumLineCrossSizes,
nscoord aAvailableBSizeForContent,
@ -187,7 +187,7 @@ protected:
void SizeItemInCrossAxis(nsPresContext* aPresContext,
const FlexboxAxisTracker& aAxisTracker,
ReflowInput& aChildReflowState,
ReflowInput& aChildReflowInput,
FlexItem& aItem);
/**
@ -198,14 +198,14 @@ protected:
* for the flex item at the correct size, and hence can skip its final reflow
* (but still need to move it to the right final position).
*
* @param aReflowState The flex container's reflow state.
* @param aReflowInput The flex container's reflow state.
* @param aItem The flex item whose frame should be moved.
* @param aFramePos The position where the flex item's frame should
* be placed. (pre-relative positioning)
* @param aContainerSize The flex container's size (required by some methods
* that we call, to interpret aFramePos correctly).
*/
void MoveFlexItemToFinalPosition(const ReflowInput& aReflowState,
void MoveFlexItemToFinalPosition(const ReflowInput& aReflowInput,
const FlexItem& aItem,
mozilla::LogicalPoint& aFramePos,
const nsSize& aContainerSize);
@ -215,7 +215,7 @@ protected:
*
* @param aPresContext The presentation context being used in reflow.
* @param aAxisTracker A FlexboxAxisTracker with the flex container's axes.
* @param aReflowState The flex container's reflow state.
* @param aReflowInput The flex container's reflow state.
* @param aItem The flex item to be reflowed.
* @param aFramePos The position where the flex item's frame should
* be placed. (pre-relative positioning)
@ -224,7 +224,7 @@ protected:
*/
void ReflowFlexItem(nsPresContext* aPresContext,
const FlexboxAxisTracker& aAxisTracker,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
const FlexItem& aItem,
mozilla::LogicalPoint& aFramePos,
const nsSize& aContainerSize);

Просмотреть файл

@ -562,11 +562,11 @@ nsAutoFloatManager::~nsAutoFloatManager()
printf("restoring old float manager %p\n", mOld);
#endif
mReflowState.mFloatManager = mOld;
mReflowInput.mFloatManager = mOld;
#ifdef NOISY_FLOATMANAGER
if (mOld) {
static_cast<nsFrame *>(mReflowState.frame)->ListTag(stdout);
static_cast<nsFrame *>(mReflowInput.frame)->ListTag(stdout);
printf(": space-manager %p after reflow\n", mOld);
mOld->List(stdout);
}
@ -583,17 +583,17 @@ nsAutoFloatManager::CreateFloatManager(nsPresContext *aPresContext)
// state. `Remember' the old float manager so we can restore it
// later.
mNew = new nsFloatManager(aPresContext->PresShell(),
mReflowState.GetWritingMode());
mReflowInput.GetWritingMode());
if (! mNew)
return NS_ERROR_OUT_OF_MEMORY;
#ifdef NOISY_FLOATMANAGER
printf("constructed new float manager %p (replacing %p)\n",
mNew, mReflowState.mFloatManager);
mNew, mReflowInput.mFloatManager);
#endif
// Set the float manager in the existing reflow state
mOld = mReflowState.mFloatManager;
mReflowState.mFloatManager = mNew;
mOld = mReflowInput.mFloatManager;
mReflowInput.mFloatManager = mNew;
return NS_OK;
}

Просмотреть файл

@ -376,8 +376,8 @@ class nsAutoFloatManager {
using ReflowInput = mozilla::ReflowInput;
public:
explicit nsAutoFloatManager(ReflowInput& aReflowState)
: mReflowState(aReflowState),
explicit nsAutoFloatManager(ReflowInput& aReflowInput)
: mReflowInput(aReflowInput),
mNew(nullptr),
mOld(nullptr) {}
@ -392,7 +392,7 @@ public:
CreateFloatManager(nsPresContext *aPresContext);
protected:
ReflowInput &mReflowState;
ReflowInput &mReflowInput;
nsFloatManager *mNew;
nsFloatManager *mOld;
};

Просмотреть файл

@ -31,9 +31,9 @@ nsFontInflationData::FindFontInflationDataFor(const nsIFrame *aFrame)
}
/* static */ bool
nsFontInflationData::UpdateFontInflationDataISizeFor(const ReflowInput& aReflowState)
nsFontInflationData::UpdateFontInflationDataISizeFor(const ReflowInput& aReflowInput)
{
nsIFrame *bfc = aReflowState.mFrame;
nsIFrame *bfc = aReflowInput.mFrame;
NS_ASSERTION(bfc->GetStateBits() & NS_FRAME_FONT_INFLATION_FLOW_ROOT,
"should have been given a flow root");
FrameProperties bfcProps(bfc->Properties());
@ -50,7 +50,7 @@ nsFontInflationData::UpdateFontInflationDataISizeFor(const ReflowInput& aReflowS
oldInflationEnabled = true; /* not relevant */
}
data->UpdateISize(aReflowState);
data->UpdateISize(aReflowInput);
if (oldInflationEnabled != data->mInflationEnabled)
return true;
@ -121,12 +121,12 @@ NearestCommonAncestorFirstInFlow(nsIFrame *aFrame1, nsIFrame *aFrame2,
}
static nscoord
ComputeDescendantISize(const ReflowInput& aAncestorReflowState,
ComputeDescendantISize(const ReflowInput& aAncestorReflowInput,
nsIFrame *aDescendantFrame)
{
nsIFrame *ancestorFrame = aAncestorReflowState.mFrame->FirstInFlow();
nsIFrame *ancestorFrame = aAncestorReflowInput.mFrame->FirstInFlow();
if (aDescendantFrame == ancestorFrame) {
return aAncestorReflowState.ComputedISize();
return aAncestorReflowInput.ComputedISize();
}
AutoTArray<nsIFrame*, 16> frames;
@ -141,39 +141,39 @@ ComputeDescendantISize(const ReflowInput& aAncestorReflowState,
// occasionally cause problems when writing tests on desktop.
uint32_t len = frames.Length();
ReflowInput *reflowStates = static_cast<ReflowInput*>
ReflowInput *reflowInputs = static_cast<ReflowInput*>
(moz_xmalloc(sizeof(ReflowInput) * len));
nsPresContext *presContext = aDescendantFrame->PresContext();
for (uint32_t i = 0; i < len; ++i) {
const ReflowInput &parentReflowState =
(i == 0) ? aAncestorReflowState : reflowStates[i - 1];
const ReflowInput &parentReflowInput =
(i == 0) ? aAncestorReflowInput : reflowInputs[i - 1];
nsIFrame *frame = frames[len - i - 1];
WritingMode wm = frame->GetWritingMode();
LogicalSize availSize = parentReflowState.ComputedSize(wm);
LogicalSize availSize = parentReflowInput.ComputedSize(wm);
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
MOZ_ASSERT(frame->GetParent()->FirstInFlow() ==
parentReflowState.mFrame->FirstInFlow(),
parentReflowInput.mFrame->FirstInFlow(),
"bad logic in this function");
new (reflowStates + i) ReflowInput(presContext, parentReflowState,
new (reflowInputs + i) ReflowInput(presContext, parentReflowInput,
frame, availSize);
}
MOZ_ASSERT(reflowStates[len - 1].mFrame == aDescendantFrame,
MOZ_ASSERT(reflowInputs[len - 1].mFrame == aDescendantFrame,
"bad logic in this function");
nscoord result = reflowStates[len - 1].ComputedISize();
nscoord result = reflowInputs[len - 1].ComputedISize();
for (uint32_t i = len; i-- != 0; ) {
reflowStates[i].~ReflowInput();
reflowInputs[i].~ReflowInput();
}
free(reflowStates);
free(reflowInputs);
return result;
}
void
nsFontInflationData::UpdateISize(const ReflowInput &aReflowState)
nsFontInflationData::UpdateISize(const ReflowInput &aReflowInput)
{
nsIFrame *bfc = aReflowState.mFrame;
nsIFrame *bfc = aReflowInput.mFrame;
NS_ASSERTION(bfc->GetStateBits() & NS_FRAME_FONT_INFLATION_FLOW_ROOT,
"must be block formatting context");
@ -201,7 +201,7 @@ nsFontInflationData::UpdateISize(const ReflowInput &aReflowState)
nca = nca->GetParent()->FirstInFlow();
}
nscoord newNCAISize = ComputeDescendantISize(aReflowState, nca);
nscoord newNCAISize = ComputeDescendantISize(aReflowInput, nca);
// See comment above "font.size.inflation.lineThreshold" in
// modules/libpref/src/init/all.js .

Просмотреть файл

@ -21,7 +21,7 @@ public:
// Returns whether the effective width changed (which requires the
// caller to mark its descendants dirty
static bool
UpdateFontInflationDataISizeFor(const ReflowInput& aReflowState);
UpdateFontInflationDataISizeFor(const ReflowInput& aReflowInput);
static void MarkFontInflationDataTextDirty(nsIFrame *aFrame);
@ -43,7 +43,7 @@ private:
nsFontInflationData(const nsFontInflationData&) = delete;
void operator=(const nsFontInflationData&) = delete;
void UpdateISize(const ReflowInput &aReflowState);
void UpdateISize(const ReflowInput &aReflowInput);
enum SearchDirection { eFromStart, eFromEnd };
static nsIFrame* FindEdgeInflatableFrameIn(nsIFrame *aFrame,
SearchDirection aDirection);

Просмотреть файл

@ -1055,7 +1055,7 @@ nsIFrame::GetUsedPadding() const
}
nsIFrame::Sides
nsIFrame::GetSkipSides(const ReflowInput* aReflowState) const
nsIFrame::GetSkipSides(const ReflowInput* aReflowInput) const
{
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
NS_STYLE_BOX_DECORATION_BREAK_CLONE) &&
@ -1066,7 +1066,7 @@ nsIFrame::GetSkipSides(const ReflowInput* aReflowState) const
// Convert the logical skip sides to physical sides using the frame's
// writing mode
WritingMode writingMode = GetWritingMode();
LogicalSides logicalSkip = GetLogicalSkipSides(aReflowState);
LogicalSides logicalSkip = GetLogicalSkipSides(aReflowInput);
Sides skip;
if (logicalSkip.BStart()) {
@ -4933,7 +4933,7 @@ nsFrame::ShrinkWidthToFit(nsRenderingContext *aRenderingContext,
void
nsFrame::DidReflow(nsPresContext* aPresContext,
const ReflowInput* aReflowState,
const ReflowInput* aReflowInput,
nsDidReflowStatus aStatus)
{
NS_FRAME_TRACE_MSG(NS_FRAME_TRACE_CALLS,
@ -4950,12 +4950,12 @@ nsFrame::DidReflow(nsPresContext* aPresContext,
// The observer may be able to initiate another reflow with a computed
// bsize. This happens in the case where a table cell has no computed
// bsize but can fabricate one when the cell bsize is known.
if (aReflowState && aReflowState->mPercentBSizeObserver &&
if (aReflowInput && aReflowInput->mPercentBSizeObserver &&
!GetPrevInFlow()) {
const nsStyleCoord &bsize =
aReflowState->mStylePosition->BSize(aReflowState->GetWritingMode());
aReflowInput->mStylePosition->BSize(aReflowInput->GetWritingMode());
if (bsize.HasPercent()) {
aReflowState->mPercentBSizeObserver->NotifyPercentBSize(*aReflowState);
aReflowInput->mPercentBSizeObserver->NotifyPercentBSize(*aReflowInput);
}
}
@ -4965,11 +4965,11 @@ nsFrame::DidReflow(nsPresContext* aPresContext,
void
nsFrame::FinishReflowWithAbsoluteFrames(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus,
bool aConstrainBSize)
{
ReflowAbsoluteFrames(aPresContext, aDesiredSize, aReflowState, aStatus, aConstrainBSize);
ReflowAbsoluteFrames(aPresContext, aDesiredSize, aReflowInput, aStatus, aConstrainBSize);
FinishAndStoreOverflow(&aDesiredSize);
}
@ -4977,7 +4977,7 @@ nsFrame::FinishReflowWithAbsoluteFrames(nsPresContext* aPresContext,
void
nsFrame::ReflowAbsoluteFrames(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus,
bool aConstrainBSize)
{
@ -5002,7 +5002,7 @@ nsFrame::ReflowAbsoluteFrames(nsPresContext* aPresContext,
if (aConstrainBSize) {
flags |= AbsPosReflowFlags::eConstrainHeight;
}
absoluteContainer->Reflow(container, aPresContext, aReflowState, aStatus,
absoluteContainer->Reflow(container, aPresContext, aReflowInput, aStatus,
containingBlock, flags,
&aDesiredSize.mOverflowAreas);
}
@ -5031,14 +5031,14 @@ nsFrame::CanContinueTextRun() const
void
nsFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsFrame");
aDesiredSize.ClearSize();
aStatus = NS_FRAME_COMPLETE;
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
nsresult
@ -6044,11 +6044,11 @@ nsFrame::UnionChildOverflow(nsOverflowAreas& aOverflowAreas)
#define MAX_FRAME_DEPTH (MAX_REFLOW_DEPTH+4)
bool
nsFrame::IsFrameTreeTooDeep(const ReflowInput& aReflowState,
nsFrame::IsFrameTreeTooDeep(const ReflowInput& aReflowInput,
ReflowOutput& aMetrics,
nsReflowStatus& aStatus)
{
if (aReflowState.mReflowDepth > MAX_FRAME_DEPTH) {
if (aReflowInput.mReflowDepth > MAX_FRAME_DEPTH) {
NS_WARNING("frame tree too deep; setting zero size and returning");
mState |= NS_FRAME_TOO_DEEP_IN_FRAME_TREE;
ClearOverflowRects();
@ -8718,8 +8718,8 @@ nsFrame::RefreshSizeCache(nsBoxLayoutState& aState)
}
// do the nasty.
const WritingMode wm = aState.OuterReflowState() ?
aState.OuterReflowState()->GetWritingMode() : GetWritingMode();
const WritingMode wm = aState.OuterReflowInput() ?
aState.OuterReflowInput()->GetWritingMode() : GetWritingMode();
ReflowOutput desiredSize(wm);
BoxReflow(aState, presContext, desiredSize, rendContext,
rect.x, rect.y,
@ -8819,7 +8819,7 @@ nsFrame::GetXULMinSize(nsBoxLayoutState& aState)
{
nsSize size(0,0);
DISPLAY_MIN_SIZE(this, size);
// Don't use the cache if we have HTMLReflowState constraints --- they might have changed
// Don't use the cache if we have HTMLReflowInput constraints --- they might have changed
nsBoxLayoutMetrics *metrics = BoxMetrics();
if (!DoesNeedRecalc(metrics->mMinSize)) {
size = metrics->mMinSize;
@ -8854,7 +8854,7 @@ nsFrame::GetXULMaxSize(nsBoxLayoutState& aState)
{
nsSize size(NS_INTRINSICSIZE, NS_INTRINSICSIZE);
DISPLAY_MAX_SIZE(this, size);
// Don't use the cache if we have HTMLReflowState constraints --- they might have changed
// Don't use the cache if we have HTMLReflowInput constraints --- they might have changed
nsBoxLayoutMetrics *metrics = BoxMetrics();
if (!DoesNeedRecalc(metrics->mMaxSize)) {
size = metrics->mMaxSize;
@ -8908,8 +8908,8 @@ nsFrame::DoXULLayout(nsBoxLayoutState& aState)
nsRenderingContext* rendContext = aState.GetRenderingContext();
nsPresContext* presContext = aState.PresContext();
WritingMode ourWM = GetWritingMode();
const WritingMode outerWM = aState.OuterReflowState() ?
aState.OuterReflowState()->GetWritingMode() : ourWM;
const WritingMode outerWM = aState.OuterReflowInput() ?
aState.OuterReflowInput()->GetWritingMode() : ourWM;
ReflowOutput desiredSize(outerWM);
LogicalSize ourSize = GetLogicalSize(outerWM);
@ -8957,8 +8957,8 @@ nsFrame::DoXULLayout(nsBoxLayoutState& aState)
desiredSize.UnionOverflowAreasWithDesiredBounds();
if (HasAbsolutelyPositionedChildren()) {
// Set up a |reflowState| to pass into ReflowAbsoluteFrames
ReflowInput reflowState(aState.PresContext(), this,
// Set up a |reflowInput| to pass into ReflowAbsoluteFrames
ReflowInput reflowInput(aState.PresContext(), this,
aState.GetRenderingContext(),
LogicalSize(ourWM, ISize(),
NS_UNCONSTRAINEDSIZE),
@ -8969,7 +8969,7 @@ nsFrame::DoXULLayout(nsBoxLayoutState& aState)
// (just a dummy value; hopefully that's OK)
nsReflowStatus reflowStatus = NS_FRAME_COMPLETE;
ReflowAbsoluteFrames(aState.PresContext(), desiredSize,
reflowState, reflowStatus);
reflowInput, reflowStatus);
RemoveStateBits(NS_FRAME_IN_REFLOW);
}
@ -9062,7 +9062,7 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState,
nsFrameState savedState = parentFrame->GetStateBits();
WritingMode parentWM = parentFrame->GetWritingMode();
ReflowInput
parentReflowState(aPresContext, parentFrame, aRenderingContext,
parentReflowInput(aPresContext, parentFrame, aRenderingContext,
LogicalSize(parentWM, parentSize),
ReflowInput::DUMMY_PARENT_REFLOW_STATE);
parentFrame->RemoveStateBits(~nsFrameState(0));
@ -9070,31 +9070,31 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState,
// This may not do very much useful, but it's probably worth trying.
if (parentSize.width != NS_INTRINSICSIZE)
parentReflowState.SetComputedWidth(std::max(parentSize.width, 0));
parentReflowInput.SetComputedWidth(std::max(parentSize.width, 0));
if (parentSize.height != NS_INTRINSICSIZE)
parentReflowState.SetComputedHeight(std::max(parentSize.height, 0));
parentReflowState.ComputedPhysicalMargin().SizeTo(0, 0, 0, 0);
parentReflowInput.SetComputedHeight(std::max(parentSize.height, 0));
parentReflowInput.ComputedPhysicalMargin().SizeTo(0, 0, 0, 0);
// XXX use box methods
parentFrame->GetXULPadding(parentReflowState.ComputedPhysicalPadding());
parentFrame->GetXULBorder(parentReflowState.ComputedPhysicalBorderPadding());
parentReflowState.ComputedPhysicalBorderPadding() +=
parentReflowState.ComputedPhysicalPadding();
parentFrame->GetXULPadding(parentReflowInput.ComputedPhysicalPadding());
parentFrame->GetXULBorder(parentReflowInput.ComputedPhysicalBorderPadding());
parentReflowInput.ComputedPhysicalBorderPadding() +=
parentReflowInput.ComputedPhysicalPadding();
// Construct the parent chain manually since constructing it normally
// messes up dimensions.
const ReflowInput *outerReflowState = aState.OuterReflowState();
NS_ASSERTION(!outerReflowState || outerReflowState->mFrame != this,
const ReflowInput *outerReflowInput = aState.OuterReflowInput();
NS_ASSERTION(!outerReflowInput || outerReflowInput->mFrame != this,
"in and out of XUL on a single frame?");
const ReflowInput* parentRS;
if (outerReflowState && outerReflowState->mFrame == parentFrame) {
if (outerReflowInput && outerReflowInput->mFrame == parentFrame) {
// We're a frame (such as a text control frame) that jumps into
// box reflow and then straight out of it on the child frame.
// This means we actually have a real parent reflow state.
// nsLayoutUtils::InflationMinFontSizeFor used to need this to be
// linked up correctly for text control frames, so do so here).
parentRS = outerReflowState;
parentRS = outerReflowInput;
} else {
parentRS = &parentReflowState;
parentRS = &parentReflowInput;
}
// XXX Is it OK that this reflow state has only one ancestor?
@ -9102,24 +9102,24 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState,
WritingMode wm = GetWritingMode();
LogicalSize logicalSize(wm, nsSize(aWidth, aHeight));
logicalSize.BSize(wm) = NS_INTRINSICSIZE;
ReflowInput reflowState(aPresContext, *parentRS, this,
ReflowInput reflowInput(aPresContext, *parentRS, this,
logicalSize, nullptr,
ReflowInput::DUMMY_PARENT_REFLOW_STATE);
// XXX_jwir3: This is somewhat fishy. If this is actually changing the value
// here (which it might be), then we should make sure that it's
// correct the first time around, rather than changing it later.
reflowState.mCBReflowState = parentRS;
reflowInput.mCBReflowInput = parentRS;
reflowState.mReflowDepth = aState.GetReflowDepth();
reflowInput.mReflowDepth = aState.GetReflowDepth();
// mComputedWidth and mComputedHeight are content-box, not
// border-box
if (aWidth != NS_INTRINSICSIZE) {
nscoord computedWidth =
aWidth - reflowState.ComputedPhysicalBorderPadding().LeftRight();
aWidth - reflowInput.ComputedPhysicalBorderPadding().LeftRight();
computedWidth = std::max(computedWidth, 0);
reflowState.SetComputedWidth(computedWidth);
reflowInput.SetComputedWidth(computedWidth);
}
// Most child frames of box frames (e.g. subdocument or scroll frames)
@ -9130,18 +9130,18 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState,
if (!IsFrameOfType(eBlockFrame)) {
if (aHeight != NS_INTRINSICSIZE) {
nscoord computedHeight =
aHeight - reflowState.ComputedPhysicalBorderPadding().TopBottom();
aHeight - reflowInput.ComputedPhysicalBorderPadding().TopBottom();
computedHeight = std::max(computedHeight, 0);
reflowState.SetComputedHeight(computedHeight);
reflowInput.SetComputedHeight(computedHeight);
} else {
reflowState.SetComputedHeight(
reflowInput.SetComputedHeight(
ComputeSize(aRenderingContext, wm,
logicalSize,
logicalSize.ISize(wm),
reflowState.ComputedLogicalMargin().Size(wm),
reflowState.ComputedLogicalBorderPadding().Size(wm) -
reflowState.ComputedLogicalPadding().Size(wm),
reflowState.ComputedLogicalPadding().Size(wm),
reflowInput.ComputedLogicalMargin().Size(wm),
reflowInput.ComputedLogicalBorderPadding().Size(wm) -
reflowInput.ComputedLogicalPadding().Size(wm),
reflowInput.ComputedLogicalPadding().Size(wm),
ComputeSizeFlags::eDefault).Height(wm));
}
}
@ -9153,7 +9153,7 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState,
// However, mLastSize can also be the size passed to BoxReflow by
// RefreshSizeCache, so that doesn't really make sense.
if (metrics->mLastSize.width != aWidth) {
reflowState.SetHResize(true);
reflowInput.SetHResize(true);
// When font size inflation is enabled, a horizontal resize
// requires a full reflow. See ReflowInput::InitResizeFlags
@ -9163,27 +9163,27 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState,
}
}
if (metrics->mLastSize.height != aHeight) {
reflowState.SetVResize(true);
reflowInput.SetVResize(true);
}
#ifdef DEBUG_REFLOW
nsAdaptorAddIndents();
printf("Size=(%d,%d)\n",reflowState.ComputedWidth(),
reflowState.ComputedHeight());
printf("Size=(%d,%d)\n",reflowInput.ComputedWidth(),
reflowInput.ComputedHeight());
nsAdaptorAddIndents();
nsAdaptorPrintReason(reflowState);
nsAdaptorPrintReason(reflowInput);
printf("\n");
#endif
// place the child and reflow
Reflow(aPresContext, aDesiredSize, reflowState, status);
Reflow(aPresContext, aDesiredSize, reflowInput, status);
NS_ASSERTION(NS_FRAME_IS_COMPLETE(status), "bad status");
uint32_t layoutFlags = aState.LayoutFlags();
nsContainerFrame::FinishReflowChild(this, aPresContext, aDesiredSize,
&reflowState, aX, aY, layoutFlags | NS_FRAME_NO_MOVE_FRAME);
&reflowInput, aX, aY, layoutFlags | NS_FRAME_NO_MOVE_FRAME);
// Save the ascent. (bug 103925)
if (IsXULCollapsed()) {
@ -9491,11 +9491,11 @@ nsAdaptorAddIndents()
}
void
nsAdaptorPrintReason(ReflowInput& aReflowState)
nsAdaptorPrintReason(ReflowInput& aReflowInput)
{
char* reflowReasonString;
switch(aReflowState.reason)
switch(aReflowInput.reason)
{
case eReflowReason_Initial:
reflowReasonString = "initial";
@ -9512,7 +9512,7 @@ nsAdaptorPrintReason(ReflowInput& aReflowState)
break;
case eReflowReason_Incremental:
{
switch (aReflowState.reflowCommand->Type()) {
switch (aReflowInput.reflowCommand->Type()) {
case eReflowType_StyleChanged:
reflowReasonString = "incremental (StyleChanged)";
break;
@ -9609,13 +9609,13 @@ nsFrame::VerifyDirtyBitSet(const nsFrameList& aFrameList)
DR_cookie::DR_cookie(nsPresContext* aPresContext,
nsIFrame* aFrame,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
ReflowOutput& aMetrics,
nsReflowStatus& aStatus)
:mPresContext(aPresContext), mFrame(aFrame), mReflowState(aReflowState), mMetrics(aMetrics), mStatus(aStatus)
:mPresContext(aPresContext), mFrame(aFrame), mReflowInput(aReflowInput), mMetrics(aMetrics), mStatus(aStatus)
{
MOZ_COUNT_CTOR(DR_cookie);
mValue = nsFrame::DisplayReflowEnter(aPresContext, mFrame, mReflowState);
mValue = nsFrame::DisplayReflowEnter(aPresContext, mFrame, mReflowInput);
}
DR_cookie::~DR_cookie()
@ -9748,7 +9748,7 @@ struct DR_State
DR_FrameTypeInfo* GetFrameTypeInfo(char* aFrameName);
void InitFrameTypeTable();
DR_FrameTreeNode* CreateTreeNode(nsIFrame* aFrame,
const ReflowInput* aReflowState);
const ReflowInput* aReflowInput);
void FindMatchingRule(DR_FrameTreeNode& aNode);
bool RuleMatches(DR_Rule& aRule,
DR_FrameTreeNode& aNode);
@ -10218,12 +10218,12 @@ void DR_State::FindMatchingRule(DR_FrameTreeNode& aNode)
}
DR_FrameTreeNode* DR_State::CreateTreeNode(nsIFrame* aFrame,
const ReflowInput* aReflowState)
const ReflowInput* aReflowInput)
{
// find the frame of the parent reflow state (usually just the parent of aFrame)
nsIFrame* parentFrame;
if (aReflowState) {
const ReflowInput* parentRS = aReflowState->mParentReflowState;
if (aReflowInput) {
const ReflowInput* parentRS = aReflowInput->mParentReflowInput;
parentFrame = (parentRS) ? parentRS->mFrame : nullptr;
} else {
parentFrame = aFrame->GetParent();
@ -10317,7 +10317,7 @@ CheckPixelError(nscoord aSize,
static void DisplayReflowEnterPrint(nsPresContext* aPresContext,
nsIFrame* aFrame,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
DR_FrameTreeNode& aTreeNode,
bool aChanged)
{
@ -10327,12 +10327,12 @@ static void DisplayReflowEnterPrint(nsPresContext* aPresContext,
char width[16];
char height[16];
DR_state->PrettyUC(aReflowState.AvailableWidth(), width, 16);
DR_state->PrettyUC(aReflowState.AvailableHeight(), height, 16);
DR_state->PrettyUC(aReflowInput.AvailableWidth(), width, 16);
DR_state->PrettyUC(aReflowInput.AvailableHeight(), height, 16);
printf("Reflow a=%s,%s ", width, height);
DR_state->PrettyUC(aReflowState.ComputedWidth(), width, 16);
DR_state->PrettyUC(aReflowState.ComputedHeight(), height, 16);
DR_state->PrettyUC(aReflowInput.ComputedWidth(), width, 16);
DR_state->PrettyUC(aReflowInput.ComputedHeight(), height, 16);
printf("c=%s,%s ", width, height);
if (aFrame->GetStateBits() & NS_FRAME_IS_DIRTY)
@ -10341,13 +10341,13 @@ static void DisplayReflowEnterPrint(nsPresContext* aPresContext,
if (aFrame->GetStateBits() & NS_FRAME_HAS_DIRTY_CHILDREN)
printf("dirty-children ");
if (aReflowState.mFlags.mSpecialBSizeReflow)
if (aReflowInput.mFlags.mSpecialBSizeReflow)
printf("special-bsize ");
if (aReflowState.IsHResize())
if (aReflowInput.IsHResize())
printf("h-resize ");
if (aReflowState.IsVResize())
if (aReflowInput.IsVResize())
printf("v-resize ");
nsIFrame* inFlow = aFrame->GetPrevInFlow();
@ -10364,26 +10364,26 @@ static void DisplayReflowEnterPrint(nsPresContext* aPresContext,
printf("cnt=%d \n", DR_state->mCount);
if (DR_state->mDisplayPixelErrors) {
int32_t p2t = aPresContext->AppUnitsPerDevPixel();
CheckPixelError(aReflowState.AvailableWidth(), p2t);
CheckPixelError(aReflowState.AvailableHeight(), p2t);
CheckPixelError(aReflowState.ComputedWidth(), p2t);
CheckPixelError(aReflowState.ComputedHeight(), p2t);
CheckPixelError(aReflowInput.AvailableWidth(), p2t);
CheckPixelError(aReflowInput.AvailableHeight(), p2t);
CheckPixelError(aReflowInput.ComputedWidth(), p2t);
CheckPixelError(aReflowInput.ComputedHeight(), p2t);
}
}
}
void* nsFrame::DisplayReflowEnter(nsPresContext* aPresContext,
nsIFrame* aFrame,
const ReflowInput& aReflowState)
const ReflowInput& aReflowInput)
{
if (!DR_state->mInited) DR_state->Init();
if (!DR_state->mActive) return nullptr;
NS_ASSERTION(aFrame, "invalid call");
DR_FrameTreeNode* treeNode = DR_state->CreateTreeNode(aFrame, &aReflowState);
DR_FrameTreeNode* treeNode = DR_state->CreateTreeNode(aFrame, &aReflowInput);
if (treeNode) {
DisplayReflowEnterPrint(aPresContext, aFrame, aReflowState, *treeNode, false);
DisplayReflowEnterPrint(aPresContext, aFrame, aReflowInput, *treeNode, false);
}
return treeNode;
}
@ -10575,7 +10575,7 @@ void DR_cookie::Change() const
{
DR_FrameTreeNode* treeNode = (DR_FrameTreeNode*)mValue;
if (treeNode && treeNode->mDisplay) {
DisplayReflowEnterPrint(mPresContext, mFrame, mReflowState, *treeNode, true);
DisplayReflowEnterPrint(mPresContext, mFrame, mReflowInput, *treeNode, true);
}
}
@ -10598,7 +10598,7 @@ ReflowInput::DisplayInitConstraintsEnter(nsIFrame* aFrame,
DR_state->DisplayFrameTypeInfo(aFrame, treeNode->mIndent);
printf("InitConstraints parent=%p",
(void*)aState->mParentReflowState);
(void*)aState->mParentReflowInput);
char width[16];
char height[16];

Просмотреть файл

@ -334,10 +334,10 @@ public:
*/
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual void DidReflow(nsPresContext* aPresContext,
const ReflowInput* aReflowState,
const ReflowInput* aReflowInput,
nsDidReflowStatus aStatus) override;
/**
@ -347,12 +347,12 @@ public:
*/
void ReflowAbsoluteFrames(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus,
bool aConstrainBSize = true);
void FinishReflowWithAbsoluteFrames(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus,
bool aConstrainBSize = true);
@ -431,7 +431,7 @@ public:
// the reflow status, and returns true. Otherwise, the frame is
// unmarked "unflowable" and the metrics and reflow status are not
// touched and false is returned.
bool IsFrameTreeTooDeep(const ReflowInput& aReflowState,
bool IsFrameTreeTooDeep(const ReflowInput& aReflowInput,
ReflowOutput& aMetrics,
nsReflowStatus& aStatus);
@ -443,8 +443,8 @@ public:
/**
* @return true if we should avoid a page/column break in this frame.
*/
bool ShouldAvoidBreakInside(const ReflowInput& aReflowState) const {
return !aReflowState.mFlags.mIsTopOfPage &&
bool ShouldAvoidBreakInside(const ReflowInput& aReflowInput) const {
return !aReflowInput.mFlags.mIsTopOfPage &&
NS_STYLE_PAGE_BREAK_AVOID == StyleDisplay()->mBreakInside &&
!GetPrevInFlow();
}
@ -480,7 +480,7 @@ public:
// Display Reflow Debugging
static void* DisplayReflowEnter(nsPresContext* aPresContext,
nsIFrame* aFrame,
const ReflowInput& aReflowState);
const ReflowInput& aReflowInput);
static void* DisplayLayoutEnter(nsIFrame* aFrame);
static void* DisplayIntrinsicISizeEnter(nsIFrame* aFrame,
const char* aType);
@ -769,7 +769,7 @@ public:
struct DR_cookie {
DR_cookie(nsPresContext* aPresContext,
nsIFrame* aFrame,
const mozilla::ReflowInput& aReflowState,
const mozilla::ReflowInput& aReflowInput,
mozilla::ReflowOutput& aMetrics,
nsReflowStatus& aStatus);
~DR_cookie();
@ -777,7 +777,7 @@ public:
nsPresContext* mPresContext;
nsIFrame* mFrame;
const mozilla::ReflowInput& mReflowState;
const mozilla::ReflowInput& mReflowInput;
mozilla::ReflowOutput& mMetrics;
nsReflowStatus& mStatus;
void* mValue;

Просмотреть файл

@ -105,7 +105,7 @@ public:
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
bool GetVisibility() { return mVisibility; }
@ -154,7 +154,7 @@ public:
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
protected:
@ -563,17 +563,17 @@ int32_t nsHTMLFramesetFrame::GetBorderWidth(nsPresContext* aPresContext,
void
nsHTMLFramesetFrame::GetDesiredSize(nsPresContext* aPresContext,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
ReflowOutput& aDesiredSize)
{
WritingMode wm = aReflowState.GetWritingMode();
WritingMode wm = aReflowInput.GetWritingMode();
LogicalSize desiredSize(wm);
nsHTMLFramesetFrame* framesetParent = do_QueryFrame(GetParent());
if (nullptr == framesetParent) {
if (aPresContext->IsPaginated()) {
// XXX This needs to be changed when framesets paginate properly
desiredSize.ISize(wm) = aReflowState.AvailableISize();
desiredSize.BSize(wm) = aReflowState.AvailableBSize();
desiredSize.ISize(wm) = aReflowInput.AvailableISize();
desiredSize.BSize(wm) = aReflowInput.AvailableBSize();
} else {
LogicalSize area(wm, aPresContext->GetVisibleArea().Size());
@ -682,22 +682,22 @@ nsHTMLFramesetFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
void
nsHTMLFramesetFrame::ReflowPlaceChild(nsIFrame* aChild,
nsPresContext* aPresContext,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsPoint& aOffset,
nsSize& aSize,
nsIntPoint* aCellIndex)
{
// reflow the child
ReflowInput reflowState(aPresContext, aReflowState, aChild,
ReflowInput reflowInput(aPresContext, aReflowInput, aChild,
LogicalSize(aChild->GetWritingMode(), aSize));
reflowState.SetComputedWidth(std::max(0, aSize.width - reflowState.ComputedPhysicalBorderPadding().LeftRight()));
reflowState.SetComputedHeight(std::max(0, aSize.height - reflowState.ComputedPhysicalBorderPadding().TopBottom()));
ReflowOutput metrics(aReflowState);
reflowInput.SetComputedWidth(std::max(0, aSize.width - reflowInput.ComputedPhysicalBorderPadding().LeftRight()));
reflowInput.SetComputedHeight(std::max(0, aSize.height - reflowInput.ComputedPhysicalBorderPadding().TopBottom()));
ReflowOutput metrics(aReflowInput);
metrics.Width() = aSize.width;
metrics.Height() = aSize.height;
nsReflowStatus status;
ReflowChild(aChild, aPresContext, metrics, reflowState, aOffset.x,
ReflowChild(aChild, aPresContext, metrics, reflowInput, aOffset.x,
aOffset.y, 0, status);
NS_ASSERTION(NS_FRAME_IS_COMPLETE(status), "bad status");
@ -793,25 +793,25 @@ nscolor nsHTMLFramesetFrame::GetBorderColor(nsIContent* aContent)
void
nsHTMLFramesetFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsHTMLFramesetFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
nsIPresShell *shell = aPresContext->PresShell();
StyleSetHandle styleSet = shell->StyleSet();
GetParent()->AddStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE);
//printf("FramesetFrame2::Reflow %X (%d,%d) \n", this, aReflowState.AvailableWidth(), aReflowState.AvailableHeight());
//printf("FramesetFrame2::Reflow %X (%d,%d) \n", this, aReflowInput.AvailableWidth(), aReflowInput.AvailableHeight());
// Always get the size so that the caller knows how big we are
GetDesiredSize(aPresContext, aReflowState, aDesiredSize);
GetDesiredSize(aPresContext, aReflowInput, aDesiredSize);
nscoord width = (aDesiredSize.Width() <= aReflowState.AvailableWidth())
? aDesiredSize.Width() : aReflowState.AvailableWidth();
nscoord height = (aDesiredSize.Height() <= aReflowState.AvailableHeight())
? aDesiredSize.Height() : aReflowState.AvailableHeight();
nscoord width = (aDesiredSize.Width() <= aReflowInput.AvailableWidth())
? aDesiredSize.Width() : aReflowInput.AvailableWidth();
nscoord height = (aDesiredSize.Height() <= aReflowInput.AvailableHeight())
? aDesiredSize.Height() : aReflowInput.AvailableHeight();
// We might be reflowed more than once with NS_FRAME_FIRST_REFLOW;
// that's allowed. (Though it will only happen for misuse of frameset
@ -845,7 +845,7 @@ nsHTMLFramesetFrame::Reflow(nsPresContext* aPresContext,
if (mNumRows != rows || mNumCols != cols) {
aStatus = NS_FRAME_COMPLETE;
mDrag.UnSet();
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
return;
}
@ -923,7 +923,7 @@ nsHTMLFramesetFrame::Reflow(nsPresContext* aPresContext,
borderChildX++;
}
nsSize borderSize(aDesiredSize.Width(), borderWidth);
ReflowPlaceChild(borderFrame, aPresContext, aReflowState, offset, borderSize);
ReflowPlaceChild(borderFrame, aPresContext, aReflowInput, offset, borderSize);
borderFrame = nullptr;
offset.y += borderWidth;
} else {
@ -953,14 +953,14 @@ nsHTMLFramesetFrame::Reflow(nsPresContext* aPresContext,
borderChildX++;
}
nsSize borderSize(borderWidth, aDesiredSize.Height());
ReflowPlaceChild(borderFrame, aPresContext, aReflowState, offset, borderSize);
ReflowPlaceChild(borderFrame, aPresContext, aReflowInput, offset, borderSize);
borderFrame = nullptr;
}
offset.x += borderWidth;
}
}
ReflowPlaceChild(child, aPresContext, aReflowState, offset, size, &cellIndex);
ReflowPlaceChild(child, aPresContext, aReflowInput, offset, size, &cellIndex);
if (firstTime) {
int32_t childVis;
@ -1082,7 +1082,7 @@ nsHTMLFramesetFrame::Reflow(nsPresContext* aPresContext,
aDesiredSize.SetOverflowAreasToDesiredBounds();
FinishAndStoreOverflow(&aDesiredSize);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
nsIAtom*
@ -1373,15 +1373,15 @@ void nsHTMLFramesetBorderFrame::SetColor(nscolor aColor)
void
nsHTMLFramesetBorderFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsHTMLFramesetBorderFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
// Override Reflow(), since we don't want to deal with what our
// computed values are.
SizeToAvailSize(aReflowState, aDesiredSize);
SizeToAvailSize(aReflowInput, aDesiredSize);
aDesiredSize.SetOverflowAreasToDesiredBounds();
aStatus = NS_FRAME_COMPLETE;
@ -1588,14 +1588,14 @@ nscoord nsHTMLFramesetBlankFrame::GetIntrinsicBSize()
void
nsHTMLFramesetBlankFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsHTMLFramesetBlankFrame");
// Override Reflow(), since we don't want to deal with what our
// computed values are.
SizeToAvailSize(aReflowState, aDesiredSize);
SizeToAvailSize(aReflowInput, aDesiredSize);
aDesiredSize.SetOverflowAreasToDesiredBounds();
aStatus = NS_FRAME_COMPLETE;

Просмотреть файл

@ -102,7 +102,7 @@ public:
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsIAtom* GetType() const override;
@ -150,7 +150,7 @@ protected:
nsString& aNewAttr);
virtual void GetDesiredSize(nsPresContext* aPresContext,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
ReflowOutput& aDesiredSize);
int32_t GetBorderWidth(nsPresContext* aPresContext,
@ -176,7 +176,7 @@ protected:
void ReflowPlaceChild(nsIFrame* aChild,
nsPresContext* aPresContext,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsPoint& aOffset,
nsSize& aSize,
nsIntPoint* aCellIndex = 0);

Просмотреть файл

@ -208,7 +208,7 @@ nsHTMLScrollFrame::GetType() const
namespace mozilla {
struct MOZ_STACK_CLASS ScrollReflowInput {
const ReflowInput& mReflowState;
const ReflowInput& mReflowInput;
nsBoxLayoutState mBoxState;
ScrollbarStyles mStyles;
nsMargin mComputedBorder;
@ -228,7 +228,7 @@ struct MOZ_STACK_CLASS ScrollReflowInput {
ScrollReflowInput(nsIScrollableFrame* aFrame,
const ReflowInput& aState) :
mReflowState(aState),
mReflowInput(aState),
// mBoxState is just used for scrollbars so we don't need to
// worry about the reflow depth here
mBoxState(aState.mFrame->PresContext(), aState.mRenderingContext, 0),
@ -245,21 +245,21 @@ static nsSize ComputeInsideBorderSize(ScrollReflowInput* aState,
// aDesiredInsideBorderSize is the frame size; i.e., it includes
// borders and padding (but the scrolled child doesn't have
// borders). The scrolled child has the same padding as us.
nscoord contentWidth = aState->mReflowState.ComputedWidth();
nscoord contentWidth = aState->mReflowInput.ComputedWidth();
if (contentWidth == NS_UNCONSTRAINEDSIZE) {
contentWidth = aDesiredInsideBorderSize.width -
aState->mReflowState.ComputedPhysicalPadding().LeftRight();
aState->mReflowInput.ComputedPhysicalPadding().LeftRight();
}
nscoord contentHeight = aState->mReflowState.ComputedHeight();
nscoord contentHeight = aState->mReflowInput.ComputedHeight();
if (contentHeight == NS_UNCONSTRAINEDSIZE) {
contentHeight = aDesiredInsideBorderSize.height -
aState->mReflowState.ComputedPhysicalPadding().TopBottom();
aState->mReflowInput.ComputedPhysicalPadding().TopBottom();
}
contentWidth = aState->mReflowState.ApplyMinMaxWidth(contentWidth);
contentHeight = aState->mReflowState.ApplyMinMaxHeight(contentHeight);
return nsSize(contentWidth + aState->mReflowState.ComputedPhysicalPadding().LeftRight(),
contentHeight + aState->mReflowState.ComputedPhysicalPadding().TopBottom());
contentWidth = aState->mReflowInput.ApplyMinMaxWidth(contentWidth);
contentHeight = aState->mReflowInput.ApplyMinMaxHeight(contentHeight);
return nsSize(contentWidth + aState->mReflowInput.ComputedPhysicalPadding().LeftRight(),
contentHeight + aState->mReflowInput.ComputedPhysicalPadding().TopBottom());
}
static void
@ -438,9 +438,9 @@ nsHTMLScrollFrame::ScrolledContentDependsOnHeight(ScrollReflowInput* aState)
// based on the presence of a horizontal scrollbar.
return mHelper.mScrolledFrame->HasAnyStateBits(
NS_FRAME_CONTAINS_RELATIVE_BSIZE | NS_FRAME_DESCENDANT_INTRINSIC_ISIZE_DEPENDS_ON_BSIZE) ||
aState->mReflowState.ComputedBSize() != NS_UNCONSTRAINEDSIZE ||
aState->mReflowState.ComputedMinBSize() > 0 ||
aState->mReflowState.ComputedMaxBSize() != NS_UNCONSTRAINEDSIZE;
aState->mReflowInput.ComputedBSize() != NS_UNCONSTRAINEDSIZE ||
aState->mReflowInput.ComputedMinBSize() > 0 ||
aState->mReflowInput.ComputedMaxBSize() != NS_UNCONSTRAINEDSIZE;
}
void
@ -454,13 +454,13 @@ nsHTMLScrollFrame::ReflowScrolledFrame(ScrollReflowInput* aState,
// these could be NS_UNCONSTRAINEDSIZE ... std::min arithmetic should
// be OK
LogicalMargin padding = aState->mReflowState.ComputedLogicalPadding();
LogicalMargin padding = aState->mReflowInput.ComputedLogicalPadding();
nscoord availISize =
aState->mReflowState.ComputedISize() + padding.IStartEnd(wm);
aState->mReflowInput.ComputedISize() + padding.IStartEnd(wm);
nscoord computedBSize = aState->mReflowState.ComputedBSize();
nscoord computedMinBSize = aState->mReflowState.ComputedMinBSize();
nscoord computedMaxBSize = aState->mReflowState.ComputedMaxBSize();
nscoord computedBSize = aState->mReflowInput.ComputedBSize();
nscoord computedMinBSize = aState->mReflowInput.ComputedMinBSize();
nscoord computedMaxBSize = aState->mReflowInput.ComputedMaxBSize();
if (!ShouldPropagateComputedBSizeToScrolledContent()) {
computedBSize = NS_UNCONSTRAINEDSIZE;
computedMinBSize = 0;
@ -513,20 +513,20 @@ nsHTMLScrollFrame::ReflowScrolledFrame(ScrollReflowInput* aState,
// Pass false for aInit so we can pass in the correct padding.
ReflowInput
kidReflowState(presContext, aState->mReflowState,
kidReflowInput(presContext, aState->mReflowInput,
mHelper.mScrolledFrame,
LogicalSize(wm, availISize, NS_UNCONSTRAINEDSIZE),
nullptr, ReflowInput::CALLER_WILL_INIT);
const nsMargin physicalPadding = padding.GetPhysicalMargin(wm);
kidReflowState.Init(presContext, nullptr, nullptr,
kidReflowInput.Init(presContext, nullptr, nullptr,
&physicalPadding);
kidReflowState.mFlags.mAssumingHScrollbar = aAssumeHScroll;
kidReflowState.mFlags.mAssumingVScrollbar = aAssumeVScroll;
kidReflowState.SetComputedBSize(computedBSize);
kidReflowState.ComputedMinBSize() = computedMinBSize;
kidReflowState.ComputedMaxBSize() = computedMaxBSize;
if (aState->mReflowState.IsBResizeForWM(kidReflowState.GetWritingMode())) {
kidReflowState.SetBResize(true);
kidReflowInput.mFlags.mAssumingHScrollbar = aAssumeHScroll;
kidReflowInput.mFlags.mAssumingVScrollbar = aAssumeVScroll;
kidReflowInput.SetComputedBSize(computedBSize);
kidReflowInput.ComputedMinBSize() = computedMinBSize;
kidReflowInput.ComputedMaxBSize() = computedMaxBSize;
if (aState->mReflowInput.IsBResizeForWM(kidReflowInput.GetWritingMode())) {
kidReflowInput.SetBResize(true);
}
// Temporarily set mHasHorizontalScrollbar/mHasVerticalScrollbar to
@ -542,7 +542,7 @@ nsHTMLScrollFrame::ReflowScrolledFrame(ScrollReflowInput* aState,
// the frame (i.e. if NS_FRAME_NO_MOVE_FRAME isn't set)
const nsSize dummyContainerSize;
ReflowChild(mHelper.mScrolledFrame, presContext, *aMetrics,
kidReflowState, wm, LogicalPoint(wm), dummyContainerSize,
kidReflowInput, wm, LogicalPoint(wm), dummyContainerSize,
NS_FRAME_NO_MOVE_FRAME, status);
mHelper.mHasHorizontalScrollbar = didHaveHorizontalScrollbar;
@ -554,7 +554,7 @@ nsHTMLScrollFrame::ReflowScrolledFrame(ScrollReflowInput* aState,
// which will usually be different from the scrollport height;
// invalidating the difference will cause unnecessary repainting.
FinishReflowChild(mHelper.mScrolledFrame, presContext,
*aMetrics, &kidReflowState, wm, LogicalPoint(wm),
*aMetrics, &kidReflowInput, wm, LogicalPoint(wm),
dummyContainerSize,
NS_FRAME_NO_MOVE_FRAME | NS_FRAME_NO_SIZE_VIEW);
@ -835,16 +835,16 @@ GetBrowserRoot(nsIContent* aContent)
void
nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsHTMLScrollFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
mHelper.HandleScrollbarStyleSwitching();
ScrollReflowInput state(this, aReflowState);
ScrollReflowInput state(this, aReflowInput);
// sanity check: ensure that if we have no scrollbar, we treat it
// as hidden.
if (!mHelper.mVScrollbarBox || mHelper.mNeverHasVerticalScrollbar)
@ -856,7 +856,7 @@ nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext,
bool reflowHScrollbar = true;
bool reflowVScrollbar = true;
bool reflowScrollCorner = true;
if (!aReflowState.ShouldReflowAllKids()) {
if (!aReflowInput.ShouldReflowAllKids()) {
#define NEEDS_REFLOW(frame_) \
((frame_) && NS_SUBTREE_DIRTY(frame_))
@ -884,8 +884,8 @@ nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext,
mHelper.mScrolledFrame->GetScrollableOverflowRectRelativeToParent();
nsPoint oldScrollPosition = mHelper.GetScrollPosition();
state.mComputedBorder = aReflowState.ComputedPhysicalBorderPadding() -
aReflowState.ComputedPhysicalPadding();
state.mComputedBorder = aReflowInput.ComputedPhysicalBorderPadding() -
aReflowInput.ComputedPhysicalPadding();
ReflowContents(&state, aDesiredSize);
@ -940,7 +940,7 @@ nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext,
}
mHelper.UpdateSticky();
FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize, aReflowState, aStatus);
FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize, aReflowInput, aStatus);
if (!InInitialReflow() && !mHelper.mHadNonInitialReflow) {
mHelper.mHadNonInitialReflow = true;
@ -953,7 +953,7 @@ nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext,
mHelper.UpdatePrevScrolledRect();
aStatus = NS_FRAME_COMPLETE;
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
mHelper.PostOverflowEvent();
}

Просмотреть файл

@ -702,7 +702,7 @@ public:
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override {
@ -1158,8 +1158,8 @@ public:
void RemoveHorizontalScrollbar(nsBoxLayoutState& aState, bool aOnBottom);
void RemoveVerticalScrollbar (nsBoxLayoutState& aState, bool aOnRight);
static void AdjustReflowStateForPrintPreview(nsBoxLayoutState& aState, bool& aSetBack);
static void AdjustReflowStateBack(nsBoxLayoutState& aState, bool aSetBack);
static void AdjustReflowInputForPrintPreview(nsBoxLayoutState& aState, bool& aSetBack);
static void AdjustReflowInputBack(nsBoxLayoutState& aState, bool aSetBack);
// nsIScrollableFrame
virtual nsIFrame* GetScrolledFrame() const override {

Просмотреть файл

@ -67,11 +67,11 @@ ReparentFrames(nsFrameList& aFrameList, nsContainerFrame* aOldParent,
}
static nscoord
ClampToCSSMaxBSize(nscoord aSize, const ReflowInput* aReflowState)
ClampToCSSMaxBSize(nscoord aSize, const ReflowInput* aReflowInput)
{
auto maxSize = aReflowState->ComputedMaxBSize();
auto maxSize = aReflowInput->ComputedMaxBSize();
if (MOZ_UNLIKELY(maxSize != NS_UNCONSTRAINEDSIZE)) {
MOZ_ASSERT(aReflowState->ComputedMinBSize() <= maxSize);
MOZ_ASSERT(aReflowInput->ComputedMinBSize() <= maxSize);
aSize = std::min(aSize, maxSize);
}
return aSize;
@ -82,12 +82,12 @@ ClampToCSSMaxBSize(nscoord aSize, const ReflowInput* aReflowState)
// i.e. we're effectively breaking in our overflow, so we should leave
// aStatus as is (it will likely be set to OVERFLOW_INCOMPLETE later)).
static nscoord
ClampToCSSMaxBSize(nscoord aSize, const ReflowInput* aReflowState,
ClampToCSSMaxBSize(nscoord aSize, const ReflowInput* aReflowInput,
nsReflowStatus* aStatus)
{
auto maxSize = aReflowState->ComputedMaxBSize();
auto maxSize = aReflowInput->ComputedMaxBSize();
if (MOZ_UNLIKELY(maxSize != NS_UNCONSTRAINEDSIZE)) {
MOZ_ASSERT(aReflowState->ComputedMinBSize() <= maxSize);
MOZ_ASSERT(aReflowInput->ComputedMinBSize() <= maxSize);
if (aSize < maxSize) {
NS_FRAME_SET_INCOMPLETE(*aStatus);
} else {
@ -1130,7 +1130,7 @@ struct nsGridContainerFrame::Tracks
/**
* Initialize grid item baseline state and offsets.
*/
void InitializeItemBaselines(GridReflowState& aState,
void InitializeItemBaselines(GridReflowInput& aState,
nsTArray<GridItemInfo>& aGridItems);
/**
@ -1143,7 +1143,7 @@ struct nsGridContainerFrame::Tracks
* Resolve Intrinsic Track Sizes.
* http://dev.w3.org/csswg/css-grid/#algo-content
*/
void ResolveIntrinsicSize(GridReflowState& aState,
void ResolveIntrinsicSize(GridReflowInput& aState,
nsTArray<GridItemInfo>& aGridItems,
const TrackSizingFunctions& aFunctions,
LineRange GridArea::* aRange,
@ -1155,7 +1155,7 @@ struct nsGridContainerFrame::Tracks
* non-spanning items" in the spec. Return true if the track has a <flex>
* max-sizing function, false otherwise.
*/
bool ResolveIntrinsicSizeStep1(GridReflowState& aState,
bool ResolveIntrinsicSizeStep1(GridReflowInput& aState,
const TrackSizingFunctions& aFunctions,
nscoord aPercentageBasis,
IntrinsicISizeType aConstraint,
@ -1454,7 +1454,7 @@ struct nsGridContainerFrame::Tracks
* (The returned value is a 'nscoord' divided by a factor - a floating type
* is used to avoid intermediary rounding errors.)
*/
float FindUsedFlexFraction(GridReflowState& aState,
float FindUsedFlexFraction(GridReflowInput& aState,
nsTArray<GridItemInfo>& aGridItems,
const nsTArray<uint32_t>& aFlexTracks,
const TrackSizingFunctions& aFunctions,
@ -1464,7 +1464,7 @@ struct nsGridContainerFrame::Tracks
* Implements "12.7. Stretch Flexible Tracks"
* http://dev.w3.org/csswg/css-grid/#algo-flex-tracks
*/
void StretchFlexibleTracks(GridReflowState& aState,
void StretchFlexibleTracks(GridReflowInput& aState,
nsTArray<GridItemInfo>& aGridItems,
const TrackSizingFunctions& aFunctions,
nscoord aAvailableSize);
@ -1473,7 +1473,7 @@ struct nsGridContainerFrame::Tracks
* Implements "12.3. Track Sizing Algorithm"
* http://dev.w3.org/csswg/css-grid/#algo-track-sizing
*/
void CalculateSizes(GridReflowState& aState,
void CalculateSizes(GridReflowInput& aState,
nsTArray<GridItemInfo>& aGridItems,
const TrackSizingFunctions& aFunctions,
nscoord aContentSize,
@ -1638,14 +1638,14 @@ struct nsGridContainerFrame::Tracks
/**
* Grid data shared by all continuations, owned by the first-in-flow.
* The data is initialized from the first-in-flow's GridReflowState at
* The data is initialized from the first-in-flow's GridReflowInput at
* the end of its reflow. Fragmentation will modify mRows.mSizes -
* the mPosition to remove the row gap at the break boundary, the mState
* by setting the eBreakBefore flag, and mBase is modified when we decide
* to grow a row. mOriginalRowData is setup by the first-in-flow and
* not modified after that. It's used for undoing the changes to mRows.
* mCols, mGridItems, mAbsPosItems are used for initializing the grid
* reflow state for continuations, see GridReflowState::Initialize below.
* reflow state for continuations, see GridReflowInput::Initialize below.
*/
struct nsGridContainerFrame::SharedGridData
{
@ -1663,21 +1663,21 @@ struct nsGridContainerFrame::SharedGridData
/**
* Only set on the first-in-flow. Continuations will Initialize() their
* GridReflowState from it.
* GridReflowInput from it.
*/
NS_DECLARE_FRAME_PROPERTY_DELETABLE(Prop, SharedGridData)
};
struct MOZ_STACK_CLASS nsGridContainerFrame::GridReflowState
struct MOZ_STACK_CLASS nsGridContainerFrame::GridReflowInput
{
GridReflowState(nsGridContainerFrame* aFrame,
GridReflowInput(nsGridContainerFrame* aFrame,
const ReflowInput& aRS)
: GridReflowState(aFrame, *aRS.mRenderingContext, &aRS, aRS.mStylePosition,
: GridReflowInput(aFrame, *aRS.mRenderingContext, &aRS, aRS.mStylePosition,
aRS.GetWritingMode())
{}
GridReflowState(nsGridContainerFrame* aFrame,
GridReflowInput(nsGridContainerFrame* aFrame,
nsRenderingContext& aRC)
: GridReflowState(aFrame, aRC, nullptr, aFrame->StylePosition(),
: GridReflowInput(aFrame, aRC, nullptr, aFrame->StylePosition(),
aFrame->GetWritingMode())
{}
@ -1825,11 +1825,11 @@ struct MOZ_STACK_CLASS nsGridContainerFrame::GridReflowState
nsTArray<GridItemInfo> mAbsPosItems;
/**
* @note mReflowState may be null when using the 2nd ctor above. In this case
* @note mReflowInput may be null when using the 2nd ctor above. In this case
* we'll construct a dummy parent reflow state if we need it to calculate
* min/max-content contributions when sizing tracks.
*/
const ReflowInput* const mReflowState;
const ReflowInput* const mReflowInput;
nsRenderingContext& mRenderingContext;
nsGridContainerFrame* const mFrame;
SharedGridData* mSharedGridData; // [weak] owned by mFrame's first-in-flow.
@ -1848,9 +1848,9 @@ struct MOZ_STACK_CLASS nsGridContainerFrame::GridReflowState
const WritingMode mWM;
private:
GridReflowState(nsGridContainerFrame* aFrame,
GridReflowInput(nsGridContainerFrame* aFrame,
nsRenderingContext& aRenderingContext,
const ReflowInput* aReflowState,
const ReflowInput* aReflowInput,
const nsStylePosition* aGridStyle,
const WritingMode& aWM)
: mIter(aFrame, kPrincipalList)
@ -1863,7 +1863,7 @@ private:
, mRowFunctions(mGridStyle->mGridTemplateRows,
mGridStyle->mGridAutoRowsMin,
mGridStyle->mGridAutoRowsMax)
, mReflowState(aReflowState)
, mReflowInput(aReflowInput)
, mRenderingContext(aRenderingContext)
, mFrame(aFrame)
, mSharedGridData(nullptr)
@ -1872,16 +1872,16 @@ private:
, mStartRow(0)
, mWM(aWM)
{
MOZ_ASSERT(!aReflowState || aReflowState->mFrame == mFrame);
if (aReflowState) {
mBorderPadding = aReflowState->ComputedLogicalBorderPadding();
MOZ_ASSERT(!aReflowInput || aReflowInput->mFrame == mFrame);
if (aReflowInput) {
mBorderPadding = aReflowInput->ComputedLogicalBorderPadding();
mSkipSides = aFrame->PreReflowBlockLevelLogicalSkipSides();
mBorderPadding.ApplySkipSides(mSkipSides);
}
}
};
using GridReflowState = nsGridContainerFrame::GridReflowState;
using GridReflowInput = nsGridContainerFrame::GridReflowInput;
/**
* The Grid implements grid item placement and the state of the grid -
@ -1900,7 +1900,7 @@ struct MOZ_STACK_CLASS nsGridContainerFrame::Grid
* @param aComputedMaxSize the container's max-size - used to determine
* the number of repeat(auto-fill/fit) tracks.
*/
void PlaceGridItems(GridReflowState& aState,
void PlaceGridItems(GridReflowInput& aState,
const LogicalSize& aComputedMinSize,
const LogicalSize& aComputedSize,
const LogicalSize& aComputedMaxSize);
@ -2254,7 +2254,7 @@ struct MOZ_STACK_CLASS nsGridContainerFrame::Grid
};
void
nsGridContainerFrame::GridReflowState::CalculateTrackSizes(
nsGridContainerFrame::GridReflowInput::CalculateTrackSizes(
const Grid& aGrid,
const LogicalSize& aContentBox,
IntrinsicISizeType aConstraint)
@ -3093,7 +3093,7 @@ nsGridContainerFrame::Grid::PlaceAutoAutoInColOrder(uint32_t aStartCol,
}
void
nsGridContainerFrame::Grid::PlaceGridItems(GridReflowState& aState,
nsGridContainerFrame::Grid::PlaceGridItems(GridReflowInput& aState,
const LogicalSize& aComputedMinSize,
const LogicalSize& aComputedSize,
const LogicalSize& aComputedMaxSize)
@ -3420,15 +3420,15 @@ nsGridContainerFrame::Tracks::Initialize(
*/
static nscoord
MeasuringReflow(nsIFrame* aChild,
const ReflowInput* aReflowState,
const ReflowInput* aReflowInput,
nsRenderingContext* aRC,
const LogicalSize& aAvailableSize)
{
nsContainerFrame* parent = aChild->GetParent();
nsPresContext* pc = aChild->PresContext();
Maybe<ReflowInput> dummyParentState;
const ReflowInput* rs = aReflowState;
if (!aReflowState) {
const ReflowInput* rs = aReflowInput;
if (!aReflowInput) {
MOZ_ASSERT(!parent->HasAnyStateBits(NS_FRAME_IN_REFLOW));
dummyParentState.emplace(pc, parent, aRC,
LogicalSize(parent->GetWritingMode(), 0,
@ -3464,7 +3464,7 @@ MeasuringReflow(nsIFrame* aChild,
*/
static nscoord
ContentContribution(const GridItemInfo& aGridItem,
const GridReflowState& aState,
const GridReflowInput& aState,
nsRenderingContext* aRC,
WritingMode aCBWM,
LogicalAxis aAxis,
@ -3490,7 +3490,7 @@ ContentContribution(const GridItemInfo& aGridItem,
}
}
LogicalSize availableSize(childWM, cbISize, cbBSize);
size = ::MeasuringReflow(child, aState.mReflowState, aRC, availableSize);
size = ::MeasuringReflow(child, aState.mReflowInput, aRC, availableSize);
nsIFrame::IntrinsicISizeOffsetData offsets = child->IntrinsicBSizeOffsets();
size += offsets.hMargin;
size = nsLayoutUtils::AddPercents(aConstraint, size, offsets.hPctMargin);
@ -3506,7 +3506,7 @@ ContentContribution(const GridItemInfo& aGridItem,
static nscoord
MinContentContribution(const GridItemInfo& aGridItem,
const GridReflowState& aState,
const GridReflowInput& aState,
nsRenderingContext* aRC,
WritingMode aCBWM,
LogicalAxis aAxis)
@ -3517,7 +3517,7 @@ MinContentContribution(const GridItemInfo& aGridItem,
static nscoord
MaxContentContribution(const GridItemInfo& aGridItem,
const GridReflowState& aState,
const GridReflowInput& aState,
nsRenderingContext* aRC,
WritingMode aCBWM,
LogicalAxis aAxis)
@ -3528,7 +3528,7 @@ MaxContentContribution(const GridItemInfo& aGridItem,
static nscoord
MinSize(const GridItemInfo& aGridItem,
const GridReflowState& aState,
const GridReflowInput& aState,
nsRenderingContext* aRC,
WritingMode aCBWM,
LogicalAxis aAxis)
@ -3567,7 +3567,7 @@ MinSize(const GridItemInfo& aGridItem,
void
nsGridContainerFrame::Tracks::CalculateSizes(
GridReflowState& aState,
GridReflowInput& aState,
nsTArray<GridItemInfo>& aGridItems,
const TrackSizingFunctions& aFunctions,
nscoord aContentBoxSize,
@ -3621,7 +3621,7 @@ nsGridContainerFrame::Tracks::HasIntrinsicButNoFlexSizingInRange(
bool
nsGridContainerFrame::Tracks::ResolveIntrinsicSizeStep1(
GridReflowState& aState,
GridReflowInput& aState,
const TrackSizingFunctions& aFunctions,
nscoord aPercentageBasis,
IntrinsicISizeType aConstraint,
@ -3730,7 +3730,7 @@ nsGridContainerFrame::Tracks::CalculateItemBaselines(
void
nsGridContainerFrame::Tracks::InitializeItemBaselines(
GridReflowState& aState,
GridReflowInput& aState,
nsTArray<GridItemInfo>& aGridItems)
{
@ -3838,7 +3838,7 @@ nsGridContainerFrame::Tracks::InitializeItemBaselines(
auto* rc = &aState.mRenderingContext;
// XXX figure out if we can avoid/merge this reflow with the main reflow.
// XXX (after bug 1174569 is sorted out)
::MeasuringReflow(child, aState.mReflowState, rc, avail);
::MeasuringReflow(child, aState.mReflowInput, rc, avail);
nscoord baseline;
if (state & ItemState::eFirstBaseline) {
if (nsLayoutUtils::GetFirstLineBaseline(wm, child, &baseline)) {
@ -3941,7 +3941,7 @@ nsGridContainerFrame::Tracks::AlignBaselineSubtree(
void
nsGridContainerFrame::Tracks::ResolveIntrinsicSize(
GridReflowState& aState,
GridReflowInput& aState,
nsTArray<GridItemInfo>& aGridItems,
const TrackSizingFunctions& aFunctions,
LineRange GridArea::* aRange,
@ -4246,7 +4246,7 @@ nsGridContainerFrame::Tracks::FindFrUnitSize(
float
nsGridContainerFrame::Tracks::FindUsedFlexFraction(
GridReflowState& aState,
GridReflowInput& aState,
nsTArray<GridItemInfo>& aGridItems,
const nsTArray<uint32_t>& aFlexTracks,
const TrackSizingFunctions& aFunctions,
@ -4299,7 +4299,7 @@ nsGridContainerFrame::Tracks::FindUsedFlexFraction(
void
nsGridContainerFrame::Tracks::StretchFlexibleTracks(
GridReflowState& aState,
GridReflowInput& aState,
nsTArray<GridItemInfo>& aGridItems,
const TrackSizingFunctions& aFunctions,
nscoord aAvailableSize)
@ -4526,7 +4526,7 @@ nsGridContainerFrame::LineRange::ToPositionAndLengthForAbsPos(
}
LogicalRect
nsGridContainerFrame::GridReflowState::ContainingBlockFor(const GridArea& aArea) const
nsGridContainerFrame::GridReflowInput::ContainingBlockFor(const GridArea& aArea) const
{
nscoord i, b, iSize, bSize;
MOZ_ASSERT(aArea.mCols.Extent() > 0, "grid items cover at least one track");
@ -4537,7 +4537,7 @@ nsGridContainerFrame::GridReflowState::ContainingBlockFor(const GridArea& aArea)
}
LogicalRect
nsGridContainerFrame::GridReflowState::ContainingBlockForAbsPos(
nsGridContainerFrame::GridReflowInput::ContainingBlockForAbsPos(
const GridArea& aArea,
const LogicalPoint& aGridOrigin,
const LogicalRect& aGridCB) const
@ -4560,13 +4560,13 @@ nsGridContainerFrame::GridReflowState::ContainingBlockForAbsPos(
* the same writing-mode and have overflow:visible.
*/
Maybe<nsGridContainerFrame::Fragmentainer>
nsGridContainerFrame::GetNearestFragmentainer(const GridReflowState& aState) const
nsGridContainerFrame::GetNearestFragmentainer(const GridReflowInput& aState) const
{
Maybe<nsGridContainerFrame::Fragmentainer> data;
WritingMode wm = aState.mWM;
const ReflowInput* gridRS = aState.mReflowState;
const ReflowInput* cbRS = gridRS->mCBReflowState;
for ( ; cbRS; cbRS = cbRS->mCBReflowState) {
const ReflowInput* gridRS = aState.mReflowInput;
const ReflowInput* cbRS = gridRS->mCBReflowInput;
for ( ; cbRS; cbRS = cbRS->mCBReflowInput) {
nsIScrollableFrame* sf = do_QueryFrame(cbRS->mFrame);
if (sf) {
break;
@ -4610,15 +4610,15 @@ nsGridContainerFrame::ReflowInFlowChild(nsIFrame* aChild,
nsSize aContainerSize,
Maybe<nscoord> aStretchBSize,
const Fragmentainer* aFragmentainer,
const GridReflowState& aState,
const GridReflowInput& aState,
const LogicalRect& aContentArea,
ReflowOutput& aDesiredSize,
nsReflowStatus& aStatus)
{
nsPresContext* pc = PresContext();
nsStyleContext* containerSC = StyleContext();
WritingMode wm = aState.mReflowState->GetWritingMode();
LogicalMargin pad(aState.mReflowState->ComputedLogicalPadding());
WritingMode wm = aState.mReflowInput->GetWritingMode();
LogicalMargin pad(aState.mReflowInput->ComputedLogicalPadding());
const LogicalPoint padStart(wm, pad.IStart(wm), pad.BStart(wm));
const bool isGridItem = !!aGridItemInfo;
MOZ_ASSERT(isGridItem == (aChild->GetType() != nsGkAtoms::placeholderFrame));
@ -4693,7 +4693,7 @@ nsGridContainerFrame::ReflowInFlowChild(nsIFrame* aChild,
}
LogicalSize percentBasis(cb.Size(wm).ConvertTo(childWM, wm));
ReflowInput childRS(pc, *aState.mReflowState, aChild, childCBSize,
ReflowInput childRS(pc, *aState.mReflowInput, aChild, childCBSize,
&percentBasis);
childRS.mFlags.mIsTopOfPage = aFragmentainer ? aFragmentainer->mIsTopOfPage : false;
@ -4760,7 +4760,7 @@ nsGridContainerFrame::ReflowInFlowChild(nsIFrame* aChild,
}
nscoord
nsGridContainerFrame::ReflowInFragmentainer(GridReflowState& aState,
nsGridContainerFrame::ReflowInFragmentainer(GridReflowInput& aState,
const LogicalRect& aContentArea,
ReflowOutput& aDesiredSize,
nsReflowStatus& aStatus,
@ -4768,7 +4768,7 @@ nsGridContainerFrame::ReflowInFragmentainer(GridReflowState& aState,
const nsSize& aContainerSize)
{
MOZ_ASSERT(aStatus == NS_FRAME_COMPLETE);
MOZ_ASSERT(aState.mReflowState);
MOZ_ASSERT(aState.mReflowInput);
// Collect our grid items and sort them in row order. Collect placeholders
// and put them in a separate array.
@ -4803,7 +4803,7 @@ nsGridContainerFrame::ReflowInFragmentainer(GridReflowState& aState,
nscoord childAvailableSize = aFragmentainer.mToFragmentainerEnd;
const uint32_t startRow = aState.mStartRow;
const uint32_t numRows = aState.mRows.mSizes.Length();
bool isBDBClone = aState.mReflowState->mStyleBorder->mBoxDecorationBreak ==
bool isBDBClone = aState.mReflowInput->mStyleBorder->mBoxDecorationBreak ==
NS_STYLE_BOX_DECORATION_BREAK_CLONE;
nscoord bpBEnd = aState.mBorderPadding.BEnd(aState.mWM);
@ -4823,7 +4823,7 @@ nsGridContainerFrame::ReflowInFragmentainer(GridReflowState& aState,
// Check for forced breaks on the items.
const bool isTopOfPage = aFragmentainer.mIsTopOfPage;
bool isForcedBreak = false;
const bool avoidBreakInside = ShouldAvoidBreakInside(*aState.mReflowState);
const bool avoidBreakInside = ShouldAvoidBreakInside(*aState.mReflowInput);
for (const GridItemInfo* info : sortedItems) {
uint32_t itemStartRow = info->mArea.mRows.mStart;
if (itemStartRow == endRow) {
@ -4885,7 +4885,7 @@ nsGridContainerFrame::ReflowInFragmentainer(GridReflowState& aState,
// We only apply min-bsize once all rows are complete (when bsize is auto).
if (endRow < numRows) {
bSize = bEndRow;
auto clampedBSize = ClampToCSSMaxBSize(bSize, aState.mReflowState);
auto clampedBSize = ClampToCSSMaxBSize(bSize, aState.mReflowInput);
if (MOZ_UNLIKELY(clampedBSize != bSize)) {
// We apply max-bsize in all fragments though.
bSize = clampedBSize;
@ -4896,13 +4896,13 @@ nsGridContainerFrame::ReflowInFragmentainer(GridReflowState& aState,
}
} else {
bSize = NS_CSS_MINMAX(bEndRow,
aState.mReflowState->ComputedMinBSize(),
aState.mReflowState->ComputedMaxBSize());
aState.mReflowInput->ComputedMinBSize(),
aState.mReflowInput->ComputedMaxBSize());
}
} else {
bSize = NS_CSS_MINMAX(aState.mReflowState->ComputedBSize(),
aState.mReflowState->ComputedMinBSize(),
aState.mReflowState->ComputedMaxBSize());
bSize = NS_CSS_MINMAX(aState.mReflowInput->ComputedBSize(),
aState.mReflowInput->ComputedMinBSize(),
aState.mReflowInput->ComputedMaxBSize());
}
// Check for overflow and set aStatus INCOMPLETE if so.
@ -4942,12 +4942,12 @@ nsGridContainerFrame::ReflowInFragmentainer(GridReflowState& aState,
bEndRow = aState.mRows.GridLineEdge(endRow, GridLineSide::eBeforeGridGap);
bSize = bEndRow;
if (aFragmentainer.mIsAutoBSize) {
bSize = ClampToCSSMaxBSize(bSize, aState.mReflowState);
bSize = ClampToCSSMaxBSize(bSize, aState.mReflowInput);
}
}
NS_FRAME_SET_INCOMPLETE(aStatus);
} else if (endRow < numRows) {
bSize = ClampToCSSMaxBSize(bEndRow, aState.mReflowState, &aStatus);
bSize = ClampToCSSMaxBSize(bEndRow, aState.mReflowInput, &aStatus);
} // else - no break opportunities.
} else {
// Even though our block-size fits we need to honor forced breaks, or if
@ -4955,7 +4955,7 @@ nsGridContainerFrame::ReflowInFragmentainer(GridReflowState& aState,
// by a max-bsize which make us overflow-incomplete).
if (endRow < numRows && (isForcedBreak ||
(aFragmentainer.mIsAutoBSize && bEndRow == bSize))) {
bSize = ClampToCSSMaxBSize(bEndRow, aState.mReflowState, &aStatus);
bSize = ClampToCSSMaxBSize(bEndRow, aState.mReflowInput, &aStatus);
}
}
@ -4978,7 +4978,7 @@ nsGridContainerFrame::ReflowInFragmentainer(GridReflowState& aState,
nscoord
nsGridContainerFrame::ReflowRowsInFragmentainer(
GridReflowState& aState,
GridReflowInput& aState,
const LogicalRect& aContentArea,
ReflowOutput& aDesiredSize,
nsReflowStatus& aStatus,
@ -4993,7 +4993,7 @@ nsGridContainerFrame::ReflowRowsInFragmentainer(
FrameHashtable pushedItems;
FrameHashtable incompleteItems;
FrameHashtable overflowIncompleteItems;
bool isBDBClone = aState.mReflowState->mStyleBorder->mBoxDecorationBreak ==
bool isBDBClone = aState.mReflowInput->mStyleBorder->mBoxDecorationBreak ==
NS_STYLE_BOX_DECORATION_BREAK_CLONE;
bool didGrowRow = false;
// As we walk across rows, we track whether the current row is at the top
@ -5098,11 +5098,11 @@ nsGridContainerFrame::ReflowRowsInFragmentainer(
aState.mRows.GridLineEdge(aEndRow, GridLineSide::eBeforeGridGap);
aFragmentainer.mToFragmentainerEnd = bEndRow;
if (aFragmentainer.mIsAutoBSize) {
aBSize = ClampToCSSMaxBSize(bEndRow, aState.mReflowState, &aStatus);
aBSize = ClampToCSSMaxBSize(bEndRow, aState.mReflowInput, &aStatus);
} else if (NS_FRAME_IS_NOT_COMPLETE(aStatus)) {
aBSize = NS_CSS_MINMAX(aState.mReflowState->ComputedBSize(),
aState.mReflowState->ComputedMinBSize(),
aState.mReflowState->ComputedMaxBSize());
aBSize = NS_CSS_MINMAX(aState.mReflowInput->ComputedBSize(),
aState.mReflowInput->ComputedMinBSize(),
aState.mReflowInput->ComputedMaxBSize());
aBSize = std::min(bEndRow, aBSize);
}
continue;
@ -5256,23 +5256,23 @@ nsGridContainerFrame::ReflowRowsInFragmentainer(
}
nscoord
nsGridContainerFrame::ReflowChildren(GridReflowState& aState,
nsGridContainerFrame::ReflowChildren(GridReflowInput& aState,
const LogicalRect& aContentArea,
ReflowOutput& aDesiredSize,
nsReflowStatus& aStatus)
{
MOZ_ASSERT(aState.mReflowState);
MOZ_ASSERT(aState.mReflowInput);
aStatus = NS_FRAME_COMPLETE;
nsOverflowAreas ocBounds;
nsReflowStatus ocStatus = NS_FRAME_COMPLETE;
if (GetPrevInFlow()) {
ReflowOverflowContainerChildren(PresContext(), *aState.mReflowState,
ReflowOverflowContainerChildren(PresContext(), *aState.mReflowInput,
ocBounds, 0, ocStatus,
MergeSortedFrameListsFor);
}
WritingMode wm = aState.mReflowState->GetWritingMode();
WritingMode wm = aState.mReflowInput->GetWritingMode();
const nsSize containerSize =
(aContentArea.Size(wm) + aState.mBorderPadding.Size(wm)).GetPhysicalSize(wm);
@ -5305,7 +5305,7 @@ nsGridContainerFrame::ReflowChildren(GridReflowState& aState,
if (!children.IsEmpty()) {
// 'gridOrigin' is the origin of the grid (the start of the first track),
// with respect to the grid container's padding-box (CB).
LogicalMargin pad(aState.mReflowState->ComputedLogicalPadding());
LogicalMargin pad(aState.mReflowInput->ComputedLogicalPadding());
const LogicalPoint gridOrigin(wm, pad.IStart(wm), pad.BStart(wm));
const LogicalRect gridCB(wm, 0, 0,
aContentArea.ISize(wm) + pad.IStartEnd(wm),
@ -5336,7 +5336,7 @@ nsGridContainerFrame::ReflowChildren(GridReflowState& aState,
flags |= AbsPosReflowFlags::eConstrainHeight;
flags |= AbsPosReflowFlags::eIsGridContainerCB;
GetAbsoluteContainingBlock()->Reflow(this, PresContext(),
*aState.mReflowState,
*aState.mReflowInput,
aStatus, dummyRect, flags,
&aDesiredSize.mOverflowAreas);
}
@ -5347,14 +5347,14 @@ nsGridContainerFrame::ReflowChildren(GridReflowState& aState,
void
nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsGridContainerFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
if (IsFrameTreeTooDeep(aReflowState, aDesiredSize, aStatus)) {
if (IsFrameTreeTooDeep(aReflowInput, aDesiredSize, aStatus)) {
return;
}
@ -5528,19 +5528,19 @@ nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
SanityCheckGridItemsBeforeReflow();
#endif // DEBUG
const nsStylePosition* stylePos = aReflowState.mStylePosition;
const nsStylePosition* stylePos = aReflowInput.mStylePosition;
if (!prevInFlow) {
InitImplicitNamedAreas(stylePos);
}
GridReflowState gridReflowState(this, aReflowState);
if (gridReflowState.mIter.ItemsAreAlreadyInOrder()) {
GridReflowInput gridReflowInput(this, aReflowInput);
if (gridReflowInput.mIter.ItemsAreAlreadyInOrder()) {
AddStateBits(NS_STATE_GRID_NORMAL_FLOW_CHILDREN_IN_CSS_ORDER);
} else {
RemoveStateBits(NS_STATE_GRID_NORMAL_FLOW_CHILDREN_IN_CSS_ORDER);
}
const nscoord computedBSize = aReflowState.ComputedBSize();
const nscoord computedISize = aReflowState.ComputedISize();
const WritingMode& wm = gridReflowState.mWM;
const nscoord computedBSize = aReflowInput.ComputedBSize();
const nscoord computedISize = aReflowInput.ComputedISize();
const WritingMode& wm = gridReflowInput.mWM;
LogicalSize computedSize(wm, computedISize, computedBSize);
nscoord consumedBSize = 0;
@ -5548,8 +5548,8 @@ nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
// ComputedMinSize is zero rather than NS_UNCONSTRAINEDSIZE when indefinite
// (unfortunately) so we have to check the style data and parent reflow state
// to determine if it's indefinite.
LogicalSize computedMinSize(aReflowState.ComputedMinSize());
const ReflowInput* cbState = aReflowState.mCBReflowState;
LogicalSize computedMinSize(aReflowInput.ComputedMinSize());
const ReflowInput* cbState = aReflowInput.mCBReflowInput;
if (!stylePos->MinISize(wm).IsCoordPercentCalcUnit() ||
(stylePos->MinISize(wm).HasPercent() && cbState &&
cbState->ComputedSize(wm).ISize(wm) == NS_UNCONSTRAINEDSIZE)) {
@ -5561,53 +5561,53 @@ nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
computedMinSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
}
Grid grid;
grid.PlaceGridItems(gridReflowState, computedMinSize, computedSize,
aReflowState.ComputedMaxSize());
grid.PlaceGridItems(gridReflowInput, computedMinSize, computedSize,
aReflowInput.ComputedMaxSize());
gridReflowState.CalculateTrackSizes(grid, computedSize,
gridReflowInput.CalculateTrackSizes(grid, computedSize,
nsLayoutUtils::PREF_ISIZE);
} else {
consumedBSize = GetConsumedBSize();
gridReflowState.InitializeForContinuation(this, consumedBSize);
gridReflowInput.InitializeForContinuation(this, consumedBSize);
}
nscoord bSize = 0;
if (computedBSize == NS_AUTOHEIGHT) {
const uint32_t numRows = gridReflowState.mRows.mSizes.Length();
const uint32_t numRows = gridReflowInput.mRows.mSizes.Length();
if (!prevInFlow) {
// Note: we can't use GridLineEdge here since we haven't calculated
// the rows' mPosition yet (happens in AlignJustifyContent below).
for (uint32_t i = 0; i < numRows; ++i) {
bSize += gridReflowState.mRows.mSizes[i].mBase;
bSize += gridReflowInput.mRows.mSizes[i].mBase;
}
bSize += gridReflowState.mRows.SumOfGridGaps();
bSize += gridReflowInput.mRows.SumOfGridGaps();
} else {
bSize = gridReflowState.mRows.GridLineEdge(numRows,
bSize = gridReflowInput.mRows.GridLineEdge(numRows,
GridLineSide::eAfterGridGap);
}
bSize = NS_CSS_MINMAX(bSize,
aReflowState.ComputedMinBSize(),
aReflowState.ComputedMaxBSize());
aReflowInput.ComputedMinBSize(),
aReflowInput.ComputedMaxBSize());
} else {
bSize = computedBSize;
}
bSize = std::max(bSize - consumedBSize, 0);
auto& bp = gridReflowState.mBorderPadding;
auto& bp = gridReflowInput.mBorderPadding;
LogicalRect contentArea(wm, bp.IStart(wm), bp.BStart(wm),
computedISize, bSize);
if (!prevInFlow) {
// Apply 'align/justify-content' to the grid.
// CalculateTrackSizes did the columns.
gridReflowState.mRows.AlignJustifyContent(stylePos, wm, contentArea.Size(wm));
gridReflowInput.mRows.AlignJustifyContent(stylePos, wm, contentArea.Size(wm));
}
bSize = ReflowChildren(gridReflowState, contentArea, aDesiredSize, aStatus);
bSize = ReflowChildren(gridReflowInput, contentArea, aDesiredSize, aStatus);
bSize = std::max(bSize - consumedBSize, 0);
// Skip our block-end border if we're INCOMPLETE.
if (!NS_FRAME_IS_COMPLETE(aStatus) &&
!gridReflowState.mSkipSides.BEnd() &&
!gridReflowInput.mSkipSides.BEnd() &&
StyleBorder()->mBoxDecorationBreak !=
NS_STYLE_BOX_DECORATION_BREAK_CLONE) {
bp.BEnd(wm) = nscoord(0);
@ -5641,16 +5641,16 @@ nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
// Now that we know column and row sizes and positions, set
// the ComputedGridTrackInfo and related properties
uint32_t colTrackCount = gridReflowState.mCols.mSizes.Length();
uint32_t colTrackCount = gridReflowInput.mCols.mSizes.Length();
nsTArray<nscoord> colTrackPositions(colTrackCount);
nsTArray<nscoord> colTrackSizes(colTrackCount);
nsTArray<uint32_t> colTrackStates(colTrackCount);
uint32_t col = 0;
for (const TrackSize& sz : gridReflowState.mCols.mSizes) {
for (const TrackSize& sz : gridReflowInput.mCols.mSizes) {
colTrackPositions.AppendElement(sz.mPosition);
colTrackSizes.AppendElement(sz.mBase);
bool isRepeat = ((col >= gridReflowState.mColFunctions.mRepeatAutoStart) &&
(col < gridReflowState.mColFunctions.mRepeatAutoEnd));
bool isRepeat = ((col >= gridReflowInput.mColFunctions.mRepeatAutoStart) &&
(col < gridReflowInput.mColFunctions.mRepeatAutoEnd));
colTrackStates.AppendElement(
isRepeat ?
(uint32_t)mozilla::dom::GridTrackState::Repeat :
@ -5660,8 +5660,8 @@ nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
col++;
}
ComputedGridTrackInfo* colInfo = new ComputedGridTrackInfo(
gridReflowState.mColFunctions.mExplicitGridOffset,
gridReflowState.mColFunctions.NumExplicitTracks(),
gridReflowInput.mColFunctions.mExplicitGridOffset,
gridReflowInput.mColFunctions.NumExplicitTracks(),
0,
col,
Move(colTrackPositions),
@ -5669,16 +5669,16 @@ nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
Move(colTrackStates));
Properties().Set(GridColTrackInfo(), colInfo);
uint32_t rowTrackCount = gridReflowState.mRows.mSizes.Length();
uint32_t rowTrackCount = gridReflowInput.mRows.mSizes.Length();
nsTArray<nscoord> rowTrackPositions(rowTrackCount);
nsTArray<nscoord> rowTrackSizes(rowTrackCount);
nsTArray<uint32_t> rowTrackStates(rowTrackCount);
uint32_t row = 0;
for (const TrackSize& sz : gridReflowState.mRows.mSizes) {
for (const TrackSize& sz : gridReflowInput.mRows.mSizes) {
rowTrackPositions.AppendElement(sz.mPosition);
rowTrackSizes.AppendElement(sz.mBase);
bool isRepeat = ((row >= gridReflowState.mRowFunctions.mRepeatAutoStart) &&
(row < gridReflowState.mRowFunctions.mRepeatAutoEnd));
bool isRepeat = ((row >= gridReflowInput.mRowFunctions.mRepeatAutoStart) &&
(row < gridReflowInput.mRowFunctions.mRepeatAutoEnd));
rowTrackStates.AppendElement(
isRepeat ?
(uint32_t)mozilla::dom::GridTrackState::Repeat :
@ -5691,9 +5691,9 @@ nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
// later calls to Reflow. For now, presume that no more fragmentation will
// occur.
ComputedGridTrackInfo* rowInfo = new ComputedGridTrackInfo(
gridReflowState.mRowFunctions.mExplicitGridOffset,
gridReflowState.mRowFunctions.NumExplicitTracks(),
gridReflowState.mStartRow,
gridReflowInput.mRowFunctions.mExplicitGridOffset,
gridReflowInput.mRowFunctions.NumExplicitTracks(),
gridReflowInput.mStartRow,
row,
Move(rowTrackPositions),
Move(rowTrackSizes),
@ -5723,7 +5723,7 @@ nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
priorRowInfo->mNumLeadingImplicitTracks,
priorRowInfo->mNumExplicitTracks,
priorRowInfo->mStartFragmentTrack,
gridReflowState.mStartRow,
gridReflowInput.mStartRow,
Move(priorRowInfo->mPositions),
Move(priorRowInfo->mSizes),
Move(priorRowInfo->mStates));
@ -5734,14 +5734,14 @@ nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
// repeat tracks produced in the reflow.
// Generate column lines first.
uint32_t capacity = gridReflowState.mColFunctions.NumRepeatTracks() +
gridReflowState.mCols.mSizes.Length();
uint32_t capacity = gridReflowInput.mColFunctions.NumRepeatTracks() +
gridReflowInput.mCols.mSizes.Length();
nsTArray<nsTArray<nsString>> columnLineNames(capacity);
for (col = 0; col <= gridReflowState.mCols.mSizes.Length(); col++) {
for (col = 0; col <= gridReflowInput.mCols.mSizes.Length(); col++) {
columnLineNames.AppendElement(
gridReflowState.mCols.GetLineNamesAtIndex(
gridReflowState.mGridStyle->mGridTemplateColumns,
gridReflowState.mColFunctions,
gridReflowInput.mCols.GetLineNamesAtIndex(
gridReflowInput.mGridStyle->mGridTemplateColumns,
gridReflowInput.mColFunctions,
col));
}
ComputedGridLineInfo* columnLineInfo = new ComputedGridLineInfo(
@ -5749,14 +5749,14 @@ nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
Properties().Set(GridColumnLineInfo(), columnLineInfo);
// Generate row lines next.
capacity = gridReflowState.mRowFunctions.NumRepeatTracks() +
gridReflowState.mRows.mSizes.Length();
capacity = gridReflowInput.mRowFunctions.NumRepeatTracks() +
gridReflowInput.mRows.mSizes.Length();
nsTArray<nsTArray<nsString>> rowLineNames(capacity);
for (row = 0; row <= gridReflowState.mRows.mSizes.Length(); row++) {
for (row = 0; row <= gridReflowInput.mRows.mSizes.Length(); row++) {
rowLineNames.AppendElement(
gridReflowState.mRows.GetLineNamesAtIndex(
gridReflowState.mGridStyle->mGridTemplateRows,
gridReflowState.mRowFunctions,
gridReflowInput.mRows.GetLineNamesAtIndex(
gridReflowInput.mGridStyle->mGridTemplateRows,
gridReflowInput.mRowFunctions,
row));
}
ComputedGridLineInfo* rowLineInfo = new ComputedGridLineInfo(
@ -5772,16 +5772,16 @@ nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
Properties().Set(SharedGridData::Prop(), sharedGridData);
}
sharedGridData->mCols.mSizes.Clear();
sharedGridData->mCols.mSizes.SwapElements(gridReflowState.mCols.mSizes);
sharedGridData->mCols.mContentBoxSize = gridReflowState.mCols.mContentBoxSize;
sharedGridData->mCols.mSizes.SwapElements(gridReflowInput.mCols.mSizes);
sharedGridData->mCols.mContentBoxSize = gridReflowInput.mCols.mContentBoxSize;
sharedGridData->mCols.mBaselineSubtreeAlign[0] =
gridReflowState.mCols.mBaselineSubtreeAlign[0];
gridReflowInput.mCols.mBaselineSubtreeAlign[0];
sharedGridData->mCols.mBaselineSubtreeAlign[1] =
gridReflowState.mCols.mBaselineSubtreeAlign[1];
gridReflowInput.mCols.mBaselineSubtreeAlign[1];
sharedGridData->mRows.mSizes.Clear();
sharedGridData->mRows.mSizes.SwapElements(gridReflowState.mRows.mSizes);
sharedGridData->mRows.mSizes.SwapElements(gridReflowInput.mRows.mSizes);
// Save the original row grid sizes and gaps so we can restore them later
// in GridReflowState::Initialize for the continuations.
// in GridReflowInput::Initialize for the continuations.
auto& origRowData = sharedGridData->mOriginalRowData;
origRowData.ClearAndRetainStorage();
origRowData.SetCapacity(sharedGridData->mRows.mSizes.Length());
@ -5791,15 +5791,15 @@ nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
origRowData.AppendElement(data);
prevTrackEnd = sz.mPosition + sz.mBase;
}
sharedGridData->mRows.mContentBoxSize = gridReflowState.mRows.mContentBoxSize;
sharedGridData->mRows.mContentBoxSize = gridReflowInput.mRows.mContentBoxSize;
sharedGridData->mRows.mBaselineSubtreeAlign[0] =
gridReflowState.mRows.mBaselineSubtreeAlign[0];
gridReflowInput.mRows.mBaselineSubtreeAlign[0];
sharedGridData->mRows.mBaselineSubtreeAlign[1] =
gridReflowState.mRows.mBaselineSubtreeAlign[1];
gridReflowInput.mRows.mBaselineSubtreeAlign[1];
sharedGridData->mGridItems.Clear();
sharedGridData->mGridItems.SwapElements(gridReflowState.mGridItems);
sharedGridData->mGridItems.SwapElements(gridReflowInput.mGridItems);
sharedGridData->mAbsPosItems.Clear();
sharedGridData->mAbsPosItems.SwapElements(gridReflowState.mAbsPosItems);
sharedGridData->mAbsPosItems.SwapElements(gridReflowInput.mAbsPosItems);
sharedGridData->mGenerateComputedGridInfo =
HasAnyStateBits(NS_STATE_GRID_GENERATE_COMPUTED_VALUES);
@ -5809,7 +5809,7 @@ nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
}
FinishAndStoreOverflow(&aDesiredSize);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
nscoord
@ -5818,7 +5818,7 @@ nsGridContainerFrame::IntrinsicISize(nsRenderingContext* aRenderingContext,
{
// Calculate the sum of column sizes under aConstraint.
// http://dev.w3.org/csswg/css-grid/#intrinsic-sizes
GridReflowState state(this, *aRenderingContext);
GridReflowInput state(this, *aRenderingContext);
InitImplicitNamedAreas(state.mGridStyle); // XXX optimize
LogicalSize indefinite(state.mWM, NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
Grid grid;

Просмотреть файл

@ -73,7 +73,7 @@ public:
// nsIFrame overrides
void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
nscoord GetMinISize(nsRenderingContext* aRenderingContext) override;
nscoord GetPrefISize(nsRenderingContext* aRenderingContext) override;
@ -160,7 +160,7 @@ public:
struct TrackSize;
struct GridItemInfo;
struct GridReflowState;
struct GridReflowInput;
protected:
static const uint32_t kAutoLine;
// The maximum line number, in the zero-based translated grid.
@ -209,7 +209,7 @@ protected:
* @return the consumed size of all of this grid container's continuations
* so far including this frame
*/
nscoord ReflowChildren(GridReflowState& aState,
nscoord ReflowChildren(GridReflowInput& aState,
const LogicalRect& aContentArea,
ReflowOutput& aDesiredSize,
nsReflowStatus& aStatus);
@ -259,10 +259,10 @@ private:
};
mozilla::Maybe<nsGridContainerFrame::Fragmentainer>
GetNearestFragmentainer(const GridReflowState& aState) const;
GetNearestFragmentainer(const GridReflowInput& aState) const;
// @return the consumed size of all continuations so far including this frame
nscoord ReflowInFragmentainer(GridReflowState& aState,
nscoord ReflowInFragmentainer(GridReflowInput& aState,
const LogicalRect& aContentArea,
ReflowOutput& aDesiredSize,
nsReflowStatus& aStatus,
@ -271,7 +271,7 @@ private:
// Helper for ReflowInFragmentainer
// @return the consumed size of all continuations so far including this frame
nscoord ReflowRowsInFragmentainer(GridReflowState& aState,
nscoord ReflowRowsInFragmentainer(GridReflowInput& aState,
const LogicalRect& aContentArea,
ReflowOutput& aDesiredSize,
nsReflowStatus& aStatus,
@ -289,7 +289,7 @@ private:
nsSize aContainerSize,
mozilla::Maybe<nscoord> aStretchBSize,
const Fragmentainer* aFragmentainer,
const GridReflowState& aState,
const GridReflowInput& aState,
const LogicalRect& aContentArea,
ReflowOutput& aDesiredSize,
nsReflowStatus& aStatus);

Просмотреть файл

@ -249,27 +249,27 @@ nsHTMLCanvasFrame::ComputeSize(nsRenderingContext *aRenderingContext,
void
nsHTMLCanvasFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aMetrics,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsHTMLCanvasFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aMetrics, aStatus);
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("enter nsHTMLCanvasFrame::Reflow: availSize=%d,%d",
aReflowState.AvailableWidth(), aReflowState.AvailableHeight()));
aReflowInput.AvailableWidth(), aReflowInput.AvailableHeight()));
NS_PRECONDITION(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow");
aStatus = NS_FRAME_COMPLETE;
WritingMode wm = aReflowState.GetWritingMode();
WritingMode wm = aReflowInput.GetWritingMode();
LogicalSize finalSize(wm,
aReflowState.ComputedISize(),
aReflowState.ComputedBSize());
aReflowInput.ComputedISize(),
aReflowInput.ComputedBSize());
// stash this away so we can compute our inner area later
mBorderPadding = aReflowState.ComputedLogicalBorderPadding();
mBorderPadding = aReflowInput.ComputedLogicalBorderPadding();
finalSize.ISize(wm) += mBorderPadding.IStartEnd(wm);
finalSize.BSize(wm) += mBorderPadding.BStartEnd(wm);
@ -288,21 +288,21 @@ nsHTMLCanvasFrame::Reflow(nsPresContext* aPresContext,
nsReflowStatus childStatus;
nsIFrame* childFrame = mFrames.FirstChild();
WritingMode childWM = childFrame->GetWritingMode();
LogicalSize availSize = aReflowState.ComputedSize(childWM);
LogicalSize availSize = aReflowInput.ComputedSize(childWM);
availSize.BSize(childWM) = NS_UNCONSTRAINEDSIZE;
NS_ASSERTION(!childFrame->GetNextSibling(), "HTML canvas should have 1 kid");
ReflowOutput childDesiredSize(aReflowState.GetWritingMode(), aMetrics.mFlags);
ReflowInput childReflowState(aPresContext, aReflowState, childFrame,
ReflowOutput childDesiredSize(aReflowInput.GetWritingMode(), aMetrics.mFlags);
ReflowInput childReflowInput(aPresContext, aReflowInput, childFrame,
availSize);
ReflowChild(childFrame, aPresContext, childDesiredSize, childReflowState,
ReflowChild(childFrame, aPresContext, childDesiredSize, childReflowInput,
0, 0, 0, childStatus, nullptr);
FinishReflowChild(childFrame, aPresContext, childDesiredSize,
&childReflowState, 0, 0, 0);
&childReflowInput, 0, 0, 0);
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("exit nsHTMLCanvasFrame::Reflow: size=%d,%d",
aMetrics.ISize(wm), aMetrics.BSize(wm)));
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aMetrics);
}
// FIXME taken from nsImageFrame, but then had splittable frame stuff

Просмотреть файл

@ -73,7 +73,7 @@ public:
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
nsRect GetInnerArea() const;

Просмотреть файл

@ -313,8 +313,8 @@ typedef uint32_t nsReflowStatus;
#define NS_FRAME_TRUNCATED 0x0010
#define NS_FRAME_IS_TRUNCATED(status) \
(0 != ((status) & NS_FRAME_TRUNCATED))
#define NS_FRAME_SET_TRUNCATION(status, aReflowState, aMetrics) \
aReflowState.SetTruncated(aMetrics, &status);
#define NS_FRAME_SET_TRUNCATION(status, aReflowInput, aMetrics) \
aReflowInput.SetTruncated(aMetrics, &status);
// Merge the incompleteness, truncation and NS_FRAME_REFLOW_NEXTINFLOW
// status from aSecondary into aPrimary.
@ -2034,7 +2034,7 @@ public:
* size, then your parent frame is responsible for making sure that
* the difference between the two rects is repainted
*
* @param aReflowState information about your reflow including the reason
* @param aReflowInput information about your reflow including the reason
* for the reflow and the available space in which to lay out. Each
* dimension of the available space can either be constrained or
* unconstrained (a value of NS_UNCONSTRAINEDSIZE).
@ -2049,7 +2049,7 @@ public:
*/
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aReflowMetrics,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) = 0;
/**
@ -2068,7 +2068,7 @@ public:
* a given reflow?
*/
virtual void DidReflow(nsPresContext* aPresContext,
const ReflowInput* aReflowState,
const ReflowInput* aReflowInput,
nsDidReflowStatus aStatus) = 0;
/**
@ -2669,9 +2669,9 @@ public:
* passed in, indicating that it should be used to determine if sides
* should be skipped during reflow.
*/
Sides GetSkipSides(const ReflowInput* aReflowState = nullptr) const;
Sides GetSkipSides(const ReflowInput* aReflowInput = nullptr) const;
virtual LogicalSides
GetLogicalSkipSides(const ReflowInput* aReflowState = nullptr) const {
GetLogicalSkipSides(const ReflowInput* aReflowInput = nullptr) const {
return LogicalSides();
}

Просмотреть файл

@ -116,14 +116,14 @@ static bool HaveSpecifiedSize(const nsStylePosition* aStylePosition)
// Decide whether we can optimize away reflows that result from the
// image's intrinsic size changing.
inline bool HaveFixedSize(const ReflowInput& aReflowState)
inline bool HaveFixedSize(const ReflowInput& aReflowInput)
{
NS_ASSERTION(aReflowState.mStylePosition, "crappy reflowState - null stylePosition");
NS_ASSERTION(aReflowInput.mStylePosition, "crappy reflowInput - null stylePosition");
// Don't try to make this optimization when an image has percentages
// in its 'width' or 'height'. The percentages might be treated like
// auto (especially for intrinsic width calculations and for heights).
return aReflowState.mStylePosition->mHeight.ConvertsToLength() &&
aReflowState.mStylePosition->mWidth.ConvertsToLength();
return aReflowInput.mStylePosition->mHeight.ConvertsToLength() &&
aReflowInput.mStylePosition->mWidth.ConvertsToLength();
}
nsIFrame*
@ -949,22 +949,22 @@ nsImageFrame::GetIntrinsicRatio()
void
nsImageFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aMetrics,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsImageFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aMetrics, aStatus);
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("enter nsImageFrame::Reflow: availSize=%d,%d",
aReflowState.AvailableWidth(), aReflowState.AvailableHeight()));
aReflowInput.AvailableWidth(), aReflowInput.AvailableHeight()));
NS_PRECONDITION(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow");
aStatus = NS_FRAME_COMPLETE;
// see if we have a frozen size (i.e. a fixed width and height)
if (HaveFixedSize(aReflowState)) {
if (HaveFixedSize(aReflowInput)) {
mState |= IMAGE_SIZECONSTRAINED;
} else {
mState &= ~IMAGE_SIZECONSTRAINED;
@ -977,19 +977,19 @@ nsImageFrame::Reflow(nsPresContext* aPresContext,
}
mComputedSize =
nsSize(aReflowState.ComputedWidth(), aReflowState.ComputedHeight());
nsSize(aReflowInput.ComputedWidth(), aReflowInput.ComputedHeight());
aMetrics.Width() = mComputedSize.width;
aMetrics.Height() = mComputedSize.height;
// add borders and padding
aMetrics.Width() += aReflowState.ComputedPhysicalBorderPadding().LeftRight();
aMetrics.Height() += aReflowState.ComputedPhysicalBorderPadding().TopBottom();
aMetrics.Width() += aReflowInput.ComputedPhysicalBorderPadding().LeftRight();
aMetrics.Height() += aReflowInput.ComputedPhysicalBorderPadding().TopBottom();
if (GetPrevInFlow()) {
aMetrics.Width() = GetPrevInFlow()->GetSize().width;
nscoord y = GetContinuationOffset();
aMetrics.Height() -= y + aReflowState.ComputedPhysicalBorderPadding().top;
aMetrics.Height() -= y + aReflowInput.ComputedPhysicalBorderPadding().top;
aMetrics.Height() = std::max(0, aMetrics.Height());
}
@ -1009,11 +1009,11 @@ nsImageFrame::Reflow(nsPresContext* aPresContext,
}
if (aPresContext->IsPaginated() &&
((loadStatus & imgIRequest::STATUS_SIZE_AVAILABLE) || (mState & IMAGE_SIZECONSTRAINED)) &&
NS_UNCONSTRAINEDSIZE != aReflowState.AvailableHeight() &&
aMetrics.Height() > aReflowState.AvailableHeight()) {
NS_UNCONSTRAINEDSIZE != aReflowInput.AvailableHeight() &&
aMetrics.Height() > aReflowInput.AvailableHeight()) {
// our desired height was greater than 0, so to avoid infinite
// splitting, use 1 pixel as the min
aMetrics.Height() = std::max(nsPresContext::CSSPixelsToAppUnits(1), aReflowState.AvailableHeight());
aMetrics.Height() = std::max(nsPresContext::CSSPixelsToAppUnits(1), aReflowInput.AvailableHeight());
aStatus = NS_FRAME_NOT_COMPLETE;
}
@ -1053,7 +1053,7 @@ nsImageFrame::Reflow(nsPresContext* aPresContext,
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("exit nsImageFrame::Reflow: size=%d,%d",
aMetrics.Width(), aMetrics.Height()));
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aMetrics);
}
bool
@ -2152,7 +2152,7 @@ nsImageFrame::List(FILE* out, const char* aPrefix, uint32_t aFlags) const
#endif
nsIFrame::LogicalSides
nsImageFrame::GetLogicalSkipSides(const ReflowInput* aReflowState) const
nsImageFrame::GetLogicalSkipSides(const ReflowInput* aReflowInput) const
{
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
NS_STYLE_BOX_DECORATION_BREAK_CLONE)) {

Просмотреть файл

@ -90,7 +90,7 @@ public:
virtual nsSize GetIntrinsicRatio() override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsresult GetContentForEvent(mozilla::WidgetEvent* aEvent,
@ -131,7 +131,7 @@ public:
return NS_FRAME_SPLITTABLE;
}
virtual LogicalSides GetLogicalSkipSides(const ReflowInput* aReflowState = nullptr) const override;
virtual LogicalSides GetLogicalSkipSides(const ReflowInput* aReflowInput = nullptr) const override;
nsresult GetIntrinsicImageSize(nsSize& aSize);

Просмотреть файл

@ -362,23 +362,23 @@ ReparentChildListStyle(nsPresContext* aPresContext,
void
nsInlineFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aMetrics,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsInlineFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aStatus);
if (nullptr == aReflowState.mLineLayout) {
NS_ERROR("must have non-null aReflowState.mLineLayout");
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aMetrics, aStatus);
if (nullptr == aReflowInput.mLineLayout) {
NS_ERROR("must have non-null aReflowInput.mLineLayout");
return;
}
if (IsFrameTreeTooDeep(aReflowState, aMetrics, aStatus)) {
if (IsFrameTreeTooDeep(aReflowInput, aMetrics, aStatus)) {
return;
}
bool lazilySetParentPointer = false;
nsIFrame* lineContainer = aReflowState.mLineLayout->LineContainerFrame();
nsIFrame* lineContainer = aReflowInput.mLineLayout->LineContainerFrame();
// Check for an overflow list with our prev-in-flow
nsInlineFrame* prevInFlow = (nsInlineFrame*)GetPrevInFlow();
@ -420,7 +420,7 @@ nsInlineFrame::Reflow(nsPresContext* aPresContext,
// the special first-line styling. In the lazilySetParentPointer case
// we reparent the style contexts when we set their parents in
// nsInlineFrame::ReflowFrames and nsInlineFrame::ReflowInlineFrame.
if (aReflowState.mLineLayout->GetInFirstLine()) {
if (aReflowInput.mLineLayout->GetInFirstLine()) {
ReparentChildListStyle(aPresContext, newFrames, this);
}
}
@ -441,18 +441,18 @@ nsInlineFrame::Reflow(nsPresContext* aPresContext,
if (!(GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
DrainFlags flags =
lazilySetParentPointer ? eDontReparentFrames : DrainFlags(0);
if (aReflowState.mLineLayout->GetInFirstLine()) {
if (aReflowInput.mLineLayout->GetInFirstLine()) {
flags = DrainFlags(flags | eInFirstLine);
}
DrainSelfOverflowListInternal(flags, lineContainer);
}
// Set our own reflow state (additional state above and beyond
// aReflowState)
InlineReflowState irs;
// aReflowInput)
InlineReflowInput irs;
irs.mPrevFrame = nullptr;
irs.mLineContainer = lineContainer;
irs.mLineLayout = aReflowState.mLineLayout;
irs.mLineLayout = aReflowInput.mLineLayout;
irs.mNextInFlow = (nsInlineFrame*) GetNextInFlow();
irs.mSetParentPointer = lazilySetParentPointer;
@ -463,14 +463,14 @@ nsInlineFrame::Reflow(nsPresContext* aPresContext,
(void) PullOneFrame(aPresContext, irs, &complete);
}
ReflowFrames(aPresContext, aReflowState, irs, aMetrics, aStatus);
ReflowFrames(aPresContext, aReflowInput, irs, aMetrics, aStatus);
ReflowAbsoluteFrames(aPresContext, aMetrics, aReflowState, aStatus);
ReflowAbsoluteFrames(aPresContext, aMetrics, aReflowInput, aStatus);
// Note: the line layout code will properly compute our
// overflow-rect state for us.
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aMetrics);
}
nsresult
@ -569,19 +569,19 @@ nsInlineFrame::PullOverflowsFromPrevInFlow()
void
nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
const ReflowInput& aReflowState,
InlineReflowState& irs,
const ReflowInput& aReflowInput,
InlineReflowInput& irs,
ReflowOutput& aMetrics,
nsReflowStatus& aStatus)
{
aStatus = NS_FRAME_COMPLETE;
nsLineLayout* lineLayout = aReflowState.mLineLayout;
bool inFirstLine = aReflowState.mLineLayout->GetInFirstLine();
nsLineLayout* lineLayout = aReflowInput.mLineLayout;
bool inFirstLine = aReflowInput.mLineLayout->GetInFirstLine();
RestyleManagerHandle restyleManager = aPresContext->RestyleManager();
WritingMode frameWM = aReflowState.GetWritingMode();
WritingMode lineWM = aReflowState.mLineLayout->mRootSpan->mWritingMode;
LogicalMargin framePadding = aReflowState.ComputedLogicalBorderPadding();
WritingMode frameWM = aReflowInput.GetWritingMode();
WritingMode lineWM = aReflowInput.mLineLayout->mRootSpan->mWritingMode;
LogicalMargin framePadding = aReflowInput.ComputedLogicalBorderPadding();
nscoord startEdge = 0;
const bool boxDecorationBreakClone =
MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
@ -594,13 +594,13 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
boxDecorationBreakClone) {
startEdge = framePadding.IStart(frameWM);
}
nscoord availableISize = aReflowState.AvailableISize();
nscoord availableISize = aReflowInput.AvailableISize();
NS_ASSERTION(availableISize != NS_UNCONSTRAINEDSIZE,
"should no longer use available widths");
// Subtract off inline axis border+padding from availableISize
availableISize -= startEdge;
availableISize -= framePadding.IEnd(frameWM);
lineLayout->BeginSpan(this, &aReflowState, startEdge,
lineLayout->BeginSpan(this, &aReflowInput, startEdge,
startEdge + availableISize, &mBaseline);
// First reflow our principal children.
@ -686,7 +686,7 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
if (!done) {
bool reflowingFirstLetter = lineLayout->GetFirstLetterStyleOK();
ReflowInlineFrame(aPresContext, aReflowState, irs, frame, aStatus);
ReflowInlineFrame(aPresContext, aReflowInput, irs, frame, aStatus);
done = NS_INLINE_IS_BREAK(aStatus) ||
(!reflowingFirstLetter && NS_FRAME_IS_NOT_COMPLETE(aStatus));
if (done) {
@ -724,7 +724,7 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
}
break;
}
ReflowInlineFrame(aPresContext, aReflowState, irs, frame, aStatus);
ReflowInlineFrame(aPresContext, aReflowInput, irs, frame, aStatus);
if (NS_INLINE_IS_BREAK(aStatus) ||
(!reflowingFirstLetter && NS_FRAME_IS_NOT_COMPLETE(aStatus))) {
break;
@ -794,12 +794,12 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
void
nsInlineFrame::ReflowInlineFrame(nsPresContext* aPresContext,
const ReflowInput& aReflowState,
InlineReflowState& irs,
const ReflowInput& aReflowInput,
InlineReflowInput& irs,
nsIFrame* aFrame,
nsReflowStatus& aStatus)
{
nsLineLayout* lineLayout = aReflowState.mLineLayout;
nsLineLayout* lineLayout = aReflowInput.mLineLayout;
bool reflowingFirstLetter = lineLayout->GetFirstLetterStyleOK();
bool pushedFrame;
lineLayout->ReflowFrame(aFrame, aStatus, nullptr, pushedFrame);
@ -857,7 +857,7 @@ nsInlineFrame::ReflowInlineFrame(nsPresContext* aPresContext,
nsIFrame*
nsInlineFrame::PullOneFrame(nsPresContext* aPresContext,
InlineReflowState& irs,
InlineReflowInput& irs,
bool* aIsComplete)
{
bool isComplete = true;
@ -918,7 +918,7 @@ void
nsInlineFrame::PushFrames(nsPresContext* aPresContext,
nsIFrame* aFromChild,
nsIFrame* aPrevSibling,
InlineReflowState& aState)
InlineReflowInput& aState)
{
NS_PRECONDITION(aFromChild, "null pointer");
NS_PRECONDITION(aPrevSibling, "pushing first child");
@ -941,7 +941,7 @@ nsInlineFrame::PushFrames(nsPresContext* aPresContext,
//////////////////////////////////////////////////////////////////////
nsIFrame::LogicalSides
nsInlineFrame::GetLogicalSkipSides(const ReflowInput* aReflowState) const
nsInlineFrame::GetLogicalSkipSides(const ReflowInput* aReflowInput) const
{
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
NS_STYLE_BOX_DECORATION_BREAK_CLONE)) {
@ -1076,7 +1076,7 @@ nsFirstLineFrame::GetType() const
}
nsIFrame*
nsFirstLineFrame::PullOneFrame(nsPresContext* aPresContext, InlineReflowState& irs,
nsFirstLineFrame::PullOneFrame(nsPresContext* aPresContext, InlineReflowInput& irs,
bool* aIsComplete)
{
nsIFrame* frame = nsInlineFrame::PullOneFrame(aPresContext, irs, aIsComplete);
@ -1093,15 +1093,15 @@ nsFirstLineFrame::PullOneFrame(nsPresContext* aPresContext, InlineReflowState& i
void
nsFirstLineFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aMetrics,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
if (nullptr == aReflowState.mLineLayout) {
if (nullptr == aReflowInput.mLineLayout) {
return; // XXX does this happen? why?
}
nsIFrame* lineContainer = aReflowState.mLineLayout->LineContainerFrame();
nsIFrame* lineContainer = aReflowInput.mLineLayout->LineContainerFrame();
// Check for an overflow list with our prev-in-flow
nsFirstLineFrame* prevInFlow = (nsFirstLineFrame*)GetPrevInFlow();
@ -1125,11 +1125,11 @@ nsFirstLineFrame::Reflow(nsPresContext* aPresContext,
DrainSelfOverflowList();
// Set our own reflow state (additional state above and beyond
// aReflowState)
InlineReflowState irs;
// aReflowInput)
InlineReflowInput irs;
irs.mPrevFrame = nullptr;
irs.mLineContainer = lineContainer;
irs.mLineLayout = aReflowState.mLineLayout;
irs.mLineLayout = aReflowInput.mLineLayout;
irs.mNextInFlow = (nsInlineFrame*) GetNextInFlow();
bool wasEmpty = mFrames.IsEmpty();
@ -1159,13 +1159,13 @@ nsFirstLineFrame::Reflow(nsPresContext* aPresContext,
irs.mPrevFrame = nullptr;
}
NS_ASSERTION(!aReflowState.mLineLayout->GetInFirstLine(),
NS_ASSERTION(!aReflowInput.mLineLayout->GetInFirstLine(),
"Nested first-line frames? BOGUS");
aReflowState.mLineLayout->SetInFirstLine(true);
ReflowFrames(aPresContext, aReflowState, irs, aMetrics, aStatus);
aReflowState.mLineLayout->SetInFirstLine(false);
aReflowInput.mLineLayout->SetInFirstLine(true);
ReflowFrames(aPresContext, aReflowInput, irs, aMetrics, aStatus);
aReflowInput.mLineLayout->SetInFirstLine(false);
ReflowAbsoluteFrames(aPresContext, aMetrics, aReflowState, aStatus);
ReflowAbsoluteFrames(aPresContext, aMetrics, aReflowInput, aStatus);
// Note: the line layout code will properly compute our overflow state for us
}

Просмотреть файл

@ -81,7 +81,7 @@ public:
virtual nsRect ComputeTightBounds(DrawTarget* aDrawTarget) const override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
@ -118,7 +118,7 @@ public:
protected:
// Additional reflow state used during our reflow methods
struct InlineReflowState {
struct InlineReflowInput {
nsIFrame* mPrevFrame;
nsInlineFrame* mNextInFlow;
nsIFrame* mLineContainer;
@ -126,7 +126,7 @@ protected:
bool mSetParentPointer; // when reflowing child frame first set its
// parent frame pointer
InlineReflowState() {
InlineReflowInput() {
mPrevFrame = nullptr;
mNextInFlow = nullptr;
mLineContainer = nullptr;
@ -137,17 +137,17 @@ protected:
explicit nsInlineFrame(nsStyleContext* aContext) : nsContainerFrame(aContext) {}
virtual LogicalSides GetLogicalSkipSides(const ReflowInput* aReflowState = nullptr) const override;
virtual LogicalSides GetLogicalSkipSides(const ReflowInput* aReflowInput = nullptr) const override;
void ReflowFrames(nsPresContext* aPresContext,
const ReflowInput& aReflowState,
InlineReflowState& rs,
const ReflowInput& aReflowInput,
InlineReflowInput& rs,
ReflowOutput& aMetrics,
nsReflowStatus& aStatus);
void ReflowInlineFrame(nsPresContext* aPresContext,
const ReflowInput& aReflowState,
InlineReflowState& rs,
const ReflowInput& aReflowInput,
InlineReflowInput& rs,
nsIFrame* aFrame,
nsReflowStatus& aStatus);
@ -161,13 +161,13 @@ protected:
bool aReparentSiblings);
virtual nsIFrame* PullOneFrame(nsPresContext* aPresContext,
InlineReflowState& rs,
InlineReflowInput& rs,
bool* aIsComplete);
virtual void PushFrames(nsPresContext* aPresContext,
nsIFrame* aFromChild,
nsIFrame* aPrevSibling,
InlineReflowState& aState);
InlineReflowInput& aState);
private:
// Helper method for DrainSelfOverflowList() to deal with lazy parenting
@ -210,7 +210,7 @@ public:
virtual nsIAtom* GetType() const override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual void Init(nsIContent* aContent,
@ -223,7 +223,7 @@ protected:
explicit nsFirstLineFrame(nsStyleContext* aContext) : nsInlineFrame(aContext) {}
virtual nsIFrame* PullOneFrame(nsPresContext* aPresContext,
InlineReflowState& rs,
InlineReflowInput& rs,
bool* aIsComplete) override;
};

Просмотреть файл

@ -51,18 +51,18 @@ nsLeafFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
void
nsLeafFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aMetrics,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsLeafFrame");
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("enter nsLeafFrame::Reflow: aMaxSize=%d,%d",
aReflowState.AvailableWidth(), aReflowState.AvailableHeight()));
aReflowInput.AvailableWidth(), aReflowInput.AvailableHeight()));
NS_PRECONDITION(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow");
DoReflow(aPresContext, aMetrics, aReflowState, aStatus);
DoReflow(aPresContext, aMetrics, aReflowInput, aStatus);
FinishAndStoreOverflow(&aMetrics);
}
@ -70,27 +70,27 @@ nsLeafFrame::Reflow(nsPresContext* aPresContext,
void
nsLeafFrame::DoReflow(nsPresContext* aPresContext,
ReflowOutput& aMetrics,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
NS_ASSERTION(aReflowState.ComputedWidth() != NS_UNCONSTRAINEDSIZE,
NS_ASSERTION(aReflowInput.ComputedWidth() != NS_UNCONSTRAINEDSIZE,
"Shouldn't have unconstrained stuff here "
"thanks to the rules of reflow");
NS_ASSERTION(NS_INTRINSICSIZE != aReflowState.ComputedHeight(),
NS_ASSERTION(NS_INTRINSICSIZE != aReflowInput.ComputedHeight(),
"Shouldn't have unconstrained stuff here "
"thanks to ComputeAutoSize");
// XXX how should border&padding effect baseline alignment?
// => descent = borderPadding.bottom for example
WritingMode wm = aReflowState.GetWritingMode();
aMetrics.SetSize(wm, aReflowState.ComputedSizeWithBorderPadding());
WritingMode wm = aReflowInput.GetWritingMode();
aMetrics.SetSize(wm, aReflowInput.ComputedSizeWithBorderPadding());
aStatus = NS_FRAME_COMPLETE;
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("exit nsLeafFrame::DoReflow: size=%d,%d",
aMetrics.ISize(wm), aMetrics.BSize(wm)));
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aMetrics);
aMetrics.SetOverflowAreasToDesiredBounds();
}
@ -103,12 +103,12 @@ nsLeafFrame::GetIntrinsicBSize()
}
void
nsLeafFrame::SizeToAvailSize(const ReflowInput& aReflowState,
nsLeafFrame::SizeToAvailSize(const ReflowInput& aReflowInput,
ReflowOutput& aDesiredSize)
{
WritingMode wm = aReflowState.GetWritingMode();
LogicalSize size(wm, aReflowState.AvailableISize(), // FRAME
aReflowState.AvailableBSize());
WritingMode wm = aReflowInput.GetWritingMode();
LogicalSize size(wm, aReflowInput.AvailableISize(), // FRAME
aReflowInput.AvailableBSize());
aDesiredSize.SetSize(wm, size);
aDesiredSize.SetOverflowAreasToDesiredBounds();
FinishAndStoreOverflow(&aDesiredSize);

Просмотреть файл

@ -58,7 +58,7 @@ public:
*/
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
/**
@ -66,7 +66,7 @@ public:
*/
virtual void DoReflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus);
virtual bool IsFrameOfType(uint32_t aFlags) const override
@ -99,7 +99,7 @@ protected:
/**
* Set aDesiredSize to be the available size
*/
void SizeToAvailSize(const ReflowInput& aReflowState,
void SizeToAvailSize(const ReflowInput& aReflowInput,
ReflowOutput& aDesiredSize);
};

Просмотреть файл

@ -54,12 +54,12 @@ using namespace mozilla;
nsLineLayout::nsLineLayout(nsPresContext* aPresContext,
nsFloatManager* aFloatManager,
const ReflowInput* aOuterReflowState,
const ReflowInput* aOuterReflowInput,
const nsLineList::iterator* aLine,
nsLineLayout* aBaseLineLayout)
: mPresContext(aPresContext),
mFloatManager(aFloatManager),
mBlockReflowState(aOuterReflowState),
mBlockReflowInput(aOuterReflowInput),
mBaseLineLayout(aBaseLineLayout),
mLastOptionalBreakFrame(nullptr),
mForceBreakFrame(nullptr),
@ -83,25 +83,25 @@ nsLineLayout::nsLineLayout(nsPresContext* aPresContext,
mDirtyNextLine(false),
mLineAtStart(false),
mHasRuby(false),
mSuppressLineWrap(aOuterReflowState->mFrame->IsSVGText())
mSuppressLineWrap(aOuterReflowInput->mFrame->IsSVGText())
{
MOZ_ASSERT(aOuterReflowState, "aOuterReflowState must not be null");
NS_ASSERTION(aFloatManager || aOuterReflowState->mFrame->GetType() ==
MOZ_ASSERT(aOuterReflowInput, "aOuterReflowInput must not be null");
NS_ASSERTION(aFloatManager || aOuterReflowInput->mFrame->GetType() ==
nsGkAtoms::letterFrame,
"float manager should be present");
MOZ_ASSERT((!!mBaseLineLayout) ==
(aOuterReflowState->mFrame->GetType() ==
(aOuterReflowInput->mFrame->GetType() ==
nsGkAtoms::rubyTextContainerFrame),
"Only ruby text container frames have "
"a different base line layout");
MOZ_COUNT_CTOR(nsLineLayout);
// Stash away some style data that we need
nsBlockFrame* blockFrame = do_QueryFrame(aOuterReflowState->mFrame);
nsBlockFrame* blockFrame = do_QueryFrame(aOuterReflowInput->mFrame);
if (blockFrame)
mStyleText = blockFrame->StyleTextForLineLayout();
else
mStyleText = aOuterReflowState->mFrame->StyleText();
mStyleText = aOuterReflowInput->mFrame->StyleText();
mLineNumber = 0;
mTotalPlacedFrames = 0;
@ -109,7 +109,7 @@ nsLineLayout::nsLineLayout(nsPresContext* aPresContext,
mTrimmableISize = 0;
mInflationMinFontSize =
nsLayoutUtils::InflationMinFontSizeFor(aOuterReflowState->mFrame);
nsLayoutUtils::InflationMinFontSizeFor(aOuterReflowInput->mFrame);
// Instead of always pre-initializing the free-lists for frames and
// spans, we do it on demand so that situations that only use a few
@ -162,19 +162,19 @@ nsLineLayout::BeginLineReflow(nscoord aICoord, nscoord aBCoord,
#ifdef DEBUG
if ((aISize != NS_UNCONSTRAINEDSIZE) && CRAZY_SIZE(aISize) &&
!LineContainerFrame()->GetParent()->IsCrazySizeAssertSuppressed()) {
nsFrame::ListTag(stdout, mBlockReflowState->mFrame);
nsFrame::ListTag(stdout, mBlockReflowInput->mFrame);
printf(": Init: bad caller: width WAS %d(0x%x)\n",
aISize, aISize);
}
if ((aBSize != NS_UNCONSTRAINEDSIZE) && CRAZY_SIZE(aBSize) &&
!LineContainerFrame()->GetParent()->IsCrazySizeAssertSuppressed()) {
nsFrame::ListTag(stdout, mBlockReflowState->mFrame);
nsFrame::ListTag(stdout, mBlockReflowInput->mFrame);
printf(": Init: bad caller: height WAS %d(0x%x)\n",
aBSize, aBSize);
}
#endif
#ifdef NOISY_REFLOW
nsFrame::ListTag(stdout, mBlockReflowState->mFrame);
nsFrame::ListTag(stdout, mBlockReflowInput->mFrame);
printf(": BeginLineReflow: %d,%d,%d,%d impacted=%s %s\n",
aICoord, aBCoord, aISize, aBSize,
aImpactedByFloats?"true":"false",
@ -205,7 +205,7 @@ nsLineLayout::BeginLineReflow(nscoord aICoord, nscoord aBCoord,
PerSpanData* psd = NewPerSpanData();
mCurrentSpan = mRootSpan = psd;
psd->mReflowState = mBlockReflowState;
psd->mReflowInput = mBlockReflowInput;
psd->mIStart = aICoord;
psd->mICoord = aICoord;
psd->mIEnd = aICoord + aISize;
@ -219,12 +219,12 @@ nsLineLayout::BeginLineReflow(nscoord aICoord, nscoord aBCoord,
// If this is the first line of a block then see if the text-indent
// property amounts to anything.
if (0 == mLineNumber && !HasPrevInFlow(mBlockReflowState->mFrame)) {
if (0 == mLineNumber && !HasPrevInFlow(mBlockReflowInput->mFrame)) {
const nsStyleCoord &textIndent = mStyleText->mTextIndent;
nscoord pctBasis = 0;
if (textIndent.HasPercent()) {
pctBasis =
mBlockReflowState->GetContainingBlockContentISize(aWritingMode);
mBlockReflowInput->GetContainingBlockContentISize(aWritingMode);
}
nscoord indent = nsRuleNode::ComputeCoordPercentCalc(textIndent, pctBasis);
@ -233,23 +233,23 @@ nsLineLayout::BeginLineReflow(nscoord aICoord, nscoord aBCoord,
psd->mICoord += indent;
}
PerFrameData* pfd = NewPerFrameData(mBlockReflowState->mFrame);
PerFrameData* pfd = NewPerFrameData(mBlockReflowInput->mFrame);
pfd->mAscent = 0;
pfd->mSpan = psd;
psd->mFrame = pfd;
nsIFrame* frame = mBlockReflowState->mFrame;
nsIFrame* frame = mBlockReflowInput->mFrame;
if (frame->GetType() == nsGkAtoms::rubyTextContainerFrame) {
// Ruby text container won't be reflowed via ReflowFrame, hence the
// relative positioning information should be recorded here.
MOZ_ASSERT(mBaseLineLayout != this);
pfd->mRelativePos =
mBlockReflowState->mStyleDisplay->IsRelativelyPositionedStyle();
mBlockReflowInput->mStyleDisplay->IsRelativelyPositionedStyle();
if (pfd->mRelativePos) {
MOZ_ASSERT(
mBlockReflowState->GetWritingMode() == pfd->mWritingMode,
"mBlockReflowState->frame == frame, "
mBlockReflowInput->GetWritingMode() == pfd->mWritingMode,
"mBlockReflowInput->frame == frame, "
"hence they should have identical writing mode");
pfd->mOffsets = mBlockReflowState->ComputedLogicalOffsets();
pfd->mOffsets = mBlockReflowInput->ComputedLogicalOffsets();
}
}
}
@ -258,7 +258,7 @@ void
nsLineLayout::EndLineReflow()
{
#ifdef NOISY_REFLOW
nsFrame::ListTag(stdout, mBlockReflowState->mFrame);
nsFrame::ListTag(stdout, mBlockReflowInput->mFrame);
printf(": EndLineReflow: width=%d\n", mRootSpan->mICoord - mRootSpan->mIStart);
#endif
@ -314,14 +314,14 @@ nsLineLayout::UpdateBand(WritingMode aWM,
if ((availSpace.ISize(lineWM) != NS_UNCONSTRAINEDSIZE) &&
CRAZY_SIZE(availSpace.ISize(lineWM)) &&
!LineContainerFrame()->GetParent()->IsCrazySizeAssertSuppressed()) {
nsFrame::ListTag(stdout, mBlockReflowState->mFrame);
nsFrame::ListTag(stdout, mBlockReflowInput->mFrame);
printf(": UpdateBand: bad caller: ISize WAS %d(0x%x)\n",
availSpace.ISize(lineWM), availSpace.ISize(lineWM));
}
if ((availSpace.BSize(lineWM) != NS_UNCONSTRAINEDSIZE) &&
CRAZY_SIZE(availSpace.BSize(lineWM)) &&
!LineContainerFrame()->GetParent()->IsCrazySizeAssertSuppressed()) {
nsFrame::ListTag(stdout, mBlockReflowState->mFrame);
nsFrame::ListTag(stdout, mBlockReflowInput->mFrame);
printf(": UpdateBand: bad caller: BSize WAS %d(0x%x)\n",
availSpace.BSize(lineWM), availSpace.BSize(lineWM));
}
@ -340,7 +340,7 @@ nsLineLayout::UpdateBand(WritingMode aWM,
nscoord deltaISize = availSpace.ISize(lineWM) -
(mRootSpan->mIEnd - mRootSpan->mIStart);
#ifdef NOISY_REFLOW
nsFrame::ListTag(stdout, mBlockReflowState->mFrame);
nsFrame::ListTag(stdout, mBlockReflowInput->mFrame);
printf(": UpdateBand: %d,%d,%d,%d deltaISize=%d deltaICoord=%d\n",
availSpace.IStart(lineWM), availSpace.BStart(lineWM),
availSpace.ISize(lineWM), availSpace.BSize(lineWM),
@ -416,7 +416,7 @@ nsLineLayout::NewPerSpanData()
void
nsLineLayout::BeginSpan(nsIFrame* aFrame,
const ReflowInput* aSpanReflowState,
const ReflowInput* aSpanReflowInput,
nscoord aIStart, nscoord aIEnd,
nscoord* aBaseline)
{
@ -437,17 +437,17 @@ nsLineLayout::BeginSpan(nsIFrame* aFrame,
// Init new span
psd->mFrame = pfd;
psd->mParent = mCurrentSpan;
psd->mReflowState = aSpanReflowState;
psd->mReflowInput = aSpanReflowInput;
psd->mIStart = aIStart;
psd->mICoord = aIStart;
psd->mIEnd = aIEnd;
psd->mBaseline = aBaseline;
nsIFrame* frame = aSpanReflowState->mFrame;
nsIFrame* frame = aSpanReflowInput->mFrame;
psd->mNoWrap = !frame->StyleText()->WhiteSpaceCanWrap(frame) ||
mSuppressLineWrap ||
frame->StyleContext()->ShouldSuppressLineBreak();
psd->mWritingMode = aSpanReflowState->GetWritingMode();
psd->mWritingMode = aSpanReflowInput->GetWritingMode();
// Switch to new span
mCurrentSpan = psd;
@ -467,7 +467,7 @@ nsLineLayout::EndSpan(nsIFrame* aFrame)
nscoord iSizeResult = psd->mLastFrame ? (psd->mICoord - psd->mIStart) : 0;
mSpanDepth--;
mCurrentSpan->mReflowState = nullptr; // no longer valid so null it out!
mCurrentSpan->mReflowInput = nullptr; // no longer valid so null it out!
mCurrentSpan = mCurrentSpan->mParent;
return iSizeResult;
}
@ -873,38 +873,38 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
nscoord availableSpaceOnLine = psd->mIEnd - psd->mICoord;
// Setup reflow state for reflowing the frame
Maybe<ReflowInput> reflowStateHolder;
Maybe<ReflowInput> reflowInputHolder;
if (!isText) {
// Compute the available size for the frame. This available width
// includes room for the side margins.
// For now, set the available block-size to unconstrained always.
LogicalSize availSize = mBlockReflowState->ComputedSize(frameWM);
LogicalSize availSize = mBlockReflowInput->ComputedSize(frameWM);
availSize.BSize(frameWM) = NS_UNCONSTRAINEDSIZE;
reflowStateHolder.emplace(mPresContext, *psd->mReflowState,
reflowInputHolder.emplace(mPresContext, *psd->mReflowInput,
aFrame, availSize);
ReflowInput& reflowState = *reflowStateHolder;
reflowState.mLineLayout = this;
reflowState.mFlags.mIsTopOfPage = mIsTopOfPage;
if (reflowState.ComputedISize() == NS_UNCONSTRAINEDSIZE) {
reflowState.AvailableISize() = availableSpaceOnLine;
ReflowInput& reflowInput = *reflowInputHolder;
reflowInput.mLineLayout = this;
reflowInput.mFlags.mIsTopOfPage = mIsTopOfPage;
if (reflowInput.ComputedISize() == NS_UNCONSTRAINEDSIZE) {
reflowInput.AvailableISize() = availableSpaceOnLine;
}
WritingMode stateWM = reflowState.GetWritingMode();
WritingMode stateWM = reflowInput.GetWritingMode();
pfd->mMargin =
reflowState.ComputedLogicalMargin().ConvertTo(lineWM, stateWM);
reflowInput.ComputedLogicalMargin().ConvertTo(lineWM, stateWM);
pfd->mBorderPadding =
reflowState.ComputedLogicalBorderPadding().ConvertTo(lineWM, stateWM);
reflowInput.ComputedLogicalBorderPadding().ConvertTo(lineWM, stateWM);
pfd->mRelativePos =
reflowState.mStyleDisplay->IsRelativelyPositionedStyle();
reflowInput.mStyleDisplay->IsRelativelyPositionedStyle();
if (pfd->mRelativePos) {
pfd->mOffsets =
reflowState.ComputedLogicalOffsets().ConvertTo(frameWM, stateWM);
reflowInput.ComputedLogicalOffsets().ConvertTo(frameWM, stateWM);
}
// Calculate whether the the frame should have a start margin and
// subtract the margin from the available width if necessary.
// The margin will be applied to the starting inline coordinates of
// the frame in CanPlaceFrame() after reflowing the frame.
AllowForStartMargin(pfd, reflowState);
AllowForStartMargin(pfd, reflowInput);
}
// if isText(), no need to propagate NS_FRAME_IS_DIRTY from the parent,
// because reflow doesn't look at the dirty bits on the frame being reflowed.
@ -940,11 +940,11 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
&savedOptionalBreakPriority);
if (!isText) {
aFrame->Reflow(mPresContext, metrics, *reflowStateHolder, aReflowStatus);
aFrame->Reflow(mPresContext, metrics, *reflowInputHolder, aReflowStatus);
} else {
static_cast<nsTextFrame*>(aFrame)->
ReflowText(*this, availableSpaceOnLine,
psd->mReflowState->mRenderingContext->GetDrawTarget(),
psd->mReflowInput->mRenderingContext->GetDrawTarget(),
metrics, aReflowStatus);
}
@ -1064,7 +1064,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
// Tell the frame that we're done reflowing it
aFrame->DidReflow(mPresContext,
isText ? nullptr : reflowStateHolder.ptr(),
isText ? nullptr : reflowInputHolder.ptr(),
nsDidReflowStatus::FINISHED);
if (aMetrics) {
@ -1100,7 +1100,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
// return now.
bool optionalBreakAfterFits;
NS_ASSERTION(isText ||
!reflowStateHolder->IsFloating(),
!reflowInputHolder->IsFloating(),
"How'd we get a floated inline frame? "
"The frame ctor should've dealt with this.");
if (CanPlaceFrame(pfd, notSafeToBreak, continuingTextRun,
@ -1170,9 +1170,9 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
void
nsLineLayout::AllowForStartMargin(PerFrameData* pfd,
ReflowInput& aReflowState)
ReflowInput& aReflowInput)
{
NS_ASSERTION(!aReflowState.IsFloating(),
NS_ASSERTION(!aReflowInput.IsFloating(),
"How'd we get a floated inline frame? "
"The frame ctor should've dealt with this.");
@ -1187,13 +1187,13 @@ nsLineLayout::AllowForStartMargin(PerFrameData* pfd,
// on all continuations.
if ((pfd->mFrame->GetPrevContinuation() ||
pfd->mFrame->FrameIsNonFirstInIBSplit()) &&
aReflowState.mStyleBorder->mBoxDecorationBreak ==
aReflowInput.mStyleBorder->mBoxDecorationBreak ==
NS_STYLE_BOX_DECORATION_BREAK_SLICE) {
// Zero this out so that when we compute the max-element-width of
// the frame we will properly avoid adding in the starting margin.
pfd->mMargin.IStart(lineWM) = 0;
} else if (NS_UNCONSTRAINEDSIZE == aReflowState.ComputedISize()) {
NS_WARN_IF_FALSE(NS_UNCONSTRAINEDSIZE != aReflowState.AvailableISize(),
} else if (NS_UNCONSTRAINEDSIZE == aReflowInput.ComputedISize()) {
NS_WARN_IF_FALSE(NS_UNCONSTRAINEDSIZE != aReflowInput.AvailableISize(),
"have unconstrained inline-size; this should only result "
"from very large sizes, not attempts at intrinsic "
"inline-size calculation");
@ -1201,8 +1201,8 @@ nsLineLayout::AllowForStartMargin(PerFrameData* pfd,
// in the reflow state), adjust available inline-size to account
// for the start margin. The end margin will be accounted for when
// we finish flowing the frame.
WritingMode wm = aReflowState.GetWritingMode();
aReflowState.AvailableISize() -=
WritingMode wm = aReflowInput.GetWritingMode();
aReflowInput.AvailableISize() -=
pfd->mMargin.ConvertTo(wm, lineWM).IStart(wm);
}
}
@ -1470,7 +1470,7 @@ nsLineLayout::AddBulletFrame(nsIFrame* aFrame,
NS_ASSERTION(mCurrentSpan == mRootSpan, "bad linelayout user");
NS_ASSERTION(mGotLineBox, "must have line box");
nsIFrame *blockFrame = mBlockReflowState->mFrame;
nsIFrame *blockFrame = mBlockReflowInput->mFrame;
NS_ASSERTION(blockFrame->IsFrameOfType(nsIFrame::eBlockFrame),
"must be for block");
if (!static_cast<nsBlockFrame*>(blockFrame)->BulletIsEmpty()) {
@ -1904,7 +1904,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
GetInflationForBlockDirAlignment(spanFrame, mInflationMinFontSize);
nscoord logicalBSize = ReflowInput::
CalcLineHeight(spanFrame->GetContent(), spanFrame->StyleContext(),
mBlockReflowState->ComputedHeight(),
mBlockReflowInput->ComputedHeight(),
inflation);
nscoord contentBSize = spanFramePFD->mBounds.BSize(lineWM) -
spanFramePFD->mBorderPadding.BStartEnd(lineWM);
@ -2192,7 +2192,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
float inflation =
GetInflationForBlockDirAlignment(frame, mInflationMinFontSize);
pctBasis = ReflowInput::CalcLineHeight(frame->GetContent(),
frame->StyleContext(), mBlockReflowState->ComputedBSize(),
frame->StyleContext(), mBlockReflowInput->ComputedBSize(),
inflation);
}
nscoord offset =
@ -2588,7 +2588,7 @@ nsLineLayout::TrimTrailingWhiteSpaceIn(PerSpanData* psd,
// might have a soft hyphen which should now appear, changing the frame's
// width
nsTextFrame::TrimOutput trimOutput = static_cast<nsTextFrame*>(pfd->mFrame)->
TrimTrailingWhiteSpace(mBlockReflowState->mRenderingContext->GetDrawTarget());
TrimTrailingWhiteSpace(mBlockReflowInput->mRenderingContext->GetDrawTarget());
#ifdef NOISY_TRIM
nsFrame::ListTag(stdout, psd->mFrame->mFrame);
printf(": trim of ");
@ -3121,7 +3121,7 @@ nsLineLayout::TextAlignLine(nsLineBox* aLine,
nscoord availISize = psd->mIEnd - psd->mIStart;
nscoord remainingISize = availISize - aLine->ISize();
#ifdef NOISY_INLINEDIR_ALIGN
nsFrame::ListTag(stdout, mBlockReflowState->mFrame);
nsFrame::ListTag(stdout, mBlockReflowInput->mFrame);
printf(": availISize=%d lineBounds.IStart=%d lineISize=%d delta=%d\n",
availISize, aLine->IStart(), aLine->ISize(), remainingISize);
#endif
@ -3146,7 +3146,7 @@ nsLineLayout::TextAlignLine(nsLineBox* aLine,
}
}
bool isSVG = mBlockReflowState->mFrame->IsSVGText();
bool isSVG = mBlockReflowInput->mFrame->IsSVGText();
bool doTextAlign = remainingISize > 0 || textAlignTrue;
int32_t additionalGaps = 0;
@ -3363,7 +3363,7 @@ nsLineLayout::RelativePositionFrames(PerSpanData* psd, nsOverflowAreas& aOverflo
frame->StyleText()->HasTextEmphasis() ||
frame->StyleText()->HasWebkitTextStroke()) {
nsTextFrame* f = static_cast<nsTextFrame*>(frame);
r = f->RecomputeOverflow(mBlockReflowState->mFrame);
r = f->RecomputeOverflow(mBlockReflowInput->mFrame);
}
frame->FinishAndStoreOverflow(r, frame->GetSize());
}

Просмотреть файл

@ -39,7 +39,7 @@ public:
*/
nsLineLayout(nsPresContext* aPresContext,
nsFloatManager* aFloatManager,
const ReflowInput* aOuterReflowState,
const ReflowInput* aOuterReflowInput,
const nsLineList::iterator* aLine,
nsLineLayout* aBaseLineLayout);
~nsLineLayout();
@ -76,7 +76,7 @@ public:
const mozilla::LogicalRect& aNewAvailableSpace,
nsIFrame* aFloatFrame);
void BeginSpan(nsIFrame* aFrame, const ReflowInput* aSpanReflowState,
void BeginSpan(nsIFrame* aFrame, const ReflowInput* aSpanReflowInput,
nscoord aLeftEdge, nscoord aRightEdge, nscoord* aBaseline);
// Returns the width of the span
@ -342,8 +342,8 @@ public:
* some other kind of frame when inline frames are reflowed in a non-block
* context (e.g. MathML or floating first-letter).
*/
nsIFrame* LineContainerFrame() const { return mBlockReflowState->mFrame; }
const ReflowInput* LineContainerRS() const { return mBlockReflowState; }
nsIFrame* LineContainerFrame() const { return mBlockReflowInput->mFrame; }
const ReflowInput* LineContainerRS() const { return mBlockReflowInput; }
const nsLineList::iterator* GetLine() const {
return mGotLineBox ? &mLineBox : nullptr;
}
@ -383,7 +383,7 @@ protected:
// This state is constant for a given block frame doing line layout
nsFloatManager* mFloatManager;
const nsStyleText* mStyleText; // for the block
const ReflowInput* mBlockReflowState;
const ReflowInput* mBlockReflowInput;
// The line layout for the base text. It is usually nullptr.
// It becomes not null when the current line layout is for ruby
@ -534,7 +534,7 @@ protected:
// the next.
PerFrameData* mLastFrame;
const ReflowInput* mReflowState;
const ReflowInput* mReflowInput;
bool mNoWrap;
mozilla::WritingMode mWritingMode;
bool mContainsFloat;
@ -667,7 +667,7 @@ protected:
void PushFrame(nsIFrame* aFrame);
void AllowForStartMargin(PerFrameData* pfd,
ReflowInput& aReflowState);
ReflowInput& aReflowInput);
void SyncAnnotationBounds(PerFrameData* aRubyFrame);

Просмотреть файл

@ -23,12 +23,12 @@ NS_IMPL_FRAMEARENA_HELPERS(nsPageContentFrame)
void
nsPageContentFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsPageContentFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
aStatus = NS_FRAME_COMPLETE; // initialize out parameter
if (GetPrevInFlow() && (GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
@ -42,8 +42,8 @@ nsPageContentFrame::Reflow(nsPresContext* aPresContext,
// Set our size up front, since some parts of reflow depend on it
// being already set. Note that the computed height may be
// unconstrained; that's ok. Consumers should watch out for that.
nsSize maxSize(aReflowState.ComputedWidth(),
aReflowState.ComputedHeight());
nsSize maxSize(aReflowInput.ComputedWidth(),
aReflowInput.ComputedHeight());
SetSize(maxSize);
// A PageContentFrame must always have one child: the canvas frame.
@ -53,12 +53,12 @@ nsPageContentFrame::Reflow(nsPresContext* aPresContext,
nsIFrame* frame = mFrames.FirstChild();
WritingMode wm = frame->GetWritingMode();
LogicalSize logicalSize(wm, maxSize);
ReflowInput kidReflowState(aPresContext, aReflowState,
ReflowInput kidReflowInput(aPresContext, aReflowInput,
frame, logicalSize);
kidReflowState.SetComputedBSize(logicalSize.BSize(wm));
kidReflowInput.SetComputedBSize(logicalSize.BSize(wm));
// Reflow the page content area
ReflowChild(frame, aPresContext, aDesiredSize, kidReflowState, 0, 0, 0, aStatus);
ReflowChild(frame, aPresContext, aDesiredSize, kidReflowInput, 0, 0, 0, aStatus);
// The document element's background should cover the entire canvas, so
// take into account the combined area and any space taken up by
@ -67,7 +67,7 @@ nsPageContentFrame::Reflow(nsPresContext* aPresContext,
// XXXbz this screws up percentage padding (sets padding to zero
// in the percentage padding case)
kidReflowState.mStylePadding->GetPadding(padding);
kidReflowInput.mStylePadding->GetPadding(padding);
// This is for shrink-to-fit, and therefore we want to use the
// scrollable overflow, since the purpose of shrink to fit is to
@ -79,7 +79,7 @@ nsPageContentFrame::Reflow(nsPresContext* aPresContext,
nscoord xmost = aDesiredSize.ScrollableOverflow().XMost();
if (xmost > aDesiredSize.Width()) {
nscoord widthToFit = xmost + padding.right +
kidReflowState.mStyleBorder->GetComputedBorderWidth(NS_SIDE_RIGHT);
kidReflowInput.mStyleBorder->GetComputedBorderWidth(NS_SIDE_RIGHT);
float ratio = float(maxSize.width) / widthToFit;
NS_ASSERTION(ratio >= 0.0 && ratio < 1.0, "invalid shrink-to-fit ratio");
mPD->mShrinkToFitRatio = std::min(mPD->mShrinkToFitRatio, ratio);
@ -87,7 +87,7 @@ nsPageContentFrame::Reflow(nsPresContext* aPresContext,
}
// Place and size the child
FinishReflowChild(frame, aPresContext, aDesiredSize, &kidReflowState, 0, 0, 0);
FinishReflowChild(frame, aPresContext, aDesiredSize, &kidReflowInput, 0, 0, 0);
NS_ASSERTION(aPresContext->IsDynamic() || !NS_FRAME_IS_FULLY_COMPLETE(aStatus) ||
!frame->GetNextInFlow(), "bad child flow list");
@ -95,18 +95,18 @@ nsPageContentFrame::Reflow(nsPresContext* aPresContext,
// Reflow our fixed frames
nsReflowStatus fixedStatus = NS_FRAME_COMPLETE;
ReflowAbsoluteFrames(aPresContext, aDesiredSize, aReflowState, fixedStatus);
ReflowAbsoluteFrames(aPresContext, aDesiredSize, aReflowInput, fixedStatus);
NS_ASSERTION(NS_FRAME_IS_COMPLETE(fixedStatus), "fixed frames can be truncated, but not incomplete");
// Return our desired size
WritingMode wm = aReflowState.GetWritingMode();
aDesiredSize.ISize(wm) = aReflowState.ComputedISize();
if (aReflowState.ComputedBSize() != NS_UNCONSTRAINEDSIZE) {
aDesiredSize.BSize(wm) = aReflowState.ComputedBSize();
WritingMode wm = aReflowInput.GetWritingMode();
aDesiredSize.ISize(wm) = aReflowInput.ComputedISize();
if (aReflowInput.ComputedBSize() != NS_UNCONSTRAINEDSIZE) {
aDesiredSize.BSize(wm) = aReflowInput.ComputedBSize();
}
FinishAndStoreOverflow(&aDesiredSize);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
nsIAtom*

Просмотреть файл

@ -52,12 +52,12 @@ nsPageFrame::~nsPageFrame()
void
nsPageFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsPageFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
aStatus = NS_FRAME_COMPLETE; // initialize out parameter
NS_ASSERTION(mFrames.FirstChild() &&
@ -94,20 +94,20 @@ nsPageFrame::Reflow(nsPresContext* aPresContext,
return;
}
ReflowInput kidReflowState(aPresContext, aReflowState, frame,
ReflowInput kidReflowInput(aPresContext, aReflowInput, frame,
LogicalSize(frame->GetWritingMode(),
maxSize));
kidReflowState.mFlags.mIsTopOfPage = true;
kidReflowState.mFlags.mTableIsSplittable = true;
kidReflowInput.mFlags.mIsTopOfPage = true;
kidReflowInput.mFlags.mTableIsSplittable = true;
// Use the margins given in the @page rule.
// If a margin is 'auto', use the margin from the print settings for that side.
const nsStyleSides& marginStyle = kidReflowState.mStyleMargin->mMargin;
const nsStyleSides& marginStyle = kidReflowInput.mStyleMargin->mMargin;
NS_FOR_CSS_SIDES(side) {
if (marginStyle.GetUnit(side) == eStyleUnit_Auto) {
mPageContentMargin.Side(side) = mPD->mReflowMargin.Side(side);
} else {
mPageContentMargin.Side(side) = kidReflowState.ComputedPhysicalMargin().Side(side);
mPageContentMargin.Side(side) = kidReflowInput.ComputedPhysicalMargin().Side(side);
}
}
@ -133,40 +133,40 @@ nsPageFrame::Reflow(nsPresContext* aPresContext,
}
}
kidReflowState.SetComputedWidth(maxWidth);
kidReflowState.SetComputedHeight(maxHeight);
kidReflowInput.SetComputedWidth(maxWidth);
kidReflowInput.SetComputedHeight(maxHeight);
// calc location of frame
nscoord xc = mPageContentMargin.left;
nscoord yc = mPageContentMargin.top;
// Get the child's desired size
ReflowChild(frame, aPresContext, aDesiredSize, kidReflowState, xc, yc, 0, aStatus);
ReflowChild(frame, aPresContext, aDesiredSize, kidReflowInput, xc, yc, 0, aStatus);
// Place and size the child
FinishReflowChild(frame, aPresContext, aDesiredSize, &kidReflowState, xc, yc, 0);
FinishReflowChild(frame, aPresContext, aDesiredSize, &kidReflowInput, xc, yc, 0);
NS_ASSERTION(!NS_FRAME_IS_FULLY_COMPLETE(aStatus) ||
!frame->GetNextInFlow(), "bad child flow list");
}
PR_PL(("PageFrame::Reflow %p ", this));
PR_PL(("[%d,%d][%d,%d]\n", aDesiredSize.Width(), aDesiredSize.Height(),
aReflowState.AvailableWidth(), aReflowState.AvailableHeight()));
aReflowInput.AvailableWidth(), aReflowInput.AvailableHeight()));
// Return our desired size
WritingMode wm = aReflowState.GetWritingMode();
aDesiredSize.ISize(wm) = aReflowState.AvailableISize();
if (aReflowState.AvailableBSize() != NS_UNCONSTRAINEDSIZE) {
aDesiredSize.BSize(wm) = aReflowState.AvailableBSize();
WritingMode wm = aReflowInput.GetWritingMode();
aDesiredSize.ISize(wm) = aReflowInput.AvailableISize();
if (aReflowInput.AvailableBSize() != NS_UNCONSTRAINEDSIZE) {
aDesiredSize.BSize(wm) = aReflowInput.AvailableBSize();
}
aDesiredSize.SetOverflowAreasToDesiredBounds();
FinishAndStoreOverflow(&aDesiredSize);
PR_PL(("PageFrame::Reflow %p ", this));
PR_PL(("[%d,%d]\n", aReflowState.AvailableWidth(), aReflowState.AvailableHeight()));
PR_PL(("[%d,%d]\n", aReflowInput.AvailableWidth(), aReflowInput.AvailableHeight()));
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
nsIAtom*
@ -709,18 +709,18 @@ nsPageBreakFrame::GetIntrinsicBSize()
void
nsPageBreakFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsPageBreakFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
// Override reflow, since we don't want to deal with what our
// computed values are.
WritingMode wm = aReflowState.GetWritingMode();
WritingMode wm = aReflowInput.GetWritingMode();
LogicalSize finalSize(wm, GetIntrinsicISize(),
aReflowState.AvailableBSize() == NS_UNCONSTRAINEDSIZE ?
0 : aReflowState.AvailableBSize());
aReflowInput.AvailableBSize() == NS_UNCONSTRAINEDSIZE ?
0 : aReflowInput.AvailableBSize());
// round the height down to the nearest pixel
finalSize.BSize(wm) -=
finalSize.BSize(wm) % nsPresContext::CSSPixelsToAppUnits(1);

Просмотреть файл

@ -113,7 +113,7 @@ class nsPageBreakFrame : public nsLeafFrame
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsIAtom* GetType() const override;

Просмотреть файл

@ -106,7 +106,7 @@ nsPlaceholderFrame::AddInlinePrefISize(nsRenderingContext* aRenderingContext,
void
nsPlaceholderFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
#ifdef DEBUG
@ -143,11 +143,11 @@ nsPlaceholderFrame::Reflow(nsPresContext* aPresContext,
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsPlaceholderFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
aDesiredSize.ClearSize();
aStatus = NS_FRAME_COMPLETE;
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
void

Просмотреть файл

@ -100,7 +100,7 @@ public:
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;

Просмотреть файл

@ -425,7 +425,7 @@ nsPluginFrame::GetWidgetConfiguration(nsTArray<nsIWidget::Configuration>* aConfi
void
nsPluginFrame::GetDesiredSize(nsPresContext* aPresContext,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
ReflowOutput& aMetrics)
{
// By default, we have no area
@ -435,21 +435,21 @@ nsPluginFrame::GetDesiredSize(nsPresContext* aPresContext,
return;
}
aMetrics.Width() = aReflowState.ComputedWidth();
aMetrics.Height() = aReflowState.ComputedHeight();
aMetrics.Width() = aReflowInput.ComputedWidth();
aMetrics.Height() = aReflowInput.ComputedHeight();
// for EMBED and APPLET, default to 240x200 for compatibility
if (mContent->IsAnyOfHTMLElements(nsGkAtoms::applet,
nsGkAtoms::embed)) {
if (aMetrics.Width() == NS_UNCONSTRAINEDSIZE) {
aMetrics.Width() = clamped(nsPresContext::CSSPixelsToAppUnits(EMBED_DEF_WIDTH),
aReflowState.ComputedMinWidth(),
aReflowState.ComputedMaxWidth());
aReflowInput.ComputedMinWidth(),
aReflowInput.ComputedMaxWidth());
}
if (aMetrics.Height() == NS_UNCONSTRAINEDSIZE) {
aMetrics.Height() = clamped(nsPresContext::CSSPixelsToAppUnits(EMBED_DEF_HEIGHT),
aReflowState.ComputedMinHeight(),
aReflowState.ComputedMaxHeight());
aReflowInput.ComputedMinHeight(),
aReflowInput.ComputedMaxHeight());
}
#if defined(MOZ_WIDGET_GTK)
@ -467,8 +467,8 @@ nsPluginFrame::GetDesiredSize(nsPresContext* aPresContext,
// Make up a number.
if (aMetrics.Width() == NS_UNCONSTRAINEDSIZE) {
aMetrics.Width() =
(aReflowState.ComputedMinWidth() != NS_UNCONSTRAINEDSIZE) ?
aReflowState.ComputedMinWidth() : 0;
(aReflowInput.ComputedMinWidth() != NS_UNCONSTRAINEDSIZE) ?
aReflowInput.ComputedMinWidth() : 0;
}
// At this point, the height has an unconstrained value only in two cases:
@ -477,8 +477,8 @@ nsPluginFrame::GetDesiredSize(nsPresContext* aPresContext,
// In either case, we have to make up a number.
if (aMetrics.Height() == NS_UNCONSTRAINEDSIZE) {
aMetrics.Height() =
(aReflowState.ComputedMinHeight() != NS_UNCONSTRAINEDSIZE) ?
aReflowState.ComputedMinHeight() : 0;
(aReflowInput.ComputedMinHeight() != NS_UNCONSTRAINEDSIZE) ?
aReflowInput.ComputedMinHeight() : 0;
}
// XXXbz don't add in the border and padding, because we screw up our
@ -491,15 +491,15 @@ nsPluginFrame::GetDesiredSize(nsPresContext* aPresContext,
void
nsPluginFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aMetrics,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsPluginFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aMetrics, aStatus);
// Get our desired size
GetDesiredSize(aPresContext, aReflowState, aMetrics);
GetDesiredSize(aPresContext, aReflowInput, aMetrics);
aMetrics.SetOverflowAreasToDesiredBounds();
FinishAndStoreOverflow(&aMetrics);
@ -518,7 +518,7 @@ nsPluginFrame::Reflow(nsPresContext* aPresContext,
}
nsRect r(0, 0, aMetrics.Width(), aMetrics.Height());
r.Deflate(aReflowState.ComputedPhysicalBorderPadding());
r.Deflate(aReflowInput.ComputedPhysicalBorderPadding());
if (mInnerView) {
nsViewManager* vm = mInnerView->GetViewManager();
@ -534,7 +534,7 @@ nsPluginFrame::Reflow(nsPresContext* aPresContext,
aStatus = NS_FRAME_COMPLETE;
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aMetrics);
}
///////////// nsIReflowCallback ///////////////
@ -822,7 +822,7 @@ nsPluginFrame::GetWindowOriginInPixels(bool aWindowless)
void
nsPluginFrame::DidReflow(nsPresContext* aPresContext,
const ReflowInput* aReflowState,
const ReflowInput* aReflowInput,
nsDidReflowStatus aStatus)
{
// Do this check before calling the superclass, as that clears
@ -834,7 +834,7 @@ nsPluginFrame::DidReflow(nsPresContext* aPresContext,
objContent->HasNewFrame(this);
}
nsFrame::DidReflow(aPresContext, aReflowState, aStatus);
nsFrame::DidReflow(aPresContext, aReflowInput, aStatus);
// The view is created hidden; once we have reflowed it and it has been
// positioned then we show it.

Просмотреть файл

@ -74,10 +74,10 @@ public:
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual void DidReflow(nsPresContext* aPresContext,
const ReflowInput* aReflowState,
const ReflowInput* aReflowInput,
nsDidReflowStatus aStatus) override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
@ -233,7 +233,7 @@ protected:
// NOTE: This frame class does not inherit from |nsLeafFrame|, so
// this is not a virtual method implementation.
void GetDesiredSize(nsPresContext* aPresContext,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
ReflowOutput& aDesiredSize);
bool IsFocusable(int32_t *aTabIndex = nullptr,

Просмотреть файл

@ -293,24 +293,24 @@ struct nsRubyBaseContainerFrame::RubyReflowInput
bool mAllowInitialLineBreak;
bool mAllowLineBreak;
const AutoRubyTextContainerArray& mTextContainers;
const ReflowInput& mBaseReflowState;
const nsTArray<UniquePtr<ReflowInput>>& mTextReflowStates;
const ReflowInput& mBaseReflowInput;
const nsTArray<UniquePtr<ReflowInput>>& mTextReflowInputs;
};
/* virtual */ void
nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsRubyBaseContainerFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
aStatus = NS_FRAME_COMPLETE;
if (!aReflowState.mLineLayout) {
if (!aReflowInput.mLineLayout) {
NS_ASSERTION(
aReflowState.mLineLayout,
aReflowInput.mLineLayout,
"No line layout provided to RubyBaseContainerFrame reflow method.");
return;
}
@ -323,9 +323,9 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext,
textContainers[i]->MoveOverflowToChildList();
}
WritingMode lineWM = aReflowState.mLineLayout->GetWritingMode();
LogicalSize availSize(lineWM, aReflowState.AvailableISize(),
aReflowState.AvailableBSize());
WritingMode lineWM = aReflowInput.mLineLayout->GetWritingMode();
LogicalSize availSize(lineWM, aReflowInput.AvailableISize(),
aReflowInput.AvailableBSize());
// We have a reflow state and a line layout for each RTC.
// They are conceptually the state of the RTCs, but we don't actually
@ -334,9 +334,9 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext,
// Since there are pointers refer to reflow states and line layouts,
// it is necessary to guarantee that they won't be moved. For this
// reason, they are wrapped in UniquePtr here.
AutoTArray<UniquePtr<ReflowInput>, RTC_ARRAY_SIZE> reflowStates;
AutoTArray<UniquePtr<ReflowInput>, RTC_ARRAY_SIZE> reflowInputs;
AutoTArray<UniquePtr<nsLineLayout>, RTC_ARRAY_SIZE> lineLayouts;
reflowStates.SetCapacity(rtcCount);
reflowInputs.SetCapacity(rtcCount);
lineLayouts.SetCapacity(rtcCount);
// Begin the line layout for each ruby text container in advance.
@ -347,49 +347,49 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext,
hasSpan = true;
}
ReflowInput* reflowState = new ReflowInput(
aPresContext, *aReflowState.mParentReflowState, textContainer,
ReflowInput* reflowInput = new ReflowInput(
aPresContext, *aReflowInput.mParentReflowInput, textContainer,
availSize.ConvertTo(textContainer->GetWritingMode(), lineWM));
reflowStates.AppendElement(reflowState);
reflowInputs.AppendElement(reflowInput);
nsLineLayout* lineLayout = new nsLineLayout(aPresContext,
reflowState->mFloatManager,
reflowState, nullptr,
aReflowState.mLineLayout);
reflowInput->mFloatManager,
reflowInput, nullptr,
aReflowInput.mLineLayout);
lineLayout->SetSuppressLineWrap(true);
lineLayouts.AppendElement(lineLayout);
// Line number is useless for ruby text
// XXX nullptr here may cause problem, see comments for
// nsLineLayout::mBlockRS and nsLineLayout::AddFloat
lineLayout->Init(nullptr, reflowState->CalcLineHeight(), -1);
reflowState->mLineLayout = lineLayout;
lineLayout->Init(nullptr, reflowInput->CalcLineHeight(), -1);
reflowInput->mLineLayout = lineLayout;
// Border and padding are suppressed on ruby text containers.
// If the writing mode is vertical-rl, the horizontal position of
// rt frames will be updated when reflowing this text container,
// hence leave container size 0 here for now.
lineLayout->BeginLineReflow(0, 0, reflowState->ComputedISize(),
lineLayout->BeginLineReflow(0, 0, reflowInput->ComputedISize(),
NS_UNCONSTRAINEDSIZE,
false, false, lineWM, nsSize(0, 0));
lineLayout->AttachRootFrameToBaseLineLayout();
}
aReflowState.mLineLayout->BeginSpan(this, &aReflowState,
0, aReflowState.AvailableISize(),
aReflowInput.mLineLayout->BeginSpan(this, &aReflowInput,
0, aReflowInput.AvailableISize(),
&mBaseline);
bool allowInitialLineBreak, allowLineBreak;
GetIsLineBreakAllowed(this, aReflowState.mLineLayout->LineIsBreakable(),
GetIsLineBreakAllowed(this, aReflowInput.mLineLayout->LineIsBreakable(),
&allowInitialLineBreak, &allowLineBreak);
nscoord isize = 0;
// Reflow columns excluding any span
RubyReflowInput reflowState = {
RubyReflowInput reflowInput = {
allowInitialLineBreak, allowLineBreak && !hasSpan,
textContainers, aReflowState, reflowStates
textContainers, aReflowInput, reflowInputs
};
isize = ReflowColumns(reflowState, aStatus);
DebugOnly<nscoord> lineSpanSize = aReflowState.mLineLayout->EndSpan(this);
isize = ReflowColumns(reflowInput, aStatus);
DebugOnly<nscoord> lineSpanSize = aReflowInput.mLineLayout->EndSpan(this);
aDesiredSize.ISize(lineWM) = isize;
// When there are no frames inside the ruby base container, EndSpan
// will return 0. However, in this case, the actual width of the
@ -405,10 +405,10 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext,
if (!NS_INLINE_IS_BREAK_BEFORE(aStatus) &&
NS_FRAME_IS_COMPLETE(aStatus) && hasSpan) {
// Reflow spans
RubyReflowInput reflowState = {
false, false, textContainers, aReflowState, reflowStates
RubyReflowInput reflowInput = {
false, false, textContainers, aReflowInput, reflowInputs
};
nscoord spanISize = ReflowSpans(reflowState);
nscoord spanISize = ReflowSpans(reflowInput);
isize = std::max(isize, spanISize);
}
@ -437,7 +437,7 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext,
// Border and padding are suppressed on ruby base container,
// create a fake borderPadding for setting BSize.
WritingMode frameWM = aReflowState.GetWritingMode();
WritingMode frameWM = aReflowInput.GetWritingMode();
LogicalMargin borderPadding(frameWM);
nsLayoutUtils::SetBSizeFromFontMetrics(this, aDesiredSize,
borderPadding, lineWM, frameWM);
@ -459,11 +459,11 @@ struct MOZ_STACK_CLASS nsRubyBaseContainerFrame::PullFrameState
};
nscoord
nsRubyBaseContainerFrame::ReflowColumns(const RubyReflowInput& aReflowState,
nsRubyBaseContainerFrame::ReflowColumns(const RubyReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
nsLineLayout* lineLayout = aReflowState.mBaseReflowState.mLineLayout;
const uint32_t rtcCount = aReflowState.mTextContainers.Length();
nsLineLayout* lineLayout = aReflowInput.mBaseReflowInput.mLineLayout;
const uint32_t rtcCount = aReflowInput.mTextContainers.Length();
nscoord icoord = lineLayout->GetCurrentICoord();
MOZ_ASSERT(icoord == 0, "border/padding of rbc should have been suppressed");
nsReflowStatus reflowStatus = NS_FRAME_COMPLETE;
@ -472,10 +472,10 @@ nsRubyBaseContainerFrame::ReflowColumns(const RubyReflowInput& aReflowState,
uint32_t columnIndex = 0;
RubyColumn column;
column.mTextFrames.SetCapacity(rtcCount);
RubyColumnEnumerator e(this, aReflowState.mTextContainers);
RubyColumnEnumerator e(this, aReflowInput.mTextContainers);
for (; !e.AtEnd(); e.Next()) {
e.GetColumn(column);
icoord += ReflowOneColumn(aReflowState, columnIndex, column, reflowStatus);
icoord += ReflowOneColumn(aReflowInput, columnIndex, column, reflowStatus);
if (!NS_INLINE_IS_BREAK_BEFORE(reflowStatus)) {
columnIndex++;
}
@ -487,7 +487,7 @@ nsRubyBaseContainerFrame::ReflowColumns(const RubyReflowInput& aReflowState,
}
bool isComplete = false;
PullFrameState pullFrameState(this, aReflowState.mTextContainers);
PullFrameState pullFrameState(this, aReflowInput.mTextContainers);
while (!NS_INLINE_IS_BREAK(reflowStatus)) {
// We are not handling overflow here.
MOZ_ASSERT(reflowStatus == NS_FRAME_COMPLETE);
@ -499,7 +499,7 @@ nsRubyBaseContainerFrame::ReflowColumns(const RubyReflowInput& aReflowState,
// No more frames can be pulled.
break;
}
icoord += ReflowOneColumn(aReflowState, columnIndex, column, reflowStatus);
icoord += ReflowOneColumn(aReflowInput, columnIndex, column, reflowStatus);
if (!NS_INLINE_IS_BREAK_BEFORE(reflowStatus)) {
columnIndex++;
}
@ -517,14 +517,14 @@ nsRubyBaseContainerFrame::ReflowColumns(const RubyReflowInput& aReflowState,
}
if (NS_INLINE_IS_BREAK_BEFORE(reflowStatus)) {
if (!columnIndex || !aReflowState.mAllowLineBreak) {
if (!columnIndex || !aReflowInput.mAllowLineBreak) {
// If no column has been placed yet, or we have any span,
// the whole container should be in the next line.
aStatus = NS_INLINE_LINE_BREAK_BEFORE();
return 0;
}
aStatus = NS_INLINE_LINE_BREAK_AFTER(aStatus);
MOZ_ASSERT(NS_FRAME_IS_COMPLETE(aStatus) || aReflowState.mAllowLineBreak);
MOZ_ASSERT(NS_FRAME_IS_COMPLETE(aStatus) || aReflowInput.mAllowLineBreak);
// If we are on an intra-level whitespace column, null values in
// column.mBaseFrame and column.mTextFrames don't represent the
@ -551,7 +551,7 @@ nsRubyBaseContainerFrame::ReflowColumns(const RubyReflowInput& aReflowState,
textFrame = nextColumn->mTextFrames[i];
}
if (textFrame) {
aReflowState.mTextContainers[i]->PushChildren(
aReflowInput.mTextContainers[i]->PushChildren(
textFrame, textFrame->GetPrevSibling());
}
}
@ -568,31 +568,31 @@ nsRubyBaseContainerFrame::ReflowColumns(const RubyReflowInput& aReflowState,
}
nscoord
nsRubyBaseContainerFrame::ReflowOneColumn(const RubyReflowInput& aReflowState,
nsRubyBaseContainerFrame::ReflowOneColumn(const RubyReflowInput& aReflowInput,
uint32_t aColumnIndex,
const RubyColumn& aColumn,
nsReflowStatus& aStatus)
{
const ReflowInput& baseReflowState = aReflowState.mBaseReflowState;
const auto& textReflowStates = aReflowState.mTextReflowStates;
nscoord istart = baseReflowState.mLineLayout->GetCurrentICoord();
const ReflowInput& baseReflowInput = aReflowInput.mBaseReflowInput;
const auto& textReflowInputs = aReflowInput.mTextReflowInputs;
nscoord istart = baseReflowInput.mLineLayout->GetCurrentICoord();
if (aColumn.mBaseFrame) {
bool allowBreakBefore = aColumnIndex ?
aReflowState.mAllowLineBreak : aReflowState.mAllowInitialLineBreak;
aReflowInput.mAllowLineBreak : aReflowInput.mAllowInitialLineBreak;
if (allowBreakBefore) {
gfxBreakPriority breakPriority = LineBreakBefore(
aColumn.mBaseFrame, baseReflowState.mRenderingContext->GetDrawTarget(),
baseReflowState.mLineLayout->LineContainerFrame(),
baseReflowState.mLineLayout->GetLine());
aColumn.mBaseFrame, baseReflowInput.mRenderingContext->GetDrawTarget(),
baseReflowInput.mLineLayout->LineContainerFrame(),
baseReflowInput.mLineLayout->GetLine());
if (breakPriority != gfxBreakPriority::eNoBreak) {
gfxBreakPriority lastBreakPriority =
baseReflowState.mLineLayout->LastOptionalBreakPriority();
baseReflowInput.mLineLayout->LastOptionalBreakPriority();
if (breakPriority >= lastBreakPriority) {
// Either we have been overflow, or we are forced
// to break here, do break before.
if (istart > baseReflowState.AvailableISize() ||
baseReflowState.mLineLayout->NotifyOptionalBreakPosition(
if (istart > baseReflowInput.AvailableISize() ||
baseReflowInput.mLineLayout->NotifyOptionalBreakPosition(
aColumn.mBaseFrame, 0, true, breakPriority)) {
aStatus = NS_INLINE_LINE_BREAK_BEFORE();
return 0;
@ -602,9 +602,9 @@ nsRubyBaseContainerFrame::ReflowOneColumn(const RubyReflowInput& aReflowState,
}
}
const uint32_t rtcCount = aReflowState.mTextContainers.Length();
const uint32_t rtcCount = aReflowInput.mTextContainers.Length();
MOZ_ASSERT(aColumn.mTextFrames.Length() == rtcCount);
MOZ_ASSERT(textReflowStates.Length() == rtcCount);
MOZ_ASSERT(textReflowInputs.Length() == rtcCount);
nscoord columnISize = 0;
nsAutoString baseText;
@ -633,7 +633,7 @@ nsRubyBaseContainerFrame::ReflowOneColumn(const RubyReflowInput& aReflowState,
bool pushedFrame;
nsReflowStatus reflowStatus;
nsLineLayout* lineLayout = textReflowStates[i]->mLineLayout;
nsLineLayout* lineLayout = textReflowInputs[i]->mLineLayout;
nscoord textIStart = lineLayout->GetCurrentICoord();
lineLayout->ReflowFrame(textFrame, reflowStatus, nullptr, pushedFrame);
if (MOZ_UNLIKELY(NS_INLINE_IS_BREAK(reflowStatus) || pushedFrame)) {
@ -654,7 +654,7 @@ nsRubyBaseContainerFrame::ReflowOneColumn(const RubyReflowInput& aReflowState,
bool pushedFrame;
nsReflowStatus reflowStatus;
nsLineLayout* lineLayout = baseReflowState.mLineLayout;
nsLineLayout* lineLayout = baseReflowInput.mLineLayout;
nscoord baseIStart = lineLayout->GetCurrentICoord();
lineLayout->ReflowFrame(aColumn.mBaseFrame, reflowStatus,
nullptr, pushedFrame);
@ -671,18 +671,18 @@ nsRubyBaseContainerFrame::ReflowOneColumn(const RubyReflowInput& aReflowState,
// Align all the line layout to the new coordinate.
nscoord icoord = istart + columnISize;
nscoord deltaISize = icoord - baseReflowState.mLineLayout->GetCurrentICoord();
nscoord deltaISize = icoord - baseReflowInput.mLineLayout->GetCurrentICoord();
if (deltaISize > 0) {
baseReflowState.mLineLayout->AdvanceICoord(deltaISize);
baseReflowInput.mLineLayout->AdvanceICoord(deltaISize);
if (aColumn.mBaseFrame) {
RubyUtils::SetReservedISize(aColumn.mBaseFrame, deltaISize);
}
}
for (uint32_t i = 0; i < rtcCount; i++) {
if (aReflowState.mTextContainers[i]->IsSpanContainer()) {
if (aReflowInput.mTextContainers[i]->IsSpanContainer()) {
continue;
}
nsLineLayout* lineLayout = textReflowStates[i]->mLineLayout;
nsLineLayout* lineLayout = textReflowInputs[i]->mLineLayout;
nsRubyTextFrame* textFrame = aColumn.mTextFrames[i];
nscoord deltaISize = icoord - lineLayout->GetCurrentICoord();
if (deltaISize > 0) {
@ -808,12 +808,12 @@ nsRubyBaseContainerFrame::PullOneColumn(nsLineLayout* aLineLayout,
}
nscoord
nsRubyBaseContainerFrame::ReflowSpans(const RubyReflowInput& aReflowState)
nsRubyBaseContainerFrame::ReflowSpans(const RubyReflowInput& aReflowInput)
{
nscoord spanISize = 0;
for (uint32_t i = 0, iend = aReflowState.mTextContainers.Length();
for (uint32_t i = 0, iend = aReflowInput.mTextContainers.Length();
i < iend; i++) {
nsRubyTextContainerFrame* container = aReflowState.mTextContainers[i];
nsRubyTextContainerFrame* container = aReflowInput.mTextContainers[i];
if (!container->IsSpanContainer()) {
continue;
}
@ -821,7 +821,7 @@ nsRubyBaseContainerFrame::ReflowSpans(const RubyReflowInput& aReflowState)
nsIFrame* rtFrame = container->PrincipalChildList().FirstChild();
nsReflowStatus reflowStatus;
bool pushedFrame;
nsLineLayout* lineLayout = aReflowState.mTextReflowStates[i]->mLineLayout;
nsLineLayout* lineLayout = aReflowInput.mTextReflowInputs[i]->mLineLayout;
MOZ_ASSERT(lineLayout->GetCurrentICoord() == 0,
"border/padding of rtc should have been suppressed");
lineLayout->ReflowFrame(rtFrame, reflowStatus, nullptr, pushedFrame);

Просмотреть файл

@ -48,7 +48,7 @@ public:
ComputeSizeFlags aFlags) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nscoord
@ -65,13 +65,13 @@ protected:
explicit nsRubyBaseContainerFrame(nsStyleContext* aContext) : nsContainerFrame(aContext) {}
struct RubyReflowInput;
nscoord ReflowColumns(const RubyReflowInput& aReflowState,
nscoord ReflowColumns(const RubyReflowInput& aReflowInput,
nsReflowStatus& aStatus);
nscoord ReflowOneColumn(const RubyReflowInput& aReflowState,
nscoord ReflowOneColumn(const RubyReflowInput& aReflowInput,
uint32_t aColumnIndex,
const mozilla::RubyColumn& aColumn,
nsReflowStatus& aStatus);
nscoord ReflowSpans(const RubyReflowInput& aReflowState);
nscoord ReflowSpans(const RubyReflowInput& aReflowInput);
struct PullFrameState;

Просмотреть файл

@ -92,15 +92,15 @@ nsRubyFrame::AddInlinePrefISize(nsRenderingContext *aRenderingContext,
/* virtual */ void
nsRubyFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsRubyFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
if (!aReflowState.mLineLayout) {
NS_ASSERTION(aReflowState.mLineLayout,
if (!aReflowInput.mLineLayout) {
NS_ASSERTION(aReflowInput.mLineLayout,
"No line layout provided to RubyFrame reflow method.");
aStatus = NS_FRAME_COMPLETE;
return;
@ -113,25 +113,25 @@ nsRubyFrame::Reflow(nsPresContext* aPresContext,
mBStartLeading = mBEndLeading = 0;
// Begin the span for the ruby frame
WritingMode frameWM = aReflowState.GetWritingMode();
WritingMode lineWM = aReflowState.mLineLayout->GetWritingMode();
LogicalMargin borderPadding = aReflowState.ComputedLogicalBorderPadding();
WritingMode frameWM = aReflowInput.GetWritingMode();
WritingMode lineWM = aReflowInput.mLineLayout->GetWritingMode();
LogicalMargin borderPadding = aReflowInput.ComputedLogicalBorderPadding();
nscoord startEdge = 0;
const bool boxDecorationBreakClone =
StyleBorder()->mBoxDecorationBreak == NS_STYLE_BOX_DECORATION_BREAK_CLONE;
if (boxDecorationBreakClone || !GetPrevContinuation()) {
startEdge = borderPadding.IStart(frameWM);
}
NS_ASSERTION(aReflowState.AvailableISize() != NS_UNCONSTRAINEDSIZE,
NS_ASSERTION(aReflowInput.AvailableISize() != NS_UNCONSTRAINEDSIZE,
"should no longer use available widths");
nscoord availableISize = aReflowState.AvailableISize();
nscoord availableISize = aReflowInput.AvailableISize();
availableISize -= startEdge + borderPadding.IEnd(frameWM);
aReflowState.mLineLayout->BeginSpan(this, &aReflowState,
aReflowInput.mLineLayout->BeginSpan(this, &aReflowInput,
startEdge, availableISize, &mBaseline);
aStatus = NS_FRAME_COMPLETE;
for (RubySegmentEnumerator e(this); !e.AtEnd(); e.Next()) {
ReflowSegment(aPresContext, aReflowState, e.GetBaseContainer(), aStatus);
ReflowSegment(aPresContext, aReflowInput, e.GetBaseContainer(), aStatus);
if (NS_INLINE_IS_BREAK(aStatus)) {
// A break occurs when reflowing the segment.
@ -143,17 +143,17 @@ nsRubyFrame::Reflow(nsPresContext* aPresContext,
ContinuationTraversingState pullState(this);
while (aStatus == NS_FRAME_COMPLETE) {
nsRubyBaseContainerFrame* baseContainer =
PullOneSegment(aReflowState.mLineLayout, pullState);
PullOneSegment(aReflowInput.mLineLayout, pullState);
if (!baseContainer) {
// No more continuations after, finish now.
break;
}
ReflowSegment(aPresContext, aReflowState, baseContainer, aStatus);
ReflowSegment(aPresContext, aReflowInput, baseContainer, aStatus);
}
// We never handle overflow in ruby.
MOZ_ASSERT(!NS_FRAME_OVERFLOW_IS_INCOMPLETE(aStatus));
aDesiredSize.ISize(lineWM) = aReflowState.mLineLayout->EndSpan(this);
aDesiredSize.ISize(lineWM) = aReflowInput.mLineLayout->EndSpan(this);
if (boxDecorationBreakClone || !GetPrevContinuation()) {
aDesiredSize.ISize(lineWM) += borderPadding.IStart(frameWM);
}
@ -167,13 +167,13 @@ nsRubyFrame::Reflow(nsPresContext* aPresContext,
void
nsRubyFrame::ReflowSegment(nsPresContext* aPresContext,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsRubyBaseContainerFrame* aBaseContainer,
nsReflowStatus& aStatus)
{
WritingMode lineWM = aReflowState.mLineLayout->GetWritingMode();
LogicalSize availSize(lineWM, aReflowState.AvailableISize(),
aReflowState.AvailableBSize());
WritingMode lineWM = aReflowInput.mLineLayout->GetWritingMode();
LogicalSize availSize(lineWM, aReflowInput.AvailableISize(),
aReflowInput.AvailableBSize());
WritingMode rubyWM = GetWritingMode();
NS_ASSERTION(!rubyWM.IsOrthogonalTo(lineWM),
"Ruby frame writing-mode shouldn't be orthogonal to its line");
@ -181,9 +181,9 @@ nsRubyFrame::ReflowSegment(nsPresContext* aPresContext,
AutoRubyTextContainerArray textContainers(aBaseContainer);
const uint32_t rtcCount = textContainers.Length();
ReflowOutput baseMetrics(aReflowState);
ReflowOutput baseMetrics(aReflowInput);
bool pushedFrame;
aReflowState.mLineLayout->ReflowFrame(aBaseContainer, aStatus,
aReflowInput.mLineLayout->ReflowFrame(aBaseContainer, aStatus,
&baseMetrics, pushedFrame);
if (NS_INLINE_IS_BREAK_BEFORE(aStatus)) {
@ -192,7 +192,7 @@ nsRubyFrame::ReflowSegment(nsPresContext* aPresContext,
// a break-before for the ruby container.
aStatus = NS_INLINE_LINE_BREAK_AFTER(NS_FRAME_NOT_COMPLETE);
PushChildren(aBaseContainer, aBaseContainer->GetPrevSibling());
aReflowState.mLineLayout->SetDirtyNextLine();
aReflowInput.mLineLayout->SetDirtyNextLine();
}
// This base container is not placed at all, we can skip all
// text containers paired with it.
@ -238,7 +238,7 @@ nsRubyFrame::ReflowSegment(nsPresContext* aPresContext,
// It is possible that we pulled it back before our next-in-flow
// drain our overflow.
PushChildren(lastChild->GetNextSibling(), lastChild);
aReflowState.mLineLayout->SetDirtyNextLine();
aReflowInput.mLineLayout->SetDirtyNextLine();
}
} else {
// If the ruby base container is reflowed completely, the line
@ -271,16 +271,16 @@ nsRubyFrame::ReflowSegment(nsPresContext* aPresContext,
nsRubyTextContainerFrame* textContainer = textContainers[i];
WritingMode rtcWM = textContainer->GetWritingMode();
nsReflowStatus textReflowStatus;
ReflowOutput textMetrics(aReflowState);
ReflowInput textReflowState(aPresContext, aReflowState, textContainer,
ReflowOutput textMetrics(aReflowInput);
ReflowInput textReflowInput(aPresContext, aReflowInput, textContainer,
availSize.ConvertTo(rtcWM, lineWM));
// FIXME We probably shouldn't be using the same nsLineLayout for
// the text containers. But it should be fine now as we are
// not actually using this line layout to reflow something,
// but just read the writing mode from it.
textReflowState.mLineLayout = aReflowState.mLineLayout;
textReflowInput.mLineLayout = aReflowInput.mLineLayout;
textContainer->Reflow(aPresContext, textMetrics,
textReflowState, textReflowStatus);
textReflowInput, textReflowStatus);
// Ruby text containers always return NS_FRAME_COMPLETE even when
// they have continuations, because the breaking has already been
// handled when reflowing the base containers.
@ -325,7 +325,7 @@ nsRubyFrame::ReflowSegment(nsPresContext* aPresContext,
// correct. We will fix it in nsLineLayout after the whole line is
// reflowed.
FinishReflowChild(textContainer, aPresContext, textMetrics,
&textReflowState, lineWM, position, dummyContainerSize, 0);
&textReflowInput, lineWM, position, dummyContainerSize, 0);
}
MOZ_ASSERT(baseRect.ISize(lineWM) == offsetRect.ISize(lineWM),
"Annotations should only be placed on the block directions");
@ -335,7 +335,7 @@ nsRubyFrame::ReflowSegment(nsPresContext* aPresContext,
RubyUtils::ClearReservedISize(aBaseContainer);
} else {
RubyUtils::SetReservedISize(aBaseContainer, deltaISize);
aReflowState.mLineLayout->AdvanceICoord(deltaISize);
aReflowInput.mLineLayout->AdvanceICoord(deltaISize);
}
// Set block leadings of the base container

Просмотреть файл

@ -36,7 +36,7 @@ public:
InlinePrefISizeData *aData) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
#ifdef DEBUG_FRAME_DUMP
@ -56,7 +56,7 @@ protected:
: nsInlineFrame(aContext) {}
void ReflowSegment(nsPresContext* aPresContext,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsRubyBaseContainerFrame* aBaseContainer,
nsReflowStatus& aStatus);

Просмотреть файл

@ -122,19 +122,19 @@ nsRubyTextContainerFrame::UpdateSpanFlag()
/* virtual */ void
nsRubyTextContainerFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsRubyTextContainerFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
// Although a ruby text container may have continuations, returning
// NS_FRAME_COMPLETE here is still safe, since its parent, ruby frame,
// ignores the status, and continuations of the ruby base container
// will take care of our continuations.
aStatus = NS_FRAME_COMPLETE;
WritingMode lineWM = aReflowState.mLineLayout->GetWritingMode();
WritingMode lineWM = aReflowInput.mLineLayout->GetWritingMode();
nscoord minBCoord = nscoord_MAX;
nscoord maxBCoord = nscoord_MIN;

Просмотреть файл

@ -30,7 +30,7 @@ public:
virtual bool IsFrameOfType(uint32_t aFlags) const override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
#ifdef DEBUG_FRAME_DUMP

Просмотреть файл

@ -76,7 +76,7 @@ nsRubyTextFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
/* virtual */ void
nsRubyTextFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
// Even if we want to hide this frame, we have to reflow it first.
@ -85,12 +85,12 @@ nsRubyTextFrame::Reflow(nsPresContext* aPresContext,
// the content is no longer the same, until next reflow triggered by
// some other change. In general, we always reflow all the frames we
// created. There might be other problems if we don't do that.
nsRubyContentFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
nsRubyContentFrame::Reflow(aPresContext, aDesiredSize, aReflowInput, aStatus);
if (IsAutoHidden()) {
// Reset the ISize. The BSize is not changed so that it won't
// affect vertical positioning in unexpected way.
WritingMode lineWM = aReflowState.mLineLayout->GetWritingMode();
WritingMode lineWM = aReflowInput.mLineLayout->GetWritingMode();
aDesiredSize.ISize(lineWM) = 0;
aDesiredSize.SetOverflowAreasToDesiredBounds();
}

Просмотреть файл

@ -39,7 +39,7 @@ public:
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
bool IsAutoHidden() const

Просмотреть файл

@ -91,7 +91,7 @@ NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
void
nsSimplePageSequenceFrame::SetDesiredSize(ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nscoord aWidth,
nscoord aHeight)
{
@ -99,9 +99,9 @@ nsSimplePageSequenceFrame::SetDesiredSize(ReflowOutput& aDesiredSize,
// can act as a background in print preview but also handle overflow
// in child page frames correctly.
// Use availableWidth so we don't cause a needless horizontal scrollbar.
aDesiredSize.Width() = std::max(aReflowState.AvailableWidth(),
aDesiredSize.Width() = std::max(aReflowInput.AvailableWidth(),
nscoord(aWidth * PresContext()->GetPrintPreviewScale()));
aDesiredSize.Height() = std::max(aReflowState.ComputedHeight(),
aDesiredSize.Height() = std::max(aReflowInput.ComputedHeight(),
nscoord(aHeight * PresContext()->GetPrintPreviewScale()));
}
@ -145,14 +145,14 @@ nsSimplePageSequenceFrame::ComputeCenteringMargin(
void
nsSimplePageSequenceFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
NS_PRECONDITION(aPresContext->IsRootPaginatedDocument(),
"A Page Sequence is only for real pages");
DO_GLOBAL_REFLOW_COUNT("nsSimplePageSequenceFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
NS_FRAME_TRACE_REFLOW_IN("nsSimplePageSequenceFrame::Reflow");
aStatus = NS_FRAME_COMPLETE; // we're always complete
@ -161,7 +161,7 @@ nsSimplePageSequenceFrame::Reflow(nsPresContext* aPresContext,
// it right in paginated mode.
if (!(GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
// Return our desired size
SetDesiredSize(aDesiredSize, aReflowState, mSize.width, mSize.height);
SetDesiredSize(aDesiredSize, aReflowInput, mSize.width, mSize.height);
aDesiredSize.SetOverflowAreasToDesiredBounds();
FinishAndStoreOverflow(&aDesiredSize);
@ -171,7 +171,7 @@ nsSimplePageSequenceFrame::Reflow(nsPresContext* aPresContext,
nsIFrame* child = e.get();
nsMargin pageCSSMargin = child->GetUsedMargin();
nscoord centeringMargin =
ComputeCenteringMargin(aReflowState.ComputedWidth(),
ComputeCenteringMargin(aReflowInput.ComputedWidth(),
child->GetRect().width,
pageCSSMargin);
nscoord newX = pageCSSMargin.left + centeringMargin;
@ -242,7 +242,7 @@ nsSimplePageSequenceFrame::Reflow(nsPresContext* aPresContext,
nscoord maxXMost = 0;
// Tile the pages vertically
ReflowOutput kidSize(aReflowState);
ReflowOutput kidSize(aReflowInput);
for (nsFrameList::Enumerator e(mFrames); !e.AtEnd(); e.Next()) {
nsIFrame* kidFrame = e.get();
// Set the shared data into the page frame before reflow
@ -250,25 +250,25 @@ nsSimplePageSequenceFrame::Reflow(nsPresContext* aPresContext,
pf->SetSharedPageData(mPageData);
// Reflow the page
ReflowInput kidReflowState(aPresContext, aReflowState, kidFrame,
ReflowInput kidReflowInput(aPresContext, aReflowInput, kidFrame,
LogicalSize(kidFrame->GetWritingMode(),
pageSize));
nsReflowStatus status;
kidReflowState.SetComputedWidth(kidReflowState.AvailableWidth());
//kidReflowState.SetComputedHeight(kidReflowState.AvailableHeight());
PR_PL(("AV W: %d H: %d\n", kidReflowState.AvailableWidth(), kidReflowState.AvailableHeight()));
kidReflowInput.SetComputedWidth(kidReflowInput.AvailableWidth());
//kidReflowInput.SetComputedHeight(kidReflowInput.AvailableHeight());
PR_PL(("AV W: %d H: %d\n", kidReflowInput.AvailableWidth(), kidReflowInput.AvailableHeight()));
nsMargin pageCSSMargin = kidReflowState.ComputedPhysicalMargin();
nsMargin pageCSSMargin = kidReflowInput.ComputedPhysicalMargin();
y += pageCSSMargin.top;
nscoord x = pageCSSMargin.left;
// Place and size the page.
ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, x, y, 0, status);
ReflowChild(kidFrame, aPresContext, kidSize, kidReflowInput, x, y, 0, status);
// If the page is narrower than our width, then center it horizontally:
x += ComputeCenteringMargin(aReflowState.ComputedWidth(),
x += ComputeCenteringMargin(aReflowInput.ComputedWidth(),
kidSize.Width(), pageCSSMargin);
FinishReflowChild(kidFrame, aPresContext, kidSize, nullptr, x, y, 0);
@ -330,7 +330,7 @@ nsSimplePageSequenceFrame::Reflow(nsPresContext* aPresContext,
// Return our desired size
// Adjust the reflow size by PrintPreviewScale so the scrollbars end up the
// correct size
SetDesiredSize(aDesiredSize, aReflowState, maxXMost, y);
SetDesiredSize(aDesiredSize, aReflowInput, maxXMost, y);
aDesiredSize.SetOverflowAreasToDesiredBounds();
FinishAndStoreOverflow(&aDesiredSize);
@ -341,7 +341,7 @@ nsSimplePageSequenceFrame::Reflow(nsPresContext* aPresContext,
mSize.height = y;
NS_FRAME_TRACE_REFLOW_OUT("nsSimplePageSequeceFrame::Reflow", aStatus);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
//----------------------------------------------------------------------

Просмотреть файл

@ -126,7 +126,7 @@ protected:
// Sets the frame desired size to the size of the viewport, or the given
// nscoords, whichever is larger. Print scaling is applied in this function.
void SetDesiredSize(ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nscoord aWidth, nscoord aHeight);
// Helper function to compute the offset needed to center a child

Просмотреть файл

@ -217,10 +217,10 @@ nsSplittableFrame::GetConsumedBSize() const
}
nscoord
nsSplittableFrame::GetEffectiveComputedBSize(const ReflowInput& aReflowState,
nsSplittableFrame::GetEffectiveComputedBSize(const ReflowInput& aReflowInput,
nscoord aConsumedBSize) const
{
nscoord bSize = aReflowState.ComputedBSize();
nscoord bSize = aReflowInput.ComputedBSize();
if (bSize == NS_INTRINSICSIZE) {
return NS_INTRINSICSIZE;
}
@ -236,7 +236,7 @@ nsSplittableFrame::GetEffectiveComputedBSize(const ReflowInput& aReflowState,
}
nsIFrame::LogicalSides
nsSplittableFrame::GetLogicalSkipSides(const ReflowInput* aReflowState) const
nsSplittableFrame::GetLogicalSkipSides(const ReflowInput* aReflowInput) const
{
if (IS_TRUE_OVERFLOW_CONTAINER(this)) {
return LogicalSides(eLogicalSideBitsBBoth);
@ -252,16 +252,16 @@ nsSplittableFrame::GetLogicalSkipSides(const ReflowInput* aReflowState) const
skip |= eLogicalSideBitsBStart;
}
if (aReflowState) {
if (aReflowInput) {
// We're in the midst of reflow right now, so it's possible that we haven't
// created a nif yet. If our content height is going to exceed our available
// height, though, then we're going to need a next-in-flow, it just hasn't
// been created yet.
if (NS_UNCONSTRAINEDSIZE != aReflowState->AvailableBSize()) {
nscoord effectiveCH = this->GetEffectiveComputedBSize(*aReflowState);
if (NS_UNCONSTRAINEDSIZE != aReflowInput->AvailableBSize()) {
nscoord effectiveCH = this->GetEffectiveComputedBSize(*aReflowInput);
if (effectiveCH != NS_INTRINSICSIZE &&
effectiveCH > aReflowState->AvailableBSize()) {
effectiveCH > aReflowInput->AvailableBSize()) {
// Our content height is going to exceed our available height, so we're
// going to need a next-in-flow.
skip |= eLogicalSideBitsBEnd;

Просмотреть файл

@ -89,13 +89,13 @@ protected:
* Retrieve the effective computed block size of this frame, which is the
* computed block size, minus the block size consumed by any previous in-flows.
*/
nscoord GetEffectiveComputedBSize(const ReflowInput& aReflowState,
nscoord GetEffectiveComputedBSize(const ReflowInput& aReflowInput,
nscoord aConsumed = NS_INTRINSICSIZE) const;
/**
* @see nsIFrame::GetLogicalSkipSides()
*/
virtual LogicalSides GetLogicalSkipSides(const ReflowInput* aReflowState = nullptr) const override;
virtual LogicalSides GetLogicalSkipSides(const ReflowInput* aReflowInput = nullptr) const override;
/**
* A faster version of GetLogicalSkipSides() that is intended to be used

Просмотреть файл

@ -760,20 +760,20 @@ nsSubDocumentFrame::ComputeSize(nsRenderingContext *aRenderingContext,
void
nsSubDocumentFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsSubDocumentFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("enter nsSubDocumentFrame::Reflow: maxSize=%d,%d",
aReflowState.AvailableWidth(), aReflowState.AvailableHeight()));
aReflowInput.AvailableWidth(), aReflowInput.AvailableHeight()));
NS_ASSERTION(aReflowState.ComputedWidth() != NS_UNCONSTRAINEDSIZE,
NS_ASSERTION(aReflowInput.ComputedWidth() != NS_UNCONSTRAINEDSIZE,
"Shouldn't have unconstrained stuff here "
"thanks to the rules of reflow");
NS_ASSERTION(NS_INTRINSICSIZE != aReflowState.ComputedHeight(),
NS_ASSERTION(NS_INTRINSICSIZE != aReflowInput.ComputedHeight(),
"Shouldn't have unconstrained stuff here "
"thanks to ComputeAutoSize");
@ -783,16 +783,16 @@ nsSubDocumentFrame::Reflow(nsPresContext* aPresContext,
"Shouldn't happen");
// XUL <iframe> or <browser>, or HTML <iframe>, <object> or <embed>
aDesiredSize.SetSize(aReflowState.GetWritingMode(),
aReflowState.ComputedSizeWithBorderPadding());
aDesiredSize.SetSize(aReflowInput.GetWritingMode(),
aReflowInput.ComputedSizeWithBorderPadding());
// "offset" is the offset of our content area from our frame's
// top-left corner.
nsPoint offset = nsPoint(aReflowState.ComputedPhysicalBorderPadding().left,
aReflowState.ComputedPhysicalBorderPadding().top);
nsPoint offset = nsPoint(aReflowInput.ComputedPhysicalBorderPadding().left,
aReflowInput.ComputedPhysicalBorderPadding().top);
if (mInnerView) {
const nsMargin& bp = aReflowState.ComputedPhysicalBorderPadding();
const nsMargin& bp = aReflowInput.ComputedPhysicalBorderPadding();
nsSize innerSize(aDesiredSize.Width() - bp.LeftRight(),
aDesiredSize.Height() - bp.TopBottom());
@ -833,7 +833,7 @@ nsSubDocumentFrame::Reflow(nsPresContext* aPresContext,
("exit nsSubDocumentFrame::Reflow: size=%d,%d status=%x",
aDesiredSize.Width(), aDesiredSize.Height(), aStatus));
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
bool

Просмотреть файл

@ -75,7 +75,7 @@ public:
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,

Просмотреть файл

@ -8650,26 +8650,26 @@ struct NewlineProperty {
void
nsTextFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aMetrics,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsTextFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aMetrics, aStatus);
// XXX If there's no line layout, we shouldn't even have created this
// frame. This may happen if, for example, this is text inside a table
// but not inside a cell. For now, just don't reflow.
if (!aReflowState.mLineLayout) {
if (!aReflowInput.mLineLayout) {
ClearMetrics(aMetrics);
aStatus = NS_FRAME_COMPLETE;
return;
}
ReflowText(*aReflowState.mLineLayout, aReflowState.AvailableWidth(),
aReflowState.mRenderingContext->GetDrawTarget(), aMetrics, aStatus);
ReflowText(*aReflowInput.mLineLayout, aReflowInput.AvailableWidth(),
aReflowInput.mRenderingContext->GetDrawTarget(), aMetrics, aStatus);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aMetrics);
}
#ifdef ACCESSIBILITY

Просмотреть файл

@ -248,7 +248,7 @@ public:
nscoord* aXMost) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aMetrics,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual bool CanContinueTextRun() const override;
// Method that is called for a text frame that is logically

Просмотреть файл

@ -283,25 +283,25 @@ public:
void
nsVideoFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aMetrics,
const ReflowInput& aReflowState,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsVideoFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aMetrics, aStatus);
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("enter nsVideoFrame::Reflow: availSize=%d,%d",
aReflowState.AvailableWidth(), aReflowState.AvailableHeight()));
aReflowInput.AvailableWidth(), aReflowInput.AvailableHeight()));
NS_PRECONDITION(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow");
aStatus = NS_FRAME_COMPLETE;
aMetrics.Width() = aReflowState.ComputedWidth();
aMetrics.Height() = aReflowState.ComputedHeight();
aMetrics.Width() = aReflowInput.ComputedWidth();
aMetrics.Height() = aReflowInput.ComputedHeight();
// stash this away so we can compute our inner area later
mBorderPadding = aReflowState.ComputedPhysicalBorderPadding();
mBorderPadding = aReflowInput.ComputedPhysicalBorderPadding();
aMetrics.Width() += mBorderPadding.left + mBorderPadding.right;
aMetrics.Height() += mBorderPadding.top + mBorderPadding.bottom;
@ -312,13 +312,13 @@ nsVideoFrame::Reflow(nsPresContext* aPresContext,
if (child->GetContent() == mPosterImage) {
// Reflow the poster frame.
nsImageFrame* imageFrame = static_cast<nsImageFrame*>(child);
ReflowOutput kidDesiredSize(aReflowState);
ReflowOutput kidDesiredSize(aReflowInput);
WritingMode wm = imageFrame->GetWritingMode();
LogicalSize availableSize = aReflowState.AvailableSize(wm);
LogicalSize availableSize = aReflowInput.AvailableSize(wm);
LogicalSize cbSize = aMetrics.Size(aMetrics.GetWritingMode()).
ConvertTo(wm, aMetrics.GetWritingMode());
ReflowInput kidReflowState(aPresContext,
aReflowState,
ReflowInput kidReflowInput(aPresContext,
aReflowInput,
imageFrame,
availableSize,
&cbSize);
@ -327,53 +327,53 @@ nsVideoFrame::Reflow(nsPresContext* aPresContext,
if (ShouldDisplayPoster()) {
posterRenderRect =
nsRect(nsPoint(mBorderPadding.left, mBorderPadding.top),
nsSize(aReflowState.ComputedWidth(),
aReflowState.ComputedHeight()));
nsSize(aReflowInput.ComputedWidth(),
aReflowInput.ComputedHeight()));
}
kidReflowState.SetComputedWidth(posterRenderRect.width);
kidReflowState.SetComputedHeight(posterRenderRect.height);
ReflowChild(imageFrame, aPresContext, kidDesiredSize, kidReflowState,
kidReflowInput.SetComputedWidth(posterRenderRect.width);
kidReflowInput.SetComputedHeight(posterRenderRect.height);
ReflowChild(imageFrame, aPresContext, kidDesiredSize, kidReflowInput,
posterRenderRect.x, posterRenderRect.y, 0, aStatus);
FinishReflowChild(imageFrame, aPresContext,
kidDesiredSize, &kidReflowState,
kidDesiredSize, &kidReflowInput,
posterRenderRect.x, posterRenderRect.y, 0);
} else if (child->GetContent() == mVideoControls) {
// Reflow the video controls frame.
nsBoxLayoutState boxState(PresContext(), aReflowState.mRenderingContext);
nsBoxLayoutState boxState(PresContext(), aReflowInput.mRenderingContext);
nsSize size = child->GetSize();
nsBoxFrame::LayoutChildAt(boxState,
child,
nsRect(mBorderPadding.left,
mBorderPadding.top,
aReflowState.ComputedWidth(),
aReflowState.ComputedHeight()));
aReflowInput.ComputedWidth(),
aReflowInput.ComputedHeight()));
if (child->GetSize() != size) {
RefPtr<Runnable> event = new DispatchResizeToControls(child->GetContent());
nsContentUtils::AddScriptRunner(event);
}
} else if (child->GetContent() == mCaptionDiv) {
// Reflow to caption div
ReflowOutput kidDesiredSize(aReflowState);
ReflowOutput kidDesiredSize(aReflowInput);
WritingMode wm = child->GetWritingMode();
LogicalSize availableSize = aReflowState.AvailableSize(wm);
LogicalSize availableSize = aReflowInput.AvailableSize(wm);
LogicalSize cbSize = aMetrics.Size(aMetrics.GetWritingMode()).
ConvertTo(wm, aMetrics.GetWritingMode());
ReflowInput kidReflowState(aPresContext,
aReflowState,
ReflowInput kidReflowInput(aPresContext,
aReflowInput,
child,
availableSize,
&cbSize);
nsSize size(aReflowState.ComputedWidth(), aReflowState.ComputedHeight());
size.width -= kidReflowState.ComputedPhysicalBorderPadding().LeftRight();
size.height -= kidReflowState.ComputedPhysicalBorderPadding().TopBottom();
nsSize size(aReflowInput.ComputedWidth(), aReflowInput.ComputedHeight());
size.width -= kidReflowInput.ComputedPhysicalBorderPadding().LeftRight();
size.height -= kidReflowInput.ComputedPhysicalBorderPadding().TopBottom();
kidReflowState.SetComputedWidth(std::max(size.width, 0));
kidReflowState.SetComputedHeight(std::max(size.height, 0));
kidReflowInput.SetComputedWidth(std::max(size.width, 0));
kidReflowInput.SetComputedHeight(std::max(size.height, 0));
ReflowChild(child, aPresContext, kidDesiredSize, kidReflowState,
ReflowChild(child, aPresContext, kidDesiredSize, kidReflowInput,
mBorderPadding.left, mBorderPadding.top, 0, aStatus);
FinishReflowChild(child, aPresContext,
kidDesiredSize, &kidReflowState,
kidDesiredSize, &kidReflowInput,
mBorderPadding.left, mBorderPadding.top, 0);
}
}
@ -384,7 +384,7 @@ nsVideoFrame::Reflow(nsPresContext* aPresContext,
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("exit nsVideoFrame::Reflow: size=%d,%d",
aMetrics.Width(), aMetrics.Height()));
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aMetrics);
}
class nsDisplayVideo : public nsDisplayItem {

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше