зеркало из https://github.com/mozilla/gecko-dev.git
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
This commit is contained in:
Родитель
2a71320db4
Коммит
e7e6f42ffc
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче