From 0185d48b6dcbedef2753a0398db85ee8bf66ee30 Mon Sep 17 00:00:00 2001 From: "troy%netscape.com" Date: Sat, 7 Nov 1998 03:56:11 +0000 Subject: [PATCH] Added a copy of the UpdateImageFrame() code from nsImageFrame, so that when the image size arrives we get notified so we can kick off an incremental reflow git-svn-id: svn://10.0.0.236/trunk@14231 18797224-902f-48f8-a5cc-f745e15eee43 --- .../html/forms/src/nsButtonControlFrame.cpp | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/mozilla/layout/html/forms/src/nsButtonControlFrame.cpp b/mozilla/layout/html/forms/src/nsButtonControlFrame.cpp index 080d4c37b96..b8300f3bd84 100644 --- a/mozilla/layout/html/forms/src/nsButtonControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsButtonControlFrame.cpp @@ -45,6 +45,7 @@ #include "nsIHTMLAttributes.h" #include "nsGenericHTMLElement.h" #include "nsFormFrame.h" +#include "nsIDocument.h" static NS_DEFINE_IID(kIFormControlIID, NS_IFORMCONTROL_IID); static NS_DEFINE_IID(kIButtonIID, NS_IBUTTON_IID); @@ -305,6 +306,28 @@ nsButtonControlFrame::Reflow(nsIPresContext& aPresContext, } } +// XXX This is a copy of the code in nsImageFrame.cpp +static nsresult +UpdateImageFrame(nsIPresContext& aPresContext, nsIFrame* aFrame, + PRIntn aStatus) +{ + if (NS_IMAGE_LOAD_STATUS_SIZE_AVAILABLE & aStatus) { + // Now that the size is available, trigger a content-changed reflow + nsIContent* content = nsnull; + aFrame->GetContent(content); + if (nsnull != content) { + nsIDocument* document = nsnull; + content->GetDocument(document); + if (nsnull != document) { + document->ContentChanged(content, nsnull); + NS_RELEASE(document); + } + NS_RELEASE(content); + } + } + return NS_OK; +} + void nsButtonControlFrame::GetDesiredSize(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState, @@ -326,7 +349,7 @@ nsButtonControlFrame::GetDesiredSize(nsIPresContext* aPresContext, if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttribute("SRC", src)) { mImageLoader.SetURL(src); } - mImageLoader.GetDesiredSize(aPresContext, aReflowState, this, nsnull, + mImageLoader.GetDesiredSize(aPresContext, aReflowState, this, UpdateImageFrame, aDesiredLayoutSize); } else { // there is a widget nsSize styleSize;