Bug 491063 - Mixed mode warning dialog (and other dialog windows) is sometimes not rendered, r+sr=bz

This commit is contained in:
Olli Pettay 2009-05-20 11:00:04 +03:00
parent 3f3ebba552
commit 1d0c8384b8
16 changed files with 110 additions and 32 deletions

View File

@ -151,6 +151,9 @@ protected:
*/
void DestroyImageLoadingContent();
void ClearBrokenState() { mBroken = PR_FALSE; }
PRBool LoadingEnabled() { return mLoadingEnabled; }
private:
/**
* Struct used to manage the image observers.

View File

@ -82,6 +82,7 @@ public:
static void ParseLinkTypes(const nsAString& aTypes, nsTArray<nsString>& aResult);
void UpdateStyleSheetInternal() { UpdateStyleSheetInternal(nsnull); }
protected:
/**
* @param aOldDocument should be non-null only if we're updating because we

View File

@ -148,6 +148,7 @@ public:
virtual PRInt32 IntrinsicState() const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
void MaybeLoadImage();
protected:
nsPoint GetXY();
nsSize GetWidthHeight();
@ -550,18 +551,30 @@ nsHTMLImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
aCompileEventHandlers);
NS_ENSURE_SUCCESS(rv, rv);
// Our base URI may have changed; claim that our URI changed, and the
// nsImageLoadingContent will decide whether a new image load is warranted.
nsAutoString uri;
if (GetAttr(kNameSpaceID_None, nsGkAtoms::src, uri)) {
// Note: no need to notify here; since we're just now being bound
// we don't have any frames or anything yet.
LoadImage(uri, PR_FALSE, PR_FALSE);
if (HasAttr(kNameSpaceID_None, nsGkAtoms::src)) {
ClearBrokenState();
nsContentUtils::AddScriptRunner(
new nsRunnableMethod<nsHTMLImageElement>(this,
&nsHTMLImageElement::MaybeLoadImage));
}
return rv;
}
void
nsHTMLImageElement::MaybeLoadImage()
{
// Our base URI may have changed; claim that our URI changed, and the
// nsImageLoadingContent will decide whether a new image load is warranted.
// Note, check LoadingEnabled() after LoadImage call.
nsAutoString uri;
if (GetAttr(kNameSpaceID_None, nsGkAtoms::src, uri) &&
(NS_FAILED(LoadImage(uri, PR_FALSE, PR_TRUE)) ||
!LoadingEnabled())) {
CancelImageRequests(PR_TRUE);
}
}
PRInt32
nsHTMLImageElement::IntrinsicState() const
{

View File

@ -316,6 +316,7 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(nsHTMLInputElement,
nsGenericHTMLFormElement)
void MaybeLoadImage();
protected:
// Helper method
nsresult SetValueInternal(const nsAString& aValue,
@ -1966,6 +1967,19 @@ nsHTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
return rv;
}
void
nsHTMLInputElement::MaybeLoadImage()
{
// Our base URI may have changed; claim that our URI changed, and the
// nsImageLoadingContent will decide whether a new image load is warranted.
nsAutoString uri;
if (mType == NS_FORM_INPUT_IMAGE &&
GetAttr(kNameSpaceID_None, nsGkAtoms::src, uri) &&
(NS_FAILED(LoadImage(uri, PR_FALSE, PR_TRUE)) ||
!LoadingEnabled())) {
CancelImageRequests(PR_TRUE);
}
}
nsresult
nsHTMLInputElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
@ -1980,11 +1994,11 @@ nsHTMLInputElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
if (mType == NS_FORM_INPUT_IMAGE) {
// Our base URI may have changed; claim that our URI changed, and the
// nsImageLoadingContent will decide whether a new image load is warranted.
nsAutoString uri;
if (GetAttr(kNameSpaceID_None, nsGkAtoms::src, uri)) {
// Note: no need to notify here; since we're just now being bound
// we don't have any frames or anything yet.
LoadImage(uri, PR_FALSE, PR_FALSE);
if (HasAttr(kNameSpaceID_None, nsGkAtoms::src)) {
ClearBrokenState();
nsContentUtils::AddScriptRunner(
new nsRunnableMethod<nsHTMLInputElement>(this,
&nsHTMLInputElement::MaybeLoadImage));
}
}

View File

@ -209,7 +209,9 @@ nsHTMLLinkElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
aCompileEventHandlers);
NS_ENSURE_SUCCESS(rv, rv);
UpdateStyleSheetInternal(nsnull);
nsContentUtils::AddScriptRunner(
new nsRunnableMethod<nsHTMLLinkElement>(this,
&nsHTMLLinkElement::UpdateStyleSheetInternal));
CreateAndDispatchEvent(aDocument, NS_LITERAL_STRING("DOMLinkAdded"));

View File

@ -124,6 +124,8 @@ public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
void StartObjectLoad() { StartObjectLoad(PR_TRUE); }
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(nsHTMLObjectElement,
nsGenericHTMLFormElement)
@ -224,9 +226,9 @@ nsHTMLObjectElement::BindToTree(nsIDocument *aDocument,
// If we already have all the children, start the load.
if (mIsDoneAddingChildren) {
// Don't need to notify: We have no frames yet, since we weren't in a
// document
StartObjectLoad(PR_FALSE);
nsContentUtils::AddScriptRunner(
new nsRunnableMethod<nsHTMLObjectElement>(this,
&nsHTMLObjectElement::StartObjectLoad));
}
return NS_OK;

View File

@ -44,6 +44,7 @@
#include "nsIDOMDocument.h"
#include "nsIDOMHTMLAppletElement.h"
#include "nsIDOMHTMLEmbedElement.h"
#include "nsThreadUtils.h"
#ifdef MOZ_SVG
#include "nsIDOMGetSVGDocument.h"
#include "nsIDOMSVGDocument.h"
@ -129,6 +130,8 @@ public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
void StartObjectLoad() { StartObjectLoad(PR_TRUE); }
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(nsHTMLSharedObjectElement,
nsGenericHTMLElement)
@ -252,9 +255,9 @@ nsHTMLSharedObjectElement::BindToTree(nsIDocument *aDocument,
// If we already have all the children, start the load.
if (mIsDoneAddingChildren) {
// Don't need to notify: We have no frames yet, since we weren't in a
// document
StartObjectLoad(PR_FALSE);
nsContentUtils::AddScriptRunner(
new nsRunnableMethod<nsHTMLSharedObjectElement>(this,
&nsHTMLSharedObjectElement::StartObjectLoad));
}
return NS_OK;

View File

@ -241,7 +241,9 @@ nsHTMLStyleElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
aCompileEventHandlers);
NS_ENSURE_SUCCESS(rv, rv);
UpdateStyleSheetInternal(nsnull);
nsContentUtils::AddScriptRunner(
new nsRunnableMethod<nsHTMLStyleElement>(this,
&nsHTMLStyleElement::UpdateStyleSheetInternal));
return rv;
}

View File

@ -5197,6 +5197,7 @@ public:
NS_IMETHOD OnStartContainer(imgIRequest *aRequest,
imgIContainer *aContainer);
void MaybeLoadSVGImage();
private:
// Invalidate users of the filter containing this element.
void Invalidate();
@ -5301,6 +5302,16 @@ nsSVGFEImageElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
aValue, aNotify);
}
void
nsSVGFEImageElement::MaybeLoadSVGImage()
{
if (HasAttr(kNameSpaceID_XLink, nsGkAtoms::href) &&
(NS_FAILED(LoadSVGImage(PR_FALSE, PR_TRUE)) ||
!LoadingEnabled())) {
CancelImageRequests(PR_TRUE);
}
}
nsresult
nsSVGFEImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
@ -5312,11 +5323,10 @@ nsSVGFEImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
NS_ENSURE_SUCCESS(rv, rv);
if (HasAttr(kNameSpaceID_XLink, nsGkAtoms::href)) {
// Our base URI may have changed; claim that our URI changed, and the
// nsImageLoadingContent will decide whether a new image load is warranted.
// Note: no need to notify here; since we're just now being bound
// we don't have any frames or anything yet.
LoadSVGImage(PR_FALSE, PR_FALSE);
ClearBrokenState();
nsContentUtils::AddScriptRunner(
new nsRunnableMethod<nsSVGFEImageElement>(this,
&nsSVGFEImageElement::MaybeLoadSVGImage));
}
return rv;

View File

@ -181,6 +181,16 @@ nsSVGImageElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
aValue, aNotify);
}
void
nsSVGImageElement::MaybeLoadSVGImage()
{
if (HasAttr(kNameSpaceID_XLink, nsGkAtoms::href) &&
(NS_FAILED(LoadSVGImage(PR_FALSE, PR_TRUE)) ||
!LoadingEnabled())) {
CancelImageRequests(PR_TRUE);
}
}
nsresult
nsSVGImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
@ -192,11 +202,10 @@ nsSVGImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
NS_ENSURE_SUCCESS(rv, rv);
if (HasAttr(kNameSpaceID_XLink, nsGkAtoms::href)) {
// Our base URI may have changed; claim that our URI changed, and the
// nsImageLoadingContent will decide whether a new image load is warranted.
// Note: no need to notify here; since we're just now being bound
// we don't have any frames or anything yet.
LoadSVGImage(PR_FALSE, PR_FALSE);
ClearBrokenState();
nsContentUtils::AddScriptRunner(
new nsRunnableMethod<nsSVGImageElement>(this,
&nsSVGImageElement::MaybeLoadSVGImage));
}
return rv;

View File

@ -90,6 +90,7 @@ public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
void MaybeLoadSVGImage();
protected:
nsresult LoadSVGImage(PRBool aForce, PRBool aNotify);

View File

@ -161,7 +161,9 @@ nsSVGStyleElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
aCompileEventHandlers);
NS_ENSURE_SUCCESS(rv, rv);
UpdateStyleSheetInternal(nsnull);
nsContentUtils::AddScriptRunner(
new nsRunnableMethod<nsSVGStyleElement>(this,
&nsSVGStyleElement::UpdateStyleSheetInternal));
return rv;
}

View File

@ -47,6 +47,7 @@
#include "nsUnicharUtils.h"
#include "nsParserUtils.h"
#include "nsGkAtoms.h"
#include "nsThreadUtils.h"
class nsXMLStylesheetPI : public nsXMLProcessingInstruction,
public nsStyleLinkElement
@ -123,7 +124,9 @@ nsXMLStylesheetPI::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
aCompileEventHandlers);
NS_ENSURE_SUCCESS(rv, rv);
UpdateStyleSheetInternal(nsnull);
nsContentUtils::AddScriptRunner(
new nsRunnableMethod<nsXMLStylesheetPI>(this,
&nsXMLStylesheetPI::UpdateStyleSheetInternal));
return rv;
}

View File

@ -0,0 +1,6 @@
<html>
<body>
<img>
<input type="image">
</body>
</html>

View File

@ -0,0 +1,6 @@
<html>
<body>
<img src="http://www.foo oo.com">
<input type="image" src="http://www.foo oo.com">
</body>
</html>

View File

@ -1,2 +1,3 @@
== background-image-zoom-1.html background-image-zoom-1-ref.html
== image-zoom-1.html image-zoom-1-ref.html
== invalid-url-image-1.html invalid-url-image-1-ref.html