Change the subdoc invalidation callback to handle overflow. (bug 1345891 part 5, r=mattwoodrow)
This commit is contained in:
@@ -136,7 +136,8 @@ NotifySubdocumentInvalidation(Layer* aLayer, NotifySubDocInvalidationFunc aCallb
|
||||
{
|
||||
ContainerLayer* container = layer->AsContainerLayer();
|
||||
if (container) {
|
||||
aCallback(container, container->GetLocalVisibleRegion().ToUnknownRegion());
|
||||
nsIntRegion region = container->GetLocalVisibleRegion().ToUnknownRegion();
|
||||
aCallback(container, ®ion);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -471,7 +472,7 @@ public:
|
||||
}
|
||||
|
||||
if (aCallback) {
|
||||
aCallback(container, result);
|
||||
aCallback(container, areaOverflowed ? nullptr : &result);
|
||||
}
|
||||
|
||||
if (childrenChanged || areaOverflowed) {
|
||||
|
||||
@@ -21,10 +21,10 @@ class ContainerLayer;
|
||||
*
|
||||
* @param aContainer ContainerLayer being invalidated.
|
||||
* @param aRegion Invalidated region in the ContainerLayer's coordinate
|
||||
* space.
|
||||
* space. If null, then the entire region must be invalidated.
|
||||
*/
|
||||
typedef void (*NotifySubDocInvalidationFunc)(ContainerLayer* aLayer,
|
||||
const nsIntRegion& aRegion);
|
||||
const nsIntRegion* aRegion);
|
||||
|
||||
/**
|
||||
* A set of cached layer properties (including those of child layers),
|
||||
|
||||
@@ -97,6 +97,7 @@
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::gfx;
|
||||
using namespace mozilla::layers;
|
||||
|
||||
uint8_t gNotifySubDocInvalidationData;
|
||||
@@ -2609,7 +2610,7 @@ nsPresContext::NotifyInvalidation(uint64_t aTransactionId, const nsRect& aRect)
|
||||
|
||||
/* static */ void
|
||||
nsPresContext::NotifySubDocInvalidation(ContainerLayer* aContainer,
|
||||
const nsIntRegion& aRegion)
|
||||
const nsIntRegion* aRegion)
|
||||
{
|
||||
ContainerLayerPresContext *data =
|
||||
static_cast<ContainerLayerPresContext*>(
|
||||
@@ -2618,15 +2619,23 @@ nsPresContext::NotifySubDocInvalidation(ContainerLayer* aContainer,
|
||||
return;
|
||||
}
|
||||
|
||||
nsIntPoint topLeft = aContainer->GetVisibleRegion().ToUnknownRegion().GetBounds().TopLeft();
|
||||
uint64_t transactionId = aContainer->Manager()->GetLastTransactionId();
|
||||
IntRect visibleBounds = aContainer->GetVisibleRegion().GetBounds().ToUnknownRect();
|
||||
|
||||
for (auto iter = aRegion.RectIter(); !iter.Done(); iter.Next()) {
|
||||
if (!aRegion) {
|
||||
IntRect rect(IntPoint(0, 0), visibleBounds.Size());
|
||||
data->mPresContext->NotifyInvalidation(transactionId, rect);
|
||||
return;
|
||||
}
|
||||
|
||||
nsIntPoint topLeft = visibleBounds.TopLeft();
|
||||
for (auto iter = aRegion->RectIter(); !iter.Done(); iter.Next()) {
|
||||
nsIntRect rect(iter.Get());
|
||||
//PresContext coordinate space is relative to the start of our visible
|
||||
// region. Is this really true? This feels like the wrong way to get the right
|
||||
// answer.
|
||||
rect.MoveBy(-topLeft);
|
||||
data->mPresContext->NotifyInvalidation(aContainer->Manager()->GetLastTransactionId(), rect);
|
||||
data->mPresContext->NotifyInvalidation(transactionId, rect);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1028,7 +1028,7 @@ public:
|
||||
// Callback for catching invalidations in ContainerLayers
|
||||
// Passed to LayerProperties::ComputeDifference
|
||||
static void NotifySubDocInvalidation(mozilla::layers::ContainerLayer* aContainer,
|
||||
const nsIntRegion& aRegion);
|
||||
const nsIntRegion* aRegion);
|
||||
void SetNotifySubDocInvalidationData(mozilla::layers::ContainerLayer* aContainer);
|
||||
static void ClearNotifySubDocInvalidationData(mozilla::layers::ContainerLayer* aContainer);
|
||||
bool IsDOMPaintEventPending();
|
||||
|
||||
Reference in New Issue
Block a user