// 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 nsHTMLReflowState& aCBReflowState, nscoord aFloatAvailableISize, nsIFrame *aFloat, const nsCSSOffsetState& aFloatOffsetState) { AutoMaybeDisableFontInflation an(aFloat); WritingMode wm = aFloatOffsetState.GetWritingMode(); LogicalSize floatSize = aFloat->ComputeSize( aCBReflowState.rendContext, wm, aCBReflowState.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(); 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); }
static nscoord FloatMarginWidth(const nsHTMLReflowState& aCBReflowState, nscoord aFloatAvailableWidth, nsIFrame *aFloat, const nsCSSOffsetState& aFloatOffsetState) { AutoMaybeDisableFontInflation an(aFloat); return aFloat->ComputeSize( aCBReflowState.rendContext, nsSize(aCBReflowState.ComputedWidth(), aCBReflowState.ComputedHeight()), aFloatAvailableWidth, nsSize(aFloatOffsetState.ComputedPhysicalMargin().LeftRight(), aFloatOffsetState.ComputedPhysicalMargin().TopBottom()), nsSize(aFloatOffsetState.ComputedPhysicalBorderPadding().LeftRight() - aFloatOffsetState.ComputedPhysicalPadding().LeftRight(), aFloatOffsetState.ComputedPhysicalBorderPadding().TopBottom() - aFloatOffsetState.ComputedPhysicalPadding().TopBottom()), nsSize(aFloatOffsetState.ComputedPhysicalPadding().LeftRight(), aFloatOffsetState.ComputedPhysicalPadding().TopBottom()), true).width + aFloatOffsetState.ComputedPhysicalMargin().LeftRight() + aFloatOffsetState.ComputedPhysicalBorderPadding().LeftRight(); }
static nscoord FloatMarginWidth(const nsHTMLReflowState& aCBReflowState, nscoord aFloatAvailableWidth, nsIFrame *aFloat, const nsCSSOffsetState& aFloatOffsetState) { AutoMaybeDisableFontInflation an(aFloat); WritingMode fosWM = aFloatOffsetState.GetWritingMode(); return aFloat->ComputeSize( aCBReflowState.rendContext, fosWM, aCBReflowState.ComputedSize(fosWM), aFloatAvailableWidth, aFloatOffsetState.ComputedLogicalMargin().Size(fosWM), aFloatOffsetState.ComputedLogicalBorderPadding().Size(fosWM) - aFloatOffsetState.ComputedLogicalPadding().Size(fosWM), aFloatOffsetState.ComputedLogicalPadding().Size(fosWM), true).Width(fosWM) + aFloatOffsetState.ComputedPhysicalMargin().LeftRight() + aFloatOffsetState.ComputedPhysicalBorderPadding().LeftRight(); }