diff options
Diffstat (limited to 'layout/generic/nsImageFrame.cpp')
-rw-r--r-- | layout/generic/nsImageFrame.cpp | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index 226cca2cf..03fcbd8e3 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -430,15 +430,11 @@ nsImageFrame::SourceRectToDest(const nsIntRect& aRect) // that we'll construct image frames for them as needed if their display is // toggled from "none" (though we won't paint them, unless their visibility // is changed too). -#define BAD_STATES (NS_EVENT_STATE_BROKEN | NS_EVENT_STATE_USERDISABLED | \ - NS_EVENT_STATE_LOADING) +#define BAD_STATES (NS_EVENT_STATE_BROKEN | NS_EVENT_STATE_USERDISABLED) -// This is a macro so that we don't evaluate the boolean last arg -// unless we have to; it can be expensive -#define IMAGE_OK(_state, _loadingOK) \ - (!(_state).HasAtLeastOneOfStates(BAD_STATES) || \ - (!(_state).HasAtLeastOneOfStates(NS_EVENT_STATE_BROKEN | NS_EVENT_STATE_USERDISABLED) && \ - (_state).HasState(NS_EVENT_STATE_LOADING) && (_loadingOK))) +static bool ImageOk(EventStates aState) { + return !aState.HasAtLeastOneOfStates(BAD_STATES); +} static bool HasAltText(Element* aElement) { @@ -459,10 +455,8 @@ static bool HasAltText(Element* aElement) nsImageFrame::ShouldCreateImageFrameFor(Element* aElement, nsStyleContext* aStyleContext) { - EventStates state = aElement->State(); - if (IMAGE_OK(state, - HaveSpecifiedSize(aStyleContext->StylePosition()))) { - // Image is fine; do the image frame thing + if (ImageOk(aElement->State())) { + // Image is fine or loading; do the image frame thing return true; } @@ -1016,8 +1010,7 @@ nsImageFrame::Reflow(nsPresContext* aPresContext, } aMetrics.SetOverflowAreasToDesiredBounds(); - EventStates contentState = mContent->AsElement()->State(); - bool imageOK = IMAGE_OK(contentState, true); + bool imageOK = ImageOk(mContent->AsElement()->State()); // Determine if the size is available bool haveSize = false; @@ -1336,7 +1329,7 @@ nsImageFrame::DisplayAltFeedback(nsRenderingContext& aRenderingContext, MOZ_ASSERT(gIconLoad, "How did we succeed in Init then?"); // Whether we draw the broken or loading icon. - bool isLoading = IMAGE_OK(GetContent()->AsElement()->State(), true); + bool isLoading = ImageOk(mContent->AsElement()->State()); // Calculate the inner area nsRect inner = GetInnerArea() + aPt; @@ -1756,8 +1749,7 @@ nsImageFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, getter_AddRefs(currentRequest)); } - EventStates contentState = mContent->AsElement()->State(); - bool imageOK = IMAGE_OK(contentState, true); + bool imageOK = ImageOk(mContent->AsElement()->State()); // XXX(seth): The SizeIsAvailable check here should not be necessary - the // intention is that a non-null mImage means we have a size, but there is |