Bug 1130328 (Part 1) - Add support for an optional frame-space damage rect to nsIFrame::InvalidateLayer. r=mattwoodrow

--HG--
extra : rebase_source : f622e5a031f2832937115a20ce0e457d4542bfe9
This commit is contained in:
Seth Fowler 2015-02-11 01:11:41 -08:00
Родитель 8fb2e275d3
Коммит 1ddf2327c3
3 изменённых файлов: 26 добавлений и 9 удалений

Просмотреть файл

@ -141,7 +141,7 @@ void VideoFrameContainer::InvalidateWithFlags(uint32_t aFlags)
if (invalidateFrame) {
frame->InvalidateFrame();
} else {
frame->InvalidateLayer(nsDisplayItem::TYPE_VIDEO, nullptr,
frame->InvalidateLayer(nsDisplayItem::TYPE_VIDEO, nullptr, nullptr,
asyncInvalidate ? nsIFrame::UPDATE_IS_ASYNC : 0);
}
}

Просмотреть файл

@ -5190,6 +5190,7 @@ nsIFrame::SchedulePaint(PaintType aType)
Layer*
nsIFrame::InvalidateLayer(uint32_t aDisplayItemKey,
const nsIntRect* aDamageRect,
const nsRect* aFrameDamageRect,
uint32_t aFlags /* = 0 */)
{
NS_ASSERTION(aDisplayItemKey > 0, "Need a key");
@ -5203,11 +5204,11 @@ nsIFrame::InvalidateLayer(uint32_t aDisplayItemKey,
return layer;
}
if (aDamageRect && aDamageRect->IsEmpty()) {
return layer;
}
if (!layer) {
if (aFrameDamageRect && aFrameDamageRect->IsEmpty()) {
return nullptr;
}
// Plugins can transition from not rendering anything to rendering,
// and still only call this. So always invalidate, with specifying
// the display item type just in case.
@ -5216,15 +5217,25 @@ nsIFrame::InvalidateLayer(uint32_t aDisplayItemKey,
// screen because sometimes we don't have any retainned data
// for remote type displayitem and thus Repaint event is not
// triggered. So, always invalidate here as well.
uint32_t displayItemKey = aDisplayItemKey;
if (aDisplayItemKey == nsDisplayItem::TYPE_PLUGIN ||
aDisplayItemKey == nsDisplayItem::TYPE_REMOTE) {
InvalidateFrame();
} else {
InvalidateFrame(aDisplayItemKey);
displayItemKey = 0;
}
if (aFrameDamageRect) {
InvalidateFrameWithRect(*aFrameDamageRect, displayItemKey);
} else {
InvalidateFrame(displayItemKey);
}
return nullptr;
}
if (aDamageRect && aDamageRect->IsEmpty()) {
return layer;
}
if (aDamageRect) {
layer->AddInvalidRect(*aDamageRect);
} else {

Просмотреть файл

@ -2224,6 +2224,9 @@ public:
* If no layer is found, calls InvalidateFrame() instead.
*
* @param aDamageRect Area of the layer to invalidate.
* @param aFrameDamageRect If no layer is found, the area of the frame to
* invalidate. If null, the entire frame will be
* invalidated.
* @param aDisplayItemKey Display item type.
* @param aFlags UPDATE_IS_ASYNC : Will skip the invalidation
* if the found layer is being composited by a remote
@ -2233,7 +2236,10 @@ public:
enum {
UPDATE_IS_ASYNC = 1 << 0
};
Layer* InvalidateLayer(uint32_t aDisplayItemKey, const nsIntRect* aDamageRect = nullptr, uint32_t aFlags = 0);
Layer* InvalidateLayer(uint32_t aDisplayItemKey,
const nsIntRect* aDamageRect = nullptr,
const nsRect* aFrameDamageRect = nullptr,
uint32_t aFlags = 0);
/**
* Returns a rect that encompasses everything that might be painted by