Bug 1266161 - Make DrawForcedBackgroundColor fill the entire draw region, not just the layer's visible region. r=mattwoodrow

We need to do this because the entire draw region will be added to the layer's
valid region after drawing. If there are parts in the valid region that are not
in the visible region, we still need those parts to have valid content, because
in a later frame the visible region may grow to include those parts.

MozReview-Commit-ID: 6zESYbPAmrx

--HG--
extra : rebase_source : 24078d1ff802e53a2eb8895d2c5ffd1fe9507f04
This commit is contained in:
Markus Stange 2016-05-06 13:53:56 -04:00
Родитель 5d45419a2c
Коммит e475933648
4 изменённых файлов: 150 добавлений и 6 удалений

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

@ -5594,13 +5594,12 @@ ShouldDrawRectsSeparately(DrawTarget* aDrawTarget, DrawRegionClip aClip)
}
static void DrawForcedBackgroundColor(DrawTarget& aDrawTarget,
Layer* aLayer, nscolor
aBackgroundColor)
const IntRect& aBounds,
nscolor aBackgroundColor)
{
if (NS_GET_A(aBackgroundColor) > 0) {
LayerIntRect r = aLayer->GetVisibleRegion().GetBounds();
ColorPattern color(ToDeviceColor(aBackgroundColor));
aDrawTarget.FillRect(Rect(r.x, r.y, r.width, r.height), color);
aDrawTarget.FillRect(Rect(aBounds), color);
}
}
@ -5675,7 +5674,7 @@ FrameLayerBuilder::DrawPaintedLayer(PaintedLayer* aLayer,
gfxUtils::ClipToRegion(aContext, aRegionToDraw);
}
DrawForcedBackgroundColor(aDrawTarget, aLayer,
DrawForcedBackgroundColor(aDrawTarget, aRegionToDraw.GetBounds(),
userData->mForcedBackgroundColor);
}
@ -5714,7 +5713,7 @@ FrameLayerBuilder::DrawPaintedLayer(PaintedLayer* aLayer,
aContext->Rectangle(ThebesRect(iterRect));
aContext->Clip();
DrawForcedBackgroundColor(aDrawTarget, aLayer,
DrawForcedBackgroundColor(aDrawTarget, iterRect,
userData->mForcedBackgroundColor);
// Apply the residual transform if it has been enabled, to ensure that

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

@ -0,0 +1,39 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Bug 1266161 - Reference</title>
<style type="text/css">
html, body {
margin: 0;
}
#scrollbox {
overflow: auto;
height: 500px;
width: 500px;
}
#scrolled {
height: 1201px;
}
</style>
<div id="wrapper">
<div id="scrollbox">
<div id="scrolled">
</div>
</div>
</div>
<script>
var scrollbox = document.getElementById("scrollbox");
scrollbox.scrollTop = 80;
</script>

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

@ -0,0 +1,105 @@
<!DOCTYPE html>
<html lang="en" class="reftest-wait" reftest-async-scroll>
<meta charset="utf-8">
<title>Bug 1266161 - Black boxes during scrolling</title>
<style type="text/css">
html, body {
margin: 0;
height: 100%;
}
body {
outline: 2px solid white;
}
#scrollbox {
overflow: auto;
will-change: transform, scroll-position;
height: 500px;
width: 500px;
}
#scrolled {
padding-top: 1px;
height: 1200px;
}
p {
height: 20px;
background: white;
margin-top: 16px;
}
span, em {
display: block;
background: white;
width: 134px;
height: 14px;
margin-top: 32px;
}
em {
width: 10px;
}
</style>
<div id="scrollbox"
reftest-displayport-x="0"
reftest-displayport-y="0"
reftest-displayport-w="500"
reftest-displayport-h="500">
<div id="scrolled">
<p></p>
<p></p>
<p></p>
<span style="margin-top: 48px"></span>
<span style="margin-top: 64px"></span>
<span style="margin-top: 96px"></span>
<span style="margin-top: 96px"></span>
<em></em>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</div>
<script>
var scrollbox = document.getElementById("scrollbox");
var pos = [ 170, 100, 248, 182, 130, 80 ];
var i = 0;
function scrollToNextPos() {
scrollbox.scrollTop = pos[i++];
}
scrollToNextPos();
window.addEventListener("MozReftestInvalidate", function () {
requestAnimationFrame(function scrollAndScheduleNext() {
scrollToNextPos();
if (i < pos.length) {
requestAnimationFrame(scrollAndScheduleNext);
} else {
document.documentElement.className = "";
}
});
});
</script>

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

@ -20,3 +20,4 @@ skip-if(!asyncPan) != pull-background-displayport-5.html about:blank
skip-if(!asyncPan) != pull-background-displayport-6.html about:blank # fails with non-overlay scrollbars and event regions due to bug 1148515
fuzzy(2,30150) == opacity-blending.html opacity-blending-ref.html
fuzzy(16,5) == mask-layer-transform.html mask-layer-transform-ref.html
fuzzy-if(gtkWidget,1,17) == forced-bg-color-outside-visible-region.html forced-bg-color-outside-visible-region-ref.html