--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -484,98 +484,98 @@ RestyleManager::RecomputePosition(nsIFra
// Construct a bogus parent reflow state so that there's a usable
// containing block reflow state.
nsIFrame* parentFrame = aFrame->GetParent();
WritingMode parentWM = parentFrame->GetWritingMode();
WritingMode frameWM = aFrame->GetWritingMode();
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);
-
- parentReflowState.ComputedPhysicalPadding() = parentFrame->GetUsedPadding();
- parentReflowState.ComputedPhysicalBorderPadding() =
+ parentReflowInput.SetComputedISize(std::max(parentSize.ISize(parentWM), 0));
+ parentReflowInput.SetComputedBSize(std::max(parentSize.BSize(parentWM), 0));
+ parentReflowInput.ComputedPhysicalMargin().SizeTo(0, 0, 0, 0);
+
+ 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
// and non-auto. If computedSize.height == NS_INTRINSICSIZE then the new
// element height will be its intrinsic height, and since 'top' and 'bottom''s
// auto-ness hasn't changed, the old height must also be its intrinsic
// height, which we can assume hasn't changed (or reflow would have
// been triggered).
if (computedSize.width == size.width &&
(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;
}
// Fall back to a reflow
StyleChangeReflow(aFrame, nsChangeHint_NeedReflow);
return false;
--- a/layout/base/nsIPercentBSizeObserver.h
+++ b/layout/base/nsIPercentBSizeObserver.h
@@ -17,17 +17,17 @@ struct ReflowInput;
* values to children during reflow which would otherwise not happen. Currently
* only table cells support this.
*/
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___
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -9540,66 +9540,66 @@ PresShell::DoReflow(nsIFrame* target, bo
}
NS_ASSERTION(!target->GetNextInFlow() && !target->GetPrevInFlow(),
"reflow roots should never split");
// 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
// nsDocumentViewer::SizeToContent), we're effectively doing a
// resize in the block direction, since it changes the meaning of
// percentage block-sizes even if no block-sizes actually changed.
// The same applies when we reflow again after that computation. This is
// an unusual case, and isn't caught by ReflowInput::InitResizeFlags.
bool hasUnconstrainedBSize = size.BSize(wm) == NS_UNCONSTRAINEDSIZE;
if (hasUnconstrainedBSize || mLastRootReflowHadUnconstrainedBSize) {
- reflowState.SetBResize(true);
+ reflowInput.SetBResize(true);
}
mLastRootReflowHadUnconstrainedBSize = hasUnconstrainedBSize;
} else {
// Initialize reflow state with current used border and padding,
// in case this was set specially by the parent frame when the reflow root
// was reflowed by its parent.
nsMargin currentBorder = target->GetUsedBorder();
nsMargin currentPadding = target->GetUsedPadding();
- reflowState.Init(mPresContext, nullptr, ¤tBorder, ¤tPadding);
+ reflowInput.Init(mPresContext, nullptr, ¤tBorder, ¤tPadding);
}
// 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);
- }
- NS_ASSERTION(reflowState.ComputedISize() ==
+ reflowInput.SetComputedBSize(computedBSize);
+ }
+ 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
// initiated at the root, then the size better not change unless its
// height was unconstrained to start with.
nsRect boundsRelativeToTarget = nsRect(0, 0, desiredSize.Width(), desiredSize.Height());
NS_ASSERTION((target == rootFrame &&
size.BSize(wm) == NS_UNCONSTRAINEDSIZE) ||
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -413,43 +413,43 @@ public:
return NS_OK;
}
nsWeakFrame mFrame;
};
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;
}
// XXXbz this will, for small-block-size dropdowns, have extra space
// 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
if (!mDroppedDown && GetStateBits() & NS_FRAME_FIRST_REFLOW) {
nsView* view = mDropdownFrame->GetView();
nsViewManager* viewManager = view->GetViewManager();
viewManager->SetViewVisibility(view, nsViewVisibility_kHide);
nsRect emptyRect(0, 0, 0, 0);
@@ -465,24 +465,24 @@ nsComboboxControlFrame::ReflowDropdown(n
//XXX Can this be different from the dropdown's writing mode?
// That would be odd!
// Note that we don't need to pass the true frame position or container size
// to ReflowChild or FinishReflowChild here; it will be positioned as needed
// 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);
}
nsPoint
nsComboboxControlFrame::GetCSSTransformTranslation()
{
nsIFrame* frame = this;
bool is3DTransform = false;
@@ -804,17 +804,17 @@ nsComboboxControlFrame::GetPrefISize(nsR
DISPLAY_PREF_WIDTH(this, prefISize);
prefISize = GetIntrinsicISize(aRenderingContext, nsLayoutUtils::PREF_ISIZE);
return prefISize;
}
void
nsComboboxControlFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
// Constraints we try to satisfy:
// 1) Default inline size of button is the vertical scrollbar size
// 2) If the inline size of button is bigger than our inline size, set
// inline size of button to 0.
@@ -843,57 +843,57 @@ nsComboboxControlFrame::Reflow(nsPresCon
if (selectedIndex != -1) {
mListControlFrame->GetOptionText(selectedIndex, selectedOptionText);
}
if (mDisplayedOptionText != selectedOptionText) {
RedisplayText(selectedIndex);
}
// 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))) {
// The reflow callback queue doesn't AddRef so we keep it alive until
// it's released in its ReflowFinished / ReflowCallbackCanceled.
Unused << resize.forget();
}
// 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()) ||
StyleDisplay()->mAppearance == NS_THEME_NONE) {
buttonISize = 0;
}
else {
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);
buttonRect.BSize(wm) = mDisplayFrame->BSize(wm) +
this->GetLogicalUsedPadding(wm).BStartEnd(wm);
mButtonFrame->SetRect(buttonRect, containerSize);
@@ -1282,17 +1282,17 @@ public:
virtual bool IsFrameOfType(uint32_t aFlags) const override
{
return nsBlockFrame::IsFrameOfType(aFlags &
~(nsIFrame::eReplacedContainsBlock));
}
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
protected:
nsComboboxControlFrame* mComboBox;
@@ -1304,27 +1304,27 @@ nsIAtom*
nsComboboxDisplayFrame::GetType() const
{
return nsGkAtoms::comboboxDisplayFrame;
}
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) {
computedISize = 0;
}
state.SetComputedISize(computedISize);
nsBlockFrame::Reflow(aPresContext, aDesiredSize, state, aStatus);
aStatus = NS_FRAME_COMPLETE; // this type of frame can't be split
--- a/layout/forms/nsComboboxControlFrame.h
+++ b/layout/forms/nsComboboxControlFrame.h
@@ -76,17 +76,17 @@ public:
#endif
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
virtual void Reflow(nsPresContext* aCX,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsresult HandleEvent(nsPresContext* aPresContext,
mozilla::WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus) override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
@@ -212,17 +212,17 @@ public:
protected:
friend class RedisplayTextEvent;
friend class nsAsyncResize;
friend class nsResizeDropdownAtFinalPosition;
// Utilities
void ReflowDropdown(nsPresContext* aPresContext,
- const ReflowInput& aReflowState);
+ const ReflowInput& aReflowInput);
enum DropDownPositionState {
// can't show the dropdown at its current position
eDropDownPositionSuppressed,
// a resize reflow is pending, don't show it yet
eDropDownPositionPendingResize,
// the dropdown has its final size and position and can be displayed here
eDropDownPositionFinal
--- a/layout/forms/nsFieldSetFrame.cpp
+++ b/layout/forms/nsFieldSetFrame.cpp
@@ -379,93 +379,93 @@ nsFieldSetFrame::ComputeSize(nsRendering
}
return result;
}
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
aStatus = NS_FRAME_COMPLETE;
nsOverflowAreas ocBounds;
nsReflowStatus ocStatus = NS_FRAME_COMPLETE;
if (GetPrevInFlow()) {
- ReflowOverflowContainerChildren(aPresContext, aReflowState, ocBounds, 0,
+ ReflowOverflowContainerChildren(aPresContext, aReflowInput, ocBounds, 0,
ocStatus);
}
//------------ Handle Incremental Reflow -----------------
bool reflowInner;
bool reflowLegend;
nsIFrame* legend = GetLegend();
nsIFrame* inner = GetInner();
- if (aReflowState.ShouldReflowAllKids()) {
+ if (aReflowInput.ShouldReflowAllKids()) {
reflowInner = inner != nullptr;
reflowLegend = legend != nullptr;
} else {
reflowInner = inner && NS_SUBTREE_DIRTY(inner);
reflowLegend = legend && NS_SUBTREE_DIRTY(legend);
}
// We don't allow fieldsets to break vertically. If we did, we'd
// need logic here to push and pull overflow frames.
// Since we're not applying our padding in this frame, we need to add it here
// to compute the available width for our children.
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
printf(" returned (%d, %d)\n",
legendDesiredSize.Width(), legendDesiredSize.Height());
#endif
// figure out the legend's rectangle
legendMargin = legend->GetLogicalUsedMargin(wm);
@@ -485,102 +485,102 @@ nsFieldSetFrame::Reflow(nsPresContext*
// if the legend space changes then we need to reflow the
// content area as well.
if (mLegendSpace != oldSpace && inner) {
reflowInner = true;
}
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();
mLegendSpace = 0;
} else {
// mLegendSpace and mLegendRect haven't changed, but we need
// the used margin when placing the legend.
legendMargin = legend->GetLogicalUsedMargin(wm);
}
// This containerSize is incomplete as yet: it does not include the size
// of the |inner| frame itself.
nsSize containerSize = (LogicalSize(wm, 0, mLegendSpace) +
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);
// We don't know the correct containerSize until we have reflowed |inner|,
// 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
// in containerSize.
containerSize += inner->GetSize();
}
LogicalRect contentRect(wm);
if (inner) {
// We don't support margins on inner, so our content rect is just the
// inner's border-box. (We don't really care about container size at this
// point, as we'll figure out the actual positioning later.)
contentRect = inner->GetLogicalRect(wm, containerSize);
}
// 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);
}
if (legend) {
// 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)) {
// NOTE legend @align values are: left/right/center/top/bottom.
// GetLogicalAlign converts left/right to start/end for the given WM.
// @see HTMLLegendElement::ParseAttribute, nsLegendFrame::GetLogicalAlign
int32_t align = static_cast<nsLegendFrame*>
(legend->GetContentInsertionFrame())->GetLogicalAlign(wm);
@@ -602,29 +602,29 @@ nsFieldSetFrame::Reflow(nsPresContext*
default:
MOZ_ASSERT_UNREACHABLE("unexpected GetLogicalAlign value");
}
} else {
// otherwise make place for the legend
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
LogicalRect actualLegendRect = mLegendRect;
actualLegendRect.Deflate(wm, legendMargin);
LogicalPoint actualLegendPos(actualLegendRect.Origin(wm));
// 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);
legend->SetPosition(wm, actualLegendPos, containerSize);
nsContainerFrame::PositionFrameView(legend);
nsContainerFrame::PositionChildViews(legend);
}
@@ -642,21 +642,21 @@ nsFieldSetFrame::Reflow(nsPresContext*
if (inner) {
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, inner);
}
// Merge overflow container bounds and status.
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
void
nsFieldSetFrame::SetInitialChildList(ChildListID aListID,
nsFrameList& aChildList)
{
nsContainerFrame::SetInitialChildList(aListID, aChildList);
--- a/layout/forms/nsFieldSetFrame.h
+++ b/layout/forms/nsFieldSetFrame.h
@@ -38,17 +38,17 @@ public:
/**
* The area to paint box-shadows around. It's the border rect except
* when there's a <legend> we offset the y-position to the center of it.
*/
virtual nsRect VisualBorderRectRelativeToSelf() const override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
DrawResult PaintBorder(nsDisplayListBuilder* aBuilder,
nsRenderingContext& aRenderingContext,
--- a/layout/forms/nsFormControlFrame.cpp
+++ b/layout/forms/nsFormControlFrame.cpp
@@ -110,44 +110,44 @@ nsFormControlFrame::GetLogicalBaseline(W
? GetLogicalUsedBorderAndPadding(aWritingMode).BStart(aWritingMode)
: BSize(aWritingMode) -
GetLogicalUsedBorderAndPadding(aWritingMode).BEnd(aWritingMode);
}
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);
aDesiredSize.Width() *= inflation;
aDesiredSize.Height() *= inflation;
}
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);
}
nsresult
nsFormControlFrame::RegUnRegAccessKey(nsIFrame * aFrame, bool aDoReg)
{
--- a/layout/forms/nsFormControlFrame.h
+++ b/layout/forms/nsFormControlFrame.h
@@ -78,17 +78,17 @@ public:
const override;
/**
* Respond to the request to resize and/or reflow
* @see nsIFrame::Reflow
*/
virtual void Reflow(nsPresContext* aCX,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
// new behavior
virtual void SetFocus(bool aOn = true, bool aRepaint = false) override;
--- a/layout/forms/nsHTMLButtonControlFrame.cpp
+++ b/layout/forms/nsHTMLButtonControlFrame.cpp
@@ -180,24 +180,24 @@ nsHTMLButtonControlFrame::GetPrefISize(n
: mRenderer.GetAddedButtonBorderAndPadding().LeftRight();
return result;
}
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) {
nsFormControlFrame::RegUnRegAccessKey(static_cast<nsIFrame*>(this), true);
}
// Reflow the child
nsIFrame* firstKid = mFrames.FirstChild();
@@ -205,174 +205,174 @@ nsHTMLButtonControlFrame::Reflow(nsPresC
MOZ_ASSERT(firstKid, "Button should have a child frame for its contents");
MOZ_ASSERT(!firstKid->GetNextSibling(),
"Button should have exactly one child frame");
MOZ_ASSERT(firstKid->StyleContext()->GetPseudo() ==
nsCSSAnonBoxes::buttonContent,
"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);
}
// else, we ignore child overflow -- anything that overflows beyond our
// own border-box will get clipped when painting.
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
// ComputedWidth and ComputedHeight reduced by the amount of renderer-specific
// focus border and padding that we're using. (This lets us provide a more
// 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);
return clone;
}
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,
// which occupies part of the button's content-box area:
LogicalMargin focusPadding =
LogicalMargin(wm, mRenderer.GetAddedButtonBorderAndPadding());
// See whether out availSize's inline-size is big enough. If it's
// smaller than our intrinsic min iSize, that means that the kid
// wouldn't really fit. In that case, we overflow into our internal
// 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));
if (focusPaddingReduction > 0) {
nscoord startReduction = focusPadding.IStart(wm);
if (focusPaddingReduction != IFocusPadding) {
startReduction = NSToCoordRound(startReduction *
(float(focusPaddingReduction) /
float(IFocusPadding)));
}
focusPadding.IStart(wm) -= startReduction;
focusPadding.IEnd(wm) -= focusPaddingReduction - startReduction;
}
// 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.
availSize.ISize(wm) -= focusPadding.IStartEnd(wm);
LogicalPoint childPos(wm);
childPos.I(wm) = focusPadding.IStart(wm) + clbp.IStart(wm);
availSize.ISize(wm) = std::max(availSize.ISize(wm), 0);
// 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.
// We just pass a dummy containerSize here, as the child will be
// 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, "
"so it should be complete");
// 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:
buttonContentBox.BSize(wm) =
contentsDesiredSize.BSize(wm) + focusPadding.BStartEnd(wm);
// 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
// (technically, inside of the button's focus-padding area)
nscoord extraSpace =
buttonContentBox.BSize(wm) - focusPadding.BStartEnd(wm) -
contentsDesiredSize.BSize(wm);
@@ -382,31 +382,31 @@ nsHTMLButtonControlFrame::ReflowButtonCo
// its focus-padding rect:
childPos.B(wm) += focusPadding.BStart(wm) + clbp.BStart(wm);
nsSize containerSize =
(buttonContentBox + clbp.Size(wm)).GetPhysicalSize(wm);
// 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));
}
// OK, we're done with the child frame.
// 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
// within our frame... unless it's orthogonal, in which case we'll use the
// contents inline-size as an approximation for now.
// XXX is there a better strategy? should we include border-padding?
if (aButtonDesiredSize.GetWritingMode().IsOrthogonalTo(wm)) {
aButtonDesiredSize.SetBlockStartAscent(contentsDesiredSize.ISize(wm));
--- a/layout/forms/nsHTMLButtonControlFrame.h
+++ b/layout/forms/nsHTMLButtonControlFrame.h
@@ -31,17 +31,17 @@ public:
const nsDisplayListSet& aLists) override;
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsresult HandleEvent(nsPresContext* aPresContext,
mozilla::WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus) override;
virtual void Init(nsIContent* aContent,
nsContainerFrame* aParent,
@@ -97,17 +97,17 @@ protected:
// border-box (either because of "overflow" or because of legacy reasons
// about how <input>-flavored buttons work).
bool ShouldClipPaintingToBorderBox();
// Reflows the button's sole child frame, and computes the desired size
// of the button itself from the results.
void ReflowButtonContents(nsPresContext* aPresContext,
ReflowOutput& aButtonDesiredSize,
- const ReflowInput& aButtonReflowState,
+ const ReflowInput& aButtonReflowInput,
nsIFrame* aFirstKid);
nsButtonFrameRenderer mRenderer;
};
#endif
--- a/layout/forms/nsImageControlFrame.cpp
+++ b/layout/forms/nsImageControlFrame.cpp
@@ -27,17 +27,17 @@ public:
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsresult HandleEvent(nsPresContext* aPresContext,
WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus) override;
virtual nsIAtom* GetType() const override;
@@ -122,25 +122,25 @@ nsIAtom*
nsImageControlFrame::GetType() const
{
return nsGkAtoms::imageControlFrame;
}
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
nsImageControlFrame::HandleEvent(nsPresContext* aPresContext,
WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus)
{
NS_ENSURE_ARG_POINTER(aEventStatus);
--- a/layout/forms/nsLegendFrame.cpp
+++ b/layout/forms/nsLegendFrame.cpp
@@ -45,25 +45,25 @@ nsLegendFrame::DestroyFrom(nsIFrame* aDe
NS_QUERYFRAME_HEAD(nsLegendFrame)
NS_QUERYFRAME_ENTRY(nsLegendFrame)
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
nsLegendFrame::GetLogicalAlign(WritingMode aCBWM)
{
int32_t intValue = NS_STYLE_TEXT_ALIGN_START;
nsGenericHTMLElement* content = nsGenericHTMLElement::FromContent(mContent);
if (content) {
--- a/layout/forms/nsLegendFrame.h
+++ b/layout/forms/nsLegendFrame.h
@@ -14,17 +14,17 @@ public:
NS_DECL_QUERYFRAME_TARGET(nsLegendFrame)
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS
explicit nsLegendFrame(nsStyleContext* aContext) : nsBlockFrame(aContext) {}
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
virtual nsIAtom* GetType() const override;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -351,20 +351,20 @@ nsListControlFrame::GetMinISize(nsRender
result += scrollbarSize.IStartEnd(wm);
return result;
}
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();
mHasPendingInterruptAtStartOfReflow = aPresContext->HasPendingInterrupt();
// If all the content and frames are here
// then initialize it before reflow
@@ -377,17 +377,17 @@ nsListControlFrame::Reflow(nsPresContext
}
}
if (GetStateBits() & NS_FRAME_FIRST_REFLOW) {
nsFormControlFrame::RegUnRegAccessKey(this, true);
}
if (IsInDropDownMode()) {
- ReflowAsDropdown(aPresContext, aDesiredSize, aReflowState, aStatus);
+ ReflowAsDropdown(aPresContext, aDesiredSize, aReflowInput, aStatus);
return;
}
MarkInReflow();
/*
* Due to the fact that our intrinsic block size depends on the block
* sizes of our kids, we end up having to do two-pass reflow, in
* general -- the first pass to find the intrinsic block size and a
@@ -404,22 +404,22 @@ nsListControlFrame::Reflow(nsPresContext
* - We're not dirty and have no dirty kids and shouldn't be reflowing
* all kids. In this case, our cached max block size of a child is
* not going to change.
* - We do our first reflow using our cached max block size of a
* child, then compute the new max block size and it's the same as
* 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();
if (!(GetStateBits() & NS_FRAME_FIRST_REFLOW) && autoBSize) {
// When not doing an initial reflow, and when the block size is
// auto, start off with our computed block size set to what we'd
// expect our block size to be.
@@ -489,33 +489,33 @@ nsListControlFrame::Reflow(nsPresContext
// mComputedPadding.top to it (and subtract it from descent). Need that
// because nsGfxScrollFrame just adds in the border....
nsHTMLScrollFrame::Reflow(aPresContext, aDesiredSize, state, aStatus);
}
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
// auto, start off with our computed block size set to what we'd
// expect our block size to be.
// Note: At this point, mLastDropdownComputedBSize can be
// NS_UNCONSTRAINEDSIZE in cases when last time we didn't have to
// constrain the block size. That's fine; just do the same thing as
@@ -578,17 +578,17 @@ nsListControlFrame::ReflowAsDropdown(nsP
LogicalPoint translation(wm);
nscoord before, after;
combobox->GetAvailableDropdownSpace(wm, &before, &after, &translation);
if (before <= 0 && after <= 0) {
state.SetComputedBSize(blockSizeOfARow);
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;
if (visibleBSize <= availableBSize) {
// The dropdown fits in the available block size.
rows = GetNumberOfRows();
mNumDisplayRows = clamped<uint32_t>(rows, 1, kMaxDropDownRows);
if (mNumDisplayRows == rows) {
@@ -1489,23 +1489,23 @@ nsListControlFrame::AboutToRollup()
if (IsInDropDownMode()) {
ComboboxFinish(mComboboxFrame->GetIndexOfDisplayArea()); // might destroy us
}
}
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;
// Suppress scrolling to the selected element if we restored
// scroll history state AND the list contents have not changed
// since we loaded all the children AND nothing else forced us
// to scroll by calling ResetList(true). The latter two conditions
// are folded into mPostChildrenLoadedReset.
--- a/layout/forms/nsListControlFrame.h
+++ b/layout/forms/nsListControlFrame.h
@@ -63,25 +63,25 @@ public:
virtual void SetInitialChildList(ChildListID aListID,
nsFrameList& aChildList) override;
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
virtual void Reflow(nsPresContext* aCX,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual void Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;
virtual void DidReflow(nsPresContext* aPresContext,
- const ReflowInput* aReflowState,
+ const ReflowInput* aReflowInput,
nsDidReflowStatus aStatus) override;
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
virtual nsContainerFrame* GetContentInsertionFrame() override;
@@ -341,17 +341,17 @@ protected:
/**
* Method to reflow ourselves as a dropdown list. This differs from
* reflow as a listbox because the criteria for needing a second
* pass are different. This will be called from Reflow() as needed.
*/
void ReflowAsDropdown(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus);
// Selection
bool SetOptionsSelectedFromFrame(int32_t aStartIndex,
int32_t aEndIndex,
bool aValue,
bool aClearAll);
bool ToggleOptionSelectedFromFrame(int32_t aIndex);
--- a/layout/forms/nsMeterFrame.cpp
+++ b/layout/forms/nsMeterFrame.cpp
@@ -100,105 +100,105 @@ NS_QUERYFRAME_HEAD(nsMeterFrame)
NS_QUERYFRAME_ENTRY(nsMeterFrame)
NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator)
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(),
"nsMeterFrame should not have continuations; if it does we "
"need to call RegUnregAccessKey only for the first.");
if (mState & NS_FRAME_FIRST_REFLOW) {
nsFormControlFrame::RegUnRegAccessKey(this, true);
}
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);
FinishAndStoreOverflow(&aDesiredSize);
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);
double max = meterElement->Max();
double min = meterElement->Min();
double value = meterElement->Value();
double position = max - min;
position = position != 0 ? (value - min) / position : 1;
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);
}
nsresult
nsMeterFrame::AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
{
--- a/layout/forms/nsMeterFrame.h
+++ b/layout/forms/nsMeterFrame.h
@@ -25,17 +25,17 @@ public:
explicit nsMeterFrame(nsStyleContext* aContext);
virtual ~nsMeterFrame();
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
virtual void Reflow(nsPresContext* aCX,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsIAtom* GetType() const override;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override {
return MakeFrameName(NS_LITERAL_STRING("Meter"), aResult);
}
@@ -77,17 +77,17 @@ public:
bool ShouldUseNativeStyle() const;
virtual Element* GetPseudoElement(mozilla::CSSPseudoElementType aType) override;
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.
* @see nsMeterFrame::CreateAnonymousContent
*/
nsCOMPtr<Element> mBarDiv;
};
--- a/layout/forms/nsNumberControlFrame.cpp
+++ b/layout/forms/nsNumberControlFrame.cpp
@@ -101,156 +101,156 @@ nsNumberControlFrame::GetPrefISize(nsRen
}
return result;
}
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!");
NS_ASSERTION(!GetPrevContinuation() && !GetNextContinuation(),
"nsNumberControlFrame should not have continuations; if it does we "
"need to call RegUnregAccessKey only for the first");
NS_ASSERTION(!mFrames.FirstChild() ||
!mFrames.FirstChild()->GetNextSibling(),
"We expect at most one direct child frame");
if (mState & NS_FRAME_FIRST_REFLOW) {
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();
if (!outerWrapperFrame) { // display:none?
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;
// We initially reflow the child with a dummy containerSize; positioning
// 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, "
"so it should be complete");
nscoord wrappersMarginBoxBSize =
wrappersDesiredSize.BSize(myWM) + wrapperMargin.BStartEnd(myWM);
if (contentBoxBSize == NS_INTRINSICSIZE) {
// We are intrinsically sized -- we should shrinkwrap the outer wrapper's
// block-size:
contentBoxBSize = wrappersMarginBoxBSize;
// 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
nscoord extraSpace = contentBoxBSize - wrappersMarginBoxBSize;
wrapperOffset.B(myWM) += std::max(0, extraSpace / 2);
// Needed in FinishReflowChild, for logical-to-physical conversion:
nsSize borderBoxSize = LogicalSize(myWM, borderBoxISize, borderBoxBSize).
GetPhysicalSize(myWM);
// Place the child
FinishReflowChild(outerWrapperFrame, aPresContext, wrappersDesiredSize,
- &wrapperReflowState, myWM, wrapperOffset,
+ &wrapperReflowInput, myWM, wrapperOffset,
borderBoxSize, 0);
nsSize contentBoxSize =
LogicalSize(myWM, contentBoxISize, contentBoxBSize).
GetPhysicalSize(myWM);
aDesiredSize.SetBlockStartAscent(
wrappersDesiredSize.BlockStartAscent() +
- outerWrapperFrame->BStart(aReflowState.GetWritingMode(),
+ outerWrapperFrame->BStart(aReflowInput.GetWritingMode(),
contentBoxSize));
}
LogicalSize logicalDesiredSize(myWM, borderBoxISize, borderBoxBSize);
aDesiredSize.SetSize(myWM, logicalDesiredSize);
aDesiredSize.SetOverflowAreasToDesiredBounds();
if (outerWrapperFrame) {
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, outerWrapperFrame);
}
FinishAndStoreOverflow(&aDesiredSize);
aStatus = NS_FRAME_COMPLETE;
- NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
+ NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
void
nsNumberControlFrame::SyncDisabledState()
{
EventStates eventStates = mContent->AsElement()->State();
if (eventStates.HasState(NS_EVENT_STATE_DISABLED)) {
mTextField->SetAttr(kNameSpaceID_None, nsGkAtoms::disabled, EmptyString(),
--- a/layout/forms/nsNumberControlFrame.h
+++ b/layout/forms/nsNumberControlFrame.h
@@ -56,17 +56,17 @@ public:
#endif
virtual nscoord GetMinISize(nsRenderingContext* aRenderingContext) override;
virtual nscoord GetPrefISize(nsRenderingContext* aRenderingContext) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType) override;
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
--- a/layout/forms/nsProgressFrame.cpp
+++ b/layout/forms/nsProgressFrame.cpp
@@ -105,113 +105,113 @@ nsProgressFrame::BuildDisplayList(nsDisp
const nsDisplayListSet& aLists)
{
BuildDisplayListForInline(aBuilder, aDirtyRect, aLists);
}
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(),
"nsProgressFrame should not have continuations; if it does we "
"need to call RegUnregAccessKey only for the first.");
if (mState & NS_FRAME_FIRST_REFLOW) {
nsFormControlFrame::RegUnRegAccessKey(this, true);
}
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();
// Force the bar's size to match the current progress.
// When indeterminate, the progress' size will be 100%.
if (position >= 0.0) {
size *= position;
}
if (!vertical && (wm.IsVertical() ? wm.IsVerticalRL() : !wm.IsBidiLTR())) {
- xoffset += aReflowState.ComputedWidth() - size;
+ xoffset += aReflowInput.ComputedWidth() - size;
}
// The bar size is fixed in these cases:
// - the progress position is determined: the bar size is fixed according
// to it's value.
// - the progress position is indeterminate and the bar appearance should be
// shown as native: the bar size is forced to 100%.
// Otherwise (when the progress is indeterminate and the bar appearance isn't
// native), the bar size isn't fixed and can be set by the author.
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);
}
nsresult
nsProgressFrame::AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
{
--- a/layout/forms/nsProgressFrame.h
+++ b/layout/forms/nsProgressFrame.h
@@ -32,17 +32,17 @@ public:
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
virtual void Reflow(nsPresContext* aCX,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsIAtom* GetType() const override;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override {
return MakeFrameName(NS_LITERAL_STRING("Progress"), aResult);
}
@@ -84,17 +84,17 @@ public:
bool ShouldUseNativeStyle() const;
virtual Element* GetPseudoElement(CSSPseudoElementType aType) override;
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 progress bar.
* @see nsProgressFrame::CreateAnonymousContent
*/
nsCOMPtr<Element> mBarDiv;
};
--- a/layout/forms/nsRangeFrame.cpp
+++ b/layout/forms/nsRangeFrame.cpp
@@ -310,48 +310,48 @@ nsRangeFrame::BuildDisplayList(nsDisplay
aLists.Content()->AppendNewToTop(
new (aBuilder) nsDisplayRangeFocusRing(aBuilder, this));
}
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!");
NS_ASSERTION(mThumbDiv, "::-moz-range-thumb div must exist!");
NS_ASSERTION(!GetPrevContinuation() && !GetNextContinuation(),
"nsRangeFrame should not have continuations; if it does we "
"need to call RegUnregAccessKey only for the first.");
if (mState & NS_FRAME_FIRST_REFLOW) {
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();
nsIFrame* trackFrame = mTrackDiv->GetPrimaryFrame();
if (trackFrame) {
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, trackFrame);
}
@@ -364,121 +364,121 @@ nsRangeFrame::Reflow(nsPresContext*
if (thumbFrame) {
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, thumbFrame);
}
FinishAndStoreOverflow(&aDesiredSize);
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;
}
nsIFrame* trackFrame = mTrackDiv->GetPrimaryFrame();
if (trackFrame) { // display:none?
// Position the track:
// The idea here is that we allow content authors to style the width,
// height, border and padding of the track, but we ignore margin and
// positioning properties and do the positioning ourself to keep the center
// of the track's border box on the center of the nsRangeFrame's content
// 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
// as described above. These coordinates are with respect to the
// nsRangeFrame's border-box.
nscoord trackX = rangeFrameContentBoxWidth / 2;
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()));
}
nsIFrame* rangeProgressFrame = mProgressDiv->GetPrimaryFrame();
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
// unadjusted dimensions, then we adjust it to so that the appropriate edge
// 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()));
}
}
#ifdef ACCESSIBILITY
a11y::AccType
nsRangeFrame::AccessibleType()
--- a/layout/forms/nsRangeFrame.h
+++ b/layout/forms/nsRangeFrame.h
@@ -43,17 +43,17 @@ public:
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override {
return MakeFrameName(NS_LITERAL_STRING("Range"), aResult);
}
#endif
@@ -154,17 +154,17 @@ private:
nsresult MakeAnonymousDiv(Element** aResult,
CSSPseudoElementType aPseudoType,
nsTArray<ContentInfo>& aElements);
// 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);
void DoUpdateRangeProgressFrame(nsIFrame* aProgressFrame,
const nsSize& aRangeSize);
/**
--- a/layout/forms/nsSelectsAreaFrame.cpp
+++ b/layout/forms/nsSelectsAreaFrame.cpp
@@ -156,41 +156,41 @@ nsSelectsAreaFrame::BuildDisplayListInte
aLists.Outlines()->AppendNewToTop(new (aBuilder)
nsDisplayListFocus(aBuilder, this));
}
}
void
nsSelectsAreaFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
nsListControlFrame* list = GetEnclosingListFrame(this);
NS_ASSERTION(list,
"Must have an nsListControlFrame! Frame constructor is "
"broken");
bool isInDropdownMode = list->IsInDropDownMode();
// 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
// nsBlockFrame::Reflow for some odd reason.
if (!(GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
oldBSize = BSize(wm);
} else {
oldBSize = NS_UNCONSTRAINEDSIZE;
}
}
- 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
// has changed.
if (list->MightNeedSecondPass()) {
nscoord newBSizeOfARow = list->CalcBSizeOfARow();
// We'll need a second pass if our block size of a row changed. For
// comboboxes, we'll also need it if our block size changed. If
--- a/layout/forms/nsSelectsAreaFrame.h
+++ b/layout/forms/nsSelectsAreaFrame.h
@@ -22,17 +22,17 @@ public:
const nsDisplayListSet& aLists) override;
void BuildDisplayListInternal(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists);
virtual void Reflow(nsPresContext* aCX,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
nscoord BSizeOfARow() const { return mBSizeOfARow; }
protected:
explicit nsSelectsAreaFrame(nsStyleContext* aContext) :
nsBlockFrame(aContext),
mBSizeOfARow(0)
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -481,105 +481,105 @@ nsTextControlFrame::ComputeAutoSize(nsRe
#endif
return autoSize;
}
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) {
nsFormControlFrame::RegUnRegAccessKey(this, true);
}
// 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(),
NS_AUTOHEIGHT, inflation);
}
RefPtr<nsFontMetrics> fontMet =
nsLayoutUtils::GetFontMetricsForFrame(this, inflation);
// now adjust for our borders and padding
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();
}
// take into account css properties that affect overflow handling
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);
}
nsSize
nsTextControlFrame::GetXULMinSize(nsBoxLayoutState& aState)
{
--- a/layout/forms/nsTextControlFrame.h
+++ b/layout/forms/nsTextControlFrame.h
@@ -54,17 +54,17 @@ public:
nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorder,
const mozilla::LogicalSize& aPadding,
bool aShrinkWrap) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsSize GetXULMinSize(nsBoxLayoutState& aBoxLayoutState) override;
virtual bool IsXULCollapsed() override;
virtual bool IsLeaf() const override;
#ifdef ACCESSIBILITY
@@ -155,17 +155,17 @@ public:
NS_DECL_QUERYFRAME
protected:
/**
* Launch the reflow on the child frames - see nsTextControlFrame::Reflow()
*/
void ReflowTextControlChild(nsIFrame* aFrame,
nsPresContext* aPresContext,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus,
ReflowOutput& aParentDesiredSize);
public: //for methods who access nsTextControlFrame directly
void SetValueChanged(bool aValueChanged);
// called by the focus listener
nsresult MaybeBeginSecureKeyboardInput();
--- a/layout/generic/BlockReflowInput.cpp
+++ b/layout/generic/BlockReflowInput.cpp
@@ -23,132 +23,132 @@
#endif
using namespace mozilla;
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,
bool aBEndMarginRoot,
bool aBlockNeedsFloatManager,
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),
mFloatBreakType(NS_STYLE_CLEAR_NONE),
mConsumedBSize(aConsumedBSize)
{
if (!sFloatFragmentsInsideColumnPrefCached) {
sFloatFragmentsInsideColumnPrefCached = true;
Preferences::AddBoolVarCache(&sFloatFragmentsInsideColumnEnabled,
"layout.float-fragments-inside-column.enabled");
}
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;
}
mContainerSize.width += mBorderPadding.LeftRight(wm);
// 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()) ||
0 != mBorderPadding.BStart(wm)) {
SetFlag(BRS_ISBSTARTMARGINROOT, true);
SetFlag(BRS_APPLYBSTARTMARGIN, true);
}
if ((aBEndMarginRoot && !logicalSkipSides.BEnd()) ||
0 != mBorderPadding.BEnd(wm)) {
SetFlag(BRS_ISBENDMARGINROOT, true);
}
if (aBlockNeedsFloatManager) {
SetFlag(BRS_FLOAT_MGR, true);
}
- mFloatManager = aReflowState.mFloatManager;
+ mFloatManager = aReflowInput.mFloatManager;
NS_ASSERTION(mFloatManager,
"FloatManager should be set in BlockReflowInput" );
if (mFloatManager) {
// Save the coordinate system origin for later.
mFloatManager->GetTranslation(mFloatManagerI, mFloatManagerB);
mFloatManager->PushState(&mFloatManagerStateBefore); // never popped
}
mReflowStatus = NS_FRAME_COMPLETE;
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
// managed by the "overflow" property. When we don't have a
// 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 {
// When we are not in a paginated situation then we always use
// an constrained height.
SetFlag(BRS_UNCONSTRAINEDBSIZE, true);
mContentArea.BSize(wm) = mBEndEdge = NS_UNCONSTRAINEDSIZE;
}
mContentArea.IStart(wm) = mBorderPadding.IStart(wm);
mBCoord = mContentArea.BStart(wm) = mBorderPadding.BStart(wm);
mPrevChild = nullptr;
mCurrentLine = aFrame->end_lines();
- mMinLineHeight = aReflowState.CalcLineHeight();
+ mMinLineHeight = aReflowInput.CalcLineHeight();
}
nscoord
BlockReflowInput::GetConsumedBSize()
{
if (mConsumedBSize == NS_INTRINSICSIZE) {
mConsumedBSize = mBlock->GetConsumedBSize();
}
@@ -158,17 +158,17 @@ BlockReflowInput::GetConsumedBSize()
void
BlockReflowInput::ComputeReplacedBlockOffsetsForFloats(
nsIFrame* aFrame,
const LogicalRect& aFloatAvailableSpace,
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.
// However, we can let its margins intersect floats.
NS_ASSERTION(aFloatAvailableSpace.IStart(wm) >= mContentArea.IStart(wm),
"bad avail space rect inline-coord");
NS_ASSERTION(aFloatAvailableSpace.ISize(wm) == 0 ||
aFloatAvailableSpace.IEnd(wm) <= mContentArea.IEnd(wm),
@@ -176,17 +176,17 @@ BlockReflowInput::ComputeReplacedBlockOf
nscoord iStartOffset, iEndOffset;
if (aFloatAvailableSpace.ISize(wm) == mContentArea.ISize(wm)) {
// We don't need to compute margins when there are no floats around.
iStartOffset = 0;
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());
nscoord iStartFloatIOffset =
aFloatAvailableSpace.IStart(wm) - mContentArea.IStart(wm);
iStartOffset = std::max(iStartFloatIOffset, frameMargin.IStart(wm)) -
frameMargin.IStart(wm);
@@ -227,22 +227,22 @@ BlockReflowInput::ComputeBlockAvailSpace
const nsFlowAreaRect& aFloatAvailableSpace,
bool aBlockAvoidsFloats,
LogicalRect& aResult)
{
#ifdef REALLY_NOISY_REFLOW
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.
// XXX Do we really want this condition to be this restrictive (i.e.,
// more restrictive than it used to be)? The |else| here is allowed
// by the CSS spec, but only out of desperation given implementations,
// and the behavior it leads to is quite undesirable (it can cause
@@ -307,17 +307,17 @@ BlockReflowInput::ReplacedBlockFitsInAva
const nsFlowAreaRect& aFloatAvailableSpace) const
{
if (!aFloatAvailableSpace.mHasFloats) {
// If there aren't any floats here, then we always fit.
// We check this before calling ISizeToClearPastFloats, which is
// somewhat expensive.
return true;
}
- WritingMode wm = mReflowState.GetWritingMode();
+ WritingMode wm = mReflowInput.GetWritingMode();
nsBlockFrame::ReplacedElementISizeToClear replacedISize =
nsBlockFrame::ISizeToClearPastFloats(*this, aFloatAvailableSpace.mRect,
aReplacedBlock);
// The inline-start side of the replaced element should be offset by
// the larger of the float intrusion or the replaced element's own
// start margin. The inline-end side is similar, except for Web
// compatibility we ignore the margin.
return std::max(aFloatAvailableSpace.mRect.IStart(wm) -
@@ -329,17 +329,17 @@ BlockReflowInput::ReplacedBlockFitsInAva
mContentArea.ISize(wm);
}
nsFlowAreaRect
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;
mFloatManager->GetTranslation(wI, wB);
NS_ASSERTION((wI == mFloatManagerI) && (wB == mFloatManagerB),
"bad coord system");
#endif
@@ -366,17 +366,17 @@ BlockReflowInput::GetFloatAvailableSpace
return result;
}
nsFlowAreaRect
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;
mFloatManager->GetTranslation(wI, wB);
NS_ASSERTION((wI == mFloatManagerI) && (wB == mFloatManagerB),
"bad coord system");
#endif
@@ -480,17 +480,17 @@ BlockReflowInput::AppendPushedFloatChain
* parent. The recovery of state is one of the things that makes
* incremental reflow O(N^2) and this state should really be kept
* around, attached to the frame tree.
*/
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.
nsFloatCache* fc = aLine->GetFirstFloat();
while (fc) {
nsIFrame* floatFrame = fc->mFloat;
if (aDeltaBCoord != 0) {
floatFrame->MovePositionBy(nsPoint(0, aDeltaBCoord));
@@ -624,17 +624,17 @@ BlockReflowInput::AddFloat(nsLineLayout*
if (mBelowCurrentLineFloats.IsEmpty() &&
(aLineLayout->LineIsEmpty() ||
mBlock->ComputeFloatISize(*this, floatAvailableSpace, aFloat)
<= aAvailableISize)) {
// And then place it
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),
floatAvailSpace.mRect.BSize(wm));
aLineLayout->UpdateBand(wm, availSpace, aFloat);
// Record this float in the current-line list
mCurrentLineFloats.Append(mFloatCacheFreeList.Alloc(aFloat));
} else {
@@ -661,63 +661,63 @@ BlockReflowInput::CanPlaceFloat(nscoord
const nsFlowAreaRect& aFloatAvailableSpace)
{
// A float fits at a given block-dir position if there are no floats
// at its inline-dir position (no matter what its inline size) or if
// its inline size fits in the space remaining after prior floats have
// 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;
}
// Return the inline-size that the float (including margins) will take up
// in the writing mode of the containing block. If this returns
// NS_UNCONSTRAINEDSIZE, we're dealing with an orthogonal block that
// 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)
{
AutoMaybeDisableFontInflation an(aFloat);
WritingMode wm = aFloatOffsetState.GetWritingMode();
LogicalSize floatSize =
aFloat->ComputeSize(
- aCBReflowState.mRenderingContext,
+ aCBReflowInput.mRenderingContext,
wm,
- aCBReflowState.ComputedSize(wm),
+ aCBReflowInput.ComputedSize(wm),
aFloatAvailableISize,
aFloatOffsetState.ComputedLogicalMargin().Size(wm),
aFloatOffsetState.ComputedLogicalBorderPadding().Size(wm) -
aFloatOffsetState.ComputedLogicalPadding().Size(wm),
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
}
return floatISize +
aFloatOffsetState.ComputedLogicalMargin().Size(wm).
ConvertTo(cbwm, wm).ISize(cbwm) +
aFloatOffsetState.ComputedLogicalBorderPadding().Size(wm).
ConvertTo(cbwm, wm).ISize(cbwm);
}
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
// placement are for the float only, not for any non-floating
// content.
AutoRestore<nscoord> restoreBCoord(mBCoord);
// Grab the float's display information
@@ -741,20 +741,20 @@ BlockReflowInput::FlowAndPlaceFloat(nsIF
// Get the band of available space
nsFlowAreaRect floatAvailableSpace = GetFloatAvailableSpace(mBCoord);
LogicalRect adjustedAvailableSpace =
mBlock->AdjustFloatAvailableSpace(*this, floatAvailableSpace.mRect, 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);
LogicalMargin floatMargin(wm); // computed margin
LogicalMargin floatOffsets(wm);
nsReflowStatus reflowStatus;
// If it's a floating first-letter, we need to reflow it before we
@@ -786,20 +786,20 @@ BlockReflowInput::FlowAndPlaceFloat(nsIF
// Can the float fit here?
bool keepFloatOnSameLine = false;
// Are we required to place at least part of the float because we're
// 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.
PushFloatPastBreak(aFloat);
return false;
}
if (CanPlaceFloat(floatMarginISize, floatAvailableSpace)) {
@@ -854,17 +854,17 @@ BlockReflowInput::FlowAndPlaceFloat(nsIF
// the table does not fit anymore in this line so advance to next band
mBCoord += floatAvailableSpace.mRect.BSize(wm);
// To match nsBlockFrame::AdjustFloatAvailableSpace, we have to
// get a new width for the new band.
floatAvailableSpace = GetFloatAvailableSpace(mBCoord);
adjustedAvailableSpace = mBlock->AdjustFloatAvailableSpace(*this,
floatAvailableSpace.mRect, aFloat);
- floatMarginISize = FloatMarginISize(mReflowState,
+ floatMarginISize = FloatMarginISize(mReflowInput,
adjustedAvailableSpace.ISize(wm),
aFloat, offsets);
}
mustPlaceFloat = false;
}
// If the float is continued, it will get the same absolute x value as its prev-in-flow
@@ -925,22 +925,22 @@ BlockReflowInput::FlowAndPlaceFloat(nsIF
aFloat->BSize(wm) + floatMargin.BStartEnd(wm) >
ContentBEnd() - floatPos.B(wm)) ||
NS_FRAME_IS_TRUNCATED(reflowStatus) ||
NS_INLINE_IS_BREAK_BEFORE(reflowStatus)) {
PushFloatPastBreak(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) >
ContentBEnd() - floatPos.B(wm)) &&
!aFloat->GetPrevInFlow()) {
PushFloatPastBreak(aFloat);
return false;
}
@@ -1032,17 +1032,17 @@ void
BlockReflowInput::PushFloatPastBreak(nsIFrame *aFloat)
{
// This ensures that we:
// * don't try to place later but smaller floats (which CSS says
// must have their tops below the top of this float)
// * 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 {
MOZ_ASSERT(floatStyle == NS_STYLE_FLOAT_RIGHT, "unexpected float value");
mFloatManager->SetPushedRightFloatPastBreak();
}
// Put the float on the pushed floats list, even though it
--- a/layout/generic/BlockReflowInput.h
+++ b/layout/generic/BlockReflowInput.h
@@ -75,17 +75,17 @@ namespace mozilla {
// BlockReflowInput contains additional reflow state information that the
// block frame uses along with ReflowInput. Like ReflowInput, this
// is read-only data that is passed down from a parent frame to its children.
class BlockReflowInput {
using ReflowInput = mozilla::ReflowInput;
public:
- BlockReflowInput(const ReflowInput& aReflowState,
+ BlockReflowInput(const ReflowInput& aReflowInput,
nsPresContext* aPresContext,
nsBlockFrame* aFrame,
bool aBStartMarginRoot, bool aBEndMarginRoot,
bool aBlockNeedsFloatManager,
nscoord aConsumedBSize = NS_INTRINSICSIZE);
/**
* Get the available reflow space (the area not occupied by floats)
@@ -132,37 +132,37 @@ public:
// Advances to the next band, i.e., the next horizontal stripe in
// which there is a different set of floats.
// Return false if it did not advance, which only happens for
// constrained heights (and means that we should get pushed to the
// 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;
}
NS_NOTREACHED("avail space rect with zero height!");
*aBCoord += 1;
}
return true;
}
bool ReplacedBlockFitsInAvailSpace(nsIFrame* aReplacedBlock,
const nsFlowAreaRect& aFloatAvailableSpace) const;
bool IsAdjacentWithTop() const {
- return mBCoord == mBorderPadding.BStart(mReflowState.GetWritingMode());
+ return mBCoord == mBorderPadding.BStart(mReflowInput.GetWritingMode());
}
/**
* Return mBlock's computed physical border+padding with GetSkipSides applied.
*/
const mozilla::LogicalMargin& BorderPadding() const {
return mBorderPadding;
}
@@ -204,17 +204,17 @@ public:
// This state is the "global" state computed once for the reflow of
// the block.
// The block frame that is using this object
nsBlockFrame* mBlock;
nsPresContext* mPresContext;
- const ReflowInput& mReflowState;
+ const ReflowInput& mReflowInput;
nsFloatManager* mFloatManager;
// The coordinates within the float manager where the block is being
// placed <b>after</b> taking into account the blocks border and
// padding. This, therefore, represents the inner "content area" (in
// spacemanager coordinates) where child frames will be placed,
// including child blocks and floats.
@@ -237,35 +237,35 @@ public:
// mContentArea.BStart == BorderPadding().BStart.
// The block size may be NS_UNCONSTRAINEDSIZE, which indicates that there
// is no page/column boundary below (the common case).
// mContentArea.BEnd() should only be called after checking that
// mContentArea.BSize is not NS_UNCONSTRAINEDSIZE; otherwise
// 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);
}
// Physical size. Use only for physical <-> logical coordinate conversion.
nsSize mContainerSize;
const nsSize& ContainerSize() const { return mContainerSize; }
// Continuation out-of-flow float frames that need to move to our
--- a/layout/generic/ReflowInput.cpp
+++ b/layout/generic/ReflowInput.cpp
@@ -62,26 +62,26 @@ ReflowInput::ReflowInput(nsPresContext*
, mBlockDelta(0)
, mOrthogonalLimit(NS_UNCONSTRAINEDSIZE)
, mReflowDepth(0)
{
NS_PRECONDITION(aRenderingContext, "no rendering context");
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;
mLineLayout = nullptr;
mDiscoveredClearance = nullptr;
mPercentBSizeObserver = nullptr;
if (aFlags & DUMMY_PARENT_REFLOW_STATE) {
- mFlags.mDummyParentReflowState = true;
+ mFlags.mDummyParentReflowInput = true;
}
if (aFlags & COMPUTE_SIZE_SHRINK_WRAP) {
mFlags.mShrinkWrap = true;
}
if (aFlags & COMPUTE_SIZE_USE_AUTO_BSIZE) {
mFlags.mUseAutoBSize = true;
}
if (aFlags & STATIC_POS_IS_CB_ORIGIN) {
@@ -161,93 +161,93 @@ SizeComputationInput::SizeComputationInp
MOZ_ASSERT(!aFrame->IsFlexOrGridItem(),
"We're about to resolve percent margin & padding "
"values against CB inline size, which is incorrect for "
"flex/grid items. "
"Additionally for grid items, this path doesn't handle baseline "
"padding contribution - see SizeComputationInput::InitOffsets");
LogicalSize cbSize(aContainingBlockWritingMode, aContainingBlockISize,
aContainingBlockISize);
- ReflowStateFlags flags;
+ ReflowInputFlags flags;
InitOffsets(aContainingBlockWritingMode, cbSize, mFrame->GetType(), flags);
}
// Initialize a reflow state for a child frame's reflow. Some state
// is copied from the parent reflow state; the remaining state is
// 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");
MOZ_ASSERT(aPresContext == aFrame->PresContext(), "wrong pres context");
NS_PRECONDITION(!mFlags.mSpecialBSizeReflow ||
!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)) {
Init(aPresContext, aContainingBlockSize);
}
}
inline nscoord
@@ -349,18 +349,18 @@ void
ReflowInput::Init(nsPresContext* aPresContext,
const LogicalSize* aContainingBlockSize,
const nsMargin* aBorder,
const nsMargin* aPadding)
{
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;
break;
}
}
}
@@ -375,17 +375,17 @@ ReflowInput::Init(nsPresContext* aPr
mStyleBorder = mFrame->StyleBorder();
mStyleMargin = mFrame->StyleMargin();
mStylePadding = mFrame->StylePadding();
mStyleText = mFrame->StyleText();
nsIAtom* type = mFrame->GetType();
InitFrameType(type);
- InitCBReflowState();
+ InitCBReflowInput();
LogicalSize cbSize(mWritingMode, -1, -1);
if (aContainingBlockSize) {
cbSize = *aContainingBlockSize;
}
InitConstraints(aPresContext, cbSize, aBorder, aPadding, type);
@@ -441,18 +441,18 @@ ReflowInput::Init(nsPresContext* aPr
break;
}
}
} else {
mFrame->RemoveStateBits(NS_FRAME_IN_CONSTRAINED_BSIZE);
}
}
- 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
// with auto-height it's the inline-size, so that they can add
// columns in the container's block direction
if (type == nsGkAtoms::columnSetFrame &&
eStyleUnit_Auto == mStylePosition->ISize(mWritingMode).GetUnit()) {
ComputedISize() = NS_UNCONSTRAINEDSIZE;
@@ -465,33 +465,33 @@ ReflowInput::Init(nsPresContext* aPr
!mFrame->IsFrameOfType(nsIFrame::eReplaced)) ||
type == nsGkAtoms::textFrame ||
ComputedISize() != NS_UNCONSTRAINEDSIZE,
"have unconstrained inline-size; this should only "
"result from very large sizes, not attempts at "
"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;
}
}
/* Check whether CalcQuirkContainingBlockHeight would stop on the
* given reflow state, using its block as a height. (essentially
* returns false for any case in which CalcQuirkContainingBlockHeight
* has a "continue" in its main loop.)
*
@@ -530,17 +530,17 @@ ReflowInput::InitResizeFlags(nsPresConte
nsLayoutUtils::FontSizeInflationEnabled(aPresContext)) {
// Create our font inflation data if we don't have it already, and
// give it our current width information.
bool dirty = nsFontInflationData::UpdateFontInflationDataISizeFor(*this) &&
// Avoid running this at the box-to-block interface
// (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:
// * the effective width of a font inflation flow root
// * the width of the frame
// needs to cause a dirty reflow since they change the font size
// inflation calculations, which in turn change the size of text,
// line-heights, etc. This is relatively similar to a classic
@@ -610,34 +610,34 @@ ReflowInput::InitResizeFlags(nsPresConte
}
} while (stack.Length() != 0);
}
}
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 ||
(mFrame->FirstInFlow()->GetStateBits() &
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
// auto height and don't have that flag set, they will not actually compute
// their auto height and will just remain at whatever size they already
// were. We can end up in that situation if the child has a percentage
// specified height and the parent changes from non-auto height to auto
// height. When that happens, the parent will typically have the BResize
@@ -646,24 +646,24 @@ ReflowInput::InitResizeFlags(nsPresConte
// Ideally it seems like we'd do this for blocks too, of course... but we'd
// really want to restrict it to the percentage height case or something, to
// avoid extra reflows in common cases. Maybe we should be examining
// mStylePosition->BSize(wm).GetUnit() for that purpose?
//
// 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());
}
SetBResize(IsBResize() || NS_SUBTREE_DIRTY(mFrame));
} else {
// not 'auto' block-size
SetBResize(mFrame->BSize(wm) !=
ComputedBSize() + ComputedLogicalBorderPadding().BStartEnd(wm));
@@ -691,57 +691,57 @@ ReflowInput::InitResizeFlags(nsPresConte
}
// If we're the descendant of a table cell that performs special bsize
// reflows and we could be the child that requires them, always set
// the block-axis resize in case this is the first pass before the
// 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;
}
// Set NS_FRAME_CONTAINS_RELATIVE_BSIZE if it's needed.
// It would be nice to check that |ComputedBSize != NS_AUTOHEIGHT|
// &&ed with the percentage bsize check. However, this doesn't get
// along with table special bsize reflows, since a special bsize
// reflow (a quirk that makes such percentage height work on children
// 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;
}
if (rs->mFrame->GetStateBits() & NS_FRAME_CONTAINS_RELATIVE_BSIZE)
break; // no need to go further
rs->mFrame->AddStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE);
// 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
// NS_FRAME_CONTAINS_RELATIVE_BSIZE bit for the cases
// where we hit the early break statements in
// CalcQuirkContainingBlockHeight. But it doesn't hurt
// us to set the bit in these cases.
@@ -751,22 +751,22 @@ ReflowInput::InitResizeFlags(nsPresConte
// to re-set this.
mFrame->RemoveStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE);
}
}
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
ReflowInput::InitFrameType(nsIAtom* aFrameType)
{
const nsStyleDisplay *disp = mStyleDisplay;
nsCSSFrameType frameType;
@@ -1032,18 +1032,18 @@ ReflowInput::GetHypotheticalBoxContainer
NS_ASSERTION(aFrame != mFrame, "How did that happen?");
/* Now aFrame is the containing block we want */
/* Check whether the containing block is currently being reflowed.
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 {
state = nullptr;
}
if (state) {
WritingMode wm = state->GetWritingMode();
@@ -1837,59 +1837,59 @@ ReflowInput::InitAbsoluteConstraints(nsP
SetComputedLogicalOffsets(offsets.ConvertTo(wm, cbwm));
SetComputedLogicalMargin(margin.ConvertTo(wm, cbwm));
}
// 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)
*
* When we encounter scrolledContent block frames, we skip over them,
* since they are guaranteed to not be useful for computing the containing block.
*
* 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
// initialize the default to NS_AUTOHEIGHT as this is the containings block
// computed height when this function is called. It is possible that we
// 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
if (nsGkAtoms::blockFrame == frameType ||
#ifdef MOZ_XUL
nsGkAtoms::XULLabelFrame == frameType ||
#endif
nsGkAtoms::scrollFrame == frameType) {
@@ -1953,19 +1953,19 @@ CalcQuirkContainingBlockHeight(const Ref
"Second ancestor is not BODY");
}
}
#endif
}
// 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);
}
break;
}
// Make sure not to return a negative height here!
return std::max(result, 0);
@@ -2094,17 +2094,17 @@ ReflowInput::InitConstraints(nsPresConte
WritingMode wm = GetWritingMode();
DISPLAY_INIT_CONSTRAINTS(mFrame, this,
aContainingBlockSize.ISize(wm),
aContainingBlockSize.BSize(wm),
aBorder, aPadding);
// 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);
// Override mComputedMargin since reflow roots start from the
// frame's boundary, which is inside the margin.
ComputedPhysicalMargin().SizeTo(0, 0, 0, 0);
ComputedPhysicalOffsets().SizeTo(0, 0, 0, 0);
@@ -2122,33 +2122,33 @@ ReflowInput::InitConstraints(nsPresConte
} else {
ComputedBSize() = NS_UNCONSTRAINEDSIZE;
}
ComputedMinWidth() = ComputedMinHeight() = 0;
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
// compute one
LogicalSize cbSize = (aContainingBlockSize == LogicalSize(wm, -1, -1))
? ComputeContainingBlockRectangle(aPresContext, cbrs)
: aContainingBlockSize;
// See if the containing block height is based on the size of its
// content
nsIAtom* fType;
if (NS_AUTOHEIGHT == cbSize.BSize(wm)) {
// 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
cbSize.BSize(wm) = cbrs->ComputedSize(wm).BSize(wm);
}
}
}
@@ -2331,18 +2331,18 @@ ReflowInput::InitConstraints(nsPresConte
// Make sure legend frames with display:block and width:auto still
// shrink-wrap.
// Also shrink-wrap blocks that are orthogonal to their container.
if (isBlock &&
((aFrameType == nsGkAtoms::legendFrame &&
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);
}
if (parentFrameType == nsGkAtoms::flexContainerFrame) {
computeSizeFlags =
ComputeSizeFlags(computeSizeFlags | ComputeSizeFlags::eShrinkWrap);
@@ -2409,17 +2409,17 @@ UpdateProp(FrameProperties& aProps,
aProps.Delete(aProperty);
}
}
void
SizeComputationInput::InitOffsets(WritingMode aWM,
const LogicalSize& aPercentBasis,
nsIAtom* aFrameType,
- ReflowStateFlags aFlags,
+ ReflowInputFlags aFlags,
const nsMargin* aBorder,
const nsMargin* aPadding)
{
DISPLAY_INIT_OFFSETS(mFrame, this, aPercentBasis, aBorder, aPadding);
// Since we are in reflow, we don't need to store these properties anymore
// unless they are dependent on width, in which case we store the new value.
nsPresContext *presContext = mFrame->PresContext();
@@ -2562,17 +2562,17 @@ ReflowInput::CalculateBlockSideMargins(n
// which is where margins will eventually be applied: we're calculating
// margins that will be used by the container in its inline direction,
// which in the case of an orthogonal contained block will correspond to
// the block direction of this reflow state. So in the orthogonal-flow
// case, "CalculateBlock*Side*Margins" will actually end up adjusting
// 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);
if (computedISizeCBWM == NS_UNCONSTRAINEDSIZE) {
// For orthogonal flows, where we found a parent orthogonal-limit
// for AvailableISize() in Init(), we'll use the same here as well.
computedISizeCBWM = availISizeCBWM;
}
@@ -2613,23 +2613,23 @@ ReflowInput::CalculateBlockSideMargins(n
const nsStyleSides& styleSides = mStyleMargin->mMargin;
bool isAutoStartMargin = eStyleUnit_Auto == styleSides.GetIStartUnit(cbWM);
bool isAutoEndMargin = eStyleUnit_Auto == styleSides.GetIEndUnit(cbWM);
if (!isAutoStartMargin && !isAutoEndMargin) {
// Neither margin is 'auto' so we're over constrained. Use the
// '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 ||
prs->mStyleText->mTextAlign == NS_STYLE_TEXT_ALIGN_MOZ_CENTER ||
prs->mStyleText->mTextAlign == NS_STYLE_TEXT_ALIGN_MOZ_RIGHT)) {
if (prs->mWritingMode.IsBidiLTR()) {
isAutoStartMargin =
prs->mStyleText->mTextAlign != NS_STYLE_TEXT_ALIGN_MOZ_LEFT;
@@ -2743,17 +2743,17 @@ ComputeLineHeight(nsStyleContext* aStyle
return GetNormalLineHeight(fm);
}
nscoord
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));
}
/* static */ nscoord
ReflowInput::CalcLineHeight(nsIContent* aContent,
nsStyleContext* aStyleContext,
--- a/layout/generic/ReflowInput.h
+++ b/layout/generic/ReflowInput.h
@@ -170,18 +170,18 @@ public:
, mWritingMode(aFrame->GetWritingMode())
{
}
SizeComputationInput(nsIFrame *aFrame, nsRenderingContext *aRenderingContext,
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)
// is changing
uint16_t mIsTopOfPage:1; // Is the current context at the top of a
// page? When true, we force something
// that's too tall for a page/column to
// fit anyway to avoid infinite loops.
@@ -201,17 +201,17 @@ public:
uint16_t mTableIsSplittable:1; // tables are splittable, this should happen only inside a page
// and never insider a column frame
uint16_t mHeightDependsOnAncestorCell:1; // Does frame height depend on
// an ancestor table-cell?
uint16_t mIsColumnBalancing:1; // nsColumnSetFrame is balancing columns
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-
// holder children? If the available
// height of this frame didn't change,
// but its in a paginated environment
// (e.g. columns), it should always
// reflow its placeholder children.
@@ -276,17 +276,17 @@ private:
const mozilla::LogicalSize& aPercentBasis,
nsIAtom* aFrameType);
protected:
void InitOffsets(mozilla::WritingMode aWM,
const mozilla::LogicalSize& aPercentBasis,
nsIAtom* aFrameType,
- ReflowStateFlags aFlags,
+ ReflowInputFlags aFlags,
const nsMargin* aBorder = nullptr,
const nsMargin* aPadding = nullptr);
/*
* Convert nsStyleCoord to nscoord when percentages depend on the
* inline size of the containing block, and enumerated values are for
* inline size, min-inline-size, or max-inline-size. Does not handle
* auto inline sizes.
@@ -312,44 +312,44 @@ protected:
* XXX Refactor so only a base class (nsSizingState?) is used for intrinsic
* size calculation.
*
* @see nsIFrame#Reflow()
*/
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;
// LineLayout object (only for inline reflow; set to nullptr otherwise)
nsLineLayout* mLineLayout;
// 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.
nsCSSFrameType mFrameType;
// The amount the in-flow position of the block is moving vertically relative
// to its previous in-flow position (i.e. the amount the line containing the
// block is moving).
// This should be zero for anything which is not a block outside, and it
// should be zero for anything which has a non-block parent.
// The intended use of this value is to allow the accurate determination
// of the potential impact of a float
// This takes on an arbitrary value the first time a block is reflowed
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.
// This is initialized to NS_UNCONSTRAINEDSIZE (so it will be ignored),
// but reset to a suitable value for the reflow root by nsPresShell.
nscoord mOrthogonalLimit;
// Accessors for the private fields below. Forcing all callers to use these
@@ -586,17 +586,17 @@ public:
// is required. When we discover that clearance is required, we
// store the frame in which clearance was discovered to the location
// requested here.
nsIFrame** mDiscoveredClearance;
// 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
// physical to logical.
bool IsHResize() const {
return mWritingMode.IsVertical() ? mFlags.mIsBResize : mFlags.mIsIResize;
}
bool IsVResize() const {
@@ -654,38 +654,38 @@ public:
const mozilla::LogicalSize& aAvailableSpace,
uint32_t aFlags = 0);
/**
* Initialize a reflow state for a child frame's reflow. Some parts of the
* 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
* members.
* @param aContainingBlockSize An optional size, in app units, specifying
* the containing block size to use instead of the default which is
* to use the aAvailableSpace.
* @param aFlags A set of flags used for additional boolean parameters (see
* below).
*/
ReflowInput(nsPresContext* aPresContext,
- const ReflowInput& aParentReflowState,
+ const ReflowInput& aParentReflowInput,
nsIFrame* aFrame,
const mozilla::LogicalSize& aAvailableSpace,
const mozilla::LogicalSize* aContainingBlockSize = nullptr,
uint32_t aFlags = 0);
// 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
// that the constructor should not call Init().
CALLER_WILL_INIT = (1<<1),
// The caller wants shrink-wrap behavior (i.e. ComputeSizeFlags::eShrinkWrap
// will be passed to ComputeSize()).
@@ -917,17 +917,17 @@ public:
ReflowInput* aState);
static void DisplayInitFrameTypeExit(nsIFrame* aFrame,
ReflowInput* aState,
void* aValue);
#endif
protected:
void InitFrameType(nsIAtom* aFrameType);
- void InitCBReflowState();
+ void InitCBReflowInput();
void InitResizeFlags(nsPresContext* aPresContext, nsIAtom* aFrameType);
void InitConstraints(nsPresContext* aPresContext,
const mozilla::LogicalSize& aContainingBlockSize,
const nsMargin* aBorder,
const nsMargin* aPadding,
nsIAtom* aFrameType);
--- a/layout/generic/nsAbsoluteContainingBlock.cpp
+++ b/layout/generic/nsAbsoluteContainingBlock.cpp
@@ -105,39 +105,39 @@ nsAbsoluteContainingBlock::RemoveFrame(n
}
mAbsoluteFrames.DestroyFrame(aOldFrame);
}
void
nsAbsoluteContainingBlock::Reflow(nsContainerFrame* aDelegatingFrame,
nsPresContext* aPresContext,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aReflowStatus,
const nsRect& aContainingBlock,
AbsPosReflowFlags aFlags,
nsOverflowAreas* aOverflowAreas)
{
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);
for (kidFrame = mAbsoluteFrames.FirstChild(); kidFrame; kidFrame = kidFrame->GetNextSibling()) {
bool kidNeedsReflow = reflowAll || NS_SUBTREE_DIRTY(kidFrame) ||
FrameDependsOnContainer(kidFrame,
!!(aFlags & AbsPosReflowFlags::eCBWidthChanged),
!!(aFlags & AbsPosReflowFlags::eCBHeightChanged));
if (kidNeedsReflow && !aPresContext->HasPendingInterrupt()) {
// Reflow the frame
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) &&
aDelegatingFrame->IsFrameOfType(nsIFrame::eCanContainOverflowContainers)) {
// Need a continuation
if (!nextFrame) {
nextFrame =
aPresContext->PresShell()->FrameConstructor()->
@@ -338,131 +338,131 @@ nsAbsoluteContainingBlock::DoMarkFramesD
// When bug 154892 is checked in, make sure that when
// mChildListID == kFixedList, the height is unconstrained.
// since we don't allow replicated frames to split.
void
nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegatingFrame,
nsPresContext* aPresContext,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
const nsRect& aContainingBlock,
AbsPosReflowFlags aFlags,
nsIFrame* aKidFrame,
nsReflowStatus& aStatus,
nsOverflowAreas* aOverflowAreas)
{
#ifdef DEBUG
if (nsBlockFrame::gNoisyReflow) {
nsFrame::IndentBy(stdout,nsBlockFrame::gNoiseIndent);
printf("abs pos ");
nsAutoString name;
aKidFrame->GetFrameName(name);
printf("%s ", NS_LossyConvertUTF16toASCII(name).get());
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);
#endif // DEBUG
WritingMode wm = aKidFrame->GetWritingMode();
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;
if (aFlags & AbsPosReflowFlags::eIsGridContainerCB) {
// When a grid container generates the abs.pos. CB for a *child* then
// the static-position is the CB origin (i.e. of the grid area rect).
// https://drafts.csswg.org/css-grid/#static-position
nsIFrame* placeholder =
aPresContext->PresShell()->GetPlaceholderFrameFor(aKidFrame);
if (placeholder && placeholder->GetParent() == aDelegatingFrame) {
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.
if ((NS_AUTOOFFSET == offsets.IStart(outerWM)) ||
(NS_AUTOOFFSET == offsets.BStart(outerWM))) {
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)) {
NS_ASSERTION(NS_AUTOOFFSET != offsets.IEnd(outerWM),
"Can't solve for both start and end");
offsets.IStart(outerWM) =
logicalCBSize.ConvertTo(outerWM, wm).ISize(outerWM) -
offsets.IEnd(outerWM) - margin.IStartEnd(outerWM) -
kidSize.ISize(outerWM);
}
if (NS_AUTOOFFSET == offsets.BStart(outerWM)) {
offsets.BStart(outerWM) =
logicalCBSize.ConvertTo(outerWM, wm).BSize(outerWM) -
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
LogicalRect rect(outerWM,
border.IStart(outerWM) + offsets.IStart(outerWM) +
margin.IStart(outerWM),
border.BStart(outerWM) + offsets.BStart(outerWM) +
margin.BStart(outerWM),
@@ -471,17 +471,17 @@ nsAbsoluteContainingBlock::ReflowAbsolut
rect.GetPhysicalRect(outerWM, logicalCBSize.GetPhysicalSize(wm) +
border.Size(outerWM).GetPhysicalSize(outerWM));
// Offset the frame rect by the given origin of the absolute containing block.
// If the frame is auto-positioned on both sides of an axis, it will be
// 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)) {
r.x += aContainingBlock.x;
}
if (!(offsets.GetTopUnit() == eStyleUnit_Auto &&
offsets.GetBottomUnit() == eStyleUnit_Auto) ||
(rsFlags & ReflowInput::STATIC_POS_IS_CB_ORIGIN)) {
@@ -496,17 +496,17 @@ nsAbsoluteContainingBlock::ReflowAbsolut
// Size and position the view and set its opacity, visibility, content
// transparency, and clip
nsContainerFrame::SyncFrameViewAfterReflow(aPresContext, aKidFrame, view,
kidDesiredSize.VisualOverflow());
} else {
nsContainerFrame::PositionChildViews(aKidFrame);
}
- aKidFrame->DidReflow(aPresContext, &kidReflowState,
+ aKidFrame->DidReflow(aPresContext, &kidReflowInput,
nsDidReflowStatus::FINISHED);
#ifdef DEBUG
if (nsBlockFrame::gNoisyReflow) {
nsFrame::IndentBy(stdout,nsBlockFrame::gNoiseIndent - 1);
printf("abs pos ");
nsAutoString name;
aKidFrame->GetFrameName(name);
--- a/layout/generic/nsAbsoluteContainingBlock.h
+++ b/layout/generic/nsAbsoluteContainingBlock.h
@@ -91,17 +91,17 @@ public:
* @param aReflowStatus is assumed to be already-initialized, e.g. with the
* status of the delegating frame's main reflow. This function merges in the
* statuses of the absolutely positioned children's reflows.
*
* @param aFlags zero or more AbsPosReflowFlags
*/
void Reflow(nsContainerFrame* aDelegatingFrame,
nsPresContext* aPresContext,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aReflowStatus,
const nsRect& aContainingBlock,
AbsPosReflowFlags aFlags,
nsOverflowAreas* aOverflowAreas);
void DestroyFrames(nsIFrame* aDelegatingFrame,
nsIFrame* aDestructRoot);
@@ -124,17 +124,17 @@ protected:
* its placeholder or if the position or size of aFrame depends on a
* containing block dimension that changed.
*/
bool FrameDependsOnContainer(nsIFrame* aFrame, bool aCBWidthChanged,
bool aCBHeightChanged);
void ReflowAbsoluteFrame(nsIFrame* aDelegatingFrame,
nsPresContext* aPresContext,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
const nsRect& aContainingBlockRect,
AbsPosReflowFlags aFlags,
nsIFrame* aKidFrame,
nsReflowStatus& aStatus,
nsOverflowAreas* aOverflowAreas);
/**
* Mark our absolute frames dirty.
--- a/layout/generic/nsBRFrame.cpp
+++ b/layout/generic/nsBRFrame.cpp
@@ -33,17 +33,17 @@ public:
virtual FrameSearchResult PeekOffsetCharacter(bool aForward, int32_t* aOffset,
bool aRespectClusters = true) override;
virtual FrameSearchResult PeekOffsetWord(bool aForward, bool aWordSelectEatSpace,
bool aIsKeyboardSelect, int32_t* aOffset,
PeekWordState* aState) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual void AddInlineMinISize(nsRenderingContext *aRenderingContext,
InlineMinISizeData *aData) override;
virtual void AddInlinePrefISize(nsRenderingContext *aRenderingContext,
InlinePrefISizeData *aData) override;
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
virtual nsIAtom* GetType() const override;
@@ -76,37 +76,37 @@ NS_IMPL_FRAMEARENA_HELPERS(BRFrame)
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 .
// However, it's not always 0. See below.
finalSize.ISize(wm) = 0;
aMetrics.SetBlockStartAscent(0);
// Only when the BR is operating in a line-layout situation will it
// behave like a BR. Additionally, we suppress breaks from BR inside
// of ruby frames. To determine if we're inside ruby, we have to rely
// 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.
if ( ll->LineIsEmpty() ||
aPresContext->CompatibilityMode() == eCompatibility_FullStandards ) {
// The line is logically empty; any whitespace is trimmed away.
//
// If this frame is going to terminate the line we know
@@ -119,17 +119,17 @@ BRFrame::Reflow(nsPresContext* aPresCont
// of the full line-height
// We also do this in strict mode because BR should act like a
// normal inline frame. That line-height is used is important
// here for cases where the line-height is less than 1.
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()));
}
else {
aMetrics.SetBlockStartAscent(aMetrics.BSize(wm) = 0);
}
@@ -139,17 +139,17 @@ BRFrame::Reflow(nsPresContext* aPresCont
// XXX This also fixes bug 10036!
// Warning: nsTextControlFrame::CalculateSizeStandard depends on
// the following line, see bug 228752.
// The code below in AddInlinePrefISize also adds 1 appunit to width
finalSize.ISize(wm) = 1;
}
// 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;
}
aStatus = NS_INLINE_BREAK | NS_INLINE_BREAK_AFTER |
NS_INLINE_MAKE_BREAK_TYPE(breakType);
ll->SetLineEndsInBR(true);
}
@@ -157,17 +157,17 @@ BRFrame::Reflow(nsPresContext* aPresCont
aStatus = NS_FRAME_COMPLETE;
}
aMetrics.SetSize(wm, finalSize);
aMetrics.SetOverflowAreasToDesiredBounds();
mAscent = aMetrics.BlockStartAscent();
- NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);
+ NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aMetrics);
}
/* virtual */ void
BRFrame::AddInlineMinISize(nsRenderingContext *aRenderingContext,
nsIFrame::InlineMinISizeData *aData)
{
if (!GetParent()->StyleContext()->ShouldSuppressLineBreak()) {
aData->ForceBreak();
--- a/layout/generic/nsBackdropFrame.cpp
+++ b/layout/generic/nsBackdropFrame.cpp
@@ -82,23 +82,23 @@ nsBackdropFrame::ComputeAutoSize(nsRende
aBorder.ISize(aWM) - aPadding.ISize(aWM);
}
return result;
}
/* 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;
}
--- a/layout/generic/nsBackdropFrame.h
+++ b/layout/generic/nsBackdropFrame.h
@@ -34,13 +34,13 @@ public:
const LogicalSize& aCBSize,
nscoord aAvailableISize,
const LogicalSize& aMargin,
const LogicalSize& aBorder,
const LogicalSize& aPadding,
bool aShrinkWrap) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
};
#endif // nsBackdropFrame_h___
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -932,30 +932,30 @@ AvailableSpaceShrunk(WritingMode aWM,
}
// Have we shrunk on either side?
return aNewAvailableSpace.IStart(aWM) > aOldAvailableSpace.IStart(aWM) ||
aNewAvailableSpace.IEnd(aWM) < aOldAvailableSpace.IEnd(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);
if (frame->GetParent()->GetContent() == frame->GetContent() &&
frame->GetParent()->GetType() != nsGkAtoms::canvasFrame) {
// We are a wrapped frame for the content (and the wrapper is not the
// canvas frame, whose size is not meaningful here).
// Use the container's dimensions, if they have been precomputed.
@@ -963,25 +963,25 @@ CalculateContainingBlockSizeForAbsolutes
// frame is fully reflowed and using the resulting dimensions, even
// if they're intrinsic.
// In fact we should be attaching absolute children to the outermost
// frame and not always sticking them in block frames.
// 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;
- }
- if (aLastRS != &aReflowState) {
+ aLastRS = aLastRS->mParentReflowInput;
+ }
+ 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);
nsMargin scrollbars(0,0,0,0);
if (scrollFrame) {
scrollbars =
scrollFrame->GetDesiredScrollbarSizes(aLastRS->mFrame->PresContext(),
aLastRS->mRenderingContext);
@@ -1016,99 +1016,99 @@ CalculateContainingBlockSizeForAbsolutes
}
return cbSize;
}
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.
int32_t ctc = 0; // We only use these if they are set (gLameReflowMetrics).
if (gLameReflowMetrics) {
start = PR_Now();
ctc = nsLineBox::GetCtorCount();
}
#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();
}
}
// See comment below about oldSize. Use *only* for the
// abs-pos-containing-block-size-change optimization!
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
// only when there are actually floats to manage. Otherwise things
// like tables will gain significant bloat.
bool needFloatManager = nsBlockFrame::BlockNeedsFloatManager(this);
if (needFloatManager)
autoFloatManager.CreateFloatManager(aPresContext);
// OK, some lines may be reflowed. Blow away any saved line cursor
// because we may invalidate the nondecreasing
// overflowArea.VisualOverflow().y/yMost invariant, and we may even
// delete the line with the line cursor.
ClearLineCursor();
- if (IsFrameTreeTooDeep(*reflowState, aMetrics, aStatus)) {
+ if (IsFrameTreeTooDeep(*reflowInput, aMetrics, aStatus)) {
return;
}
bool blockStartMarginRoot, blockEndMarginRoot;
IsMarginRoot(&blockStartMarginRoot, &blockEndMarginRoot);
// 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);
if (GetStateBits() & NS_BLOCK_NEEDS_BIDI_RESOLUTION)
static_cast<nsBlockFrame*>(FirstContinuation())->ResolveBidi();
if (RenumberLists(aPresContext)) {
AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
@@ -1127,17 +1127,17 @@ nsBlockFrame::Reflow(nsPresContext*
// overflow lines hanging around; block reflow depends on the
// overflow line lists being cleared out between reflow passes.
DrainOverflowLines();
// Handle paginated overflow (see nsContainerFrame.h)
nsOverflowAreas ocBounds;
nsReflowStatus ocStatus = NS_FRAME_COMPLETE;
if (GetPrevInFlow()) {
- ReflowOverflowContainerChildren(aPresContext, *reflowState, ocBounds, 0,
+ ReflowOverflowContainerChildren(aPresContext, *reflowInput, ocBounds, 0,
ocStatus);
}
// Now that we're done cleaning up our overflow container lists, we can
// give |state| its nsOverflowContinuationTracker.
nsOverflowContinuationTracker tracker(this, false);
state.mOverflowTracker = &tracker;
@@ -1145,26 +1145,26 @@ nsBlockFrame::Reflow(nsPresContext*
DrainPushedFloats();
nsOverflowAreas fcBounds;
nsReflowStatus fcStatus = NS_FRAME_COMPLETE;
ReflowPushedFloats(state, fcBounds, fcStatus);
// 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();
}
LazyMarkLinesDirty();
mState &= ~NS_FRAME_FIRST_REFLOW;
@@ -1196,17 +1196,17 @@ nsBlockFrame::Reflow(nsPresContext*
}
}
NS_MergeReflowStatusInto(&state.mReflowStatus, ocStatus);
NS_MergeReflowStatusInto(&state.mReflowStatus, fcStatus);
// 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);
}
if (!NS_FRAME_IS_FULLY_COMPLETE(state.mReflowStatus)) {
if (HasOverflowLines() || HasPushedFloats()) {
state.mReflowStatus |= NS_FRAME_REFLOW_NEXTINFLOW;
@@ -1230,25 +1230,25 @@ nsBlockFrame::Reflow(nsPresContext*
// contains a block (example: <LI>\n<P>... ). This is where
// the second case can happen.
if (HasOutsideBullet() && !mLines.empty() &&
(mLines.front()->IsBlock() ||
(0 == mLines.front()->BSize() &&
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,
"empty bullet took up space");
if (havePosition && !BulletIsEmpty()) {
// We have some lines to align the bullet with.
@@ -1263,17 +1263,17 @@ nsBlockFrame::Reflow(nsPresContext*
// Otherwise just leave the bullet where it is, up against our
// block-start padding.
}
CheckFloats(state);
// 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
// we typically do not know the true container size until we've reflowed all
// its children. So we use a dummy mContainerSize during reflow (see
// BlockReflowInput's constructor) and then fix up the positions of the
// lines here, once the final block size is known.
//
@@ -1300,17 +1300,17 @@ nsBlockFrame::Reflow(nsPresContext*
for (nsIFrame* f : *bulletList) {
f->MovePositionBy(physicalDelta);
}
}
}
}
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);
// Factor pushed float child bounds into the overflow area
aMetrics.mOverflowAreas.UnionWith(fcBounds);
// Let the absolutely positioned container reflow any absolutely positioned
// child frames that need to be reflowed, e.g., elements with a percentage
@@ -1328,32 +1328,32 @@ nsBlockFrame::Reflow(nsPresContext*
// When WillReflowAgainForClearance is true, we will reflow again without
// resetting the size. Because of this, we must not reflow our abs-pos children
// in that situation --- what we think is our "new size"
// will not be our real new size. This also happens to be more efficient.
WritingMode parentWM = aMetrics.GetWritingMode();
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,
// if we're dirty right now and interrupted; in that case we also need
// to mark them all with NS_FRAME_IS_DIRTY). Sadly, we can't do much
// better than that, because we don't really know what our size will be,
// and it might in fact not change on the followup reflow!
if (haveInterrupt && (GetStateBits() & NS_FRAME_IS_DIRTY)) {
absoluteContainer->MarkAllFramesDirty();
} else {
absoluteContainer->MarkSizeDependentFramesDirty();
}
} 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:
// Now we can assume that the padding edge hasn't moved.
// We need to reflow the absolutes if one of them depends on
// its placeholder position, or the containing block size in a
// direction in which the containing block size might have
// changed.
@@ -1362,34 +1362,34 @@ nsBlockFrame::Reflow(nsPresContext*
// when nsAbsoluteContainingBlock is logicalized
bool cbWidthChanged = aMetrics.Width() != oldSize.width;
bool isRoot = !GetContent()->GetParent();
// If isRoot and we have auto height, then we are the initial
// containing block and the containing block height is the
// 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),
containingBlockSize.GetPhysicalSize(parentWM));
AbsPosReflowFlags flags = AbsPosReflowFlags::eConstrainHeight;
if (cbWidthChanged) {
flags |= AbsPosReflowFlags::eCBWidthChanged;
}
if (cbHeightChanged) {
flags |= AbsPosReflowFlags::eCBHeightChanged;
}
// Setup the line cursor here to optimize line searching for
// calculating hypothetical position of absolutely-positioned
// 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);
ClearLineCursor();
}
}
FinishAndStoreOverflow(&aMetrics);
@@ -1447,17 +1447,17 @@ nsBlockFrame::Reflow(nsPresContext*
char buf[400];
snprintf_literal(buf,
": %lld elapsed (%lld per line) (%d lines; %d new lines)",
delta, perLineDelta, numLines, ectc - ctc);
printf("%s\n", buf);
}
#endif
- NS_FRAME_SET_TRUNCATION(aStatus, (*reflowState), aMetrics);
+ NS_FRAME_SET_TRUNCATION(aStatus, (*reflowInput), aMetrics);
}
bool
nsBlockFrame::CheckForCollapsedBEndMarginFromClearanceLine()
{
line_iterator begin = begin_lines();
line_iterator line = end_lines();
@@ -1472,36 +1472,36 @@ nsBlockFrame::CheckForCollapsedBEndMargi
if (line->HasClearance()) {
return true;
}
}
// not reached
}
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);
printf(": mBCoord=%d mIsBEndMarginRoot=%s mPrevBEndMargin=%d bp=%d,%d\n",
aState.mBCoord, aState.GetFlag(BRS_ISBENDMARGINROOT) ? "yes" : "no",
aState.mPrevBEndMargin.get(),
borderPadding.BStart(wm), borderPadding.BEnd(wm));
#endif
// Compute final inline size
LogicalSize finalSize(wm);
finalSize.ISize(wm) =
NSCoordSaturatingAdd(NSCoordSaturatingAdd(borderPadding.IStart(wm),
- aReflowState.ComputedISize()),
+ aReflowInput.ComputedISize()),
borderPadding.IEnd(wm));
// Return block-end margin information
// rbs says he hit this assertion occasionally (see bug 86947), so
// just set the margin to zero and we'll figure out why later
//NS_ASSERTION(aMetrics.mCarriedOutBEndMargin.IsZero(),
// "someone else set the margin");
nscoord nonCarriedOutBDirMargin = 0;
@@ -1520,99 +1520,99 @@ nsBlockFrame::ComputeFinalSize(const Ref
aMetrics.mCarriedOutBEndMargin = aState.mPrevBEndMargin;
} else {
aMetrics.mCarriedOutBEndMargin.Zero();
}
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)) {
// Include the float manager's state to properly account for the
// block-end margin of any floated elements; e.g., inside a table cell.
nscoord floatHeight =
aState.ClearFloats(blockEndEdgeOfChildren, NS_STYLE_CLEAR_BOTH,
nullptr, nsFloatManager::DONT_CLEAR_PUSHED_FLOATS);
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)) {
// Use the current height; continuations will take up the rest.
// 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);
// XXX It's pretty wrong that our bottom border still gets drawn on
// on its own on the last-in-flow, even if we ran out of height
// here. We need GetSkipSides to check whether we ran out of content
// height in the current frame, not whether it's last-in-flow.
}
// Don't carry out a block-end margin when our BSize is fixed.
aMetrics.mCarriedOutBEndMargin.Zero();
}
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.
aMetrics.mCarriedOutBEndMargin.Zero();
}
autoBSize += borderPadding.BStart(wm) + borderPadding.BEnd(wm);
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;
}
}
if (IS_TRUE_OVERFLOW_CONTAINER(this)) {
if (NS_FRAME_IS_NOT_COMPLETE(aState.mReflowStatus)) {
// Overflow containers can only be overflow complete.
// Note that auto height overflow containers have no normal children
NS_ASSERTION(finalSize.BSize(wm) == 0,
"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.
// The FragStretchBSizeProperty is our expected non-fragmented block-size
// we should stretch to (for align-self:stretch etc). In some fragmentation
// cases though, the last fragment (this frame since we're complete), needs
// to have extra size applied because earlier fragments consumed too much of
// our computed size due to overflowing their containing block. (E.g. this
@@ -1861,28 +1861,28 @@ nsBlockFrame::PrepareResizeReflow(BlockR
if (gDisableResizeOpt) {
tryAndSkipLines = false;
}
if (gNoisyReflow) {
if (!tryAndSkipLines) {
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
if (gNoisyReflow) {
IndentBy(stdout, gNoiseIndent);
ListTag(stdout);
printf(": trying to avoid marking all lines dirty\n");
}
@@ -1951,35 +1951,35 @@ nsBlockFrame::PrepareResizeReflow(BlockR
* |aDeltaBCoord| indicates how much it will later be slid (assuming it
* doesn't get marked dirty and reflowed entirely).
*/
void
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
if (!floatManager->HasAnyFloats())
return;
// Check the damage region recorded in the float damage.
if (floatManager->HasFloatDamage()) {
// Need to check mBounds *and* mCombinedArea to find intersections
// with aLine's floats
nscoord lineBCoordBefore = aLine->BStart() + aDeltaBCoord;
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);
nscoord lineBCoordCombinedBefore = overflow.BStart(wm) + aDeltaBCoord;
nscoord lineBCoordCombinedAfter = lineBCoordCombinedBefore +
overflow.BSize(wm);
bool isDirty = floatManager->IntersectsDamage(lineBCoordBefore,
@@ -1988,17 +1988,17 @@ nsBlockFrame::PropagateFloatDamage(Block
lineBCoordCombinedAfter);
if (isDirty) {
aLine->MarkDirty();
return;
}
}
// 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
// makes it difficult to check that. Therefore, we let the child block
// decide what it needs to reflow.
aLine->MarkDirty();
} else {
bool wasImpactedByFloat = aLine->IsImpactedByFloat();
@@ -2078,30 +2078,30 @@ nsBlockFrame::ReflowDirtyLines(BlockRefl
bool foundAnyClears = aState.mFloatBreakType != NS_STYLE_CLEAR_NONE;
bool willReflowAgain = false;
#ifdef DEBUG
if (gNoisyReflow) {
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;
lastLine->MarkDirty();
}
}
// the amount by which we will slide the current line if it is not
// dirty
@@ -2202,19 +2202,19 @@ nsBlockFrame::ReflowDirtyLines(BlockRefl
// If we have a constrained height (i.e., breaking columns/pages),
// and the distance to the bottom might have changed, then we need
// to reflow any line that might have floats in it, both because the
// breakpoints within those floats may have changed and because we
// might have to push/pull the floats in their entirety.
// 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();
}
if (!line->IsDirty()) {
// See if there's any reflow damage that requires that we mark the
// line dirty.
PropagateFloatDamage(aState, line, deltaBCoord);
@@ -2230,17 +2230,17 @@ nsBlockFrame::ReflowDirtyLines(BlockRefl
!GetNextInFlow() &&
NS_STYLE_TEXT_ALIGN_AUTO == StyleText()->mTextAlignLast;
uint8_t align = isLastLine ?
StyleText()->mTextAlign : StyleText()->mTextAlignLast;
if (line->mWritingMode.IsVertical() ||
!line->mWritingMode.IsBidiLTR() ||
!IsAlignedLeft(align,
- aState.mReflowState.mStyleVisibility->mDirection,
+ aState.mReflowInput.mStyleVisibility->mDirection,
StyleTextReset()->mUnicodeBidi, this)) {
line->MarkDirty();
}
}
if (needToRecoverState && line->IsDirty()) {
// We need to reconstruct the block-end margin only if we didn't
// reflow the previous line and we do need to reflow (or repair
@@ -2264,17 +2264,17 @@ nsBlockFrame::ReflowDirtyLines(BlockRefl
// Now repair the line and update |aState.mBCoord| by calling
// |ReflowLine| or |SlideLine|.
// If we're going to reflow everything again, then no need to reflow
// the dirty line ... unless the line has floats, in which case we'd
// better reflow it now to refresh its float cache, which may contain
// 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;
bool maybeReflowingForFirstTime =
line->IStart() == 0 && line->BStart() == 0 &&
line->ISize() == 0 && line->BSize() == 0;
// Compute the dirty lines "before" BEnd, after factoring in
@@ -2285,17 +2285,17 @@ nsBlockFrame::ReflowDirtyLines(BlockRefl
NS_ASSERTION(!willReflowAgain || !line->IsBlock(),
"Don't reflow blocks while willReflowAgain is true, reflow of block abs-pos children depends on this");
// Reflow the dirty line. If it's an incremental reflow, then force
// 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
// (e.g. because it has floats) gets marked dirty and reflowed again.
// in the next pass. This is important, see above.
}
if (line->HasFloats()) {
@@ -2465,20 +2465,20 @@ nsBlockFrame::ReflowDirtyLines(BlockRefl
// -- and we cannot have added more space for its first line to be
// pulled up into,
// -- it's an incremental reflow of a descendant
// -- and we didn't reflow any floats (so the available space
// didn't change)
// -- 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)) {
// We'll place lineIter at the last line of this block, so that
// nsBlockInFlowLineIterator::Next() will take us to the first
// line of my next-in-flow-chain. (But first, check that I
// have any lines -- if I don't, just bail out of this
// optimization.)
@@ -2570,17 +2570,17 @@ nsBlockFrame::ReflowDirtyLines(BlockRefl
} else {
// Now reflow it and any lines that it makes during it's reflow
// (we have to loop here because reflowing the line may cause a new
// line to be created; see SplitLine's callers for examples of
// when this happens).
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);
break;
}
DumpLine(aState, line, deltaBCoord, -1);
if (!keepGoing) {
@@ -2608,31 +2608,31 @@ nsBlockFrame::ReflowDirtyLines(BlockRefl
if (NS_FRAME_IS_NOT_COMPLETE(aState.mReflowStatus)) {
aState.mReflowStatus |= NS_FRAME_REFLOW_NEXTINFLOW;
} //XXXfr shouldn't set this flag when nextinflow has no lines
}
// 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");
if (!BulletIsEmpty()) {
// There are no lines so we have to fake up some y motion so that
// we end up with *some* height.
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 {
metrics.SetBlockStartAscent(metrics.BSize(wm));
}
}
RefPtr<nsFontMetrics> fm =
@@ -3124,20 +3124,20 @@ nsBlockFrame::ReflowBlockFrame(BlockRefl
nsIFrame* frame = aLine->mFirstChild;
if (!frame) {
NS_ASSERTION(false, "program error - unexpected empty line");
return;
}
// 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);
aState.mFloatBreakType = NS_STYLE_CLEAR_NONE;
}
// Clear past floats before the block if the clear style is not none
aLine->SetBreakTypeBefore(breakType);
@@ -3166,23 +3166,23 @@ nsBlockFrame::ReflowBlockFrame(BlockRefl
replacedBlock = frame;
}
// If our block-start margin was counted as part of some parent's block-start
// margin collapse, and we are being speculatively reflowed assuming this
// 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
// reflowed.
return;
}
}
if (treatWithClearance) {
@@ -3201,39 +3201,39 @@ nsBlockFrame::ReflowBlockFrame(BlockRefl
nscoord bStartMargin = 0;
bool mayNeedRetry = false;
bool clearedFloats = false;
if (applyBStartMargin) {
// Precompute the blocks block-start margin value so that we can get the
// 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.
// The availSpace here is irrelevant to our needs - all we want
// out if this setup is the block-start margin value which doesn't depend
// on the childs available space.
// XXX building a complete ReflowInput just to get the block-start
// 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) {
aState.mBCoord += aState.mPrevBEndMargin.get();
aState.mPrevBEndMargin.Zero();
}
// 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);
// XXX optimization; we could check the collapsing children to see if they are sure
// to require clearance, and so avoid retrying them
if (clearanceFrame) {
@@ -3259,17 +3259,17 @@ nsBlockFrame::ReflowBlockFrame(BlockRefl
aLine->SetHasClearance();
// Apply incoming margins
aState.mBCoord += aState.mPrevBEndMargin.get();
aState.mPrevBEndMargin.Zero();
// Compute the collapsed margin again, ignoring the incoming margin this time
mayNeedRetry = false;
- brc.ComputeCollapsedBStartMargin(reflowState,
+ brc.ComputeCollapsedBStartMargin(reflowInput,
&aState.mPrevBEndMargin,
clearanceFrame,
&mayNeedRetry);
}
}
// Temporarily advance the running Y value so that the
// GetAvailableSpace method will return the right available
@@ -3306,42 +3306,42 @@ nsBlockFrame::ReflowBlockFrame(BlockRefl
}
}
aLine->SetLineIsImpactedByFloat(false);
// 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
// need to get out of here now. (If we don't, most blocks will handle
// things fine, and report break-before, but zero-height blocks
// won't, and will thus make their parent overly-large and force
// *it* to be pushed in its entirety.)
// Doing this means that we also don't need to worry about the
// |availSpace.BSize(wm) += bStartMargin| below interacting with
// pushed floats (which force nscoord_MAX clearance) to cause a
// constrained block size to turn into an unconstrained one.
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());
NS_FRAME_SET_INCOMPLETE(aState.mReflowStatus);
}
return;
}
@@ -3352,46 +3352,46 @@ nsBlockFrame::ReflowBlockFrame(BlockRefl
if (NS_UNCONSTRAINEDSIZE != availSpace.BSize(wm)) {
availSpace.BSize(wm) += bStartMargin;
}
// construct the html reflow state for the block. ReflowBlock
// 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;
nsReflowStatus frameReflowStatus;
do {
if (floatAvailableSpace.mHasFloats) {
// Set if floatAvailableSpace.mHasFloats is true for any
// iteration of the loop.
aLine->SetLineIsImpactedByFloat(true);
}
// We might need to store into mDiscoveredClearance later if it's
// currently null; we want to overwrite any writes that
// 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) {
aState.mFloatManager->PushState(&floatManagerState);
}
if (mayNeedRetry) {
blockHtmlRS->mDiscoveredClearance = &clearanceFrame;
} else if (!applyBStartMargin) {
blockHtmlRS->mDiscoveredClearance =
- aState.mReflowState.mDiscoveredClearance;
+ aState.mReflowInput.mDiscoveredClearance;
}
frameReflowStatus = NS_FRAME_COMPLETE;
brc.ReflowBlock(availSpace, applyBStartMargin, aState.mPrevBEndMargin,
clearance, aState.IsAdjacentWithTop(),
aLine.get(), *blockHtmlRS, frameReflowStatus, aState);
// Now the block has a height. Using that height, get the
@@ -3452,21 +3452,21 @@ nsBlockFrame::ReflowBlockFrame(BlockRefl
if (!advanced && availSpace.IsEqualEdges(oldAvailSpace)) {
break;
}
// We need another reflow.
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
// reflowed.
return;
}
if (advanced) {
@@ -3476,17 +3476,17 @@ nsBlockFrame::ReflowBlockFrame(BlockRefl
applyBStartMargin = false;
bStartMargin = 0;
treatWithClearance = true; // avoid hitting test above
clearance = 0;
}
blockHtmlRS.reset();
blockHtmlRS.emplace(
- aState.mPresContext, aState.mReflowState, frame,
+ aState.mPresContext, aState.mReflowInput, frame,
availSpace.Size(wm).ConvertTo(frame->GetWritingMode(), wm));
} while (true);
if (mayNeedRetry && clearanceFrame) {
aState.mFloatManager->PopState(&floatManagerState);
aState.mBCoord = startingBCoord;
aState.mPrevBEndMargin = incomingMargin;
continue;
@@ -3507,17 +3507,17 @@ nsBlockFrame::ReflowBlockFrame(BlockRefl
#if defined(REFLOW_STATUS_COVERAGE)
RecordReflowStatus(true, frameReflowStatus);
#endif
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());
NS_FRAME_SET_INCOMPLETE(aState.mReflowStatus);
}
}
else {
// Note: line-break-after a block is a nop
@@ -3532,17 +3532,17 @@ nsBlockFrame::ReflowBlockFrame(BlockRefl
!floatAvailableSpace.mHasFloats;
nsCollapsingMargin collapsedBEndMargin;
nsOverflowAreas overflowAreas;
*aKeepReflowGoing = brc.PlaceBlock(*blockHtmlRS, forceFit, aLine.get(),
collapsedBEndMargin,
overflowAreas,
frameReflowStatus);
if (!NS_FRAME_IS_FULLY_COMPLETE(frameReflowStatus) &&
- ShouldAvoidBreakInside(aState.mReflowState)) {
+ ShouldAvoidBreakInside(aState.mReflowInput)) {
*aKeepReflowGoing = false;
}
if (aLine->SetCarriedOutBEndMargin(collapsedBEndMargin)) {
line_iterator nextLine = aLine;
++nextLine;
if (nextLine != end_lines()) {
nextLine->MarkPreviousMarginDirty();
@@ -3678,17 +3678,17 @@ nsBlockFrame::ReflowBlockFrame(BlockRefl
printf(": frame=");
nsFrame::ListTag(stdout, mFrame);
printf(" carriedOutBEndMargin=%d collapsedBEndMargin=%d => %d\n",
brc.GetCarriedOutBEndMargin().get(), collapsedBEndMargin.get(),
aState.mPrevBEndMargin.get());
#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.
aState.mReflowStatus = NS_INLINE_LINE_BREAK_BEFORE();
} else {
// Push the line that didn't fit and any lines that follow it
// to our next-in-flow.
PushLines(aState, aLine.prev());
@@ -3733,28 +3733,28 @@ nsBlockFrame::ReflowInlineFrames(BlockRe
nscoord availableSpaceHeight = 0;
do {
bool allowPullUp = true;
nsIFrame* forceBreakInFrame = nullptr;
int32_t forceBreakOffset = -1;
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
// these objects were large (1100 bytes on a 32 bit system).
// Then the nsLineLayout object was shrunk to 156 bytes by
// removing some internal buffers. Given that it is so much
// 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);
}
DoReflowInlineFrames(aState, lineLayout, aLine,
floatAvailableSpace, availableSpaceHeight,
&floatManagerState, aKeepReflowGoing,
&lineReflowStatus, allowPullUp);
@@ -3769,17 +3769,17 @@ nsBlockFrame::ReflowInlineFrames(BlockRe
// set forceBreakInFrame to null and we won't back up, which is
// correct.
forceBreakInFrame =
lineLayout.GetLastOptionalBreakPosition(&forceBreakOffset, &forceBreakPriority);
} else {
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();
}
// Don't allow pullup on a subsequent LINE_REFLOW_REDO_NO_PULL pass
allowPullUp = false;
} while (LINE_REFLOW_REDO_NO_PULL == lineReflowStatus);
@@ -3825,17 +3825,17 @@ nsBlockFrame::DoReflowInlineFrames(Block
// are impacted by floats.
if (aFloatAvailableSpace.mHasFloats)
aLine->SetLineIsImpactedByFloat(true);
#ifdef REALLY_NOISY_REFLOW
printf("nsBlockFrame::DoReflowInlineFrames %p impacted = %d\n",
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,
aState.ContainerSize());
nscoord iStart = lineRect.IStart(lineWM);
nscoord availISize = lineRect.ISize(lineWM);
nscoord availBSize;
@@ -3980,19 +3980,19 @@ nsBlockFrame::DoReflowInlineFrames(Block
// We should never hit this case if we've placed floats on the
// line; if we have, then the GetFloatAvailableSpace call is wrong
// and needs to happen after the caller pops the space manager
// state.
aState.mFloatManager->AssertStateMatches(aFloatStateBeforeLine);
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
// line; if we have, then the GetFloatAvailableSpace call is wrong
// and needs to happen after the caller pops the space manager
// state.
aState.mFloatManager->AssertStateMatches(aFloatStateBeforeLine);
aFloatAvailableSpace = aState.GetFloatAvailableSpace();
@@ -4249,17 +4249,17 @@ nsBlockFrame::SplitFloat(BlockReflowInpu
nextInFlow = aState.mPresContext->PresShell()->FrameConstructor()->
CreateContinuingFrame(aState.mPresContext, aFloat, this);
}
if (NS_FRAME_OVERFLOW_IS_INCOMPLETE(aFloatStatus)) {
nextInFlow->AddStateBits(NS_FRAME_IS_OVERFLOW_CONTAINER);
}
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 {
MOZ_ASSERT(floatStyle == NS_STYLE_FLOAT_RIGHT, "unexpected float side");
aState.mFloatManager->SetSplitRightFloatAcrossBreak();
}
aState.AppendPushedFloatChain(nextInFlow);
@@ -4419,25 +4419,25 @@ nsBlockFrame::PlaceLine(BlockReflowInput
//
// According to the CSS2 spec, section 12.6.1, the "marker" box
// participates in the height calculation of the list-item box's
// first line box.
//
// 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() &&
(!aLineLayout.IsZeroBSize() || (aLine == mLines.back()))) ||
(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,
"empty bullet took up space");
aLineLayout.AddBulletFrame(bullet, metrics);
addedBullet = true;
}
aLineLayout.VerticalAlignLine();
@@ -4538,28 +4538,28 @@ nsBlockFrame::PlaceLine(BlockReflowInput
// We already called |ShouldApplyBStartMargin|, and if we applied it
// then BRS_APPLYBSTARTMARGIN is set.
nscoord dy = aState.GetFlag(BRS_APPLYBSTARTMARGIN)
? -aState.mPrevBEndMargin.get() : 0;
newBCoord = aState.mBCoord + dy;
}
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;
}
// See if the line fit (our first line always does).
if (mLines.front() != aLine &&
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 {
// Push aLine and all of its children and anything else that
// follows to our next-in-flow.
PushTruncatedLine(aState, aLine, aKeepReflowGoing);
}
return true;
@@ -6046,17 +6046,17 @@ LogicalRect
nsBlockFrame::AdjustFloatAvailableSpace(BlockReflowInput& aState,
const LogicalRect& aFloatAvailableSpace,
nsIFrame* aFloatFrame)
{
// Compute the available inline size. By default, assume the inline
// 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() ) {
availISize = aState.ContentISize();
}
else {
// This quirk matches the one in BlockReflowInput::FlowAndPlaceFloat
// give tables only the available space
@@ -6090,20 +6090,20 @@ nsBlockFrame::ComputeFloatISize(BlockRef
{
NS_PRECONDITION(aFloat->GetStateBits() & NS_FRAME_OUT_OF_FLOW,
"aFloat must be an out-of-flow frame");
// Reflow the float.
LogicalRect availSpace = AdjustFloatAvailableSpace(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);
}
void
nsBlockFrame::ReflowFloat(BlockReflowInput& aState,
const LogicalRect& aAdjustedAvailableSpace,
@@ -6113,27 +6113,27 @@ nsBlockFrame::ReflowFloat(BlockReflowInp
bool aFloatPushedDown,
nsReflowStatus& aReflowStatus)
{
NS_PRECONDITION(aFloat->GetStateBits() & NS_FRAME_OUT_OF_FLOW,
"aFloat must be an out-of-flow frame");
// 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,
aAdjustedAvailableSpace.IStart(wm), aAdjustedAvailableSpace.BStart(wm),
aAdjustedAvailableSpace.ISize(wm), aAdjustedAvailableSpace.BSize(wm)
);
#endif
ReflowInput
- floatRS(aState.mPresContext, aState.mReflowState, aFloat,
+ floatRS(aState.mPresContext, aState.mReflowInput, aFloat,
aAdjustedAvailableSpace.Size(wm).ConvertTo(aFloat->GetWritingMode(),
wm));
// Normally the mIsTopOfPage state is copied from the parent reflow
// state. However, when reflowing a float, if we've placed other
// floats that force this float *down* or *narrower*, we should unset
// the mIsTopOfPage state.
// FIXME: This is somewhat redundant with the |isAdjacentWithTop|
@@ -6142,17 +6142,17 @@ nsBlockFrame::ReflowFloat(BlockReflowInp
// about adjacency with the top, so it seems misleading.
if (floatRS.mFlags.mIsTopOfPage &&
(aFloatPushedDown ||
aAdjustedAvailableSpace.ISize(wm) != aState.ContentISize())) {
floatRS.mFlags.mIsTopOfPage = false;
}
// 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();
nsIFrame* clearanceFrame = nullptr;
do {
nsCollapsingMargin margin;
bool mayNeedRetry = false;
@@ -7172,32 +7172,32 @@ nsBlockFrame::RenumberListsFor(nsPresCon
}
void
nsBlockFrame::ReflowBullet(nsIFrame* aBulletFrame,
BlockReflowInput& aState,
ReflowOutput& aMetrics,
nscoord aLineTop)
{
- const ReflowInput &rs = aState.mReflowState;
+ const ReflowInput &rs = aState.mReflowInput;
// Reflow the bullet now
WritingMode bulletWM = aBulletFrame->GetWritingMode();
LogicalSize availSize(bulletWM);
// Make up an inline-size since it doesn't really matter (XXX).
availSize.ISize(bulletWM) = aState.ContentISize();
availSize.BSize(bulletWM) = NS_UNCONSTRAINEDSIZE;
// 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
// the block.
// FIXME: aLineTop isn't actually set correctly by some callers, since
// they reposition the line.
LogicalRect floatAvailSpace =
aState.GetFloatAvailableSpaceWithState(aLineTop,
@@ -7217,31 +7217,31 @@ nsBlockFrame::ReflowBullet(nsIFrame* aBu
// IStart from floatAvailSpace gives us the content/float start edge
// in the current writing mode. Then we subtract out the start
// border/padding and the bullet's width and margin to offset the position.
WritingMode wm = rs.GetWritingMode();
// 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) -
aMetrics.ISize(wm);
// Approximate the bullets position; vertical alignment will provide
// the final vertical location. We pass our writing-mode here, because
// it may be different from the bullet frame's mode.
nscoord bStart = floatAvailSpace.BStart(wm);
aBulletFrame->SetRect(wm, LogicalRect(wm, iStart, bStart,
aMetrics.ISize(wm),
aMetrics.BSize(wm)),
aState.ContainerSize());
- aBulletFrame->DidReflow(aState.mPresContext, &aState.mReflowState,
+ aBulletFrame->DidReflow(aState.mPresContext, &aState.mReflowInput,
nsDidReflowStatus::FINISHED);
}
// This is used to scan frames for any float placeholders, add their
// floats to the list represented by aList, and remove the
// floats from whatever list they might be in. We don't search descendants
// that are float containing blocks. Floats that or not children of 'this'
// are ignored (they are not added to aList).
@@ -7393,18 +7393,18 @@ nsBlockFrame::BlockCanIntersectFloats(ns
// matter.
/* static */
nsBlockFrame::ReplacedElementISizeToClear
nsBlockFrame::ISizeToClearPastFloats(const BlockReflowInput& aState,
const LogicalRect& aFloatAvailableSpace,
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;
aState.ComputeReplacedBlockOffsetsForFloats(aFrame, aFloatAvailableSpace,
inlineStartOffset,
inlineEndOffset);
nscoord availISize = aState.mContentArea.ISize(wm) -
inlineStartOffset - inlineEndOffset;
@@ -7413,21 +7413,21 @@ nsBlockFrame::ISizeToClearPastFloats(con
// want to displace if the width won't compute to a value small enough
// to fit.
// All we really need here is the result of ComputeSize, and we
// could *almost* get that from an SizeComputationInput, except for the
// last argument.
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);
result.marginIStart = computedMargin.IStart(wm);
return result;
}
/* static */
@@ -7444,59 +7444,59 @@ nsBlockFrame::GetNearestAncestorBlock(ns
// Not a block. Check its parent next.
aCandidate = aCandidate->GetParent();
}
NS_NOTREACHED("Fell off frame tree looking for ancestor block!");
return nullptr;
}
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 ),
"overflow container must not have computedBSizeLeftOver");
aFinalSize.BSize(wm) =
NSCoordSaturatingAdd(NSCoordSaturatingAdd(aBorderPadding.BStart(wm),
computedBSizeLeftOver),
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?
NS_FRAME_SET_OVERFLOW_INCOMPLETE(*aStatus);
}
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;
}
// We don't fit and we consumed some of the computed height,
// so we should consume all the available height and then
// 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())
*aStatus |= NS_FRAME_REFLOW_NEXTINFLOW;
}
}
}
--- a/layout/generic/nsBlockFrame.h
+++ b/layout/generic/nsBlockFrame.h
@@ -236,40 +236,40 @@ public:
virtual nsresult GetPrefWidthTightBounds(nsRenderingContext* aContext,
nscoord* aX,
nscoord* aXMost) override;
/**
* 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.
* @param aContentBSize The block-size of content, precomputed outside of this
* function. The final block-size that is used in aMetrics will be set
* to either this or the available block-size, whichever is larger, in
* the case where our available block-size is constrained, and we
* overflow that available block-size.
* @param aBorderPadding The margins representing the border padding for block
* frames. Can be 0.
* @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,
mozilla::LogicalSize& aFinalSize,
nscoord aConsumed);
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType) override;
/**
* Move any frames on our overflow list to the end of our principal list.
@@ -409,17 +409,17 @@ protected:
nsLineBox* aLine, nscoord aDeltaBCoord);
void UpdateLineContainerSize(nsLineBox* aLine,
const nsSize& aNewContainerSize);
// 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);
void ComputeOverflowAreas(const nsRect& aBounds,
const nsStyleDisplay* aDisplay,
nscoord aBottomEdgeOfChildren,
nsOverflowAreas& aOverflowAreas);
--- a/layout/generic/nsBlockReflowContext.cpp
+++ b/layout/generic/nsBlockReflowContext.cpp
@@ -25,17 +25,17 @@ using namespace mozilla;
#undef NOISY_MAX_ELEMENT_SIZE
#undef REALLY_NOISY_MAX_ELEMENT_SIZE
#undef NOISY_BLOCK_DIR_MARGINS
#endif
nsBlockReflowContext::nsBlockReflowContext(nsPresContext* aPresContext,
const ReflowInput& aParentRS)
: mPresContext(aPresContext),
- mOuterReflowState(aParentRS),
+ mOuterReflowInput(aParentRS),
mSpace(aParentRS.GetWritingMode()),
mMetrics(aParentRS)
{
}
static nsIFrame* DescendIntoBlockLevelFrame(nsIFrame* aFrame)
{
nsIAtom* type = aFrame->GetType();
@@ -147,51 +147,51 @@ nsBlockReflowContext::ComputeCollapsedBS
// child blocks margin and so in so that we can look into
// it. For its margins to be computed we need to have a reflow
// state for it.
// We may have to construct an extra reflow state here if
// 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
if (kid->StyleDisplay()->mBreakType != NS_STYLE_CLEAR_NONE ||
!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) {
if (!setBlockIsEmpty && aBlockIsEmpty) {
setBlockIsEmpty = true;
*aBlockIsEmpty = false;
}
goto done;
@@ -227,29 +227,29 @@ nsBlockReflowContext::ReflowBlock(const
nscoord aClearance,
bool aIsAdjacentWithBStart,
nsLineBox* aLine,
ReflowInput& aFrameRS,
nsReflowStatus& aFrameReflowStatus,
BlockReflowInput& aState)
{
mFrame = aFrameRS.mFrame;
- mWritingMode = aState.mReflowState.GetWritingMode();
+ mWritingMode = aState.mReflowInput.GetWritingMode();
mContainerSize = aState.ContainerSize();
mSpace = aSpace;
if (!aIsAdjacentWithBStart) {
aFrameRS.mFlags.mIsTopOfPage = false; // make sure this is cleared
}
if (aApplyBStartMargin) {
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);
#endif
// Adjust the available size if it's constrained so that the
// child frame doesn't think it can reflow into its margin area.
if (mWritingMode.IsOrthogonalTo(mFrame->GetWritingMode())) {
@@ -289,27 +289,27 @@ nsBlockReflowContext::ReflowBlock(const
usedMargin.IStartEnd(mWritingMode),
mSpace.BSize(mWritingMode) -
usedMargin.BStartEnd(mWritingMode));
tI = space.LineLeft(mWritingMode, mContainerSize);
tB = mBCoord;
if ((mFrame->GetStateBits() & NS_BLOCK_FLOAT_MGR) == 0)
aFrameRS.mBlockDelta =
- mOuterReflowState.mBlockDelta + mBCoord - aLine->BStart();
+ mOuterReflowInput.mBlockDelta + mBCoord - aLine->BStart();
}
#ifdef DEBUG
mMetrics.ISize(mWritingMode) = nscoord(0xdeadbeef);
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)) {
if ((CRAZY_SIZE(mMetrics.ISize(mWritingMode)) ||
CRAZY_SIZE(mMetrics.BSize(mWritingMode))) &&
!mFrame->GetParent()->IsCrazySizeAssertSuppressed()) {
printf("nsBlockReflowContext: ");
nsFrame::ListTag(stdout, mFrame);
@@ -352,29 +352,29 @@ nsBlockReflowContext::ReflowBlock(const
}
/**
* Attempt to place the block frame within the available space. If
* it fits, apply inline-dir ("horizontal") positioning (CSS 10.3.3),
* 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,
nsOverflowAreas& aOverflowAreas,
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.
aBEndMarginResult.Zero();
}
nscoord backupContainingBlockAdvance = 0;
@@ -390,17 +390,17 @@ nsBlockReflowContext::PlaceBlock(const R
bool empty = 0 == mMetrics.BSize(parentWM) && aLine->CachedIsEmpty();
if (empty) {
// Collapse the block-end margin with the block-start margin that was
// already applied.
aBEndMarginResult.Include(mBStartMargin);
#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",
mBCoord, mSpace.BStart(mWritingMode));
#endif
// Section 8.3.1 of CSS 2.1 says that blocks with adjoining
// "top/bottom" (i.e. block-start/end) margins whose top margin collapses
// with their parent's top margin should have their top border-edge at the
@@ -426,17 +426,17 @@ nsBlockReflowContext::PlaceBlock(const R
// even if there's some sort of integer overflow that makes bCoord +
// mMetrics.BSize() appear to go beyond the available block size.
if (!empty && !aForceFit &&
mSpace.BSize(mWritingMode) != NS_UNCONSTRAINEDSIZE) {
nscoord bEnd = mBCoord -
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;
}
}
aLine->SetBounds(mWritingMode,
mICoord, mBCoord - backupContainingBlockAdvance,
mMetrics.ISize(mWritingMode), mMetrics.BSize(mWritingMode),
@@ -446,19 +446,19 @@ nsBlockReflowContext::PlaceBlock(const R
LogicalPoint logPos =
LogicalPoint(mWritingMode, mICoord, mBCoord).
ConvertTo(frameWM, mWritingMode,
mContainerSize - mMetrics.PhysicalSize());
// 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();
return true;
}
--- a/layout/generic/nsBlockReflowContext.h
+++ b/layout/generic/nsBlockReflowContext.h
@@ -32,21 +32,21 @@ public:
~nsBlockReflowContext() { }
void ReflowBlock(const mozilla::LogicalRect& aSpace,
bool aApplyBStartMargin,
nsCollapsingMargin& aPrevMargin,
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 */,
nsOverflowAreas& aOverflowAreas,
nsReflowStatus aReflowStatus);
nsCollapsingMargin& GetCarriedOutBEndMargin() {
return mMetrics.mCarriedOutBEndMargin;
@@ -78,17 +78,17 @@ public:
bool ComputeCollapsedBStartMargin(const ReflowInput& aRS,
nsCollapsingMargin* aMargin,
nsIFrame* aClearanceFrame,
bool* aMayNeedRetry,
bool* aIsEmpty = nullptr);
protected:
nsPresContext* mPresContext;
- const ReflowInput& mOuterReflowState;
+ const ReflowInput& mOuterReflowInput;
nsIFrame* mFrame;
mozilla::LogicalRect mSpace;
nscoord mICoord, mBCoord;
nsSize mContainerSize;
mozilla::WritingMode mWritingMode;
ReflowOutput mMetrics;
--- a/layout/generic/nsBulletFrame.cpp
+++ b/layout/generic/nsBulletFrame.cpp
@@ -626,34 +626,34 @@ nsBulletFrame::GetDesiredSize(nsPresCont
break;
}
aMetrics.SetSize(wm, finalSize);
}
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);
mPadding.IStart(wm) += NSToCoordRound(bp.IStart(wm) * inflation);
WritingMode lineWM = aMetrics.GetWritingMode();
LogicalMargin linePadding = mPadding.ConvertTo(lineWM, wm);
aMetrics.ISize(lineWM) += linePadding.IStartEnd(lineWM);
@@ -663,17 +663,17 @@ nsBulletFrame::Reflow(nsPresContext* aPr
// XXX this is a bit of a hack, we're assuming that no glyphs used for bullets
// overflow their font-boxes. It'll do for now; to fix it for real, we really
// should rewrite all the text-handling code here to use gfxTextRun (bug
// 397294).
aMetrics.SetOverflowAreasToDesiredBounds();
aStatus = NS_FRAME_COMPLETE;
- NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);
+ NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aMetrics);
}
/* virtual */ nscoord
nsBulletFrame::GetMinISize(nsRenderingContext *aRenderingContext)
{
WritingMode wm = GetWritingMode();
ReflowOutput metrics(wm);
DISPLAY_MIN_WIDTH(this, metrics.ISize(wm));
--- a/layout/generic/nsBulletFrame.h
+++ b/layout/generic/nsBulletFrame.h
@@ -73,17 +73,17 @@ public:
virtual nsIAtom* GetType() const override;
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) override;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
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;
void AddInlineMinISize(nsRenderingContext* aRenderingContext,
nsIFrame::InlineMinISizeData* aData) override;
void AddInlinePrefISize(nsRenderingContext* aRenderingContext,
nsIFrame::InlinePrefISizeData* aData) override;
--- a/layout/generic/nsCanvasFrame.cpp
+++ b/layout/generic/nsCanvasFrame.cpp
@@ -568,22 +568,22 @@ nsCanvasFrame::GetPrefISize(nsRenderingC
else
result = mFrames.FirstChild()->GetPrefISize(aRenderingContext);
return result;
}
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
aStatus = NS_FRAME_COMPLETE;
nsCanvasFrame* prevCanvasFrame = static_cast<nsCanvasFrame*>
(GetPrevInFlow());
if (prevCanvasFrame) {
@@ -598,59 +598,59 @@ nsCanvasFrame::Reflow(nsPresContext*
// reflowed but must not be lost until the canvas frame is destroyed.
mFrames.InsertFrames(this, nullptr, *overflow);
}
}
// 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
// is abs-pos or fixed-pos. We may have additional children which
// are placeholders for continuations of fixed-pos content, but those
// 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;
} else {
nsIFrame* kidFrame = mFrames.FirstChild();
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)) {
nsIFrame* nextFrame = kidFrame->GetNextInFlow();
NS_ASSERTION(nextFrame || aStatus & NS_FRAME_REFLOW_NEXTINFLOW,
"If it's incomplete and has no nif yet, it must flag a nif reflow.");
if (!nextFrame) {
nextFrame = aPresContext->PresShell()->FrameConstructor()->
@@ -680,40 +680,40 @@ nsCanvasFrame::Reflow(nsPresContext*
nsIFrame* viewport = PresContext()->GetPresShell()->GetRootFrame();
viewport->InvalidateFrame();
}
// Return our desired size. Normally it's what we're told, but
// 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);
aDesiredSize.SetOverflowAreasToDesiredBounds();
aDesiredSize.mOverflowAreas.UnionWith(
kidDesiredSize.mOverflowAreas + kidFrame->GetPosition());
}
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*
nsCanvasFrame::GetType() const
{
return nsGkAtoms::canvasFrame;
}
--- a/layout/generic/nsCanvasFrame.h
+++ b/layout/generic/nsCanvasFrame.h
@@ -67,17 +67,17 @@ public:
virtual void RemoveFrame(ChildListID aListID,
nsIFrame* aOldFrame) override;
#endif
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
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
{
return nsContainerFrame::IsFrameOfType(aFlags &
~(nsIFrame::eCanContainOverflowContainers));
}
// nsIAnonymousContentCreator
--- a/layout/generic/nsColumnSetFrame.cpp
+++ b/layout/generic/nsColumnSetFrame.cpp
@@ -150,40 +150,40 @@ nsColumnSetFrame::PaintColumnRule(nsRend
skipSides);
child = nextSibling;
nextSibling = nextSibling->GetNextSibling();
}
}
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
GetColumnGap(nsColumnSetFrame* aFrame,
const nsStyleColumn* aColStyle)
{
if (eStyleUnit_Normal == aColStyle->mColumnGap.GetUnit())
return aFrame->StyleFont()->mFont.size;
@@ -193,56 +193,56 @@ GetColumnGap(nsColumnSetFrame* aFrame
return colGap;
}
NS_NOTREACHED("Unknown gap type");
return 0;
}
nsColumnSetFrame::ReflowConfig
-nsColumnSetFrame::ChooseColumnStrategy(const ReflowInput& aReflowState,
+nsColumnSetFrame::ChooseColumnStrategy(const ReflowInput& aReflowInput,
bool aForceAuto = false,
nscoord aFeasibleBSize = NS_INTRINSICSIZE,
nscoord aInfeasibleBSize = 0)
{
nscoord knownFeasibleBSize = aFeasibleBSize;
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();
// 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);
int32_t numColumns = colStyle->mColumnCount;
// If column-fill is set to 'balance', then we want to balance the columns.
const bool isBalancing = colStyle->mColumnFill == NS_STYLE_COLUMN_FILL_BALANCE
&& !aForceAuto;
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;
}
}
if (cnt == MAX_NESTED_COLUMN_BALANCING) {
numColumns = 1;
}
}
@@ -338,34 +338,34 @@ nsColumnSetFrame::ChooseColumnStrategy(c
ReflowConfig config = { numColumns, colISize, expectedISizeLeftOver, colGap,
colBSize, isBalancing, knownFeasibleBSize,
knownInfeasibleBSize, computedBSize, consumedBSize };
return config;
}
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);
}
return feasible;
}
static void MoveChildTo(nsIFrame* aChild, LogicalPoint aOrigin,
@@ -445,17 +445,17 @@ nsColumnSetFrame::GetPrefISize(nsRenderi
// The multiplication above can make 'iSize' negative (integer overflow),
// so use std::max to protect against that.
result = std::max(iSize, colISize);
return result;
}
bool
nsColumnSetFrame::ReflowChildren(ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus,
const ReflowConfig& aConfig,
bool aUnboundedLastColumn,
nsCollapsingMargin* aCarriedOutBEndMargin,
ColumnBalanceData& aColData)
{
aColData.Reset();
bool allFit = true;
@@ -483,42 +483,42 @@ nsColumnSetFrame::ReflowChildren(ReflowO
// We need a way to do an incremental reflow and be sure availableHeight
// changes are taken account of! Right now I think block frames with absolute
// children might exit early.
//NS_ASSERTION(aKidReason != eReflowReason_Incremental,
// "incremental reflow should not have changed the balance height");
}
// 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;
nsIFrame* child = mFrames.FirstChild();
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
// columns by some tiny amount
// XXX when all of layout is converted to logical coordinates, we
// 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) -
availISize;
#ifdef DEBUG_roc
printf("*** childOrigin.iCoord = %d\n", childOrigin.I(wm));
#endif
}
@@ -534,17 +534,17 @@ nsColumnSetFrame::ReflowChildren(ReflowO
// might be pullable back to this column. We can't skip if it's the last child
// because we need to obtain the bottom margin. We can't skip
// if this is the last column and we're supposed to assign unbounded
// height to it, because that could change the available height from
// the last time we reflowed it and we should try to pull all the
// 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)
&& !NS_SUBTREE_DIRTY(child->GetNextSibling());
// If we need to pull up content from the prev-in-flow then this is not just
// a height shrink. The prev in flow will have set the dirty bit.
// Check the overflow rect YMost instead of just the child's content height. The child
// may have overflowing content that cares about the available height boundary.
@@ -592,80 +592,80 @@ nsColumnSetFrame::ReflowChildren(ReflowO
childContentBEnd = nsLayoutUtils::CalculateContentBEnd(wm, child);
#ifdef DEBUG_roc
printf("*** Skipping child #%d %p (incremental %d, resize block-size shrink %d): status = %d\n",
columnCount, (void*)child, skipIncremental, skipResizeBSizeShrink, aStatus);
#endif
} 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",
columnCount, (void*)child,availSize.BSize(wm));
#endif
// Note if the column's next in flow is not being changed by this incremental reflow.
// This may allow the current column to avoid trying to pull lines from the next column.
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);
// XXX it would be cool to consult the float manager for the
// previous block to figure out the region of floats from the
// previous column that extend into this column, and subtract
// that region from the new float manager. So you could stick a
// really big float in the first column and text in following
// columns would flow around it.
// 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;
#ifdef DEBUG_roc
printf("*** Reflowed child #%d %p: status = %d, desiredSize=%d,%d CarriedOutBEndMargin=%d\n",
columnCount, (void*)child, aStatus, kidDesiredSize.Width(), kidDesiredSize.Height(),
kidDesiredSize.mCarriedOutBEndMargin.get());
#endif
NS_FRAME_TRACE_REFLOW_OUT("Column::Reflow", aStatus);
*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) {
allFit = false;
}
if (childContentBEnd > availSize.BSize(wm)) {
aColData.mMaxOverflowingBSize = std::max(childContentBEnd,
aColData.mMaxOverflowingBSize);
@@ -710,18 +710,18 @@ nsColumnSetFrame::ReflowChildren(ReflowO
}
}
else if (kidNextInFlow->GetStateBits() & NS_FRAME_IS_OVERFLOW_CONTAINER) {
aStatus |= NS_FRAME_REFLOW_NEXTINFLOW;
reflowNext = true;
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
// no longer applies.
aColData.mHasExcessBSize = true;
}
if (columnCount >= aConfig.mBalanceColCount) {
@@ -778,37 +778,37 @@ nsColumnSetFrame::ReflowChildren(ReflowO
aColData.mMaxBSize = contentBEnd;
LogicalSize contentSize = LogicalSize(wm, contentRect.Size());
contentSize.BSize(wm) = std::max(contentSize.BSize(wm), contentBEnd);
mLastFrameStatus = aStatus;
// 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 {
contentSize.BSize(wm) = aConfig.mComputedBSize;
}
} else {
// We add the "consumed" block-size back in so that we're applying
// constraints to the correct bSize value, then subtract it again
// after we've finished with the min/max calculation. This prevents us from
// 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);
contentSize.BSize(wm) += borderPadding.BStartEnd(wm);
aDesiredSize.SetSize(wm, contentSize);
aDesiredSize.mOverflowAreas = overflowRects;
aDesiredSize.UnionOverflowAreasWithDesiredBounds();
@@ -856,34 +856,34 @@ nsColumnSetFrame::DrainOverflowColumns()
if (overflows) {
// We're already the parent for these frames, so no need to set
// their parent again.
mFrames.AppendFrames(nullptr, *overflows);
}
}
void
-nsColumnSetFrame::FindBestBalanceBSize(const ReflowInput& aReflowState,
+nsColumnSetFrame::FindBestBalanceBSize(const ReflowInput& aReflowInput,
nsPresContext* aPresContext,
ReflowConfig& aConfig,
ColumnBalanceData& aColData,
ReflowOutput& aDesiredSize,
nsCollapsingMargin& aOutMargin,
bool& aUnboundedLastColumn,
bool& aRunWasFeasible,
nsReflowStatus& aStatus)
{
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
// iteration.
// We set this flag when we detect that we may contain a frame
// that can break anywhere (thus foiling the linear decrease-by-one
// search)
@@ -975,17 +975,17 @@ nsColumnSetFrame::FindBestBalanceBSize(c
#ifdef DEBUG_roc
printf("*** nsColumnSetFrame::Reflow balancing choosing next guess=%d\n", nextGuess);
#endif
aConfig.mColMaxBSize = nextGuess;
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) {
// Looks like we had excess height when balancing, so we gave up on
// trying to balance.
break;
}
}
@@ -1004,43 +1004,43 @@ nsColumnSetFrame::FindBestBalanceBSize(c
aConfig.mColMaxBSize = aConfig.mKnownFeasibleBSize;
}
if (!skip) {
// If our height is unconstrained, make sure that the last column is
// allowed to have arbitrary height here, even though we were balancing.
// 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);
}
}
aRunWasFeasible = feasible;
}
void
nsColumnSetFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
// Don't support interruption in columns
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);
}
#ifdef DEBUG
nsFrameList::Enumerator oc(GetChildList(kOverflowContainersList));
for (; !oc.AtEnd(); oc.Next()) {
@@ -1050,75 +1050,75 @@ nsColumnSetFrame::Reflow(nsPresContext*
for (; !eoc.AtEnd(); eoc.Next()) {
MOZ_ASSERT(!IS_TRUE_OVERFLOW_CONTAINER(eoc.get()));
}
#endif
nsOverflowAreas ocBounds;
nsReflowStatus ocStatus = NS_FRAME_COMPLETE;
if (GetPrevInFlow()) {
- ReflowOverflowContainerChildren(aPresContext, aReflowState, ocBounds, 0,
+ ReflowOverflowContainerChildren(aPresContext, aReflowInput, ocBounds, 0,
ocStatus);
}
//------------ Handle Incremental Reflow -----------------
// If inline size is unconstrained, set aForceAuto to true to allow
// the columns to expand in the inline direction. (This typically
// 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
// what the average column height should be, because we can measure
// the heights of all the columns and sum them up. But don't do this
// if we have a next in flow because we don't want to suck all its
// content back here and then have to push it out again!
nsIFrame* nextInFlow = GetNextInFlow();
bool unboundedLastColumn = config.mIsBalancing && !nextInFlow;
nsCollapsingMargin carriedOutBottomMargin;
ColumnBalanceData colData;
colData.mHasExcessBSize = false;
- bool feasible = ReflowColumns(aDesiredSize, aReflowState, aStatus, config,
+ bool feasible = ReflowColumns(aDesiredSize, aReflowInput, aStatus, config,
unboundedLastColumn, &carriedOutBottomMargin,
colData);
// If we're not balancing, then we're already done, since we should have
// reflown all of our children, and there is no need for a binary search to
// determine proper column height.
if (config.mIsBalancing && !aPresContext->HasPendingInterrupt()) {
- FindBestBalanceBSize(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
nsColumnSetFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists)
{
DisplayBorderBackgroundOutline(aBuilder, aLists);
--- a/layout/generic/nsColumnSetFrame.h
+++ b/layout/generic/nsColumnSetFrame.h
@@ -21,17 +21,17 @@ class nsColumnSetFrame final : public ns
{
public:
NS_DECL_FRAMEARENA_HELPERS
explicit nsColumnSetFrame(nsStyleContext* aContext);
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
#ifdef DEBUG
virtual void SetInitialChildList(ChildListID aListID,
nsFrameList& aChildList) override;
virtual void AppendFrames(ChildListID aListID,
nsFrameList& aFrameList) override;
virtual void InsertFrames(ChildListID aListID,
@@ -43,17 +43,17 @@ public:
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
/**
* 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();
// if no children return nullptr
if (!frame)
return nullptr;
@@ -157,38 +157,38 @@ protected:
void Reset() {
mMaxBSize = mSumBSize = mLastBSize = mMaxOverflowingBSize = 0;
mHasExcessBSize = false;
}
};
bool ReflowColumns(ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aReflowStatus,
ReflowConfig& aConfig,
bool aLastColumnUnbounded,
nsCollapsingMargin* aCarriedOutBEndMargin,
ColumnBalanceData& aColData);
/**
* The basic reflow strategy is to call this function repeatedly to
* obtain specific parameters that determine the layout of the
* columns. This function will compute those parameters from the CSS
* 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
* frame, generated by ChooseColumnStrategy().
* @param aColData A data structure used to keep track of data needed between
* successive iterations of the balancing process.
* @param aDesiredSize The final output size of the column set frame (output
* of reflow procedure).
@@ -199,31 +199,31 @@ protected:
* balancing procedure to measure the height of all content in
* descendant frames of the column set.
* @param aRunWasFeasible An input/output parameter indicating whether or not
* the last iteration of the balancing loop was a feasible height to
* fit all content from descendant frames.
* @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,
ReflowOutput& aDesiredSize,
nsCollapsingMargin& aOutMargin,
bool& aUnboundedLastColumn,
bool& aRunWasFeasible,
nsReflowStatus& aStatus);
/**
* Reflow column children. Returns true iff the content that was reflowed
* fit into the mColMaxBSize.
*/
bool ReflowChildren(ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus,
const ReflowConfig& aConfig,
bool aLastColumnUnbounded,
nsCollapsingMargin* aCarriedOutBEndMargin,
ColumnBalanceData& aColData);
};
#endif // nsColumnSetFrame_h___
--- a/layout/generic/nsContainerFrame.cpp
+++ b/layout/generic/nsContainerFrame.cpp
@@ -990,41 +990,41 @@ nsContainerFrame::ComputeAutoSize(nsRend
}
return result;
}
void
nsContainerFrame::ReflowChild(nsIFrame* aKidFrame,
nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
const WritingMode& aWM,
const LogicalPoint& aPos,
const nsSize& aContainerSize,
uint32_t aFlags,
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!");
}
// Position the child frame and its view if requested.
if (NS_FRAME_NO_MOVE_FRAME != (aFlags & NS_FRAME_NO_MOVE_FRAME)) {
aKidFrame->SetPosition(aWM, aPos, aContainerSize);
}
if (0 == (aFlags & NS_FRAME_NO_MOVE_VIEW)) {
PositionFrameView(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.
if (!NS_INLINE_IS_BREAK_BEFORE(aStatus) &&
NS_FRAME_IS_FULLY_COMPLETE(aStatus) &&
!(aFlags & NS_FRAME_NO_DELETE_NEXT_IN_FLOW_CHILD)) {
nsIFrame* kidNextInFlow = aKidFrame->GetNextInFlow();
if (kidNextInFlow) {
@@ -1038,36 +1038,36 @@ nsContainerFrame::ReflowChild(nsIFrame*
}
//XXX temporary: hold on to a copy of the old physical version of
// ReflowChild so that we can convert callers incrementally.
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)) {
aKidFrame->SetPosition(nsPoint(aX, aY));
}
if (0 == (aFlags & NS_FRAME_NO_MOVE_VIEW)) {
PositionFrameView(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.
if (NS_FRAME_IS_FULLY_COMPLETE(aStatus) &&
!(aFlags & NS_FRAME_NO_DELETE_NEXT_IN_FLOW_CHILD)) {
nsIFrame* kidNextInFlow = aKidFrame->GetNextInFlow();
if (kidNextInFlow) {
// Remove all of the childs next-in-flows. Make sure that we ask
@@ -1131,17 +1131,17 @@ nsContainerFrame::PositionChildViews(nsI
* NS_FRAME_NO_MOVE_VIEW - don't position the frame's view. Set this if you
* don't want to automatically sync the frame and view
* NS_FRAME_NO_SIZE_VIEW - don't size the frame's view
*/
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,
uint32_t aFlags)
{
if (aWM.IsVerticalRL() || (!aWM.IsVertical() && !aWM.IsBidiLTR())) {
NS_ASSERTION(aContainerSize.width != NS_UNCONSTRAINEDSIZE,
"FinishReflowChild with unconstrained container width!");
@@ -1171,26 +1171,26 @@ nsContainerFrame::FinishReflowChild(nsIF
if (!(aFlags & NS_FRAME_NO_MOVE_VIEW) && curOrigin != newOrigin) {
if (!aKidFrame->HasView()) {
// If the frame has moved, then we need to make sure any child views are
// correctly positioned
PositionChildViews(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
// FinishReflowChild so that we can convert callers incrementally.
void
nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame,
nsPresContext* aPresContext,
const ReflowOutput& aDesiredSize,
- const ReflowInput* aReflowState,
+ const ReflowInput* aReflowInput,
nscoord aX,
nscoord aY,
uint32_t aFlags)
{
nsPoint curOrigin = aKidFrame->GetPosition();
if (NS_FRAME_NO_MOVE_FRAME != (aFlags & NS_FRAME_NO_MOVE_FRAME)) {
aKidFrame->SetRect(nsRect(aX, aY, aDesiredSize.Width(), aDesiredSize.Height()));
@@ -1210,36 +1210,36 @@ nsContainerFrame::FinishReflowChild(nsIF
(curOrigin.x != aX || curOrigin.y != aY)) {
if (!aKidFrame->HasView()) {
// If the frame has moved, then we need to make sure any child views are
// correctly positioned
PositionChildViews(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,
ChildFrameMerger aMergeFunc)
{
NS_PRECONDITION(aPresContext, "null pointer");
nsFrameList* overflowContainers = DrainExcessOverflowContainersList(aMergeFunc);
if (!overflowContainers) {
return; // nothing to reflow
}
nsOverflowContinuationTracker tracker(this, false, false);
- bool shouldReflowAllKids = aReflowState.ShouldReflowAllKids();
+ bool shouldReflowAllKids = aReflowInput.ShouldReflowAllKids();
for (nsIFrame* frame : *overflowContainers) {
if (frame->GetPrevInFlow()->GetParent() != GetPrevInFlow()) {
// frame's prevInFlow has moved, skip reflowing this frame;
// it will get reflowed once it's been placed
continue;
}
// If the available vertical height has changed, we need to reflow
@@ -1247,24 +1247,24 @@ nsContainerFrame::ReflowOverflowContaine
if (shouldReflowAllKids || NS_SUBTREE_DIRTY(frame)) {
// Get prev-in-flow
nsIFrame* prevInFlow = frame->GetPrevInFlow();
NS_ASSERTION(prevInFlow,
"overflow container frame must have a prev-in-flow");
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;
// Reflow
LogicalPoint pos(wm, prevRect.IStart(wm), 0);
ReflowChild(frame, aPresContext, desiredSize, frameState,
wm, pos, containerSize, aFlags, frameStatus, &tracker);
//XXXfr Do we need to override any shrinkwrap effects here?
@@ -1304,20 +1304,20 @@ nsContainerFrame::ReflowOverflowContaine
}
NS_MergeReflowStatusInto(&aStatus, frameStatus);
// At this point it would be nice to assert !frame->GetOverflowRect().IsEmpty(),
// but we have some unsplittable frames that, when taller than
// availableHeight will push zero-height content into a next-in-flow.
}
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);
}
}
void
nsContainerFrame::DisplayOverflowContainers(nsDisplayListBuilder* aBuilder,
--- a/layout/generic/nsContainerFrame.h
+++ b/layout/generic/nsContainerFrame.h
@@ -250,17 +250,17 @@ public:
* NS_FRAME_NO_MOVE_VIEW - don't position the frame's view. Set this if you
* don't want to automatically sync the frame and view
* NS_FRAME_NO_MOVE_FRAME - don't move the frame. aPos is ignored in this
* case. Also implies NS_FRAME_NO_MOVE_VIEW
*/
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,
uint32_t aFlags,
nsReflowStatus& aStatus,
nsOverflowContinuationTracker* aTracker = nullptr);
/**
@@ -280,39 +280,39 @@ public:
* case. Also implies NS_FRAME_NO_MOVE_VIEW
* NS_FRAME_NO_MOVE_VIEW - don't position the frame's view. Set this if you
* don't want to automatically sync the frame and view
* NS_FRAME_NO_SIZE_VIEW - don't size the frame's view
*/
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,
uint32_t aFlags);
//XXX temporary: hold on to a copy of the old physical versions of
// ReflowChild and FinishReflowChild so that we can convert callers
// incrementally.
void ReflowChild(nsIFrame* aKidFrame,
nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nscoord aX,
nscoord aY,
uint32_t aFlags,
nsReflowStatus& aStatus,
nsOverflowContinuationTracker* aTracker = nullptr);
static void FinishReflowChild(nsIFrame* aKidFrame,
nsPresContext* aPresContext,
const ReflowOutput& aDesiredSize,
- const ReflowInput* aReflowState,
+ const ReflowInput* aReflowInput,
nscoord aX,
nscoord aY,
uint32_t aFlags);
static void PositionChildViews(nsIFrame* aFrame);
// ==========================================================================
/* Overflow containers are continuation frames that hold overflow. They
@@ -383,17 +383,17 @@ public:
* continuations it makes, removing them from its child list, and
* making sure they are stored properly in the overflow container lists.
* The nsOverflowContinuationTracker helper class should be used for this.
*
* @param aFlags is passed through to ReflowChild
* @param aMergeFunc is passed to DrainExcessOverflowContainersList
*/
void ReflowOverflowContainerChildren(nsPresContext* aPresContext,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsOverflowAreas& aOverflowRects,
uint32_t aFlags,
nsReflowStatus& aStatus,
ChildFrameMerger aMergeFunc =
DefaultChildFrameMerge);
/**
* Move any frames on our overflow list to the end of our principal list.
--- a/layout/generic/nsFirstLetterFrame.cpp
+++ b/layout/generic/nsFirstLetterFrame.cpp
@@ -159,57 +159,57 @@ nsFirstLetterFrame::ComputeSize(nsRender
}
return nsContainerFrame::ComputeSize(aRenderingContext, aWM,
aCBSize, aAvailableISize, aMargin, aBorder, aPadding, aFlags);
}
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);
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);
if (NS_UNCONSTRAINEDSIZE != availSize.BSize(wm)) {
availSize.BSize(wm) -= bp.BStartEnd(wm);
}
WritingMode lineWM = aMetrics.GetWritingMode();
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.SetInFirstLetter(true);
ll.SetFirstLetterStyleOK(true);
kid->Reflow(aPresContext, kidMetrics, rs, aReflowStatus);
ll.EndLineReflow();
ll.SetInFirstLetter(false);
@@ -237,40 +237,40 @@ nsFirstLetterFrame::Reflow(nsPresContext
// area is in the overflow rect of the child textframe.
aMetrics.UnionOverflowAreasWithDesiredBounds();
ConsiderChildOverflow(aMetrics.mOverflowAreas, kid);
FinishAndStoreOverflow(&aMetrics);
}
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(),
"we're assuming we can mix sizes between lineWM and wm "
"since we shouldn't have orthogonal writing modes within "
"a line.");
aMetrics.ISize(lineWM) = ll->EndSpan(this) + bp.IStartEnd(wm);
ll->SetInFirstLetter(false);
nsLayoutUtils::SetBSizeFromFontMetrics(this, aMetrics, bp, lineWM, wm);
}
if (!NS_INLINE_IS_BREAK_BEFORE(aReflowStatus)) {
// 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) {
// Remove all of the childs next-in-flows
kidNextInFlow->GetParent()->DeleteNextInFlowChild(kidNextInFlow, true);
}
}
else {
@@ -289,17 +289,17 @@ nsFirstLetterFrame::Reflow(nsPresContext
// text that the first letter frame was made out of.
nsIFrame* continuation;
CreateContinuationForFloatingParent(aPresContext, kid,
&continuation, true);
}
}
}
- NS_FRAME_SET_TRUNCATION(aReflowStatus, aReflowState, aMetrics);
+ NS_FRAME_SET_TRUNCATION(aReflowStatus, aReflowInput, aMetrics);
}
/* virtual */ bool
nsFirstLetterFrame::CanContinueTextRun() const
{
// We can continue a text run through a first-letter frame.
return true;
}
@@ -393,17 +393,17 @@ nsFirstLetterFrame::DrainOverflowFrames(
nscoord
nsFirstLetterFrame::GetLogicalBaseline(WritingMode aWritingMode) const
{
return mBaseline;
}
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
// they have separate style contexts with initial values for all the
// properties that could trigger a call to GetSkipSides. Then again,
// it's not really an error to call GetSkipSides on any frame, so
// that's why we handle it properly.
return LogicalSides(eLogicalSideBitsAll);
--- a/layout/generic/nsFirstLetterFrame.h
+++ b/layout/generic/nsFirstLetterFrame.h
@@ -57,22 +57,22 @@ public:
nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorder,
const mozilla::LogicalSize& aPadding,
ComputeSizeFlags aFlags) override;
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,
bool inHint,
int32_t* outFrameContentOffset,
nsIFrame** outChildFrame) override;
nscoord GetFirstLetterBaseline() const { return mBaseline; }
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -405,17 +405,17 @@ private:
* Represents a flex item.
* Includes the various pieces of input that the Flexbox Layout Algorithm uses
* to resolve a flexible width.
*/
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,
nscoord aCrossMinSize, nscoord aCrossMaxSize,
const FlexboxAxisTracker& aAxisTracker);
// Simplified constructor, to be used only for generating "struts":
// (NOTE: This "strut" constructor uses the *container's* writing mode, which
@@ -739,17 +739,17 @@ public:
uint32_t GetNumAutoMarginsInAxis(AxisOrientationType aAxis) const;
// Once the main size has been resolved, should we bother doing layout to
// establish the cross size?
bool CanMainSizeInfluenceCrossSize(const FlexboxAxisTracker& aAxisTracker) const;
protected:
// Helper called by the constructor, to set mNeedsMinSizeAutoResolution:
- void CheckForMinSizeAuto(const ReflowInput& aFlexItemReflowState,
+ void CheckForMinSizeAuto(const ReflowInput& aFlexItemReflowInput,
const FlexboxAxisTracker& aAxisTracker);
// Our frame:
nsIFrame* const mFrame;
// Values that we already know in constructor: (and are hence mostly 'const')
const float mFlexGrow;
const float mFlexShrink;
@@ -1176,30 +1176,30 @@ nsFlexContainerFrame::IsHorizontal()
const FlexboxAxisTracker axisTracker(this, GetWritingMode());
return axisTracker.IsMainAxisHorizontal();
}
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();
flexGrow = stylePos->mFlexGrow;
flexShrink = stylePos->mFlexShrink;
}
WritingMode childWM = childRS.GetWritingMode();
@@ -1309,26 +1309,26 @@ nsFlexContainerFrame::GenerateFlexItemFo
}
// Static helper-functions for ResolveAutoFlexBasisAndMinSize():
// -------------------------------------------------------------
// Indicates whether the cross-size property is set to something definite.
// 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);
}
// If aFlexItem has a definite cross size, this function returns it, for usage
// (in combination with an intrinsic ratio) for resolving the item's main size
// or main min-size.
//
// The parameter "aMinSizeFallback" indicates whether we should fall back to
@@ -1337,38 +1337,38 @@ IsCrossSizeDefinite(const ReflowInput& a
// param is true, then this function is guaranteed to return a definite value
// (i.e. not NS_AUTOHEIGHT, excluding cases where huge sizes are involved).
//
// XXXdholbert the min-size behavior here is based on my understanding in
// http://lists.w3.org/Archives/Public/www-style/2014Jul/0053.html
// 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)
{
if (aFlexItem.IsStretched()) {
// Definite cross-size, imposed via 'align-self:stretch' & flex container.
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.
return NS_AUTOHEIGHT;
}
// Convenience function; returns a main-size, given a cross-size and an
// intrinsic ratio. The intrinsic ratio must not have 0 in its cross-axis
@@ -1393,58 +1393,58 @@ MainSizeFromAspectRatio(nscoord aCrossSi
// By "partially", I mean we don't consider the min-content size (but we do
// consider flex-basis, main max-size, and the intrinsic aspect ratio).
// The caller is responsible for computing & considering the min-content size
// in combination with the partially-resolved value that this function returns.
//
// 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(),
"only call for FlexItems that need min-size auto resolution");
nscoord minMainSize = nscoord_MAX; // Intentionally huge; we'll shrink it
// from here, w/ std::min().
// We need the smallest of:
// * 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
// the min-content height and min()'ing it with the value we return, which
// is equivalent to what would happen if we min()'d that at this point.
minMainSize = std::min(minMainSize, aFlexItem.GetFlexBaseSize());
}
// * 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);
}
// * if the item has no intrinsic aspect ratio, its min-content size:
// --- SKIPPING THIS IN THIS FUNCTION --- caller's responsibility.
// * if the item has an intrinsic aspect ratio, the width (height) calculated
// from the aspect ratio and any definite size constraints in the opposite
// dimension.
if (aAxisTracker.GetCrossComponent(aFlexItem.IntrinsicRatio()) != 0) {
// 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 =
MainSizeFromAspectRatio(crossSizeToUseWithRatio,
aFlexItem.IntrinsicRatio(), aAxisTracker);
minMainSize = std::min(minMainSize, minMainSizeFromRatio);
}
@@ -1452,32 +1452,32 @@ PartiallyResolveAutoMinSize(const FlexIt
}
// Resolves flex-basis:auto, using the given intrinsic ratio and the flex
// item's cross size. On success, updates the flex item with its resolved
// flex-basis and returns true. On failure (e.g. if the ratio is invalid or
// 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(),
"Should only be called to resolve an 'auto' flex-basis");
// If the flex item has ...
// - an intrinsic aspect ratio,
// - a [used] flex-basis of 'main-size' [auto?] [We have this, if we're here.]
// - a definite cross size
// then the flex base size is calculated from its inner cross size and the
// flex item’s intrinsic aspect ratio.
if (aAxisTracker.GetCrossComponent(aFlexItem.IntrinsicRatio()) != 0) {
// 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) {
// We have a definite cross-size
nscoord mainSizeFromRatio =
MainSizeFromAspectRatio(crossSizeToUseWithRatio,
aFlexItem.IntrinsicRatio(), aAxisTracker);
aFlexItem.SetFlexBaseSizeAndMainSize(mainSizeFromRatio);
@@ -1488,17 +1488,17 @@ ResolveAutoFlexBasisFromRatio(FlexItem&
}
// Note: If & when we handle "min-height: min-content" for flex items,
// we may want to resolve that in this function, too.
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
// is horizontal; width values should always be resolvable without reflow.)
const bool isMainSizeAuto = (!aAxisTracker.IsMainAxisHorizontal() &&
NS_AUTOHEIGHT == aFlexItem.GetFlexBaseSize());
const bool isMainMinSizeAuto = aFlexItem.NeedsMinSizeAutoResolution();
@@ -1513,17 +1513,17 @@ nsFlexContainerFrame::
// (e.g. using it as a contstraint when measuring our content in the
// main axis, or using it with the intrinsic ratio to obtain a main size).
// BEFORE WE DO THAT, we need let the item "pre-stretch" its cross size (if
// it's got 'align-self:stretch'), for a certain case where the spec says
// the stretched cross size is considered "definite". That case is if we
// 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) {
// XXXdholbert Maybe this should share logic with ComputeCrossSize()...
// Alternately, maybe tentative container cross size should be passed down.
nscoord containerCrossSize =
GET_CROSS_COMPONENT_LOGICAL(aAxisTracker, aAxisTracker.GetWritingMode(),
flexContainerRS->ComputedISize(),
@@ -1537,43 +1537,43 @@ nsFlexContainerFrame::
}
}
nscoord resolvedMinSize; // (only set/used if isMainMinSizeAuto==true)
bool minSizeNeedsToMeasureContent = false; // assume the best
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) {
// We don't have a usable aspect ratio, so we need to consider our
// min-content size as another candidate min-size, which we'll have to
// min() with the current resolvedMinSize.
// (If resolvedMinSize were already at 0, we could skip this measurement
// because it can't go any lower. But it's not 0, so we need it.)
minSizeNeedsToMeasureContent = true;
}
}
bool flexBasisNeedsToMeasureContent = false; // assume the best
if (isMainSizeAuto) {
- if (!ResolveAutoFlexBasisFromRatio(aFlexItem, aItemReflowState,
+ if (!ResolveAutoFlexBasisFromRatio(aFlexItem, aItemReflowInput,
aAxisTracker)) {
flexBasisNeedsToMeasureContent = true;
}
}
// Measure content, if needed (w/ intrinsic-width method or a reflow)
if (minSizeNeedsToMeasureContent || flexBasisNeedsToMeasureContent) {
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,
"flex-basis:auto should have been resolved in the "
"reflow state, for horizontal flexbox. It shouldn't need "
"special handling here");
} else {
// If this item is flexible (vertically), or if we're measuring the
@@ -1609,24 +1609,24 @@ nsFlexContainerFrame::
}
}
nscoord
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;
childRSForMeasuringHeight.Init(aPresContext);
if (aFlexItem.IsStretched()) {
childRSForMeasuringHeight.SetComputedWidth(aFlexItem.GetCrossSize());
childRSForMeasuringHeight.SetHResize(true);
@@ -1664,85 +1664,85 @@ nsFlexContainerFrame::
// Subtract border/padding in vertical axis, to get _just_
// the effective computed value of the "height" property.
nscoord childDesiredHeight = childDesiredSize.Height() -
childRSForMeasuringHeight.ComputedPhysicalBorderPadding().TopBottom();
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),
mCrossMaxSize(aCrossMaxSize),
mMainPosn(0),
mCrossSize(aTentativeCrossSize),
mCrossPosn(0),
mAscent(0),
mShareOfWeightSoFar(0.0f),
mIsFrozen(false),
mHadMinViolation(false),
mHadMaxViolation(false),
mHadMeasuringReflow(false),
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");
MOZ_ASSERT(mFrame->GetType() != nsGkAtoms::placeholderFrame,
"placeholder frames should not be treated as flex items");
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:
// (1) Use "-webkit-box-align" instead of "align-items" to determine the
// container's cross-axis alignment behavior.
// (2) Suppress the ability for flex items to override that with their own
// cross-axis alignment. (The legacy box model doesn't support this.)
// So, each FlexItem simply copies the container's converted "align-items"
// value and disregards their own "align-self" property.
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;
}
// XXX strip off the <overflow-position> bit until we implement that
mAlignSelf &= ~NS_STYLE_ALIGN_FLAG_BITS;
}
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,
"Someone else tried to resolve our auto margin");
}
}
}
#endif // DEBUG
@@ -1801,21 +1801,21 @@ FlexItem::FlexItem(nsIFrame* aChildFrame
"Should only make struts for children with 'visibility:collapse'");
MOZ_ASSERT(mFrame->GetType() != nsGkAtoms::placeholderFrame,
"placeholder frames should not be treated as flex items");
MOZ_ASSERT(!(mFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW),
"out-of-flow frames should not be treated as flex items");
}
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:
// (a) its computed value is "auto"
// (b) the "overflow" sub-property in the same axis (the main axis) has a
// computed value of "visible"
const nsStyleCoord& minSize = GET_MAIN_COMPONENT(aAxisTracker,
pos->mMinWidth,
@@ -3358,27 +3358,27 @@ AddNewFlexLineToList(LinkedList<FlexLine
aLines.insertBack(newLine);
}
return newLine;
}
void
nsFlexContainerFrame::GenerateFlexLines(
nsPresContext* aPresContext,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nscoord aContentBoxMainSize,
nscoord aAvailableBSizeForContent,
const nsTArray<StrutInfo>& aStruts,
const FlexboxAxisTracker& aAxisTracker,
LinkedList<FlexLine>& aLines)
{
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
// layout (with flipped axes) will still produce the correct result.
// Here, we declare a convenience bool that we'll pass when adding a new
// FlexLine or FlexItem, to make us insert it at the beginning of its list
// (so the list ends up reversed).
const bool shouldInsertAtFront = aAxisTracker.AreAxesInternallyReversed();
@@ -3396,18 +3396,18 @@ nsFlexContainerFrame::GenerateFlexLines(
wrapThreshold = aContentBoxMainSize;
// If the flex container doesn't have a definite content-box main-size
// (e.g. if main axis is vertical & 'height' is 'auto'), make sure we at
// least wrap when we hit its max main-size.
if (wrapThreshold == NS_UNCONSTRAINEDSIZE) {
const nscoord flexContainerMaxMainSize =
GET_MAIN_COMPONENT_LOGICAL(aAxisTracker, aAxisTracker.GetWritingMode(),
- aReflowState.ComputedMaxISize(),
- aReflowState.ComputedMaxBSize());
+ aReflowInput.ComputedMaxISize(),
+ aReflowInput.ComputedMaxBSize());
wrapThreshold = flexContainerMaxMainSize;
}
// Also: if we're column-oriented and paginating in the block dimension,
// we may need to wrap to a new flex line sooner (before we grow past the
// available BSize, potentially running off the end of the page).
if (aAxisTracker.IsColumnOriented() &&
@@ -3432,21 +3432,21 @@ nsFlexContainerFrame::GenerateFlexLines(
}
UniquePtr<FlexItem> item;
if (nextStrutIdx < aStruts.Length() &&
aStruts[nextStrutIdx].mItemIdx == itemIdxInContainer) {
// 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();
nscoord itemOuterHypotheticalMainSize =
item->GetOuterMainSize(aAxisTracker.GetMainAxis());
// Check if we need to wrap |item| to a new line
// (i.e. check if its outer hypothetical main size pushes our line over
@@ -3472,35 +3472,35 @@ nsFlexContainerFrame::GenerateFlexLines(
itemIdxInContainer++;
}
}
// Retrieves the content-box main-size of our flex container from the
// 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()) {
// Row-oriented --> our main axis is the inline axis, so our main size
// is our inline size (which should already be resolved).
// 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|.
// (i.e. the hypothetical main-size of the largest line)
static nscoord
GetLargestLineMainSize(const FlexLine* aFirstLine)
{
nscoord largestLineOuterSize = 0;
@@ -3516,24 +3516,24 @@ GetLargestLineMainSize(const FlexLine* a
* - the "tentative" main size, taken from the reflow state ("tentative"
* because it may be unconstrained or may run off the page).
* - the available BSize (needed if the main axis is the block axis).
* - the sizes of our lines of flex items.
*
* 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,
const FlexLine* aFirstLine,
nsReflowStatus& aStatus)
{
MOZ_ASSERT(aFirstLine, "null first line pointer");
@@ -3571,45 +3571,45 @@ ResolveFlexContainerMainSize(const Reflo
}
// Column-oriented case, with auto BSize:
// Resolve auto BSize to the largest FlexLine length, clamped to our
// computed min/max main-size properties.
// 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,
bool* aIsDefinite,
nsReflowStatus& aStatus)
{
MOZ_ASSERT(aIsDefinite, "outparam pointer must be non-null");
if (aAxisTracker.IsColumnOriented()) {
// Column-oriented --> our cross axis is the inline axis, so our cross size
// is our inline size (which should already be resolved).
// 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;
if (aAvailableBSizeForContent == NS_UNCONSTRAINEDSIZE ||
effectiveComputedBSize < aAvailableBSizeForContent) {
// Not in a fragmenting context, OR no need to fragment because we have
// more available BSize than we need. Either way, just use our fixed
// BSize. (Note that the reflow state has already done the appropriate
@@ -3632,18 +3632,18 @@ nsFlexContainerFrame::ComputeCrossSize(c
}
// Row-oriented case (cross axis is block axis), with auto BSize:
// Shrink-wrap our line(s), subject to our min-size / max-size
// constraints in that (block) axis.
// XXXdholbert Handle constrained-aAvailableBSizeForContent case here.
*aIsDefinite = false;
return NS_CSS_MINMAX(aSumLineCrossSizes,
- aReflowState.ComputedMinBSize(),
- aReflowState.ComputedMaxBSize());
+ aReflowInput.ComputedMinBSize(),
+ aReflowInput.ComputedMaxBSize());
}
void
FlexLine::PositionItemsInMainAxis(uint8_t aJustifyContent,
nscoord aContentBoxMainSize,
const FlexboxAxisTracker& aAxisTracker)
{
MainAxisPositionTracker mainAxisPosnTracker(aAxisTracker, this,
@@ -3675,78 +3675,78 @@ FlexLine::PositionItemsInMainAxis(uint8_
* flex container's content-box cross-start edge to its baseline), returns
* its actual physical ascent value (the distance from the *border-box* top
* edge to its baseline).
*/
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());
}
void
nsFlexContainerFrame::SizeItemInCrossAxis(
nsPresContext* aPresContext,
const FlexboxAxisTracker& aAxisTracker,
- ReflowInput& aChildReflowState,
+ ReflowInput& aChildReflowInput,
FlexItem& aItem)
{
if (aAxisTracker.IsCrossAxisHorizontal()) {
MOZ_ASSERT(aItem.HasIntrinsicRatio(),
"For now, caller's CanMainSizeInfluenceCrossSize check should "
"only allow us to get here for items with intrinsic ratio");
// XXXdholbert When we finish support for vertical writing-modes,
// (in bug 1079155 or a dependency), we'll relax the horizontal check in
// CanMainSizeInfluenceCrossSize, and this function will need to be able
// to measure the baseline & width (given our resolved height)
// of vertical-writing-mode flex items here.
// 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;
}
MOZ_ASSERT(!aItem.HadMeasuringReflow(),
"We shouldn't need more than one measuring reflow");
if (aItem.GetAlignSelf() == NS_STYLE_ALIGN_STRETCH) {
// This item's got "align-self: stretch", so we probably imposed a
// stretched computed height on it during its previous reflow. We're
// 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();
// XXXdholbert Once we do pagination / splitting, we'll need to actually
// handle incomplete childReflowStatuses. But for now, we give our kids
// unconstrained available height, which means they should always complete.
MOZ_ASSERT(NS_FRAME_IS_COMPLETE(childReflowStatus),
"We gave flex item unconstrained available height, so it "
"should be complete");
// 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
// -----------------------------------------------------
// Tentatively store the child's desired content-box cross-size.
// Note that childDesiredSize is the border-box size, so we have to
// subtract border & padding to get the content-box size.
// (Note that at this point in the code, we know our cross axis is vertical,
@@ -3803,35 +3803,35 @@ FlexLine::PositionItemsInCrossAxis(nscoo
// Back out to cross-axis edge of the line.
lineCrossAxisPosnTracker.ResetPosition();
}
}
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;
}
// We (and our children) can only depend on our ancestor's bsize if we have
// a percent-bsize, or if we're positioned and we have "block-start" and "block-end"
// 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() ||
(StyleDisplay()->IsAbsolutelyPositionedStyle() &&
eStyleUnit_Auto == bsize.GetUnit() &&
eStyleUnit_Auto != stylePos->mOffset.GetBStartUnit(wm) &&
eStyleUnit_Auto != stylePos->mOffset.GetBEndUnit(wm))) {
AddStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE);
@@ -3850,42 +3850,42 @@ nsFlexContainerFrame::Reflow(nsPresConte
if (!HasAnyStateBits(NS_STATE_FLEX_CHILDREN_REORDERED)) {
if (SortChildrenIfNeeded<IsOrderLEQ>()) {
AddStateBits(NS_STATE_FLEX_CHILDREN_REORDERED);
}
} else {
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);
}
}
// RAII class to clean up a list of FlexLines.
// Specifically, this removes each line from the list, deletes all the
// FlexItems in its list, and deletes the FlexLine.
@@ -3946,35 +3946,35 @@ public:
private:
const FrameProperties mItemProps;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
void
nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus,
nscoord aContentBoxMainSize,
nscoord aAvailableBSizeForContent,
nsTArray<StrutInfo>& aStruts,
const FlexboxAxisTracker& aAxisTracker)
{
aStatus = NS_FRAME_COMPLETE;
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);
for (FlexLine* line = lines.getFirst(); line; line = line->getNext()) {
line->ResolveFlexibleLengths(aContentBoxMainSize);
}
// Cross Size Determination - Flexbox spec section 9.4
@@ -3994,48 +3994,48 @@ nsFlexContainerFrame::DoFlexLayout(nsPre
// cross size in the reflow state. (For other flex items, it's OK
// (and cheaper) to impose our main size *after* the reflow state has
// been constructed, since the main size shouldn't influence anything
// about cross-size measurement until we actually reflow the child.)
sizeOverride.emplace(*item);
}
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:
line->ComputeCrossSizeAndBaseline(aAxisTracker);
sumLineCrossSizes += line->GetLineCrossSize();
}
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);
// Now that we know the cross size of each line (including
// "align-content:stretch" adjustments, from the CrossAxisPositionTracker
// constructor), we can create struts for any flex items with
// "visibility: collapse" (and restart flex layout).
if (aStruts.IsEmpty()) { // (Don't make struts if we already did)
@@ -4056,24 +4056,24 @@ nsFlexContainerFrame::DoFlexLayout(nsPre
if (firstLineBaselineOffset == nscoord_MIN) {
// No baseline-aligned items in line. Use sentinel value to prompt us to
// get baseline from the first FlexItem after we've reflowed it.
flexContainerAscent = nscoord_MIN;
} else {
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
// ==============================================
line->PositionItemsInMainAxis(justifyContent,
aContentBoxMainSize,
aAxisTracker);
@@ -4094,44 +4094,44 @@ nsFlexContainerFrame::DoFlexLayout(nsPre
if (lastLineBaselineOffset == nscoord_MIN) {
// No baseline-aligned items in line. Use sentinel value to prompt us to
// get baseline from the last FlexItem after we've reflowed it.
flexContainerAscent = nscoord_MIN;
} else {
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
// established baseline and decided whether bottom border-padding fits (if
// 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,
containerBP.IStart(flexWM),
containerBP.BStart(flexWM));
// Determine flex container's border-box size (used in positioning children):
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
// we know its final size and position.
for (const FlexLine* line = lines.getFirst(); line; line = line->getNext()) {
for (const FlexItem* item = line->GetFirstItem(); item;
item = item->getNext()) {
LogicalPoint framePos = aAxisTracker.LogicalPointFromFlexRelativePoint(
@@ -4164,23 +4164,23 @@ nsFlexContainerFrame::DoFlexLayout(nsPre
// wasn't in our previous "measuring" reflow), if they have a
// relative bsize.
if (!(item->Frame()->GetStateBits() &
NS_FRAME_CONTAINS_RELATIVE_BSIZE)) {
// Item has the correct size (and its children don't care that
// 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);
}
// If this is our first child and we haven't established a baseline for
// the container yet (i.e. if we don't have 'align-self: baseline' on any
// children), then use this child's baseline as the container's baseline.
if (item->Frame() == mFrames.FirstChild() &&
flexContainerAscent == nscoord_MIN) {
@@ -4224,20 +4224,20 @@ nsFlexContainerFrame::DoFlexLayout(nsPre
// any height, in which case we stay complete to avoid looping forever).
// NOTE: If we're auto-height, we allow our bottom border/padding to push us
// over the available height without requesting a continuation, for
// consistency with the behavior of "display:block" elements.
if (NS_FRAME_IS_COMPLETE(aStatus)) {
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 {
// We couldn't fit bottom border/padding, so we'll need a continuation.
NS_FRAME_SET_INCOMPLETE(aStatus);
}
}
@@ -4246,29 +4246,29 @@ nsFlexContainerFrame::DoFlexLayout(nsPre
// Overflow area = union(my overflow area, kids' overflow areas)
aDesiredSize.SetOverflowAreasToDesiredBounds();
for (nsIFrame* childFrame : mFrames) {
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, childFrame);
}
FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize,
- aReflowState, aStatus);
-
- NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize)
+ aReflowInput, aStatus);
+
+ 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);
if (NS_STYLE_POSITION_RELATIVE == aItem.Frame()->StyleDisplay()->mPosition) {
FrameProperties props = aItem.Frame()->Properties();
nsMargin* cachedOffsets = props.Get(nsIFrame::ComputedOffsetProperty());
MOZ_ASSERT(cachedOffsets,
"relpos previously-reflowed frame should've cached its offsets");
@@ -4280,58 +4280,58 @@ nsFlexContainerFrame::MoveFlexItemToFina
aItem.Frame()->SetPosition(outerWM, aFramePos, aContainerSize);
PositionFrameView(aItem.Frame());
PositionChildViews(aItem.Frame());
}
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
// and/or width, so we can set its resize flags accordingly.
bool didOverrideComputedWidth = false;
bool didOverrideComputedHeight = false;
// 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;
}
// Override reflow state's computed cross-size if either:
// - the item was stretched (in which case we're imposing a cross size)
// ...or...
// - the item it has an aspect ratio (in which case the cross-size that's
// currently in the reflow state is based on arithmetic involving a stale
// main-size value that we just stomped on above). (Note that we could handle
// this case using an AutoFlexItemMainSizeOverride, as we do elsewhere; but
// given that we *already know* the correct cross size to use here, it's
// cheaper to just directly set it instead of setting a frame property.)
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;
}
}
if (aItem.IsStretched() && !aAxisTracker.IsCrossAxisHorizontal()) {
// If this item's height is stretched, it's a relative height.
aItem.Frame()->AddStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE);
}
@@ -4343,49 +4343,49 @@ nsFlexContainerFrame::ReflowFlexItem(nsP
// earlier "measuring" reflow, then this upcoming reflow needs to be
// treated as a resize.
if (aItem.HadMeasuringReflow()) {
if (didOverrideComputedWidth) {
// (This is somewhat redundant, since the reflow state already
// 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);
// XXXdholbert Once we do pagination / splitting, we'll need to actually
// handle incomplete childReflowStatuses. But for now, we give our kids
// unconstrained available height, which means they should always
// complete.
MOZ_ASSERT(NS_FRAME_IS_COMPLETE(childReflowStatus),
"We gave flex item unconstrained available height, so it "
"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.
if (aItem.Frame() == mFrames.FirstChild()) {
aItem.SetAscent(childDesiredSize.BlockStartAscent());
}
}
--- a/layout/generic/nsFlexContainerFrame.h
+++ b/layout/generic/nsFlexContainerFrame.h
@@ -59,17 +59,17 @@ public:
// nsIFrame overrides
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nscoord
GetMinISize(nsRenderingContext* aRenderingContext) override;
virtual nscoord
GetPrefISize(nsRenderingContext* aRenderingContext) override;
virtual nsIAtom* GetType() const override;
@@ -97,17 +97,17 @@ protected:
*
* (The logic behind the division of work between Reflow and DoFlexLayout is
* as follows: DoFlexLayout() begins at the step that we have to jump back
* to, if we find any visibility:collapse children, and Reflow() does
* everything before that point.)
*/
void DoFlexLayout(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus,
nscoord aContentBoxMainSize,
nscoord aAvailableBSizeForContent,
nsTArray<StrutInfo>& aStruts,
const FlexboxAxisTracker& aAxisTracker);
/**
* Checks whether our child-frame list "mFrames" is sorted, using the given
@@ -134,102 +134,102 @@ protected:
* Before returning, this method also processes the FlexItem to resolve its
* flex basis (including e.g. auto-height) as well as to resolve
* "min-height:auto", via ResolveAutoFlexBasisAndMinSize(). (Basically, the
* returned FlexItem will be ready to participate in the "Resolve the
* Flexible Lengths" step of the Flex Layout Algorithm.)
*/
mozilla::UniquePtr<FlexItem> GenerateFlexItemForChild(nsPresContext* aPresContext,
nsIFrame* aChildFrame,
- const ReflowInput& aParentReflowState,
+ const ReflowInput& aParentReflowInput,
const FlexboxAxisTracker& aAxisTracker);
/**
* This method performs a "measuring" reflow to get the content height of
* aFlexItem.Frame() (treating it as if it had auto-height), & returns the
* resulting height.
* (Helper for ResolveAutoFlexBasisAndMinSize().)
*/
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
* on aFlexItem, if needed.
* (Helper for GenerateFlexItemForChild().)
*/
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
// FlexLines. These are returned by reference in |aLines|. Our actual
// 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,
bool* aIsDefinite,
nsReflowStatus& aStatus);
void SizeItemInCrossAxis(nsPresContext* aPresContext,
const FlexboxAxisTracker& aAxisTracker,
- ReflowInput& aChildReflowState,
+ ReflowInput& aChildReflowInput,
FlexItem& aItem);
/**
* Moves the given flex item's frame to the given LogicalPosition (modulo any
* relative positioning).
*
* This can be used in cases where we've already done a "measuring reflow"
* 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);
/**
* Helper-function to reflow a child frame, at its final position determined
* by flex layout.
*
* @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)
* @param aContainerSize The flex container's size (required by some methods
* that we call, to interpret aFramePos correctly).
*/
void ReflowFlexItem(nsPresContext* aPresContext,
const FlexboxAxisTracker& aAxisTracker,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
const FlexItem& aItem,
mozilla::LogicalPoint& aFramePos,
const nsSize& aContainerSize);
bool mChildrenHaveBeenReordered; // Have we ever had to reorder our kids
// to satisfy their 'order' values?
};
--- a/layout/generic/nsFloatManager.cpp
+++ b/layout/generic/nsFloatManager.cpp
@@ -557,43 +557,43 @@ nsFloatManager::FloatInfo::~FloatInfo()
nsAutoFloatManager::~nsAutoFloatManager()
{
// Restore the old float manager in the reflow state if necessary.
if (mNew) {
#ifdef NOISY_FLOATMANAGER
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);
}
#endif
delete mNew;
}
}
nsresult
nsAutoFloatManager::CreateFloatManager(nsPresContext *aPresContext)
{
// Create a new float manager and install it in the reflow
// 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;
}
--- a/layout/generic/nsFloatManager.h
+++ b/layout/generic/nsFloatManager.h
@@ -371,30 +371,30 @@ private:
* A helper class to manage maintenance of the float manager during
* nsBlockFrame::Reflow. It automatically restores the old float
* manager in the reflow state when the object goes out of scope.
*/
class nsAutoFloatManager {
using ReflowInput = mozilla::ReflowInput;
public:
- explicit nsAutoFloatManager(ReflowInput& aReflowState)
- : mReflowState(aReflowState),
+ explicit nsAutoFloatManager(ReflowInput& aReflowInput)
+ : mReflowInput(aReflowInput),
mNew(nullptr),
mOld(nullptr) {}
~nsAutoFloatManager();
/**
* Create a new float manager for the specified frame. This will
* `remember' the old float manager, and install the new float
* manager in the reflow state.
*/
nsresult
CreateFloatManager(nsPresContext *aPresContext);
protected:
- ReflowInput &mReflowState;
+ ReflowInput &mReflowInput;
nsFloatManager *mNew;
nsFloatManager *mOld;
};
#endif /* !defined(nsFloatManager_h_) */
--- a/layout/generic/nsFontInflationData.cpp
+++ b/layout/generic/nsFontInflationData.cpp
@@ -26,36 +26,36 @@ nsFontInflationData::FindFontInflationDa
const nsIFrame *bfc = FlowRootFor(aFrame);
NS_ASSERTION(bfc->GetStateBits() & NS_FRAME_FONT_INFLATION_FLOW_ROOT,
"should have found a flow root");
return bfc->Properties().Get(FontInflationDataProperty());
}
/* 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());
nsFontInflationData *data = bfcProps.Get(FontInflationDataProperty());
bool oldInflationEnabled;
nscoord oldNCAISize;
if (data) {
oldNCAISize = data->mNCAISize;
oldInflationEnabled = data->mInflationEnabled;
} else {
data = new nsFontInflationData(bfc);
bfcProps.Set(FontInflationDataProperty(), data);
oldNCAISize = -1;
oldInflationEnabled = true; /* not relevant */
}
- data->UpdateISize(aReflowState);
+ data->UpdateISize(aReflowInput);
if (oldInflationEnabled != data->mInflationEnabled)
return true;
return oldInflationEnabled &&
oldNCAISize != data->mNCAISize;
}
@@ -116,69 +116,69 @@ NearestCommonAncestorFirstInFlow(nsIFram
}
result = ancestors1[i1];
}
return result;
}
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;
for (nsIFrame *f = aDescendantFrame; f != ancestorFrame;
f = f->GetParent()->FirstInFlow()) {
frames.AppendElement(f);
}
// This ignores the inline-size contributions made by scrollbars, though in
// reality we don't have any scrollbars on the sorts of devices on
// which we use font inflation, so it's not a problem. But it may
// 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");
nsIFrame *firstInflatableDescendant =
FindEdgeInflatableFrameIn(bfc, eFromStart);
if (!firstInflatableDescendant) {
mTextAmount = 0;
mTextThreshold = 0; // doesn't matter
@@ -196,17 +196,17 @@ nsFontInflationData::UpdateISize(const R
// nca might differ significantly for the inline-size of bfc.
nsIFrame *nca = NearestCommonAncestorFirstInFlow(firstInflatableDescendant,
lastInflatableDescendant,
bfc);
while (!nca->IsContainerForFontSizeInflation()) {
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 .
nsIPresShell* presShell = bfc->PresContext()->PresShell();
uint32_t lineThreshold = presShell->FontSizeInflationLineThreshold();
nscoord newTextThreshold = (newNCAISize * lineThreshold) / 100;
if (mTextThreshold <= mTextAmount && mTextAmount < newTextThreshold) {
--- a/layout/generic/nsFontInflationData.h
+++ b/layout/generic/nsFontInflationData.h
@@ -16,17 +16,17 @@ class nsFontInflationData
public:
static nsFontInflationData* FindFontInflationDataFor(const nsIFrame *aFrame);
// 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);
bool InflationEnabled() {
if (mTextDirty) {
ScanText();
}
return mInflationEnabled;
@@ -38,17 +38,17 @@ public:
private:
explicit nsFontInflationData(nsIFrame* aBFCFrame);
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);
void MarkTextDirty() { mTextDirty = true; }
void ScanText();
// Scan text in the subtree rooted at aFrame. Increment mTextAmount
// by multiplying the number of characters found by the font size
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -1050,28 +1050,28 @@ nsIFrame::GetUsedPadding() const
NS_ERROR("Returning bogus 0-sized padding, because this padding "
"depends on layout & isn't cached!");
}
}
return padding;
}
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) &&
!(GetStateBits() & NS_FRAME_IS_OVERFLOW_CONTAINER)) {
return Sides();
}
// 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()) {
if (writingMode.IsVertical()) {
skip |= writingMode.IsVerticalLR() ? eSideBitsLeft : eSideBitsRight;
} else {
skip |= eSideBitsTop;
}
@@ -4928,61 +4928,61 @@ nsFrame::ShrinkWidthToFit(nsRenderingCon
result = prefWidth;
}
}
return result;
}
void
nsFrame::DidReflow(nsPresContext* aPresContext,
- const ReflowInput* aReflowState,
+ const ReflowInput* aReflowInput,
nsDidReflowStatus aStatus)
{
NS_FRAME_TRACE_MSG(NS_FRAME_TRACE_CALLS,
("nsFrame::DidReflow: aStatus=%d", static_cast<uint32_t>(aStatus)));
nsSVGEffects::InvalidateDirectRenderingObservers(this, nsSVGEffects::INVALIDATE_REFLOW);
if (nsDidReflowStatus::FINISHED == aStatus) {
mState &= ~(NS_FRAME_IN_REFLOW | NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY |
NS_FRAME_HAS_DIRTY_CHILDREN);
}
// Notify the percent bsize observer if there is a percent bsize.
// 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);
}
}
aPresContext->ReflowedFrame();
}
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);
}
void
nsFrame::ReflowAbsoluteFrames(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus,
bool aConstrainBSize)
{
if (HasAbsolutelyPositionedChildren()) {
nsAbsoluteContainingBlock* absoluteContainer = GetAbsoluteContainingBlock();
// Let the absolutely positioned container reflow any absolutely positioned
// child frames that need to be reflowed
@@ -4997,17 +4997,17 @@ nsFrame::ReflowAbsoluteFrames(nsPresCont
NS_ASSERTION(container, "Abs-pos children only supported on container frames for now");
nsRect containingBlock(0, 0, containingBlockWidth, containingBlockHeight);
AbsPosReflowFlags flags =
AbsPosReflowFlags::eCBWidthAndHeightChanged; // XXX could be optimized
if (aConstrainBSize) {
flags |= AbsPosReflowFlags::eConstrainHeight;
}
- absoluteContainer->Reflow(container, aPresContext, aReflowState, aStatus,
+ absoluteContainer->Reflow(container, aPresContext, aReflowInput, aStatus,
containingBlock, flags,
&aDesiredSize.mOverflowAreas);
}
}
void
nsFrame::PushDirtyBitToAbsoluteFrames()
{
@@ -5026,24 +5026,24 @@ nsFrame::CanContinueTextRun() const
// By default, a frame will *not* allow a text run to be continued
// through it.
return false;
}
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
nsFrame::CharacterDataChanged(CharacterDataChangeInfo* aInfo)
{
NS_NOTREACHED("should only be called for text frames");
return NS_OK;
}
@@ -6039,21 +6039,21 @@ nsFrame::UnionChildOverflow(nsOverflowAr
// Define the MAX_FRAME_DEPTH to be the ContentSink's MAX_REFLOW_DEPTH plus
// 4 for the frames above the document's frames:
// the Viewport, GFXScroll, ScrollPort, and Canvas
#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();
aMetrics.ClearSize();
aMetrics.SetBlockStartAscent(0);
aMetrics.mCarriedOutBEndMargin.Zero();
aMetrics.mOverflowAreas.Clear();
@@ -8713,18 +8713,18 @@ nsFrame::RefreshSizeCache(nsBoxLayoutSta
metrics->mBlockPrefSize.width =
GetPrefISize(rendContext) + bp.LeftRight();
metrics->mBlockMinSize.width =
GetMinISize(rendContext) + bp.LeftRight();
}
// 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,
metrics->mBlockPrefSize.width, NS_UNCONSTRAINEDSIZE);
metrics->mBlockMinSize.height = 0;
// ok we need the max ascent of the items on the line. So to do this
// ask the block for its line iterator. Get the max ascent.
@@ -8814,17 +8814,17 @@ nsFrame::GetXULPrefSize(nsBoxLayoutState
return size;
}
nsSize
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;
return size;
}
if (IsXULCollapsed())
return size;
@@ -8849,17 +8849,17 @@ nsFrame::GetXULMinSize(nsBoxLayoutState&
return size;
}
nsSize
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;
return size;
}
if (IsXULCollapsed())
return size;
@@ -8903,18 +8903,18 @@ nsFrame::GetXULBoxAscent(nsBoxLayoutStat
nsresult
nsFrame::DoXULLayout(nsBoxLayoutState& aState)
{
nsRect ourRect(mRect);
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);
if (rendContext) {
BoxReflow(aState, presContext, desiredSize, rendContext,
ourRect.x, ourRect.y, ourRect.width, ourRect.height);
@@ -8952,29 +8952,29 @@ nsFrame::DoXULLayout(nsBoxLayoutState& a
// Should we do this if IsXULCollapsed() is true?
LogicalSize size(GetLogicalSize(outerWM));
desiredSize.ISize(outerWM) = size.ISize(outerWM);
desiredSize.BSize(outerWM) = size.BSize(outerWM);
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),
ReflowInput::DUMMY_PARENT_REFLOW_STATE);
AddStateBits(NS_FRAME_IN_REFLOW);
// Set up a |reflowStatus| to pass into ReflowAbsoluteFrames
// (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);
}
nsSize oldSize(ourRect.Size());
FinishAndStoreOverflow(desiredSize.mOverflowAreas,
size.GetPhysicalSize(outerWM), &oldSize);
SyncLayout(aState);
@@ -9057,138 +9057,138 @@ nsFrame::BoxReflow(nsBoxLayoutState&
parentSize.height += margin.TopBottom();
if (parentSize.width != NS_INTRINSICSIZE)
parentSize.width += margin.LeftRight();
nsIFrame *parentFrame = GetParent();
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));
parentFrame->AddStateBits(savedState);
// 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?
// (It used to have a bogus parent, skipping all the boxes).
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;
-
- reflowState.mReflowDepth = aState.GetReflowDepth();
+ reflowInput.mCBReflowInput = parentRS;
+
+ 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)
// need to be constrained to the provided size and overflow as necessary.
// The one exception are block frames, because we need to know their
// natural height excluding any overflow area which may be caused by
// various CSS effects such as shadow or outline.
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));
}
}
// Box layout calls SetRect before XULLayout, whereas non-box layout
// calls SetRect after Reflow.
// XXX Perhaps we should be doing this by twiddling the rect back to
// mLastSize before calling Reflow and then switching it back, but
// 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
// for more details.
if (nsLayoutUtils::FontSizeInflationEnabled(aPresContext)) {
AddStateBits(NS_FRAME_IS_DIRTY);
}
}
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()) {
metrics->mAscent = 0;
} else {
if (aDesiredSize.BlockStartAscent() ==
ReflowOutput::ASK_FOR_BASELINE) {
if (!nsLayoutUtils::GetFirstLineBaseline(wm, this, &metrics->mAscent))
@@ -9486,38 +9486,38 @@ nsAdaptorAddIndents()
{
for(int32_t i=0; i < gIndent2; i++)
{
printf(" ");
}
}
void
-nsAdaptorPrintReason(ReflowInput& aReflowState)
+nsAdaptorPrintReason(ReflowInput& aReflowInput)
{
char* reflowReasonString;
- switch(aReflowState.reason)
+ switch(aReflowInput.reason)
{
case eReflowReason_Initial:
reflowReasonString = "initial";
break;
case eReflowReason_Resize:
reflowReasonString = "resize";
break;
case eReflowReason_Dirty:
reflowReasonString = "dirty";
break;
case eReflowReason_StyleChange:
reflowReasonString = "stylechange";
break;
case eReflowReason_Incremental:
{
- switch (aReflowState.reflowCommand->Type()) {
+ switch (aReflowInput.reflowCommand->Type()) {
case eReflowType_StyleChanged:
reflowReasonString = "incremental (StyleChanged)";
break;
case eReflowType_ReflowDirty:
reflowReasonString = "incremental (ReflowDirty)";
break;
default:
reflowReasonString = "incremental (Unknown)";
@@ -9604,23 +9604,23 @@ nsFrame::VerifyDirtyBitSet(const nsFrame
}
}
// Start Display Reflow
#ifdef DEBUG
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()
{
MOZ_COUNT_DTOR(DR_cookie);
nsFrame::DisplayReflowExit(mPresContext, mFrame, mMetrics, mStatus, mValue);
}
@@ -9743,17 +9743,17 @@ struct DR_State
void Init();
void AddFrameTypeInfo(nsIAtom* aFrameType,
const char* aFrameNameAbbrev,
const char* aFrameName);
DR_FrameTypeInfo* GetFrameTypeInfo(nsIAtom* aFrameType);
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);
bool GetToken(FILE* aFile,
char* aBuf,
size_t aBufSize);
DR_Rule* ParseRule(FILE* aFile);
void ParseRulesFile();
@@ -10213,22 +10213,22 @@ void DR_State::FindMatchingRule(DR_Frame
aNode.mDisplay = rule->mDisplay;
break;
}
}
}
}
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();
}
// find the parent tree node leaf
DR_FrameTreeNode* parentNode = nullptr;
@@ -10312,83 +10312,83 @@ CheckPixelError(nscoord aSize,
if ((aSize % aPixelToTwips) > 0) {
printf("VALUE %d is not a whole pixel \n", aSize);
}
}
}
static void DisplayReflowEnterPrint(nsPresContext* aPresContext,
nsIFrame* aFrame,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
DR_FrameTreeNode& aTreeNode,
bool aChanged)
{
if (aTreeNode.mDisplay) {
DR_state->DisplayFrameTypeInfo(aFrame, aTreeNode.mIndent);
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)
printf("dirty ");
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();
if (inFlow) {
printf("pif=%p ", (void*)inFlow);
}
inFlow = aFrame->GetNextInFlow();
if (inFlow) {
printf("nif=%p ", (void*)inFlow);
}
if (aChanged)
printf("CHANGED \n");
else
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;
}
void* nsFrame::DisplayLayoutEnter(nsIFrame* aFrame)
{
if (!DR_state->mInited) DR_state->Init();
if (!DR_state->mActive) return nullptr;
@@ -10570,17 +10570,17 @@ nsFrame::DisplayReflowShutdown()
delete DR_state;
DR_state = nullptr;
}
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);
}
}
/* static */ void*
ReflowInput::DisplayInitConstraintsEnter(nsIFrame* aFrame,
ReflowInput* aState,
nscoord aContainingBlockWidth,
nscoord aContainingBlockHeight,
@@ -10593,17 +10593,17 @@ ReflowInput::DisplayInitConstraintsEnter
if (!DR_state->mInited) DR_state->Init();
if (!DR_state->mActive) return nullptr;
DR_FrameTreeNode* treeNode = DR_state->CreateTreeNode(aFrame, aState);
if (treeNode && treeNode->mDisplay) {
DR_state->DisplayFrameTypeInfo(aFrame, treeNode->mIndent);
printf("InitConstraints parent=%p",
- (void*)aState->mParentReflowState);
+ (void*)aState->mParentReflowInput);
char width[16];
char height[16];
DR_state->PrettyUC(aContainingBlockWidth, width, 16);
DR_state->PrettyUC(aContainingBlockHeight, height, 16);
printf(" cb=%s,%s", width, height);
--- a/layout/generic/nsFrame.h
+++ b/layout/generic/nsFrame.h
@@ -329,35 +329,35 @@ public:
* to reflow all the children, but for some frame types it might result in
* over-reflow.)
*
* Note: if it's only the overflow rect(s) of a frame that need to be
* updated, then UpdateOverflow should be called instead of Reflow.
*/
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;
/**
* NOTE: aStatus is assumed to be already-initialized. The reflow statuses of
* any reflowed absolute children will be merged into aStatus; aside from
* that, this method won't modify aStatus.
*/
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);
/*
* If this frame is dirty, marks all absolutely-positioned children of this
* frame dirty. If this frame isn't dirty, or if there are no
* absolutely-positioned children, does nothing.
*
@@ -426,30 +426,30 @@ public:
//--------------------------------------------------
// Additional methods
// Helper function that tests if the frame tree is too deep; if it is
// it marks the frame as "unflowable", zeroes out the metrics, sets
// 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);
// Incorporate the child overflow areas into aOverflowAreas.
// If the child does not have a overflow, use the child area.
void ConsiderChildOverflow(nsOverflowAreas& aOverflowAreas,
nsIFrame* aChildFrame);
/**
* @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();
}
#ifdef DEBUG
/**
* Tracing method that writes a method enter/exit routine to the
* nspr log using the nsIFrame log module. The tracing is only
@@ -475,17 +475,17 @@ public:
* some custom behavior that requires changing how the outer "frame"
* XML container is dumped.
*/
virtual void DumpBaseRegressionData(nsPresContext* aPresContext, FILE* out, int32_t aIndent);
// 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);
static void* DisplayIntrinsicSizeEnter(nsIFrame* aFrame,
const char* aType);
static void DisplayReflowExit(nsPresContext* aPresContext,
nsIFrame* aFrame,
ReflowOutput& aMetrics,
@@ -764,25 +764,25 @@ public:
};
// Start Display Reflow Debugging
#ifdef DEBUG
struct DR_cookie {
DR_cookie(nsPresContext* aPresContext,
nsIFrame* aFrame,
- const mozilla::ReflowInput& aReflowState,
+ const mozilla::ReflowInput& aReflowInput,
mozilla::ReflowOutput& aMetrics,
nsReflowStatus& aStatus);
~DR_cookie();
void Change() const;
nsPresContext* mPresContext;
nsIFrame* mFrame;
- const mozilla::ReflowInput& mReflowState;
+ const mozilla::ReflowInput& mReflowInput;
mozilla::ReflowOutput& mMetrics;
nsReflowStatus& mStatus;
void* mValue;
};
struct DR_layout_cookie {
explicit DR_layout_cookie(nsIFrame* aFrame);
~DR_layout_cookie();
--- a/layout/generic/nsFrameSetFrame.cpp
+++ b/layout/generic/nsFrameSetFrame.cpp
@@ -100,17 +100,17 @@ public:
nsIFrame::Cursor& aCursor) override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
bool GetVisibility() { return mVisibility; }
void SetVisibility(bool aVisibility);
void SetColor(nscolor aColor);
void PaintBorder(DrawTarget* aDrawTarget, nsPoint aPt);
@@ -149,17 +149,17 @@ public:
#endif
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
protected:
explicit nsHTMLFramesetBlankFrame(nsStyleContext* aContext) : nsLeafFrame(aContext) {}
virtual ~nsHTMLFramesetBlankFrame();
virtual nscoord GetIntrinsicISize() override;
virtual nscoord GetIntrinsicBSize() override;
@@ -558,27 +558,27 @@ int32_t nsHTMLFramesetFrame::GetBorderWi
return mParentBorderWidth;
}
return nsPresContext::CSSPixelsToAppUnits(DEFAULT_BORDER_WIDTH_PX);
}
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());
desiredSize.ISize(wm) = area.ISize(wm);
desiredSize.BSize(wm) = area.BSize(wm);
}
} else {
LogicalSize size(wm);
@@ -677,32 +677,32 @@ nsHTMLFramesetFrame::BuildDisplayList(ns
aLists.Content()->AppendNewToTop(
new (aBuilder) nsDisplayEventReceiver(aBuilder, this));
}
}
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");
// Place and size the child
metrics.Width() = aSize.width;
metrics.Height() = aSize.height;
FinishReflowChild(aChild, aPresContext, metrics, nullptr, aOffset.x, aOffset.y, 0);
}
@@ -788,35 +788,35 @@ nscolor nsHTMLFramesetFrame::GetBorderCo
}
}
return GetBorderColor();
}
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
// that includes it within other content.) So measure firstTime by
// what we care about, which is whether we've processed the data we
// process below if firstTime is true.
MOZ_ASSERT(!mChildFrameborder == !mChildBorderColors);
bool firstTime = !!mChildFrameborder;
@@ -840,17 +840,17 @@ nsHTMLFramesetFrame::Reflow(nsPresContex
int32_t cols = 0;
ourContent->GetRowSpec(&rows, &rowSpecs);
ourContent->GetColSpec(&cols, &colSpecs);
// If the number of cols or rows has changed, the frame for the frameset
// will be re-created.
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;
}
CalculateRowCol(aPresContext, width, mNumCols, colSpecs, mColSizes.get());
CalculateRowCol(aPresContext, height, mNumRows, rowSpecs, mRowSizes.get());
UniquePtr<bool[]> verBordersVis; // vertical borders visibility
UniquePtr<nscolor[]> verBorderColors;
@@ -918,17 +918,17 @@ nsHTMLFramesetFrame::Reflow(nsPresContex
borderFrame->mPrevNeighbor = lastRow;
borderFrame->mNextNeighbor = cellIndex.y;
} else {
borderFrame = (nsHTMLFramesetBorderFrame*)mFrames.FrameAt(borderChildX);
borderFrame->mWidth = borderWidth;
borderChildX++;
}
nsSize borderSize(aDesiredSize.Width(), borderWidth);
- ReflowPlaceChild(borderFrame, aPresContext, aReflowState, offset, borderSize);
+ ReflowPlaceChild(borderFrame, aPresContext, aReflowInput, offset, borderSize);
borderFrame = nullptr;
offset.y += borderWidth;
} else {
if (cellIndex.x > 0) { // moved to next col in same row
if (0 == cellIndex.y) { // in 1st row
if (firstTime) { // create vertical border
RefPtr<nsStyleContext> pseudoStyleContext;
@@ -948,24 +948,24 @@ nsHTMLFramesetFrame::Reflow(nsPresContex
borderFrame->mPrevNeighbor = lastCol;
borderFrame->mNextNeighbor = cellIndex.x;
} else {
borderFrame = (nsHTMLFramesetBorderFrame*)mFrames.FrameAt(borderChildX);
borderFrame->mWidth = borderWidth;
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;
nsHTMLFramesetFrame* framesetFrame = do_QueryFrame(child);
nsSubDocumentFrame* subdocFrame;
if (framesetFrame) {
childVis = framesetFrame->mEdgeVisibility;
mChildBorderColors[childX] = framesetFrame->mEdgeColors;
@@ -1077,17 +1077,17 @@ nsHTMLFramesetFrame::Reflow(nsPresContex
}
aStatus = NS_FRAME_COMPLETE;
mDrag.UnSet();
aDesiredSize.SetOverflowAreasToDesiredBounds();
FinishAndStoreOverflow(&aDesiredSize);
- NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
+ NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
nsIAtom*
nsHTMLFramesetFrame::GetType() const
{
return nsGkAtoms::frameSetFrame;
}
@@ -1368,25 +1368,25 @@ void nsHTMLFramesetBorderFrame::SetColor
{
mColor = 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;
}
class nsDisplayFramesetBorder : public nsDisplayItem {
public:
nsDisplayFramesetBorder(nsDisplayListBuilder* aBuilder,
@@ -1583,24 +1583,24 @@ nscoord nsHTMLFramesetBlankFrame::GetInt
{
// No intrinsic height
return 0;
}
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;
}
class nsDisplayFramesetBlank : public nsDisplayItem {
public:
nsDisplayFramesetBlank(nsDisplayListBuilder* aBuilder,
--- a/layout/generic/nsFrameSetFrame.h
+++ b/layout/generic/nsFrameSetFrame.h
@@ -97,17 +97,17 @@ public:
nsIFrame::Cursor& aCursor) override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsIAtom* GetType() const override;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
virtual bool IsLeaf() const override;
@@ -145,17 +145,17 @@ protected:
void GenerateRowCol(nsPresContext* aPresContext,
nscoord aSize,
int32_t aNumSpecs,
const nsFramesetSpec* aSpecs,
nscoord* aValues,
nsString& aNewAttr);
virtual void GetDesiredSize(nsPresContext* aPresContext,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
ReflowOutput& aDesiredSize);
int32_t GetBorderWidth(nsPresContext* aPresContext,
bool aTakeForcingIntoAccount);
int32_t GetParentBorderWidth() { return mParentBorderWidth; }
void SetParentBorderWidth(int32_t aWidth) { mParentBorderWidth = aWidth; }
@@ -171,17 +171,17 @@ protected:
nscolor GetBorderColor();
nscolor GetBorderColor(nsIContent* aFrameContent);
bool GetNoResize(nsIFrame* aChildFrame);
void ReflowPlaceChild(nsIFrame* aChild,
nsPresContext* aPresContext,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsPoint& aOffset,
nsSize& aSize,
nsIntPoint* aCellIndex = 0);
bool CanResize(bool aVertical, bool aLeft);
bool CanChildResize(bool aVertical, bool aLeft, int32_t aChildX);
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -203,17 +203,17 @@ nsHTMLScrollFrame::GetType() const
HTML scrolling implementation
All other things being equal, we prefer layouts with fewer scrollbars showing.
*/
namespace mozilla {
struct MOZ_STACK_CLASS ScrollReflowInput {
- const ReflowInput& mReflowState;
+ const ReflowInput& mReflowInput;
nsBoxLayoutState mBoxState;
ScrollbarStyles mStyles;
nsMargin mComputedBorder;
// === Filled in by ReflowScrolledFrame ===
nsOverflowAreas mContentsOverflowAreas;
bool mReflowedContentsWithHScrollbar;
bool mReflowedContentsWithVScrollbar;
@@ -223,48 +223,48 @@ struct MOZ_STACK_CLASS ScrollReflowInput
nsSize mInsideBorderSize;
// Whether we decided to show the horizontal scrollbar
bool mShowHScrollbar;
// Whether we decided to show the vertical scrollbar
bool mShowVScrollbar;
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),
mStyles(aFrame->GetScrollbarStyles()) {
}
};
} // namespace mozilla
// XXXldb Can this go away?
static nsSize ComputeInsideBorderSize(ScrollReflowInput* aState,
const nsSize& aDesiredInsideBorderSize)
{
// 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();
- }
- nscoord contentHeight = aState->mReflowState.ComputedHeight();
+ aState->mReflowInput.ComputedPhysicalPadding().LeftRight();
+ }
+ nscoord contentHeight = aState->mReflowInput.ComputedHeight();
if (contentHeight == NS_UNCONSTRAINEDSIZE) {
contentHeight = aDesiredInsideBorderSize.height -
- aState->mReflowState.ComputedPhysicalPadding().TopBottom();
- }
-
- contentWidth = aState->mReflowState.ApplyMinMaxWidth(contentWidth);
- contentHeight = aState->mReflowState.ApplyMinMaxHeight(contentHeight);
- return nsSize(contentWidth + aState->mReflowState.ComputedPhysicalPadding().LeftRight(),
- contentHeight + aState->mReflowState.ComputedPhysicalPadding().TopBottom());
+ aState->mReflowInput.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
GetScrollbarMetrics(nsBoxLayoutState& aState, nsIFrame* aBox, nsSize* aMin,
nsSize* aPref, bool aVertical)
{
NS_ASSERTION(aState.GetRenderingContext(),
"Must have rendering context in layout state for size "
@@ -433,39 +433,39 @@ nsHTMLScrollFrame::TryLayout(ScrollReflo
// (See bug 1175509.)
bool
nsHTMLScrollFrame::ScrolledContentDependsOnHeight(ScrollReflowInput* aState)
{
// Return true if ReflowScrolledFrame is going to do something different
// 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
nsHTMLScrollFrame::ReflowScrolledFrame(ScrollReflowInput* aState,
bool aAssumeHScroll,
bool aAssumeVScroll,
ReflowOutput* aMetrics,
bool aFirstPass)
{
WritingMode wm = mHelper.mScrolledFrame->GetWritingMode();
// 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);
-
- nscoord computedBSize = aState->mReflowState.ComputedBSize();
- nscoord computedMinBSize = aState->mReflowState.ComputedMinBSize();
- nscoord computedMaxBSize = aState->mReflowState.ComputedMaxBSize();
+ aState->mReflowInput.ComputedISize() + padding.IStartEnd(wm);
+
+ nscoord computedBSize = aState->mReflowInput.ComputedBSize();
+ nscoord computedMinBSize = aState->mReflowInput.ComputedMinBSize();
+ nscoord computedMaxBSize = aState->mReflowInput.ComputedMaxBSize();
if (!ShouldPropagateComputedBSizeToScrolledContent()) {
computedBSize = NS_UNCONSTRAINEDSIZE;
computedMinBSize = 0;
computedMaxBSize = NS_UNCONSTRAINEDSIZE;
}
if (wm.IsVertical()) {
if (aAssumeVScroll) {
@@ -508,58 +508,58 @@ nsHTMLScrollFrame::ReflowScrolledFrame(S
availISize = std::max(0, availISize - vScrollbarPrefSize.width);
}
}
nsPresContext* presContext = PresContext();
// 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
// reflect our assumptions while we reflow the child.
bool didHaveHorizontalScrollbar = mHelper.mHasHorizontalScrollbar;
bool didHaveVerticalScrollbar = mHelper.mHasVerticalScrollbar;
mHelper.mHasHorizontalScrollbar = aAssumeHScroll;
mHelper.mHasVerticalScrollbar = aAssumeVScroll;
nsReflowStatus status;
// No need to pass a true container-size to ReflowChild or
// FinishReflowChild, because it's only used there when positioning
// 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;
mHelper.mHasVerticalScrollbar = didHaveVerticalScrollbar;
// Don't resize or position the view (if any) because we're going to resize
// it to the correct size anyway in PlaceScrollArea. Allowing it to
// resize here would size it to the natural height of the frame,
// 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);
// XXX Some frames (e.g., nsPluginFrame, nsFrameFrame, nsTextFrame) don't bother
// setting their mOverflowArea. This is wrong because every frame should
// always set mOverflowArea. In fact nsPluginFrame and nsFrameFrame don't
// support the 'outline' property because of this. Rather than fix the world
// right now, just fix up the overflow area if necessary. Note that we don't
@@ -830,38 +830,38 @@ GetBrowserRoot(nsIContent* aContent)
}
return nullptr;
}
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)
state.mStyles.mVertical = NS_STYLE_OVERFLOW_HIDDEN;
if (!mHelper.mHScrollbarBox || mHelper.mNeverHasHorizontalScrollbar)
state.mStyles.mHorizontal = NS_STYLE_OVERFLOW_HIDDEN;
//------------ Handle Incremental Reflow -----------------
bool reflowHScrollbar = true;
bool reflowVScrollbar = true;
bool reflowScrollCorner = true;
- if (!aReflowState.ShouldReflowAllKids()) {
+ if (!aReflowInput.ShouldReflowAllKids()) {
#define NEEDS_REFLOW(frame_) \
((frame_) && NS_SUBTREE_DIRTY(frame_))
reflowHScrollbar = NEEDS_REFLOW(mHelper.mHScrollbarBox);
reflowVScrollbar = NEEDS_REFLOW(mHelper.mVScrollbarBox);
reflowScrollCorner = NEEDS_REFLOW(mHelper.mScrollCornerBox) ||
NEEDS_REFLOW(mHelper.mResizerBox);
@@ -879,18 +879,18 @@ nsHTMLScrollFrame::Reflow(nsPresContext*
}
}
nsRect oldScrollAreaBounds = mHelper.mScrollPort;
nsRect oldScrolledAreaBounds =
mHelper.mScrolledFrame->GetScrollableOverflowRectRelativeToParent();
nsPoint oldScrollPosition = mHelper.GetScrollPosition();
- state.mComputedBorder = aReflowState.ComputedPhysicalBorderPadding() -
- aReflowState.ComputedPhysicalPadding();
+ state.mComputedBorder = aReflowInput.ComputedPhysicalBorderPadding() -
+ aReflowInput.ComputedPhysicalPadding();
ReflowContents(&state, aDesiredSize);
// Restore the old scroll position, for now, even if that's not valid anymore
// because we changed size. We'll fix it up in a post-reflow callback, because
// our current size may only be temporary (e.g. we're compute XUL desired sizes).
PlaceScrollArea(state, oldScrollPosition);
if (!mHelper.mPostedReflowCallback) {
@@ -935,30 +935,30 @@ nsHTMLScrollFrame::Reflow(nsPresContext*
aDesiredSize.SetOverflowAreasToDesiredBounds();
if (mHelper.IsIgnoringViewportClipping()) {
aDesiredSize.mOverflowAreas.UnionWith(
state.mContentsOverflowAreas + mHelper.mScrolledFrame->GetPosition());
}
mHelper.UpdateSticky();
- FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize, aReflowState, aStatus);
+ FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize, aReflowInput, aStatus);
if (!InInitialReflow() && !mHelper.mHadNonInitialReflow) {
mHelper.mHadNonInitialReflow = true;
}
if (mHelper.mIsRoot && !oldScrolledAreaBounds.IsEqualEdges(newScrolledAreaBounds)) {
mHelper.PostScrolledAreaEvent();
}
mHelper.UpdatePrevScrolledRect();
aStatus = NS_FRAME_COMPLETE;
- NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
+ NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
mHelper.PostOverflowEvent();
}
////////////////////////////////////////////////////////////////////////////////
#ifdef DEBUG_FRAME_DUMP
nsresult
--- a/layout/generic/nsGfxScrollFrame.h
+++ b/layout/generic/nsGfxScrollFrame.h
@@ -698,17 +698,17 @@ public:
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
virtual nsresult GetXULPadding(nsMargin& aPadding) override;
virtual bool IsXULCollapsed() override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override {
return mHelper.ComputeCustomOverflow(aOverflowAreas);
}
// Called to set the child frames. We typically have three: the scroll area,
// the vertical scrollbar, and the horizontal scrollbar.
@@ -1154,18 +1154,18 @@ public:
bool aHorizontal,
bool aAdd);
bool AddHorizontalScrollbar (nsBoxLayoutState& aState, bool aOnBottom);
bool AddVerticalScrollbar (nsBoxLayoutState& aState, bool aOnRight);
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 {
return mHelper.GetScrolledFrame();
}
virtual mozilla::ScrollbarStyles GetScrollbarStyles() const override {
return mHelper.GetScrollbarStylesFromFrame();
}
--- a/layout/generic/nsGridContainerFrame.cpp
+++ b/layout/generic/nsGridContainerFrame.cpp
@@ -62,37 +62,37 @@ ReparentFrames(nsFrameList& aFrameList,
nsContainerFrame* aNewParent)
{
for (auto f : aFrameList) {
ReparentFrame(f, aOldParent, aNewParent);
}
}
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;
}
// Same as above and set aStatus INCOMPLETE if aSize wasn't clamped.
// (If we clamp aSize it means our size is less than the break point,
// 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 {
aSize = maxSize;
}
} else {
NS_FRAME_SET_INCOMPLETE(*aStatus);
}
@@ -1125,42 +1125,42 @@ struct nsGridContainerFrame::Tracks
* Helper for InitialzeItemBaselines.
*/
void CalculateItemBaselines(nsTArray<ItemBaselineData>& aBaselineItems,
BaselineSharingGroup aBaselineGroup);
/**
* Initialize grid item baseline state and offsets.
*/
- void InitializeItemBaselines(GridReflowState& aState,
+ void InitializeItemBaselines(GridReflowInput& aState,
nsTArray<GridItemInfo>& aGridItems);
/**
* Apply the additional alignment needed to align the baseline-aligned subtree
* the item belongs to within its baseline track.
*/
void AlignBaselineSubtree(const GridItemInfo& aGridItem) const;
/**
* 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,
nscoord aPercentageBasis,
IntrinsicISizeType aConstraint);
/**
* Helper for ResolveIntrinsicSize. It implements step 1 "size tracks to fit
* 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,
const LineRange& aRange,
const GridItemInfo& aGridItem);
/**
* Collect the tracks which are growable (matching aSelector) into
* aGrowableTracks, and return the amount of space that can be used
@@ -1449,36 +1449,36 @@ struct nsGridContainerFrame::Tracks
const TrackSizingFunctions& aFunctions,
nscoord aSpaceToFill) const;
/**
* Implements the "find the used flex fraction" part of StretchFlexibleTracks.
* (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,
nscoord aAvailableSize) const;
/**
* 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);
/**
* 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,
LineRange GridArea::* aRange,
IntrinsicISizeType aConstraint);
/**
* Apply 'align/justify-content', whichever is relevant for this axis.
@@ -1633,24 +1633,24 @@ struct nsGridContainerFrame::Tracks
// There is one alignment value for each BaselineSharingGroup.
uint8_t mBaselineSubtreeAlign[2];
// True if track positions and sizes are final in this axis.
bool mCanResolveLineRangeSize;
};
/**
* 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
{
SharedGridData() : mCols(eLogicalAxisInline), mRows(eLogicalAxisBlock) {}
Tracks mCols;
Tracks mRows;
struct RowData {
nscoord mBase; // the original track size
@@ -1658,31 +1658,31 @@ struct nsGridContainerFrame::SharedGridD
};
nsTArray<RowData> mOriginalRowData;
nsTArray<GridItemInfo> mGridItems;
nsTArray<GridItemInfo> mAbsPosItems;
bool mGenerateComputedGridInfo;
/**
* 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())
{}
/**
* Initialize our track sizes and grid item info using the shared
* state from aGridContainerFrame first-in-flow.
*/
void InitializeForContinuation(nsGridContainerFrame* aGridContainerFrame,
@@ -1820,21 +1820,21 @@ struct MOZ_STACK_CLASS nsGridContainerFr
*/
nsTArray<GridItemInfo> mGridItems;
/**
* Info about each grid-aligned abs.pos. child.
*/
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.
/** Computed border+padding with mSkipSides applied. */
LogicalMargin mBorderPadding;
/**
* BStart of this fragment in "grid space" (i.e. the concatenation of content
* areas of all fragments). Equal to mRows.mSizes[mStartRow].mPosition,
@@ -1843,50 +1843,50 @@ struct MOZ_STACK_CLASS nsGridContainerFr
nscoord mFragBStart;
/** The start row for this fragment. */
uint32_t mStartRow;
/** Our tentative ApplySkipSides bits. */
LogicalSides mSkipSides;
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)
, mGridStyle(aGridStyle)
, mCols(eLogicalAxisInline)
, mRows(eLogicalAxisBlock)
, mColFunctions(mGridStyle->mGridTemplateColumns,
mGridStyle->mGridAutoColumnsMin,
mGridStyle->mGridAutoColumnsMax)
, mRowFunctions(mGridStyle->mGridTemplateRows,
mGridStyle->mGridAutoRowsMin,
mGridStyle->mGridAutoRowsMax)
- , mReflowState(aReflowState)
+ , mReflowInput(aReflowInput)
, mRenderingContext(aRenderingContext)
, mFrame(aFrame)
, mSharedGridData(nullptr)
, mBorderPadding(aWM)
, mFragBStart(0)
, 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 -
* the size of the explicit/implicit grid, which cells are occupied etc.
*/
struct MOZ_STACK_CLASS nsGridContainerFrame::Grid
{
/**
@@ -1895,17 +1895,17 @@ struct MOZ_STACK_CLASS nsGridContainerFr
* frame property on the child frame.
* @param aComputedMinSize the container's min-size - used to determine
* the number of repeat(auto-fill/fit) tracks.
* @param aComputedSize the container's size - used to determine
* the number of repeat(auto-fill/fit) tracks.
* @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);
/**
* As above but for an abs.pos. child. Any 'auto' lines will be represented
* by kAutoLine in the LineRange result.
* @param aGridStart the first line in the final, but untranslated grid
@@ -2249,17 +2249,17 @@ struct MOZ_STACK_CLASS nsGridContainerFr
* grid.
*/
uint32_t mExplicitGridOffsetCol;
uint32_t mExplicitGridOffsetRow;
};
void
-nsGridContainerFrame::GridReflowState::CalculateTrackSizes(
+nsGridContainerFrame::GridReflowInput::CalculateTrackSizes(
const Grid& aGrid,
const LogicalSize& aContentBox,
IntrinsicISizeType aConstraint)
{
mCols.Initialize(mColFunctions, mGridStyle->mGridColumnGap,
aGrid.mGridColEnd, aContentBox.ISize(mWM));
mRows.Initialize(mRowFunctions, mGridStyle->mGridRowGap,
aGrid.mGridRowEnd, aContentBox.BSize(mWM));
@@ -3088,17 +3088,17 @@ nsGridContainerFrame::Grid::PlaceAutoAut
MOZ_ASSERT(col < gridColEnd || row == 0,
"expected row 0 for placing in a new column");
aArea->mCols.ResolveAutoPosition(col, mExplicitGridOffsetCol);
aArea->mRows.ResolveAutoPosition(row, mExplicitGridOffsetRow);
MOZ_ASSERT(aArea->IsDefinite());
}
void
-nsGridContainerFrame::Grid::PlaceGridItems(GridReflowState& aState,
+nsGridContainerFrame::Grid::PlaceGridItems(GridReflowInput& aState,
const LogicalSize& aComputedMinSize,
const LogicalSize& aComputedSize,
const LogicalSize& aComputedMaxSize)
{
mAreas = aState.mFrame->GetImplicitNamedAreas();
const nsStylePosition* const gridStyle = aState.mGridStyle;
MOZ_ASSERT(mCellMap.mCells.IsEmpty(), "unexpected entries in cell map");
@@ -3415,25 +3415,25 @@ nsGridContainerFrame::Tracks::Initialize
mContentBoxSize = aContentBoxSize;
}
/**
* Reflow aChild in the given aAvailableSize.
*/
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,
NS_UNCONSTRAINEDSIZE),
ReflowInput::DUMMY_PARENT_REFLOW_STATE);
rs = dummyParentState.ptr();
}
#ifdef DEBUG
@@ -3459,17 +3459,17 @@ MeasuringReflow(nsIFrame*
}
/**
* Return the [min|max]-content contribution of aChild to its parent (i.e.
* the child's margin-box) in aAxis.
*/
static nscoord
ContentContribution(const GridItemInfo& aGridItem,
- const GridReflowState& aState,
+ const GridReflowInput& aState,
nsRenderingContext* aRC,
WritingMode aCBWM,
LogicalAxis aAxis,
nsLayoutUtils::IntrinsicISizeType aConstraint,
uint32_t aFlags = 0)
{
nsIFrame* child = aGridItem.mFrame;
PhysicalAxis axis(aCBWM.PhysicalAxis(aAxis));
@@ -3485,55 +3485,55 @@ ContentContribution(const GridItemInfo&
nscoord sz = aState.mCols.ResolveSize(aGridItem.mArea.mCols);
if (childWM.IsOrthogonalTo(aCBWM)) {
cbBSize = sz;
} else {
cbISize = sz;
}
}
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);
}
MOZ_ASSERT(aGridItem.mBaselineOffset[aAxis] >= 0,
"baseline offset should be non-negative at this point");
MOZ_ASSERT((aGridItem.mState[aAxis] & ItemState::eIsBaselineAligned) ||
aGridItem.mBaselineOffset[aAxis] == nscoord(0),
"baseline offset should be zero when not baseline-aligned");
size += aGridItem.mBaselineOffset[aAxis];
return std::max(size, 0);
}
static nscoord
MinContentContribution(const GridItemInfo& aGridItem,
- const GridReflowState& aState,
+ const GridReflowInput& aState,
nsRenderingContext* aRC,
WritingMode aCBWM,
LogicalAxis aAxis)
{
return ContentContribution(aGridItem, aState, aRC, aCBWM, aAxis,
nsLayoutUtils::MIN_ISIZE);
}
static nscoord
MaxContentContribution(const GridItemInfo& aGridItem,
- const GridReflowState& aState,
+ const GridReflowInput& aState,
nsRenderingContext* aRC,
WritingMode aCBWM,
LogicalAxis aAxis)
{
return ContentContribution(aGridItem, aState, aRC, aCBWM, aAxis,
nsLayoutUtils::PREF_ISIZE);
}
static nscoord
MinSize(const GridItemInfo& aGridItem,
- const GridReflowState& aState,
+ const GridReflowInput& aState,
nsRenderingContext* aRC,
WritingMode aCBWM,
LogicalAxis aAxis)
{
nsIFrame* child = aGridItem.mFrame;
PhysicalAxis axis(aCBWM.PhysicalAxis(aAxis));
const nsStylePosition* stylePos = child->StylePosition();
const nsStyleCoord& style = axis == eAxisHorizontal ? stylePos->mMinWidth
@@ -3562,17 +3562,17 @@ MinSize(const GridItemInfo& aGridItem
nsLayoutUtils::MIN_ISIZE,
nsLayoutUtils::MIN_INTRINSIC_ISIZE));
}
return sz;
}
void
nsGridContainerFrame::Tracks::CalculateSizes(
- GridReflowState& aState,
+ GridReflowInput& aState,
nsTArray<GridItemInfo>& aGridItems,
const TrackSizingFunctions& aFunctions,
nscoord aContentBoxSize,
LineRange GridArea::* aRange,
IntrinsicISizeType aConstraint)
{
nscoord percentageBasis = aContentBoxSize;
if (percentageBasis == NS_UNCONSTRAINEDSIZE) {
@@ -3616,17 +3616,17 @@ nsGridContainerFrame::Tracks::HasIntrins
foundIntrinsic = true;
}
}
return foundIntrinsic;
}
bool
nsGridContainerFrame::Tracks::ResolveIntrinsicSizeStep1(
- GridReflowState& aState,
+ GridReflowInput& aState,
const TrackSizingFunctions& aFunctions,
nscoord aPercentageBasis,
IntrinsicISizeType aConstraint,
const LineRange& aRange,
const GridItemInfo& aGridItem)
{
Maybe<nscoord> minContentContribution;
Maybe<nscoord> maxContentContribution;
@@ -3725,17 +3725,17 @@ nsGridContainerFrame::Tracks::CalculateI
trackStartIndex = i;
maxBaseline = item.mBaseline;
maxDescent = item.mSize - item.mBaseline;
}
}
void
nsGridContainerFrame::Tracks::InitializeItemBaselines(
- GridReflowState& aState,
+ GridReflowInput& aState,
nsTArray<GridItemInfo>& aGridItems)
{
nsTArray<ItemBaselineData> firstBaselineItems;
nsTArray<ItemBaselineData> lastBaselineItems;
WritingMode wm = aState.mWM;
nsStyleContext* containerSC = aState.mFrame->StyleContext();
GridItemCSSOrderIterator& iter = aState.mIter;
@@ -3833,17 +3833,17 @@ nsGridContainerFrame::Tracks::Initialize
}
if (state & ItemState::eIsBaselineAligned) {
// XXX available size issue
LogicalSize avail(childWM, INFINITE_ISIZE_COORD, NS_UNCONSTRAINEDSIZE);
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)) {
auto frameSize = isInlineAxis ? child->ISize(wm) : child->BSize(wm);
auto m = child->GetLogicalUsedMargin(wm);
baseline += isInlineAxis ? m.IStart(wm) : m.BStart(wm);
auto alignSize = frameSize + (isInlineAxis ? m.IStartEnd(wm)
: m.BStartEnd(wm));
@@ -3936,17 +3936,17 @@ nsGridContainerFrame::Tracks::AlignBasel
break;
default:
MOZ_ASSERT_UNREACHABLE("unexpected baseline subtree alignment");
}
}
void
nsGridContainerFrame::Tracks::ResolveIntrinsicSize(
- GridReflowState& aState,
+ GridReflowInput& aState,
nsTArray<GridItemInfo>& aGridItems,
const TrackSizingFunctions& aFunctions,
LineRange GridArea::* aRange,
nscoord aPercentageBasis,
IntrinsicISizeType aConstraint)
{
// Some data we collect on each item for Step 2 of the algorithm below.
struct Step2ItemData
@@ -4241,17 +4241,17 @@ nsGridContainerFrame::Tracks::FindFrUnit
}
}
} while (restart);
return hypotheticalFrSize;
}
float
nsGridContainerFrame::Tracks::FindUsedFlexFraction(
- GridReflowState& aState,
+ GridReflowInput& aState,
nsTArray<GridItemInfo>& aGridItems,
const nsTArray<uint32_t>& aFlexTracks,
const TrackSizingFunctions& aFunctions,
nscoord aAvailableSize) const
{
if (aAvailableSize != NS_UNCONSTRAINEDSIZE) {
// Use all of the grid tracks and a 'space to fill' of the available space.
const TranslatedLineRange range(0, mSizes.Length());
@@ -4294,17 +4294,17 @@ nsGridContainerFrame::Tracks::FindUsedFl
fr = std::max(fr, itemFr);
}
}
return fr;
}
void
nsGridContainerFrame::Tracks::StretchFlexibleTracks(
- GridReflowState& aState,
+ GridReflowInput& aState,
nsTArray<GridItemInfo>& aGridItems,
const TrackSizingFunctions& aFunctions,
nscoord aAvailableSize)
{
if (aAvailableSize <= 0) {
return;
}
nsTArray<uint32_t> flexTracks(mSizes.Length());
@@ -4521,28 +4521,28 @@ nsGridContainerFrame::LineRange::ToPosit
nscoord pos;
ToPositionAndLength(aTracks.mSizes, &pos, aLength);
*aPos = aGridOrigin + pos;
}
}
}
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");
MOZ_ASSERT(aArea.mRows.Extent() > 0, "grid items cover at least one track");
aArea.mCols.ToPositionAndLength(mCols.mSizes, &i, &iSize);
aArea.mRows.ToPositionAndLength(mRows.mSizes, &b, &bSize);
return LogicalRect(mWM, i, b, iSize, bSize);
}
LogicalRect
-nsGridContainerFrame::GridReflowState::ContainingBlockForAbsPos(
+nsGridContainerFrame::GridReflowInput::ContainingBlockForAbsPos(
const GridArea& aArea,
const LogicalPoint& aGridOrigin,
const LogicalRect& aGridCB) const
{
nscoord i = aGridCB.IStart(mWM);
nscoord b = aGridCB.BStart(mWM);
nscoord iSize = aGridCB.ISize(mWM);
nscoord bSize = aGridCB.BSize(mWM);
@@ -4555,23 +4555,23 @@ nsGridContainerFrame::GridReflowState::C
/**
* Return a Fragmentainer object if we have a fragmentainer frame in our
* ancestor chain of containing block (CB) reflow states. We'll only
* continue traversing the ancestor chain as long as the CBs have
* 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;
}
if (wm.IsOrthogonalTo(cbRS->GetWritingMode())) {
break;
}
nsIAtom* frameType = cbRS->mFrame->GetType();
@@ -4605,25 +4605,25 @@ nsGridContainerFrame::GetNearestFragment
}
void
nsGridContainerFrame::ReflowInFlowChild(nsIFrame* aChild,
const GridItemInfo* aGridItemInfo,
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));
LogicalRect cb(wm);
WritingMode childWM = aChild->GetWritingMode();
bool isConstrainedBSize = false;
nscoord toFragmentainerEnd;
// The part of the child's grid area that's in previous container fragments.
@@ -4688,17 +4688,17 @@ nsGridContainerFrame::ReflowInFlowChild(
reflowSize.BSize(wm) = toFragmentainerEnd;
}
LogicalSize childCBSize = reflowSize.ConvertTo(childWM, wm);
if (!isConstrainedBSize) {
childCBSize.BSize(childWM) = NS_UNCONSTRAINEDSIZE;
}
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;
// If the child is stretching in its block axis, and we might be fragmenting
// it in that axis, then setup a frame property to tell
// nsBlockFrame::ComputeFinalSize the size.
if (isConstrainedBSize && !wm.IsOrthogonalTo(childWM)) {
bool stretch = false;
@@ -4755,25 +4755,25 @@ nsGridContainerFrame::ReflowInFlowChild(
}
childRS.ApplyRelativePositioning(&childPos, aContainerSize);
FinishReflowChild(aChild, pc, childSize, &childRS, childWM, childPos,
aContainerSize, 0);
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, aChild);
}
nscoord
-nsGridContainerFrame::ReflowInFragmentainer(GridReflowState& aState,
+nsGridContainerFrame::ReflowInFragmentainer(GridReflowInput& aState,
const LogicalRect& aContentArea,
ReflowOutput& aDesiredSize,
nsReflowStatus& aStatus,
Fragmentainer& aFragmentainer,
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.
nsTArray<const GridItemInfo*> sortedItems(aState.mGridItems.Length());
nsTArray<nsIFrame*> placeholders(aState.mAbsPosItems.Length());
aState.mIter.Reset(GridItemCSSOrderIterator::eIncludeAll);
for (; !aState.mIter.AtEnd(); aState.mIter.Next()) {
nsIFrame* child = *aState.mIter;
@@ -4798,17 +4798,17 @@ nsGridContainerFrame::ReflowInFragmentai
"nsPlaceholderFrame should never need to be fragmented");
}
// The available size for children - we'll set this to the edge of the last
// row in most cases below, but for now use the full size.
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);
// Set |endRow| to the first row that doesn't fit.
uint32_t endRow = numRows;
for (uint32_t row = startRow; row < numRows; ++row) {
auto& sz = aState.mRows.mSizes[row];
const nscoord bEnd = sz.mPosition + sz.mBase;
@@ -4818,17 +4818,17 @@ nsGridContainerFrame::ReflowInFragmentai
endRow = row;
break;
}
}
// 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) {
break;
}
auto disp = info->mFrame->StyleDisplay();
if (disp->mBreakBefore) {
// Propagate break-before on the first row to the container unless we're
@@ -4880,34 +4880,34 @@ nsGridContainerFrame::ReflowInFragmentai
// Calculate the block-size including this fragment.
nscoord bEndRow =
aState.mRows.GridLineEdge(endRow, GridLineSide::eBeforeGridGap);
nscoord bSize;
if (aFragmentainer.mIsAutoBSize) {
// 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;
} else if (!isBDBClone) {
// The max-bsize won't make this fragment COMPLETE, so the block-end
// border will be in a later fragment.
bpBEnd = 0;
}
} 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.
bool overflow = bSize + bpBEnd > childAvailableSize;
if (overflow) {
if (avoidBreakInside) {
aStatus = NS_INLINE_LINE_BREAK_BEFORE();
return aState.mFragBStart;
@@ -4937,30 +4937,30 @@ nsGridContainerFrame::ReflowInFragmentai
} else if (bSize <= bEndRow && startRow + 1 < endRow) {
if (endRow == numRows) {
// We have more than one row in this fragment, so we can break before
// the last row instead.
--endRow;
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
// a row doesn't fit in an auto-sized container (unless it's constrained
// 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);
}
}
// If we can't fit all rows then we're at least overflow-incomplete.
if (endRow < numRows) {
childAvailableSize = bEndRow;
if (NS_FRAME_IS_COMPLETE(aStatus)) {
NS_FRAME_SET_OVERFLOW_INCOMPLETE(aStatus);
@@ -4973,32 +4973,32 @@ nsGridContainerFrame::ReflowInFragmentai
return ReflowRowsInFragmentainer(aState, aContentArea, aDesiredSize, aStatus,
aFragmentainer, aContainerSize, sortedItems,
startRow, endRow, bSize, childAvailableSize);
}
nscoord
nsGridContainerFrame::ReflowRowsInFragmentainer(
- GridReflowState& aState,
+ GridReflowInput& aState,
const LogicalRect& aContentArea,
ReflowOutput& aDesiredSize,
nsReflowStatus& aStatus,
Fragmentainer& aFragmentainer,
const nsSize& aContainerSize,
const nsTArray<const GridItemInfo*>& aSortedItems,
uint32_t aStartRow,
uint32_t aEndRow,
nscoord aBSize,
nscoord aAvailableSize)
{
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
// of its grid-fragment, to help decide whether we can break before it. When
// this function starts, our row is at the top of the current fragment if:
// - we're starting with a nonzero row (i.e. we're a continuation)
// OR:
// - we're starting with the first row, & we're not allowed to break before
@@ -5093,21 +5093,21 @@ nsGridContainerFrame::ReflowRowsInFragme
i = -1; // i == 0 after the next loop increment
isRowTopOfPage = isStartRowTopOfPage;
overflowIncompleteItems.Clear();
incompleteItems.Clear();
nscoord bEndRow =
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;
}
if (!isRowTopOfPage) {
// We can break before this row - restart with it as the new end row.
aEndRow = row;
@@ -5251,33 +5251,33 @@ nsGridContainerFrame::ReflowRowsInFragme
if (!overflowIncompleteList.IsEmpty()) {
MergeSortedExcessOverflowContainers(overflowIncompleteList);
}
}
return aBSize;
}
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);
nscoord bSize = aContentArea.BSize(wm);
Maybe<Fragmentainer> fragmentainer = GetNearestFragmentainer(aState);
if (MOZ_UNLIKELY(fragmentainer.isSome())) {
bSize = ReflowInFragmentainer(aState, aContentArea, aDesiredSize, aStatus,
*fragmentainer, containerSize);
@@ -5300,17 +5300,17 @@ nsGridContainerFrame::ReflowChildren(Gri
aDesiredSize.mOverflowAreas.UnionWith(ocBounds);
NS_MergeReflowStatusInto(&aStatus, ocStatus);
if (IsAbsoluteContainer()) {
nsFrameList children(GetChildList(GetAbsoluteListID()));
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),
bSize + pad.BStartEnd(wm));
const nsSize gridCBPhysicalSize = gridCB.Size(wm).GetPhysicalSize(wm);
size_t i = 0;
for (nsFrameList::Enumerator e(children); !e.AtEnd(); e.Next(), ++i) {
nsIFrame* child = e.get();
@@ -5331,35 +5331,35 @@ nsGridContainerFrame::ReflowChildren(Gri
// The eIsGridContainerCB flag tells nsAbsoluteContainingBlock::Reflow to
// use those instead.
nsRect dummyRect;
AbsPosReflowFlags flags =
AbsPosReflowFlags::eCBWidthAndHeightChanged; // XXX could be optimized
flags |= AbsPosReflowFlags::eConstrainHeight;
flags |= AbsPosReflowFlags::eIsGridContainerCB;
GetAbsoluteContainingBlock()->Reflow(this, PresContext(),
- *aState.mReflowState,
+ *aState.mReflowInput,
aStatus, dummyRect, flags,
&aDesiredSize.mOverflowAreas);
}
}
return bSize;
}
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);
-
- if (IsFrameTreeTooDeep(aReflowState, aDesiredSize, aStatus)) {
+ DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
+
+ if (IsFrameTreeTooDeep(aReflowInput, aDesiredSize, aStatus)) {
return;
}
// First we gather child frames we should include in our reflow,
// i.e. overflowed children from our prev-in-flow, and pushed first-in-flow
// children (that might now fit). It's important to note that these children
// can be in arbitrary order vis-a-vis the current children in our lists.
// E.g. grid items in the document order: A, B, C may be placed in the rows
@@ -5523,96 +5523,96 @@ nsGridContainerFrame::Reflow(nsPresConte
::MergeSortedFrameLists(mFrames, items, GetContent());
}
#ifdef DEBUG
mDidPushItemsBitMayLie = false;
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;
if (!prevInFlow) {
// 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)) {
computedMinSize.ISize(wm) = NS_UNCONSTRAINEDSIZE;
}
if (!stylePos->MinBSize(wm).IsCoordPercentCalcUnit() ||
(stylePos->MinBSize(wm).HasPercent() && cbState &&
cbState->ComputedSize(wm).BSize(wm) == NS_UNCONSTRAINEDSIZE)) {
computedMinSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
}
Grid grid;
- grid.PlaceGridItems(gridReflowState, computedMinSize, computedSize,
- aReflowState.ComputedMaxSize());
-
- gridReflowState.CalculateTrackSizes(grid, computedSize,
+ grid.PlaceGridItems(gridReflowInput, computedMinSize, computedSize,
+ aReflowInput.ComputedMaxSize());
+
+ 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));
- }
-
- bSize = ReflowChildren(gridReflowState, contentArea, aDesiredSize, aStatus);
+ gridReflowInput.mRows.AlignJustifyContent(stylePos, wm, contentArea.Size(wm));
+ }
+
+ 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);
}
LogicalSize desiredSize(wm, computedISize + bp.IStartEnd(wm),
bSize + bp.BStartEnd(wm));
aDesiredSize.SetSize(wm, desiredSize);
@@ -5636,69 +5636,69 @@ nsGridContainerFrame::Reflow(nsPresConte
// multiple times in fragmented grids, and it's challenging to scope
// the bit to only that sequence of calls. This is relatively harmless
// since this bit is only set by accessing a ChromeOnly property, and
// therefore can't unduly slow down normal web browsing.
// 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 :
(uint32_t)mozilla::dom::GridTrackState::Static
);
col++;
}
ComputedGridTrackInfo* colInfo = new ComputedGridTrackInfo(
- gridReflowState.mColFunctions.mExplicitGridOffset,
- gridReflowState.mColFunctions.NumExplicitTracks(),
+ gridReflowInput.mColFunctions.mExplicitGridOffset,
+ gridReflowInput.mColFunctions.NumExplicitTracks(),
0,
col,
Move(colTrackPositions),
Move(colTrackSizes),
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 :
(uint32_t)mozilla::dom::GridTrackState::Static
);
row++;
}
// Row info has to accomodate fragmentation of the grid, which may happen in
// 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),
Move(rowTrackStates));
Properties().Set(GridRowTrackInfo(), rowInfo);
if (prevInFlow) {
// This frame is fragmenting rows from a previous frame, so patch up
@@ -5718,112 +5718,112 @@ nsGridContainerFrame::Reflow(nsPresConte
pos -= delta;
}
}
ComputedGridTrackInfo* revisedPriorRowInfo = new ComputedGridTrackInfo(
priorRowInfo->mNumLeadingImplicitTracks,
priorRowInfo->mNumExplicitTracks,
priorRowInfo->mStartFragmentTrack,
- gridReflowState.mStartRow,
+ gridReflowInput.mStartRow,
Move(priorRowInfo->mPositions),
Move(priorRowInfo->mSizes),
Move(priorRowInfo->mStates));
prevInFlow->Properties().Set(GridRowTrackInfo(), revisedPriorRowInfo);
}
// Generate the line info properties. We need to provide the number of
// 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(
Move(columnLineNames));
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(
Move(rowLineNames));
Properties().Set(GridRowLineInfo(), rowLineInfo);
}
if (!prevInFlow) {
SharedGridData* sharedGridData = Properties().Get(SharedGridData::Prop());
if (!NS_FRAME_IS_FULLY_COMPLETE(aStatus)) {
if (!sharedGridData) {
sharedGridData = new SharedGridData;
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());
nscoord prevTrackEnd = 0;
for (auto& sz : sharedGridData->mRows.mSizes) {
SharedGridData::RowData data = {sz.mBase, sz.mPosition - prevTrackEnd};
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);
} else if (sharedGridData && !GetNextInFlow()) {
Properties().Delete(SharedGridData::Prop());
}
}
FinishAndStoreOverflow(&aDesiredSize);
- NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
+ NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
nscoord
nsGridContainerFrame::IntrinsicISize(nsRenderingContext* aRenderingContext,
IntrinsicISizeType aConstraint)
{
// 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;
grid.PlaceGridItems(state, indefinite, indefinite, indefinite); // XXX optimize
if (grid.mGridColEnd == 0) {
return 0;
}
state.mCols.Initialize(state.mColFunctions, state.mGridStyle->mGridColumnGap,
--- a/layout/generic/nsGridContainerFrame.h
+++ b/layout/generic/nsGridContainerFrame.h
@@ -68,17 +68,17 @@ public:
NS_DECL_QUERYFRAME_TARGET(nsGridContainerFrame)
NS_DECL_QUERYFRAME
typedef mozilla::ComputedGridTrackInfo ComputedGridTrackInfo;
typedef mozilla::ComputedGridLineInfo ComputedGridLineInfo;
// 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;
void MarkIntrinsicISizesDirty() override;
nsIAtom* GetType() const override;
bool IsFrameOfType(uint32_t aFlags) const override
{
return nsContainerFrame::IsFrameOfType(aFlags &
@@ -155,17 +155,17 @@ public:
* Return a containing grid frame, and ensure it has computed grid info
* @return nullptr if aFrame has no grid container, or frame was destroyed
* @note this might destroy layout/style data since it may flush layout
*/
static nsGridContainerFrame* GetGridFrameWithComputedInfo(nsIFrame* aFrame);
struct TrackSize;
struct GridItemInfo;
- struct GridReflowState;
+ struct GridReflowInput;
protected:
static const uint32_t kAutoLine;
// The maximum line number, in the zero-based translated grid.
static const uint32_t kTranslatedMaxLine;
typedef mozilla::LogicalPoint LogicalPoint;
typedef mozilla::LogicalRect LogicalRect;
typedef mozilla::LogicalSize LogicalSize;
typedef mozilla::WritingMode WritingMode;
@@ -204,17 +204,17 @@ protected:
return Properties().Get(ImplicitNamedAreasProperty());
}
/**
* Reflow and place our children.
* @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);
/**
* Helper for GetMinISize / GetPrefISize.
*/
nscoord IntrinsicISize(nsRenderingContext* aRenderingContext,
@@ -254,29 +254,29 @@ private:
bool mCanBreakAtEnd;
/**
* Is the grid container's block-size unconstrained?
*/
bool mIsAutoBSize;
};
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,
Fragmentainer& aFragmentainer,
const nsSize& aContainerSize);
// 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,
Fragmentainer& aFragmentainer,
const nsSize& aContainerSize,
const nsTArray<const GridItemInfo*>& aItems,
uint32_t aStartRow,
uint32_t aEndRow,
@@ -284,17 +284,17 @@ private:
nscoord aAvailableSize);
// Helper for ReflowChildren / ReflowInFragmentainer
void ReflowInFlowChild(nsIFrame* aChild,
const GridItemInfo* aGridItemInfo,
nsSize aContainerSize,
mozilla::Maybe<nscoord> aStretchBSize,
const Fragmentainer* aFragmentainer,
- const GridReflowState& aState,
+ const GridReflowInput& aState,
const LogicalRect& aContentArea,
ReflowOutput& aDesiredSize,
nsReflowStatus& aStatus);
/**
* Cached values to optimize GetMinISize/GetPrefISize.
*/
nscoord mCachedMinISize;
--- a/layout/generic/nsHTMLCanvasFrame.cpp
+++ b/layout/generic/nsHTMLCanvasFrame.cpp
@@ -244,37 +244,37 @@ nsHTMLCanvasFrame::ComputeSize(nsRenderi
aMargin,
aBorder,
aPadding);
}
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);
if (GetPrevInFlow()) {
nscoord y = GetContinuationOffset(&finalSize.ISize(wm));
finalSize.BSize(wm) -= y + mBorderPadding.BStart(wm);
finalSize.BSize(wm) = std::max(0, finalSize.BSize(wm));
@@ -283,31 +283,31 @@ nsHTMLCanvasFrame::Reflow(nsPresContext*
aMetrics.SetSize(wm, finalSize);
aMetrics.SetOverflowAreasToDesiredBounds();
FinishAndStoreOverflow(&aMetrics);
// Reflow the single anon block child.
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
// removed. That needs to be fixed.
// XXXdholbert As in nsImageFrame, this function's clients should probably
// just be calling GetContentRectRelativeToSelf().
nsRect
nsHTMLCanvasFrame::GetInnerArea() const
--- a/layout/generic/nsHTMLCanvasFrame.h
+++ b/layout/generic/nsHTMLCanvasFrame.h
@@ -68,17 +68,17 @@ public:
nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorder,
const mozilla::LogicalSize& aPadding,
ComputeSizeFlags aFlags) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
nsRect GetInnerArea() const;
#ifdef ACCESSIBILITY
virtual mozilla::a11y::AccType AccessibleType() override;
#endif
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -308,18 +308,18 @@ typedef uint32_t nsReflowStatus;
// A frame is "truncated" if the part of the frame before the first
// possible break point was unable to fit in the available vertical
// space. Therefore, the entire frame should be moved to the next page.
// A frame that begins at the top of the page must never be "truncated".
// Doing so would likely cause an infinite loop.
#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.
void NS_MergeReflowStatusInto(nsReflowStatus* aPrimary,
nsReflowStatus aSecondary);
//----------------------------------------------------------------------
@@ -2029,32 +2029,32 @@ public:
* minimum size.
*
* For an incremental reflow you are responsible for invalidating
* any area within your frame that needs repainting (including
* borders). If your new desired size is different than your current
* 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).
*
* Note that the available space can be negative. In this case you
* still must return an accurate desired size. If you're a container
* you must <b>always</b> reflow at least one frame regardless of the
* available space
*
* @param aStatus a return value indicating whether the frame is complete
* and whether the next-in-flow is dirty and needs to be reflowed
*/
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aReflowMetrics,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) = 0;
/**
* Post-reflow hook. After a frame is reflowed this method will be called
* informing the frame that this reflow process is complete, and telling the
* frame the status returned by the Reflow member function.
*
* This call may be invoked many times, while NS_FRAME_IN_REFLOW is set, before
@@ -2063,17 +2063,17 @@ public:
* frame state will be cleared.
*
* XXX This doesn't make sense. If the frame is reflowed but not complete, then
* the status should be NS_FRAME_NOT_COMPLETE and not NS_FRAME_COMPLETE
* XXX Don't we want the semantics to dictate that we only call this once for
* a given reflow?
*/
virtual void DidReflow(nsPresContext* aPresContext,
- const ReflowInput* aReflowState,
+ const ReflowInput* aReflowInput,
nsDidReflowStatus aStatus) = 0;
/**
* Updates the overflow areas of the frame. This can be called if an
* overflow area of the frame's children has changed without reflowing.
* @return true if either of the overflow areas for this frame have changed.
*/
bool UpdateOverflow();
@@ -2664,19 +2664,19 @@ public:
* @note (See also bug 743402, comment 11) GetSkipSides() checks to see
* if this frame has a previous or next continuation to determine
* if a side should be skipped.
* Unfortunately, this only works after reflow has been completed. In
* lieu of this, during reflow, an ReflowInput parameter can be
* 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();
}
/**
* @returns true if this frame is selected.
*/
bool IsSelected() const;
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -111,24 +111,24 @@ static bool HaveSpecifiedSize(const nsSt
// - if width and height are specified as either coord or percentage, then
// the size of the image frame is constrained
return aStylePosition->mWidth.IsCoordPercentCalcUnit() &&
aStylePosition->mHeight.IsCoordPercentCalcUnit();
}
// 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*
NS_NewImageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
return new (aPresShell) nsImageFrame(aContext);
}
@@ -944,57 +944,57 @@ nsImageFrame::GetIntrinsicSize()
nsImageFrame::GetIntrinsicRatio()
{
return mIntrinsicRatio;
}
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;
}
// XXXldb These two bits are almost exact opposites (except in the
// middle of the initial reflow); remove IMAGE_GOTINITIALREFLOW.
if (GetStateBits() & NS_FRAME_FIRST_REFLOW) {
mState |= IMAGE_GOTINITIALREFLOW;
}
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());
}
// we have to split images if we are:
// in Paginated mode, we need to have a constrained height, and have a height larger than our available height
uint32_t loadStatus = imgIRequest::STATUS_NONE;
nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mContent);
@@ -1004,21 +1004,21 @@ nsImageFrame::Reflow(nsPresContext*
imageLoader->GetRequest(nsIImageLoadingContent::CURRENT_REQUEST,
getter_AddRefs(currentRequest));
if (currentRequest) {
currentRequest->GetImageStatus(&loadStatus);
}
}
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;
}
aMetrics.SetOverflowAreasToDesiredBounds();
EventStates contentState = mContent->AsElement()->State();
bool imageOK = IMAGE_OK(contentState, true);
// Determine if the size is available
@@ -1048,17 +1048,17 @@ nsImageFrame::Reflow(nsPresContext*
nsIPresShell* shell = PresContext()->PresShell();
mReflowCallbackPosted = true;
shell->PostReflowCallback(this);
}
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
nsImageFrame::ReflowFinished()
{
mReflowCallbackPosted = false;
// XXX(seth): We don't need this. The purpose of updating visibility
@@ -2147,17 +2147,17 @@ nsImageFrame::List(FILE* out, const char
str += nsPrintfCString(" [src=%s]", uristr.get());
}
}
fprintf_stderr(out, "%s\n", str.get());
}
#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)) {
return LogicalSides();
}
LogicalSides skip;
if (nullptr != GetPrevInFlow()) {
skip |= eLogicalSideBitsBStart;
--- a/layout/generic/nsImageFrame.h
+++ b/layout/generic/nsImageFrame.h
@@ -85,17 +85,17 @@ public:
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
virtual mozilla::IntrinsicSize GetIntrinsicSize() override;
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,
nsIContent** aContent) override;
virtual nsresult HandleEvent(nsPresContext* aPresContext,
mozilla::WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus) override;
virtual nsresult GetCursor(const nsPoint& aPoint,
@@ -126,17 +126,17 @@ public:
uint32_t aFlags = 0) const override;
#endif
nsSplittableType GetSplittableType() const override
{
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);
static void ReleaseGlobals() {
if (gIconLoad) {
gIconLoad->Shutdown();
NS_RELEASE(gIconLoad);
}
--- a/layout/generic/nsInlineFrame.cpp
+++ b/layout/generic/nsInlineFrame.cpp
@@ -357,33 +357,33 @@ ReparentChildListStyle(nsPresContext* aP
restyleManager->ReparentStyleContext(e.get());
nsLayoutUtils::MarkDescendantsDirty(e.get());
}
}
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();
if (prevInFlow) {
AutoFrameListPtr prevOverflowFrames(aPresContext,
prevInFlow->StealOverflowFrames());
if (prevOverflowFrames) {
// When pushing and pulling frames we need to check for whether any
@@ -415,17 +415,17 @@ nsInlineFrame::Reflow(nsPresContext*
// and set their parent pointer
const nsFrameList::Slice& newFrames =
mFrames.InsertFrames(this, nullptr, *prevOverflowFrames);
// If our prev in flow was under the first continuation of a first-line
// frame then we need to reparent the style contexts to remove the
// 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);
}
}
}
}
// It's also possible that we have an overflow list for ourselves
#ifdef DEBUG
@@ -436,46 +436,46 @@ nsInlineFrame::Reflow(nsPresContext*
nsFrameList* overflowFrames = GetOverflowFrames();
NS_ASSERTION(!overflowFrames || overflowFrames->IsEmpty(),
"overflow list is not empty for initial reflow");
}
#endif
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;
if (mFrames.IsEmpty()) {
// Try to pull over one frame before starting so that we know
// whether we have an anonymous block or not.
bool complete;
(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
nsInlineFrame::AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
{
nsresult rv =
@@ -564,48 +564,48 @@ nsInlineFrame::PullOverflowsFromPrevInFl
this);
mFrames.InsertFrames(this, nullptr, *prevOverflowFrames);
}
}
}
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 ==
NS_STYLE_BOX_DECORATION_BREAK_CLONE);
// Don't offset by our start borderpadding if we have a prev continuation or
// if we're in a part of an {ib} split other than the first one. For
// box-decoration-break:clone we always offset our start since all
// continuations have border/padding.
if ((!GetPrevContinuation() && !FrameIsNonFirstInIBSplit()) ||
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.
nsIFrame* frame = mFrames.FirstChild();
bool done = false;
while (frame) {
// Check if we should lazily set the child frame's parent pointer.
if (irs.mSetParentPointer) {
@@ -681,17 +681,17 @@ nsInlineFrame::ReflowFrames(nsPresContex
}
}
}
}
MOZ_ASSERT(frame->GetParent() == this);
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) {
if (!irs.mSetParentPointer) {
break;
}
// Keep reparenting the remaining siblings, but don't reflow them.
nsFrameList* pushedFrames = GetOverflowFrames();
@@ -719,17 +719,17 @@ nsInlineFrame::ReflowFrames(nsPresContex
printf("%p pulled up %p\n", this, frame);
#endif
if (nullptr == frame) {
if (!isComplete) {
aStatus = NS_FRAME_NOT_COMPLETE;
}
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;
}
irs.mPrevFrame = frame;
frame = frame->GetNextSibling();
}
}
@@ -789,22 +789,22 @@ nsInlineFrame::ReflowFrames(nsPresContex
ListTag(stdout);
printf(": metrics=%d,%d ascent=%d\n",
aMetrics.Width(), aMetrics.Height(), aMetrics.TopAscent());
#endif
}
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);
if (NS_INLINE_IS_BREAK_BEFORE(aStatus)) {
if (aFrame != mFrames.FirstChild()) {
// Change break-before status into break-after since we have
// already placed at least one child frame. This preserves the
@@ -852,17 +852,17 @@ nsInlineFrame::ReflowInlineFrame(nsPresC
if (nextFrame) {
PushFrames(aPresContext, nextFrame, aFrame, irs);
}
}
}
nsIFrame*
nsInlineFrame::PullOneFrame(nsPresContext* aPresContext,
- InlineReflowState& irs,
+ InlineReflowInput& irs,
bool* aIsComplete)
{
bool isComplete = true;
nsIFrame* frame = nullptr;
nsInlineFrame* nextInFlow = irs.mNextInFlow;
while (nextInFlow) {
frame = nextInFlow->mFrames.FirstChild();
@@ -913,17 +913,17 @@ nsInlineFrame::PullOneFrame(nsPresContex
*aIsComplete = isComplete;
return frame;
}
void
nsInlineFrame::PushFrames(nsPresContext* aPresContext,
nsIFrame* aFromChild,
nsIFrame* aPrevSibling,
- InlineReflowState& aState)
+ InlineReflowInput& aState)
{
NS_PRECONDITION(aFromChild, "null pointer");
NS_PRECONDITION(aPrevSibling, "pushing first child");
NS_PRECONDITION(aPrevSibling->GetNextSibling() == aFromChild, "bad prev sibling");
#ifdef NOISY_PUSHING
printf("%p pushing aFromChild %p, disconnecting from prev sib %p\n",
this, aFromChild, aPrevSibling);
@@ -936,17 +936,17 @@ nsInlineFrame::PushFrames(nsPresContext*
aState.mLineLayout->SetDirtyNextLine();
}
}
//////////////////////////////////////////////////////////////////////
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)) {
return LogicalSides();
}
LogicalSides skip;
if (!IsFirst()) {
@@ -1071,42 +1071,42 @@ nsFirstLineFrame::GetFrameName(nsAString
nsIAtom*
nsFirstLineFrame::GetType() const
{
return nsGkAtoms::lineFrame;
}
nsIFrame*
-nsFirstLineFrame::PullOneFrame(nsPresContext* aPresContext, InlineReflowState& irs,
+nsFirstLineFrame::PullOneFrame(nsPresContext* aPresContext, InlineReflowInput& irs,
bool* aIsComplete)
{
nsIFrame* frame = nsInlineFrame::PullOneFrame(aPresContext, irs, aIsComplete);
if (frame && !GetPrevInFlow()) {
// We are a first-line frame. Fixup the child frames
// style-context that we just pulled.
NS_ASSERTION(frame->GetParent() == this, "Incorrect parent?");
aPresContext->RestyleManager()->ReparentStyleContext(frame);
nsLayoutUtils::MarkDescendantsDirty(frame);
}
return frame;
}
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();
if (prevInFlow) {
AutoFrameListPtr prevOverflowFrames(aPresContext,
prevInFlow->StealOverflowFrames());
if (prevOverflowFrames) {
// Assign all floats to our block if necessary
@@ -1120,21 +1120,21 @@ nsFirstLineFrame::Reflow(nsPresContext*
ReparentChildListStyle(aPresContext, newFrames, this);
}
}
// It's also possible that we have an overflow list for ourselves.
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();
if (wasEmpty) {
// Try to pull over one frame before starting so that we know
// whether we have an anonymous block or not.
bool complete;
PullOneFrame(aPresContext, irs, &complete);
@@ -1154,23 +1154,23 @@ nsFirstLineFrame::Reflow(nsPresContext*
if (!frame) {
break;
}
irs.mPrevFrame = frame;
}
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
}
/* virtual */ void
nsFirstLineFrame::PullOverflowsFromPrevInFlow()
{
nsFirstLineFrame* prevInFlow = static_cast<nsFirstLineFrame*>(GetPrevInFlow());
--- a/layout/generic/nsInlineFrame.h
+++ b/layout/generic/nsInlineFrame.h
@@ -76,17 +76,17 @@ public:
nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorder,
const mozilla::LogicalSize& aPadding,
ComputeSizeFlags aFlags) override;
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,
nsIAtom* aAttribute,
int32_t aModType) override;
virtual bool CanContinueTextRun() const override;
@@ -113,66 +113,66 @@ public:
// else return true if it's the last continuation.
return (GetStateBits() & NS_INLINE_FRAME_BIDI_VISUAL_STATE_IS_SET)
? !!(GetStateBits() & NS_INLINE_FRAME_BIDI_VISUAL_IS_LAST)
: (!GetNextInFlow());
}
protected:
// Additional reflow state used during our reflow methods
- struct InlineReflowState {
+ struct InlineReflowInput {
nsIFrame* mPrevFrame;
nsInlineFrame* mNextInFlow;
nsIFrame* mLineContainer;
nsLineLayout* mLineLayout;
bool mSetParentPointer; // when reflowing child frame first set its
// parent frame pointer
- InlineReflowState() {
+ InlineReflowInput() {
mPrevFrame = nullptr;
mNextInFlow = nullptr;
mLineContainer = nullptr;
mLineLayout = nullptr;
mSetParentPointer = false;
}
};
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);
/**
* Reparent floats whose placeholders are inline descendants of aFrame from
* whatever block they're currently parented by to aOurBlock.
* @param aReparentSiblings if this is true, we follow aFrame's
* GetNextSibling chain reparenting them all
*/
void ReparentFloatsForInlineChild(nsIFrame* aOurBlock, nsIFrame* aFrame,
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
// (which we only do for nsInlineFrame, not nsFirstLineFrame).
enum DrainFlags {
eDontReparentFrames = 1, // skip reparenting the overflow list frames
eInFirstLine = 2, // the request is for an inline descendant of a nsFirstLineFrame
eForDestroy = 4, // the request is from DestroyFrom; in this case we do the
@@ -205,26 +205,26 @@ public:
nsStyleContext* aContext);
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
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,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;
virtual void PullOverflowsFromPrevInFlow() override;
virtual bool DrainSelfOverflowList() override;
protected:
explicit nsFirstLineFrame(nsStyleContext* aContext) : nsInlineFrame(aContext) {}
virtual nsIFrame* PullOneFrame(nsPresContext* aPresContext,
- InlineReflowState& rs,
+ InlineReflowInput& rs,
bool* aIsComplete) override;
};
#endif /* nsInlineFrame_h___ */
--- a/layout/generic/nsLeafFrame.cpp
+++ b/layout/generic/nsLeafFrame.cpp
@@ -46,70 +46,70 @@ nsLeafFrame::ComputeAutoSize(nsRendering
const WritingMode wm = GetWritingMode();
LogicalSize result(wm, GetIntrinsicISize(), GetIntrinsicBSize());
return result.ConvertTo(aWM, wm);
}
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);
}
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();
}
nscoord
nsLeafFrame::GetIntrinsicBSize()
{
NS_NOTREACHED("Someone didn't override Reflow or ComputeAutoSize");
return 0;
}
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);
}
--- a/layout/generic/nsLeafFrame.h
+++ b/layout/generic/nsLeafFrame.h
@@ -53,25 +53,25 @@ public:
/**
* Reflow our frame. This will use the computed width plus borderpadding for
* the desired width, and use the return value of GetIntrinsicBSize plus
* borderpadding for the desired height. Ascent will be set to the height,
* and descent will be set to 0.
*/
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
/**
* This method does most of the work that Reflow() above need done.
*/
virtual void DoReflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus);
virtual bool IsFrameOfType(uint32_t aFlags) const override
{
// We don't actually contain a block, but we do always want a
// computed width, so tell a little white lie here.
return nsFrame::IsFrameOfType(aFlags & ~(nsIFrame::eReplacedContainsBlock));
}
@@ -94,13 +94,13 @@ protected:
* Reflow and ComputeAutoSize; the default Reflow and ComputeAutoSize impls
* call this method.
*/
virtual nscoord GetIntrinsicBSize();
/**
* Set aDesiredSize to be the available size
*/
- void SizeToAvailSize(const ReflowInput& aReflowState,
+ void SizeToAvailSize(const ReflowInput& aReflowInput,
ReflowOutput& aDesiredSize);
};
#endif /* nsLeafFrame_h___ */
--- a/layout/generic/nsLineLayout.cpp
+++ b/layout/generic/nsLineLayout.cpp
@@ -49,22 +49,22 @@
using namespace mozilla;
//----------------------------------------------------------------------
#define FIX_BUG_50257
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),
mBlockRS(nullptr),/* XXX temporary */
mLastOptionalBreakPriority(gfxBreakPriority::eNoBreak),
mLastOptionalBreakFrameOffset(-1),
mForceBreakFrameOffset(-1),
mMinLineBSize(0),
@@ -78,43 +78,43 @@ nsLineLayout::nsLineLayout(nsPresContext
mNeedBackup(false),
mInFirstLine(false),
mGotLineBox(false),
mInFirstLetter(false),
mHasBullet(false),
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;
mBStartEdge = 0;
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
// frames and spans won't waste a lot of time in unneeded
// initialization.
PL_INIT_ARENA_POOL(&mArena, "nsLineLayout", 1024);
mFrameFreeList = nullptr;
mSpanFreeList = nullptr;
@@ -157,29 +157,29 @@ nsLineLayout::BeginLineReflow(nscoord aI
NS_ASSERTION(nullptr == mRootSpan, "bad linelayout user");
LAYOUT_WARN_IF_FALSE(aISize != NS_UNCONSTRAINEDSIZE,
"have unconstrained width; this should only result from "
"very large sizes, not attempts at intrinsic width "
"calculation");
#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",
aIsTopOfPage ? "top-of-page" : "");
#endif
#ifdef DEBUG
mSpansAllocated = mSpansFreed = mFramesAllocated = mFramesFreed = 0;
#endif
@@ -200,70 +200,70 @@ nsLineLayout::BeginLineReflow(nscoord aI
mMaxStartBoxBSize = mMaxEndBoxBSize = 0;
if (mGotLineBox) {
mLineBox->ClearHasBullet();
}
PerSpanData* psd = NewPerSpanData();
mCurrentSpan = mRootSpan = psd;
- psd->mReflowState = mBlockReflowState;
+ psd->mReflowInput = mBlockReflowInput;
psd->mIStart = aICoord;
psd->mICoord = aICoord;
psd->mIEnd = aICoord + aISize;
mContainerSize = aContainerSize;
mBStartEdge = aBCoord;
psd->mNoWrap = !mStyleText->WhiteSpaceCanWrapStyle() || mSuppressLineWrap;
psd->mWritingMode = aWritingMode;
// 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);
mTextIndent = indent;
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();
}
}
}
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
NS_ASSERTION(!mBaseLineLayout ||
(!mSpansAllocated && !mSpansFreed && !mSpanFreeList &&
!mFramesAllocated && !mFramesFreed && !mFrameFreeList),
"Allocated frames or spans on non-base line layout?");
@@ -309,24 +309,24 @@ nsLineLayout::UpdateBand(WritingMode aWM
availSpace.IStart(lineWM), availSpace.BStart(lineWM),
availSpace.ISize(lineWM), availSpace.BSize(lineWM),
aFloatFrame);
#endif
#ifdef DEBUG
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));
}
#endif
// Compute the difference between last times width and the new width
NS_WARN_IF_FALSE(mRootSpan->mIEnd != NS_UNCONSTRAINEDSIZE &&
availSpace.ISize(lineWM) != NS_UNCONSTRAINEDSIZE,
@@ -335,17 +335,17 @@ nsLineLayout::UpdateBand(WritingMode aWM
"calculation");
// The root span's mIStart moves to aICoord
nscoord deltaICoord = availSpace.IStart(lineWM) - mRootSpan->mIStart;
// The inline size of all spans changes by this much (the root span's
// mIEnd moves to aICoord + aISize, its new inline size is aISize)
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),
deltaISize, deltaICoord);
#endif
// Update the root span position
mRootSpan->mIStart += deltaICoord;
@@ -411,17 +411,17 @@ nsLineLayout::NewPerSpanData()
#ifdef DEBUG
outerLineLayout->mSpansAllocated++;
#endif
return psd;
}
void
nsLineLayout::BeginSpan(nsIFrame* aFrame,
- const ReflowInput* aSpanReflowState,
+ const ReflowInput* aSpanReflowInput,
nscoord aIStart, nscoord aIEnd,
nscoord* aBaseline)
{
NS_ASSERTION(aIEnd != NS_UNCONSTRAINEDSIZE,
"should no longer be using unconstrained sizes");
#ifdef NOISY_REFLOW
nsFrame::IndentBy(stdout, mSpanDepth+1);
nsFrame::ListTag(stdout, aFrame);
@@ -432,27 +432,27 @@ nsLineLayout::BeginSpan(nsIFrame* aFrame
// Link up span frame's pfd to point to its child span data
PerFrameData* pfd = mCurrentSpan->mLastFrame;
NS_ASSERTION(pfd->mFrame == aFrame, "huh?");
pfd->mSpan = psd;
// 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;
mSpanDepth++;
}
nscoord
nsLineLayout::EndSpan(nsIFrame* aFrame)
@@ -462,17 +462,17 @@ nsLineLayout::EndSpan(nsIFrame* aFrame)
nsFrame::IndentBy(stdout, mSpanDepth);
nsFrame::ListTag(stdout, aFrame);
printf(": EndSpan width=%d\n", mCurrentSpan->mICoord - mCurrentSpan->mIStart);
#endif
PerSpanData* psd = mCurrentSpan;
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;
}
void
nsLineLayout::AttachFrameToBaseLineLayout(PerFrameData* aFrame)
{
NS_PRECONDITION(mBaseLineLayout,
@@ -868,48 +868,48 @@ nsLineLayout::ReflowFrame(nsIFrame* aFra
// reflects the space left on the line.
LAYOUT_WARN_IF_FALSE(psd->mIEnd != NS_UNCONSTRAINEDSIZE,
"have unconstrained width; this should only result from "
"very large sizes, not attempts at intrinsic width "
"calculation");
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.
// See if this frame depends on the width of its containing block. If
// so, disable resize reflow optimizations for the line. (Note that,
// to be conservative, we do this if we *try* to fit a frame on a
// line, even if we don't succeed.) (Note also that we can only make
@@ -935,21 +935,21 @@ nsLineLayout::ReflowFrame(nsIFrame* aFra
int32_t savedOptionalBreakOffset;
gfxBreakPriority savedOptionalBreakPriority;
nsIFrame* savedOptionalBreakFrame =
GetLastOptionalBreakPosition(&savedOptionalBreakOffset,
&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);
}
pfd->mJustificationInfo = mJustificationInfo;
mJustificationInfo = JustificationInfo();
// See if the frame is a placeholderFrame and if it is process
// the float. At the same time, check if the frame has any non-collapsed-away
@@ -1059,17 +1059,17 @@ nsLineLayout::ReflowFrame(nsIFrame* aFra
pfd->mBounds.ISize(lineWM) = metrics.ISize(lineWM);
pfd->mBounds.BSize(lineWM) = metrics.BSize(lineWM);
// Size the frame, but |RelativePositionFrames| will size the view.
aFrame->SetRect(lineWM, pfd->mBounds, ContainerSizeForSpan(psd));
// Tell the frame that we're done reflowing it
aFrame->DidReflow(mPresContext,
- isText ? nullptr : reflowStateHolder.ptr(),
+ isText ? nullptr : reflowInputHolder.ptr(),
nsDidReflowStatus::FINISHED);
if (aMetrics) {
*aMetrics = metrics;
}
if (!NS_INLINE_IS_BREAK_BEFORE(aReflowStatus)) {
// If frame is complete and has a next-in-flow, we need to delete
@@ -1095,17 +1095,17 @@ nsLineLayout::ReflowFrame(nsIFrame* aFra
if (!continuingTextRun && !pfd->mSkipWhenTrimmingWhitespace) {
mTrimmableISize = 0;
}
// See if we can place the frame. If we can't fit it, then we
// 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,
savedOptionalBreakFrame != nullptr, metrics,
aReflowStatus, &optionalBreakAfterFits)) {
if (!isEmpty) {
psd->mHasNonemptyContent = true;
mLineIsEmpty = false;
@@ -1165,49 +1165,49 @@ nsLineLayout::ReflowFrame(nsIFrame* aFra
printf("End ReflowFrame ");
nsFrame::ListTag(stdout, aFrame);
printf(" status=%x\n", aReflowStatus);
#endif
}
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.");
WritingMode lineWM = mRootSpan->mWritingMode;
// Only apply start-margin on the first-in flow for inline frames,
// and make sure to not apply it to any inline other than the first
// in an ib split. Note that the ib sibling (block-in-inline
// sibling) annotations only live on the first continuation, but we
// don't want to apply the start margin for later continuations
// anyway. For box-decoration-break:clone we apply the start-margin
// 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");
// For inline-ish and text-ish things (which don't compute widths
// 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);
}
}
nscoord
nsLineLayout::GetCurrentFrameInlineDistanceFromBlock()
{
PerSpanData* psd;
@@ -1465,17 +1465,17 @@ nsLineLayout::PlaceFrame(PerFrameData* p
void
nsLineLayout::AddBulletFrame(nsIFrame* aFrame,
const ReflowOutput& aMetrics)
{
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()) {
mHasBullet = true;
mLineBox->SetHasBullet();
}
WritingMode lineWM = mRootSpan->mWritingMode;
@@ -1899,17 +1899,17 @@ nsLineLayout::VerticalAlignFrames(PerSpa
else {
// Compute the logical block size for this span. The logical block size
// is based on the "line-height" value, not the font-size. Also
// compute the top leading.
float inflation =
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);
// Special-case for a ::first-letter frame, set the line height to
// the frame block size if the user has left line-height == normal
const nsStyleText* styleText = spanFrame->StyleText();
if (spanFramePFD->mIsLetterFrame &&
@@ -2187,17 +2187,17 @@ nsLineLayout::VerticalAlignFrames(PerSpa
// We have either a coord, a percent, or a calc().
nscoord pctBasis = 0;
if (verticalAlign.HasPercent()) {
// Percentages are like lengths, except treated as a percentage
// of the elements line block size value.
float inflation =
GetInflationForBlockDirAlignment(frame, mInflationMinFontSize);
pctBasis = ReflowInput::CalcLineHeight(frame->GetContent(),
- frame->StyleContext(), mBlockReflowState->ComputedBSize(),
+ frame->StyleContext(), mBlockReflowInput->ComputedBSize(),
inflation);
}
nscoord offset =
nsRuleNode::ComputeCoordPercentCalc(verticalAlign, pctBasis);
// According to the CSS2 spec (10.8.1), a positive value
// "raises" the box by the given distance while a negative value
// "lowers" the box by the given distance (with zero being the
// baseline). Since Y coordinates increase towards the bottom of
@@ -2583,17 +2583,17 @@ nsLineLayout::TrimTrailingWhiteSpaceIn(P
*aDeltaISize = 0;
return true;
}
else if (pfd->mIsTextFrame) {
// Call TrimTrailingWhiteSpace even on empty textframes because they
// 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 ");
nsFrame::ListTag(stdout, pfd->mFrame);
printf(" returned %d\n", trimOutput.mDeltaWidth);
#endif
if (trimOutput.mChanged) {
@@ -3116,17 +3116,17 @@ nsLineLayout::TextAlignLine(nsLineBox* a
WritingMode lineWM = psd->mWritingMode;
LAYOUT_WARN_IF_FALSE(psd->mIEnd != NS_UNCONSTRAINEDSIZE,
"have unconstrained width; this should only result from "
"very large sizes, not attempts at intrinsic width "
"calculation");
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
// 'text-align-last: auto' is equivalent to the value of the 'text-align'
// property except when 'text-align' is set to 'justify', in which case it
// is 'justify' when 'text-justify' is 'distribute' and 'start' otherwise.
//
@@ -3141,17 +3141,17 @@ nsLineLayout::TextAlignLine(nsLineBox* a
if (textAlign == NS_STYLE_TEXT_ALIGN_JUSTIFY) {
textAlign = NS_STYLE_TEXT_ALIGN_START;
}
} else {
textAlign = mStyleText->mTextAlignLast;
}
}
- bool isSVG = mBlockReflowState->mFrame->IsSVGText();
+ bool isSVG = mBlockReflowInput->mFrame->IsSVGText();
bool doTextAlign = remainingISize > 0 || textAlignTrue;
int32_t additionalGaps = 0;
if (!isSVG && (mHasRuby || (doTextAlign &&
textAlign == NS_STYLE_TEXT_ALIGN_JUSTIFY))) {
JustificationComputationState computeState;
ComputeFrameJustification(psd, computeState);
if (mHasRuby && computeState.mFirstParticipant) {
@@ -3358,17 +3358,17 @@ nsLineLayout::RelativePositionFrames(Per
// (3) When there are text emphasis marks, since the marks may be
// put further away if the text is inside ruby.
// (4) When there are text strokes
if (pfd->mRecomputeOverflow ||
frame->StyleContext()->HasTextDecorationLines() ||
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());
}
// If we have something that's not an inline but with a complex frame
// hierarchy inside that contains views, they need to be
// positioned.
// All descendant views must be repositioned even if this frame
--- a/layout/generic/nsLineLayout.h
+++ b/layout/generic/nsLineLayout.h
@@ -34,17 +34,17 @@ class nsLineLayout {
public:
/**
* @param aBaseLineLayout the nsLineLayout for ruby base,
* nullptr if no separate base nsLineLayout is needed.
*/
nsLineLayout(nsPresContext* aPresContext,
nsFloatManager* aFloatManager,
- const ReflowInput* aOuterReflowState,
+ const ReflowInput* aOuterReflowInput,
const nsLineList::iterator* aLine,
nsLineLayout* aBaseLineLayout);
~nsLineLayout();
void Init(BlockReflowInput* aState, nscoord aMinLineBSize,
int32_t aLineNumber) {
mBlockRS = aState;
mMinLineBSize = aMinLineBSize;
@@ -71,17 +71,17 @@ public:
* @param aX/aY/aWidth/aHeight are the new available
* space rectangle, relative to the containing block.
* @param aFloatFrame the float frame that was placed.
*/
void UpdateBand(mozilla::WritingMode aWM,
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
nscoord EndSpan(nsIFrame* aFrame);
// This method attaches the last frame reflowed in this line layout
// to that in the base line layout.
void AttachLastFrameToBaseLineLayout()
@@ -337,18 +337,18 @@ public:
return mForceBreakFrame == aFrame ? mForceBreakFrameOffset : -1;
}
/**
* This can't be null. It usually returns a block frame but may return
* 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;
}
nsLineList::iterator* GetLine() {
return mGotLineBox ? &mLineBox : nullptr;
}
/**
@@ -378,17 +378,17 @@ public:
nscoord GetCurrentICoord() { return mCurrentSpan->mICoord; }
void SetSuppressLineWrap(bool aEnabled) { mSuppressLineWrap = aEnabled; }
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
// annotations. When there is nested ruby inside annotation, it
// forms a linked list from the inner annotation to the outermost
// line layout. The outermost line layout, which has this member
// being nullptr, is responsible for managing the life cycle of
// per-frame data and per-span data, and handling floats.
@@ -529,17 +529,17 @@ protected:
PerFrameData* mFirstFrame;
// The last PerFrameData structure in the span. PerFrameData structures are
// added to the span as they are reflowed. mLastFrame may also be directly
// manipulated if a line is split, or if frames are pushed from one line to
// the next.
PerFrameData* mLastFrame;
- const ReflowInput* mReflowState;
+ const ReflowInput* mReflowInput;
bool mNoWrap;
mozilla::WritingMode mWritingMode;
bool mContainsFloat;
bool mHasNonemptyContent;
nscoord mIStart;
nscoord mICoord;
nscoord mIEnd;
@@ -662,17 +662,17 @@ protected:
bool InBlockContext() const {
return mSpanDepth == 0;
}
void PushFrame(nsIFrame* aFrame);
void AllowForStartMargin(PerFrameData* pfd,
- ReflowInput& aReflowState);
+ ReflowInput& aReflowInput);
void SyncAnnotationBounds(PerFrameData* aRubyFrame);
bool CanPlaceFrame(PerFrameData* pfd,
bool aNotSafeToBreak,
bool aFrameCanContinueTextRun,
bool aCanRollBackBeforeFrame,
ReflowOutput& aMetrics,
--- a/layout/generic/nsPageContentFrame.cpp
+++ b/layout/generic/nsPageContentFrame.cpp
@@ -18,100 +18,100 @@ NS_NewPageContentFrame(nsIPresShell* aPr
return new (aPresShell) nsPageContentFrame(aContext);
}
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)) {
nsresult rv = aPresContext->PresShell()->FrameConstructor()
->ReplicateFixedFrames(this);
if (NS_FAILED(rv)) {
return;
}
}
// 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.
// Resize our frame allowing it only to be as big as we are
// XXX Pay attention to the page's border and padding...
if (mFrames.NotEmpty()) {
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
// absolutely positioned elements
nsMargin padding(0,0,0,0);
// 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
// make the content that ought to be reachable (represented by the
// scrollable overflow) fit in the page.
if (frame->HasOverflowAreas()) {
// The background covers the content area and padding area, so check
// for children sticking outside the child frame's padding edge
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);
}
}
// 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");
}
// 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*
nsPageContentFrame::GetType() const
{
return nsGkAtoms::pageContentFrame;
}
--- a/layout/generic/nsPageFrame.cpp
+++ b/layout/generic/nsPageFrame.cpp
@@ -47,22 +47,22 @@ nsPageFrame::nsPageFrame(nsStyleContext*
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() &&
nsGkAtoms::pageContentFrame == mFrames.FirstChild()->GetType(),
"pageFrame must have a pageContentFrame child");
// Resize our frame allowing it only to be as big as we are
// XXX Pay attention to the page's border and padding...
@@ -89,30 +89,30 @@ nsPageFrame::Reflow(nsPresContext*
// XXX Shouldn't we do something more friendly when invalid margins
// are set?
if (maxSize.width < onePixelInTwips || maxSize.height < onePixelInTwips) {
aDesiredSize.ClearSize();
NS_WARNING("Reflow aborted; no space for content");
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);
}
}
nscoord maxWidth = maxSize.width - mPageContentMargin.LeftRight() / scale;
nscoord maxHeight;
if (maxSize.height == NS_UNCONSTRAINEDSIZE) {
maxHeight = NS_UNCONSTRAINEDSIZE;
@@ -128,50 +128,50 @@ nsPageFrame::Reflow(nsPresContext*
mPageContentMargin.Side(side) = mPD->mReflowMargin.Side(side);
}
maxWidth = maxSize.width - mPageContentMargin.LeftRight() / scale;
if (maxHeight != NS_UNCONSTRAINEDSIZE) {
maxHeight = maxSize.height - mPageContentMargin.TopBottom() / scale;
}
}
- 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*
nsPageFrame::GetType() const
{
return nsGkAtoms::pageFrame;
}
@@ -704,28 +704,28 @@ nscoord
nsPageBreakFrame::GetIntrinsicBSize()
{
return 0;
}
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);
aDesiredSize.SetSize(wm, finalSize);
// Note: not using NS_FRAME_FIRST_REFLOW here, since it's not clear whether
// DidReflow will always get called before the next Reflow() call.
mHaveReflowed = true;
--- a/layout/generic/nsPageFrame.h
+++ b/layout/generic/nsPageFrame.h
@@ -108,17 +108,17 @@ class nsPageBreakFrame : public nsLeafFr
{
NS_DECL_FRAMEARENA_HELPERS
explicit nsPageBreakFrame(nsStyleContext* aContext);
~nsPageBreakFrame();
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsIAtom* GetType() const override;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
--- a/layout/generic/nsPlaceholderFrame.cpp
+++ b/layout/generic/nsPlaceholderFrame.cpp
@@ -101,17 +101,17 @@ nsPlaceholderFrame::AddInlinePrefISize(n
aData->mFloats.AppendElement(
InlineIntrinsicISizeData::FloatInfo(mOutOfFlowFrame, floatWidth));
}
}
void
nsPlaceholderFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
#ifdef DEBUG
// We should be getting reflowed before our out-of-flow.
// If this is our first reflow, and our out-of-flow has already received its
// first reflow (before us), complain.
// XXXdholbert This "look for a previous continuation or IB-split sibling"
// code could use nsLayoutUtils::GetPrevContinuationOrIBSplitSibling(), if
@@ -138,21 +138,21 @@ nsPlaceholderFrame::Reflow(nsPresContext
} else {
NS_ERROR("Out-of-flow frame got reflowed before its placeholder");
}
}
#endif
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
nsPlaceholderFrame::DestroyFrom(nsIFrame* aDestructRoot)
{
nsIFrame* oof = mOutOfFlowFrame;
if (oof) {
// Unregister out-of-flow frame
--- a/layout/generic/nsPlaceholderFrame.h
+++ b/layout/generic/nsPlaceholderFrame.h
@@ -95,17 +95,17 @@ public:
virtual void AddInlinePrefISize(nsRenderingContext* aRenderingContext,
InlinePrefISizeData* aData) override;
virtual nsSize GetXULMinSize(nsBoxLayoutState& aBoxLayoutState) override;
virtual nsSize GetXULPrefSize(nsBoxLayoutState& aBoxLayoutState) override;
virtual nsSize GetXULMaxSize(nsBoxLayoutState& aBoxLayoutState) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
#if defined(DEBUG) || (defined(MOZ_REFLOW_PERF_DSP) && defined(MOZ_REFLOW_PERF))
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
--- a/layout/generic/nsPluginFrame.cpp
+++ b/layout/generic/nsPluginFrame.cpp
@@ -420,41 +420,41 @@ nsPluginFrame::GetWidgetConfiguration(ns
configuration->mVisible = mWidget->IsVisible();
}
#endif // defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
}
void
nsPluginFrame::GetDesiredSize(nsPresContext* aPresContext,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
ReflowOutput& aMetrics)
{
// By default, we have no area
aMetrics.ClearSize();
if (IsHidden(false)) {
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)
// We need to make sure that the size of the object frame does not
// exceed the maximum size of X coordinates. See bug #225357 for
// more information. In theory Gtk2 can handle large coordinates,
// but underlying plugins can't.
aMetrics.Height() = std::min(aPresContext->DevPixelsToAppUnits(INT16_MAX), aMetrics.Height());
@@ -462,49 +462,49 @@ nsPluginFrame::GetDesiredSize(nsPresCont
#endif
}
// At this point, the width has an unconstrained value only if we have
// nothing to go on (no width set, no information from the plugin, nothing).
// 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:
// a) We are in standards mode with percent heights and parent is auto-height
// b) We have no height information at all.
// 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
// plugin's size and positioning if we do... Eventually we _do_ want to
// paint borders, though! At that point, we will need to adjust the desired
// size either here or in Reflow.... Further, we will need to fix Paint() to
// call the superclass in all cases.
}
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);
// delay plugin instantiation until all children have
// arrived. Otherwise there may be PARAMs or other stuff that the
// plugin needs to see that haven't arrived yet.
if (!GetContent()->IsDoneAddingChildren()) {
aStatus = NS_FRAME_COMPLETE;
@@ -513,33 +513,33 @@ nsPluginFrame::Reflow(nsPresContext*
// if we are printing or print previewing, bail for now
if (aPresContext->Medium() == nsGkAtoms::print) {
aStatus = NS_FRAME_COMPLETE;
return;
}
nsRect r(0, 0, aMetrics.Width(), aMetrics.Height());
- r.Deflate(aReflowState.ComputedPhysicalBorderPadding());
+ r.Deflate(aReflowInput.ComputedPhysicalBorderPadding());
if (mInnerView) {
nsViewManager* vm = mInnerView->GetViewManager();
vm->MoveViewTo(mInnerView, r.x, r.y);
vm->ResizeView(mInnerView, nsRect(nsPoint(0, 0), r.Size()), true);
}
FixupWindow(r.Size());
if (!mReflowCallbackPosted) {
mReflowCallbackPosted = true;
aPresContext->PresShell()->PostReflowCallback(this);
}
aStatus = NS_FRAME_COMPLETE;
- NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);
+ NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aMetrics);
}
///////////// nsIReflowCallback ///////////////
bool
nsPluginFrame::ReflowFinished()
{
mReflowCallbackPosted = false;
@@ -817,29 +817,29 @@ nsPluginFrame::GetWindowOriginInPixels(b
pt += nsIntPoint(lpt.x, lpt.y);
}
return pt;
}
void
nsPluginFrame::DidReflow(nsPresContext* aPresContext,
- const ReflowInput* aReflowState,
+ const ReflowInput* aReflowInput,
nsDidReflowStatus aStatus)
{
// Do this check before calling the superclass, as that clears
// NS_FRAME_FIRST_REFLOW
if (aStatus == nsDidReflowStatus::FINISHED &&
(GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
nsCOMPtr<nsIObjectLoadingContent> objContent(do_QueryInterface(mContent));
NS_ASSERTION(objContent, "Why not an object loading content?");
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.
if (aStatus != nsDidReflowStatus::FINISHED)
return;
if (HasView()) {
nsView* view = GetView();
--- a/layout/generic/nsPluginFrame.h
+++ b/layout/generic/nsPluginFrame.h
@@ -69,20 +69,20 @@ public:
virtual void Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
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,
const nsDisplayListSet& aLists) override;
virtual nsresult HandleEvent(nsPresContext* aPresContext,
mozilla::WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus) override;
@@ -228,17 +228,17 @@ public:
protected:
explicit nsPluginFrame(nsStyleContext* aContext);
virtual ~nsPluginFrame();
// 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,
bool aWithMouse = false) override;
// check attributes and optionally CSS to see if we should display anything
bool IsHidden(bool aCheckVisibilityStyle = true) const;
--- a/layout/generic/nsRubyBaseContainerFrame.cpp
+++ b/layout/generic/nsRubyBaseContainerFrame.cpp
@@ -288,132 +288,132 @@ nsRubyBaseContainerFrame::GetLogicalBase
return mBaseline;
}
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;
}
MoveOverflowToChildList();
// Ask text containers to drain overflows
AutoRubyTextContainerArray textContainers(this);
const uint32_t rtcCount = textContainers.Length();
for (uint32_t i = 0; i < rtcCount; i++) {
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
// reflow those RTCs in this code. These two arrays are holders of
// the reflow states and line layouts.
// 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.
bool hasSpan = false;
for (uint32_t i = 0; i < rtcCount; i++) {
nsRubyTextContainerFrame* textContainer = textContainers[i];
if (textContainer->IsSpanContainer()) {
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
// container could be non-zero because of non-empty ruby annotations.
// XXX When bug 765861 gets fixed, this warning should be upgraded.
NS_WARN_IF_FALSE(NS_INLINE_IS_BREAK(aStatus) ||
isize == lineSpanSize || mFrames.IsEmpty(), "bad isize");
// If there exists any span, the columns must either be completely
// reflowed, or be not reflowed at all.
MOZ_ASSERT(NS_INLINE_IS_BREAK_BEFORE(aStatus) ||
NS_FRAME_IS_COMPLETE(aStatus) || !hasSpan);
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);
}
for (uint32_t i = 0; i < rtcCount; i++) {
// It happens before the ruby text container is reflowed, and that
// when it is reflowed, it will just use this size.
nsRubyTextContainerFrame* textContainer = textContainers[i];
nsLineLayout* lineLayout = lineLayouts[i].get();
@@ -432,17 +432,17 @@ nsRubyBaseContainerFrame::Reflow(nsPresC
lineLayout->VerticalAlignLine();
textContainer->SetISize(rtcISize);
lineLayout->EndLineReflow();
}
// 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);
}
/**
* This struct stores the continuations after this frame and
* corresponding text containers. It is used to speed up looking
@@ -454,57 +454,57 @@ struct MOZ_STACK_CLASS nsRubyBaseContain
AutoTArray<ContinuationTraversingState, RTC_ARRAY_SIZE> mTexts;
const AutoRubyTextContainerArray& mTextContainers;
PullFrameState(nsRubyBaseContainerFrame* aBaseContainer,
const AutoRubyTextContainerArray& aTextContainers);
};
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;
aStatus = NS_FRAME_COMPLETE;
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++;
}
if (NS_INLINE_IS_BREAK(reflowStatus)) {
break;
}
// We are not handling overflow here.
MOZ_ASSERT(reflowStatus == NS_FRAME_COMPLETE);
}
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);
// Try pull some frames from next continuations. This call replaces
// frames in |column| with the frame pulled in each level.
PullOneColumn(lineLayout, pullFrameState, column, isComplete);
if (isComplete) {
// 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++;
}
}
if (!e.AtEnd() && NS_INLINE_IS_BREAK_AFTER(reflowStatus)) {
// The current column has been successfully placed.
// Skip to the next column and mark break before.
@@ -512,24 +512,24 @@ nsRubyBaseContainerFrame::ReflowColumns(
e.GetColumn(column);
reflowStatus = NS_INLINE_LINE_BREAK_BEFORE();
}
if (!e.AtEnd() || (GetNextInFlow() && !isComplete)) {
NS_FRAME_SET_INCOMPLETE(aStatus);
}
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
// end of the frame-sibling-chain at that level -- instead, they
// represent an anonymous empty intra-level whitespace box. It is
// likely that there are frames in the next column (which can't be
// intra-level whitespace). Those frames should be pushed as well.
Maybe<RubyColumn> nextColumn;
@@ -546,70 +546,70 @@ nsRubyBaseContainerFrame::ReflowColumns(
PushChildren(baseFrame, baseFrame->GetPrevSibling());
}
for (uint32_t i = 0; i < rtcCount; i++) {
nsRubyTextFrame* textFrame = column.mTextFrames[i];
if (!textFrame && nextColumn.isSome()) {
textFrame = nextColumn->mTextFrames[i];
}
if (textFrame) {
- aReflowState.mTextContainers[i]->PushChildren(
+ aReflowInput.mTextContainers[i]->PushChildren(
textFrame, textFrame->GetPrevSibling());
}
}
} else if (NS_INLINE_IS_BREAK_AFTER(reflowStatus)) {
// |reflowStatus| being break after here may only happen when
// there is a break after the column just pulled, or the whole
// segment has been completely reflowed. In those cases, we do
// not need to push anything.
MOZ_ASSERT(e.AtEnd());
aStatus = NS_INLINE_LINE_BREAK_AFTER(aStatus);
}
return icoord;
}
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;
}
}
}
}
}
- 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;
if (aColumn.mBaseFrame) {
nsLayoutUtils::GetFrameTextContent(aColumn.mBaseFrame, baseText);
}
// Reflow text frames
@@ -628,17 +628,17 @@ nsRubyBaseContainerFrame::ReflowOneColum
textFrame->AddStateBits(NS_RUBY_TEXT_FRAME_AUTOHIDE);
} else {
textFrame->RemoveStateBits(NS_RUBY_TEXT_FRAME_AUTOHIDE);
}
RubyUtils::ClearReservedISize(textFrame);
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)) {
MOZ_ASSERT_UNREACHABLE(
"Any line break inside ruby box should have been suppressed");
// For safety, always drain the overflow list, so that
// no frames are left there after reflow.
textFrame->DrainSelfOverflowList();
@@ -649,45 +649,45 @@ nsRubyBaseContainerFrame::ReflowOneColum
}
// Reflow the base frame
if (aColumn.mBaseFrame) {
RubyUtils::ClearReservedISize(aColumn.mBaseFrame);
bool pushedFrame;
nsReflowStatus reflowStatus;
- nsLineLayout* lineLayout = baseReflowState.mLineLayout;
+ nsLineLayout* lineLayout = baseReflowInput.mLineLayout;
nscoord baseIStart = lineLayout->GetCurrentICoord();
lineLayout->ReflowFrame(aColumn.mBaseFrame, reflowStatus,
nullptr, pushedFrame);
if (MOZ_UNLIKELY(NS_INLINE_IS_BREAK(reflowStatus) || pushedFrame)) {
MOZ_ASSERT_UNREACHABLE(
"Any line break inside ruby box should have been suppressed");
// For safety, always drain the overflow list, so that
// no frames are left there after reflow.
aColumn.mBaseFrame->DrainSelfOverflowList();
}
nscoord baseISize = lineLayout->GetCurrentICoord() - baseIStart;
columnISize = std::max(columnISize, baseISize);
}
// 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) {
lineLayout->AdvanceICoord(deltaISize);
if (textFrame && !textFrame->IsAutoHidden()) {
RubyUtils::SetReservedISize(textFrame, deltaISize);
}
}
@@ -803,30 +803,30 @@ nsRubyBaseContainerFrame::PullOneColumn(
if (!aIsComplete) {
// We pulled frames from the next line, hence mark it dirty.
aLineLayout->SetDirtyNextLine();
}
}
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;
}
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);
MOZ_ASSERT(!NS_INLINE_IS_BREAK(reflowStatus) && !pushedFrame,
"Any line break inside ruby box should has been suppressed");
spanISize = std::max(spanISize, lineLayout->GetCurrentICoord());
}
return spanISize;
--- a/layout/generic/nsRubyBaseContainerFrame.h
+++ b/layout/generic/nsRubyBaseContainerFrame.h
@@ -43,40 +43,40 @@ public:
const mozilla::LogicalSize& aCBSize,
nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorder,
const mozilla::LogicalSize& aPadding,
ComputeSizeFlags aFlags) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nscoord
GetLogicalBaseline(mozilla::WritingMode aWritingMode) const override;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
protected:
friend nsContainerFrame*
NS_NewRubyBaseContainerFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext);
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;
// Pull ruby base and corresponding ruby text frames from
// continuations after them.
void PullOneColumn(nsLineLayout* aLineLayout,
PullFrameState& aPullFrameState,
mozilla::RubyColumn& aColumn,
--- a/layout/generic/nsRubyFrame.cpp
+++ b/layout/generic/nsRubyFrame.cpp
@@ -87,117 +87,117 @@ nsRubyFrame::AddInlinePrefISize(nsRender
e.GetBaseContainer()->AddInlinePrefISize(aRenderingContext, aData);
}
}
}
/* 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;
}
// Grab overflow frames from prev-in-flow and its own.
MoveOverflowToChildList();
// Clear leadings
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.
// Don't continue reflowing more segments.
break;
}
}
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);
}
if (boxDecorationBreakClone || NS_FRAME_IS_COMPLETE(aStatus)) {
aDesiredSize.ISize(lineWM) += borderPadding.IEnd(frameWM);
}
nsLayoutUtils::SetBSizeFromFontMetrics(this, aDesiredSize,
borderPadding, lineWM, frameWM);
}
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");
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)) {
if (aBaseContainer != mFrames.FirstChild()) {
// Some segments may have been reflowed before, hence it is not
// 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.
return;
}
if (NS_FRAME_IS_NOT_COMPLETE(aStatus)) {
// It always promise that if the status is incomplete, there is a
// break occurs. Break before has been processed above. However,
@@ -233,17 +233,17 @@ nsRubyFrame::ReflowSegment(nsPresContext
newLastChild = newTextContainer;
}
}
if (lastChild != mFrames.LastChild()) {
// Always push the next frame after the last child in this segment.
// 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
// layout will remove the next-in-flows of that frame. But the
// line layout is not aware of the ruby text containers, hence
// it is necessary to remove them here.
for (uint32_t i = 0; i < rtcCount; i++) {
nsIFrame* nextRTC = textContainers[i]->GetNextInFlow();
@@ -266,26 +266,26 @@ nsRubyFrame::ReflowSegment(nsPresContext
// XXX We may need to add border/padding here. See bug 1055667.
baseRect.BStart(lineWM) = 0;
// The rect for offsets of text containers.
LogicalRect offsetRect = baseRect;
for (uint32_t i = 0; i < rtcCount; i++) {
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.
NS_ASSERTION(textReflowStatus == NS_FRAME_COMPLETE,
"Ruby text container must not break itself inside");
// The metrics is initialized with reflow state of this ruby frame,
// hence the writing-mode is tied to rubyWM instead of rtcWM.
LogicalSize size = textMetrics.Size(rubyWM).ConvertTo(lineWM, rubyWM);
@@ -320,27 +320,27 @@ nsRubyFrame::ReflowSegment(nsPresContext
} else {
MOZ_ASSERT_UNREACHABLE("???");
}
}
// Using a dummy container-size here, so child positioning may not be
// 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");
nscoord deltaISize = segmentISize - baseMetrics.ISize(lineWM);
if (deltaISize <= 0) {
RubyUtils::ClearReservedISize(aBaseContainer);
} else {
RubyUtils::SetReservedISize(aBaseContainer, deltaISize);
- aReflowState.mLineLayout->AdvanceICoord(deltaISize);
+ aReflowInput.mLineLayout->AdvanceICoord(deltaISize);
}
// Set block leadings of the base container
nscoord startLeading = baseRect.BStart(lineWM) - offsetRect.BStart(lineWM);
nscoord endLeading = offsetRect.BEnd(lineWM) - baseRect.BEnd(lineWM);
// XXX When bug 765861 gets fixed, this warning should be upgraded.
NS_WARN_IF_FALSE(startLeading >= 0 && endLeading >= 0,
"Leadings should be non-negative (because adding "
--- a/layout/generic/nsRubyFrame.h
+++ b/layout/generic/nsRubyFrame.h
@@ -31,17 +31,17 @@ public:
virtual nsIAtom* GetType() const override;
virtual bool IsFrameOfType(uint32_t aFlags) const override;
virtual void AddInlineMinISize(nsRenderingContext *aRenderingContext,
InlineMinISizeData *aData) override;
virtual void AddInlinePrefISize(nsRenderingContext *aRenderingContext,
InlinePrefISizeData *aData) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
void GetBlockLeadings(nscoord& aStartLeading, nscoord& aEndLeading)
{
@@ -51,17 +51,17 @@ public:
protected:
friend nsContainerFrame* NS_NewRubyFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext);
explicit nsRubyFrame(nsStyleContext* aContext)
: nsInlineFrame(aContext) {}
void ReflowSegment(nsPresContext* aPresContext,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsRubyBaseContainerFrame* aBaseContainer,
nsReflowStatus& aStatus);
nsRubyBaseContainerFrame* PullOneSegment(const nsLineLayout* aLineLayout,
ContinuationTraversingState& aState);
// The leading required to put the annotations.
// They are not initialized until the first reflow.
--- a/layout/generic/nsRubyTextContainerFrame.cpp
+++ b/layout/generic/nsRubyTextContainerFrame.cpp
@@ -117,29 +117,29 @@ nsRubyTextContainerFrame::UpdateSpanFlag
} else {
RemoveStateBits(NS_RUBY_TEXT_CONTAINER_IS_SPAN);
}
}
/* 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;
// The container size is not yet known, so we use a dummy (0, 0) size.
// The block-dir position will be corrected below after containerSize
// is finalized.
const nsSize dummyContainerSize;
for (nsFrameList::Enumerator e(mFrames); !e.AtEnd(); e.Next()) {
--- a/layout/generic/nsRubyTextContainerFrame.h
+++ b/layout/generic/nsRubyTextContainerFrame.h
@@ -25,17 +25,17 @@ public:
NS_DECL_QUERYFRAME_TARGET(nsRubyTextContainerFrame)
NS_DECL_QUERYFRAME
// nsIFrame overrides
virtual nsIAtom* GetType() const override;
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
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
// nsContainerFrame overrides
virtual void SetInitialChildList(ChildListID aListID,
--- a/layout/generic/nsRubyTextFrame.cpp
+++ b/layout/generic/nsRubyTextFrame.cpp
@@ -71,27 +71,27 @@ nsRubyTextFrame::BuildDisplayList(nsDisp
}
nsRubyContentFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists);
}
/* 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.
// If we leave it dirty, changes to its content will never be
// propagated to the ancestors, then it won't be displayed even if
// 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();
}
}
--- a/layout/generic/nsRubyTextFrame.h
+++ b/layout/generic/nsRubyTextFrame.h
@@ -34,17 +34,17 @@ public:
#endif
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
bool IsAutoHidden() const
{
return GetStateBits() & NS_RUBY_TEXT_FRAME_AUTOHIDE;
}
protected:
--- a/layout/generic/nsSimplePageSequenceFrame.cpp
+++ b/layout/generic/nsSimplePageSequenceFrame.cpp
@@ -86,27 +86,27 @@ nsSimplePageSequenceFrame::~nsSimplePage
NS_QUERYFRAME_HEAD(nsSimplePageSequenceFrame)
NS_QUERYFRAME_ENTRY(nsIPageSequenceFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
//----------------------------------------------------------------------
void
nsSimplePageSequenceFrame::SetDesiredSize(ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nscoord aWidth,
nscoord aHeight)
{
// Aim to fill the whole size of the document, not only so we
// 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()));
}
// Helper function to compute the offset needed to center a child
// page-frame's margin-box inside our content-box.
nscoord
nsSimplePageSequenceFrame::ComputeCenteringMargin(
nscoord aContainerContentBoxWidth,
@@ -140,43 +140,43 @@ nsSimplePageSequenceFrame::ComputeCenter
// that it'll produce the correct scaled-up amount when we render (because
// rendering will scale it back up):
return NSToCoordRound(scaledExtraSpace * 0.5 / ppScale);
}
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
// Don't do incremental reflow until we've taught tables how to do
// 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);
if (GetRect().Width() != aDesiredSize.Width()) {
// Our width is changing; we need to re-center our children (our pages).
for (nsFrameList::Enumerator e(mFrames); !e.AtEnd(); e.Next()) {
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;
// Adjust the child's x-position:
child->MovePositionBy(nsPoint(newX - child->GetNormalPosition().x, 0));
}
}
@@ -237,43 +237,43 @@ nsSimplePageSequenceFrame::Reflow(nsPres
// We use the CSS "margin" property on the -moz-page pseudoelement
// to determine the space between each page in print preview.
// Keep a running y-offset for each page.
nscoord y = 0;
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
nsPageFrame * pf = static_cast<nsPageFrame*>(kidFrame);
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);
y += kidSize.Height();
y += pageCSSMargin.bottom;
maxXMost = std::max(maxXMost, x + kidSize.Width() + pageCSSMargin.right);
@@ -325,28 +325,28 @@ nsSimplePageSequenceFrame::Reflow(nsPres
ltime,
formattedDateString))) {
SetDateTimeStr(formattedDateString);
}
// 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);
// cache the size so we can set the desired size
// for the other reflows that happen
mSize.width = maxXMost;
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);
}
//----------------------------------------------------------------------
#ifdef DEBUG_FRAME_DUMP
nsresult
nsSimplePageSequenceFrame::GetFrameName(nsAString& aResult) const
{
--- a/layout/generic/nsSimplePageSequenceFrame.h
+++ b/layout/generic/nsSimplePageSequenceFrame.h
@@ -121,17 +121,17 @@ protected:
// SharedPageData Helper methods
void SetDateTimeStr(const nsAString& aDateTimeStr);
void SetPageNumberFormat(const nsAString& aFormatStr, bool aForPageNumOnly);
// 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
// page-frame's margin-box inside our content-box.
nscoord ComputeCenteringMargin(nscoord aContainerContentBoxWidth,
nscoord aChildPaddingBoxWidth,
const nsMargin& aChildPhysicalMargin);
--- a/layout/generic/nsSplittableFrame.cpp
+++ b/layout/generic/nsSplittableFrame.cpp
@@ -212,61 +212,61 @@ nsSplittableFrame::GetConsumedBSize() co
nscoord height = 0;
for (nsIFrame* prev = GetPrevInFlow(); prev; prev = prev->GetPrevInFlow()) {
height += prev->GetContentRectRelativeToSelf().height;
}
return height;
}
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;
}
if (aConsumedBSize == NS_INTRINSICSIZE) {
aConsumedBSize = GetConsumedBSize();
}
bSize -= aConsumedBSize;
// We may have stretched the frame beyond its computed height. Oh well.
return std::max(0, bSize);
}
nsIFrame::LogicalSides
-nsSplittableFrame::GetLogicalSkipSides(const ReflowInput* aReflowState) const
+nsSplittableFrame::GetLogicalSkipSides(const ReflowInput* aReflowInput) const
{
if (IS_TRUE_OVERFLOW_CONTAINER(this)) {
return LogicalSides(eLogicalSideBitsBBoth);
}
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
NS_STYLE_BOX_DECORATION_BREAK_CLONE)) {
return LogicalSides();
}
LogicalSides skip;
if (GetPrevInFlow()) {
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;
}
}
} else {
nsIFrame* nif = GetNextInFlow();
if (nif && !IS_TRUE_OVERFLOW_CONTAINER(nif)) {
--- a/layout/generic/nsSplittableFrame.h
+++ b/layout/generic/nsSplittableFrame.h
@@ -84,23 +84,23 @@ protected:
* of calls to this method.
*/
nscoord GetConsumedBSize() const;
/**
* 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
* inside Reflow before it's known if |this| frame will be COMPLETE or not.
* It returns a result that assumes this fragment is the last and thus
* should apply the block-end border/padding etc (except for "true" overflow
* containers which always skip block sides). You're then expected to
* recalculate the block-end side (as needed) when you know |this| frame's
--- a/layout/generic/nsSubDocumentFrame.cpp
+++ b/layout/generic/nsSubDocumentFrame.cpp
@@ -755,49 +755,49 @@ nsSubDocumentFrame::ComputeSize(nsRender
aCBSize, aAvailableISize,
aMargin, aBorder, aPadding,
aFlags);
}
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");
aStatus = NS_FRAME_COMPLETE;
NS_ASSERTION(mContent->GetPrimaryFrame() == this,
"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());
// Size & position the view according to 'object-fit' & 'object-position'.
nsIFrame* subDocRoot = ObtainIntrinsicSizeFrame();
IntrinsicSize intrinsSize;
nsSize intrinsRatio;
if (subDocRoot) {
@@ -828,17 +828,17 @@ nsSubDocumentFrame::Reflow(nsPresContext
PresContext()->PresShell()->PostReflowCallback(this);
mPostedReflowCallback = true;
}
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("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
nsSubDocumentFrame::ReflowFinished()
{
if (mFrameLoader) {
nsWeakFrame weakFrame(this);
--- a/layout/generic/nsSubDocumentFrame.h
+++ b/layout/generic/nsSubDocumentFrame.h
@@ -70,17 +70,17 @@ public:
nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorder,
const mozilla::LogicalSize& aPadding,
ComputeSizeFlags aFlags) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -8645,36 +8645,36 @@ struct NewlineProperty {
int32_t mStartOffset;
// The offset of the first \n after mStartOffset, or -1 if there is none
int32_t mNewlineOffset;
};
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);
-
- NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);
+ ReflowText(*aReflowInput.mLineLayout, aReflowInput.AvailableWidth(),
+ aReflowInput.mRenderingContext->GetDrawTarget(), aMetrics, aStatus);
+
+ NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aMetrics);
}
#ifdef ACCESSIBILITY
/**
* Notifies accessibility about text reflow. Used by nsTextFrame::ReflowText.
*/
class MOZ_STACK_CLASS ReflowTextA11yNotifier
{
--- a/layout/generic/nsTextFrame.h
+++ b/layout/generic/nsTextFrame.h
@@ -243,17 +243,17 @@ public:
const mozilla::LogicalSize& aPadding,
ComputeSizeFlags aFlags) override;
virtual nsRect ComputeTightBounds(DrawTarget* aDrawTarget) const override;
virtual nsresult GetPrefWidthTightBounds(nsRenderingContext* aContext,
nscoord* aX,
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
// adjacent to the end of the line (i.e. followed only by empty text frames,
// placeholders or inlines containing such).
struct TrimOutput {
// true if we trimmed some space or changed metrics in some other way.
// In this case, we should call RecomputeOverflow on this frame.
--- a/layout/generic/nsVideoFrame.cpp
+++ b/layout/generic/nsVideoFrame.cpp
@@ -278,118 +278,118 @@ public:
return NS_OK;
}
nsCOMPtr<nsIContent> mContent;
};
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;
// Reflow the child frames. We may have up to two, an image frame
// which is the poster, and a box frame, which is the video controls.
for (nsIFrame* child : mFrames) {
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);
nsRect posterRenderRect;
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);
}
}
aMetrics.SetOverflowAreasToDesiredBounds();
FinishAndStoreOverflow(&aMetrics);
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 {
public:
nsDisplayVideo(nsDisplayListBuilder* aBuilder, nsVideoFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame)
{
MOZ_COUNT_CTOR(nsDisplayVideo);
--- a/layout/generic/nsVideoFrame.h
+++ b/layout/generic/nsVideoFrame.h
@@ -70,17 +70,17 @@ public:
ComputeSizeFlags aFlags) override;
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
virtual bool IsLeaf() const override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
#ifdef ACCESSIBILITY
virtual mozilla::a11y::AccType AccessibleType() override;
#endif
virtual nsIAtom* GetType() const override;
--- a/layout/generic/nsViewportFrame.cpp
+++ b/layout/generic/nsViewportFrame.cpp
@@ -218,152 +218,152 @@ ViewportFrame::GetPrefISize(nsRenderingC
result = 0;
else
result = mFrames.FirstChild()->GetPrefISize(aRenderingContext);
return result;
}
nsPoint
-ViewportFrame::AdjustReflowStateForScrollbars(ReflowInput* aReflowState) const
+ViewportFrame::AdjustReflowInputForScrollbars(ReflowInput* aReflowInput) const
{
// Get our prinicpal child frame and see if we're scrollable
nsIFrame* kidFrame = mFrames.FirstChild();
nsIScrollableFrame* scrollingFrame = do_QueryFrame(kidFrame);
if (scrollingFrame) {
- WritingMode wm = aReflowState->GetWritingMode();
+ WritingMode wm = aReflowInput->GetWritingMode();
LogicalMargin scrollbars(wm, scrollingFrame->GetActualScrollbarSizes());
- aReflowState->SetComputedISize(aReflowState->ComputedISize() -
+ aReflowInput->SetComputedISize(aReflowInput->ComputedISize() -
scrollbars.IStartEnd(wm));
- aReflowState->AvailableISize() -= scrollbars.IStartEnd(wm);
- aReflowState->SetComputedBSizeWithoutResettingResizeFlags(
- aReflowState->ComputedBSize() - scrollbars.BStartEnd(wm));
+ aReflowInput->AvailableISize() -= scrollbars.IStartEnd(wm);
+ aReflowInput->SetComputedBSizeWithoutResettingResizeFlags(
+ aReflowInput->ComputedBSize() - scrollbars.BStartEnd(wm));
return nsPoint(scrollbars.Left(wm), scrollbars.Top(wm));
}
return nsPoint(0, 0);
}
nsRect
-ViewportFrame::AdjustReflowStateAsContainingBlock(ReflowInput* aReflowState) const
+ViewportFrame::AdjustReflowInputAsContainingBlock(ReflowInput* aReflowInput) const
{
#ifdef DEBUG
nsPoint offset =
#endif
- AdjustReflowStateForScrollbars(aReflowState);
+ AdjustReflowInputForScrollbars(aReflowInput);
NS_ASSERTION(GetAbsoluteContainingBlock()->GetChildList().IsEmpty() ||
(offset.x == 0 && offset.y == 0),
"We don't handle correct positioning of fixed frames with "
"scrollbars in odd positions");
// If a scroll position clamping scroll-port size has been set, layout
// fixed position elements to this size instead of the computed size.
- nsRect rect(0, 0, aReflowState->ComputedWidth(), aReflowState->ComputedHeight());
+ nsRect rect(0, 0, aReflowInput->ComputedWidth(), aReflowInput->ComputedHeight());
nsIPresShell* ps = PresContext()->PresShell();
if (ps->IsScrollPositionClampingScrollPortSizeSet()) {
rect.SizeTo(ps->GetScrollPositionClampingScrollPortSize());
}
return rect;
}
void
ViewportFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("ViewportFrame");
- DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
+ DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
NS_FRAME_TRACE_REFLOW_IN("ViewportFrame::Reflow");
// Initialize OUT parameters
aStatus = NS_FRAME_COMPLETE;
// Because |Reflow| sets ComputedBSize() on the child to our
// ComputedBSize().
AddStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE);
// 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 the main content first so that the placeholders of the
// fixed-position frames will be in the right places on an initial
// reflow.
nscoord kidBSize = 0;
- WritingMode wm = aReflowState.GetWritingMode();
+ WritingMode wm = aReflowInput.GetWritingMode();
if (mFrames.NotEmpty()) {
// Deal with a non-incremental reflow or an incremental reflow
// targeted at our one-and-only principal child frame.
- if (aReflowState.ShouldReflowAllKids() ||
- aReflowState.IsBResize() ||
+ if (aReflowInput.ShouldReflowAllKids() ||
+ aReflowInput.IsBResize() ||
NS_SUBTREE_DIRTY(mFrames.FirstChild())) {
// Reflow our one-and-only principal child frame
nsIFrame* kidFrame = mFrames.FirstChild();
- ReflowOutput kidDesiredSize(aReflowState);
+ ReflowOutput kidDesiredSize(aReflowInput);
WritingMode wm = kidFrame->GetWritingMode();
- LogicalSize availableSpace = aReflowState.AvailableSize(wm);
- ReflowInput kidReflowState(aPresContext, aReflowState,
+ LogicalSize availableSpace = aReflowInput.AvailableSize(wm);
+ ReflowInput kidReflowInput(aPresContext, aReflowInput,
kidFrame, availableSpace);
// Reflow the frame
- kidReflowState.SetComputedBSize(aReflowState.ComputedBSize());
- ReflowChild(kidFrame, aPresContext, kidDesiredSize, kidReflowState,
+ kidReflowInput.SetComputedBSize(aReflowInput.ComputedBSize());
+ ReflowChild(kidFrame, aPresContext, kidDesiredSize, kidReflowInput,
0, 0, 0, aStatus);
kidBSize = kidDesiredSize.BSize(wm);
FinishReflowChild(kidFrame, aPresContext, kidDesiredSize, nullptr, 0, 0, 0);
} else {
kidBSize = LogicalSize(wm, mFrames.FirstChild()->GetSize()).BSize(wm);
}
}
- NS_ASSERTION(aReflowState.AvailableISize() != NS_UNCONSTRAINEDSIZE,
+ NS_ASSERTION(aReflowInput.AvailableISize() != NS_UNCONSTRAINEDSIZE,
"shouldn't happen anymore");
// Return the max size as our desired size
- LogicalSize maxSize(wm, aReflowState.AvailableISize(),
+ LogicalSize maxSize(wm, aReflowInput.AvailableISize(),
// Being flowed initially at an unconstrained block size
// means we should return our child's intrinsic size.
- aReflowState.ComputedBSize() != NS_UNCONSTRAINEDSIZE
- ? aReflowState.ComputedBSize()
+ aReflowInput.ComputedBSize() != NS_UNCONSTRAINEDSIZE
+ ? aReflowInput.ComputedBSize()
: kidBSize);
aDesiredSize.SetSize(wm, maxSize);
aDesiredSize.SetOverflowAreasToDesiredBounds();
if (HasAbsolutelyPositionedChildren()) {
// Make a copy of the reflow state and change the computed width and height
// to reflect the available space for the fixed items
- ReflowInput reflowState(aReflowState);
+ ReflowInput reflowInput(aReflowInput);
- if (reflowState.AvailableBSize() == NS_UNCONSTRAINEDSIZE) {
+ if (reflowInput.AvailableBSize() == NS_UNCONSTRAINEDSIZE) {
// We have an intrinsic-height document with abs-pos/fixed-pos children.
// Set the available height and mComputedHeight to our chosen height.
- reflowState.AvailableBSize() = maxSize.BSize(wm);
+ reflowInput.AvailableBSize() = maxSize.BSize(wm);
// Not having border/padding simplifies things
- NS_ASSERTION(reflowState.ComputedPhysicalBorderPadding() == nsMargin(0,0,0,0),
+ NS_ASSERTION(reflowInput.ComputedPhysicalBorderPadding() == nsMargin(0,0,0,0),
"Viewports can't have border/padding");
- reflowState.SetComputedBSize(maxSize.BSize(wm));
+ reflowInput.SetComputedBSize(maxSize.BSize(wm));
}
- nsRect rect = AdjustReflowStateAsContainingBlock(&reflowState);
+ nsRect rect = AdjustReflowInputAsContainingBlock(&reflowInput);
nsOverflowAreas* overflowAreas = &aDesiredSize.mOverflowAreas;
nsIScrollableFrame* rootScrollFrame =
aPresContext->PresShell()->GetRootScrollFrameAsScrollable();
if (rootScrollFrame && !rootScrollFrame->IsIgnoringViewportClipping()) {
overflowAreas = nullptr;
}
AbsPosReflowFlags flags =
AbsPosReflowFlags::eCBWidthAndHeightChanged; // XXX could be optimized
- GetAbsoluteContainingBlock()->Reflow(this, aPresContext, reflowState, aStatus,
+ GetAbsoluteContainingBlock()->Reflow(this, aPresContext, reflowInput, aStatus,
rect, flags, overflowAreas);
}
if (mFrames.NotEmpty()) {
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, mFrames.FirstChild());
}
// If we were dirty then do a repaint
@@ -381,17 +381,17 @@ ViewportFrame::Reflow(nsPresContext*
(nsLayoutUtils::GetCrossDocParentFrame(this));
if (container && !container->ShouldClipSubdocument()) {
container->PresContext()->PresShell()->
FrameNeedsReflow(container, nsIPresShell::eResize, NS_FRAME_IS_DIRTY);
}
}
NS_FRAME_TRACE_REFLOW_OUT("ViewportFrame::Reflow", aStatus);
- NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
+ NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
bool
ViewportFrame::ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas)
{
nsIScrollableFrame* rootScrollFrame =
PresContext()->PresShell()->GetRootScrollFrameAsScrollable();
if (rootScrollFrame && !rootScrollFrame->IsIgnoringViewportClipping()) {
--- a/layout/generic/nsViewportFrame.h
+++ b/layout/generic/nsViewportFrame.h
@@ -61,48 +61,48 @@ public:
void BuildDisplayListForTopLayer(nsDisplayListBuilder* aBuilder,
nsDisplayList* aList);
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
/**
* Get the "type" of the frame
*
* @see nsGkAtoms::viewportFrame
*/
virtual nsIAtom* GetType() const override;
virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override;
/**
- * Adjust aReflowState to account for scrollbars and pres shell
+ * Adjust aReflowInput to account for scrollbars and pres shell
* GetScrollPositionClampingScrollPortSizeSet and
* GetContentDocumentFixedPositionMargins adjustments.
* @return the rect to use as containing block rect
*/
- nsRect AdjustReflowStateAsContainingBlock(ReflowInput* aReflowState) const;
+ nsRect AdjustReflowInputAsContainingBlock(ReflowInput* aReflowInput) const;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
private:
virtual mozilla::layout::FrameChildListID GetAbsoluteListID() const override { return kFixedList; }
protected:
/**
* Calculate how much room is available for fixed frames. That means
* determining if the viewport is scrollable and whether the vertical and/or
* horizontal scrollbars are visible. Adjust the computed width/height and
- * available width for aReflowState accordingly.
+ * available width for aReflowInput accordingly.
* @return the current scroll position, or 0,0 if not scrollable
*/
- nsPoint AdjustReflowStateForScrollbars(ReflowInput* aReflowState) const;
+ nsPoint AdjustReflowInputForScrollbars(ReflowInput* aReflowInput) const;
};
#endif // nsViewportFrame_h___
--- a/layout/mathml/nsMathMLContainerFrame.cpp
+++ b/layout/mathml/nsMathMLContainerFrame.cpp
@@ -815,17 +815,17 @@ nsMathMLContainerFrame::ComputeCustomOve
aOverflowAreas.UnionAllWith(boundingBox);
return nsContainerFrame::ComputeCustomOverflow(aOverflowAreas);
}
void
nsMathMLContainerFrame::ReflowChild(nsIFrame* aChildFrame,
nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
// Having foreign/hybrid children, e.g., from html markups, is not defined by
// the MathML spec. But it can happen in practice, e.g., <html:img> allows us
// to do some cool demos... or we may have a child that is an nsInlineFrame
// from a generated content such as :before { content: open-quote } or
// :after { content: close-quote }. Unfortunately, the other frames out-there
// may expect their own invariants that are not met when we mix things.
@@ -834,17 +834,17 @@ nsMathMLContainerFrame::ReflowChild(nsIF
// frames may be reflowed generically, but nsInlineFrames need extra care.
#ifdef DEBUG
nsInlineFrame* inlineFrame = do_QueryFrame(aChildFrame);
NS_ASSERTION(!inlineFrame, "Inline frames should be wrapped in blocks");
#endif
nsContainerFrame::
- ReflowChild(aChildFrame, aPresContext, aDesiredSize, aReflowState,
+ ReflowChild(aChildFrame, aPresContext, aDesiredSize, aReflowInput,
0, 0, NS_FRAME_NO_MOVE_FRAME, aStatus);
if (aDesiredSize.BlockStartAscent() == ReflowOutput::ASK_FOR_BASELINE) {
// This will be suitable for inline frames, which are wrapped in a block.
nscoord ascent;
WritingMode wm = aDesiredSize.GetWritingMode();
if (!nsLayoutUtils::GetLastLineBaseline(wm, aChildFrame, &ascent)) {
// We don't expect any other block children so just place the frame on
@@ -852,67 +852,67 @@ nsMathMLContainerFrame::ReflowChild(nsIF
// GetBaseline(). This is what nsFrame::GetBaseline() will do anyway.
aDesiredSize.SetBlockStartAscent(aDesiredSize.BSize(wm));
} else {
aDesiredSize.SetBlockStartAscent(ascent);
}
}
if (IsForeignChild(aChildFrame)) {
// use ComputeTightBounds API as aDesiredSize.mBoundingMetrics is not set.
- nsRect r = aChildFrame->ComputeTightBounds(aReflowState.mRenderingContext->GetDrawTarget());
+ nsRect r = aChildFrame->ComputeTightBounds(aReflowInput.mRenderingContext->GetDrawTarget());
aDesiredSize.mBoundingMetrics.leftBearing = r.x;
aDesiredSize.mBoundingMetrics.rightBearing = r.XMost();
aDesiredSize.mBoundingMetrics.ascent = aDesiredSize.BlockStartAscent() - r.y;
aDesiredSize.mBoundingMetrics.descent = r.YMost() - aDesiredSize.BlockStartAscent();
aDesiredSize.mBoundingMetrics.width = aDesiredSize.Width();
}
}
void
nsMathMLContainerFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
mPresentationData.flags &= ~NS_MATHML_ERROR;
aDesiredSize.Width() = aDesiredSize.Height() = 0;
aDesiredSize.SetBlockStartAscent(0);
aDesiredSize.mBoundingMetrics = nsBoundingMetrics();
/////////////
// Reflow children
// Asking each child to cache its bounding metrics
nsReflowStatus childStatus;
nsIFrame* childFrame = mFrames.FirstChild();
while (childFrame) {
- ReflowOutput childDesiredSize(aReflowState, // ???
+ ReflowOutput childDesiredSize(aReflowInput, // ???
aDesiredSize.mFlags);
WritingMode wm = childFrame->GetWritingMode();
- LogicalSize availSize = aReflowState.ComputedSize(wm);
+ LogicalSize availSize = aReflowInput.ComputedSize(wm);
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
- ReflowInput childReflowState(aPresContext, aReflowState,
+ ReflowInput childReflowInput(aPresContext, aReflowInput,
childFrame, availSize);
ReflowChild(childFrame, aPresContext, childDesiredSize,
- childReflowState, childStatus);
+ childReflowInput, childStatus);
//NS_ASSERTION(NS_FRAME_IS_COMPLETE(childStatus), "bad status");
SaveReflowAndBoundingMetricsFor(childFrame, childDesiredSize,
childDesiredSize.mBoundingMetrics);
childFrame = childFrame->GetNextSibling();
}
/////////////
// If we are a container which is entitled to stretch its children, then we
// ask our stretchy children to stretch themselves
// The stretching of siblings of an embellished child is _deferred_ until
// after finishing the stretching of the embellished child - bug 117652
- DrawTarget* drawTarget = aReflowState.mRenderingContext->GetDrawTarget();
+ DrawTarget* drawTarget = aReflowInput.mRenderingContext->GetDrawTarget();
if (!NS_MATHML_IS_EMBELLISH_OPERATOR(mEmbellishData.flags) &&
(NS_MATHML_WILL_STRETCH_ALL_CHILDREN_VERTICALLY(mPresentationData.flags) ||
NS_MATHML_WILL_STRETCH_ALL_CHILDREN_HORIZONTALLY(mPresentationData.flags))) {
// get the stretchy direction
nsStretchDirection stretchDir =
NS_MATHML_WILL_STRETCH_ALL_CHILDREN_VERTICALLY(mPresentationData.flags)
@@ -927,17 +927,17 @@ nsMathMLContainerFrame::Reflow(nsPresCon
GetPreferredStretchSize(drawTarget, 0, stretchDir, containerSize);
// fire the stretch on each child
childFrame = mFrames.FirstChild();
while (childFrame) {
nsIMathMLFrame* mathMLFrame = do_QueryFrame(childFrame);
if (mathMLFrame) {
// retrieve the metrics that was stored at the previous pass
- ReflowOutput childDesiredSize(aReflowState);
+ ReflowOutput childDesiredSize(aReflowInput);
GetReflowAndBoundingMetricsFor(childFrame,
childDesiredSize, childDesiredSize.mBoundingMetrics);
mathMLFrame->Stretch(drawTarget, stretchDir,
containerSize, childDesiredSize);
// store the updated metrics
SaveReflowAndBoundingMetricsFor(childFrame, childDesiredSize,
childDesiredSize.mBoundingMetrics);
@@ -946,17 +946,17 @@ nsMathMLContainerFrame::Reflow(nsPresCon
}
}
/////////////
// Place children now by re-adjusting the origins to align the baselines
FinalizeReflow(drawTarget, aDesiredSize);
aStatus = NS_FRAME_COMPLETE;
- NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
+ NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
static nscoord AddInterFrameSpacingToSize(ReflowOutput& aDesiredSize,
nsMathMLContainerFrame* aFrame);
/* virtual */ void
nsMathMLContainerFrame::MarkIntrinsicISizesDirty()
{
--- a/layout/mathml/nsMathMLContainerFrame.h
+++ b/layout/mathml/nsMathMLContainerFrame.h
@@ -108,26 +108,26 @@ public:
*/
virtual void
GetIntrinsicISizeMetrics(nsRenderingContext* aRenderingContext,
ReflowOutput& aDesiredSize);
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
{
mPresentationData.flags &= ~NS_MATHML_STRETCH_DONE;
- return nsContainerFrame::DidReflow(aPresContext, aReflowState, aStatus);
+ return nsContainerFrame::DidReflow(aPresContext, aReflowInput, aStatus);
}
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override;
@@ -273,17 +273,17 @@ public:
// helper method to reflow a child frame. We are inline frames, and we don't
// know our positions until reflow is finished. That's why we ask the
// base method not to worry about our position.
void
ReflowChild(nsIFrame* aKidFrame,
nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus);
protected:
// helper to add the inter-spacing when <math> is the immediate parent.
// Since we don't (yet) handle the root <math> element ourselves, we need to
// take special care of the inter-frame spacing on elements for which <math>
// is the direct xml parent. This function will be repeatedly called from
// left to right on the childframes of <math>, and by so doing it will
--- a/layout/mathml/nsMathMLSelectedFrame.cpp
+++ b/layout/mathml/nsMathMLSelectedFrame.cpp
@@ -130,40 +130,40 @@ nsMathMLSelectedFrame::ComputeSize(nsRen
}
return LogicalSize(aWM);
}
// Only reflow the selected child ...
void
nsMathMLSelectedFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
mPresentationData.flags &= ~NS_MATHML_ERROR;
aStatus = NS_FRAME_COMPLETE;
aDesiredSize.ClearSize();
aDesiredSize.SetBlockStartAscent(0);
mBoundingMetrics = nsBoundingMetrics();
nsIFrame* childFrame = GetSelectedFrame();
if (childFrame) {
WritingMode wm = childFrame->GetWritingMode();
- LogicalSize availSize = aReflowState.ComputedSize(wm);
+ LogicalSize availSize = aReflowInput.ComputedSize(wm);
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
- ReflowInput childReflowState(aPresContext, aReflowState,
+ ReflowInput childReflowInput(aPresContext, aReflowInput,
childFrame, availSize);
ReflowChild(childFrame, aPresContext, aDesiredSize,
- childReflowState, aStatus);
+ childReflowInput, aStatus);
SaveReflowAndBoundingMetricsFor(childFrame, aDesiredSize,
aDesiredSize.mBoundingMetrics);
mBoundingMetrics = aDesiredSize.mBoundingMetrics;
}
- FinalizeReflow(aReflowState.mRenderingContext->GetDrawTarget(), aDesiredSize);
- NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
+ FinalizeReflow(aReflowInput.mRenderingContext->GetDrawTarget(), aDesiredSize);
+ NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
// Only place the selected child ...
/* virtual */ nsresult
nsMathMLSelectedFrame::Place(DrawTarget* aDrawTarget,
bool aPlaceOrigin,
ReflowOutput& aDesiredSize)
{
--- a/layout/mathml/nsMathMLSelectedFrame.h
+++ b/layout/mathml/nsMathMLSelectedFrame.h
@@ -42,17 +42,17 @@ public:
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorder,
const mozilla::LogicalSize& aPadding,
ComputeSizeFlags aFlags) override;
virtual void
Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsQueryFrame::FrameIID GetFrameId() override = 0;
protected:
explicit nsMathMLSelectedFrame(nsStyleContext* aContext) :
nsMathMLContainerFrame(aContext) {}
virtual ~nsMathMLSelectedFrame();
--- a/layout/mathml/nsMathMLTokenFrame.cpp
+++ b/layout/mathml/nsMathMLTokenFrame.cpp
@@ -116,49 +116,49 @@ nsMathMLTokenFrame::InsertFrames(ChildLi
{
nsMathMLContainerFrame::InsertFrames(aListID, aPrevFrame, aChildList);
MarkTextFramesAsTokenMathML();
}
void
nsMathMLTokenFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
mPresentationData.flags &= ~NS_MATHML_ERROR;
// initializations needed for empty markup like <mtag></mtag>
aDesiredSize.ClearSize();
aDesiredSize.SetBlockStartAscent(0);
aDesiredSize.mBoundingMetrics = nsBoundingMetrics();
for (nsIFrame* childFrame : PrincipalChildList()) {
// ask our children to compute their bounding metrics
- ReflowOutput childDesiredSize(aReflowState.GetWritingMode(),
+ ReflowOutput childDesiredSize(aReflowInput.GetWritingMode(),
aDesiredSize.mFlags
| NS_REFLOW_CALC_BOUNDING_METRICS);
WritingMode wm = childFrame->GetWritingMode();
- LogicalSize availSize = aReflowState.ComputedSize(wm);
+ LogicalSize availSize = aReflowInput.ComputedSize(wm);
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
- ReflowInput childReflowState(aPresContext, aReflowState,
+ ReflowInput childReflowInput(aPresContext, aReflowInput,
childFrame, availSize);
ReflowChild(childFrame, aPresContext, childDesiredSize,
- childReflowState, aStatus);
+ childReflowInput, aStatus);
//NS_ASSERTION(NS_FRAME_IS_COMPLETE(aStatus), "bad status");
SaveReflowAndBoundingMetricsFor(childFrame, childDesiredSize,
childDesiredSize.mBoundingMetrics);
}
// place and size children
- FinalizeReflow(aReflowState.mRenderingContext->GetDrawTarget(), aDesiredSize);
+ FinalizeReflow(aReflowInput.mRenderingContext->GetDrawTarget(), aDesiredSize);
aStatus = NS_FRAME_COMPLETE;
- NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
+ NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
// For token elements, mBoundingMetrics is computed at the ReflowToken
// pass, it is not computed here because our children may be text frames
// that do not implement the GetBoundingMetrics() interface.
/* virtual */ nsresult
nsMathMLTokenFrame::Place(DrawTarget* aDrawTarget,
bool aPlaceOrigin,
--- a/layout/mathml/nsMathMLTokenFrame.h
+++ b/layout/mathml/nsMathMLTokenFrame.h
@@ -45,17 +45,17 @@ public:
virtual void
InsertFrames(ChildListID aListID,
nsIFrame* aPrevFrame,
nsFrameList& aChildList) override;
virtual void
Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsresult
Place(DrawTarget* aDrawTarget,
bool aPlaceOrigin,
ReflowOutput& aDesiredSize) override;
protected:
--- a/layout/mathml/nsMathMLmfencedFrame.cpp
+++ b/layout/mathml/nsMathMLmfencedFrame.cpp
@@ -206,32 +206,32 @@ ApplyUnstretchedMetrics(nsPresContext*
charSize, NS_STRETCH_NONE, aIsRTL);
aMetrics += charSize;
}
}
void
nsMathMLmfencedFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
mPresentationData.flags &= ~NS_MATHML_ERROR;
aDesiredSize.ClearSize();
aDesiredSize.SetBlockStartAscent(0);
aDesiredSize.mBoundingMetrics = nsBoundingMetrics();
int32_t i;
const nsStyleFont* font = StyleFont();
float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(this);
RefPtr<nsFontMetrics> fm =
nsLayoutUtils::GetFontMetricsForFrame(this, fontSizeInflation);
nscoord axisHeight, em;
- GetAxisHeight(aReflowState.mRenderingContext->GetDrawTarget(), fm, axisHeight);
+ GetAxisHeight(aReflowInput.mRenderingContext->GetDrawTarget(), fm, axisHeight);
GetEmHeight(fm, em);
// leading to be left at the top and the bottom of stretched chars
nscoord leading = NSToCoordRound(0.2f * em);
/////////////
// Reflow children
// Asking each child to cache its bounding metrics
@@ -250,57 +250,57 @@ nsMathMLmfencedFrame::Reflow(nsPresConte
if (firstChild || mOpenChar || mCloseChar || mSeparatorsCount > 0) {
// We use the ASCII metrics to get our minimum height. This way,
// if we have borders or a background, they will fit better with
// other elements on the line.
ascent = fm->MaxAscent();
descent = fm->MaxDescent();
}
while (childFrame) {
- ReflowOutput childDesiredSize(aReflowState,
+ ReflowOutput childDesiredSize(aReflowInput,
aDesiredSize.mFlags
| NS_REFLOW_CALC_BOUNDING_METRICS);
WritingMode wm = childFrame->GetWritingMode();
- LogicalSize availSize = aReflowState.ComputedSize(wm);
+ LogicalSize availSize = aReflowInput.ComputedSize(wm);
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
- ReflowInput childReflowState(aPresContext, aReflowState,
+ ReflowInput childReflowInput(aPresContext, aReflowInput,
childFrame, availSize);
ReflowChild(childFrame, aPresContext, childDesiredSize,
- childReflowState, childStatus);
+ childReflowInput, childStatus);
//NS_ASSERTION(NS_FRAME_IS_COMPLETE(childStatus), "bad status");
SaveReflowAndBoundingMetricsFor(childFrame, childDesiredSize,
childDesiredSize.mBoundingMetrics);
- mozilla::WritingMode outerWM = aReflowState.GetWritingMode();
+ mozilla::WritingMode outerWM = aReflowInput.GetWritingMode();
nscoord childDescent = childDesiredSize.BSize(outerWM) -
childDesiredSize.BlockStartAscent();
if (descent < childDescent)
descent = childDescent;
if (ascent < childDesiredSize.BlockStartAscent())
ascent = childDesiredSize.BlockStartAscent();
childFrame = childFrame->GetNextSibling();
}
/////////////
// Ask stretchy children to stretch themselves
nsBoundingMetrics containerSize;
nsStretchDirection stretchDir = NS_STRETCH_DIRECTION_VERTICAL;
- DrawTarget* drawTarget = aReflowState.mRenderingContext->GetDrawTarget();
+ DrawTarget* drawTarget = aReflowInput.mRenderingContext->GetDrawTarget();
GetPreferredStretchSize(drawTarget,
0, /* i.e., without embellishments */
stretchDir, containerSize);
childFrame = firstChild;
while (childFrame) {
nsIMathMLFrame* mathmlChild = do_QueryFrame(childFrame);
if (mathmlChild) {
- ReflowOutput childDesiredSize(aReflowState);
+ ReflowOutput childDesiredSize(aReflowInput);
// retrieve the metrics that was stored at the previous pass
GetReflowAndBoundingMetricsFor(childFrame, childDesiredSize,
childDesiredSize.mBoundingMetrics);
mathmlChild->Stretch(drawTarget,
stretchDir, containerSize, childDesiredSize);
// store the updated metrics
SaveReflowAndBoundingMetricsFor(childFrame, childDesiredSize,
@@ -390,17 +390,17 @@ nsMathMLmfencedFrame::Reflow(nsPresConte
}
if (isRTL) {
childFrame = this->GetChildList(nsIFrame::kPrincipalList).LastChild();
} else {
childFrame = firstChild;
}
while (childFrame) {
- ReflowOutput childSize(aReflowState);
+ ReflowOutput childSize(aReflowInput);
GetReflowAndBoundingMetricsFor(childFrame, childSize, bm);
if (firstTime) {
firstTime = false;
aDesiredSize.mBoundingMetrics = bm;
}
else
aDesiredSize.mBoundingMetrics += bm;
@@ -442,17 +442,17 @@ nsMathMLmfencedFrame::Reflow(nsPresConte
// Finished with these:
ClearSavedChildMetrics();
// Set our overflow area
GatherAndStoreOverflow(&aDesiredSize);
aStatus = NS_FRAME_COMPLETE;
- NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
+ NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
static void
GetCharSpacing(nsMathMLChar* aMathMLChar,
nsOperatorFlags aForm,
int32_t aScriptLevel,
nscoord em,
nscoord& aLeftSpace,
--- a/layout/mathml/nsMathMLmfencedFrame.h
+++ b/layout/mathml/nsMathMLmfencedFrame.h
@@ -32,17 +32,17 @@ public:
virtual void
SetInitialChildList(ChildListID aListID,
nsFrameList& aChildList) override;
virtual void
Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
virtual void
GetIntrinsicISizeMetrics(nsRenderingContext* aRenderingContext,
--- a/layout/mathml/nsMathMLmoFrame.cpp
+++ b/layout/mathml/nsMathMLmoFrame.cpp
@@ -940,25 +940,25 @@ nsMathMLmoFrame::SetInitialChildList(Chi
// First, let the parent class do its work
nsMathMLTokenFrame::SetInitialChildList(aListID, aChildList);
ProcessTextData();
}
void
nsMathMLmoFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
// certain values use units that depend on our style context, so
// it is safer to just process the whole lot here
ProcessOperatorData();
nsMathMLTokenFrame::Reflow(aPresContext, aDesiredSize,
- aReflowState, aStatus);
+ aReflowInput, aStatus);
}
nsresult
nsMathMLmoFrame::Place(DrawTarget* aDrawTarget,
bool aPlaceOrigin,
ReflowOutput& aDesiredSize)
{
nsresult rv = nsMathMLTokenFrame::Place(aDrawTarget, aPlaceOrigin, aDesiredSize);
--- a/layout/mathml/nsMathMLmoFrame.h
+++ b/layout/mathml/nsMathMLmoFrame.h
@@ -40,17 +40,17 @@ public:
virtual void
SetInitialChildList(ChildListID aListID,
nsFrameList& aChildList) override;
virtual void
Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsresult
Place(DrawTarget* aDrawTarget,
bool aPlaceOrigin,
ReflowOutput& aDesiredSize) override;
virtual void MarkIntrinsicISizesDirty() override;
--- a/layout/mathml/nsMathMLmpaddedFrame.cpp
+++ b/layout/mathml/nsMathMLmpaddedFrame.cpp
@@ -300,26 +300,26 @@ nsMathMLmpaddedFrame::UpdateValue(int32_
else
aValueToUpdate = amount;
}
}
void
nsMathMLmpaddedFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
mPresentationData.flags &= ~NS_MATHML_ERROR;
ProcessAttributes();
///////////////
// Let the base class format our content like an inferred mrow
nsMathMLContainerFrame::Reflow(aPresContext, aDesiredSize,
- aReflowState, aStatus);
+ aReflowInput, aStatus);
//NS_ASSERTION(NS_FRAME_IS_COMPLETE(aStatus), "bad status");
}
/* virtual */ nsresult
nsMathMLmpaddedFrame::Place(DrawTarget* aDrawTarget,
bool aPlaceOrigin,
ReflowOutput& aDesiredSize)
{
--- a/layout/mathml/nsMathMLmpaddedFrame.h
+++ b/layout/mathml/nsMathMLmpaddedFrame.h
@@ -25,17 +25,17 @@ public:
NS_IMETHOD
TransmitAutomaticData() override {
return TransmitAutomaticDataForMrowLikeElement();
}
virtual void
Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsresult
Place(DrawTarget* aDrawTarget,
bool aPlaceOrigin,
ReflowOutput& aDesiredSize) override;
bool
--- a/layout/mathml/nsMathMLmrootFrame.cpp
+++ b/layout/mathml/nsMathMLmrootFrame.cpp
@@ -156,50 +156,50 @@ nsMathMLmrootFrame::GetRadicalXOffsets(n
*aIndexOffset = dxIndex;
if (aSqrOffset)
*aSqrOffset = dxSqr;
}
void
nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
nsReflowStatus childStatus;
mPresentationData.flags &= ~NS_MATHML_ERROR;
aDesiredSize.ClearSize();
aDesiredSize.SetBlockStartAscent(0);
nsBoundingMetrics bmSqr, bmBase, bmIndex;
- DrawTarget* drawTarget = aReflowState.mRenderingContext->GetDrawTarget();
+ DrawTarget* drawTarget = aReflowInput.mRenderingContext->GetDrawTarget();
//////////////////
// Reflow Children
int32_t count = 0;
nsIFrame* baseFrame = nullptr;
nsIFrame* indexFrame = nullptr;
- ReflowOutput baseSize(aReflowState);
- ReflowOutput indexSize(aReflowState);
+ ReflowOutput baseSize(aReflowInput);
+ ReflowOutput indexSize(aReflowInput);
nsIFrame* childFrame = mFrames.FirstChild();
while (childFrame) {
// ask our children to compute their bounding metrics
- ReflowOutput childDesiredSize(aReflowState,
+ ReflowOutput childDesiredSize(aReflowInput,
aDesiredSize.mFlags
| NS_REFLOW_CALC_BOUNDING_METRICS);
WritingMode wm = childFrame->GetWritingMode();
- LogicalSize availSize = aReflowState.ComputedSize(wm);
+ LogicalSize availSize = aReflowInput.ComputedSize(wm);
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
- ReflowInput childReflowState(aPresContext, aReflowState,
+ ReflowInput childReflowInput(aPresContext, aReflowInput,
childFrame, availSize);
ReflowChild(childFrame, aPresContext,
- childDesiredSize, childReflowState, childStatus);
+ childDesiredSize, childReflowInput, childStatus);
//NS_ASSERTION(NS_FRAME_IS_COMPLETE(childStatus), "bad status");
if (0 == count) {
// base
baseFrame = childFrame;
baseSize = childDesiredSize;
bmBase = childDesiredSize.mBoundingMetrics;
}
else if (1 == count) {
@@ -211,17 +211,17 @@ nsMathMLmrootFrame::Reflow(nsPresContext
count++;
childFrame = childFrame->GetNextSibling();
}
if (2 != count) {
// report an error, encourage people to get their markups in order
ReportChildCountError();
ReflowError(drawTarget, aDesiredSize);
aStatus = NS_FRAME_COMPLETE;
- NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
+ NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
// Call DidReflow() for the child frames we successfully did reflow.
DidReflowChildren(mFrames.FirstChild(), childFrame);
return;
}
////////////
// Prepare the radical symbol and the overline bar
@@ -349,17 +349,17 @@ nsMathMLmrootFrame::Reflow(nsPresContext
FinishReflowChild(baseFrame, aPresContext, baseSize, nullptr,
MirrorIfRTL(aDesiredSize.Width(), baseSize.Width(), dx),
dy, 0);
mReference.x = 0;
mReference.y = aDesiredSize.BlockStartAscent();
aStatus = NS_FRAME_COMPLETE;
- NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
+ NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
/* virtual */ void
nsMathMLmrootFrame::GetIntrinsicISizeMetrics(nsRenderingContext* aRenderingContext, ReflowOutput& aDesiredSize)
{
nsIFrame* baseFrame = mFrames.FirstChild();
nsIFrame* indexFrame = nullptr;
if (baseFrame)
--- a/layout/mathml/nsMathMLmrootFrame.h
+++ b/layout/mathml/nsMathMLmrootFrame.h
@@ -32,17 +32,17 @@ public:
nsIFrame* aPrevInFlow) override;
NS_IMETHOD
TransmitAutomaticData() override;
virtual void
Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
void
GetRadicalXOffsets(nscoord aIndexWidth, nscoord aSqrWidth,
nsFontMetrics* aFontMetrics,
nscoord* aIndexOffset,
nscoord* aSqrOffset);
--- a/layout/mathml/nsMathMLmspaceFrame.cpp
+++ b/layout/mathml/nsMathMLmspaceFrame.cpp
@@ -90,17 +90,17 @@ nsMathMLmspaceFrame::ProcessAttributes(n
ParseNumericValue(value, &mDepth, 0,
aPresContext, mStyleContext, fontSizeInflation);
}
}
void
nsMathMLmspaceFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
mPresentationData.flags &= ~NS_MATHML_ERROR;
ProcessAttributes(aPresContext);
mBoundingMetrics = nsBoundingMetrics();
mBoundingMetrics.width = mWidth;
@@ -111,17 +111,17 @@ nsMathMLmspaceFrame::Reflow(nsPresContex
aDesiredSize.SetBlockStartAscent(mHeight);
aDesiredSize.Width() = std::max(0, mBoundingMetrics.width);
aDesiredSize.Height() = aDesiredSize.BlockStartAscent() + mDepth;
// Also return our bounding metrics
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
aStatus = NS_FRAME_COMPLETE;
- NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
+ NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
/* virtual */ nsresult
nsMathMLmspaceFrame::MeasureForWidth(DrawTarget* aDrawTarget,
ReflowOutput& aDesiredSize)
{
ProcessAttributes(PresContext());
mBoundingMetrics = nsBoundingMetrics();
--- a/layout/mathml/nsMathMLmspaceFrame.h
+++ b/layout/mathml/nsMathMLmspaceFrame.h
@@ -27,17 +27,17 @@ public:
return NS_OK;
}
virtual bool IsLeaf() const override;
virtual void
Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
protected:
explicit nsMathMLmspaceFrame(nsStyleContext* aContext) : nsMathMLContainerFrame(aContext) {}
virtual ~nsMathMLmspaceFrame();
virtual nsresult
MeasureForWidth(DrawTarget* aDrawTarget,
--- a/layout/mathml/nsMathMLmtableFrame.cpp
+++ b/layout/mathml/nsMathMLmtableFrame.cpp
@@ -817,23 +817,23 @@ nsMathMLmtableWrapperFrame::GetRowFrameA
}
}
return nullptr;
}
void
nsMathMLmtableWrapperFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
nsAutoString value;
// we want to return a table that is anchored according to the align attribute
- nsTableWrapperFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
+ nsTableWrapperFrame::Reflow(aPresContext, aDesiredSize, aReflowInput, aStatus);
NS_ASSERTION(aDesiredSize.Height() >= 0, "illegal height for mtable");
NS_ASSERTION(aDesiredSize.Width() >= 0, "illegal width for mtable");
// see if the user has set the align attribute on the <mtable>
int32_t rowIndex = 0;
eAlign tableAlign = eAlign_axis;
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::align, value);
if (!value.IsEmpty()) {
@@ -849,17 +849,17 @@ nsMathMLmtableWrapperFrame::Reflow(nsPre
nscoord blockSize = aDesiredSize.BSize(wm);
nsIFrame* rowFrame = nullptr;
if (rowIndex) {
rowFrame = GetRowFrameAt(rowIndex);
if (rowFrame) {
// translate the coordinates to be relative to us and in our writing mode
nsIFrame* frame = rowFrame;
LogicalRect rect(wm, frame->GetRect(),
- aReflowState.ComputedSizeAsContainerIfConstrained());
+ aReflowInput.ComputedSizeAsContainerIfConstrained());
blockSize = rect.BSize(wm);
do {
dy += rect.BStart(wm);
frame = frame->GetParent();
} while (frame != this);
}
}
switch (tableAlign) {
@@ -885,17 +885,17 @@ nsMathMLmtableWrapperFrame::Reflow(nsPre
aDesiredSize.SetBlockStartAscent(dy + blockSize / 2);
break;
case eAlign_axis:
default: {
// XXX should instead use style data from the row of reference here ?
RefPtr<nsFontMetrics> fm =
nsLayoutUtils::GetInflatedFontMetricsForFrame(this);
nscoord axisHeight;
- GetAxisHeight(aReflowState.mRenderingContext->GetDrawTarget(), fm, axisHeight);
+ GetAxisHeight(aReflowInput.mRenderingContext->GetDrawTarget(), fm, axisHeight);
if (rowFrame) {
// anchor the table on the axis of the row of reference
// XXX fallback to baseline because it is a hard problem
// XXX need to fetch the axis of the row; would need rowalign=axis to work better
nscoord rowAscent = ((nsTableRowFrame*)rowFrame)->GetMaxCellAscent();
if (rowAscent) { // the row has at least one cell with 'vertical-align: baseline'
aDesiredSize.SetBlockStartAscent(dy + rowAscent);
break;
@@ -914,17 +914,17 @@ nsMathMLmtableWrapperFrame::Reflow(nsPre
mBoundingMetrics.ascent = aDesiredSize.BlockStartAscent();
mBoundingMetrics.descent = aDesiredSize.Height() -
aDesiredSize.BlockStartAscent();
mBoundingMetrics.width = aDesiredSize.Width();
mBoundingMetrics.leftBearing = 0;
mBoundingMetrics.rightBearing = aDesiredSize.Width();
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
- NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
+ NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
nsContainerFrame*
NS_NewMathMLmtableFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
return new (aPresShell) nsMathMLmtableFrame(aContext);
}
@@ -1312,21 +1312,21 @@ nsMathMLmtdInnerFrame::nsMathMLmtdInnerF
nsMathMLmtdInnerFrame::~nsMathMLmtdInnerFrame()
{
mUniqueStyleText->Destroy(PresContext());
}
void
nsMathMLmtdInnerFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
// Let the base class do the reflow
- nsBlockFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
+ nsBlockFrame::Reflow(aPresContext, aDesiredSize, aReflowInput, aStatus);
// more about <maligngroup/> and <malignmark/> later
// ...
}
const
nsStyleText* nsMathMLmtdInnerFrame::StyleTextForLineLayout()
{
--- a/layout/mathml/nsMathMLmtableFrame.h
+++ b/layout/mathml/nsMathMLmtableFrame.h
@@ -28,17 +28,17 @@ public:
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS
// overloaded nsTableWrapperFrame methods
virtual void
Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsresult
AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType) override;
virtual bool IsFrameOfType(uint32_t aFlags) const override
@@ -298,17 +298,17 @@ public:
nsMathMLContainerFrame::PropagatePresentationDataFromChildAt(this,
aFirstIndex, aLastIndex, aFlagsValues, aFlagsToUpdate);
return NS_OK;
}
virtual void
Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual bool IsFrameOfType(uint32_t aFlags) const override
{
return nsBlockFrame::IsFrameOfType(aFlags &
~(nsIFrame::eMathML | nsIFrame::eExcludesIgnorableWhitespace));
}
--- a/layout/svg/SVGTextFrame.cpp
+++ b/layout/svg/SVGTextFrame.cpp
@@ -5384,30 +5384,30 @@ SVGTextFrame::DoReflow()
// an updated preferred width.
kid->MarkIntrinsicISizesDirty();
}
mState |= NS_STATE_SVG_TEXT_IN_REFLOW;
nscoord inlineSize = kid->GetPrefISize(&renderingContext);
WritingMode wm = kid->GetWritingMode();
- ReflowInput reflowState(presContext, kid,
+ ReflowInput reflowInput(presContext, kid,
&renderingContext,
LogicalSize(wm, inlineSize,
NS_UNCONSTRAINEDSIZE));
- ReflowOutput desiredSize(reflowState);
+ ReflowOutput desiredSize(reflowInput);
nsReflowStatus status;
- NS_ASSERTION(reflowState.ComputedPhysicalBorderPadding() == nsMargin(0, 0, 0, 0) &&
- reflowState.ComputedPhysicalMargin() == nsMargin(0, 0, 0, 0),
+ NS_ASSERTION(reflowInput.ComputedPhysicalBorderPadding() == nsMargin(0, 0, 0, 0) &&
+ reflowInput.ComputedPhysicalMargin() == nsMargin(0, 0, 0, 0),
"style system should ensure that :-moz-svg-text "
"does not get styled");
- kid->Reflow(presContext, desiredSize, reflowState, status);
- kid->DidReflow(presContext, &reflowState, nsDidReflowStatus::FINISHED);
+ kid->Reflow(presContext, desiredSize, reflowInput, status);
+ kid->DidReflow(presContext, &reflowInput, nsDidReflowStatus::FINISHED);
kid->SetSize(wm, desiredSize.Size(wm));
mState &= ~NS_STATE_SVG_TEXT_IN_REFLOW;
TextNodeCorrespondenceRecorder::RecordCorrespondence(this);
}
// Usable font size range in devpixels / user-units
--- a/layout/svg/nsSVGForeignObjectFrame.cpp
+++ b/layout/svg/nsSVGForeignObjectFrame.cpp
@@ -120,44 +120,44 @@ nsSVGForeignObjectFrame::AttributeChange
}
return NS_OK;
}
void
nsSVGForeignObjectFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MOZ_ASSERT(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY),
"Should not have been called");
// Only InvalidateAndScheduleBoundsUpdate marks us with NS_FRAME_IS_DIRTY,
// so if that bit is still set we still have a resize pending. If we hit
// this assertion, then we should get the presShell to skip reflow roots
// that have a dirty parent since a reflow is going to come via the
// reflow root's parent anyway.
NS_ASSERTION(!(GetStateBits() & NS_FRAME_IS_DIRTY),
"Reflowing while a resize is pending is wasteful");
// ReflowSVG makes sure mRect is up to date before we're called.
- NS_ASSERTION(!aReflowState.mParentReflowState,
+ NS_ASSERTION(!aReflowInput.mParentReflowInput,
"should only get reflow from being reflow root");
- NS_ASSERTION(aReflowState.ComputedWidth() == GetSize().width &&
- aReflowState.ComputedHeight() == GetSize().height,
+ NS_ASSERTION(aReflowInput.ComputedWidth() == GetSize().width &&
+ aReflowInput.ComputedHeight() == GetSize().height,
"reflow roots should be reflowed at existing size and "
"svg.css should ensure we have no padding/border/margin");
DoReflow();
- WritingMode wm = aReflowState.GetWritingMode();
- LogicalSize finalSize(wm, aReflowState.ComputedISize(),
- aReflowState.ComputedBSize());
+ WritingMode wm = aReflowInput.GetWritingMode();
+ LogicalSize finalSize(wm, aReflowInput.ComputedISize(),
+ aReflowInput.ComputedBSize());
aDesiredSize.SetSize(wm, finalSize);
aDesiredSize.SetOverflowAreasToDesiredBounds();
aStatus = NS_FRAME_COMPLETE;
}
void
nsSVGForeignObjectFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
@@ -536,38 +536,38 @@ nsSVGForeignObjectFrame::DoReflow()
// initiate a synchronous reflow here and now:
nsRenderingContext renderingContext(
presContext->PresShell()->CreateReferenceRenderingContext());
mInReflow = true;
WritingMode wm = kid->GetWritingMode();
- ReflowInput reflowState(presContext, kid,
+ ReflowInput reflowInput(presContext, kid,
&renderingContext,
LogicalSize(wm, ISize(wm),
NS_UNCONSTRAINEDSIZE));
- ReflowOutput desiredSize(reflowState);
+ ReflowOutput desiredSize(reflowInput);
nsReflowStatus status;
// We don't use mRect.height above because that tells the child to do
// page/column breaking at that height.
- NS_ASSERTION(reflowState.ComputedPhysicalBorderPadding() == nsMargin(0, 0, 0, 0) &&
- reflowState.ComputedPhysicalMargin() == nsMargin(0, 0, 0, 0),
+ NS_ASSERTION(reflowInput.ComputedPhysicalBorderPadding() == nsMargin(0, 0, 0, 0) &&
+ reflowInput.ComputedPhysicalMargin() == nsMargin(0, 0, 0, 0),
"style system should ensure that :-moz-svg-foreign-content "
"does not get styled");
- NS_ASSERTION(reflowState.ComputedISize() == ISize(wm),
+ NS_ASSERTION(reflowInput.ComputedISize() == ISize(wm),
"reflow state made child wrong size");
- reflowState.SetComputedBSize(BSize(wm));
+ reflowInput.SetComputedBSize(BSize(wm));
- ReflowChild(kid, presContext, desiredSize, reflowState, 0, 0,
+ ReflowChild(kid, presContext, desiredSize, reflowInput, 0, 0,
NS_FRAME_NO_MOVE_FRAME, status);
NS_ASSERTION(mRect.width == desiredSize.Width() &&
mRect.height == desiredSize.Height(), "unexpected size");
- FinishReflowChild(kid, presContext, desiredSize, &reflowState, 0, 0,
+ FinishReflowChild(kid, presContext, desiredSize, &reflowInput, 0, 0,
NS_FRAME_NO_MOVE_FRAME);
mInReflow = false;
}
nsRect
nsSVGForeignObjectFrame::GetInvalidRegion()
{
--- a/layout/svg/nsSVGForeignObjectFrame.h
+++ b/layout/svg/nsSVGForeignObjectFrame.h
@@ -38,17 +38,17 @@ public:
int32_t aModType) override;
virtual nsContainerFrame* GetContentInsertionFrame() override {
return PrincipalChildList().FirstChild()->GetContentInsertionFrame();
}
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
/**
* Get the "type" of the frame
--- a/layout/svg/nsSVGOuterSVGFrame.cpp
+++ b/layout/svg/nsSVGOuterSVGFrame.cpp
@@ -353,34 +353,34 @@ nsSVGOuterSVGFrame::ComputeSize(nsRender
aMargin,
aBorder,
aPadding);
}
void
nsSVGOuterSVGFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsSVGOuterSVGFrame");
- DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
+ DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("enter nsSVGOuterSVGFrame::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;
- aDesiredSize.Width() = aReflowState.ComputedWidth() +
- aReflowState.ComputedPhysicalBorderPadding().LeftRight();
- aDesiredSize.Height() = aReflowState.ComputedHeight() +
- aReflowState.ComputedPhysicalBorderPadding().TopBottom();
+ aDesiredSize.Width() = aReflowInput.ComputedWidth() +
+ aReflowInput.ComputedPhysicalBorderPadding().LeftRight();
+ aDesiredSize.Height() = aReflowInput.ComputedHeight() +
+ aReflowInput.ComputedPhysicalBorderPadding().TopBottom();
NS_ASSERTION(!GetPrevInFlow(), "SVG can't currently be broken across pages.");
SVGSVGElement *svgElem = static_cast<SVGSVGElement*>(mContent);
nsSVGOuterSVGAnonChildFrame *anonKid =
static_cast<nsSVGOuterSVGAnonChildFrame*>(PrincipalChildList().FirstChild());
@@ -388,18 +388,18 @@ nsSVGOuterSVGFrame::Reflow(nsPresContext
// Initialize
svgElem->UpdateHasChildrenOnlyTransform();
}
// If our SVG viewport has changed, update our content and notify.
// http://www.w3.org/TR/SVG11/coords.html#ViewportSpace
svgFloatSize newViewportSize(
- nsPresContext::AppUnitsToFloatCSSPixels(aReflowState.ComputedWidth()),
- nsPresContext::AppUnitsToFloatCSSPixels(aReflowState.ComputedHeight()));
+ nsPresContext::AppUnitsToFloatCSSPixels(aReflowInput.ComputedWidth()),
+ nsPresContext::AppUnitsToFloatCSSPixels(aReflowInput.ComputedHeight()));
svgFloatSize oldViewportSize = svgElem->GetViewportSize();
uint32_t changeBits = 0;
if (newViewportSize != oldViewportSize) {
// When our viewport size changes, we may need to update the overflow rects
// of our child frames. This is the case if:
//
@@ -494,25 +494,25 @@ nsSVGOuterSVGFrame::Reflow(nsPresContext
aDesiredSize.mOverflowAreas.VisualOverflow(),
anonKid->GetVisualOverflowRect() + anonKid->GetPosition());
}
FinishAndStoreOverflow(&aDesiredSize);
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("exit nsSVGOuterSVGFrame::Reflow: size=%d,%d",
aDesiredSize.Width(), aDesiredSize.Height()));
- NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
+ NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
void
nsSVGOuterSVGFrame::DidReflow(nsPresContext* aPresContext,
- const ReflowInput* aReflowState,
+ const ReflowInput* aReflowInput,
nsDidReflowStatus aStatus)
{
- nsSVGDisplayContainerFrame::DidReflow(aPresContext,aReflowState,aStatus);
+ nsSVGDisplayContainerFrame::DidReflow(aPresContext,aReflowInput,aStatus);
// Make sure elements styled by :hover get updated if script/animation moves
// them under or out from under the pointer:
PresContext()->PresShell()->SynthesizeMouseMove(false);
}
/* virtual */ void
nsSVGOuterSVGFrame::UnionChildOverflow(nsOverflowAreas& aOverflowAreas)
--- a/layout/svg/nsSVGOuterSVGFrame.h
+++ b/layout/svg/nsSVGOuterSVGFrame.h
@@ -51,21 +51,21 @@ public:
nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorder,
const mozilla::LogicalSize& aPadding,
ComputeSizeFlags aFlags) 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 UnionChildOverflow(nsOverflowAreas& aOverflowAreas) override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
--- a/layout/tables/BasicTableLayoutStrategy.cpp
+++ b/layout/tables/BasicTableLayoutStrategy.cpp
@@ -515,34 +515,34 @@ BasicTableLayoutStrategy::MarkIntrinsicI
{
mMinISize = NS_INTRINSIC_WIDTH_UNKNOWN;
mPrefISize = NS_INTRINSIC_WIDTH_UNKNOWN;
mPrefISizePctExpand = NS_INTRINSIC_WIDTH_UNKNOWN;
mLastCalcISize = nscoord_MIN;
}
/* virtual */ void
-BasicTableLayoutStrategy::ComputeColumnISizes(const ReflowInput& aReflowState)
+BasicTableLayoutStrategy::ComputeColumnISizes(const ReflowInput& aReflowInput)
{
- nscoord iSize = aReflowState.ComputedISize();
+ nscoord iSize = aReflowInput.ComputedISize();
if (mLastCalcISize == iSize) {
return;
}
mLastCalcISize = iSize;
NS_ASSERTION((mMinISize == NS_INTRINSIC_WIDTH_UNKNOWN) ==
(mPrefISize == NS_INTRINSIC_WIDTH_UNKNOWN),
"dirtyness out of sync");
NS_ASSERTION((mMinISize == NS_INTRINSIC_WIDTH_UNKNOWN) ==
(mPrefISizePctExpand == NS_INTRINSIC_WIDTH_UNKNOWN),
"dirtyness out of sync");
// XXX Is this needed?
if (mMinISize == NS_INTRINSIC_WIDTH_UNKNOWN) {
- ComputeIntrinsicISizes(aReflowState.mRenderingContext);
+ ComputeIntrinsicISizes(aReflowInput.mRenderingContext);
}
nsTableCellMap *cellMap = mTableFrame->GetCellMap();
int32_t colCount = cellMap->GetColCount();
if (colCount <= 0)
return; // nothing to do
DistributeISizeToColumns(iSize, 0, colCount, BTLS_FINAL_ISIZE, false);
--- a/layout/tables/BasicTableLayoutStrategy.h
+++ b/layout/tables/BasicTableLayoutStrategy.h
@@ -23,17 +23,17 @@ public:
explicit BasicTableLayoutStrategy(nsTableFrame *aTableFrame);
virtual ~BasicTableLayoutStrategy();
// nsITableLayoutStrategy implementation
virtual nscoord GetMinISize(nsRenderingContext* aRenderingContext) override;
virtual nscoord GetPrefISize(nsRenderingContext* aRenderingContext,
bool aComputingSize) override;
virtual void MarkIntrinsicISizesDirty() override;
- virtual void ComputeColumnISizes(const ReflowInput& aReflowState) override;
+ virtual void ComputeColumnISizes(const ReflowInput& aReflowInput) override;
private:
// NOTE: Using prefix "BTLS" to avoid overlapping names with
// the values of nsLayoutUtils::IntrinsicISizeType
enum BtlsISizeType { BTLS_MIN_ISIZE,
BTLS_PREF_ISIZE,
BTLS_FINAL_ISIZE };
--- a/layout/tables/FixedTableLayoutStrategy.cpp
+++ b/layout/tables/FixedTableLayoutStrategy.cpp
@@ -148,19 +148,19 @@ AllocateUnassigned(nscoord aUnassignedSp
// equal. We want to return unassignedSpace exactly, even if it
// can't be precisely round-tripped through float.
return aUnassignedSpace;
}
return NSToCoordRound(float(aUnassignedSpace) * aShare);
}
/* virtual */ void
-FixedTableLayoutStrategy::ComputeColumnISizes(const ReflowInput& aReflowState)
+FixedTableLayoutStrategy::ComputeColumnISizes(const ReflowInput& aReflowInput)
{
- nscoord tableISize = aReflowState.ComputedISize();
+ nscoord tableISize = aReflowInput.ComputedISize();
if (mLastCalcISize == tableISize) {
return;
}
mLastCalcISize = tableISize;
nsTableCellMap *cellMap = mTableFrame->GetCellMap();
int32_t colCount = cellMap->GetColCount();
@@ -208,17 +208,17 @@ FixedTableLayoutStrategy::ComputeColumnI
NS_ERROR("column frames out of sync with cell map");
continue;
}
oldColISizes.AppendElement(colFrame->GetFinalISize());
colFrame->ResetPrefPercent();
const nsStyleCoord *styleISize = &colFrame->StylePosition()->ISize(wm);
nscoord colISize;
if (styleISize->ConvertsToLength()) {
- colISize = nsLayoutUtils::ComputeISizeValue(aReflowState.mRenderingContext,
+ colISize = nsLayoutUtils::ComputeISizeValue(aReflowInput.mRenderingContext,
colFrame, 0, 0, 0,
*styleISize);
specTotal += colISize;
} else if (styleISize->GetUnit() == eStyleUnit_Percent) {
float pct = styleISize->GetPercentValue();
colISize = NSToCoordFloor(pct * float(tableISize));
colFrame->AddPrefPercent(pct);
pctTotal += pct;
@@ -242,17 +242,17 @@ FixedTableLayoutStrategy::ComputeColumnI
(styleISize->GetIntValue() == NS_STYLE_WIDTH_MAX_CONTENT ||
styleISize->GetIntValue() == NS_STYLE_WIDTH_MIN_CONTENT))) {
// XXX This should use real percentage padding
// Note that the difference between MIN_ISIZE and PREF_ISIZE
// shouldn't matter for any of these values of styleISize; use
// MIN_ISIZE for symmetry with GetMinISize above, just in case
// there is a difference.
colISize =
- nsLayoutUtils::IntrinsicForContainer(aReflowState.mRenderingContext,
+ nsLayoutUtils::IntrinsicForContainer(aReflowInput.mRenderingContext,
cellFrame,
nsLayoutUtils::MIN_ISIZE);
} else if (styleISize->GetUnit() == eStyleUnit_Percent) {
// XXX This should use real percentage padding
float pct = styleISize->GetPercentValue();
colISize = NSToCoordFloor(pct * float(tableISize));
if (cellStylePos->mBoxSizing == StyleBoxSizing::Content) {
--- a/layout/tables/FixedTableLayoutStrategy.h
+++ b/layout/tables/FixedTableLayoutStrategy.h
@@ -23,17 +23,17 @@ public:
explicit FixedTableLayoutStrategy(nsTableFrame *aTableFrame);
virtual ~FixedTableLayoutStrategy();
// nsITableLayoutStrategy implementation
virtual nscoord GetMinISize(nsRenderingContext* aRenderingContext) override;
virtual nscoord GetPrefISize(nsRenderingContext* aRenderingContext,
bool aComputingSize) override;
virtual void MarkIntrinsicISizesDirty() override;
- virtual void ComputeColumnISizes(const ReflowInput& aReflowState)
+ virtual void ComputeColumnISizes(const ReflowInput& aReflowInput)
override;
private:
nsTableFrame *mTableFrame;
nscoord mMinISize;
nscoord mLastCalcISize;
};
--- a/layout/tables/nsITableLayoutStrategy.h
+++ b/layout/tables/nsITableLayoutStrategy.h
@@ -36,17 +36,17 @@ public:
/** Implement nsIFrame::MarkIntrinsicISizesDirty for the table */
virtual void MarkIntrinsicISizesDirty() = 0;
/**
* Compute final column isizes based on the intrinsic isize data and
* the available isize.
*/
- virtual void ComputeColumnISizes(const ReflowInput& aReflowState) = 0;
+ virtual void ComputeColumnISizes(const ReflowInput& aReflowInput) = 0;
/**
* Return the type of table layout strategy, without the cost of
* a virtual function call
*/
enum Type { Auto, Fixed };
Type GetType() const { return mType; }
--- a/layout/tables/nsTableCellFrame.cpp
+++ b/layout/tables/nsTableCellFrame.cpp
@@ -103,76 +103,76 @@ nsTableCellFrame::DestroyFrom(nsIFrame*
}
nsContainerFrame::DestroyFrom(aDestructRoot);
}
// nsIPercentBSizeObserver methods
void
-nsTableCellFrame::NotifyPercentBSize(const ReflowInput& aReflowState)
+nsTableCellFrame::NotifyPercentBSize(const ReflowInput& aReflowInput)
{
- // ReflowInput ensures the mCBReflowState of blocks inside a
+ // ReflowInput ensures the mCBReflowInput of blocks inside a
// cell is the cell frame, not the inner-cell block, and that the
// containing block of an inner table is the containing block of its
// table wrapper.
// XXXldb Given the now-stricter |NeedsToObserve|, many if not all of
// these tests are probably unnecessary.
// Maybe the cell reflow state; we sure if we're inside the |if|.
- const ReflowInput *cellRS = aReflowState.mCBReflowState;
+ const ReflowInput *cellRS = aReflowInput.mCBReflowInput;
if (cellRS && cellRS->mFrame == this &&
(cellRS->ComputedBSize() == NS_UNCONSTRAINEDSIZE ||
cellRS->ComputedBSize() == 0)) { // XXXldb Why 0?
// This is a percentage bsize on a frame whose percentage bsizes
// are based on the bsize of the cell, since its containing block
// is the inner cell frame.
// We'll only honor the percent bsize if sibling-cells/ancestors
// have specified/pct bsize. (Also, siblings only count for this if
// both this cell and the sibling cell span exactly 1 row.)
if (nsTableFrame::AncestorsHaveStyleBSize(*cellRS) ||
(GetTableFrame()->GetEffectiveRowSpan(*this) == 1 &&
- cellRS->mParentReflowState->mFrame->
+ cellRS->mParentReflowInput->mFrame->
HasAnyStateBits(NS_ROW_HAS_CELL_WITH_STYLE_BSIZE))) {
- for (const ReflowInput *rs = aReflowState.mParentReflowState;
+ for (const ReflowInput *rs = aReflowInput.mParentReflowInput;
rs != cellRS;
- rs = rs->mParentReflowState) {
+ rs = rs->mParentReflowInput) {
rs->mFrame->AddStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE);
}
nsTableFrame::RequestSpecialBSizeReflow(*cellRS);
}
}
}
// The cell needs to observe its block and things inside its block but nothing below that
bool
-nsTableCellFrame::NeedsToObserve(const ReflowInput& aReflowState)
+nsTableCellFrame::NeedsToObserve(const ReflowInput& aReflowInput)
{
- const ReflowInput *rs = aReflowState.mParentReflowState;
+ const ReflowInput *rs = aReflowInput.mParentReflowInput;
if (!rs)
return false;
if (rs->mFrame == this) {
// We always observe the child block. It will never send any
// notifications, but we need this so that the observer gets
// propagated to its kids.
return true;
}
- rs = rs->mParentReflowState;
+ rs = rs->mParentReflowInput;
if (!rs) {
return false;
}
// We always need to let the percent bsize observer be propagated
// from a table wrapper frame to an inner table frame.
- nsIAtom *fType = aReflowState.mFrame->GetType();
+ nsIAtom *fType = aReflowInput.mFrame->GetType();
if (fType == nsGkAtoms::tableFrame) {
return true;
}
// We need the observer to be propagated to all children of the cell
// (i.e., children of the child block) in quirks mode, but only to
// tables in standards mode.
// XXX This may not be true in the case of orthogonal flows within
@@ -556,17 +556,17 @@ nsTableCellFrame::BuildDisplayList(nsDis
// event handling. We do not call BuildDisplayListForNonBlockChildren
// because that/ would put the child's background in the Content() list
// which isn't right (e.g., would end up on top of our child floats for
// event handling).
BuildDisplayListForChild(aBuilder, kid, aDirtyRect, aLists);
}
nsIFrame::LogicalSides
-nsTableCellFrame::GetLogicalSkipSides(const ReflowInput* aReflowState) const
+nsTableCellFrame::GetLogicalSkipSides(const ReflowInput* aReflowInput) const
{
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
NS_STYLE_BOX_DECORATION_BREAK_CLONE)) {
return LogicalSides();
}
LogicalSides skip;
if (nullptr != GetPrevInFlow()) {
@@ -853,36 +853,36 @@ CalcUnpaginatedBSize(nsTableCellFrame& a
}
}
return computedBSize;
}
void
nsTableCellFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsTableCellFrame");
- DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
+ DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
- if (aReflowState.mFlags.mSpecialBSizeReflow) {
+ if (aReflowInput.mFlags.mSpecialBSizeReflow) {
FirstInFlow()->AddStateBits(NS_TABLE_CELL_HAD_SPECIAL_REFLOW);
}
// see if a special bsize reflow needs to occur due to having a pct height
- nsTableFrame::CheckRequestSpecialBSizeReflow(aReflowState);
+ nsTableFrame::CheckRequestSpecialBSizeReflow(aReflowInput);
aStatus = NS_FRAME_COMPLETE;
- WritingMode wm = aReflowState.GetWritingMode();
- LogicalSize availSize(wm, aReflowState.AvailableISize(),
- aReflowState.AvailableBSize());
+ WritingMode wm = aReflowInput.GetWritingMode();
+ LogicalSize availSize(wm, aReflowInput.AvailableISize(),
+ aReflowInput.AvailableBSize());
- LogicalMargin borderPadding = aReflowState.ComputedLogicalPadding();
+ LogicalMargin borderPadding = aReflowInput.ComputedLogicalPadding();
LogicalMargin border = GetBorderWidth(wm);
borderPadding += border;
// reduce available space by insets, if we're in a constrained situation
availSize.ISize(wm) -= borderPadding.IStartEnd(wm);
if (NS_UNCONSTRAINEDSIZE != availSize.BSize(wm)) {
availSize.BSize(wm) -= borderPadding.BStartEnd(wm);
}
@@ -890,73 +890,73 @@ nsTableCellFrame::Reflow(nsPresContext*
// Try to reflow the child into the available space. It might not
// fit or might need continuing.
if (availSize.BSize(wm) < 0) {
availSize.BSize(wm) = 1;
}
ReflowOutput kidSize(wm, aDesiredSize.mFlags);
kidSize.ClearSize();
- SetPriorAvailISize(aReflowState.AvailableISize());
+ SetPriorAvailISize(aReflowInput.AvailableISize());
nsIFrame* firstKid = mFrames.FirstChild();
NS_ASSERTION(firstKid, "Frame construction error, a table cell always has an inner cell frame");
nsTableFrame* tableFrame = GetTableFrame();
- if (aReflowState.mFlags.mSpecialBSizeReflow) {
- const_cast<ReflowInput&>(aReflowState).
+ if (aReflowInput.mFlags.mSpecialBSizeReflow) {
+ const_cast<ReflowInput&>(aReflowInput).
SetComputedBSize(BSize(wm) - borderPadding.BStartEnd(wm));
DISPLAY_REFLOW_CHANGE();
}
else if (aPresContext->IsPaginated()) {
nscoord computedUnpaginatedBSize =
CalcUnpaginatedBSize((nsTableCellFrame&)*this,
*tableFrame, borderPadding.BStartEnd(wm));
if (computedUnpaginatedBSize > 0) {
- const_cast<ReflowInput&>(aReflowState).SetComputedBSize(computedUnpaginatedBSize);
+ const_cast<ReflowInput&>(aReflowInput).SetComputedBSize(computedUnpaginatedBSize);
DISPLAY_REFLOW_CHANGE();
}
}
else {
SetHasPctOverBSize(false);
}
WritingMode kidWM = firstKid->GetWritingMode();
- ReflowInput kidReflowState(aPresContext, aReflowState, firstKid,
+ ReflowInput kidReflowInput(aPresContext, aReflowInput, firstKid,
availSize.ConvertTo(kidWM, wm));
// Don't be a percent height observer if we're in the middle of
// special-bsize reflow, in case we get an accidental NotifyPercentBSize()
// call (which we shouldn't honor during special-bsize reflow)
- if (!aReflowState.mFlags.mSpecialBSizeReflow) {
+ if (!aReflowInput.mFlags.mSpecialBSizeReflow) {
// mPercentBSizeObserver is for children of cells in quirks mode,
// but only those than are tables in standards mode. NeedsToObserve
// will determine how far this is propagated to descendants.
- kidReflowState.mPercentBSizeObserver = this;
+ kidReflowInput.mPercentBSizeObserver = this;
}
// Don't propagate special bsize reflow state to our kids
- kidReflowState.mFlags.mSpecialBSizeReflow = false;
+ kidReflowInput.mFlags.mSpecialBSizeReflow = false;
- if (aReflowState.mFlags.mSpecialBSizeReflow ||
+ if (aReflowInput.mFlags.mSpecialBSizeReflow ||
FirstInFlow()->HasAnyStateBits(NS_TABLE_CELL_HAD_SPECIAL_REFLOW)) {
// We need to force the kid to have mBResize set if we've had a
// special reflow in the past, since the non-special reflow needs to
// resize back to what it was without the special bsize reflow.
- kidReflowState.SetBResize(true);
+ kidReflowInput.SetBResize(true);
}
nsSize containerSize =
- aReflowState.ComputedSizeAsContainerIfConstrained();
+ aReflowInput.ComputedSizeAsContainerIfConstrained();
LogicalPoint kidOrigin(wm, borderPadding.IStart(wm),
borderPadding.BStart(wm));
nsRect origRect = firstKid->GetRect();
nsRect origVisualOverflow = firstKid->GetVisualOverflowRect();
bool firstReflow = firstKid->HasAnyStateBits(NS_FRAME_FIRST_REFLOW);
- ReflowChild(firstKid, aPresContext, kidSize, kidReflowState,
+ ReflowChild(firstKid, aPresContext, kidSize, kidReflowInput,
wm, kidOrigin, containerSize, 0, aStatus);
if (NS_FRAME_OVERFLOW_IS_INCOMPLETE(aStatus)) {
// Don't pass OVERFLOW_INCOMPLETE through tables until they can actually handle it
//XXX should paginate overflow as overflow, but not in this patch (bug 379349)
NS_FRAME_SET_INCOMPLETE(aStatus);
printf("Set table cell incomplete %p\n", static_cast<void*>(this));
}
@@ -976,17 +976,17 @@ nsTableCellFrame::Reflow(nsPresContext*
if (prevInFlow) {
isEmpty = static_cast<nsTableCellFrame*>(prevInFlow)->GetContentEmpty();
} else {
isEmpty = !CellHasVisibleContent(kidSize.Height(), tableFrame, firstKid);
}
SetContentEmpty(isEmpty);
// Place the child
- FinishReflowChild(firstKid, aPresContext, kidSize, &kidReflowState,
+ FinishReflowChild(firstKid, aPresContext, kidSize, &kidReflowInput,
wm, kidOrigin, containerSize, 0);
nsTableFrame::InvalidateTableFrame(firstKid, origRect, origVisualOverflow,
firstReflow);
// first, compute the bsize which can be set w/o being restricted by
// available bsize
LogicalSize cellSize(wm);
@@ -1004,23 +1004,23 @@ nsTableCellFrame::Reflow(nsPresContext*
cellSize.ISize(wm) += borderPadding.IStartEnd(wm);
}
// set the cell's desired size and max element size
aDesiredSize.SetSize(wm, cellSize);
// the overflow area will be computed when BlockDirAlignChild() gets called
- if (aReflowState.mFlags.mSpecialBSizeReflow) {
+ if (aReflowInput.mFlags.mSpecialBSizeReflow) {
if (aDesiredSize.BSize(wm) > BSize(wm)) {
// set a bit indicating that the pct bsize contents exceeded
// the height that they could honor in the pass 2 reflow
SetHasPctOverBSize(true);
}
- if (NS_UNCONSTRAINEDSIZE == aReflowState.AvailableBSize()) {
+ if (NS_UNCONSTRAINEDSIZE == aReflowInput.AvailableBSize()) {
aDesiredSize.BSize(wm) = BSize(wm);
}
}
// If our parent is in initial reflow, it'll handle invalidating our
// entire overflow rect.
if (!GetParent()->HasAnyStateBits(NS_FRAME_FIRST_REFLOW) &&
nsSize(aDesiredSize.Width(), aDesiredSize.Height()) != mRect.Size()) {
@@ -1030,17 +1030,17 @@ nsTableCellFrame::Reflow(nsPresContext*
// remember the desired size for this reflow
SetDesiredSize(aDesiredSize);
// Any absolutely-positioned children will get reflowed in
// nsFrame::FixupPositionedTableParts in another pass, so propagate our
// dirtiness to them before our parent clears our dirty bits.
PushDirtyBitToAbsoluteFrames();
- NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
+ NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
/* ----- global methods ----- */
NS_QUERYFRAME_HEAD(nsTableCellFrame)
NS_QUERYFRAME_ENTRY(nsTableCellFrame)
NS_QUERYFRAME_ENTRY(nsITableCellLayout)
NS_QUERYFRAME_ENTRY(nsIPercentBSizeObserver)
--- a/layout/tables/nsTableCellFrame.h
+++ b/layout/tables/nsTableCellFrame.h
@@ -94,19 +94,19 @@ public:
#endif
virtual nsContainerFrame* GetContentInsertionFrame() override {
return PrincipalChildList().FirstChild()->GetContentInsertionFrame();
}
virtual nsMargin GetUsedMargin() const override;
- virtual void NotifyPercentBSize(const ReflowInput& aReflowState) override;
+ virtual void NotifyPercentBSize(const ReflowInput& aReflowInput) override;
- virtual bool NeedsToObserve(const ReflowInput& aReflowState) override;
+ virtual bool NeedsToObserve(const ReflowInput& aReflowInput) override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
DrawResult PaintCellBackground(nsRenderingContext& aRenderingContext,
const nsRect& aDirtyRect, nsPoint aPt,
uint32_t aFlags);
@@ -117,17 +117,17 @@ public:
const nsDisplayListSet& aLists);
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
virtual IntrinsicISizeOffsetData IntrinsicISizeOffsets() override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
/**
* Get the "type" of the frame
*
* @see nsLayoutAtoms::tableCellFrame
*/
virtual nsIAtom* GetType() const override;
@@ -238,17 +238,17 @@ public:
}
virtual void InvalidateFrame(uint32_t aDisplayItemKey = 0) override;
virtual void InvalidateFrameWithRect(const nsRect& aRect, uint32_t aDisplayItemKey = 0) override;
virtual void InvalidateFrameForRemoval() override { InvalidateFrameSubtree(); }
protected:
virtual LogicalSides
- GetLogicalSkipSides(const ReflowInput* aReflowState = nullptr) const override;
+ GetLogicalSkipSides(const ReflowInput* aReflowInput = nullptr) const override;
/**
* GetBorderOverflow says how far the cell's own borders extend
* outside its own bounds. In the separated borders model this should
* just be zero (as it is for most frames), but in the collapsed
* borders model (for which nsBCTableCellFrame overrides this virtual
* method), it considers the extents of the collapsed border.
*/
--- a/layout/tables/nsTableColFrame.cpp
+++ b/layout/tables/nsTableColFrame.cpp
@@ -87,30 +87,30 @@ void nsTableColFrame::SetContinuousBCBor
default:
NS_ERROR("invalid side arg");
}
}
void
nsTableColFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsTableColFrame");
- DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
+ DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
aDesiredSize.ClearSize();
const nsStyleVisibility* colVis = StyleVisibility();
bool collapseCol = (NS_STYLE_VISIBILITY_COLLAPSE == colVis->mVisible);
if (collapseCol) {
GetTableFrame()->SetNeedToCollapse(true);
}
aStatus = NS_FRAME_COMPLETE;
- NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
+ NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
int32_t nsTableColFrame::GetSpan()
{
return StyleTable()->mSpan;
}
#ifdef DEBUG
--- a/layout/tables/nsTableColFrame.h
+++ b/layout/tables/nsTableColFrame.h
@@ -51,17 +51,17 @@ public:
int32_t GetColIndex() const;
void SetColIndex (int32_t aColIndex);
nsTableColFrame* GetNextCol() const;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
/**
* Table columns never paint anything, nor receive events.
*/
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override {}
--- a/layout/tables/nsTableColGroupFrame.cpp
+++ b/layout/tables/nsTableColGroupFrame.cpp
@@ -325,17 +325,17 @@ nsTableColGroupFrame::RemoveFrame(ChildL
}
}
else {
mFrames.DestroyFrame(aOldFrame);
}
}
nsIFrame::LogicalSides
-nsTableColGroupFrame::GetLogicalSkipSides(const ReflowInput* aReflowState) const
+nsTableColGroupFrame::GetLogicalSkipSides(const ReflowInput* aReflowInput) const
{
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
NS_STYLE_BOX_DECORATION_BREAK_CLONE)) {
return LogicalSides();
}
LogicalSides skip;
if (nullptr != GetPrevInFlow()) {
@@ -345,47 +345,47 @@ nsTableColGroupFrame::GetLogicalSkipSide
skip |= eLogicalSideBitsBEnd;
}
return skip;
}
void
nsTableColGroupFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsTableColGroupFrame");
- DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
+ DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
NS_ASSERTION(nullptr!=mContent, "bad state -- null content for frame");
const nsStyleVisibility* groupVis = StyleVisibility();
bool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupVis->mVisible);
if (collapseGroup) {
GetTableFrame()->SetNeedToCollapse(true);
}
// for every content child that (is a column thingy and does not already have a frame)
// create a frame and adjust it's style
for (nsIFrame *kidFrame = mFrames.FirstChild(); kidFrame;
kidFrame = kidFrame->GetNextSibling()) {
// Give the child frame a chance to reflow, even though we know it'll have 0 size
- ReflowOutput kidSize(aReflowState);
- ReflowInput kidReflowState(aPresContext, aReflowState, kidFrame,
+ ReflowOutput kidSize(aReflowInput);
+ ReflowInput kidReflowInput(aPresContext, aReflowInput, kidFrame,
LogicalSize(kidFrame->GetWritingMode()));
nsReflowStatus status;
- ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, 0, 0, 0, status);
+ ReflowChild(kidFrame, aPresContext, kidSize, kidReflowInput, 0, 0, 0, status);
FinishReflowChild(kidFrame, aPresContext, kidSize, nullptr, 0, 0, 0);
}
aDesiredSize.ClearSize();
aStatus = NS_FRAME_COMPLETE;
- NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
+ NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
nsTableColFrame * nsTableColGroupFrame::GetFirstColumn()
{
return GetNextColumn(nullptr);
}
nsTableColFrame * nsTableColGroupFrame::GetNextColumn(nsIFrame *aChildFrame)
--- a/layout/tables/nsTableColGroupFrame.h
+++ b/layout/tables/nsTableColGroupFrame.h
@@ -101,17 +101,17 @@ public:
/** reflow of a column group is a trivial matter of reflowing
* the col group's children (columns), and setting this frame
* to 0-size. Since tables are row-centric, column group frames
* don't play directly in the rendering game. They do however
* maintain important state that effects table and cell layout.
*/
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
/**
* Get the "type" of the frame
*
* @see nsGkAtoms::tableColGroupFrame
*/
virtual nsIAtom* GetType() const override;
@@ -209,17 +209,17 @@ public:
virtual void InvalidateFrameForRemoval() override { InvalidateFrameSubtree(); }
protected:
explicit nsTableColGroupFrame(nsStyleContext* aContext);
void InsertColsReflow(int32_t aColIndex,
const nsFrameList::Slice& aCols);
- virtual LogicalSides GetLogicalSkipSides(const ReflowInput* aReflowState = nullptr) const override;
+ virtual LogicalSides GetLogicalSkipSides(const ReflowInput* aReflowInput = nullptr) const override;
// data members
int32_t mColCount;
// the starting column index this col group represents. Must be >= 0.
int32_t mStartColIndex;
// border width in pixels
BCPixelSize mBStartContBorderWidth;
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -56,38 +56,38 @@ using namespace mozilla::layout;
** TableReflowInput **
********************************************************************************/
namespace mozilla {
struct TableReflowInput {
// the real reflow state
- const ReflowInput& reflowState;
-
- // The table's available size (in reflowState's writing mode)
+ const ReflowInput& reflowInput;
+
+ // The table's available size (in reflowInput's writing mode)
LogicalSize availSize;
// Stationary inline-offset
nscoord iCoord;
// Running block-offset
nscoord bCoord;
- TableReflowInput(const ReflowInput& aReflowState,
+ TableReflowInput(const ReflowInput& aReflowInput,
const LogicalSize& aAvailSize)
- : reflowState(aReflowState)
+ : reflowInput(aReflowInput)
, availSize(aAvailSize)
{
- MOZ_ASSERT(reflowState.mFrame->GetType() == nsGkAtoms::tableFrame,
+ MOZ_ASSERT(reflowInput.mFrame->GetType() == nsGkAtoms::tableFrame,
"TableReflowInput should only be created for nsTableFrame");
nsTableFrame* table =
- static_cast<nsTableFrame*>(reflowState.mFrame->FirstInFlow());
- WritingMode wm = aReflowState.GetWritingMode();
- LogicalMargin borderPadding = table->GetChildAreaOffset(wm, &reflowState);
+ static_cast<nsTableFrame*>(reflowInput.mFrame->FirstInFlow());
+ WritingMode wm = aReflowInput.GetWritingMode();
+ LogicalMargin borderPadding = table->GetChildAreaOffset(wm, &reflowInput);
iCoord = borderPadding.IStart(wm) + table->GetColSpacing(-1);
bCoord = borderPadding.BStart(wm); //cellspacing added during reflow
// XXX do we actually need to check for unconstrained inline-size here?
if (NS_UNCONSTRAINEDSIZE != availSize.ISize(wm)) {
int32_t colCount = table->GetColCount();
availSize.ISize(wm) -= borderPadding.IStartEnd(wm) +
@@ -1410,17 +1410,17 @@ nsTableFrame::PaintTableBorderBackground
PaintBCBorders(*drawTarget, aDirtyRect - aPt);
}
}
return result;
}
nsIFrame::LogicalSides
-nsTableFrame::GetLogicalSkipSides(const ReflowInput* aReflowState) const
+nsTableFrame::GetLogicalSkipSides(const ReflowInput* aReflowInput) const
{
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
NS_STYLE_BOX_DECORATION_BREAK_CLONE)) {
return LogicalSides();
}
LogicalSides skip;
// frame attribute was accounted for in nsHTMLTableElement::MapTableBorderInto
@@ -1665,24 +1665,24 @@ nsTableFrame::ComputeAutoSize(nsRenderin
{
// Tables always shrink-wrap.
nscoord cbBased = aAvailableISize - aMargin.ISize(aWM) - aBorder.ISize(aWM) -
aPadding.ISize(aWM);
return LogicalSize(aWM, TableShrinkISizeToFit(aRenderingContext, cbBased),
NS_UNCONSTRAINEDSIZE);
}
-// Return true if aParentReflowState.frame or any of its ancestors within
+// Return true if aParentReflowInput.frame or any of its ancestors within
// the containing table have non-auto bsize. (e.g. pct or fixed bsize)
bool
-nsTableFrame::AncestorsHaveStyleBSize(const ReflowInput& aParentReflowState)
-{
- WritingMode wm = aParentReflowState.GetWritingMode();
- for (const ReflowInput* rs = &aParentReflowState;
- rs && rs->mFrame; rs = rs->mParentReflowState) {
+nsTableFrame::AncestorsHaveStyleBSize(const ReflowInput& aParentReflowInput)
+{
+ WritingMode wm = aParentReflowInput.GetWritingMode();
+ for (const ReflowInput* rs = &aParentReflowInput;
+ rs && rs->mFrame; rs = rs->mParentReflowInput) {
nsIAtom* frameType = rs->mFrame->GetType();
if (IS_TABLE_CELL(frameType) ||
(nsGkAtoms::tableRowFrame == frameType) ||
(nsGkAtoms::tableRowGroupFrame == frameType)) {
const nsStyleCoord &bsize = rs->mStylePosition->BSize(wm);
// calc() with percentages treated like 'auto' on internal table elements
if (bsize.GetUnit() != eStyleUnit_Auto &&
(!bsize.IsCalcUnit() || !bsize.HasPercent())) {
@@ -1695,53 +1695,53 @@ nsTableFrame::AncestorsHaveStyleBSize(co
}
}
return false;
}
// See if a special block-size reflow needs to occur and if so,
// call RequestSpecialBSizeReflow
void
-nsTableFrame::CheckRequestSpecialBSizeReflow(const ReflowInput& aReflowState)
-{
- NS_ASSERTION(IS_TABLE_CELL(aReflowState.mFrame->GetType()) ||
- aReflowState.mFrame->GetType() == nsGkAtoms::tableRowFrame ||
- aReflowState.mFrame->GetType() == nsGkAtoms::tableRowGroupFrame ||
- aReflowState.mFrame->GetType() == nsGkAtoms::tableFrame,
+nsTableFrame::CheckRequestSpecialBSizeReflow(const ReflowInput& aReflowInput)
+{
+ NS_ASSERTION(IS_TABLE_CELL(aReflowInput.mFrame->GetType()) ||
+ aReflowInput.mFrame->GetType() == nsGkAtoms::tableRowFrame ||
+ aReflowInput.mFrame->GetType() == nsGkAtoms::tableRowGroupFrame ||
+ aReflowInput.mFrame->GetType() == nsGkAtoms::tableFrame,
"unexpected frame type");
- WritingMode wm = aReflowState.GetWritingMode();
- if (!aReflowState.mFrame->GetPrevInFlow() && // 1st in flow
- (NS_UNCONSTRAINEDSIZE == aReflowState.ComputedBSize() || // no computed bsize
- 0 == aReflowState.ComputedBSize()) &&
- eStyleUnit_Percent == aReflowState.mStylePosition->BSize(wm).GetUnit() && // pct bsize
- nsTableFrame::AncestorsHaveStyleBSize(*aReflowState.mParentReflowState)) {
- nsTableFrame::RequestSpecialBSizeReflow(aReflowState);
+ WritingMode wm = aReflowInput.GetWritingMode();
+ if (!aReflowInput.mFrame->GetPrevInFlow() && // 1st in flow
+ (NS_UNCONSTRAINEDSIZE == aReflowInput.ComputedBSize() || // no computed bsize
+ 0 == aReflowInput.ComputedBSize()) &&
+ eStyleUnit_Percent == aReflowInput.mStylePosition->BSize(wm).GetUnit() && // pct bsize
+ nsTableFrame::AncestorsHaveStyleBSize(*aReflowInput.mParentReflowInput)) {
+ nsTableFrame::RequestSpecialBSizeReflow(aReflowInput);
}
}
// Notify the frame and its ancestors (up to the containing table) that a special
// bsize reflow will occur. During a special bsize reflow, a table, row group,
// row, or cell returns the last size it was reflowed at. However, the table may
// change the bsize of row groups, rows, cells in DistributeBSizeToRows after.
// And the row group can change the bsize of rows, cells in CalculateRowBSizes.
void
-nsTableFrame::RequestSpecialBSizeReflow(const ReflowInput& aReflowState)
+nsTableFrame::RequestSpecialBSizeReflow(const ReflowInput& aReflowInput)
{
// notify the frame and its ancestors of the special reflow, stopping at the containing table
- for (const ReflowInput* rs = &aReflowState; rs && rs->mFrame; rs = rs->mParentReflowState) {
+ for (const ReflowInput* rs = &aReflowInput; rs && rs->mFrame; rs = rs->mParentReflowInput) {
nsIAtom* frameType = rs->mFrame->GetType();
NS_ASSERTION(IS_TABLE_CELL(frameType) ||
nsGkAtoms::tableRowFrame == frameType ||
nsGkAtoms::tableRowGroupFrame == frameType ||
nsGkAtoms::tableFrame == frameType,
"unexpected frame type");
rs->mFrame->AddStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE);
if (nsGkAtoms::tableFrame == frameType) {
- NS_ASSERTION(rs != &aReflowState,
+ NS_ASSERTION(rs != &aReflowInput,
"should not request special bsize reflow for table");
// always stop when we reach a table
break;
}
}
}
/******************************************************************************************
@@ -1804,141 +1804,141 @@ nsTableFrame::RequestSpecialBSizeReflow(
* the contents of the cells to do the necessary block-axis resizing.
*
******************************************************************************************/
/* Layout the entire inner table. */
void
nsTableFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsTableFrame");
- DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
+ DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
bool isPaginated = aPresContext->IsPaginated();
- WritingMode wm = aReflowState.GetWritingMode();
+ WritingMode wm = aReflowInput.GetWritingMode();
aStatus = NS_FRAME_COMPLETE;
if (!GetPrevInFlow() && !mTableLayoutStrategy) {
NS_ERROR("strategy should have been created in Init");
return;
}
// see if collapsing borders need to be calculated
if (!GetPrevInFlow() && IsBorderCollapse() && NeedToCalcBCBorders()) {
CalcBCBorders();
}
- aDesiredSize.ISize(wm) = aReflowState.AvailableISize();
+ aDesiredSize.ISize(wm) = aReflowInput.AvailableISize();
// Check for an overflow list, and append any row group frames being pushed
MoveOverflowToChildList();
bool haveDesiredBSize = false;
SetHaveReflowedColGroups(false);
// Reflow the entire table (pass 2 and possibly pass 3). This phase is necessary during a
// constrained initial reflow and other reflows which require either a strategy init or balance.
// This isn't done during an unconstrained reflow, because it will occur later when the parent
// reflows with a constrained isize.
bool fixupKidPositions = false;
if (NS_SUBTREE_DIRTY(this) ||
- aReflowState.ShouldReflowAllKids() ||
+ aReflowInput.ShouldReflowAllKids() ||
IsGeometryDirty() ||
- aReflowState.IsBResize()) {
-
- if (aReflowState.ComputedBSize() != NS_UNCONSTRAINEDSIZE ||
+ aReflowInput.IsBResize()) {
+
+ if (aReflowInput.ComputedBSize() != NS_UNCONSTRAINEDSIZE ||
// Also check IsBResize(), to handle the first Reflow preceding a
// special bsize Reflow, when we've already had a special bsize
// Reflow (where ComputedBSize() would not be
// NS_UNCONSTRAINEDSIZE, but without a style change in between).
- aReflowState.IsBResize()) {
+ aReflowInput.IsBResize()) {
// XXX Eventually, we should modify DistributeBSizeToRows to use
// nsTableRowFrame::GetInitialBSize instead of nsIFrame::BSize().
// That way, it will make its calculations based on internal table
// frame bsizes as they are before they ever had any extra bsize
// distributed to them. In the meantime, this reflows all the
// internal table frames, which restores them to their state before
// DistributeBSizeToRows was called.
SetGeometryDirty();
}
bool needToInitiateSpecialReflow =
HasAnyStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE);
// see if an extra reflow will be necessary in pagination mode
// when there is a specified table bsize
- if (isPaginated && !GetPrevInFlow() && (NS_UNCONSTRAINEDSIZE != aReflowState.AvailableBSize())) {
- nscoord tableSpecifiedBSize = CalcBorderBoxBSize(aReflowState);
+ if (isPaginated && !GetPrevInFlow() && (NS_UNCONSTRAINEDSIZE != aReflowInput.AvailableBSize())) {
+ nscoord tableSpecifiedBSize = CalcBorderBoxBSize(aReflowInput);
if ((tableSpecifiedBSize > 0) &&
(tableSpecifiedBSize != NS_UNCONSTRAINEDSIZE)) {
needToInitiateSpecialReflow = true;
}
}
nsIFrame* lastChildReflowed = nullptr;
- NS_ASSERTION(!aReflowState.mFlags.mSpecialBSizeReflow,
+ NS_ASSERTION(!aReflowInput.mFlags.mSpecialBSizeReflow,
"Shouldn't be in special bsize reflow here!");
// do the pass 2 reflow unless this is a special bsize reflow and we will be
// initiating a special bsize reflow
// XXXldb I changed this. Should I change it back?
// if we need to initiate a special bsize reflow, then don't constrain the
// bsize of the reflow before that
nscoord availBSize = needToInitiateSpecialReflow
? NS_UNCONSTRAINEDSIZE
- : aReflowState.AvailableBSize();
-
- ReflowTable(aDesiredSize, aReflowState, availBSize,
+ : aReflowInput.AvailableBSize();
+
+ ReflowTable(aDesiredSize, aReflowInput, availBSize,
lastChildReflowed, aStatus);
// If ComputedWidth is unconstrained, we may need to fix child positions
// later (in vertical-rl mode) due to use of 0 as a dummy
// containerSize.width during ReflowChildren.
fixupKidPositions = wm.IsVerticalRL() &&
- aReflowState.ComputedWidth() == NS_UNCONSTRAINEDSIZE;
+ aReflowInput.ComputedWidth() == NS_UNCONSTRAINEDSIZE;
// reevaluate special bsize reflow conditions
if (HasAnyStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE)) {
needToInitiateSpecialReflow = true;
}
// XXXldb Are all these conditions correct?
if (needToInitiateSpecialReflow && NS_FRAME_IS_COMPLETE(aStatus)) {
// XXXldb Do we need to set the IsBResize flag on any reflow states?
ReflowInput &mutable_rs =
- const_cast<ReflowInput&>(aReflowState);
+ const_cast<ReflowInput&>(aReflowInput);
// distribute extra block-direction space to rows
- CalcDesiredBSize(aReflowState, aDesiredSize);
+ CalcDesiredBSize(aReflowInput, aDesiredSize);
mutable_rs.mFlags.mSpecialBSizeReflow = true;
- ReflowTable(aDesiredSize, aReflowState, aReflowState.AvailableBSize(),
+ ReflowTable(aDesiredSize, aReflowInput, aReflowInput.AvailableBSize(),
lastChildReflowed, aStatus);
if (lastChildReflowed && NS_FRAME_IS_NOT_COMPLETE(aStatus)) {
// if there is an incomplete child, then set the desired bsize
// to include it but not the next one
- LogicalMargin borderPadding = GetChildAreaOffset(wm, &aReflowState);
+ LogicalMargin borderPadding = GetChildAreaOffset(wm, &aReflowInput);
aDesiredSize.BSize(wm) =
borderPadding.BEnd(wm) + GetRowSpacing(GetRowCount()) +
lastChildReflowed->GetNormalRect().YMost(); // XXX YMost should be B-flavored
}
haveDesiredBSize = true;
mutable_rs.mFlags.mSpecialBSizeReflow = false;
}
}
- aDesiredSize.ISize(wm) = aReflowState.ComputedISize() +
- aReflowState.ComputedLogicalBorderPadding().IStartEnd(wm);
+ aDesiredSize.ISize(wm) = aReflowInput.ComputedISize() +
+ aReflowInput.ComputedLogicalBorderPadding().IStartEnd(wm);
if (!haveDesiredBSize) {
- CalcDesiredBSize(aReflowState, aDesiredSize);
+ CalcDesiredBSize(aReflowInput, aDesiredSize);
}
if (IsRowInserted()) {
ProcessRowInserted(aDesiredSize.BSize(wm));
}
if (fixupKidPositions) {
// If we didn't already know the containerSize (and so used zero during
// ReflowChildren), then we need to update the block-position of our kids.
@@ -1951,91 +1951,91 @@ nsTableFrame::Reflow(nsPresContext*
// Calculate the overflow area contribution from our children. We couldn't
// do this on the fly during ReflowChildren(), because in vertical-rl mode
// with unconstrained width, we weren't placing them in their final positions
// until the fixupKidPositions loop just above.
for (nsIFrame* kid : mFrames) {
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, kid);
}
- LogicalMargin borderPadding = GetChildAreaOffset(wm, &aReflowState);
+ LogicalMargin borderPadding = GetChildAreaOffset(wm, &aReflowInput);
SetColumnDimensions(aDesiredSize.BSize(wm), wm, borderPadding,
aDesiredSize.PhysicalSize());
if (NeedToCollapse() &&
- (NS_UNCONSTRAINEDSIZE != aReflowState.AvailableISize())) {
+ (NS_UNCONSTRAINEDSIZE != aReflowInput.AvailableISize())) {
AdjustForCollapsingRowsCols(aDesiredSize, wm, borderPadding);
}
// If there are any relatively-positioned table parts, we need to reflow their
// absolutely-positioned descendants now that their dimensions are final.
- FixupPositionedTableParts(aPresContext, aDesiredSize, aReflowState);
+ FixupPositionedTableParts(aPresContext, aDesiredSize, aReflowInput);
// make sure the table overflow area does include the table rect.
nsRect tableRect(0, 0, aDesiredSize.Width(), aDesiredSize.Height()) ;
- if (!ShouldApplyOverflowClipping(this, aReflowState.mStyleDisplay)) {
+ if (!ShouldApplyOverflowClipping(this, aReflowInput.mStyleDisplay)) {
// collapsed border may leak out
LogicalMargin bcMargin = GetExcludedOuterBCBorder(wm);
tableRect.Inflate(bcMargin.GetPhysicalMargin(wm));
}
aDesiredSize.mOverflowAreas.UnionAllWith(tableRect);
if (HasAnyStateBits(NS_FRAME_FIRST_REFLOW) ||
nsSize(aDesiredSize.Width(), aDesiredSize.Height()) != mRect.Size()) {
nsIFrame::InvalidateFrame();
}
FinishAndStoreOverflow(&aDesiredSize);
- NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
+ NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
void
nsTableFrame::FixupPositionedTableParts(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState)
+ const ReflowInput& aReflowInput)
{
FrameTArray* positionedParts = Properties().Get(PositionedTablePartArray());
if (!positionedParts) {
return;
}
OverflowChangedTracker overflowTracker;
overflowTracker.SetSubtreeRoot(this);
for (size_t i = 0; i < positionedParts->Length(); ++i) {
nsIFrame* positionedPart = positionedParts->ElementAt(i);
// As we've already finished reflow, positionedParts's size and overflow
// areas have already been assigned, so we just pull them back out.
nsSize size(positionedPart->GetSize());
- ReflowOutput desiredSize(aReflowState.GetWritingMode());
+ ReflowOutput desiredSize(aReflowInput.GetWritingMode());
desiredSize.Width() = size.width;
desiredSize.Height() = size.height;
desiredSize.mOverflowAreas = positionedPart->GetOverflowAreasRelativeToSelf();
// Construct a dummy reflow state and reflow status.
// XXX(seth): Note that the dummy reflow state doesn't have a correct
// chain of parent reflow states. It also doesn't necessarily have a
// correct containing block.
WritingMode wm = positionedPart->GetWritingMode();
LogicalSize availSize(wm, size);
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
- ReflowInput reflowState(aPresContext, positionedPart,
- aReflowState.mRenderingContext, availSize,
+ ReflowInput reflowInput(aPresContext, positionedPart,
+ aReflowInput.mRenderingContext, availSize,
ReflowInput::DUMMY_PARENT_REFLOW_STATE);
nsReflowStatus reflowStatus = NS_FRAME_COMPLETE;
// Reflow absolutely-positioned descendants of the positioned part.
// FIXME: Unconditionally using NS_UNCONSTRAINEDSIZE for the bsize and
// ignoring any change to the reflow status aren't correct. We'll never
// paginate absolutely positioned frames.
nsFrame* positionedFrame = static_cast<nsFrame*>(positionedPart);
positionedFrame->FinishReflowWithAbsoluteFrames(PresContext(),
desiredSize,
- reflowState,
+ reflowInput,
reflowStatus,
true);
// FinishReflowWithAbsoluteFrames has updated overflow on
// |positionedPart|. We need to make sure that update propagates
// through the intermediate frames between it and this frame.
nsIFrame* positionedFrameParent = positionedPart->GetParent();
if (positionedFrameParent != this) {
@@ -2066,38 +2066,38 @@ nsTableFrame::ComputeCustomOverflow(nsOv
aOverflowAreas.UnionAllWith(bounds);
}
return nsContainerFrame::ComputeCustomOverflow(aOverflowAreas);
}
void
nsTableFrame::ReflowTable(ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nscoord aAvailBSize,
nsIFrame*& aLastChildReflowed,
nsReflowStatus& aStatus)
{
aLastChildReflowed = nullptr;
if (!GetPrevInFlow()) {
- mTableLayoutStrategy->ComputeColumnISizes(aReflowState);
+ mTableLayoutStrategy->ComputeColumnISizes(aReflowInput);
}
// Constrain our reflow isize to the computed table isize (of the 1st in flow).
// and our reflow bsize to our avail bsize minus border, padding, cellspacing
- WritingMode wm = aReflowState.GetWritingMode();
- aDesiredSize.ISize(wm) = aReflowState.ComputedISize() +
- aReflowState.ComputedLogicalBorderPadding().IStartEnd(wm);
- TableReflowInput reflowState(aReflowState,
+ WritingMode wm = aReflowInput.GetWritingMode();
+ aDesiredSize.ISize(wm) = aReflowInput.ComputedISize() +
+ aReflowInput.ComputedLogicalBorderPadding().IStartEnd(wm);
+ TableReflowInput reflowInput(aReflowInput,
LogicalSize(wm, aDesiredSize.ISize(wm),
aAvailBSize));
- ReflowChildren(reflowState, aStatus, aLastChildReflowed,
+ ReflowChildren(reflowInput, aStatus, aLastChildReflowed,
aDesiredSize.mOverflowAreas);
- ReflowColGroups(aReflowState.mRenderingContext);
+ ReflowColGroups(aReflowInput.mRenderingContext);
}
nsIFrame*
nsTableFrame::GetFirstBodyRowGroupFrame()
{
nsIFrame* headerFrame = nullptr;
nsIFrame* footerFrame = nullptr;
@@ -2715,90 +2715,90 @@ nsTableFrame::GetIncludedOuterBCBorder(c
LogicalMargin
nsTableFrame::GetExcludedOuterBCBorder(const WritingMode aWM) const
{
return GetOuterBCBorder(aWM) - GetIncludedOuterBCBorder(aWM);
}
static LogicalMargin
GetSeparateModelBorderPadding(const WritingMode aWM,
- const ReflowInput* aReflowState,
+ const ReflowInput* aReflowInput,
nsStyleContext* aStyleContext)
{
// XXXbz Either we _do_ have a reflow state and then we can use its
// mComputedBorderPadding or we don't and then we get the padding
// wrong!
const nsStyleBorder* border = aStyleContext->StyleBorder();
LogicalMargin borderPadding(aWM, border->GetComputedBorder());
- if (aReflowState) {
- borderPadding += aReflowState->ComputedLogicalPadding();
+ if (aReflowInput) {
+ borderPadding += aReflowInput->ComputedLogicalPadding();
}
return borderPadding;
}
LogicalMargin
nsTableFrame::GetChildAreaOffset(const WritingMode aWM,
- const ReflowInput* aReflowState) const
+ const ReflowInput* aReflowInput) const
{
return IsBorderCollapse() ? GetIncludedOuterBCBorder(aWM) :
- GetSeparateModelBorderPadding(aWM, aReflowState, mStyleContext);
+ GetSeparateModelBorderPadding(aWM, aReflowInput, mStyleContext);
}
void
-nsTableFrame::InitChildReflowState(ReflowInput& aReflowState)
+nsTableFrame::InitChildReflowInput(ReflowInput& aReflowInput)
{
nsMargin collapseBorder;
nsMargin padding(0,0,0,0);
nsMargin* pCollapseBorder = nullptr;
nsPresContext* presContext = PresContext();
if (IsBorderCollapse()) {
nsTableRowGroupFrame* rgFrame =
- static_cast<nsTableRowGroupFrame*>(aReflowState.mFrame);
+ static_cast<nsTableRowGroupFrame*>(aReflowInput.mFrame);
WritingMode wm = GetWritingMode();
LogicalMargin border = rgFrame->GetBCBorderWidth(wm);
collapseBorder = border.GetPhysicalMargin(wm);
pCollapseBorder = &collapseBorder;
}
- aReflowState.Init(presContext, nullptr, pCollapseBorder, &padding);
+ aReflowInput.Init(presContext, nullptr, pCollapseBorder, &padding);
NS_ASSERTION(!mBits.mResizedColumns ||
- !aReflowState.mParentReflowState->mFlags.mSpecialBSizeReflow,
+ !aReflowInput.mParentReflowInput->mFlags.mSpecialBSizeReflow,
"should not resize columns on special bsize reflow");
if (mBits.mResizedColumns) {
- aReflowState.SetIResize(true);
+ aReflowInput.SetIResize(true);
}
}
// Position and size aKidFrame and update our reflow state. The origin of
// aKidRect is relative to the upper-left origin of our frame
void
-nsTableFrame::PlaceChild(TableReflowInput& aReflowState,
+nsTableFrame::PlaceChild(TableReflowInput& aReflowInput,
nsIFrame* aKidFrame,
nsPoint aKidPosition,
ReflowOutput& aKidDesiredSize,
const nsRect& aOriginalKidRect,
const nsRect& aOriginalKidVisualOverflow)
{
- WritingMode wm = aReflowState.reflowState.GetWritingMode();
+ WritingMode wm = aReflowInput.reflowInput.GetWritingMode();
bool isFirstReflow =
aKidFrame->HasAnyStateBits(NS_FRAME_FIRST_REFLOW);
// Place and size the child
FinishReflowChild(aKidFrame, PresContext(), aKidDesiredSize, nullptr,
aKidPosition.x, aKidPosition.y, 0);
InvalidateTableFrame(aKidFrame, aOriginalKidRect, aOriginalKidVisualOverflow,
isFirstReflow);
// Adjust the running block-offset
- aReflowState.bCoord += aKidDesiredSize.BSize(wm);
+ aReflowInput.bCoord += aKidDesiredSize.BSize(wm);
// If our bsize is constrained, then update the available bsize
- if (NS_UNCONSTRAINEDSIZE != aReflowState.availSize.BSize(wm)) {
- aReflowState.availSize.BSize(wm) -= aKidDesiredSize.BSize(wm);
+ if (NS_UNCONSTRAINEDSIZE != aReflowInput.availSize.BSize(wm)) {
+ aReflowInput.availSize.BSize(wm) -= aKidDesiredSize.BSize(wm);
}
}
void
nsTableFrame::OrderRowGroups(RowGroupArray& aChildren,
nsTableRowGroupFrame** aHead,
nsTableRowGroupFrame** aFoot) const
{
@@ -2909,122 +2909,122 @@ nsTableFrame::GetTFoot() const
static bool
IsRepeatable(nscoord aFrameHeight, nscoord aPageHeight)
{
return aFrameHeight < (aPageHeight / 4);
}
nsresult
-nsTableFrame::SetupHeaderFooterChild(const TableReflowInput& aReflowState,
+nsTableFrame::SetupHeaderFooterChild(const TableReflowInput& aReflowInput,
nsTableRowGroupFrame* aFrame,
nscoord* aDesiredHeight)
{
nsPresContext* presContext = PresContext();
nscoord pageHeight = presContext->GetPageSize().height;
// Reflow the child with unconstrained height
WritingMode wm = aFrame->GetWritingMode();
- LogicalSize availSize = aReflowState.reflowState.AvailableSize(wm);
+ LogicalSize availSize = aReflowInput.reflowInput.AvailableSize(wm);
nsSize containerSize = availSize.GetPhysicalSize(wm);
// XXX check for containerSize.* == NS_UNCONSTRAINEDSIZE
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
- ReflowInput kidReflowState(presContext, aReflowState.reflowState,
+ ReflowInput kidReflowInput(presContext, aReflowInput.reflowInput,
aFrame, availSize, nullptr,
ReflowInput::CALLER_WILL_INIT);
- InitChildReflowState(kidReflowState);
- kidReflowState.mFlags.mIsTopOfPage = true;
- ReflowOutput desiredSize(aReflowState.reflowState);
+ InitChildReflowInput(kidReflowInput);
+ kidReflowInput.mFlags.mIsTopOfPage = true;
+ ReflowOutput desiredSize(aReflowInput.reflowInput);
desiredSize.ClearSize();
nsReflowStatus status;
- ReflowChild(aFrame, presContext, desiredSize, kidReflowState,
- wm, LogicalPoint(wm, aReflowState.iCoord, aReflowState.bCoord),
+ ReflowChild(aFrame, presContext, desiredSize, kidReflowInput,
+ wm, LogicalPoint(wm, aReflowInput.iCoord, aReflowInput.bCoord),
containerSize, 0, status);
// The child will be reflowed again "for real" so no need to place it now
aFrame->SetRepeatable(IsRepeatable(desiredSize.Height(), pageHeight));
*aDesiredHeight = desiredSize.Height();
return NS_OK;
}
void
-nsTableFrame::PlaceRepeatedFooter(TableReflowInput& aReflowState,
+nsTableFrame::PlaceRepeatedFooter(TableReflowInput& aReflowInput,
nsTableRowGroupFrame *aTfoot,
nscoord aFooterHeight)
{
nsPresContext* presContext = PresContext();
WritingMode wm = aTfoot->GetWritingMode();
- LogicalSize kidAvailSize = aReflowState.availSize;
+ LogicalSize kidAvailSize = aReflowInput.availSize;
nsSize containerSize = kidAvailSize.GetPhysicalSize(wm);
// XXX check for containerSize.* == NS_UNCONSTRAINEDSIZE
kidAvailSize.BSize(wm) = aFooterHeight;
- ReflowInput footerReflowState(presContext,
- aReflowState.reflowState,
+ ReflowInput footerReflowInput(presContext,
+ aReflowInput.reflowInput,
aTfoot, kidAvailSize,
nullptr,
ReflowInput::CALLER_WILL_INIT);
- InitChildReflowState(footerReflowState);
- aReflowState.bCoord += GetRowSpacing(GetRowCount());
+ InitChildReflowInput(footerReflowInput);
+ aReflowInput.bCoord += GetRowSpacing(GetRowCount());
nsRect origTfootRect = aTfoot->GetRect();
nsRect origTfootVisualOverflow = aTfoot->GetVisualOverflowRect();
nsReflowStatus footerStatus;
- ReflowOutput desiredSize(aReflowState.reflowState);
+ ReflowOutput desiredSize(aReflowInput.reflowInput);
desiredSize.ClearSize();
- LogicalPoint kidPosition(wm, aReflowState.iCoord, aReflowState.bCoord);
- ReflowChild(aTfoot, presContext, desiredSize, footerReflowState,
+ LogicalPoint kidPosition(wm, aReflowInput.iCoord, aReflowInput.bCoord);
+ ReflowChild(aTfoot, presContext, desiredSize, footerReflowInput,
wm, kidPosition, containerSize, 0, footerStatus);
- footerReflowState.ApplyRelativePositioning(&kidPosition, containerSize);
-
- PlaceChild(aReflowState, aTfoot,
+ footerReflowInput.ApplyRelativePositioning(&kidPosition, containerSize);
+
+ PlaceChild(aReflowInput, aTfoot,
// We subtract desiredSize.PhysicalSize() from containerSize here
// to account for the fact that in RTL modes, the origin is
// on the right-hand side so we're not simply converting a
// point, we're also swapping the child's origin side.
kidPosition.GetPhysicalPoint(wm, containerSize -
desiredSize.PhysicalSize()),
desiredSize, origTfootRect, origTfootVisualOverflow);
}
-// Reflow the children based on the avail size and reason in aReflowState
+// Reflow the children based on the avail size and reason in aReflowInput
// update aReflowMetrics a aStatus
void
-nsTableFrame::ReflowChildren(TableReflowInput& aReflowState,
+nsTableFrame::ReflowChildren(TableReflowInput& aReflowInput,
nsReflowStatus& aStatus,
nsIFrame*& aLastChildReflowed,
nsOverflowAreas& aOverflowAreas)
{
aStatus = NS_FRAME_COMPLETE;
aLastChildReflowed = nullptr;
nsIFrame* prevKidFrame = nullptr;
- WritingMode wm = aReflowState.reflowState.GetWritingMode();
+ WritingMode wm = aReflowInput.reflowInput.GetWritingMode();
NS_WARN_IF_FALSE(wm.IsVertical() || NS_UNCONSTRAINEDSIZE !=
- aReflowState.reflowState.ComputedWidth(),
+ aReflowInput.reflowInput.ComputedWidth(),
"shouldn't have unconstrained width in horizontal mode");
nsSize containerSize =
- aReflowState.reflowState.ComputedSizeAsContainerIfConstrained();
+ aReflowInput.reflowInput.ComputedSizeAsContainerIfConstrained();
nsPresContext* presContext = PresContext();
// XXXldb Should we be checking constrained height instead?
// tables are not able to pull back children from its next inflow, so even
// under paginated contexts tables are should not paginate if they are inside
// column set
bool isPaginated = presContext->IsPaginated() &&
- NS_UNCONSTRAINEDSIZE != aReflowState.availSize.BSize(wm) &&
- aReflowState.reflowState.mFlags.mTableIsSplittable;
+ NS_UNCONSTRAINEDSIZE != aReflowInput.availSize.BSize(wm) &&
+ aReflowInput.reflowInput.mFlags.mTableIsSplittable;
aOverflowAreas.Clear();
- bool reflowAllKids = aReflowState.reflowState.ShouldReflowAllKids() ||
+ bool reflowAllKids = aReflowInput.reflowInput.ShouldReflowAllKids() ||
mBits.mResizedColumns ||
IsGeometryDirty();
RowGroupArray rowGroups;
nsTableRowGroupFrame *thead, *tfoot;
OrderRowGroups(rowGroups, &thead, &tfoot);
bool pageBreak = false;
nscoord footerHeight = 0;
@@ -3035,53 +3035,53 @@ nsTableFrame::ReflowChildren(TableReflow
// when they are created in nsCSSFrameConstructor::CreateContinuingTableFrame.
// We handle the repeatability of footers again here because we need to
// determine the footer's height anyway. We could perhaps optimize by
// using the footer's prev-in-flow's height instead of reflowing it again,
// but there's no real need.
if (isPaginated) {
if (thead && !GetPrevInFlow()) {
nscoord desiredHeight;
- nsresult rv = SetupHeaderFooterChild(aReflowState, thead, &desiredHeight);
+ nsresult rv = SetupHeaderFooterChild(aReflowInput, thead, &desiredHeight);
if (NS_FAILED(rv))
return;
}
if (tfoot) {
- nsresult rv = SetupHeaderFooterChild(aReflowState, tfoot, &footerHeight);
+ nsresult rv = SetupHeaderFooterChild(aReflowInput, tfoot, &footerHeight);
if (NS_FAILED(rv))
return;
}
}
// if the child is a tbody in paginated mode reduce the height by a repeated footer
bool allowRepeatedFooter = false;
for (size_t childX = 0; childX < rowGroups.Length(); childX++) {
nsIFrame* kidFrame = rowGroups[childX];
nsTableRowGroupFrame* rowGroupFrame = rowGroups[childX];
nscoord cellSpacingB = GetRowSpacing(rowGroupFrame->GetStartRowIndex()+
rowGroupFrame->GetRowCount());
// Get the frame state bits
// See if we should only reflow the dirty child frames
if (reflowAllKids ||
NS_SUBTREE_DIRTY(kidFrame) ||
- (aReflowState.reflowState.mFlags.mSpecialBSizeReflow &&
+ (aReflowInput.reflowInput.mFlags.mSpecialBSizeReflow &&
(isPaginated || kidFrame->HasAnyStateBits(
NS_FRAME_CONTAINS_RELATIVE_BSIZE)))) {
if (pageBreak) {
if (allowRepeatedFooter) {
- PlaceRepeatedFooter(aReflowState, tfoot, footerHeight);
+ PlaceRepeatedFooter(aReflowInput, tfoot, footerHeight);
}
else if (tfoot && tfoot->IsRepeatable()) {
tfoot->SetRepeatable(false);
}
PushChildren(rowGroups, childX);
aStatus = NS_FRAME_NOT_COMPLETE;
break;
}
- LogicalSize kidAvailSize(aReflowState.availSize);
+ LogicalSize kidAvailSize(aReflowInput.availSize);
allowRepeatedFooter = false;
if (isPaginated && (NS_UNCONSTRAINEDSIZE != kidAvailSize.BSize(wm))) {
nsTableRowGroupFrame* kidRG =
static_cast<nsTableRowGroupFrame*>(kidFrame);
if (kidRG != thead && kidRG != tfoot && tfoot && tfoot->IsRepeatable()) {
// the child is a tbody and there is a repeatable footer
NS_ASSERTION(tfoot == rowGroups[rowGroups.Length() - 1], "Missing footer!");
if (footerHeight + cellSpacingB < kidAvailSize.BSize(wm)) {
@@ -3089,138 +3089,138 @@ nsTableFrame::ReflowChildren(TableReflow
kidAvailSize.BSize(wm) -= footerHeight + cellSpacingB;
}
}
}
nsRect oldKidRect = kidFrame->GetRect();
nsRect oldKidVisualOverflow = kidFrame->GetVisualOverflowRect();
- ReflowOutput desiredSize(aReflowState.reflowState);
+ ReflowOutput desiredSize(aReflowInput.reflowInput);
desiredSize.ClearSize();
// Reflow the child into the available space
- ReflowInput kidReflowState(presContext, aReflowState.reflowState,
+ ReflowInput kidReflowInput(presContext, aReflowInput.reflowInput,
kidFrame,
kidAvailSize,
nullptr,
ReflowInput::CALLER_WILL_INIT);
- InitChildReflowState(kidReflowState);
+ InitChildReflowInput(kidReflowInput);
// If this isn't the first row group, and the previous row group has a
// nonzero YMost, then we can't be at the top of the page.
// We ignore a repeated head row group in this check to avoid causing
// infinite loops in some circumstances - see bug 344883.
if (childX > ((thead && IsRepeatedFrame(thead)) ? 1u : 0u) &&
(rowGroups[childX - 1]->GetNormalRect().YMost() > 0)) {
- kidReflowState.mFlags.mIsTopOfPage = false;
+ kidReflowInput.mFlags.mIsTopOfPage = false;
}
- aReflowState.bCoord += cellSpacingB;
- if (NS_UNCONSTRAINEDSIZE != aReflowState.availSize.BSize(wm)) {
- aReflowState.availSize.BSize(wm) -= cellSpacingB;
+ aReflowInput.bCoord += cellSpacingB;
+ if (NS_UNCONSTRAINEDSIZE != aReflowInput.availSize.BSize(wm)) {
+ aReflowInput.availSize.BSize(wm) -= cellSpacingB;
}
// record the presence of a next in flow, it might get destroyed so we
// need to reorder the row group array
bool reorder = false;
if (kidFrame->GetNextInFlow())
reorder = true;
- LogicalPoint kidPosition(wm, aReflowState.iCoord, aReflowState.bCoord);
- ReflowChild(kidFrame, presContext, desiredSize, kidReflowState,
+ LogicalPoint kidPosition(wm, aReflowInput.iCoord, aReflowInput.bCoord);
+ ReflowChild(kidFrame, presContext, desiredSize, kidReflowInput,
wm, kidPosition, containerSize, 0, aStatus);
- kidReflowState.ApplyRelativePositioning(&kidPosition, containerSize);
+ kidReflowInput.ApplyRelativePositioning(&kidPosition, containerSize);
if (reorder) {
// reorder row groups the reflow may have changed the nextinflows
OrderRowGroups(rowGroups, &thead, &tfoot);
childX = rowGroups.IndexOf(kidFrame);
if (childX == RowGroupArray::NoIndex) {
// XXXbz can this happen?
childX = rowGroups.Length();
}
}
if (isPaginated && !NS_FRAME_IS_FULLY_COMPLETE(aStatus) &&
- ShouldAvoidBreakInside(aReflowState.reflowState)) {
+ ShouldAvoidBreakInside(aReflowInput.reflowInput)) {
aStatus = NS_INLINE_LINE_BREAK_BEFORE();
break;
}
// see if the rowgroup did not fit on this page might be pushed on
// the next page
if (isPaginated &&
(NS_INLINE_IS_BREAK_BEFORE(aStatus) ||
(NS_FRAME_IS_COMPLETE(aStatus) &&
- (NS_UNCONSTRAINEDSIZE != kidReflowState.AvailableHeight()) &&
- kidReflowState.AvailableHeight() < desiredSize.Height()))) {
- if (ShouldAvoidBreakInside(aReflowState.reflowState)) {
+ (NS_UNCONSTRAINEDSIZE != kidReflowInput.AvailableHeight()) &&
+ kidReflowInput.AvailableHeight() < desiredSize.Height()))) {
+ if (ShouldAvoidBreakInside(aReflowInput.reflowInput)) {
aStatus = NS_INLINE_LINE_BREAK_BEFORE();
break;
}
// if we are on top of the page place with dataloss
- if (kidReflowState.mFlags.mIsTopOfPage) {
+ if (kidReflowInput.mFlags.mIsTopOfPage) {
if (childX+1 < rowGroups.Length()) {
nsIFrame* nextRowGroupFrame = rowGroups[childX + 1];
if (nextRowGroupFrame) {
- PlaceChild(aReflowState, kidFrame,
+ PlaceChild(aReflowInput, kidFrame,
kidPosition.GetPhysicalPoint(wm,
containerSize - desiredSize.PhysicalSize()),
desiredSize, oldKidRect, oldKidVisualOverflow);
if (allowRepeatedFooter) {
- PlaceRepeatedFooter(aReflowState, tfoot, footerHeight);
+ PlaceRepeatedFooter(aReflowInput, tfoot, footerHeight);
}
else if (tfoot && tfoot->IsRepeatable()) {
tfoot->SetRepeatable(false);
}
aStatus = NS_FRAME_NOT_COMPLETE;
PushChildren(rowGroups, childX + 1);
aLastChildReflowed = kidFrame;
break;
}
}
}
else { // we are not on top, push this rowgroup onto the next page
if (prevKidFrame) { // we had a rowgroup before so push this
if (allowRepeatedFooter) {
- PlaceRepeatedFooter(aReflowState, tfoot, footerHeight);
+ PlaceRepeatedFooter(aReflowInput, tfoot, footerHeight);
}
else if (tfoot && tfoot->IsRepeatable()) {
tfoot->SetRepeatable(false);
}
aStatus = NS_FRAME_NOT_COMPLETE;
PushChildren(rowGroups, childX);
aLastChildReflowed = prevKidFrame;
break;
}
else { // we can't push so lets make clear how much space we need
- PlaceChild(aReflowState, kidFrame,
+ PlaceChild(aReflowInput, kidFrame,
kidPosition.GetPhysicalPoint(wm,
containerSize - desiredSize.PhysicalSize()),
desiredSize, oldKidRect, oldKidVisualOverflow);
aLastChildReflowed = kidFrame;
if (allowRepeatedFooter) {
- PlaceRepeatedFooter(aReflowState, tfoot, footerHeight);
+ PlaceRepeatedFooter(aReflowInput, tfoot, footerHeight);
aLastChildReflowed = tfoot;
}
break;
}
}
}
aLastChildReflowed = kidFrame;
pageBreak = false;
// see if there is a page break after this row group or before the next one
if (NS_FRAME_IS_COMPLETE(aStatus) && isPaginated &&
- (NS_UNCONSTRAINEDSIZE != kidReflowState.AvailableHeight())) {
+ (NS_UNCONSTRAINEDSIZE != kidReflowInput.AvailableHeight())) {
nsIFrame* nextKid =
(childX + 1 < rowGroups.Length()) ? rowGroups[childX + 1] : nullptr;
pageBreak = PageBreakAfter(kidFrame, nextKid);
}
// Place the child
- PlaceChild(aReflowState, kidFrame,
+ PlaceChild(aReflowInput, kidFrame,
kidPosition.GetPhysicalPoint(wm, containerSize -
desiredSize.PhysicalSize()),
desiredSize, oldKidRect, oldKidVisualOverflow);
// Remember where we just were in case we end up pushing children
prevKidFrame = kidFrame;
// Special handling for incomplete children
@@ -3244,47 +3244,47 @@ nsTableFrame::ReflowChildren(TableReflow
"OrderRowGroups must not put our NIF in 'rowGroups'");
rowGroups.InsertElementAt(childX + 1,
static_cast<nsTableRowGroupFrame*>(kidNextInFlow));
}
// We've used up all of our available space so push the remaining
// children.
if (allowRepeatedFooter) {
- PlaceRepeatedFooter(aReflowState, tfoot, footerHeight);
+ PlaceRepeatedFooter(aReflowInput, tfoot, footerHeight);
}
else if (tfoot && tfoot->IsRepeatable()) {
tfoot->SetRepeatable(false);
}
nsIFrame* nextSibling = kidFrame->GetNextSibling();
if (nextSibling) {
PushChildren(rowGroups, childX + 1);
}
break;
}
}
else { // it isn't being reflowed
- aReflowState.bCoord += cellSpacingB;
+ aReflowInput.bCoord += cellSpacingB;
LogicalRect kidRect(wm, kidFrame->GetNormalRect(), containerSize);
- if (kidRect.BStart(wm) != aReflowState.bCoord) {
+ if (kidRect.BStart(wm) != aReflowInput.bCoord) {
// invalidate the old position
kidFrame->InvalidateFrameSubtree();
// move to the new position
- kidFrame->MovePositionBy(wm, LogicalPoint(wm, 0, aReflowState.bCoord -
+ kidFrame->MovePositionBy(wm, LogicalPoint(wm, 0, aReflowInput.bCoord -
kidRect.BStart(wm)));
RePositionViews(kidFrame);
// invalidate the new position
kidFrame->InvalidateFrameSubtree();
}
- aReflowState.bCoord += kidRect.BSize(wm);
+ aReflowInput.bCoord += kidRect.BSize(wm);
// If our bsize is constrained then update the available bsize.
- if (NS_UNCONSTRAINEDSIZE != aReflowState.availSize.BSize(wm)) {
- aReflowState.availSize.BSize(wm) -= cellSpacingB + kidRect.BSize(wm);
+ if (NS_UNCONSTRAINEDSIZE != aReflowInput.availSize.BSize(wm)) {
+ aReflowInput.availSize.BSize(wm) -= cellSpacingB + kidRect.BSize(wm);
}
}
}
// We've now propagated the column resizes and geometry changes to all
// the children.
mBits.mResizedColumns = false;
ClearGeometryDirty();
@@ -3295,47 +3295,47 @@ nsTableFrame::ReflowColGroups(nsRenderin
{
if (!GetPrevInFlow() && !HaveReflowedColGroups()) {
ReflowOutput kidMet(GetWritingMode());
nsPresContext *presContext = PresContext();
for (nsIFrame* kidFrame : mColGroups) {
if (NS_SUBTREE_DIRTY(kidFrame)) {
// The column groups don't care about dimensions or reflow states.
ReflowInput
- kidReflowState(presContext, kidFrame, aRenderingContext,
+ kidReflowInput(presContext, kidFrame, aRenderingContext,
LogicalSize(kidFrame->GetWritingMode()));
nsReflowStatus cgStatus;
- ReflowChild(kidFrame, presContext, kidMet, kidReflowState, 0, 0, 0,
+ ReflowChild(kidFrame, presContext, kidMet, kidReflowInput, 0, 0, 0,
cgStatus);
FinishReflowChild(kidFrame, presContext, kidMet, nullptr, 0, 0, 0);
}
}
SetHaveReflowedColGroups(true);
}
}
void
-nsTableFrame::CalcDesiredBSize(const ReflowInput& aReflowState,
+nsTableFrame::CalcDesiredBSize(const ReflowInput& aReflowInput,
ReflowOutput& aDesiredSize)
{
- WritingMode wm = aReflowState.GetWritingMode();
+ WritingMode wm = aReflowInput.GetWritingMode();
nsTableCellMap* cellMap = GetCellMap();
if (!cellMap) {
NS_ERROR("never ever call me until the cell map is built!");
aDesiredSize.BSize(wm) = 0;
return;
}
- LogicalMargin borderPadding = GetChildAreaOffset(wm, &aReflowState);
+ LogicalMargin borderPadding = GetChildAreaOffset(wm, &aReflowInput);
// get the natural bsize based on the last child's (row group) rect
RowGroupArray rowGroups;
OrderRowGroups(rowGroups);
if (rowGroups.IsEmpty()) {
// tables can be used as rectangular items without content
- nscoord tableSpecifiedBSize = CalcBorderBoxBSize(aReflowState);
+ nscoord tableSpecifiedBSize = CalcBorderBoxBSize(aReflowInput);
if ((NS_UNCONSTRAINEDSIZE != tableSpecifiedBSize) &&
(tableSpecifiedBSize > 0) &&
eCompatibility_NavQuirks != PresContext()->CompatibilityMode()) {
// empty tables should not have a size in quirks mode
aDesiredSize.BSize(wm) = tableSpecifiedBSize;
} else {
aDesiredSize.BSize(wm) = 0;
}
@@ -3350,23 +3350,23 @@ nsTableFrame::CalcDesiredBSize(const Ref
desiredBSize += rowGroups[rgIdx]->BSize(wm) +
GetRowSpacing(rowGroups[rgIdx]->GetRowCount() +
rowGroups[rgIdx]->GetStartRowIndex());
}
}
// see if a specified table bsize requires dividing additional space to rows
if (!GetPrevInFlow()) {
- nscoord tableSpecifiedBSize = CalcBorderBoxBSize(aReflowState);
+ nscoord tableSpecifiedBSize = CalcBorderBoxBSize(aReflowInput);
if ((tableSpecifiedBSize > 0) &&
(tableSpecifiedBSize != NS_UNCONSTRAINEDSIZE) &&
(tableSpecifiedBSize > desiredBSize)) {
// proportionately distribute the excess bsize to unconstrained rows in each
// unconstrained row group.
- DistributeBSizeToRows(aReflowState, tableSpecifiedBSize - desiredBSize);
+ DistributeBSizeToRows(aReflowInput, tableSpecifiedBSize - desiredBSize);
// this might have changed the overflow area incorporate the childframe overflow area.
for (nsIFrame* kidFrame : mFrames) {
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, kidFrame);
}
desiredBSize = tableSpecifiedBSize;
}
}
aDesiredSize.BSize(wm) = desiredBSize;
@@ -3398,33 +3398,33 @@ void ResizeCells(nsTableFrame& aTableFra
rgFrame->FinishAndStoreOverflow(&groupDesiredSize);
tableDesiredSize.mOverflowAreas.UnionWith(groupDesiredSize.mOverflowAreas +
rgFrame->GetPosition());
}
aTableFrame.FinishAndStoreOverflow(&tableDesiredSize);
}
void
-nsTableFrame::DistributeBSizeToRows(const ReflowInput& aReflowState,
+nsTableFrame::DistributeBSizeToRows(const ReflowInput& aReflowInput,
nscoord aAmount)
{
- WritingMode wm = aReflowState.GetWritingMode();
- LogicalMargin borderPadding = GetChildAreaOffset(wm, &aReflowState);
+ WritingMode wm = aReflowInput.GetWritingMode();
+ LogicalMargin borderPadding = GetChildAreaOffset(wm, &aReflowInput);
nsSize containerSize =
- aReflowState.ComputedSizeAsContainerIfConstrained();
+ aReflowInput.ComputedSizeAsContainerIfConstrained();
RowGroupArray rowGroups;
OrderRowGroups(rowGroups);
nscoord amountUsed = 0;
// distribute space to each pct bsize row whose row group doesn't have a computed
// bsize, and base the pct on the table bsize. If the row group had a computed
// bsize, then this was already done in nsTableRowGroupFrame::CalculateRowBSizes
- nscoord pctBasis = aReflowState.ComputedBSize() - GetRowSpacing(-1, GetRowCount());
+ nscoord pctBasis = aReflowInput.ComputedBSize() - GetRowSpacing(-1, GetRowCount());
nscoord bOriginRG = borderPadding.BStart(wm) + GetRowSpacing(0);
nscoord bEndRG = bOriginRG;
uint32_t rgIdx;
for (rgIdx = 0; rgIdx < rowGroups.Length(); rgIdx++) {
nsTableRowGroupFrame* rgFrame = rowGroups[rgIdx];
nscoord amountUsedByRG = 0;
nscoord bOriginRow = 0;
LogicalRect rgNormalRect(wm, rgFrame->GetNormalRect(), containerSize);
--- a/layout/tables/nsTableFrame.h
+++ b/layout/tables/nsTableFrame.h
@@ -156,43 +156,43 @@ public:
* @see nsIFrame::Init
*/
virtual void Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;
static float GetTwipsToPixels(nsPresContext* aPresContext);
- // Return true if aParentReflowState.frame or any of its ancestors within
+ // Return true if aParentReflowInput.frame or any of its ancestors within
// the containing table have non-auto bsize. (e.g. pct or fixed bsize)
- static bool AncestorsHaveStyleBSize(const ReflowInput& aParentReflowState);
+ static bool AncestorsHaveStyleBSize(const ReflowInput& aParentReflowInput);
// See if a special bsize reflow will occur due to having a pct bsize when
// the pct bsize basis may not yet be valid.
- static void CheckRequestSpecialBSizeReflow(const ReflowInput& aReflowState);
+ static void CheckRequestSpecialBSizeReflow(const ReflowInput& aReflowInput);
// Notify the frame and its ancestors (up to the containing table) that a special
// height reflow will occur.
- static void RequestSpecialBSizeReflow(const ReflowInput& aReflowState);
+ static void RequestSpecialBSizeReflow(const ReflowInput& aReflowInput);
static void RePositionViews(nsIFrame* aFrame);
static bool PageBreakAfter(nsIFrame* aSourceFrame,
nsIFrame* aNextFrame);
// Register a positioned table part with its nsTableFrame. These objects will
// be visited by FixupPositionedTableParts after reflow is complete. (See that
// function for more explanation.) Should be called during frame construction.
static void RegisterPositionedTablePart(nsIFrame* aFrame);
// Unregister a positioned table part with its nsTableFrame.
static void UnregisterPositionedTablePart(nsIFrame* aFrame,
nsIFrame* aDestructRoot);
- nsPoint GetFirstSectionOrigin(const ReflowInput& aReflowState) const;
+ nsPoint GetFirstSectionOrigin(const ReflowInput& aReflowInput) const;
/*
* Notification that aAttribute has changed for content inside a table (cell, row, etc)
*/
void AttributeChangedFor(nsIFrame* aFrame,
nsIContent* aContent,
nsIAtom* aAttribute);
/** @see nsIFrame::DestroyFrom */
@@ -212,17 +212,17 @@ public:
nsIFrame* aOldFrame) override;
virtual nsMargin GetUsedBorder() const override;
virtual nsMargin GetUsedPadding() const override;
virtual nsMargin GetUsedMargin() const override;
// Get the offset from the border box to the area where the row groups fit
LogicalMargin GetChildAreaOffset(const WritingMode aWM,
- const ReflowInput* aReflowState) const;
+ const ReflowInput* aReflowInput) const;
/** helper method to find the table parent of any table frame object */
static nsTableFrame* GetTableFrame(nsIFrame* aSourceFrame);
/* Like GetTableFrame, but will set *aDidPassThrough to false if we don't
* pass through aMustPassThrough on the way to the table.
*/
static nsTableFrame* GetTableFramePassingThrough(nsIFrame* aMustPassThrough,
@@ -365,21 +365,21 @@ public:
* do pass 2
* use column widths to Reflow cells
* </pre>
*
* @see nsIFrame::Reflow
*/
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
void ReflowTable(ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nscoord aAvailBSize,
nsIFrame*& aLastChildReflowed,
nsReflowStatus& aStatus);
nsFrameList& GetColGroups();
virtual nsStyleContext*
GetParentStyleContext(nsIFrame** aProviderFrame) const override;
@@ -609,34 +609,34 @@ protected:
/** protected constructor.
* @see NewFrame
*/
explicit nsTableFrame(nsStyleContext* aContext);
/** destructor, responsible for mColumnLayoutData */
virtual ~nsTableFrame();
- void InitChildReflowState(ReflowInput& aReflowState);
+ void InitChildReflowInput(ReflowInput& aReflowInput);
- virtual LogicalSides GetLogicalSkipSides(const ReflowInput* aReflowState = nullptr) const override;
+ virtual LogicalSides GetLogicalSkipSides(const ReflowInput* aReflowInput = nullptr) const override;
public:
bool IsRowInserted() const;
void SetRowInserted(bool aValue);
protected:
// A helper function to reflow a header or footer with unconstrained height
// to see if it should be made repeatable and also to determine its desired
// height.
- nsresult SetupHeaderFooterChild(const TableReflowInput& aReflowState,
+ nsresult SetupHeaderFooterChild(const TableReflowInput& aReflowInput,
nsTableRowGroupFrame* aFrame,
nscoord* aDesiredHeight);
- void ReflowChildren(TableReflowInput& aReflowState,
+ void ReflowChildren(TableReflowInput& aReflowInput,
nsReflowStatus& aStatus,
nsIFrame*& aLastChildReflowed,
nsOverflowAreas& aOverflowAreas);
// This calls the col group and column reflow methods, which do two things:
// (1) set all the dimensions to 0
// (2) notify the table about colgroups or columns with hidden visibility
void ReflowColGroups(nsRenderingContext* aRenderingContext);
@@ -660,17 +660,17 @@ protected:
/** FixupPositionedTableParts is called at the end of table reflow to reflow
* the absolutely positioned descendants of positioned table parts. This is
* necessary because the dimensions of table parts may change after they've
* been reflowed (e.g. in AdjustForCollapsingRowsCols).
*/
void FixupPositionedTableParts(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState);
+ const ReflowInput& aReflowInput);
// Clears the list of positioned table parts.
void ClearAllPositionedTableParts();
nsITableLayoutStrategy* LayoutStrategy() const {
return static_cast<nsTableFrame*>(FirstInFlow())->
mTableLayoutStrategy;
}
@@ -685,38 +685,38 @@ private:
void ProcessRowInserted(nscoord aNewHeight);
// WIDTH AND HEIGHT CALCULATION
public:
// calculate the computed block-size of aFrame including its border and
// padding given its reflow state.
- nscoord CalcBorderBoxBSize(const ReflowInput& aReflowState);
+ nscoord CalcBorderBoxBSize(const ReflowInput& aReflowInput);
protected:
// update the desired block-size of this table taking into account the current
// reflow state, the table attributes and the content driven rowgroup bsizes
// this function can change the overflow area
- void CalcDesiredBSize(const ReflowInput& aReflowState,
+ void CalcDesiredBSize(const ReflowInput& aReflowInput,
ReflowOutput& aDesiredSize);
// The following is a helper for CalcDesiredBSize
- void DistributeBSizeToRows(const ReflowInput& aReflowState,
+ void DistributeBSizeToRows(const ReflowInput& aReflowInput,
nscoord aAmount);
- void PlaceChild(TableReflowInput& aReflowState,
+ void PlaceChild(TableReflowInput& aReflowInput,
nsIFrame* aKidFrame,
nsPoint aKidPosition,
ReflowOutput& aKidDesiredSize,
const nsRect& aOriginalKidRect,
const nsRect& aOriginalKidVisualOverflow);
- void PlaceRepeatedFooter(TableReflowInput& aReflowState,
+ void PlaceRepeatedFooter(TableReflowInput& aReflowInput,
nsTableRowGroupFrame *aTfoot,
nscoord aFooterHeight);
nsIFrame* GetFirstBodyRowGroupFrame();
public:
typedef AutoTArray<nsTableRowGroupFrame*, 8> RowGroupArray;
/**
* Push all our child frames from the aRowGroups array, in order, starting
--- a/layout/tables/nsTableRowFrame.cpp
+++ b/layout/tables/nsTableRowFrame.cpp
@@ -26,21 +26,21 @@
using namespace mozilla;
namespace mozilla {
struct TableCellReflowInput : public ReflowInput
{
TableCellReflowInput(nsPresContext* aPresContext,
- const ReflowInput& aParentReflowState,
+ const ReflowInput& aParentReflowInput,
nsIFrame* aFrame,
const LogicalSize& aAvailableSpace,
uint32_t aFlags = 0)
- : ReflowInput(aPresContext, aParentReflowState, aFrame,
+ : ReflowInput(aPresContext, aParentReflowInput, aFrame,
aAvailableSpace, nullptr, aFlags)
{
}
void FixUp(const LogicalSize& aAvailSpace);
};
} // namespace mozilla
@@ -63,34 +63,34 @@ void TableCellReflowInput::FixUp(const L
nscoord computedBSize = aAvailSpace.BSize(mWritingMode) -
ComputedLogicalBorderPadding().BStartEnd(mWritingMode);
computedBSize = std::max(0, computedBSize);
SetComputedBSize(computedBSize);
}
}
void
-nsTableRowFrame::InitChildReflowState(nsPresContext& aPresContext,
+nsTableRowFrame::InitChildReflowInput(nsPresContext& aPresContext,
const LogicalSize& aAvailSize,
bool aBorderCollapse,
- TableCellReflowInput& aReflowState)
+ TableCellReflowInput& aReflowInput)
{
nsMargin collapseBorder;
nsMargin* pCollapseBorder = nullptr;
if (aBorderCollapse) {
// we only reflow cells, so don't need to check frame type
- nsBCTableCellFrame* bcCellFrame = (nsBCTableCellFrame*)aReflowState.mFrame;
+ nsBCTableCellFrame* bcCellFrame = (nsBCTableCellFrame*)aReflowInput.mFrame;
if (bcCellFrame) {
WritingMode wm = GetWritingMode();
collapseBorder = bcCellFrame->GetBorderWidth(wm).GetPhysicalMargin(wm);
pCollapseBorder = &collapseBorder;
}
}
- aReflowState.Init(&aPresContext, nullptr, pCollapseBorder);
- aReflowState.FixUp(aAvailSize);
+ aReflowInput.Init(&aPresContext, nullptr, pCollapseBorder);
+ aReflowInput.FixUp(aAvailSize);
}
void
nsTableRowFrame::SetFixedBSize(nscoord aValue)
{
nscoord bsize = std::max(0, aValue);
if (HasFixedBSize()) {
if (bsize > mStyleFixedBSize) {
@@ -517,40 +517,40 @@ nsTableRowFrame::UpdateBSize(nscoord
if (GetInitialBSize() < mMaxCellAscent + mMaxCellDescent) {
SetContentBSize(mMaxCellAscent + mMaxCellDescent);
}
}
}
}
nscoord
-nsTableRowFrame::CalcBSize(const ReflowInput& aReflowState)
+nsTableRowFrame::CalcBSize(const ReflowInput& aReflowInput)
{
nsTableFrame* tableFrame = GetTableFrame();
- nscoord computedBSize = (NS_UNCONSTRAINEDSIZE == aReflowState.ComputedBSize())
- ? 0 : aReflowState.ComputedBSize();
+ nscoord computedBSize = (NS_UNCONSTRAINEDSIZE == aReflowInput.ComputedBSize())
+ ? 0 : aReflowInput.ComputedBSize();
ResetBSize(computedBSize);
- WritingMode wm = aReflowState.GetWritingMode();
+ WritingMode wm = aReflowInput.GetWritingMode();
const nsStylePosition* position = StylePosition();
const nsStyleCoord& bsizeStyleCoord = position->BSize(wm);
if (bsizeStyleCoord.ConvertsToLength()) {
SetFixedBSize(nsRuleNode::ComputeCoordPercentCalc(bsizeStyleCoord, 0));
}
else if (eStyleUnit_Percent == bsizeStyleCoord.GetUnit()) {
SetPctBSize(bsizeStyleCoord.GetPercentValue());
}
// calc() with percentages is treated like 'auto' on table rows.
for (nsIFrame* kidFrame : mFrames) {
nsTableCellFrame *cellFrame = do_QueryFrame(kidFrame);
if (cellFrame) {
MOZ_ASSERT(cellFrame->GetWritingMode() == wm);
LogicalSize desSize = cellFrame->GetDesiredSize();
- if ((NS_UNCONSTRAINEDSIZE == aReflowState.AvailableBSize()) && !GetPrevInFlow()) {
+ if ((NS_UNCONSTRAINEDSIZE == aReflowInput.AvailableBSize()) && !GetPrevInFlow()) {
CalculateCellActualBSize(cellFrame, desSize.BSize(wm), wm);
}
// bsize may have changed, adjust descent to absorb any excess difference
nscoord ascent;
if (!kidFrame->PrincipalChildList().FirstChild()->PrincipalChildList().FirstChild())
ascent = desSize.BSize(wm);
else
ascent = cellFrame->GetCellBaseline();
@@ -618,17 +618,17 @@ nsTableRowFrame::BuildDisplayList(nsDisp
item = new (aBuilder) nsDisplayTableRowBackground(aBuilder, this);
aLists.BorderBackground()->AppendNewToTop(item);
}
}
nsTableFrame::DisplayGenericTablePart(aBuilder, this, aDirtyRect, aLists, item);
}
nsIFrame::LogicalSides
-nsTableRowFrame::GetLogicalSkipSides(const ReflowInput* aReflowState) const
+nsTableRowFrame::GetLogicalSkipSides(const ReflowInput* aReflowInput) const
{
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
NS_STYLE_BOX_DECORATION_BREAK_CLONE)) {
return LogicalSides();
}
LogicalSides skip;
if (nullptr != GetPrevInFlow()) {
@@ -781,17 +781,17 @@ nscoord CalcBSizeFromUnpaginatedBSize(ns
}
}
return std::max(bsize, 0);
}
void
nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsTableFrame& aTableFrame,
nsReflowStatus& aStatus)
{
aStatus = NS_FRAME_COMPLETE;
// XXXldb Should we be checking constrained bsize instead?
const bool isPaginated = aPresContext->IsPaginated();
const bool borderCollapse = aTableFrame.IsBorderCollapse();
@@ -801,56 +801,56 @@ nsTableRowFrame::ReflowChildren(nsPresCo
// remember the col index of the previous cell to handle rowspans into this row
int32_t prevColIndex = -1;
nscoord iCoord = 0; // running total of children inline-coord offset
// This computes the max of all cell bsizes
nscoord cellMaxBSize = 0;
// Reflow each of our existing cell frames
- WritingMode wm = aReflowState.GetWritingMode();
+ WritingMode wm = aReflowInput.GetWritingMode();
nsSize containerSize =
- aReflowState.ComputedSizeAsContainerIfConstrained();
+ aReflowInput.ComputedSizeAsContainerIfConstrained();
for (nsIFrame* kidFrame : mFrames) {
nsTableCellFrame *cellFrame = do_QueryFrame(kidFrame);
if (!cellFrame) {
// XXXldb nsCSSFrameConstructor needs to enforce this!
NS_NOTREACHED("yikes, a non-row child");
// it's an unknown frame type, give it a generic reflow and ignore the results
TableCellReflowInput
- kidReflowState(aPresContext, aReflowState, kidFrame,
+ kidReflowInput(aPresContext, aReflowInput, kidFrame,
LogicalSize(kidFrame->GetWritingMode(), 0, 0),
ReflowInput::CALLER_WILL_INIT);
- InitChildReflowState(*aPresContext, LogicalSize(wm), false, kidReflowState);
- ReflowOutput desiredSize(aReflowState);
+ InitChildReflowInput(*aPresContext, LogicalSize(wm), false, kidReflowInput);
+ ReflowOutput desiredSize(aReflowInput);
nsReflowStatus status;
- ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState, 0, 0, 0, status);
+ ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowInput, 0, 0, 0, status);
kidFrame->DidReflow(aPresContext, nullptr, nsDidReflowStatus::FINISHED);
continue;
}
// See if we should only reflow the dirty child frames
bool doReflowChild = true;
- if (!aReflowState.ShouldReflowAllKids() &&
+ if (!aReflowInput.ShouldReflowAllKids() &&
!aTableFrame.IsGeometryDirty() &&
!NS_SUBTREE_DIRTY(kidFrame)) {
- if (!aReflowState.mFlags.mSpecialBSizeReflow)
+ if (!aReflowInput.mFlags.mSpecialBSizeReflow)
doReflowChild = false;
}
- else if ((NS_UNCONSTRAINEDSIZE != aReflowState.AvailableBSize())) {
+ else if ((NS_UNCONSTRAINEDSIZE != aReflowInput.AvailableBSize())) {
// We don't reflow a rowspan >1 cell here with a constrained bsize.
// That happens in nsTableRowGroupFrame::SplitSpanningCells.
if (aTableFrame.GetEffectiveRowSpan(*cellFrame) > 1) {
doReflowChild = false;
}
}
- if (aReflowState.mFlags.mSpecialBSizeReflow) {
+ if (aReflowInput.mFlags.mSpecialBSizeReflow) {
if (!isPaginated &&
!cellFrame->HasAnyStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE)) {
continue;
}
}
int32_t cellColIndex;
cellFrame->GetColIndex(cellColIndex);
@@ -881,49 +881,49 @@ nsTableRowFrame::ReflowChildren(nsPresCo
LogicalPoint kidPosition(wm, iCoord, 0);
bool firstReflow = kidFrame->HasAnyStateBits(NS_FRAME_FIRST_REFLOW);
if (doReflowChild) {
// Calculate the available isize for the table cell using the known
// column isizes
nscoord availCellISize = CalcAvailISize(aTableFrame, *cellFrame);
- Maybe<TableCellReflowInput> kidReflowState;
- ReflowOutput desiredSize(aReflowState);
+ Maybe<TableCellReflowInput> kidReflowInput;
+ ReflowOutput desiredSize(aReflowInput);
// If the avail isize is not the same as last time we reflowed the cell or
// the cell wants to be bigger than what was available last time or
// it is a style change reflow or we are printing, then we must reflow the
// cell. Otherwise we can skip the reflow.
// XXXldb Why is this condition distinct from doReflowChild above?
- WritingMode wm = aReflowState.GetWritingMode();
+ WritingMode wm = aReflowInput.GetWritingMode();
NS_ASSERTION(cellFrame->GetWritingMode() == wm,
"expected consistent writing-mode within table");
LogicalSize cellDesiredSize = cellFrame->GetDesiredSize();
if ((availCellISize != cellFrame->GetPriorAvailISize()) ||
(cellDesiredSize.ISize(wm) > cellFrame->GetPriorAvailISize()) ||
HasAnyStateBits(NS_FRAME_IS_DIRTY) ||
isPaginated ||
NS_SUBTREE_DIRTY(cellFrame) ||
// See if it needs a special reflow, or if it had one that we need to undo.
cellFrame->HasAnyStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE) ||
HasPctBSize()) {
// Reflow the cell to fit the available isize, bsize
// XXX The old IR_ChildIsDirty code used availCellISize here.
- LogicalSize kidAvailSize(wm, availCellISize, aReflowState.AvailableBSize());
+ LogicalSize kidAvailSize(wm, availCellISize, aReflowInput.AvailableBSize());
// Reflow the child
- kidReflowState.emplace(aPresContext, aReflowState, kidFrame,
+ kidReflowInput.emplace(aPresContext, aReflowInput, kidFrame,
kidAvailSize,
ReflowInput::CALLER_WILL_INIT);
- InitChildReflowState(*aPresContext, kidAvailSize, borderCollapse,
- *kidReflowState);
+ InitChildReflowInput(*aPresContext, kidAvailSize, borderCollapse,
+ *kidReflowInput);
nsReflowStatus status;
- ReflowChild(kidFrame, aPresContext, desiredSize, *kidReflowState,
+ ReflowChild(kidFrame, aPresContext, desiredSize, *kidReflowInput,
wm, kidPosition, containerSize, 0, status);
// allow the table to determine if/how the table needs to be rebalanced
// If any of the cells are not complete, then we're not complete
if (NS_FRAME_IS_NOT_COMPLETE(status)) {
aStatus = NS_FRAME_NOT_COMPLETE;
}
} else {
@@ -939,17 +939,17 @@ nsTableRowFrame::ReflowChildren(nsPresCo
if (!aTableFrame.IsFloating()) {
// Because we may have moved the frame we need to make sure any views are
// positioned properly. We have to do this, because any one of our parent
// frames could have moved and we have no way of knowing...
nsTableFrame::RePositionViews(kidFrame);
}
}
- if (NS_UNCONSTRAINEDSIZE == aReflowState.AvailableBSize()) {
+ if (NS_UNCONSTRAINEDSIZE == aReflowInput.AvailableBSize()) {
if (!GetPrevInFlow()) {
// Calculate the cell's actual bsize given its pass2 bsize. This
// function takes into account the specified bsize (in the style)
CalculateCellActualBSize(cellFrame, desiredSize.BSize(wm), wm);
}
// bsize may have changed, adjust descent to absorb any excess difference
nscoord ascent;
if (!kidFrame->PrincipalChildList().FirstChild()->PrincipalChildList().FirstChild()) {
@@ -965,19 +965,19 @@ nsTableRowFrame::ReflowChildren(nsPresCo
if (1 == rowSpan) {
SetContentBSize(cellMaxBSize);
}
}
// Place the child
desiredSize.ISize(wm) = availCellISize;
- if (kidReflowState) {
+ if (kidReflowInput) {
// We reflowed. Apply relative positioning in the normal way.
- kidReflowState->ApplyRelativePositioning(&kidPosition, containerSize);
+ kidReflowInput->ApplyRelativePositioning(&kidPosition, containerSize);
} else if (kidFrame->IsRelativelyPositioned()) {
// We didn't reflow. Do the positioning part of what
// MovePositionBy does internally. (This codepath should really
// be merged into the else below if we can.)
nsMargin* computedOffsetProp =
kidFrame->Properties().Get(nsIFrame::ComputedOffsetProperty());
// Bug 975644: a position:sticky kid can end up with a null
// property value here.
@@ -1017,22 +1017,22 @@ nsTableRowFrame::ReflowChildren(nsPresCo
}
}
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, kidFrame);
iCoord += aTableFrame.GetColSpacing(cellColIndex);
}
// Just set our isize to what was available.
// The table will calculate the isize and not use our value.
- aDesiredSize.ISize(wm) = aReflowState.AvailableISize();
+ aDesiredSize.ISize(wm) = aReflowInput.AvailableISize();
- if (aReflowState.mFlags.mSpecialBSizeReflow) {
+ if (aReflowInput.mFlags.mSpecialBSizeReflow) {
aDesiredSize.BSize(wm) = BSize(wm);
- } else if (NS_UNCONSTRAINEDSIZE == aReflowState.AvailableBSize()) {
- aDesiredSize.BSize(wm) = CalcBSize(aReflowState);
+ } else if (NS_UNCONSTRAINEDSIZE == aReflowInput.AvailableBSize()) {
+ aDesiredSize.BSize(wm) = CalcBSize(aReflowInput);
if (GetPrevInFlow()) {
nscoord bsize = CalcBSizeFromUnpaginatedBSize(*this, wm);
aDesiredSize.BSize(wm) = std::max(aDesiredSize.BSize(wm), bsize);
} else {
if (isPaginated && HasStyleBSize()) {
// set the unpaginated bsize so next in flows can try to honor it
SetHasUnpaginatedBSize(true);
SetUnpaginatedBSize(aPresContext, aDesiredSize.BSize(wm));
@@ -1041,18 +1041,18 @@ nsTableRowFrame::ReflowChildren(nsPresCo
aDesiredSize.BSize(wm) = std::max(aDesiredSize.BSize(wm),
GetUnpaginatedBSize());
}
}
} else { // constrained bsize, paginated
// Compute the bsize we should have from style (subtracting the
// bsize from our prev-in-flows from the style bsize)
nscoord styleBSize = CalcBSizeFromUnpaginatedBSize(*this, wm);
- if (styleBSize > aReflowState.AvailableBSize()) {
- styleBSize = aReflowState.AvailableBSize();
+ if (styleBSize > aReflowInput.AvailableBSize()) {
+ styleBSize = aReflowInput.AvailableBSize();
NS_FRAME_SET_INCOMPLETE(aStatus);
}
aDesiredSize.BSize(wm) = std::max(cellMaxBSize, styleBSize);
}
if (wm.IsVerticalRL()) {
// Any children whose width was not the same as our final
// aDesiredSize.BSize will have been misplaced earlier at the
@@ -1076,98 +1076,98 @@ nsTableRowFrame::ReflowChildren(nsPresCo
}
/** Layout the entire row.
* This method stacks cells in the inline dir according to HTML 4.0 rules.
*/
void
nsTableRowFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsTableRowFrame");
- DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
+ DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
- WritingMode wm = aReflowState.GetWritingMode();
+ WritingMode wm = aReflowInput.GetWritingMode();
nsTableFrame* tableFrame = GetTableFrame();
const nsStyleVisibility* rowVis = StyleVisibility();
bool collapseRow = (NS_STYLE_VISIBILITY_COLLAPSE == rowVis->mVisible);
if (collapseRow) {
tableFrame->SetNeedToCollapse(true);
}
// see if a special bsize reflow needs to occur due to having a pct bsize
- nsTableFrame::CheckRequestSpecialBSizeReflow(aReflowState);
+ nsTableFrame::CheckRequestSpecialBSizeReflow(aReflowInput);
// See if we have a cell with specified/pct bsize
InitHasCellWithStyleBSize(tableFrame);
- ReflowChildren(aPresContext, aDesiredSize, aReflowState, *tableFrame, aStatus);
+ ReflowChildren(aPresContext, aDesiredSize, aReflowInput, *tableFrame, aStatus);
if (aPresContext->IsPaginated() && !NS_FRAME_IS_FULLY_COMPLETE(aStatus) &&
- ShouldAvoidBreakInside(aReflowState)) {
+ ShouldAvoidBreakInside(aReflowInput)) {
aStatus = NS_INLINE_LINE_BREAK_BEFORE();
}
// Just set our isize to what was available.
// The table will calculate the isize and not use our value.
- aDesiredSize.ISize(wm) = aReflowState.AvailableISize();
+ aDesiredSize.ISize(wm) = aReflowInput.AvailableISize();
// If our parent is in initial reflow, it'll handle invalidating our
// entire overflow rect.
if (!GetParent()->HasAnyStateBits(NS_FRAME_FIRST_REFLOW) &&
nsSize(aDesiredSize.Width(), aDesiredSize.Height()) != mRect.Size()) {
InvalidateFrame();
}
// Any absolutely-positioned children will get reflowed in
// nsFrame::FixupPositionedTableParts in another pass, so propagate our
// dirtiness to them before our parent clears our dirty bits.
PushDirtyBitToAbsoluteFrames();
- NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
+ NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
/**
* This function is called by the row group frame's SplitRowGroup() code when
* pushing a row frame that has cell frames that span into it. The cell frame
* should be reflowed with the specified height
*/
nscoord
nsTableRowFrame::ReflowCellFrame(nsPresContext* aPresContext,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
bool aIsTopOfPage,
nsTableCellFrame* aCellFrame,
nscoord aAvailableBSize,
nsReflowStatus& aStatus)
{
- WritingMode wm = aReflowState.GetWritingMode();
+ WritingMode wm = aReflowInput.GetWritingMode();
// Reflow the cell frame with the specified height. Use the existing width
nsSize containerSize = aCellFrame->GetSize();
LogicalRect cellRect = aCellFrame->GetLogicalRect(wm, containerSize);
nsRect cellVisualOverflow = aCellFrame->GetVisualOverflowRect();
LogicalSize cellSize = cellRect.Size(wm);
LogicalSize availSize(wm, cellRect.ISize(wm), aAvailableBSize);
bool borderCollapse = GetTableFrame()->IsBorderCollapse();
NS_ASSERTION(aCellFrame->GetWritingMode() == wm,
"expected consistent writing-mode within table");
TableCellReflowInput
- cellReflowState(aPresContext, aReflowState, aCellFrame, availSize,
+ cellReflowInput(aPresContext, aReflowInput, aCellFrame, availSize,
ReflowInput::CALLER_WILL_INIT);
- InitChildReflowState(*aPresContext, availSize, borderCollapse, cellReflowState);
- cellReflowState.mFlags.mIsTopOfPage = aIsTopOfPage;
+ InitChildReflowInput(*aPresContext, availSize, borderCollapse, cellReflowInput);
+ cellReflowInput.mFlags.mIsTopOfPage = aIsTopOfPage;
- ReflowOutput desiredSize(aReflowState);
+ ReflowOutput desiredSize(aReflowInput);
- ReflowChild(aCellFrame, aPresContext, desiredSize, cellReflowState,
+ ReflowChild(aCellFrame, aPresContext, desiredSize, cellReflowInput,
0, 0, NS_FRAME_NO_MOVE_FRAME, aStatus);
bool fullyComplete = NS_FRAME_IS_COMPLETE(aStatus) && !NS_FRAME_IS_TRUNCATED(aStatus);
if (fullyComplete) {
desiredSize.BSize(wm) = aAvailableBSize;
}
aCellFrame->SetSize(wm, LogicalSize(wm, cellSize.ISize(wm),
desiredSize.BSize(wm)));
--- a/layout/tables/nsTableRowFrame.h
+++ b/layout/tables/nsTableRowFrame.h
@@ -95,17 +95,17 @@ public:
* height of cells with rowspan=1.
*
* @see nsIFrame::Reflow
* @see nsTableFrame::BalanceColumnWidths
* @see nsTableFrame::ShrinkWrapChildren
*/
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
void DidResize();
/**
* Get the "type" of the frame
*
* @see nsGkAtoms::tableRowFrame
@@ -124,17 +124,17 @@ public:
nscoord aDescent,
nsTableFrame* aTableFrame = nullptr,
nsTableCellFrame* aCellFrame = nullptr);
void ResetBSize(nscoord aRowStyleBSize);
// calculate the bsize, considering content bsize of the
// cells and the style bsize of the row and cells, excluding pct bsizes
- nscoord CalcBSize(const ReflowInput& aReflowState);
+ nscoord CalcBSize(const ReflowInput& aReflowInput);
// Support for cells with 'vertical-align: baseline'.
/**
* returns the max-ascent amongst all the cells that have
* 'vertical-align: baseline', *including* cells with rowspans.
* returns 0 if we don't have any cell with 'vertical-align: baseline'
*/
@@ -147,17 +147,17 @@ public:
/** returns the ordinal position of this row in its table */
virtual int32_t GetRowIndex() const;
/** set this row's starting row index */
void SetRowIndex (int aRowIndex);
/** used by row group frame code */
nscoord ReflowCellFrame(nsPresContext* aPresContext,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
bool aIsTopOfPage,
nsTableCellFrame* aCellFrame,
nscoord aAvailableBSize,
nsReflowStatus& aStatus);
/**
* Collapse the row if required, apply col and colgroup visibility: collapse
* info to the cells in the row.
* @return the amount to shift bstart-wards all following rows
@@ -257,35 +257,35 @@ public:
protected:
/** protected constructor.
* @see NewFrame
*/
explicit nsTableRowFrame(nsStyleContext *aContext);
- void InitChildReflowState(nsPresContext& aPresContext,
+ void InitChildReflowInput(nsPresContext& aPresContext,
const mozilla::LogicalSize& aAvailSize,
bool aBorderCollapse,
- TableCellReflowInput& aReflowState);
+ TableCellReflowInput& aReflowInput);
- virtual LogicalSides GetLogicalSkipSides(const ReflowInput* aReflowState = nullptr) const override;
+ virtual LogicalSides GetLogicalSkipSides(const ReflowInput* aReflowInput = nullptr) const override;
// row-specific methods
nscoord ComputeCellXOffset(const ReflowInput& aState,
nsIFrame* aKidFrame,
const nsMargin& aKidMargin) const;
/**
* Called for incremental/dirty and resize reflows. If aDirtyOnly is true then
* only reflow dirty cells.
*/
void ReflowChildren(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsTableFrame& aTableFrame,
nsReflowStatus& aStatus);
private:
struct RowBits {
unsigned mRowIndex:29;
unsigned mHasFixedBSize:1; // set if the dominating style bsize on the row or any cell is pixel based
unsigned mHasPctBSize:1; // set if the dominating style bsize on the row or any cell is pct based
--- a/layout/tables/nsTableRowGroupFrame.cpp
+++ b/layout/tables/nsTableRowGroupFrame.cpp
@@ -22,33 +22,33 @@
#include <algorithm>
using namespace mozilla;
using namespace mozilla::layout;
namespace mozilla {
struct TableRowGroupReflowInput {
- const ReflowInput& reflowState; // Our reflow state
+ const ReflowInput& reflowInput; // Our reflow state
nsTableFrame* tableFrame;
// The available size (computed from the parent)
mozilla::LogicalSize availSize;
// Running block-offset
nscoord bCoord;
- TableRowGroupReflowInput(const ReflowInput& aReflowState,
+ TableRowGroupReflowInput(const ReflowInput& aReflowInput,
nsTableFrame* aTableFrame)
- : reflowState(aReflowState)
+ : reflowInput(aReflowInput)
, tableFrame(aTableFrame)
- , availSize(aReflowState.GetWritingMode(),
- aReflowState.AvailableISize(),
- aReflowState.AvailableBSize())
+ , availSize(aReflowInput.GetWritingMode(),
+ aReflowInput.AvailableISize(),
+ aReflowInput.AvailableBSize())
, bCoord(0)
{
}
~TableRowGroupReflowInput() {}
};
} // namespace mozilla
@@ -260,17 +260,17 @@ nsTableRowGroupFrame::BuildDisplayList(n
aLists.BorderBackground()->AppendNewToTop(item);
}
}
nsTableFrame::DisplayGenericTablePart(aBuilder, this, aDirtyRect,
aLists, item, DisplayRows);
}
nsIFrame::LogicalSides
-nsTableRowGroupFrame::GetLogicalSkipSides(const ReflowInput* aReflowState) const
+nsTableRowGroupFrame::GetLogicalSkipSides(const ReflowInput* aReflowInput) const
{
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
NS_STYLE_BOX_DECORATION_BREAK_CLONE)) {
return LogicalSides();
}
LogicalSides skip;
if (nullptr != GetPrevInFlow()) {
@@ -280,17 +280,17 @@ nsTableRowGroupFrame::GetLogicalSkipSide
skip |= eLogicalSideBitsBEnd;
}
return skip;
}
// Position and size aKidFrame and update our reflow state.
void
nsTableRowGroupFrame::PlaceChild(nsPresContext* aPresContext,
- TableRowGroupReflowInput& aReflowState,
+ TableRowGroupReflowInput& aReflowInput,
nsIFrame* aKidFrame,
WritingMode aWM,
const LogicalPoint& aKidPosition,
const nsSize& aContainerSize,
ReflowOutput& aDesiredSize,
const nsRect& aOriginalKidRect,
const nsRect& aOriginalKidVisualOverflow)
{
@@ -299,42 +299,42 @@ nsTableRowGroupFrame::PlaceChild(nsPresC
// Place and size the child
FinishReflowChild(aKidFrame, aPresContext, aDesiredSize, nullptr,
aWM, aKidPosition, aContainerSize, 0);
nsTableFrame::InvalidateTableFrame(aKidFrame, aOriginalKidRect,
aOriginalKidVisualOverflow, isFirstReflow);
// Adjust the running block-offset
- aReflowState.bCoord += aDesiredSize.BSize(aWM);
+ aReflowInput.bCoord += aDesiredSize.BSize(aWM);
// If our block-size is constrained then update the available bsize
- if (NS_UNCONSTRAINEDSIZE != aReflowState.availSize.BSize(aWM)) {
- aReflowState.availSize.BSize(aWM) -= aDesiredSize.BSize(aWM);
+ if (NS_UNCONSTRAINEDSIZE != aReflowInput.availSize.BSize(aWM)) {
+ aReflowInput.availSize.BSize(aWM) -= aDesiredSize.BSize(aWM);
}
}
void
-nsTableRowGroupFrame::InitChildReflowState(nsPresContext& aPresContext,
+nsTableRowGroupFrame::InitChildReflowInput(nsPresContext& aPresContext,
bool aBorderCollapse,
- ReflowInput& aReflowState)
+ ReflowInput& aReflowInput)
{
nsMargin collapseBorder;
nsMargin padding(0,0,0,0);
nsMargin* pCollapseBorder = nullptr;
if (aBorderCollapse) {
- nsTableRowFrame *rowFrame = do_QueryFrame(aReflowState.mFrame);
+ nsTableRowFrame *rowFrame = do_QueryFrame(aReflowInput.mFrame);
if (rowFrame) {
WritingMode wm = GetWritingMode();
LogicalMargin border = rowFrame->GetBCBorderWidth(wm);
collapseBorder = border.GetPhysicalMargin(wm);
pCollapseBorder = &collapseBorder;
}
}
- aReflowState.Init(&aPresContext, nullptr, pCollapseBorder, &padding);
+ aReflowInput.Init(&aPresContext, nullptr, pCollapseBorder, &padding);
}
static void
CacheRowBSizesForPrinting(nsPresContext* aPresContext,
nsTableRowFrame* aFirstRow,
WritingMode aWM)
{
for (nsTableRowFrame* row = aFirstRow; row; row = row->GetNextRow()) {
@@ -343,116 +343,116 @@ CacheRowBSizesForPrinting(nsPresContext*
row->SetUnpaginatedBSize(aPresContext, row->BSize(aWM));
}
}
}
void
nsTableRowGroupFrame::ReflowChildren(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- TableRowGroupReflowInput& aReflowState,
+ TableRowGroupReflowInput& aReflowInput,
nsReflowStatus& aStatus,
bool* aPageBreakBeforeEnd)
{
if (aPageBreakBeforeEnd) {
*aPageBreakBeforeEnd = false;
}
- WritingMode wm = aReflowState.reflowState.GetWritingMode();
+ WritingMode wm = aReflowInput.reflowInput.GetWritingMode();
nsTableFrame* tableFrame = GetTableFrame();
const bool borderCollapse = tableFrame->IsBorderCollapse();
// XXXldb Should we really be checking IsPaginated(),
// or should we *only* check available block-size?
// (Think about multi-column layout!)
bool isPaginated = aPresContext->IsPaginated() &&
- NS_UNCONSTRAINEDSIZE != aReflowState.availSize.BSize(wm);
+ NS_UNCONSTRAINEDSIZE != aReflowInput.availSize.BSize(wm);
bool haveRow = false;
- bool reflowAllKids = aReflowState.reflowState.ShouldReflowAllKids() ||
+ bool reflowAllKids = aReflowInput.reflowInput.ShouldReflowAllKids() ||
tableFrame->IsGeometryDirty();
// in vertical-rl mode, we always need the row bsizes in order to
// get the necessary containerSize for placing our kids
bool needToCalcRowBSizes = reflowAllKids || wm.IsVerticalRL();
nsSize containerSize =
- aReflowState.reflowState.ComputedSizeAsContainerIfConstrained();
+ aReflowInput.reflowInput.ComputedSizeAsContainerIfConstrained();
nsIFrame *prevKidFrame = nullptr;
for (nsIFrame* kidFrame = mFrames.FirstChild(); kidFrame;
prevKidFrame = kidFrame, kidFrame = kidFrame->GetNextSibling()) {
nsTableRowFrame *rowFrame = do_QueryFrame(kidFrame);
if (!rowFrame) {
// XXXldb nsCSSFrameConstructor needs to enforce this!
NS_NOTREACHED("yikes, a non-row child");
continue;
}
nscoord cellSpacingB = tableFrame->GetRowSpacing(rowFrame->GetRowIndex());
haveRow = true;
// Reflow the row frame
if (reflowAllKids ||
NS_SUBTREE_DIRTY(kidFrame) ||
- (aReflowState.reflowState.mFlags.mSpecialBSizeReflow &&
+ (aReflowInput.reflowInput.mFlags.mSpecialBSizeReflow &&
(isPaginated ||
kidFrame->HasAnyStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE)))) {
LogicalRect oldKidRect = kidFrame->GetLogicalRect(wm, containerSize);
nsRect oldKidVisualOverflow = kidFrame->GetVisualOverflowRect();
// XXXldb We used to only pass aDesiredSize.mFlags through for the
// incremental reflow codepath.
- ReflowOutput desiredSize(aReflowState.reflowState,
+ ReflowOutput desiredSize(aReflowInput.reflowInput,
aDesiredSize.mFlags);
desiredSize.ClearSize();
// Reflow the child into the available space, giving it as much bsize as
// it wants. We'll deal with splitting later after we've computed the row
// bsizes, taking into account cells with row spans...
- LogicalSize kidAvailSize = aReflowState.availSize;
+ LogicalSize kidAvailSize = aReflowInput.availSize;
kidAvailSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
- ReflowInput kidReflowState(aPresContext, aReflowState.reflowState,
+ ReflowInput kidReflowInput(aPresContext, aReflowInput.reflowInput,
kidFrame, kidAvailSize,
nullptr,
ReflowInput::CALLER_WILL_INIT);
- InitChildReflowState(*aPresContext, borderCollapse, kidReflowState);
+ InitChildReflowInput(*aPresContext, borderCollapse, kidReflowInput);
// This can indicate that columns were resized.
- if (aReflowState.reflowState.IsIResize()) {
- kidReflowState.SetIResize(true);
+ if (aReflowInput.reflowInput.IsIResize()) {
+ kidReflowInput.SetIResize(true);
}
NS_ASSERTION(kidFrame == mFrames.FirstChild() || prevKidFrame,
"If we're not on the first frame, we should have a "
"previous sibling...");
// If prev row has nonzero YMost, then we can't be at the top of the page
if (prevKidFrame && prevKidFrame->GetNormalRect().YMost() > 0) {
- kidReflowState.mFlags.mIsTopOfPage = false;
+ kidReflowInput.mFlags.mIsTopOfPage = false;
}
- LogicalPoint kidPosition(wm, 0, aReflowState.bCoord);
- ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState,
+ LogicalPoint kidPosition(wm, 0, aReflowInput.bCoord);
+ ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowInput,
wm, kidPosition, containerSize, 0, aStatus);
- kidReflowState.ApplyRelativePositioning(&kidPosition, containerSize);
+ kidReflowInput.ApplyRelativePositioning(&kidPosition, containerSize);
// Place the child
- PlaceChild(aPresContext, aReflowState, kidFrame,
+ PlaceChild(aPresContext, aReflowInput, kidFrame,
wm, kidPosition, containerSize,
desiredSize, oldKidRect.GetPhysicalRect(wm, containerSize),
oldKidVisualOverflow);
- aReflowState.bCoord += cellSpacingB;
+ aReflowInput.bCoord += cellSpacingB;
if (!reflowAllKids) {
- if (IsSimpleRowFrame(aReflowState.tableFrame, rowFrame)) {
+ if (IsSimpleRowFrame(aReflowInput.tableFrame, rowFrame)) {
// Inform the row of its new bsize.
rowFrame->DidResize();
// the overflow area may have changed inflate the overflow area
const nsStylePosition *stylePos = StylePosition();
nsStyleUnit unit = stylePos->BSize(wm).GetUnit();
- if (aReflowState.tableFrame->IsAutoBSize(wm) &&
+ if (aReflowInput.tableFrame->IsAutoBSize(wm) &&
unit != eStyleUnit_Coord) {
// Because other cells in the row may need to be aligned
// differently, repaint the entire row
InvalidateFrame();
} else if (oldKidRect.BSize(wm) != desiredSize.BSize(wm)) {
needToCalcRowBSizes = true;
}
} else {
@@ -462,46 +462,46 @@ nsTableRowGroupFrame::ReflowChildren(nsP
if (isPaginated && aPageBreakBeforeEnd && !*aPageBreakBeforeEnd) {
nsTableRowFrame* nextRow = rowFrame->GetNextRow();
if (nextRow) {
*aPageBreakBeforeEnd = nsTableFrame::PageBreakAfter(kidFrame, nextRow);
}
}
} else {
- SlideChild(aReflowState, kidFrame);
+ SlideChild(aReflowInput, kidFrame);
// Adjust the running b-offset so we know where the next row should be placed
nscoord bSize = kidFrame->BSize(wm) + cellSpacingB;
- aReflowState.bCoord += bSize;
+ aReflowInput.bCoord += bSize;
- if (NS_UNCONSTRAINEDSIZE != aReflowState.availSize.BSize(wm)) {
- aReflowState.availSize.BSize(wm) -= bSize;
+ if (NS_UNCONSTRAINEDSIZE != aReflowInput.availSize.BSize(wm)) {
+ aReflowInput.availSize.BSize(wm) -= bSize;
}
}
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, kidFrame);
}
if (haveRow) {
- aReflowState.bCoord -= tableFrame->GetRowSpacing(GetStartRowIndex() +
+ aReflowInput.bCoord -= tableFrame->GetRowSpacing(GetStartRowIndex() +
GetRowCount());
}
// Return our desired rect
- aDesiredSize.ISize(wm) = aReflowState.reflowState.AvailableISize();
- aDesiredSize.BSize(wm) = aReflowState.bCoord;
+ aDesiredSize.ISize(wm) = aReflowInput.reflowInput.AvailableISize();
+ aDesiredSize.BSize(wm) = aReflowInput.bCoord;
- if (aReflowState.reflowState.mFlags.mSpecialBSizeReflow) {
+ if (aReflowInput.reflowInput.mFlags.mSpecialBSizeReflow) {
DidResizeRows(aDesiredSize);
if (isPaginated) {
CacheRowBSizesForPrinting(aPresContext, GetFirstRow(), wm);
}
}
else if (needToCalcRowBSizes) {
- CalculateRowBSizes(aPresContext, aDesiredSize, aReflowState.reflowState);
+ CalculateRowBSizes(aPresContext, aDesiredSize, aReflowInput.reflowInput);
if (!reflowAllKids) {
InvalidateFrame();
}
}
}
nsTableRowFrame*
nsTableRowGroupFrame::GetFirstRow()
@@ -557,34 +557,34 @@ nsTableRowGroupFrame::DidResizeRows(Refl
// This calculates the bsize of all the rows and takes into account
// style bsize on the row group, style bsizes on rows and cells, style bsizes on rowspans.
// Actual row bsizes will be adjusted later if the table has a style bsize.
// Even if rows don't change bsize, this method must be called to set the bsizes of each
// cell in the row to the bsize of its row.
void
nsTableRowGroupFrame::CalculateRowBSizes(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState)
+ const ReflowInput& aReflowInput)
{
nsTableFrame* tableFrame = GetTableFrame();
const bool isPaginated = aPresContext->IsPaginated();
int32_t numEffCols = tableFrame->GetEffectiveColCount();
int32_t startRowIndex = GetStartRowIndex();
// find the row corresponding to the row index we just found
nsTableRowFrame* startRowFrame = GetFirstRow();
if (!startRowFrame) {
return;
}
// The current row group block-size is the block-origin of the 1st row
// we are about to calculate a block-size for.
- WritingMode wm = aReflowState.GetWritingMode();
+ WritingMode wm = aReflowInput.GetWritingMode();
nsSize containerSize; // actual value is unimportant as we're initially
// computing sizes, not physical positions
nscoord startRowGroupBSize =
startRowFrame->GetLogicalNormalPosition(wm, containerSize).B(wm);
int32_t numRows = GetRowCount() - (startRowFrame->GetRowIndex() - GetStartRowIndex());
// Collect the current bsize of each row.
if (numRows <= 0)
@@ -596,17 +596,17 @@ nsTableRowGroupFrame::CalculateRowBSizes
}
bool hasRowSpanningCell = false;
nscoord bSizeOfRows = 0;
nscoord bSizeOfUnStyledRows = 0;
// Get the bsize of each row without considering rowspans. This will be the max of
// the largest desired bsize of each cell, the largest style bsize of each cell,
// the style bsize of the row.
- nscoord pctBSizeBasis = GetBSizeBasis(aReflowState);
+ nscoord pctBSizeBasis = GetBSizeBasis(aReflowInput);
int32_t rowIndex; // the index in rowInfo, not among the rows in the row group
nsTableRowFrame* rowFrame;
for (rowFrame = startRowFrame, rowIndex = 0; rowFrame; rowFrame = rowFrame->GetNextRow(), rowIndex++) {
nscoord nonPctBSize = rowFrame->GetContentBSize();
if (isPaginated) {
nonPctBSize = std::max(nonPctBSize, rowFrame->BSize(wm));
}
if (!rowFrame->GetPrevInFlow()) {
@@ -771,19 +771,19 @@ nsTableRowGroupFrame::CalculateRowBSizes
extra -= rowExtra;
}
}
bool styleBSizeAllocation = false;
nscoord rowGroupBSize = startRowGroupBSize + bSizeOfRows +
tableFrame->GetRowSpacing(0, numRows-1);
// if we have a style bsize, allocate the extra bsize to unconstrained rows
- if ((aReflowState.ComputedBSize() > rowGroupBSize) &&
- (NS_UNCONSTRAINEDSIZE != aReflowState.ComputedBSize())) {
- nscoord extraComputedBSize = aReflowState.ComputedBSize() - rowGroupBSize;
+ if ((aReflowInput.ComputedBSize() > rowGroupBSize) &&
+ (NS_UNCONSTRAINEDSIZE != aReflowInput.ComputedBSize())) {
+ nscoord extraComputedBSize = aReflowInput.ComputedBSize() - rowGroupBSize;
nscoord extraUsed = 0;
bool haveUnStyledRows = (bSizeOfUnStyledRows > 0);
nscoord divisor = (haveUnStyledRows)
? bSizeOfUnStyledRows : bSizeOfRows;
if (divisor > 0) {
styleBSizeAllocation = true;
for (rowIndex = 0; rowIndex < numRows; rowIndex++) {
if (!haveUnStyledRows || !rowInfo[rowIndex].hasStyleBSize) {
@@ -800,17 +800,17 @@ nsTableRowGroupFrame::CalculateRowBSizes
extraUsed += extraForRow;
if (extraUsed >= extraComputedBSize) {
NS_ASSERTION((extraUsed == extraComputedBSize), "invalid row bsize calculation");
break;
}
}
}
}
- rowGroupBSize = aReflowState.ComputedBSize();
+ rowGroupBSize = aReflowInput.ComputedBSize();
}
if (wm.IsVertical()) {
// we need the correct containerSize below for block positioning in
// vertical-rl writing mode
containerSize.width = rowGroupBSize;
}
@@ -909,30 +909,30 @@ nsTableRowGroupFrame::CollapseRowGroupIf
nsTableFrame::InvalidateTableFrame(this, oldGroupRect, oldGroupVisualOverflow,
false);
return bGroupOffset;
}
// Move a child that was skipped during a reflow.
void
-nsTableRowGroupFrame::SlideChild(TableRowGroupReflowInput& aReflowState,
+nsTableRowGroupFrame::SlideChild(TableRowGroupReflowInput& aReflowInput,
nsIFrame* aKidFrame)
{
// Move the frame if we need to.
- WritingMode wm = aReflowState.reflowState.GetWritingMode();
+ WritingMode wm = aReflowInput.reflowInput.GetWritingMode();
const nsSize containerSize =
- aReflowState.reflowState.ComputedSizeAsContainerIfConstrained();
+ aReflowInput.reflowInput.ComputedSizeAsContainerIfConstrained();
LogicalPoint oldPosition =
aKidFrame->GetLogicalNormalPosition(wm, containerSize);
LogicalPoint newPosition = oldPosition;
- newPosition.B(wm) = aReflowState.bCoord;
+ newPosition.B(wm) = aReflowInput.bCoord;
if (oldPosition.B(wm) != newPosition.B(wm)) {
aKidFrame->InvalidateFrameSubtree();
- aReflowState.reflowState.ApplyRelativePositioning(&newPosition,
+ aReflowInput.reflowInput.ApplyRelativePositioning(&newPosition,
containerSize);
aKidFrame->SetPosition(wm, newPosition, containerSize);
nsTableFrame::RePositionViews(aKidFrame);
aKidFrame->InvalidateFrameSubtree();
}
}
// Create a continuing frame, add it to the child list, and then push it
@@ -955,17 +955,17 @@ nsTableRowGroupFrame::CreateContinuingRo
PushChildren(*aContRowFrame, &aRowFrame);
}
// Reflow the cells with rowspan > 1 which originate between aFirstRow
// and end on or after aLastRow. aFirstTruncatedRow is the highest row on the
// page that contains a cell which cannot split on this page
void
nsTableRowGroupFrame::SplitSpanningCells(nsPresContext& aPresContext,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsTableFrame& aTable,
nsTableRowFrame& aFirstRow,
nsTableRowFrame& aLastRow,
bool aFirstRowIsTopOfPage,
nscoord aSpanningRowBEnd,
nsTableRowFrame*& aContRow,
nsTableRowFrame*& aFirstTruncatedRow,
nscoord& aDesiredBSize)
@@ -993,31 +993,31 @@ nsTableRowGroupFrame::SplitSpanningCells
nsReflowStatus status;
// Ask the row to reflow the cell to the bsize of all the rows it spans up through aLastRow
// cellAvailBSize is the space between the row group start and the end of the page
nscoord cellAvailBSize = aSpanningRowBEnd - rowPos.y;
NS_ASSERTION(cellAvailBSize >= 0, "No space for cell?");
bool isTopOfPage = (row == &aFirstRow) && aFirstRowIsTopOfPage;
nsRect rowRect = row->GetNormalRect();
- nsSize rowAvailSize(aReflowState.AvailableWidth(),
- std::max(aReflowState.AvailableHeight() - rowRect.y,
+ nsSize rowAvailSize(aReflowInput.AvailableWidth(),
+ std::max(aReflowInput.AvailableHeight() - rowRect.y,
0));
// don't let the available height exceed what
// CalculateRowBSizes set for it
rowAvailSize.height = std::min(rowAvailSize.height, rowRect.height);
- ReflowInput rowReflowState(&aPresContext, aReflowState, row,
+ ReflowInput rowReflowInput(&aPresContext, aReflowInput, row,
LogicalSize(row->GetWritingMode(),
rowAvailSize),
nullptr,
ReflowInput::CALLER_WILL_INIT);
- InitChildReflowState(aPresContext, borderCollapse, rowReflowState);
- rowReflowState.mFlags.mIsTopOfPage = isTopOfPage; // set top of page
+ InitChildReflowInput(aPresContext, borderCollapse, rowReflowInput);
+ rowReflowInput.mFlags.mIsTopOfPage = isTopOfPage; // set top of page
- nscoord cellBSize = row->ReflowCellFrame(&aPresContext, rowReflowState,
+ nscoord cellBSize = row->ReflowCellFrame(&aPresContext, rowReflowInput,
isTopOfPage, cell,
cellAvailBSize, status);
aDesiredBSize = std::max(aDesiredBSize, rowPos.y + cellBSize);
if (NS_FRAME_IS_COMPLETE(status)) {
if (cellBSize > cellAvailBSize) {
aFirstTruncatedRow = row;
if ((row != &aFirstRow) || !aFirstRowIsTopOfPage) {
// return now, since we will be getting another reflow after either (1) row is
@@ -1091,37 +1091,37 @@ GetRowBefore(nsTableRowFrame& aStartRow,
rowBefore = sib;
}
return rowBefore;
}
nsresult
nsTableRowGroupFrame::SplitRowGroup(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsTableFrame* aTableFrame,
nsReflowStatus& aStatus,
bool aRowForcedPageBreak)
{
NS_PRECONDITION(aPresContext->IsPaginated(), "SplitRowGroup currently supports only paged media");
nsTableRowFrame* prevRowFrame = nullptr;
aDesiredSize.Height() = 0;
- nscoord availWidth = aReflowState.AvailableWidth();
- nscoord availHeight = aReflowState.AvailableHeight();
+ nscoord availWidth = aReflowInput.AvailableWidth();
+ nscoord availHeight = aReflowInput.AvailableHeight();
const bool borderCollapse = aTableFrame->IsBorderCollapse();
// get the page height
nscoord pageHeight = aPresContext->GetPageSize().height;
NS_ASSERTION(pageHeight != NS_UNCONSTRAINEDSIZE,
"The table shouldn't be split when there should be space");
- bool isTopOfPage = aReflowState.mFlags.mIsTopOfPage;
+ bool isTopOfPage = aReflowInput.mFlags.mIsTopOfPage;
nsTableRowFrame* firstRowThisPage = GetFirstRow();
// Need to dirty the table's geometry, or else the row might skip
// reflowing its cell as an optimization.
aTableFrame->SetGeometryDirty();
// Walk each of the row frames looking for the first row frame that doesn't fit
// in the available space
@@ -1135,54 +1135,54 @@ nsTableRowGroupFrame::SplitRowGroup(nsPr
// Reflow the row in the availabe space and have it split if it is the 1st
// row (on the page) or there is at least 5% of the current page available
// XXX this 5% should be made a preference
if (!prevRowFrame || (availHeight - aDesiredSize.Height() > pageHeight / 20)) {
nsSize availSize(availWidth, std::max(availHeight - rowRect.y, 0));
// don't let the available height exceed what CalculateRowHeights set for it
availSize.height = std::min(availSize.height, rowRect.height);
- ReflowInput rowReflowState(aPresContext, aReflowState, rowFrame,
+ ReflowInput rowReflowInput(aPresContext, aReflowInput, rowFrame,
LogicalSize(rowFrame->GetWritingMode(),
availSize),
nullptr,
ReflowInput::CALLER_WILL_INIT);
- InitChildReflowState(*aPresContext, borderCollapse, rowReflowState);
- rowReflowState.mFlags.mIsTopOfPage = isTopOfPage; // set top of page
- ReflowOutput rowMetrics(aReflowState);
+ InitChildReflowInput(*aPresContext, borderCollapse, rowReflowInput);
+ rowReflowInput.mFlags.mIsTopOfPage = isTopOfPage; // set top of page
+ ReflowOutput rowMetrics(aReflowInput);
// Get the old size before we reflow.
nsRect oldRowRect = rowFrame->GetRect();
nsRect oldRowVisualOverflow = rowFrame->GetVisualOverflowRect();
// Reflow the cell with the constrained height. A cell with rowspan >1 will get this
// reflow later during SplitSpanningCells.
- ReflowChild(rowFrame, aPresContext, rowMetrics, rowReflowState,
+ ReflowChild(rowFrame, aPresContext, rowMetrics, rowReflowInput,
0, 0, NS_FRAME_NO_MOVE_FRAME, aStatus);
rowFrame->SetSize(nsSize(rowMetrics.Width(), rowMetrics.Height()));
rowFrame->DidReflow(aPresContext, nullptr, nsDidReflowStatus::FINISHED);
rowFrame->DidResize();
if (!aRowForcedPageBreak && !NS_FRAME_IS_FULLY_COMPLETE(aStatus) &&
- ShouldAvoidBreakInside(aReflowState)) {
+ ShouldAvoidBreakInside(aReflowInput)) {
aStatus = NS_INLINE_LINE_BREAK_BEFORE();
break;
}
nsTableFrame::InvalidateTableFrame(rowFrame, oldRowRect,
oldRowVisualOverflow,
false);
if (NS_FRAME_IS_NOT_COMPLETE(aStatus)) {
// The row frame is incomplete and all of the rowspan 1 cells' block frames split
- if ((rowMetrics.Height() <= rowReflowState.AvailableHeight()) || isTopOfPage) {
+ if ((rowMetrics.Height() <= rowReflowInput.AvailableHeight()) || isTopOfPage) {
// The row stays on this page because either it split ok or we're on the top of page.
// If top of page and the height exceeded the avail height, then there will be data loss
- NS_ASSERTION(rowMetrics.Height() <= rowReflowState.AvailableHeight(),
+ NS_ASSERTION(rowMetrics.Height() <= rowReflowInput.AvailableHeight(),
"data loss - incomplete row needed more height than available, on top of page");
CreateContinuingRowFrame(*aPresContext, *rowFrame, (nsIFrame**)&contRow);
if (contRow) {
aDesiredSize.Height() += rowMetrics.Height();
if (prevRowFrame)
aDesiredSize.Height() += cellSpacingB;
}
else return NS_ERROR_NULL_POINTER;
@@ -1224,44 +1224,44 @@ nsTableRowGroupFrame::SplitRowGroup(nsPr
// put the row on the next page to give it more height
rowIsOnPage = false;
}
nsTableRowFrame* lastRowThisPage = rowFrame;
nscoord spanningRowBottom = availHeight;
if (!rowIsOnPage) {
NS_ASSERTION(!contRow, "We should not have created a continuation if none of this row fits");
- if (!aRowForcedPageBreak && ShouldAvoidBreakInside(aReflowState)) {
+ if (!aRowForcedPageBreak && ShouldAvoidBreakInside(aReflowInput)) {
aStatus = NS_INLINE_LINE_BREAK_BEFORE();
break;
}
if (prevRowFrame) {
spanningRowBottom = prevRowFrame->GetNormalRect().YMost();
lastRowThisPage = prevRowFrame;
- isTopOfPage = (lastRowThisPage == firstRowThisPage) && aReflowState.mFlags.mIsTopOfPage;
+ isTopOfPage = (lastRowThisPage == firstRowThisPage) && aReflowInput.mFlags.mIsTopOfPage;
aStatus = NS_FRAME_NOT_COMPLETE;
}
else {
// We can't push children, so let our parent reflow us again with more space
aDesiredSize.Height() = rowRect.YMost();
aStatus = NS_FRAME_COMPLETE;
break;
}
}
// reflow the cells with rowspan >1 that occur on the page
nsTableRowFrame* firstTruncatedRow;
nscoord bMost;
- SplitSpanningCells(*aPresContext, aReflowState, *aTableFrame, *firstRowThisPage,
- *lastRowThisPage, aReflowState.mFlags.mIsTopOfPage, spanningRowBottom, contRow,
+ SplitSpanningCells(*aPresContext, aReflowInput, *aTableFrame, *firstRowThisPage,
+ *lastRowThisPage, aReflowInput.mFlags.mIsTopOfPage, spanningRowBottom, contRow,
firstTruncatedRow, bMost);
if (firstTruncatedRow) {
// A rowspan >1 cell did not fit (and could not split) in the space we gave it
if (firstTruncatedRow == firstRowThisPage) {
- if (aReflowState.mFlags.mIsTopOfPage) {
+ if (aReflowInput.mFlags.mIsTopOfPage) {
NS_WARNING("data loss in a row spanned cell");
}
else {
// We can't push children, so let our parent reflow us again with more space
aDesiredSize.Height() = rowRect.YMost();
aStatus = NS_FRAME_COMPLETE;
UndoContinuedRow(aPresContext, contRow);
contRow = nullptr;
@@ -1275,28 +1275,28 @@ nsTableRowGroupFrame::SplitRowGroup(nsPr
UndoContinuedRow(aPresContext, contRow);
contRow = nullptr;
nsTableRowFrame* oldLastRowThisPage = lastRowThisPage;
lastRowThisPage = rowBefore;
aStatus = NS_FRAME_NOT_COMPLETE;
// Call SplitSpanningCells again with rowBefore as the last row on the page
- SplitSpanningCells(*aPresContext, aReflowState, *aTableFrame,
- *firstRowThisPage, *rowBefore, aReflowState.mFlags.mIsTopOfPage,
+ SplitSpanningCells(*aPresContext, aReflowInput, *aTableFrame,
+ *firstRowThisPage, *rowBefore, aReflowInput.mFlags.mIsTopOfPage,
spanningRowBottom, contRow, firstTruncatedRow, aDesiredSize.Height());
if (firstTruncatedRow) {
- if (aReflowState.mFlags.mIsTopOfPage) {
+ if (aReflowInput.mFlags.mIsTopOfPage) {
// We were better off with the 1st call to SplitSpanningCells, do it again
UndoContinuedRow(aPresContext, contRow);
contRow = nullptr;
lastRowThisPage = oldLastRowThisPage;
spanningRowBottom = oldSpanningRowBottom;
- SplitSpanningCells(*aPresContext, aReflowState, *aTableFrame, *firstRowThisPage,
- *lastRowThisPage, aReflowState.mFlags.mIsTopOfPage, spanningRowBottom, contRow,
+ SplitSpanningCells(*aPresContext, aReflowInput, *aTableFrame, *firstRowThisPage,
+ *lastRowThisPage, aReflowInput.mFlags.mIsTopOfPage, spanningRowBottom, contRow,
firstTruncatedRow, aDesiredSize.Height());
NS_WARNING("data loss in a row spanned cell");
}
else {
// Let our parent reflow us again with more space
aDesiredSize.Height() = rowRect.YMost();
aStatus = NS_FRAME_COMPLETE;
UndoContinuedRow(aPresContext, contRow);
@@ -1339,77 +1339,77 @@ nsTableRowGroupFrame::SplitRowGroup(nsPr
/** Layout the entire row group.
* This method stacks rows vertically according to HTML 4.0 rules.
* Rows are responsible for layout of their children.
*/
void
nsTableRowGroupFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsTableRowGroupFrame");
- DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
+ DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
aStatus = NS_FRAME_COMPLETE;
// Row geometry may be going to change so we need to invalidate any row cursor.
ClearRowCursor();
// see if a special bsize reflow needs to occur due to having a pct bsize
- nsTableFrame::CheckRequestSpecialBSizeReflow(aReflowState);
+ nsTableFrame::CheckRequestSpecialBSizeReflow(aReflowInput);
nsTableFrame* tableFrame = GetTableFrame();
- TableRowGroupReflowInput state(aReflowState, tableFrame);
+ TableRowGroupReflowInput state(aReflowInput, tableFrame);
const nsStyleVisibility* groupVis = StyleVisibility();
bool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupVis->mVisible);
if (collapseGroup) {
tableFrame->SetNeedToCollapse(true);
}
// Check for an overflow list
MoveOverflowToChildList();
// Reflow the existing frames.
bool splitDueToPageBreak = false;
ReflowChildren(aPresContext, aDesiredSize, state, aStatus,
&splitDueToPageBreak);
// See if all the frames fit. Do not try to split anything if we're
// not paginated ... we can't split across columns yet.
- if (aReflowState.mFlags.mTableIsSplittable &&
- NS_UNCONSTRAINEDSIZE != aReflowState.AvailableHeight() &&
+ if (aReflowInput.mFlags.mTableIsSplittable &&
+ NS_UNCONSTRAINEDSIZE != aReflowInput.AvailableHeight() &&
(NS_FRAME_NOT_COMPLETE == aStatus || splitDueToPageBreak ||
- aDesiredSize.Height() > aReflowState.AvailableHeight())) {
+ aDesiredSize.Height() > aReflowInput.AvailableHeight())) {
// Nope, find a place to split the row group
- bool specialReflow = (bool)aReflowState.mFlags.mSpecialBSizeReflow;
- ((ReflowInput::ReflowStateFlags&)aReflowState.mFlags).mSpecialBSizeReflow = false;
+ bool specialReflow = (bool)aReflowInput.mFlags.mSpecialBSizeReflow;
+ ((ReflowInput::ReflowInputFlags&)aReflowInput.mFlags).mSpecialBSizeReflow = false;
- SplitRowGroup(aPresContext, aDesiredSize, aReflowState, tableFrame, aStatus,
+ SplitRowGroup(aPresContext, aDesiredSize, aReflowInput, tableFrame, aStatus,
splitDueToPageBreak);
- ((ReflowInput::ReflowStateFlags&)aReflowState.mFlags).mSpecialBSizeReflow = specialReflow;
+ ((ReflowInput::ReflowInputFlags&)aReflowInput.mFlags).mSpecialBSizeReflow = specialReflow;
}
// XXXmats The following is just bogus. We leave it here for now because
// ReflowChildren should pull up rows from our next-in-flow before returning
// a Complete status, but doesn't (bug 804888).
if (GetNextInFlow() && GetNextInFlow()->PrincipalChildList().FirstChild()) {
NS_FRAME_SET_INCOMPLETE(aStatus);
}
- SetHasStyleBSize((NS_UNCONSTRAINEDSIZE != aReflowState.ComputedBSize()) &&
- (aReflowState.ComputedBSize() > 0));
+ SetHasStyleBSize((NS_UNCONSTRAINEDSIZE != aReflowInput.ComputedBSize()) &&
+ (aReflowInput.ComputedBSize() > 0));
// Just set our isize to what was available.
// The table will calculate the isize and not use our value.
- WritingMode wm = aReflowState.GetWritingMode();
- aDesiredSize.ISize(wm) = aReflowState.AvailableISize();
+ WritingMode wm = aReflowInput.GetWritingMode();
+ aDesiredSize.ISize(wm) = aReflowInput.AvailableISize();
aDesiredSize.UnionOverflowAreasWithDesiredBounds();
// If our parent is in initial reflow, it'll handle invalidating our
// entire overflow rect.
if (!GetParent()->HasAnyStateBits(NS_FRAME_FIRST_REFLOW) &&
nsSize(aDesiredSize.Width(), aDesiredSize.Height()) != mRect.Size()) {
InvalidateFrame();
@@ -1417,17 +1417,17 @@ nsTableRowGroupFrame::Reflow(nsPresConte
FinishAndStoreOverflow(&aDesiredSize);
// Any absolutely-positioned children will get reflowed in
// nsFrame::FixupPositionedTableParts in another pass, so propagate our
// dirtiness to them before our parent clears our dirty bits.
PushDirtyBitToAbsoluteFrames();
- NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
+ NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
bool
nsTableRowGroupFrame::ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas)
{
// Row cursor invariants depend on the visual overflow area of the rows,
// which may have changed, so we need to clear the cursor now.
ClearRowCursor();
@@ -1575,31 +1575,31 @@ nsTableRowGroupFrame::GetUsedBorder() co
/* virtual */ nsMargin
nsTableRowGroupFrame::GetUsedPadding() const
{
return nsMargin(0,0,0,0);
}
nscoord
-nsTableRowGroupFrame::GetBSizeBasis(const ReflowInput& aReflowState)
+nsTableRowGroupFrame::GetBSizeBasis(const ReflowInput& aReflowInput)
{
nscoord result = 0;
nsTableFrame* tableFrame = GetTableFrame();
int32_t startRowIndex = GetStartRowIndex();
- if ((aReflowState.ComputedBSize() > 0) && (aReflowState.ComputedBSize() < NS_UNCONSTRAINEDSIZE)) {
+ if ((aReflowInput.ComputedBSize() > 0) && (aReflowInput.ComputedBSize() < NS_UNCONSTRAINEDSIZE)) {
nscoord cellSpacing = tableFrame->GetRowSpacing(startRowIndex,
std::max(startRowIndex,
startRowIndex + GetRowCount() - 1));
- result = aReflowState.ComputedBSize() - cellSpacing;
+ result = aReflowInput.ComputedBSize() - cellSpacing;
}
else {
- const ReflowInput* parentRS = aReflowState.mParentReflowState;
+ const ReflowInput* parentRS = aReflowInput.mParentReflowInput;
if (parentRS && (tableFrame != parentRS->mFrame)) {
- parentRS = parentRS->mParentReflowState;
+ parentRS = parentRS->mParentReflowInput;
}
if (parentRS && (tableFrame == parentRS->mFrame) &&
(parentRS->ComputedBSize() > 0) && (parentRS->ComputedBSize() < NS_UNCONSTRAINEDSIZE)) {
nscoord cellSpacing = tableFrame->GetRowSpacing(-1, tableFrame->GetRowCount());
result = parentRS->ComputedBSize() - cellSpacing;
}
}
--- a/layout/tables/nsTableRowGroupFrame.h
+++ b/layout/tables/nsTableRowGroupFrame.h
@@ -85,17 +85,17 @@ public:
*
* @param aDesiredSize isize set to isize of rows, bsize set to
* sum of bsize of rows that fit in AvailableBSize.
*
* @see nsIFrame::Reflow
*/
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override;
/**
* Get the "type" of the frame
*
* @see nsGkAtoms::tableRowGroupFrame
@@ -136,17 +136,17 @@ public:
* that was repeated
*/
nsresult InitRepeatedFrame(nsTableRowGroupFrame* aHeaderFooterFrame);
/**
* Get the total bsize of all the row rects
*/
- nscoord GetBSizeBasis(const ReflowInput& aReflowState);
+ nscoord GetBSizeBasis(const ReflowInput& aReflowInput);
mozilla::LogicalMargin GetBCBorderWidth(mozilla::WritingMode aWM);
/**
* Gets inner border widths before collapsing with cell borders
* Caller must get bstart border from previous row group or from table
* GetContinuousBCBorderWidth will not overwrite aBorder.BStart()
* see nsTablePainter about continuous borders
@@ -318,62 +318,62 @@ public:
virtual void InvalidateFrame(uint32_t aDisplayItemKey = 0) override;
virtual void InvalidateFrameWithRect(const nsRect& aRect, uint32_t aDisplayItemKey = 0) override;
virtual void InvalidateFrameForRemoval() override { InvalidateFrameSubtree(); }
protected:
explicit nsTableRowGroupFrame(nsStyleContext* aContext);
- void InitChildReflowState(nsPresContext& aPresContext,
+ void InitChildReflowInput(nsPresContext& aPresContext,
bool aBorderCollapse,
- ReflowInput& aReflowState);
+ ReflowInput& aReflowInput);
- virtual LogicalSides GetLogicalSkipSides(const ReflowInput* aReflowState = nullptr) const override;
+ virtual LogicalSides GetLogicalSkipSides(const ReflowInput* aReflowInput = nullptr) const override;
void PlaceChild(nsPresContext* aPresContext,
- TableRowGroupReflowInput& aReflowState,
+ TableRowGroupReflowInput& aReflowInput,
nsIFrame* aKidFrame,
mozilla::WritingMode aWM,
const mozilla::LogicalPoint& aKidPosition,
const nsSize& aContainerSize,
ReflowOutput& aDesiredSize,
const nsRect& aOriginalKidRect,
const nsRect& aOriginalKidVisualOverflow);
void CalculateRowBSizes(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState);
+ const ReflowInput& aReflowInput);
void DidResizeRows(ReflowOutput& aDesiredSize);
- void SlideChild(TableRowGroupReflowInput& aReflowState,
+ void SlideChild(TableRowGroupReflowInput& aReflowInput,
nsIFrame* aKidFrame);
/**
* Reflow the frames we've already created
*
* @param aPresContext presentation context to use
- * @param aReflowState current inline state
+ * @param aReflowInput current inline state
*/
void ReflowChildren(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- TableRowGroupReflowInput& aReflowState,
+ TableRowGroupReflowInput& aReflowInput,
nsReflowStatus& aStatus,
bool* aPageBreakBeforeEnd = nullptr);
nsresult SplitRowGroup(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsTableFrame* aTableFrame,
nsReflowStatus& aStatus,
bool aRowForcedPageBreak);
void SplitSpanningCells(nsPresContext& aPresContext,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsTableFrame& aTableFrame,
nsTableRowFrame& aFirstRow,
nsTableRowFrame& aLastRow,
bool aFirstRowIsTopOfPage,
nscoord aSpanningRowBottom,
nsTableRowFrame*& aContRowFrame,
nsTableRowFrame*& aFirstTruncatedRow,
nscoord& aDesiredHeight);
--- a/layout/tables/nsTableWrapperFrame.cpp
+++ b/layout/tables/nsTableWrapperFrame.cpp
@@ -223,32 +223,32 @@ nsTableWrapperFrame::GetParentStyleConte
// the table wrapper's style context is a leaf.
return (*aProviderFrame = InnerTableFrame())->StyleContext();
}
// INCREMENTAL REFLOW HELPER FUNCTIONS
void
-nsTableWrapperFrame::InitChildReflowState(nsPresContext& aPresContext,
- ReflowInput& aReflowState)
+nsTableWrapperFrame::InitChildReflowInput(nsPresContext& aPresContext,
+ ReflowInput& aReflowInput)
{
nsMargin collapseBorder;
nsMargin collapsePadding(0,0,0,0);
nsMargin* pCollapseBorder = nullptr;
nsMargin* pCollapsePadding = nullptr;
- if (aReflowState.mFrame == InnerTableFrame() &&
+ if (aReflowInput.mFrame == InnerTableFrame() &&
InnerTableFrame()->IsBorderCollapse()) {
- WritingMode wm = aReflowState.GetWritingMode();
+ WritingMode wm = aReflowInput.GetWritingMode();
LogicalMargin border = InnerTableFrame()->GetIncludedOuterBCBorder(wm);
collapseBorder = border.GetPhysicalMargin(wm);
pCollapseBorder = &collapseBorder;
pCollapsePadding = &collapsePadding;
}
- aReflowState.Init(&aPresContext, nullptr, pCollapseBorder, pCollapsePadding);
+ aReflowInput.Init(&aPresContext, nullptr, pCollapseBorder, pCollapsePadding);
}
// get the margin and padding data. ReflowInput doesn't handle the
// case of auto margins
void
nsTableWrapperFrame::GetChildMargin(nsPresContext* aPresContext,
const ReflowInput& aOuterRS,
nsIFrame* aChildFrame,
@@ -262,26 +262,26 @@ nsTableWrapperFrame::GetChildMargin(nsPr
// will not be computed at this time.
// create and init the child reflow state
// XXX We really shouldn't construct a reflow state to do this.
WritingMode wm = aOuterRS.GetWritingMode();
LogicalSize availSize(wm, aAvailISize, aOuterRS.AvailableSize(wm).BSize(wm));
ReflowInput childRS(aPresContext, aOuterRS, aChildFrame, availSize,
nullptr, ReflowInput::CALLER_WILL_INIT);
- InitChildReflowState(*aPresContext, childRS);
+ InitChildReflowInput(*aPresContext, childRS);
aMargin = childRS.ComputedLogicalMargin();
}
static nsSize
GetContainingBlockSize(const ReflowInput& aOuterRS)
{
nsSize size(0,0);
- const ReflowInput* containRS = aOuterRS.mCBReflowState;
+ const ReflowInput* containRS = aOuterRS.mCBReflowInput;
if (containRS) {
size.width = containRS->ComputedWidth();
if (NS_UNCONSTRAINEDSIZE == size.width) {
size.width = 0;
}
size.height = containRS->ComputedHeight();
if (NS_UNCONSTRAINEDSIZE == size.height) {
@@ -757,17 +757,17 @@ nsTableWrapperFrame::OuterBeginReflowChi
availBSize -= margin.BEnd(wm);
}
}
LogicalSize availSize(wm, aAvailISize, availBSize);
// create and init the child reflow state, using passed-in Maybe<>,
// so that caller can use it after we return.
aChildRS.emplace(aPresContext, aOuterRS, aChildFrame, availSize,
nullptr, ReflowInput::CALLER_WILL_INIT);
- InitChildReflowState(*aPresContext, *aChildRS);
+ InitChildReflowInput(*aPresContext, *aChildRS);
// see if we need to reset top-of-page due to a caption
if (aChildRS->mFlags.mIsTopOfPage &&
mCaptionFrames.FirstChild() == aChildFrame) {
uint8_t captionSide = GetCaptionSide();
if (captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM ||
captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE) {
aChildRS->mFlags.mIsTopOfPage = false;
--- a/layout/tables/nsTableWrapperFrame.h
+++ b/layout/tables/nsTableWrapperFrame.h
@@ -81,17 +81,17 @@ public:
const mozilla::LogicalSize& aPadding,
bool aShrinkWrap) override;
/** process a reflow command for the table.
* This involves reflowing the caption and the inner table.
* @see nsIFrame::Reflow */
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
/**
* Get the "type" of the frame
*
* @see nsGkAtoms::tableWrapperFrame
*/
virtual nsIAtom* GetType() const override;
@@ -180,18 +180,18 @@ public:
}
protected:
explicit nsTableWrapperFrame(nsStyleContext* aContext);
virtual ~nsTableWrapperFrame();
- void InitChildReflowState(nsPresContext& aPresContext,
- ReflowInput& aReflowState);
+ void InitChildReflowInput(nsPresContext& aPresContext,
+ ReflowInput& aReflowInput);
// Get a NS_STYLE_CAPTION_SIDE_* value, or NO_SIDE if no caption is present.
// (Remember that caption-side values are interpreted logically, despite
// having "physical" names.)
uint8_t GetCaptionSide();
bool HasSideCaption() {
uint8_t captionSide = GetCaptionSide();
--- a/layout/xul/nsBoxFrame.cpp
+++ b/layout/xul/nsBoxFrame.cpp
@@ -549,22 +549,22 @@ nsBoxFrame::GetInitialAutoStretch(bool&
const nsStyleXUL* boxInfo = StyleXUL();
aStretch = (boxInfo->mBoxAlign == NS_STYLE_BOX_ALIGN_STRETCH);
return true;
}
void
nsBoxFrame::DidReflow(nsPresContext* aPresContext,
- const ReflowInput* aReflowState,
+ const ReflowInput* aReflowInput,
nsDidReflowStatus aStatus)
{
nsFrameState preserveBits =
mState & (NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN);
- nsFrame::DidReflow(aPresContext, aReflowState, aStatus);
+ nsFrame::DidReflow(aPresContext, aReflowInput, aStatus);
mState |= preserveBits;
}
bool
nsBoxFrame::HonorPrintBackgroundSettings()
{
return (!mContent || !mContent->IsInNativeAnonymousSubtree()) &&
nsContainerFrame::HonorPrintBackgroundSettings();
@@ -625,53 +625,53 @@ nsBoxFrame::GetPrefISize(nsRenderingCont
result = std::max(result, 0);
return result;
}
void
nsBoxFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
// If you make changes to this method, please keep nsLeafBoxFrame::Reflow
// in sync, if the changes are applicable there.
DO_GLOBAL_REFLOW_COUNT("nsBoxFrame");
- DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
+ DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
- NS_ASSERTION(aReflowState.ComputedWidth() >=0 &&
- aReflowState.ComputedHeight() >= 0, "Computed Size < 0");
+ NS_ASSERTION(aReflowInput.ComputedWidth() >=0 &&
+ aReflowInput.ComputedHeight() >= 0, "Computed Size < 0");
#ifdef DO_NOISY_REFLOW
printf("\n-------------Starting BoxFrame Reflow ----------------------------\n");
printf("%p ** nsBF::Reflow %d ", this, myCounter++);
- printSize("AW", aReflowState.AvailableWidth());
- printSize("AH", aReflowState.AvailableHeight());
- printSize("CW", aReflowState.ComputedWidth());
- printSize("CH", aReflowState.ComputedHeight());
+ printSize("AW", aReflowInput.AvailableWidth());
+ printSize("AH", aReflowInput.AvailableHeight());
+ printSize("CW", aReflowInput.ComputedWidth());
+ printSize("CH", aReflowInput.ComputedHeight());
printf(" *\n");
#endif
aStatus = NS_FRAME_COMPLETE;
// create the layout state
- nsBoxLayoutState state(aPresContext, aReflowState.mRenderingContext,
- &aReflowState, aReflowState.mReflowDepth);
+ nsBoxLayoutState state(aPresContext, aReflowInput.mRenderingContext,
+ &aReflowInput, aReflowInput.mReflowDepth);
- WritingMode wm = aReflowState.GetWritingMode();
- LogicalSize computedSize(wm, aReflowState.ComputedISize(),
- aReflowState.ComputedBSize());
+ WritingMode wm = aReflowInput.GetWritingMode();
+ LogicalSize computedSize(wm, aReflowInput.ComputedISize(),
+ aReflowInput.ComputedBSize());
- LogicalMargin m = aReflowState.ComputedLogicalBorderPadding();
+ LogicalMargin m = aReflowInput.ComputedLogicalBorderPadding();
// GetXULBorderAndPadding(m);
LogicalSize prefSize(wm);
// if we are told to layout intrinsic then get our preferred size.
NS_ASSERTION(computedSize.ISize(wm) != NS_INTRINSICSIZE,
"computed inline size should always be computed");
if (computedSize.BSize(wm) == NS_INTRINSICSIZE) {
@@ -681,25 +681,25 @@ nsBoxFrame::Reflow(nsPresContext*
// XXXbz isn't GetXULPrefSize supposed to bounds-check for us?
physicalPrefSize = BoundsCheck(minSize, physicalPrefSize, maxSize);
prefSize = LogicalSize(wm, physicalPrefSize);
}
// get our desiredSize
computedSize.ISize(wm) += m.IStart(wm) + m.IEnd(wm);
- if (aReflowState.ComputedBSize() == NS_INTRINSICSIZE) {
+ if (aReflowInput.ComputedBSize() == NS_INTRINSICSIZE) {
computedSize.BSize(wm) = prefSize.BSize(wm);
// prefSize is border-box but min/max constraints are content-box.
nscoord blockDirBorderPadding =
- aReflowState.ComputedLogicalBorderPadding().BStartEnd(wm);
+ aReflowInput.ComputedLogicalBorderPadding().BStartEnd(wm);
nscoord contentBSize = computedSize.BSize(wm) - blockDirBorderPadding;
// Note: contentHeight might be negative, but that's OK because min-height
// is never negative.
- computedSize.BSize(wm) = aReflowState.ApplyMinMaxHeight(contentBSize) +
+ computedSize.BSize(wm) = aReflowInput.ApplyMinMaxHeight(contentBSize) +
blockDirBorderPadding;
} else {
computedSize.BSize(wm) += m.BStart(wm) + m.BEnd(wm);
}
nsSize physicalSize = computedSize.GetPhysicalSize(wm);
nsRect r(mRect.x, mRect.y, physicalSize.width, physicalSize.height);
@@ -733,19 +733,19 @@ nsBoxFrame::Reflow(nsPresContext*
printf("MW:%d\n", *maxElementWidth);
} else {
printf("MW:?\n");
}
}
#endif
- ReflowAbsoluteFrames(aPresContext, aDesiredSize, aReflowState, aStatus);
+ ReflowAbsoluteFrames(aPresContext, aDesiredSize, aReflowInput, aStatus);
- NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
+ NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
nsSize
nsBoxFrame::GetXULPrefSize(nsBoxLayoutState& aBoxLayoutState)
{
NS_ASSERTION(aBoxLayoutState.GetRenderingContext(),
"must have rendering context");
@@ -911,25 +911,25 @@ nsBoxFrame::DoXULLayout(nsBoxLayoutState
if (mLayoutManager) {
CoordNeedsRecalc(mAscent);
rv = mLayoutManager->XULLayout(this, aState);
}
aState.SetLayoutFlags(oldFlags);
if (HasAbsolutelyPositionedChildren()) {
- // Set up a |reflowState| to pass into ReflowAbsoluteFrames
+ // Set up a |reflowInput| to pass into ReflowAbsoluteFrames
WritingMode wm = GetWritingMode();
- ReflowInput reflowState(aState.PresContext(), this,
+ ReflowInput reflowInput(aState.PresContext(), this,
aState.GetRenderingContext(),
LogicalSize(wm, GetLogicalSize().ISize(wm),
NS_UNCONSTRAINEDSIZE));
// Set up a |desiredSize| to pass into ReflowAbsoluteFrames
- ReflowOutput desiredSize(reflowState);
+ ReflowOutput desiredSize(reflowInput);
desiredSize.Width() = mRect.width;
desiredSize.Height() = mRect.height;
// get the ascent (cribbed from ::Reflow)
nscoord ascent = mRect.height;
// getting the ascent could be a lot of work. Don't get it if
// we are the root. The viewport doesn't care about it.
@@ -939,17 +939,17 @@ nsBoxFrame::DoXULLayout(nsBoxLayoutState
desiredSize.SetBlockStartAscent(ascent);
desiredSize.mOverflowAreas = GetOverflowAreas();
AddStateBits(NS_FRAME_IN_REFLOW);
// Set up a |reflowStatus| to pass into ReflowAbsoluteFrames
// (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);
}
return rv;
}
void
nsBoxFrame::DestroyFrom(nsIFrame* aDestructRoot)
--- a/layout/xul/nsBoxFrame.h
+++ b/layout/xul/nsBoxFrame.h
@@ -90,17 +90,17 @@ public:
int32_t aModType) override;
virtual void MarkIntrinsicISizesDirty() override;
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual void SetInitialChildList(ChildListID aListID,
nsFrameList& aChildList) override;
virtual void AppendFrames(ChildListID aListID,
nsFrameList& aFrameList) override;
virtual void InsertFrames(ChildListID aListID,
nsIFrame* aPrevFrame,
@@ -131,17 +131,17 @@ public:
nsIFrame::eExcludesIgnorableWhitespace));
}
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
virtual void DidReflow(nsPresContext* aPresContext,
- const ReflowInput* aReflowState,
+ const ReflowInput* aReflowInput,
nsDidReflowStatus aStatus) override;
virtual bool HonorPrintBackgroundSettings() override;
virtual ~nsBoxFrame();
explicit nsBoxFrame(nsStyleContext* aContext, bool aIsRoot = false, nsBoxLayout* aLayoutManager = nullptr);
--- a/layout/xul/nsBoxLayoutState.cpp
+++ b/layout/xul/nsBoxLayoutState.cpp
@@ -9,30 +9,30 @@
//
// See documentation in associated header file
//
#include "nsBoxLayoutState.h"
nsBoxLayoutState::nsBoxLayoutState(nsPresContext* aPresContext,
nsRenderingContext* aRenderingContext,
- const ReflowInput* aOuterReflowState,
+ const ReflowInput* aOuterReflowInput,
uint16_t aReflowDepth)
: mPresContext(aPresContext)
, mRenderingContext(aRenderingContext)
- , mOuterReflowState(aOuterReflowState)
+ , mOuterReflowInput(aOuterReflowInput)
, mLayoutFlags(0)
, mReflowDepth(aReflowDepth)
, mPaintingDisabled(false)
{
NS_ASSERTION(mPresContext, "PresContext must be non-null");
}
nsBoxLayoutState::nsBoxLayoutState(const nsBoxLayoutState& aState)
: mPresContext(aState.mPresContext)
, mRenderingContext(aState.mRenderingContext)
- , mOuterReflowState(aState.mOuterReflowState)
+ , mOuterReflowInput(aState.mOuterReflowInput)
, mLayoutFlags(aState.mLayoutFlags)
, mReflowDepth(aState.mReflowDepth + 1)
, mPaintingDisabled(aState.mPaintingDisabled)
{
NS_ASSERTION(mPresContext, "PresContext must be non-null");
}
--- a/layout/xul/nsBoxLayoutState.h
+++ b/layout/xul/nsBoxLayoutState.h
@@ -25,18 +25,18 @@ struct ReflowInput;
class MOZ_STACK_CLASS nsBoxLayoutState
{
using ReflowInput = mozilla::ReflowInput;
public:
explicit nsBoxLayoutState(nsPresContext* aPresContext,
nsRenderingContext* aRenderingContext = nullptr,
- // see OuterReflowState() below
- const ReflowInput* aOuterReflowState = nullptr,
+ // see OuterReflowInput() below
+ const ReflowInput* aOuterReflowInput = nullptr,
uint16_t aReflowDepth = 0);
nsBoxLayoutState(const nsBoxLayoutState& aState);
nsPresContext* PresContext() const { return mPresContext; }
nsIPresShell* PresShell() const { return mPresContext->PresShell(); }
uint32_t LayoutFlags() const { return mLayoutFlags; }
void SetLayoutFlags(uint32_t aFlags) { mLayoutFlags = aFlags; }
@@ -55,23 +55,23 @@ public:
explicit AutoReflowDepth(nsBoxLayoutState& aState)
: mState(aState) { ++mState.mReflowDepth; }
~AutoReflowDepth() { --mState.mReflowDepth; }
nsBoxLayoutState& mState;
};
// The HTML reflow state that lives outside the box-block boundary.
// May not be set reliably yet.
- const ReflowInput* OuterReflowState() { return mOuterReflowState; }
+ const ReflowInput* OuterReflowInput() { return mOuterReflowInput; }
uint16_t GetReflowDepth() { return mReflowDepth; }
private:
RefPtr<nsPresContext> mPresContext;
nsRenderingContext *mRenderingContext;
- const ReflowInput *mOuterReflowState;
+ const ReflowInput *mOuterReflowInput;
uint32_t mLayoutFlags;
uint16_t mReflowDepth;
bool mPaintingDisabled;
};
#endif
--- a/layout/xul/nsLeafBoxFrame.cpp
+++ b/layout/xul/nsLeafBoxFrame.cpp
@@ -188,117 +188,117 @@ nsLeafBoxFrame::ComputeAutoSize(nsRender
return nsFrame::ComputeAutoSize(aRenderingContext, aWM,
aCBSize, aAvailableISize,
aMargin, aBorder, aPadding, aShrinkWrap);
}
void
nsLeafBoxFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
// This is mostly a copy of nsBoxFrame::Reflow().
// We aren't able to share an implementation because of the frame
// class hierarchy. If you make changes here, please keep
// nsBoxFrame::Reflow in sync.
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsLeafBoxFrame");
- DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
+ DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
- NS_ASSERTION(aReflowState.ComputedWidth() >=0 &&
- aReflowState.ComputedHeight() >= 0, "Computed Size < 0");
+ NS_ASSERTION(aReflowInput.ComputedWidth() >=0 &&
+ aReflowInput.ComputedHeight() >= 0, "Computed Size < 0");
#ifdef DO_NOISY_REFLOW
printf("\n-------------Starting LeafBoxFrame Reflow ----------------------------\n");
printf("%p ** nsLBF::Reflow %d R: ", this, myCounter++);
- switch (aReflowState.reason) {
+ switch (aReflowInput.reason) {
case eReflowReason_Initial:
printf("Ini");break;
case eReflowReason_Incremental:
printf("Inc");break;
case eReflowReason_Resize:
printf("Rsz");break;
case eReflowReason_StyleChange:
printf("Sty");break;
case eReflowReason_Dirty:
printf("Drt ");
break;
- default:printf("<unknown>%d", aReflowState.reason);break;
+ default:printf("<unknown>%d", aReflowInput.reason);break;
}
- printSize("AW", aReflowState.AvailableWidth());
- printSize("AH", aReflowState.AvailableHeight());
- printSize("CW", aReflowState.ComputedWidth());
- printSize("CH", aReflowState.ComputedHeight());
+ printSize("AW", aReflowInput.AvailableWidth());
+ printSize("AH", aReflowInput.AvailableHeight());
+ printSize("CW", aReflowInput.ComputedWidth());
+ printSize("CH", aReflowInput.ComputedHeight());
printf(" *\n");
#endif
aStatus = NS_FRAME_COMPLETE;
// create the layout state
- nsBoxLayoutState state(aPresContext, aReflowState.mRenderingContext);
+ nsBoxLayoutState state(aPresContext, aReflowInput.mRenderingContext);
- nsSize computedSize(aReflowState.ComputedWidth(),aReflowState.ComputedHeight());
+ nsSize computedSize(aReflowInput.ComputedWidth(),aReflowInput.ComputedHeight());
nsMargin m;
- m = aReflowState.ComputedPhysicalBorderPadding();
+ m = aReflowInput.ComputedPhysicalBorderPadding();
//GetXULBorderAndPadding(m);
// this happens sometimes. So lets handle it gracefully.
- if (aReflowState.ComputedHeight() == 0) {
+ if (aReflowInput.ComputedHeight() == 0) {
nsSize minSize = GetXULMinSize(state);
computedSize.height = minSize.height - m.top - m.bottom;
}
nsSize prefSize(0,0);
// if we are told to layout intrinic then get our preferred size.
if (computedSize.width == NS_INTRINSICSIZE || computedSize.height == NS_INTRINSICSIZE) {
prefSize = GetXULPrefSize(state);
nsSize minSize = GetXULMinSize(state);
nsSize maxSize = GetXULMaxSize(state);
prefSize = BoundsCheck(minSize, prefSize, maxSize);
}
// get our desiredSize
- if (aReflowState.ComputedWidth() == NS_INTRINSICSIZE) {
+ if (aReflowInput.ComputedWidth() == NS_INTRINSICSIZE) {
computedSize.width = prefSize.width;
} else {
computedSize.width += m.left + m.right;
}
- if (aReflowState.ComputedHeight() == NS_INTRINSICSIZE) {
+ if (aReflowInput.ComputedHeight() == NS_INTRINSICSIZE) {
computedSize.height = prefSize.height;
} else {
computedSize.height += m.top + m.bottom;
}
// handle reflow state min and max sizes
// XXXbz the width handling here seems to be wrong, since
// mComputedMin/MaxWidth is a content-box size, whole
// computedSize.width is a border-box size...
- if (computedSize.width > aReflowState.ComputedMaxWidth())
- computedSize.width = aReflowState.ComputedMaxWidth();
+ if (computedSize.width > aReflowInput.ComputedMaxWidth())
+ computedSize.width = aReflowInput.ComputedMaxWidth();
- if (computedSize.width < aReflowState.ComputedMinWidth())
- computedSize.width = aReflowState.ComputedMinWidth();
+ if (computedSize.width < aReflowInput.ComputedMinWidth())
+ computedSize.width = aReflowInput.ComputedMinWidth();
// Now adjust computedSize.height for our min and max computed
// height. The only problem is that those are content-box sizes,
// while computedSize.height is a border-box size. So subtract off
// m.TopBottom() before adjusting, then readd it.
computedSize.height = std::max(0, computedSize.height - m.TopBottom());
computedSize.height = NS_CSS_MINMAX(computedSize.height,
- aReflowState.ComputedMinHeight(),
- aReflowState.ComputedMaxHeight());
+ aReflowInput.ComputedMinHeight(),
+ aReflowInput.ComputedMaxHeight());
computedSize.height += m.TopBottom();
nsRect r(mRect.x, mRect.y, computedSize.width, computedSize.height);
SetXULBounds(state, r);
// layout our children
XULLayout(state);
--- a/layout/xul/nsLeafBoxFrame.h
+++ b/layout/xul/nsLeafBoxFrame.h
@@ -49,17 +49,17 @@ public:
nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorder,
const mozilla::LogicalSize& aPadding,
bool aShrinkWrap) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsresult CharacterDataChanged(CharacterDataChangeInfo* aInfo) override;
virtual void Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* asPrevInFlow) override;
--- a/layout/xul/nsRootBoxFrame.cpp
+++ b/layout/xul/nsRootBoxFrame.cpp
@@ -63,17 +63,17 @@ public:
virtual void InsertFrames(ChildListID aListID,
nsIFrame* aPrevFrame,
nsFrameList& aFrameList) override;
virtual void RemoveFrame(ChildListID aListID,
nsIFrame* aOldFrame) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsresult HandleEvent(nsPresContext* aPresContext,
WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus) override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
@@ -157,26 +157,26 @@ nsRootBoxFrame::RemoveFrame(ChildListID
#ifdef DEBUG_REFLOW
int32_t gReflows = 0;
#endif
void
nsRootBoxFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsRootBoxFrame");
#ifdef DEBUG_REFLOW
gReflows++;
printf("----Reflow %d----\n", gReflows);
#endif
- return nsBoxFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
+ return nsBoxFrame::Reflow(aPresContext, aDesiredSize, aReflowInput, aStatus);
}
void
nsRootBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists)
{
if (mContent && mContent->GetProperty(nsGkAtoms::DisplayPortMargins)) {
--- a/layout/xul/nsScrollbarFrame.cpp
+++ b/layout/xul/nsScrollbarFrame.cpp
@@ -52,27 +52,27 @@ nsScrollbarFrame::Init(nsIContent*
// move the slider and will thus not change anything outside of the
// scrollbar or change the size of the scrollbar frame.
mState |= NS_FRAME_REFLOW_ROOT;
}
void
nsScrollbarFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
- nsBoxFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
+ nsBoxFrame::Reflow(aPresContext, aDesiredSize, aReflowInput, aStatus);
// nsGfxScrollFrame may have told us to shrink to nothing. If so, make sure our
// desired size agrees.
- if (aReflowState.AvailableWidth() == 0) {
+ if (aReflowInput.AvailableWidth() == 0) {
aDesiredSize.Width() = 0;
}
- if (aReflowState.AvailableHeight() == 0) {
+ if (aReflowInput.AvailableHeight() == 0) {
aDesiredSize.Height() = 0;
}
}
nsIAtom*
nsScrollbarFrame::GetType() const
{
return nsGkAtoms::scrollbarFrame;
--- a/layout/xul/nsScrollbarFrame.h
+++ b/layout/xul/nsScrollbarFrame.h
@@ -57,17 +57,17 @@ public:
nsEventStatus* aEventStatus) override;
virtual void Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowState,
+ const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsIAtom* GetType() const override;
void SetScrollbarMediatorContent(nsIContent* aMediator);
nsIScrollbarMediator* GetScrollbarMediator();
// nsBox methods