Bug 805343. Part 2: Update FrameLayerBuilder::HasVisibleRetainedDataFor to account for occluded display items. r=mattwoodrow

--HG--
extra : rebase_source : 293895627ef5f37c508a23fe9e9a5639527aafcc
This commit is contained in:
Robert O'Callahan 2012-12-10 18:49:17 +13:00
parent 7aebe60cc1
commit 4f25ab855f
3 changed files with 10 additions and 8 deletions

View File

@ -1102,13 +1102,15 @@ FrameLayerBuilder::GetDisplayItemDataForManager(nsDisplayItem* aItem,
}
bool
FrameLayerBuilder::HasRetainedDataFor(nsIFrame* aFrame, uint32_t aDisplayItemKey)
FrameLayerBuilder::HasVisibleRetainedDataFor(nsIFrame* aFrame, uint32_t aDisplayItemKey)
{
nsTArray<DisplayItemData*> *array =
reinterpret_cast<nsTArray<DisplayItemData*>*>(aFrame->Properties().Get(LayerManagerDataProperty()));
if (array) {
for (uint32_t i = 0; i < array->Length(); i++) {
if (array->ElementAt(i)->mDisplayItemKey == aDisplayItemKey) {
DisplayItemData* data = array->ElementAt(i);
if (data->mDisplayItemKey == aDisplayItemKey &&
data->IsVisibleInLayer()) {
return true;
}
}

View File

@ -315,10 +315,10 @@ public:
LayerManager* GetRetainingLayerManager() { return mRetainingManager; }
/**
* Returns true if the given display item was rendered during the previous
* paint. Returns false otherwise.
* Returns true if the given display item was visible in its layer during
* the previous paint. Returns false otherwise.
*/
static bool HasRetainedDataFor(nsIFrame* aFrame, uint32_t aDisplayItemKey);
static bool HasVisibleRetainedDataFor(nsIFrame* aFrame, uint32_t aDisplayItemKey);
typedef void (*DisplayItemDataCallback)(nsIFrame *aFrame, DisplayItemData* aItem);

View File

@ -4873,7 +4873,7 @@ void
nsIFrame::InvalidateFrameSubtree(uint32_t aDisplayItemKey)
{
bool hasDisplayItem =
!aDisplayItemKey || FrameLayerBuilder::HasRetainedDataFor(this, aDisplayItemKey);
!aDisplayItemKey || FrameLayerBuilder::HasVisibleRetainedDataFor(this, aDisplayItemKey);
InvalidateFrame(aDisplayItemKey);
if (HasAnyStateBits(NS_FRAME_ALL_DESCENDANTS_NEED_PAINT) || !hasDisplayItem) {
@ -4919,7 +4919,7 @@ void
nsIFrame::InvalidateFrame(uint32_t aDisplayItemKey)
{
bool hasDisplayItem =
!aDisplayItemKey || FrameLayerBuilder::HasRetainedDataFor(this, aDisplayItemKey);
!aDisplayItemKey || FrameLayerBuilder::HasVisibleRetainedDataFor(this, aDisplayItemKey);
InvalidateFrameInternal(this, hasDisplayItem);
}
@ -4927,7 +4927,7 @@ void
nsIFrame::InvalidateFrameWithRect(const nsRect& aRect, uint32_t aDisplayItemKey)
{
bool hasDisplayItem =
!aDisplayItemKey || FrameLayerBuilder::HasRetainedDataFor(this, aDisplayItemKey);
!aDisplayItemKey || FrameLayerBuilder::HasVisibleRetainedDataFor(this, aDisplayItemKey);
bool alreadyInvalid = false;
if (!HasAnyStateBits(NS_FRAME_NEEDS_PAINT)) {
InvalidateFrameInternal(this, hasDisplayItem);