Bug 1064843 part 3 - Make nsFormControlFrame inherit nsContainerFrame. r=dholbert

This commit is contained in:
Xidorn Quan
2016-01-28 10:11:00 +11:00
parent e5a48bd3df
commit ccf8c97853
3 changed files with 88 additions and 12 deletions

View File

@@ -18,7 +18,7 @@ using namespace mozilla;
//#define FCF_NOISY
nsFormControlFrame::nsFormControlFrame(nsStyleContext* aContext) :
nsLeafFrame(aContext)
nsFormControlFrameSuper(aContext)
{
}
@@ -37,12 +37,46 @@ nsFormControlFrame::DestroyFrom(nsIFrame* aDestructRoot)
{
// Unregister the access key registered in reflow
nsFormControlFrame::RegUnRegAccessKey(static_cast<nsIFrame*>(this), false);
nsLeafFrame::DestroyFrom(aDestructRoot);
nsFormControlFrameSuper::DestroyFrom(aDestructRoot);
}
NS_QUERYFRAME_HEAD(nsFormControlFrame)
NS_QUERYFRAME_ENTRY(nsIFormControlFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsLeafFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsFormControlFrameSuper)
/* virtual */ nscoord
nsFormControlFrame::GetMinISize(nsRenderingContext *aRenderingContext)
{
nscoord result;
DISPLAY_MIN_WIDTH(this, result);
result = GetIntrinsicISize();
return result;
}
/* virtual */ nscoord
nsFormControlFrame::GetPrefISize(nsRenderingContext *aRenderingContext)
{
nscoord result;
DISPLAY_PREF_WIDTH(this, result);
result = GetIntrinsicISize();
return result;
}
/* virtual */
LogicalSize
nsFormControlFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
WritingMode aWM,
const LogicalSize& aCBSize,
nscoord aAvailableISize,
const LogicalSize& aMargin,
const LogicalSize& aBorder,
const LogicalSize& aPadding,
bool aShrinkWrap)
{
const WritingMode wm = GetWritingMode();
LogicalSize result(wm, GetIntrinsicISize(), GetIntrinsicBSize());
return result.ConvertTo(aWM, wm);
}
nscoord
nsFormControlFrame::GetIntrinsicISize()
@@ -84,22 +118,34 @@ nsFormControlFrame::Reflow(nsPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsFormControlFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("enter nsFormControlFrame::Reflow: aMaxSize=%d,%d",
aReflowState.AvailableWidth(), aReflowState.AvailableHeight()));
if (mState & NS_FRAME_FIRST_REFLOW) {
RegUnRegAccessKey(static_cast<nsIFrame*>(this), true);
}
nsLeafFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
aStatus = NS_FRAME_COMPLETE;
aDesiredSize.SetSize(aReflowState.GetWritingMode(),
aReflowState.ComputedSizeWithBorderPadding());
if (nsLayoutUtils::FontSizeInflationEnabled(aPresContext)) {
float inflation = nsLayoutUtils::FontSizeInflationFor(this);
aDesiredSize.Width() *= inflation;
aDesiredSize.Height() *= inflation;
aDesiredSize.UnionOverflowAreasWithDesiredBounds();
FinishAndStoreOverflow(&aDesiredSize);
}
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("exit nsFormControlFrame::Reflow: size=%d,%d",
aDesiredSize.Width(), aDesiredSize.Height()));
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
aDesiredSize.SetOverflowAreasToDesiredBounds();
FinishAndStoreOverflow(&aDesiredSize);
}
nsresult