зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1128225 (Part 5) - Record the last draw result in nsDisplayBullet and use it to decide whether to sync decode. r=tn
This commit is contained in:
Родитель
8c44fcc668
Коммит
48c5abfdb0
|
@ -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<nsDisplayBulletGeometry>
|
||||
{
|
||||
public:
|
||||
nsDisplayBulletGeometry(nsDisplayItem* aItem, nsDisplayListBuilder* aBuilder)
|
||||
: nsDisplayItemGenericGeometry(aItem, aBuilder)
|
||||
, nsImageGeometryMixin(aItem)
|
||||
{
|
||||
nsBulletFrame* f = static_cast<nsBulletFrame*>(aItem->Frame());
|
||||
mOrdinal = f->GetOrdinal();
|
||||
|
@ -234,10 +238,8 @@ public:
|
|||
}
|
||||
|
||||
nsCOMPtr<imgIContainer> 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<nsBulletFrame*>(mFrame)->
|
||||
|
||||
DrawResult result = static_cast<nsBulletFrame*>(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
|
||||
|
|
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче