Bug 1719375 - Consider documents used-as-an-image always active. r=tnikkel

These are ticked when painted, so it is fine and it's effectively what
happened before bug 1717983 (because we didn't get into this condition:
https://hg.mozilla.org/mozilla-central/rev/cb704553fc64#l3.73).

Differential Revision: https://phabricator.services.mozilla.com/D119314
This commit is contained in:
Emilio Cobos Álvarez 2021-07-08 12:54:48 +00:00
parent ab234269bd
commit 7ee0e2d6e4
4 changed files with 40 additions and 1 deletions

View File

@ -0,0 +1,12 @@
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
style="animation: colorAnim 1s steps(2) infinite alternate"
width="40" height="40">
<style>
@keyframes colorAnim {
from { background-color: green }
to { background-color: blue }
}
</style>
</svg>

After

Width:  |  Height:  |  Size: 319 B

View File

@ -2,6 +2,7 @@
support-files =
INT32_MIN.bmp
animated1.gif
animated1.svg
animated2.gif
animated-gif.gif
animated-gif2.gif

View File

@ -150,7 +150,25 @@ const kTests = [
element(doc) {
return doc.documentElement;
},
}
},
// bug 1719375: CSS animation in SVG image.
{
html: `
<!doctype html>
<style>
div {
width: 100px;
height: 100px;
background-image: url(animated1.svg);
}
</style>
<div></div>
`,
element(doc) {
return doc.querySelector("div");
},
},
];
onload = async function() {

View File

@ -10788,6 +10788,14 @@ bool PresShell::ShouldBeActive() const {
mIsActive));
Document* doc = mDocument;
if (doc->IsBeingUsedAsImage()) {
// Documents used as an image can remain active. They do not tick their
// refresh driver if not painted, and they can't run script or such so they
// can't really observe much else.
return true;
}
if (Document* displayDoc = doc->GetDisplayDocument()) {
// Ok, we're an external resource document -- we need to use our display
// document's docshell to determine "IsActive" status, since we lack