Bug 1348208 part 2 - Refactor nsImageFrame::ShouldCreateImageFrameFor a bit. r?dbaron
MozReview-Commit-ID: IrYbo1N1unt
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -458,40 +458,35 @@ nsImageFrame::ShouldCreateImageFrameFor(
//
// - 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 <object> (which could not possibly have
// such an attribute), show an icon.
// - if QuirksMode, and the IMG has a size show an icon.
// - otherwise, skip the icon
- bool useSizedBox;
-
+
if (gIconLoad && gIconLoad->mPrefForceInlineAltText) {
- useSizedBox = false;
+ return false;
}
- else if (aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::src) &&
- !aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::alt) &&
- !aElement->IsHTMLElement(nsGkAtoms::object) &&
- !aElement->IsHTMLElement(nsGkAtoms::input)) {
+ if (aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::src) &&
+ !aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::alt) &&
+ !aElement->IsHTMLElement(nsGkAtoms::object) &&
+ !aElement->IsHTMLElement(nsGkAtoms::input)) {
// Use a sized box if we have no alt text. This means no alt attribute
// and the node is not an object or an input (since those always have alt
// text).
- useSizedBox = true;
- }
- else if (aStyleContext->PresContext()->CompatibilityMode() !=
- eCompatibility_NavQuirks) {
- useSizedBox = false;
+ return true;
}
- else {
- // check whether we have specified size
- useSizedBox = HaveSpecifiedSize(aStyleContext->StylePosition());
+ if (aStyleContext->PresContext()->CompatibilityMode() !=
+ eCompatibility_NavQuirks) {
+ return false;
}
-
- return useSizedBox;
+ // check whether we have specified size
+ return HaveSpecifiedSize(aStyleContext->StylePosition());
}
nsresult
nsImageFrame::Notify(imgIRequest* aRequest,
int32_t aType,
const nsIntRect* aRect)
{
if (aType == imgINotificationObserver::SIZE_AVAILABLE) {