diff --git a/layout/html/forms/src/nsFormFrame.cpp b/layout/html/forms/src/nsFormFrame.cpp
index 35c716991a35..fb05791565db 100644
--- a/layout/html/forms/src/nsFormFrame.cpp
+++ b/layout/html/forms/src/nsFormFrame.cpp
@@ -50,6 +50,7 @@
#include "nsIPresShell.h"
#include "nsIPresContext.h"
#include "nsIStyleContext.h"
+#include "nsIMutableStyleContext.h"
#include "nsCSSRendering.h"
#include "nsHTMLIIDs.h"
#include "nsDebug.h"
@@ -166,6 +167,16 @@ nsFormFrame::~nsFormFrame()
}
}
+NS_METHOD nsFormFrame::DidSetStyleContext(nsIPresContext* aPresContext)
+{
+ // we can't yet support anything but display:block on a form,
+ // so make sure that the display is block
+ nsMutableStyleDisplay displayData(mStyleContext);
+ displayData->mDisplay = NS_STYLE_DISPLAY_BLOCK;
+
+ return NS_OK;
+}
+
PRBool
nsFormFrame::CanSubmit(nsIFormControlFrame *aFrame)
{
diff --git a/layout/html/forms/src/nsFormFrame.h b/layout/html/forms/src/nsFormFrame.h
index 99181a2f28cc..66c941f399be 100644
--- a/layout/html/forms/src/nsFormFrame.h
+++ b/layout/html/forms/src/nsFormFrame.h
@@ -102,6 +102,7 @@ public:
protected:
NS_IMETHOD_(nsrefcnt) AddRef(void);
NS_IMETHOD_(nsrefcnt) Release(void);
+ NS_IMETHOD DidSetStyleContext(nsIPresContext* aPresContext);
void RemoveRadioGroups();
void DoDefaultSelection(nsIPresContext* aPresContext,