Bug 787623. Call MarkContextClean immediately if we're not going to receive a DidTransactionCallback. r=joedrew

--HG--
extra : rebase_source : 459c517fba4b6c2e6e6d95200aebec9369c0edb6
This commit is contained in:
Robert O'Callahan 2012-09-05 22:28:23 +12:00
parent 8f39d91f36
commit d1f472b4ee
5 changed files with 34 additions and 0 deletions

View File

@ -4321,6 +4321,9 @@ nsCanvasRenderingContext2D::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
// If we don't have anything to draw, don't bother.
if (!mValid || !mSurface || mSurface->CairoStatus() || !mThebes ||
!mSurfaceCreated) {
// No DidTransactionCallback will be received, so mark the context clean
// now so future invalidations will be dispatched.
MarkContextClean();
return nullptr;
}
@ -4337,6 +4340,9 @@ nsCanvasRenderingContext2D::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
nsRefPtr<CanvasLayer> canvasLayer = aManager->CreateCanvasLayer();
if (!canvasLayer) {
NS_WARNING("CreateCanvasLayer returned null!");
// No DidTransactionCallback will be received, so mark the context clean
// now so future invalidations will be dispatched.
MarkContextClean();
return nullptr;
}
CanvasRenderingContext2DUserData *userData = nullptr;

View File

@ -4626,6 +4626,9 @@ nsCanvasRenderingContext2DAzure::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
LayerManager *aManager)
{
if (!mValid) {
// No DidTransactionCallback will be received, so mark the context clean
// now so future invalidations will be dispatched.
MarkContextClean();
return nullptr;
}
@ -4646,6 +4649,9 @@ nsCanvasRenderingContext2DAzure::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
nsRefPtr<CanvasLayer> canvasLayer = aManager->CreateCanvasLayer();
if (!canvasLayer) {
NS_WARNING("CreateCanvasLayer returned null!");
// No DidTransactionCallback will be received, so mark the context clean
// now so future invalidations will be dispatched.
MarkContextClean();
return nullptr;
}
CanvasRenderingContext2DUserDataAzure *userData = nullptr;

View File

@ -0,0 +1,6 @@
<!DOCTYPE HTML>
<html>
<body>
<div style="background:black; width:100px; height:100px;"></div>
</body>
</html>

View File

@ -0,0 +1,14 @@
<!DOCTYPE HTML>
<html class="reftest-wait">
<body>
<canvas style="display:block" id="c" width="100" height="100"></canvas>
<script>
var ctx = document.getElementById("c").getContext("2d");
function doTest() {
document.documentElement.removeAttribute("class");
ctx.fillRect(0, 0, 100, 100);
}
window.addEventListener("MozReftestInvalidate", doTest, false);
</script>
</body>
</html>

View File

@ -1,6 +1,8 @@
== default-size.html default-size-ref.html
== size-1.html size-1-ref.html
== empty-transaction-1.html empty-transaction-1-ref.html
== image-rendering-test.html image-rendering-ref.html
== image-shadow.html image-shadow-ref.html