mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-22 10:27:03 +00:00
Bug 1634839. Call UpdateState on the animation state in RasterImage::NotifyProgress. r=aosmond
Since AnimationState::UpdateState now depends on a specific frame of the animation being in the surface cache we need to call UpdateState whenever we add a new frame. Depends on D73583 Differential Revision: https://phabricator.services.mozilla.com/D73584
This commit is contained in:
parent
9f72de06ce
commit
7994dd5c2d
@ -1655,14 +1655,7 @@ void RasterImage::NotifyProgress(
|
||||
// Ensure that we stay alive long enough to finish notifying.
|
||||
RefPtr<RasterImage> image = this;
|
||||
|
||||
const bool wasDefaultFlags = aSurfaceFlags == DefaultSurfaceFlags();
|
||||
|
||||
auto invalidRect = ToOriented(aInvalidRect);
|
||||
|
||||
if (!invalidRect.IsEmpty() && wasDefaultFlags) {
|
||||
// Update our image container since we're invalidating.
|
||||
UpdateImageContainer(Some(invalidRect.ToUnknownRect()));
|
||||
}
|
||||
UnorientedIntRect invalidRect = aInvalidRect;
|
||||
|
||||
if (!(aDecoderFlags & DecoderFlags::FIRST_FRAME_ONLY)) {
|
||||
// We may have decoded new animation frames; update our animation state.
|
||||
@ -1676,11 +1669,28 @@ void RasterImage::NotifyProgress(
|
||||
ShouldAnimate()) {
|
||||
StartAnimation();
|
||||
}
|
||||
|
||||
if (mAnimationState) {
|
||||
auto size = ToUnoriented(mSize);
|
||||
IntRect rect = mAnimationState->UpdateState(this, size.ToUnknownSize());
|
||||
|
||||
invalidRect.UnionRect(invalidRect,
|
||||
UnorientedIntRect::FromUnknownRect(rect));
|
||||
}
|
||||
}
|
||||
|
||||
const bool wasDefaultFlags = aSurfaceFlags == DefaultSurfaceFlags();
|
||||
|
||||
auto orientedInvalidRect = ToOriented(invalidRect);
|
||||
|
||||
if (!orientedInvalidRect.IsEmpty() && wasDefaultFlags) {
|
||||
// Update our image container since we're invalidating.
|
||||
UpdateImageContainer(Some(orientedInvalidRect.ToUnknownRect()));
|
||||
}
|
||||
|
||||
// Tell the observers what happened.
|
||||
image->mProgressTracker->SyncNotifyProgress(aProgress,
|
||||
invalidRect.ToUnknownRect());
|
||||
image->mProgressTracker->SyncNotifyProgress(
|
||||
aProgress, orientedInvalidRect.ToUnknownRect());
|
||||
}
|
||||
|
||||
void RasterImage::NotifyDecodeComplete(
|
||||
|
1
image/test/crashtests/1634839-2-iframe.html
Normal file
1
image/test/crashtests/1634839-2-iframe.html
Normal file
@ -0,0 +1 @@
|
||||
<img id="image1" src="out2.gif">
|
51
image/test/crashtests/1634839-2.html
Normal file
51
image/test/crashtests/1634839-2.html
Normal file
@ -0,0 +1,51 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">
|
||||
<iframe id='if' src="1634839-2-iframe.html"></iframe>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let iterationsLeft = 1;
|
||||
|
||||
let img = null;
|
||||
|
||||
function runTest() {
|
||||
// Make sure the image is decoded and advanced to it's final frame.
|
||||
img = document.getElementById("if").contentWindow.document.getElementById("image1");
|
||||
img.decode().then(function() {
|
||||
setTimeout(forceDiscard, 1000);
|
||||
});
|
||||
}
|
||||
|
||||
function showIframe() {
|
||||
document.getElementById("container").style.display = "";
|
||||
document.documentElement.getBoundingClientRect();
|
||||
requestAnimationFrame(forceDecode);
|
||||
}
|
||||
|
||||
function forceDecode() {
|
||||
img.decode().then(function() {
|
||||
setTimeout(forceDiscard, 0);
|
||||
});
|
||||
}
|
||||
|
||||
function forceDiscard() {
|
||||
iterationsLeft--;
|
||||
if (iterationsLeft < 0) {
|
||||
document.documentElement.className = "";
|
||||
return;
|
||||
}
|
||||
document.getElementById("container").style.display = "none";
|
||||
document.documentElement.getBoundingClientRect();
|
||||
img.remove();
|
||||
requestAnimationFrame(() => { requestAnimationFrame( () => { setTimeout(showIframe, 0); } ) });
|
||||
}
|
||||
|
||||
//window.addEventListener("load", runTest);
|
||||
window.addEventListener("MozReftestInvalidate", runTest);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -66,3 +66,4 @@ load 1526717-1.html
|
||||
load 1629490-1.html
|
||||
|
||||
HTTP load 1634839-1.html
|
||||
HTTP load 1634839-2.html
|
||||
|
BIN
image/test/crashtests/out2.gif
Normal file
BIN
image/test/crashtests/out2.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
Loading…
x
Reference in New Issue
Block a user