Bug 528604. Don't add areas-to-repaint when scrolling for non-moving clip rects that aren't clipping any moving content. r=dbaron

This commit is contained in:
Robert O'Callahan 2009-11-18 13:38:17 +13:00
Родитель 2237966136
Коммит 2c262b74da
2 изменённых файлов: 19 добавлений и 1 удалений

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

@ -1180,8 +1180,12 @@ AddItemsToRegion(nsDisplayListBuilder* aBuilder, nsDisplayList* aList,
// If the clipping frame is moving, then it isn't clipping any
// non-moving content (see ApplyAbsPosClipping), so we don't need
// to do anything special, but we should not restrict aClipRect.
// If the clipping frame is not moving, but the moving frames
// are not in its descendants, then again we don't need to
// do anything special.
nsIFrame* clipFrame = clipItem->GetClippingFrame();
if (!aBuilder->IsMovingFrame(clipFrame)) {
if (!aBuilder->IsMovingFrame(clipFrame) &&
nsLayoutUtils::IsProperAncestorFrame(clipFrame, aBuilder->GetRootMovingFrame())) {
nscoord appUnitsPerDevPixel = clipFrame->PresContext()->AppUnitsPerDevPixel();
// We know the nsDisplayClip will snap because we're in a context
// where pixels can be blitted and we don't traverse down through

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

@ -91,6 +91,13 @@ body > div {
<div style="margin-top:20px; height:20px; margin-bottom:300px; background-color:blue; overflow:hidden;"></div>
</div>
<div id="testNonmovingClipArea">
<div style="height:300px; background:-moz-linear-gradient(top, red, black);"></div>
<div style="position:fixed; left:0; top:150px; width:200px; height:50px; background:yellow; overflow:hidden; opacity:0.5;">
<div style="height:50px; background:-moz-linear-gradient(top, green, yellow); opacity:0.3;"></div>
</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>
@ -232,6 +239,13 @@ function testMovingClipArea(blitRegion, paintRegion) {
"Shouldn't repaint anything: " + paintRegion.toString());
}
function testNonmovingClipArea(blitRegion, paintRegion) {
ok(blitRegion.equalsRegion(new Region([[0,0,200,130]])),
"Should only blit necessary strip: " + blitRegion.toString());
ok(paintRegion.equalsRegion(new Region([[0,130,200,200]])),
"Should only repaint necessary strip: " + 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());