diff --git a/layout/generic/nsBulletFrame.cpp b/layout/generic/nsBulletFrame.cpp index c8251f19c503..3e4cfc399a34 100644 --- a/layout/generic/nsBulletFrame.cpp +++ b/layout/generic/nsBulletFrame.cpp @@ -39,6 +39,7 @@ using namespace mozilla; using namespace mozilla::gfx; +using namespace mozilla::image; NS_DECLARE_FRAME_PROPERTY(FontSizeInflationProperty, nullptr) @@ -169,11 +170,14 @@ nsBulletFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext) #endif } -class nsDisplayBulletGeometry : public nsDisplayItemGenericGeometry +class nsDisplayBulletGeometry + : public nsDisplayItemGenericGeometry + , public nsImageGeometryMixin { public: nsDisplayBulletGeometry(nsDisplayItem* aItem, nsDisplayListBuilder* aBuilder) : nsDisplayItemGenericGeometry(aItem, aBuilder) + , nsImageGeometryMixin(aItem) { nsBulletFrame* f = static_cast(aItem->Frame()); mOrdinal = f->GetOrdinal(); @@ -234,10 +238,8 @@ public: } nsCOMPtr image = f->GetImage(); - if (aBuilder->ShouldSyncDecodeImages() && image && !image->IsDecoded()) { - // If we are going to do a sync decode and we are not decoded then we are - // going to be drawing something different from what is currently there, - // so we add our bounds to the invalid region. + if (aBuilder->ShouldSyncDecodeImages() && image && + geometry->LastDrawResult() != DrawResult::SUCCESS) { bool snap; aInvalidRegion->Or(*aInvalidRegion, GetBounds(aBuilder, &snap)); } @@ -253,8 +255,11 @@ void nsDisplayBullet::Paint(nsDisplayListBuilder* aBuilder, if (aBuilder->ShouldSyncDecodeImages()) { flags |= imgIContainer::FLAG_SYNC_DECODE; } - static_cast(mFrame)-> + + DrawResult result = static_cast(mFrame)-> PaintBullet(*aCtx, ToReferenceFrame(), mVisibleRect, flags); + + nsDisplayBulletGeometry::UpdateDrawResult(this, result); } void @@ -271,7 +276,7 @@ nsBulletFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, new (aBuilder) nsDisplayBullet(aBuilder, this)); } -void +DrawResult nsBulletFrame::PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt, const nsRect& aDirtyRect, uint32_t aFlags) { @@ -290,11 +295,11 @@ nsBulletFrame::PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt, nsRect dest(padding.left, padding.top, mRect.width - (padding.left + padding.right), mRect.height - (padding.top + padding.bottom)); - nsLayoutUtils::DrawSingleImage(*aRenderingContext.ThebesContext(), + return + nsLayoutUtils::DrawSingleImage(*aRenderingContext.ThebesContext(), PresContext(), imageCon, nsLayoutUtils::GetGraphicsFilterForFrame(this), dest + aPt, aDirtyRect, nullptr, aFlags); - return; } } } @@ -432,6 +437,8 @@ nsBulletFrame::PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt, } break; } + + return DrawResult::SUCCESS; } int32_t diff --git a/layout/generic/nsBulletFrame.h b/layout/generic/nsBulletFrame.h index 598ab0db4f32..bb4a5320fa08 100644 --- a/layout/generic/nsBulletFrame.h +++ b/layout/generic/nsBulletFrame.h @@ -11,6 +11,7 @@ #include "mozilla/Attributes.h" #include "nsFrame.h" +#include "imgIContainer.h" #include "imgINotificationObserver.h" #include "imgIOnloadBlocker.h" @@ -42,6 +43,8 @@ private: * This class also supports the CSS list-style properties. */ class nsBulletFrame MOZ_FINAL : public nsFrame { + typedef mozilla::image::DrawResult DrawResult; + public: NS_DECL_FRAMEARENA_HELPERS #ifdef DEBUG @@ -90,8 +93,8 @@ public: void GetSpokenText(nsAString& aText); - void PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt, - const nsRect& aDirtyRect, uint32_t aFlags); + DrawResult PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt, + const nsRect& aDirtyRect, uint32_t aFlags); virtual bool IsEmpty() MOZ_OVERRIDE; virtual bool IsSelfEmpty() MOZ_OVERRIDE;