Bug 1128769 (Part 4) - Record the last draw result when drawing CSS tables and use it to decide whether to sync decode. r=tn
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::gfx;
|
||||
using namespace mozilla::image;
|
||||
|
||||
nsTableCellFrame::nsTableCellFrame(nsStyleContext* aContext) :
|
||||
nsContainerFrame(aContext)
|
||||
@@ -363,27 +364,28 @@ nsTableCellFrame::DecorateForSelection(nsRenderingContext& aRenderingContext,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DrawResult
|
||||
nsTableCellFrame::PaintBackground(nsRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsPoint aPt,
|
||||
uint32_t aFlags)
|
||||
{
|
||||
nsRect rect(aPt, GetSize());
|
||||
nsCSSRendering::PaintBackground(PresContext(), aRenderingContext, this,
|
||||
aDirtyRect, rect, aFlags);
|
||||
return nsCSSRendering::PaintBackground(PresContext(), aRenderingContext, this,
|
||||
aDirtyRect, rect, aFlags);
|
||||
}
|
||||
|
||||
// Called by nsTablePainter
|
||||
void
|
||||
DrawResult
|
||||
nsTableCellFrame::PaintCellBackground(nsRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect, nsPoint aPt,
|
||||
uint32_t aFlags)
|
||||
{
|
||||
if (!StyleVisibility()->IsVisible())
|
||||
return;
|
||||
if (!StyleVisibility()->IsVisible()) {
|
||||
return DrawResult::SUCCESS;
|
||||
}
|
||||
|
||||
PaintBackground(aRenderingContext, aDirtyRect, aPt, aFlags);
|
||||
return PaintBackground(aRenderingContext, aDirtyRect, aPt, aFlags);
|
||||
}
|
||||
|
||||
nsresult
|
||||
@@ -426,6 +428,7 @@ public:
|
||||
nsRenderingContext* aCtx) MOZ_OVERRIDE;
|
||||
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder,
|
||||
bool* aSnap) MOZ_OVERRIDE;
|
||||
virtual nsDisplayItemGeometry* AllocateGeometry(nsDisplayListBuilder* aBuilder) MOZ_OVERRIDE;
|
||||
virtual void ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayItemGeometry* aGeometry,
|
||||
nsRegion *aInvalidRegion) MOZ_OVERRIDE;
|
||||
@@ -436,9 +439,11 @@ public:
|
||||
void nsDisplayTableCellBackground::Paint(nsDisplayListBuilder* aBuilder,
|
||||
nsRenderingContext* aCtx)
|
||||
{
|
||||
static_cast<nsTableCellFrame*>(mFrame)->
|
||||
DrawResult result = static_cast<nsTableCellFrame*>(mFrame)->
|
||||
PaintBackground(*aCtx, mVisibleRect, ToReferenceFrame(),
|
||||
aBuilder->GetBackgroundPaintFlags());
|
||||
|
||||
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
|
||||
}
|
||||
|
||||
nsRect
|
||||
@@ -450,16 +455,24 @@ nsDisplayTableCellBackground::GetBounds(nsDisplayListBuilder* aBuilder,
|
||||
return nsDisplayItem::GetBounds(aBuilder, aSnap);
|
||||
}
|
||||
|
||||
nsDisplayItemGeometry*
|
||||
nsDisplayTableCellBackground::AllocateGeometry(nsDisplayListBuilder* aBuilder)
|
||||
{
|
||||
return new nsDisplayItemGenericImageGeometry(this, aBuilder);
|
||||
}
|
||||
|
||||
void
|
||||
nsDisplayTableCellBackground::ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayItemGeometry* aGeometry,
|
||||
nsRegion *aInvalidRegion)
|
||||
{
|
||||
if (aBuilder->ShouldSyncDecodeImages()) {
|
||||
if (!nsCSSRendering::AreAllBackgroundImagesDecodedForFrame(mFrame)) {
|
||||
bool snap;
|
||||
aInvalidRegion->Or(*aInvalidRegion, GetBounds(aBuilder, &snap));
|
||||
}
|
||||
auto geometry =
|
||||
static_cast<const nsDisplayItemGenericImageGeometry*>(aGeometry);
|
||||
|
||||
if (aBuilder->ShouldSyncDecodeImages() &&
|
||||
geometry->ShouldInvalidateToSyncDecodeImages()) {
|
||||
bool snap;
|
||||
aInvalidRegion->Or(*aInvalidRegion, GetBounds(aBuilder, &snap));
|
||||
}
|
||||
|
||||
nsDisplayTableItem::ComputeInvalidationRegion(aBuilder, aGeometry, aInvalidRegion);
|
||||
@@ -1219,7 +1232,7 @@ nsBCTableCellFrame::GetBorderOverflow()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DrawResult
|
||||
nsBCTableCellFrame::PaintBackground(nsRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsPoint aPt,
|
||||
@@ -1239,8 +1252,8 @@ nsBCTableCellFrame::PaintBackground(nsRenderingContext& aRenderingContext,
|
||||
nsRect rect(aPt, GetSize());
|
||||
// bypassing nsCSSRendering::PaintBackground is safe because this kind
|
||||
// of frame cannot be used for the root element
|
||||
nsCSSRendering::PaintBackgroundWithSC(PresContext(), aRenderingContext, this,
|
||||
aDirtyRect, rect,
|
||||
StyleContext(), myBorder,
|
||||
aFlags, nullptr);
|
||||
return nsCSSRendering::PaintBackgroundWithSC(PresContext(), aRenderingContext,
|
||||
this, aDirtyRect, rect,
|
||||
StyleContext(), myBorder,
|
||||
aFlags, nullptr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user