Bug 523911. Content that's not moving, that's positioned over uniform content that is moving, does not need to be repainted. r=dbaron

This commit is contained in:
Robert O'Callahan 2009-11-04 07:39:42 +13:00
Родитель 3a9836be55
Коммит bbc584bbb1
2 изменённых файлов: 21 добавлений и 2 удалений

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

@ -324,7 +324,8 @@ nsDisplayList::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsAutoTArray<nsDisplayItem*, 512> elements;
FlattenTo(&elements);
// Accumulate the bounds of all moving content we find in this list
// Accumulate the bounds of all moving content we find in this list.
// For speed, we store only a bounding box, not a region.
nsRect movingContentAccumulatedBounds;
// Store an overapproximation of the visible regions for the moving
// content in this list
@ -345,7 +346,13 @@ nsDisplayList::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsIFrame* f = item->GetUnderlyingFrame();
PRBool isMoving = f && aBuilder->IsMovingFrame(f);
if (isMoving) {
// Record bounds of moving visible items in movingContentAccumulatedBounds.
// We do not need to add items that are uniform across the entire visible
// area, since they have no visible movement.
if (isMoving &&
!(item->IsUniform(aBuilder) &&
bounds.Contains(aVisibleRegion->GetBounds()) &&
bounds.Contains(aVisibleRegionBeforeMove->GetBounds()))) {
if (movingContentAccumulatedBounds.IsEmpty()) {
// *aVisibleRegion can only shrink during this loop, so storing
// the first one we see is a sound overapproximation

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

@ -91,6 +91,11 @@ body > div {
<div style="margin-top:20px; height:20px; margin-bottom:300px; background-color:blue; overflow:hidden;"></div>
</div>
<div id="testFixedOverUniform">
<div style="height:300px; background:blue;"></div>
<div style="position:fixed; left:0; top:50px; width:100px; height:45px; background:yellow; opacity:0.5;"></div>
</div>
<script>
var tests = document.querySelectorAll("body>div");
var currentTest = -1;
@ -227,6 +232,13 @@ function testMovingClipArea(blitRegion, paintRegion) {
"Shouldn't repaint anything: " + paintRegion.toString());
}
function testFixedOverUniform(blitRegion, paintRegion) {
ok(!blitRegion.intersectsRect([0,20,200,200]),
"Shouldn't blit anything except possibly to cover the area that has moved offscreen: " + blitRegion.toString());
ok(paintRegion.isEmpty(),
"Shouldn't repaint anything: " + paintRegion.toString());
}
function clientRectToRect(cr)
{
return [cr.left, cr.top, cr.right, cr.bottom];