--- a/layout/generic/ReflowInput.cpp
+++ b/layout/generic/ReflowInput.cpp
@@ -53,17 +53,17 @@ static eNormalLineHeightControl sNormalL
// Initialize a <b>root</b> reflow state with a rendering context to
// use for measuring things.
ReflowInput::ReflowInput(nsPresContext* aPresContext,
nsIFrame* aFrame,
nsRenderingContext* aRenderingContext,
const LogicalSize& aAvailableSpace,
uint32_t aFlags)
- : nsCSSOffsetState(aFrame, aRenderingContext)
+ : SizeComputationInput(aFrame, aRenderingContext)
, 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");
@@ -140,52 +140,52 @@ FontSizeInflationListMarginAdjustment(co
}
}
}
return 0;
}
-// NOTE: If we ever want to use nsCSSOffsetState for a flex item or a
+// NOTE: If we ever want to use SizeComputationInput for a flex item or a
// grid item, we need to make it take the containing-block block-size as
// well as the inline-size, since flex items and grid items resolve
// block-direction percent margins and padding against the
// containing-block block-size, rather than its inline-size.
-nsCSSOffsetState::nsCSSOffsetState(nsIFrame *aFrame,
+SizeComputationInput::SizeComputationInput(nsIFrame *aFrame,
nsRenderingContext *aRenderingContext,
WritingMode aContainingBlockWritingMode,
nscoord aContainingBlockISize)
: frame(aFrame)
, rendContext(aRenderingContext)
, mWritingMode(aFrame->GetWritingMode())
{
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 nsCSSOffsetState::InitOffsets");
+ "padding contribution - see SizeComputationInput::InitOffsets");
LogicalSize cbSize(aContainingBlockWritingMode, aContainingBlockISize,
aContainingBlockISize);
ReflowStateFlags flags;
InitOffsets(aContainingBlockWritingMode, cbSize, frame->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,
nsIFrame* aFrame,
const LogicalSize& aAvailableSpace,
const LogicalSize* aContainingBlockSize,
uint32_t aFlags)
- : nsCSSOffsetState(aFrame, aParentReflowState.rendContext)
+ : SizeComputationInput(aFrame, aParentReflowState.rendContext)
, mBlockDelta(0)
, mOrthogonalLimit(NS_UNCONSTRAINEDSIZE)
, mReflowDepth(aParentReflowState.mReflowDepth + 1)
, mFlags(aParentReflowState.mFlags)
{
MOZ_ASSERT(aPresContext, "no pres context");
MOZ_ASSERT(aFrame, "no frame");
MOZ_ASSERT(aPresContext == aFrame->PresContext(), "wrong pres context");
@@ -246,47 +246,47 @@ ReflowInput::ReflowInput(
}
if (!(aFlags & CALLER_WILL_INIT)) {
Init(aPresContext, aContainingBlockSize);
}
}
inline nscoord
-nsCSSOffsetState::ComputeISizeValue(nscoord aContainingBlockISize,
+SizeComputationInput::ComputeISizeValue(nscoord aContainingBlockISize,
nscoord aContentEdgeToBoxSizing,
nscoord aBoxSizingToMarginEdge,
const nsStyleCoord& aCoord) const
{
return nsLayoutUtils::ComputeISizeValue(rendContext, frame,
aContainingBlockISize,
aContentEdgeToBoxSizing,
aBoxSizingToMarginEdge,
aCoord);
}
nscoord
-nsCSSOffsetState::ComputeISizeValue(nscoord aContainingBlockISize,
+SizeComputationInput::ComputeISizeValue(nscoord aContainingBlockISize,
StyleBoxSizing aBoxSizing,
const nsStyleCoord& aCoord) const
{
WritingMode wm = GetWritingMode();
nscoord inside = 0, outside = ComputedLogicalBorderPadding().IStartEnd(wm) +
ComputedLogicalMargin().IStartEnd(wm);
if (aBoxSizing == StyleBoxSizing::Border) {
inside = ComputedLogicalBorderPadding().IStartEnd(wm);
}
outside -= inside;
return ComputeISizeValue(aContainingBlockISize, inside,
outside, aCoord);
}
nscoord
-nsCSSOffsetState::ComputeBSizeValue(nscoord aContainingBlockBSize,
+SizeComputationInput::ComputeBSizeValue(nscoord aContainingBlockBSize,
StyleBoxSizing aBoxSizing,
const nsStyleCoord& aCoord) const
{
WritingMode wm = GetWritingMode();
nscoord inside = 0;
if (aBoxSizing == StyleBoxSizing::Border) {
inside = ComputedLogicalBorderPadding().BStartEnd(wm);
}
@@ -2406,17 +2406,17 @@ UpdateProp(FrameProperties& aProps,
aProps.Set(aProperty, new nsMargin(aNewValue));
}
} else {
aProps.Delete(aProperty);
}
}
void
-nsCSSOffsetState::InitOffsets(WritingMode aWM,
+SizeComputationInput::InitOffsets(WritingMode aWM,
const LogicalSize& aPercentBasis,
nsIAtom* aFrameType,
ReflowStateFlags aFlags,
const nsMargin* aBorder,
const nsMargin* aPadding)
{
DISPLAY_INIT_OFFSETS(frame, this, aPercentBasis, aBorder, aPadding);
@@ -2777,17 +2777,17 @@ ReflowInput::CalcLineHeight(nsIContent*
lineHeight = lineHeightOne;
}
}
return lineHeight;
}
bool
-nsCSSOffsetState::ComputeMargin(WritingMode aWM,
+SizeComputationInput::ComputeMargin(WritingMode aWM,
const LogicalSize& aPercentBasis)
{
// SVG text frames have no margin.
if (frame->IsSVGText()) {
return false;
}
// If style style can provide us the margin directly, then use it.
@@ -2825,17 +2825,17 @@ nsCSSOffsetState::ComputeMargin(WritingM
m.IStart(mWritingMode) += marginAdjustment;
SetComputedLogicalMargin(m);
}
return isCBDependent;
}
bool
-nsCSSOffsetState::ComputePadding(WritingMode aWM,
+SizeComputationInput::ComputePadding(WritingMode aWM,
const LogicalSize& aPercentBasis,
nsIAtom* aFrameType)
{
// If style can provide us the padding directly, then use it.
const nsStylePadding *stylePadding = frame->StylePadding();
bool isCBDependent = !stylePadding->GetPadding(ComputedPhysicalPadding());
// a table row/col group, row/col doesn't have padding
// XXXldb Neither do border-collapse tables.
--- a/layout/generic/ReflowInput.h
+++ b/layout/generic/ReflowInput.h
@@ -93,17 +93,17 @@ typedef uint32_t nsCSSFrameType;
#define NS_FRAME_GET_TYPE(_ft) \
((_ft) & ~(NS_CSS_FRAME_TYPE_REPLACED | \
NS_CSS_FRAME_TYPE_REPLACED_CONTAINS_BLOCK))
namespace mozilla {
// A base class of ReflowInput that computes only the padding,
// border, and margin, since those values are needed more often.
-struct nsCSSOffsetState {
+struct SizeComputationInput {
public:
typedef mozilla::WritingMode WritingMode;
typedef mozilla::LogicalMargin LogicalMargin;
// the frame being reflowed
nsIFrame* frame;
// rendering context to use for measurement
@@ -159,24 +159,24 @@ protected:
// Cached copy of the border + padding values
nsMargin mComputedBorderPadding;
// Computed padding values
nsMargin mComputedPadding;
public:
// Callers using this constructor must call InitOffsets on their own.
- nsCSSOffsetState(nsIFrame *aFrame, nsRenderingContext *aRenderingContext)
+ SizeComputationInput(nsIFrame *aFrame, nsRenderingContext *aRenderingContext)
: frame(aFrame)
, rendContext(aRenderingContext)
, mWritingMode(aFrame->GetWritingMode())
{
}
- nsCSSOffsetState(nsIFrame *aFrame, nsRenderingContext *aRenderingContext,
+ SizeComputationInput(nsIFrame *aFrame, nsRenderingContext *aRenderingContext,
mozilla::WritingMode aContainingBlockWritingMode,
nscoord aContainingBlockISize);
struct ReflowStateFlags {
ReflowStateFlags() { 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)
@@ -220,22 +220,22 @@ public:
uint16_t mStaticPosIsCBOrigin:1; // the STATIC_POS_IS_CB_ORIGIN ctor flag
};
#ifdef DEBUG
// Reflow trace methods. Defined in nsFrame.cpp so they have access
// to the display-reflow infrastructure.
static void* DisplayInitOffsetsEnter(
nsIFrame* aFrame,
- nsCSSOffsetState* aState,
+ SizeComputationInput* aState,
const mozilla::LogicalSize& aPercentBasis,
const nsMargin* aBorder,
const nsMargin* aPadding);
static void DisplayInitOffsetsExit(nsIFrame* aFrame,
- nsCSSOffsetState* aState,
+ SizeComputationInput* aState,
void* aValue);
#endif
private:
/**
* Computes margin values from the specified margin style information, and
* fills in the mComputedMargin member.
*
@@ -309,17 +309,17 @@ protected:
/**
* State passed to a frame during reflow or intrinsic size calculation.
*
* XXX Refactor so only a base class (nsSizingState?) is used for intrinsic
* size calculation.
*
* @see nsIFrame#Reflow()
*/
-struct ReflowInput : public nsCSSOffsetState {
+struct ReflowInput : public SizeComputationInput {
// the reflow states are linked together. this is the pointer to the
// parent's reflow state
const ReflowInput* mParentReflowState;
// pointer to the float manager associated with this area
nsFloatManager* mFloatManager;
// LineLayout object (only for inline reflow; set to nullptr otherwise)
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -7393,31 +7393,31 @@ nsBlockFrame::BlockCanIntersectFloats(ns
/* static */
nsBlockFrame::ReplacedElementISizeToClear
nsBlockFrame::ISizeToClearPastFloats(const nsBlockReflowState& aState,
const LogicalRect& aFloatAvailableSpace,
nsIFrame* aFrame)
{
nscoord inlineStartOffset, inlineEndOffset;
WritingMode wm = aState.mReflowState.GetWritingMode();
- nsCSSOffsetState offsetState(aFrame, aState.mReflowState.rendContext,
+ SizeComputationInput offsetState(aFrame, aState.mReflowState.rendContext,
wm, aState.mContentArea.ISize(wm));
ReplacedElementISizeToClear result;
aState.ComputeReplacedBlockOffsetsForFloats(aFrame, aFloatAvailableSpace,
inlineStartOffset,
inlineEndOffset);
nscoord availISize = aState.mContentArea.ISize(wm) -
inlineStartOffset - inlineEndOffset;
// We actually don't want the min width here; see bug 427782; we only
// 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 nsCSSOffsetState, except for the
+ // 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,
aFrame, availSpace);
result.borderBoxISize =
reflowState.ComputedSizeWithBorderPadding().ConvertTo(wm, frWM).ISize(wm);
--- a/layout/generic/nsBlockReflowState.cpp
+++ b/layout/generic/nsBlockReflowState.cpp
@@ -176,17 +176,17 @@ nsBlockReflowState::ComputeReplacedBlock
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);
- nsCSSOffsetState os(aFrame, mReflowState.rendContext,
+ SizeComputationInput os(aFrame, mReflowState.rendContext,
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);
@@ -204,17 +204,17 @@ nsBlockReflowState::ComputeReplacedBlock
static nscoord
GetBEndMarginClone(nsIFrame* aFrame,
nsRenderingContext* aRenderingContext,
const LogicalRect& aContentArea,
WritingMode aWritingMode)
{
if (aFrame->StyleBorder()->mBoxDecorationBreak ==
NS_STYLE_BOX_DECORATION_BREAK_CLONE) {
- nsCSSOffsetState os(aFrame, aRenderingContext, aWritingMode,
+ SizeComputationInput os(aFrame, aRenderingContext, aWritingMode,
aContentArea.ISize(aWritingMode));
return os.ComputedLogicalMargin().
ConvertTo(aWritingMode,
aFrame->GetWritingMode()).BEnd(aWritingMode);
}
return 0;
}
@@ -674,17 +674,17 @@ nsBlockReflowState::CanPlaceFloat(nscoor
// 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,
nscoord aFloatAvailableISize,
nsIFrame *aFloat,
- const nsCSSOffsetState& aFloatOffsetState)
+ const SizeComputationInput& aFloatOffsetState)
{
AutoMaybeDisableFontInflation an(aFloat);
WritingMode wm = aFloatOffsetState.GetWritingMode();
LogicalSize floatSize =
aFloat->ComputeSize(
aCBReflowState.rendContext,
wm,
@@ -741,17 +741,17 @@ nsBlockReflowState::FlowAndPlaceFloat(ns
// 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");
- nsCSSOffsetState offsets(aFloat, mReflowState.rendContext,
+ SizeComputationInput offsets(aFloat, mReflowState.rendContext,
wm, mReflowState.ComputedISize());
nscoord floatMarginISize = FloatMarginISize(mReflowState,
adjustedAvailableSpace.ISize(wm),
aFloat, offsets);
LogicalMargin floatMargin(wm); // computed margin
LogicalMargin floatOffsets(wm);
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -9692,33 +9692,33 @@ DR_init_constraints_cookie::DR_init_cons
DR_init_constraints_cookie::~DR_init_constraints_cookie()
{
MOZ_COUNT_DTOR(DR_init_constraints_cookie);
ReflowInput::DisplayInitConstraintsExit(mFrame, mState, mValue);
}
DR_init_offsets_cookie::DR_init_offsets_cookie(
nsIFrame* aFrame,
- nsCSSOffsetState* aState,
+ SizeComputationInput* aState,
const LogicalSize& aPercentBasis,
const nsMargin* aMargin,
const nsMargin* aPadding)
: mFrame(aFrame)
, mState(aState)
{
MOZ_COUNT_CTOR(DR_init_offsets_cookie);
- mValue = nsCSSOffsetState::DisplayInitOffsetsEnter(mFrame, mState,
+ mValue = SizeComputationInput::DisplayInitOffsetsEnter(mFrame, mState,
aPercentBasis,
aMargin, aPadding);
}
DR_init_offsets_cookie::~DR_init_offsets_cookie()
{
MOZ_COUNT_DTOR(DR_init_offsets_cookie);
- nsCSSOffsetState::DisplayInitOffsetsExit(mFrame, mState, mValue);
+ SizeComputationInput::DisplayInitOffsetsExit(mFrame, mState, mValue);
}
DR_init_type_cookie::DR_init_type_cookie(
nsIFrame* aFrame,
ReflowInput* aState)
: mFrame(aFrame)
, mState(aState)
{
@@ -10644,18 +10644,18 @@ ReflowInput::DisplayInitConstraintsExit(
DR_state->PrintMargin("co", &aState->ComputedPhysicalOffsets());
putchar('\n');
}
DR_state->DeleteTreeNode(*treeNode);
}
/* static */ void*
-nsCSSOffsetState::DisplayInitOffsetsEnter(nsIFrame* aFrame,
- nsCSSOffsetState* aState,
+SizeComputationInput::DisplayInitOffsetsEnter(nsIFrame* aFrame,
+ SizeComputationInput* aState,
const LogicalSize& aPercentBasis,
const nsMargin* aBorder,
const nsMargin* aPadding)
{
NS_PRECONDITION(aFrame, "non-null frame required");
NS_PRECONDITION(aState, "non-null state required");
if (!DR_state->mInited) DR_state->Init();
@@ -10676,18 +10676,18 @@ nsCSSOffsetState::DisplayInitOffsetsEnte
DR_state->PrintMargin("b", aBorder);
DR_state->PrintMargin("p", aPadding);
putchar('\n');
}
return treeNode;
}
/* static */ void
-nsCSSOffsetState::DisplayInitOffsetsExit(nsIFrame* aFrame,
- nsCSSOffsetState* aState,
+SizeComputationInput::DisplayInitOffsetsExit(nsIFrame* aFrame,
+ SizeComputationInput* aState,
void* aValue)
{
NS_PRECONDITION(aFrame, "non-null frame required");
NS_PRECONDITION(aState, "non-null state required");
if (!DR_state->mActive) return;
if (!aValue) return;
--- a/layout/generic/nsFrame.h
+++ b/layout/generic/nsFrame.h
@@ -821,24 +821,24 @@ public:
~DR_init_constraints_cookie();
nsIFrame* mFrame;
mozilla::ReflowInput* mState;
void* mValue;
};
struct DR_init_offsets_cookie {
- DR_init_offsets_cookie(nsIFrame* aFrame, mozilla::nsCSSOffsetState* aState,
+ DR_init_offsets_cookie(nsIFrame* aFrame, mozilla::SizeComputationInput* aState,
const mozilla::LogicalSize& aPercentBasis,
const nsMargin* aBorder,
const nsMargin* aPadding);
~DR_init_offsets_cookie();
nsIFrame* mFrame;
- mozilla::nsCSSOffsetState* mState;
+ mozilla::SizeComputationInput* mState;
void* mValue;
};
struct DR_init_type_cookie {
DR_init_type_cookie(nsIFrame* aFrame, mozilla::ReflowInput* aState);
~DR_init_type_cookie();
nsIFrame* mFrame;
--- a/layout/generic/nsGridContainerFrame.cpp
+++ b/layout/generic/nsGridContainerFrame.cpp
@@ -4647,17 +4647,17 @@ nsGridContainerFrame::ReflowInFlowChild(
toFragmentainerEnd = aFragmentainer->mToFragmentainerEnd -
aState.mFragBStart - cb.BStart(wm);
toFragmentainerEnd = std::max(toFragmentainerEnd, 0);
}
cb += aContentArea.Origin(wm);
aState.mRows.AlignBaselineSubtree(*aGridItemInfo);
aState.mCols.AlignBaselineSubtree(*aGridItemInfo);
// Setup [align|justify]-content:[last-]baseline related frame properties.
- // These are added to the padding in nsCSSOffsetState::InitOffsets.
+ // These are added to the padding in SizeComputationInput::InitOffsets.
// (a negative value signals the value is for 'last-baseline' and should be
// added to the (logical) end padding)
typedef const FramePropertyDescriptor<SmallValueHolder<nscoord>>* Prop;
auto SetProp = [aGridItemInfo, aChild] (LogicalAxis aGridAxis,
Prop aProp) {
auto state = aGridItemInfo->mState[aGridAxis];
auto baselineAdjust = (state & ItemState::eContentBaseline) ?
aGridItemInfo->mBaselineOffset[aGridAxis] : nscoord(0);
--- a/layout/mathml/nsMathMLSelectedFrame.cpp
+++ b/layout/mathml/nsMathMLSelectedFrame.cpp
@@ -112,17 +112,17 @@ nsMathMLSelectedFrame::ComputeSize(nsRen
nsIFrame* childFrame = GetSelectedFrame();
if (childFrame) {
// Delegate size computation to the child frame.
// Try to account for border/padding/margin on this frame and the child,
// though we don't really support them during reflow anyway...
nscoord availableISize = aAvailableISize - aBorder.ISize(aWM) -
aPadding.ISize(aWM) - aMargin.ISize(aWM);
LogicalSize cbSize = aCBSize - aBorder - aPadding - aMargin;
- nsCSSOffsetState offsetState(childFrame, aRenderingContext, aWM,
+ SizeComputationInput offsetState(childFrame, aRenderingContext, aWM,
availableISize);
LogicalSize size =
childFrame->ComputeSize(aRenderingContext, aWM, cbSize,
availableISize, offsetState.ComputedLogicalMargin().Size(aWM),
offsetState.ComputedLogicalBorderPadding().Size(aWM) -
offsetState.ComputedLogicalPadding().Size(aWM),
offsetState.ComputedLogicalPadding().Size(aWM),
aFlags);
--- a/layout/tables/nsTableWrapperFrame.cpp
+++ b/layout/tables/nsTableWrapperFrame.cpp
@@ -369,17 +369,17 @@ ChildShrinkWrapISize(nsRenderingContext
LogicalSize aCBSize, nscoord aAvailableISize,
nscoord *aMarginResult = nullptr)
{
AutoMaybeDisableFontInflation an(aChildFrame);
// For the caption frame, child's WM may differ from the table's main WM.
WritingMode childWM = aChildFrame->GetWritingMode();
- nsCSSOffsetState offsets(aChildFrame, aRenderingContext, aWM,
+ SizeComputationInput offsets(aChildFrame, aRenderingContext, aWM,
aCBSize.ISize(aWM));
LogicalSize marginSize =
offsets.ComputedLogicalMargin().Size(childWM).ConvertTo(aWM, childWM);
LogicalSize paddingSize =
offsets.ComputedLogicalPadding().Size(childWM).ConvertTo(aWM, childWM);
LogicalSize bpSize =
offsets.ComputedLogicalBorderPadding().Size(childWM).ConvertTo(aWM,
childWM);