Set up image loaders before reflow for border-image in XUL just like for HTML. (Bug 468473) r+sr=roc

This commit is contained in:
L. David Baron 2008-12-23 09:06:56 -05:00
parent a8f62c8912
commit 16aba7fd6b
5 changed files with 32 additions and 12 deletions

View File

@ -99,6 +99,7 @@
#include "nsITextControlFrame.h"
#include "nsINameSpaceManager.h"
#include "nsIPercentHeightObserver.h"
#include "nsStyleStructInlines.h"
#ifdef IBMBIDI
#include "nsBidiPresUtils.h"
@ -553,6 +554,16 @@ nsFrame::GetOffsets(PRInt32 &aStart, PRInt32 &aEnd) const
/* virtual */ void
nsFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
{
// We have to start loading the border image before or during reflow,
// because the border-image's width overrides only apply once the
// image is loaded. Starting the load of the image means we'll get a
// reflow when the image loads. (Otherwise, if the image loads
// between reflow and paint, we never get the notification and our
// size ends up wrong.)
imgIRequest *borderImage = GetStyleBorder()->GetBorderImage();
if (borderImage) {
PresContext()->LoadBorderImage(borderImage, this);
}
}
/* virtual */ nsMargin

View File

@ -57,7 +57,6 @@
#include "nsIPercentHeightObserver.h"
#include "nsContentUtils.h"
#include "nsLayoutUtils.h"
#include "nsStyleStructInlines.h"
#ifdef IBMBIDI
#include "nsBidiUtils.h"
#endif
@ -287,17 +286,6 @@ nsHTMLReflowState::Init(nsPresContext* aPresContext,
InitResizeFlags(aPresContext);
// We have to start loading the border image now, because the
// border-image's width overrides only apply once the image is loaded.
// Starting the load of the image means we'll get a reflow when the
// image loads. (If we didn't do it now, and the image loaded between
// reflow and paint, we'd never get the notification, and our size
// would be wrong.)
imgIRequest *borderImage = mStyleBorder->GetBorderImage();
if (borderImage) {
aPresContext->LoadBorderImage(borderImage, frame);
}
NS_ASSERTION((mFrameType == NS_CSS_FRAME_TYPE_INLINE &&
!frame->IsFrameOfType(nsIFrame::eReplaced)) ||
frame->GetType() == nsGkAtoms::textFrame ||

View File

@ -0,0 +1,10 @@
<?xml version="1.0"?>
<window title="Missing repaint when using -moz-border-image on a XUL button"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<hbox>
<button label="Button" style="min-width: 0; -moz-appearance: none; border: medium solid; padding: 0; margin: 0; visibility:hidden; border-width: 0 8px;"/>
<box flex="1" style="background: green" />
</hbox>
</window>

View File

@ -0,0 +1,10 @@
<?xml version="1.0"?>
<window title="Missing repaint when using -moz-border-image on a XUL button"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<hbox>
<button label="Button" style="min-width: 0; -moz-appearance: none; border-width: 0; padding: 0; margin: 0; visibility:hidden; -moz-border-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAARCAMAAADnhAzLAAAAsVBMVEUAAAAAAAAAAAD///////8QEBAAAAAHBwcQEBD///8GBgYAAAAAAAAAAAAAAAAODg4AAAA2NjYAAAAAAAAGBgYREREAAAAQEBAAAAA4ODiJiYkSEhIAAADExMQAAAAICAhra2stLS0ODg4JCQklJSX///8HBwcGBgb///////98fHz///////+hoaE4ODj////////e3t6np6dxcXFUVFROTk7///////////////////+i+RpeAAAAO3RSTlNKAEwHAlBRbU8Ff2heWVdcZyFPTX1MZE5VIGpIVFdOXFhVWFdaQWp4El1tIGp6YBhhjYNxbWwnVXeDhIrUVQ0AAACvSURBVHheXdDXDoJAEIXhMztL73ZRFBXE3vv7P5hrognrfzdfMjcHRJIT22q5bsuyE5ZEIIe7lecHYRj4XtVlhyA5inuNplA1G704Yglud0yBb8LstBn9uYla5ryPwRBawwFmI51GM4yFTmKMKfQUTKCnIP9/zJEVOhUZytSoi5GWWCxXNTNWywVovdnufrLbbtYEov3heDpfrtfL+XQ87OlDJG/3x/P1ej7uN6nON0ZMDbf0SRXfAAAAAElFTkSuQmCC) 0 8 / 0 8px;"/>
<box flex="1" style="background: green" />
</hbox>
</window>

View File

@ -997,3 +997,4 @@ fails == 461512-1.html 461512-1-ref.html # Bug 461512
== 467084-1.html 467084-1-ref.html
== 467084-2.html 467084-2-ref.html
== 467460-1.html 467460-1-ref.html
== 468473-1.xul 468473-1-ref.xul