diff --git a/layout/html/forms/src/nsGfxTextControlFrame2.cpp b/layout/html/forms/src/nsGfxTextControlFrame2.cpp
index c194e80f4912..aab3dc69fa69 100644
--- a/layout/html/forms/src/nsGfxTextControlFrame2.cpp
+++ b/layout/html/forms/src/nsGfxTextControlFrame2.cpp
@@ -1766,6 +1766,25 @@ nsGfxTextControlFrame2::CreateAnonymousContent(nsIPresContext* aPresContext,
return NS_OK;
}
+NS_IMETHODIMP
+nsGfxTextControlFrame2::Reflow(nsIPresContext* aPresContext,
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus)
+{
+ DO_GLOBAL_REFLOW_COUNT("nsGfxTextControlFrame2", aReflowState.reason);
+
+ // make sure the the form registers itself on the initial/first reflow
+ if (mState & NS_FRAME_FIRST_REFLOW) {
+ nsFormControlFrame::RegUnRegAccessKey(aPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_TRUE);
+ nsFormFrame::AddFormControlFrame(aPresContext, *NS_STATIC_CAST(nsIFrame*, this));
+ mNotifyOnInput = PR_TRUE;//its ok to notify now. all has been prepared.
+ }
+
+ return nsStackFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
+}
+
+
NS_IMETHODIMP
nsGfxTextControlFrame2::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize)
{
@@ -1797,13 +1816,6 @@ nsGfxTextControlFrame2::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize)
if (!aReflowState)
return NS_OK;
- if (mState & NS_FRAME_FIRST_REFLOW)
- {
- nsFormControlFrame::RegUnRegAccessKey(aPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_TRUE);
- nsFormFrame::AddFormControlFrame(aPresContext, *NS_STATIC_CAST(nsIFrame*, this));
- mNotifyOnInput = PR_TRUE;//its ok to notify now. all has been prepared.
- }
-
nsCompatibility mode;
aPresContext->GetCompatibilityMode(&mode);
PRBool navQuirksMode = eCompatibility_NavQuirks == mode && nameSpaceID == kNameSpaceID_HTML;
diff --git a/layout/html/forms/src/nsGfxTextControlFrame2.h b/layout/html/forms/src/nsGfxTextControlFrame2.h
index 0a2b51810c2a..1474fd994aec 100644
--- a/layout/html/forms/src/nsGfxTextControlFrame2.h
+++ b/layout/html/forms/src/nsGfxTextControlFrame2.h
@@ -61,6 +61,11 @@ public:
NS_IMETHOD Destroy(nsIPresContext* aPresContext);//remove yourself as a form control
+ NS_IMETHOD Reflow(nsIPresContext* aPresContext,
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus);
+
NS_IMETHOD GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
NS_IMETHOD GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
NS_IMETHOD GetMaxSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);