зеркало из https://github.com/mozilla/gecko-dev.git
Bug 695763. Part 4. Invalidate table background images if they are not decoded and we are asked to do a sync decode. r=roc
This commit is contained in:
Родитель
5942372742
Коммит
38244a9048
|
@ -373,6 +373,9 @@ public:
|
||||||
virtual void Paint(nsDisplayListBuilder* aBuilder,
|
virtual void Paint(nsDisplayListBuilder* aBuilder,
|
||||||
nsRenderingContext* aCtx);
|
nsRenderingContext* aCtx);
|
||||||
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap);
|
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap);
|
||||||
|
virtual void ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
|
||||||
|
const nsDisplayItemGeometry* aGeometry,
|
||||||
|
nsRegion *aInvalidRegion) MOZ_OVERRIDE;
|
||||||
|
|
||||||
NS_DISPLAY_DECL_NAME("TableCellBackground", TYPE_TABLE_CELL_BACKGROUND)
|
NS_DISPLAY_DECL_NAME("TableCellBackground", TYPE_TABLE_CELL_BACKGROUND)
|
||||||
};
|
};
|
||||||
|
@ -394,6 +397,21 @@ nsDisplayTableCellBackground::GetBounds(nsDisplayListBuilder* aBuilder,
|
||||||
return nsDisplayItem::GetBounds(aBuilder, aSnap);
|
return nsDisplayItem::GetBounds(aBuilder, aSnap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nsDisplayTableItem::ComputeInvalidationRegion(aBuilder, aGeometry, aInvalidRegion);
|
||||||
|
}
|
||||||
|
|
||||||
void nsTableCellFrame::InvalidateFrame(uint32_t aDisplayItemKey)
|
void nsTableCellFrame::InvalidateFrame(uint32_t aDisplayItemKey)
|
||||||
{
|
{
|
||||||
nsIFrame::InvalidateFrame(aDisplayItemKey);
|
nsIFrame::InvalidateFrame(aDisplayItemKey);
|
||||||
|
|
|
@ -1061,11 +1061,66 @@ public:
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
virtual void ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
|
||||||
|
const nsDisplayItemGeometry* aGeometry,
|
||||||
|
nsRegion *aInvalidRegion) MOZ_OVERRIDE;
|
||||||
virtual void Paint(nsDisplayListBuilder* aBuilder,
|
virtual void Paint(nsDisplayListBuilder* aBuilder,
|
||||||
nsRenderingContext* aCtx);
|
nsRenderingContext* aCtx);
|
||||||
NS_DISPLAY_DECL_NAME("TableBorderBackground", TYPE_TABLE_BORDER_BACKGROUND)
|
NS_DISPLAY_DECL_NAME("TableBorderBackground", TYPE_TABLE_BORDER_BACKGROUND)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
static bool
|
||||||
|
IsFrameAllowedInTable(nsIAtom* aType)
|
||||||
|
{
|
||||||
|
return IS_TABLE_CELL(aType) ||
|
||||||
|
nsGkAtoms::tableRowFrame == aType ||
|
||||||
|
nsGkAtoms::tableRowGroupFrame == aType ||
|
||||||
|
nsGkAtoms::scrollFrame == aType ||
|
||||||
|
nsGkAtoms::tableFrame == aType ||
|
||||||
|
nsGkAtoms::tableColFrame == aType ||
|
||||||
|
nsGkAtoms::tableColGroupFrame == aType;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* static */ bool
|
||||||
|
nsTableFrame::AnyTablePartHasUndecodedBackgroundImage(nsIFrame* aStart,
|
||||||
|
nsIFrame* aEnd)
|
||||||
|
{
|
||||||
|
for (nsIFrame* f = aStart; f != aEnd; f = f->GetNextSibling()) {
|
||||||
|
NS_ASSERTION(IsFrameAllowedInTable(f->GetType()), "unexpected frame type");
|
||||||
|
|
||||||
|
if (!nsCSSRendering::AreAllBackgroundImagesDecodedForFrame(f))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
nsTableCellFrame *cellFrame = do_QueryFrame(f);
|
||||||
|
if (cellFrame)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (AnyTablePartHasUndecodedBackgroundImage(f->PrincipalChildList().FirstChild(), nullptr))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDisplayTableBorderBackground::ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
|
||||||
|
const nsDisplayItemGeometry* aGeometry,
|
||||||
|
nsRegion *aInvalidRegion)
|
||||||
|
{
|
||||||
|
if (aBuilder->ShouldSyncDecodeImages()) {
|
||||||
|
if (nsTableFrame::AnyTablePartHasUndecodedBackgroundImage(mFrame, mFrame->GetNextSibling()) ||
|
||||||
|
nsTableFrame::AnyTablePartHasUndecodedBackgroundImage(
|
||||||
|
mFrame->GetChildList(nsIFrame::kColGroupList).FirstChild(), nullptr)) {
|
||||||
|
bool snap;
|
||||||
|
aInvalidRegion->Or(*aInvalidRegion, GetBounds(aBuilder, &snap));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nsDisplayTableItem::ComputeInvalidationRegion(aBuilder, aGeometry, aInvalidRegion);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsDisplayTableBorderBackground::Paint(nsDisplayListBuilder* aBuilder,
|
nsDisplayTableBorderBackground::Paint(nsDisplayListBuilder* aBuilder,
|
||||||
nsRenderingContext* aCtx)
|
nsRenderingContext* aCtx)
|
||||||
|
@ -1176,20 +1231,6 @@ nsTableFrame::DisplayGenericTablePart(nsDisplayListBuilder* aBuilder,
|
||||||
aFrame->DisplayOutline(aBuilder, aLists);
|
aFrame->DisplayOutline(aBuilder, aLists);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
static bool
|
|
||||||
IsFrameAllowedInTable(nsIAtom* aType)
|
|
||||||
{
|
|
||||||
return IS_TABLE_CELL(aType) ||
|
|
||||||
nsGkAtoms::tableRowFrame == aType ||
|
|
||||||
nsGkAtoms::tableRowGroupFrame == aType ||
|
|
||||||
nsGkAtoms::scrollFrame == aType ||
|
|
||||||
nsGkAtoms::tableFrame == aType ||
|
|
||||||
nsGkAtoms::tableColFrame == aType ||
|
|
||||||
nsGkAtoms::tableColGroupFrame == aType;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
AnyTablePartHasBorderOrBackground(nsIFrame* aStart, nsIFrame* aEnd)
|
AnyTablePartHasBorderOrBackground(nsIFrame* aStart, nsIFrame* aEnd)
|
||||||
{
|
{
|
||||||
|
|
|
@ -237,6 +237,13 @@ public:
|
||||||
const nsRect& aDirtyRect,
|
const nsRect& aDirtyRect,
|
||||||
nsPoint aPt, uint32_t aBGPaintFlags);
|
nsPoint aPt, uint32_t aBGPaintFlags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines if any table part has a background image that is currently not
|
||||||
|
* decoded. Does not look into cell contents (ie only table parts).
|
||||||
|
*/
|
||||||
|
static bool AnyTablePartHasUndecodedBackgroundImage(nsIFrame* aStart,
|
||||||
|
nsIFrame* aEnd);
|
||||||
|
|
||||||
/** Get the outer half (i.e., the part outside the height and width of
|
/** Get the outer half (i.e., the part outside the height and width of
|
||||||
* the table) of the largest segment (?) of border-collapsed border on
|
* the table) of the largest segment (?) of border-collapsed border on
|
||||||
* the table on each side, or 0 for non border-collapsed tables.
|
* the table on each side, or 0 for non border-collapsed tables.
|
||||||
|
|
|
@ -533,11 +533,29 @@ public:
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
virtual void ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
|
||||||
|
const nsDisplayItemGeometry* aGeometry,
|
||||||
|
nsRegion *aInvalidRegion) MOZ_OVERRIDE;
|
||||||
virtual void Paint(nsDisplayListBuilder* aBuilder,
|
virtual void Paint(nsDisplayListBuilder* aBuilder,
|
||||||
nsRenderingContext* aCtx);
|
nsRenderingContext* aCtx);
|
||||||
NS_DISPLAY_DECL_NAME("TableRowBackground", TYPE_TABLE_ROW_BACKGROUND)
|
NS_DISPLAY_DECL_NAME("TableRowBackground", TYPE_TABLE_ROW_BACKGROUND)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDisplayTableRowBackground::ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
|
||||||
|
const nsDisplayItemGeometry* aGeometry,
|
||||||
|
nsRegion *aInvalidRegion)
|
||||||
|
{
|
||||||
|
if (aBuilder->ShouldSyncDecodeImages()) {
|
||||||
|
if (nsTableFrame::AnyTablePartHasUndecodedBackgroundImage(mFrame, mFrame->GetNextSibling())) {
|
||||||
|
bool snap;
|
||||||
|
aInvalidRegion->Or(*aInvalidRegion, GetBounds(aBuilder, &snap));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nsDisplayTableItem::ComputeInvalidationRegion(aBuilder, aGeometry, aInvalidRegion);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsDisplayTableRowBackground::Paint(nsDisplayListBuilder* aBuilder,
|
nsDisplayTableRowBackground::Paint(nsDisplayListBuilder* aBuilder,
|
||||||
nsRenderingContext* aCtx)
|
nsRenderingContext* aCtx)
|
||||||
|
|
|
@ -137,12 +137,30 @@ public:
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
virtual void ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
|
||||||
|
const nsDisplayItemGeometry* aGeometry,
|
||||||
|
nsRegion *aInvalidRegion) MOZ_OVERRIDE;
|
||||||
virtual void Paint(nsDisplayListBuilder* aBuilder,
|
virtual void Paint(nsDisplayListBuilder* aBuilder,
|
||||||
nsRenderingContext* aCtx);
|
nsRenderingContext* aCtx);
|
||||||
|
|
||||||
NS_DISPLAY_DECL_NAME("TableRowGroupBackground", TYPE_TABLE_ROW_GROUP_BACKGROUND)
|
NS_DISPLAY_DECL_NAME("TableRowGroupBackground", TYPE_TABLE_ROW_GROUP_BACKGROUND)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDisplayTableRowGroupBackground::ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
|
||||||
|
const nsDisplayItemGeometry* aGeometry,
|
||||||
|
nsRegion *aInvalidRegion)
|
||||||
|
{
|
||||||
|
if (aBuilder->ShouldSyncDecodeImages()) {
|
||||||
|
if (nsTableFrame::AnyTablePartHasUndecodedBackgroundImage(mFrame, mFrame->GetNextSibling())) {
|
||||||
|
bool snap;
|
||||||
|
aInvalidRegion->Or(*aInvalidRegion, GetBounds(aBuilder, &snap));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nsDisplayTableItem::ComputeInvalidationRegion(aBuilder, aGeometry, aInvalidRegion);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsDisplayTableRowGroupBackground::Paint(nsDisplayListBuilder* aBuilder,
|
nsDisplayTableRowGroupBackground::Paint(nsDisplayListBuilder* aBuilder,
|
||||||
nsRenderingContext* aCtx)
|
nsRenderingContext* aCtx)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче