diff --git a/dom/base/nsIImageLoadingContent.idl b/dom/base/nsIImageLoadingContent.idl
index 0a469c165..218e35b47 100644
--- a/dom/base/nsIImageLoadingContent.idl
+++ b/dom/base/nsIImageLoadingContent.idl
@@ -60,7 +60,7 @@ interface nsIImageLoadingContent : imgINotificationObserver
* the image was blocked. This status always refers to the
* CURRENT_REQUEST load.
*/
- readonly attribute short imageBlockingStatus;
+ [infallible] readonly attribute short imageBlockingStatus;
/**
* Used to register an image decoder observer. Typically, this will
diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp
index aa18e5548..8f39e807f 100644
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -115,7 +115,7 @@ static bool HaveSpecifiedSize(const nsStylePosition* aStylePosition)
// Decide whether we can optimize away reflows that result from the
// image's intrinsic size changing.
-inline bool HaveFixedSize(const nsHTMLReflowState& aReflowState)
+static bool HaveFixedSize(const nsHTMLReflowState& aReflowState)
{
NS_ASSERTION(aReflowState.mStylePosition, "crappy reflowState - null stylePosition");
// Don't try to make this optimization when an image has percentages
@@ -437,8 +437,23 @@ nsImageFrame::SourceRectToDest(const nsIntRect& aRect)
(!(_state).HasAtLeastOneOfStates(NS_EVENT_STATE_BROKEN | NS_EVENT_STATE_USERDISABLED) && \
(_state).HasState(NS_EVENT_STATE_LOADING) && (_loadingOK)))
-/* static */
-bool
+static bool HasAltText(Element* aElement)
+{
+ // We always return some alternate text for , see
+ // nsCSSFrameConstructor::GetAlternateTextFor.
+ if (aElement->IsHTMLElement(nsGkAtoms::input)) {
+ return true;
+ }
+
+ MOZ_ASSERT(aElement->IsHTMLElement(nsGkAtoms::img));
+ nsAutoString altText;
+ return aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::alt, altText) && !altText.IsEmpty();
+}
+
+// Check if we want to use an image frame or just let the frame constructor make
+// us into an inline.
+
+/* static */ bool
nsImageFrame::ShouldCreateImageFrameFor(Element* aElement,
nsStyleContext* aStyleContext)
{
@@ -449,44 +464,26 @@ nsImageFrame::ShouldCreateImageFrameFor(Element* aElement,
return true;
}
- // Check if we want to use a placeholder box with an icon or just
- // let the presShell make us into inline text. Decide as follows:
- //
- // - if our special "force icons" style is set, show an icon
- // - else if our "do not show placeholders" pref is set, skip the icon
- // - else:
- // - if there is a src attribute, there is no alt attribute,
- // and this is not an