mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 732610 - Make nsIFrame::ComputeSize take a bitfield 'aFlags' instead of a bool 'aShrinkWrap'. r=dbaron
This commit is contained in:
parent
7f9923f96d
commit
7dcfb057c4
@ -85,7 +85,7 @@ public:
|
||||
virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
||||
bool aShrinkWrap);
|
||||
PRUint32 aFlags) MOZ_OVERRIDE;
|
||||
virtual nscoord GetBaseline() const;
|
||||
virtual void DestroyFrom(nsIFrame* aDestructRoot);
|
||||
|
||||
@ -399,11 +399,11 @@ nsFieldSetFrame::GetPrefWidth(nsRenderingContext* aRenderingContext)
|
||||
nsFieldSetFrame::ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
||||
bool aShrinkWrap)
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
nsSize result =
|
||||
nsContainerFrame::ComputeSize(aRenderingContext, aCBSize, aAvailableWidth,
|
||||
aMargin, aBorder, aPadding, aShrinkWrap);
|
||||
aMargin, aBorder, aPadding, aFlags);
|
||||
|
||||
// Fieldsets never shrink below their min width.
|
||||
|
||||
|
@ -180,7 +180,7 @@ nsFirstLetterFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
|
||||
nsFirstLetterFrame::ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
||||
bool aShrinkWrap)
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
if (GetPrevInFlow()) {
|
||||
// We're wrapping the text *after* the first letter, so behave like an
|
||||
@ -188,7 +188,7 @@ nsFirstLetterFrame::ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
return nsSize(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
|
||||
}
|
||||
return nsContainerFrame::ComputeSize(aRenderingContext,
|
||||
aCBSize, aAvailableWidth, aMargin, aBorder, aPadding, aShrinkWrap);
|
||||
aCBSize, aAvailableWidth, aMargin, aBorder, aPadding, aFlags);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -83,7 +83,7 @@ public:
|
||||
virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
||||
bool aShrinkWrap);
|
||||
PRUint32 aFlags) MOZ_OVERRIDE;
|
||||
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
|
@ -3741,10 +3741,11 @@ nsFrame::GetIntrinsicRatio()
|
||||
nsFrame::ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
||||
bool aShrinkWrap)
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
nsSize result = ComputeAutoSize(aRenderingContext, aCBSize, aAvailableWidth,
|
||||
aMargin, aBorder, aPadding, aShrinkWrap);
|
||||
aMargin, aBorder, aPadding,
|
||||
aFlags & eShrinkWrap);
|
||||
nsSize boxSizingAdjust(0,0);
|
||||
const nsStylePosition *stylePos = GetStylePosition();
|
||||
|
||||
|
@ -294,7 +294,7 @@ public:
|
||||
virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
||||
bool aShrinkWrap);
|
||||
PRUint32 aFlags) MOZ_OVERRIDE;
|
||||
|
||||
// Compute tight bounds assuming this frame honours its border, background
|
||||
// and outline, its children's tight bounds, and nothing else.
|
||||
|
@ -195,7 +195,7 @@ nsHTMLCanvasFrame::GetIntrinsicRatio()
|
||||
nsHTMLCanvasFrame::ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
||||
bool aShrinkWrap)
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
nsIntSize size = GetCanvasSize();
|
||||
|
||||
|
@ -84,7 +84,7 @@ public:
|
||||
virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
||||
bool aShrinkWrap);
|
||||
PRUint32 aFlags) MOZ_OVERRIDE;
|
||||
|
||||
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
|
@ -1238,7 +1238,11 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsPresContext* aPresContext,
|
||||
bool widthIsAuto = eStyleUnit_Auto == mStylePosition->mWidth.GetUnit();
|
||||
bool heightIsAuto = eStyleUnit_Auto == mStylePosition->mHeight.GetUnit();
|
||||
|
||||
bool shrinkWrap = leftIsAuto || rightIsAuto;
|
||||
PRUint32 computeSizeFlags = 0;
|
||||
if (leftIsAuto || rightIsAuto) {
|
||||
computeSizeFlags |= nsIFrame::eShrinkWrap;
|
||||
}
|
||||
|
||||
{
|
||||
AutoMaybeNullInflationContainer an(frame);
|
||||
|
||||
@ -1257,7 +1261,7 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsPresContext* aPresContext,
|
||||
mComputedPadding.TopBottom()),
|
||||
nsSize(mComputedPadding.LeftRight(),
|
||||
mComputedPadding.TopBottom()),
|
||||
shrinkWrap);
|
||||
computeSizeFlags);
|
||||
mComputedWidth = size.width;
|
||||
mComputedHeight = size.height;
|
||||
}
|
||||
@ -1868,7 +1872,12 @@ nsHTMLReflowState::InitConstraints(nsPresContext* aPresContext,
|
||||
NS_CSS_FRAME_TYPE_BLOCK == NS_FRAME_GET_TYPE(mFrameType);
|
||||
// make sure legend frames with display:block and width:auto still
|
||||
// shrink-wrap
|
||||
bool shrinkWrap = !isBlock || aFrameType == nsGkAtoms::legendFrame;
|
||||
|
||||
PRUint32 computeSizeFlags = 0;
|
||||
if (!isBlock || aFrameType == nsGkAtoms::legendFrame) {
|
||||
computeSizeFlags |= nsIFrame::eShrinkWrap;
|
||||
}
|
||||
|
||||
nsSize size =
|
||||
frame->ComputeSize(rendContext,
|
||||
nsSize(aContainingBlockWidth,
|
||||
@ -1882,7 +1891,7 @@ nsHTMLReflowState::InitConstraints(nsPresContext* aPresContext,
|
||||
mComputedPadding.TopBottom()),
|
||||
nsSize(mComputedPadding.LeftRight(),
|
||||
mComputedPadding.TopBottom()),
|
||||
shrinkWrap);
|
||||
computeSizeFlags);
|
||||
|
||||
mComputedWidth = size.width;
|
||||
mComputedHeight = size.height;
|
||||
|
@ -1651,6 +1651,16 @@ public:
|
||||
*/
|
||||
virtual nsSize GetIntrinsicRatio() = 0;
|
||||
|
||||
/**
|
||||
* Bit-flags to pass to ComputeSize in |aFlags| parameter.
|
||||
*/
|
||||
enum {
|
||||
/* Set if the frame is in a context where non-replaced blocks should
|
||||
* shrink-wrap (e.g., it's floating, absolutely positioned, or
|
||||
* inline-block). */
|
||||
eShrinkWrap = 1 << 0
|
||||
};
|
||||
|
||||
/**
|
||||
* Compute the size that a frame will occupy. Called while
|
||||
* constructing the nsHTMLReflowState to be used to Reflow the frame,
|
||||
@ -1682,18 +1692,15 @@ public:
|
||||
* positioning.
|
||||
* @param aBorder The sum of the vertical / horizontal border widths
|
||||
* of the frame.
|
||||
* @param aPadding The sum of the vertical / horizontal margins of
|
||||
* the frame, including actual values resulting from
|
||||
* percentages.
|
||||
* @param aShrinkWrap Whether the frame is in a context where
|
||||
* non-replaced blocks should shrink-wrap (e.g.,
|
||||
* it's floating, absolutely positioned, or
|
||||
* inline-block).
|
||||
* @param aPadding The sum of the vertical / horizontal margins of
|
||||
* the frame, including actual values resulting from
|
||||
* percentages.
|
||||
* @param aFlags Flags to further customize behavior (definitions above).
|
||||
*/
|
||||
virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
||||
bool aShrinkWrap) = 0;
|
||||
PRUint32 aFlags) = 0;
|
||||
|
||||
/**
|
||||
* Compute a tight bounding rectangle for the frame. This is a rectangle
|
||||
|
@ -765,7 +765,7 @@ nsImageFrame::EnsureIntrinsicSizeAndRatio(nsPresContext* aPresContext)
|
||||
nsImageFrame::ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
||||
bool aShrinkWrap)
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
nsPresContext *presContext = PresContext();
|
||||
EnsureIntrinsicSizeAndRatio(presContext);
|
||||
|
@ -215,7 +215,7 @@ protected:
|
||||
virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
||||
bool aShrinkWrap);
|
||||
PRUint32 aFlags) MOZ_OVERRIDE;
|
||||
|
||||
bool IsServerImageMap();
|
||||
|
||||
|
@ -233,7 +233,7 @@ nsInlineFrame::AddInlinePrefWidth(nsRenderingContext *aRenderingContext,
|
||||
nsInlineFrame::ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
||||
bool aShrinkWrap)
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
// Inlines and text don't compute size before reflow.
|
||||
return nsSize(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
|
||||
|
@ -112,7 +112,7 @@ public:
|
||||
virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
||||
bool aShrinkWrap);
|
||||
PRUint32 aFlags) MOZ_OVERRIDE;
|
||||
virtual nsRect ComputeTightBounds(gfxContext* aContext) const;
|
||||
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
|
@ -60,7 +60,7 @@ NS_IMPL_FRAMEARENA_HELPERS(nsPageContentFrame)
|
||||
nsPageContentFrame::ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
||||
bool aShrinkWrap)
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
NS_ASSERTION(mPD, "Pages are supposed to have page data");
|
||||
nscoord height = (!mPD || mPD->mReflowSize.height == NS_UNCONSTRAINEDSIZE)
|
||||
|
@ -71,7 +71,7 @@ public:
|
||||
virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
||||
bool aShrinkWrap);
|
||||
PRUint32 aFlags) MOZ_OVERRIDE;
|
||||
|
||||
/**
|
||||
* Get the "type" of the frame
|
||||
|
@ -546,7 +546,7 @@ nsSubDocumentFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
|
||||
nsSubDocumentFrame::ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
||||
bool aShrinkWrap)
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
nsIFrame* subDocRoot = ObtainIntrinsicSizeFrame();
|
||||
if (subDocRoot) {
|
||||
@ -557,7 +557,7 @@ nsSubDocumentFrame::ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
aCBSize, aMargin, aBorder, aPadding);
|
||||
}
|
||||
return nsLeafFrame::ComputeSize(aRenderingContext, aCBSize, aAvailableWidth,
|
||||
aMargin, aBorder, aPadding, aShrinkWrap);
|
||||
aMargin, aBorder, aPadding, aFlags);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -89,7 +89,7 @@ public:
|
||||
virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
||||
bool aShrinkWrap);
|
||||
PRUint32 aFlags) MOZ_OVERRIDE;
|
||||
|
||||
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
|
@ -241,7 +241,7 @@ public:
|
||||
virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
||||
bool aShrinkWrap);
|
||||
PRUint32 aFlags) MOZ_OVERRIDE;
|
||||
virtual nsRect ComputeTightBounds(gfxContext* aContext) const;
|
||||
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
|
@ -6868,7 +6868,7 @@ nsTextFrame::AddInlinePrefWidth(nsRenderingContext *aRenderingContext,
|
||||
nsTextFrame::ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
||||
bool aShrinkWrap)
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
// Inlines and text don't compute size before reflow.
|
||||
return nsSize(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
|
||||
|
@ -450,7 +450,7 @@ nsSize nsVideoFrame::ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
nsSize aMargin,
|
||||
nsSize aBorder,
|
||||
nsSize aPadding,
|
||||
bool aShrinkWrap)
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
nsSize size = GetVideoIntrinsicSize(aRenderingContext);
|
||||
|
||||
|
@ -81,7 +81,7 @@ public:
|
||||
virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
||||
bool aShrinkWrap);
|
||||
PRUint32 aFlags) MOZ_OVERRIDE;
|
||||
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
|
||||
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
|
||||
virtual void DestroyFrom(nsIFrame* aDestructRoot);
|
||||
|
@ -309,7 +309,7 @@ nsSVGOuterSVGFrame::GetIntrinsicRatio()
|
||||
nsSVGOuterSVGFrame::ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
||||
bool aShrinkWrap)
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
nsSVGSVGElement* content = static_cast<nsSVGSVGElement*>(mContent);
|
||||
|
||||
|
@ -81,7 +81,7 @@ public:
|
||||
virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
||||
bool aShrinkWrap);
|
||||
PRUint32 aFlags) MOZ_OVERRIDE;
|
||||
|
||||
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
|
@ -1509,11 +1509,11 @@ nsTableFrame::IntrinsicWidthOffsets(nsRenderingContext* aRenderingContext)
|
||||
nsTableFrame::ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
||||
bool aShrinkWrap)
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
nsSize result =
|
||||
nsContainerFrame::ComputeSize(aRenderingContext, aCBSize, aAvailableWidth,
|
||||
aMargin, aBorder, aPadding, aShrinkWrap);
|
||||
aMargin, aBorder, aPadding, aFlags);
|
||||
|
||||
// If we're a container for font size inflation, then shrink
|
||||
// wrapping inside of us should not apply font size inflation.
|
||||
|
@ -309,7 +309,7 @@ public:
|
||||
virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
||||
bool aShrinkWrap);
|
||||
PRUint32 aFlags) MOZ_OVERRIDE;
|
||||
virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder,
|
||||
|
Loading…
Reference in New Issue
Block a user