mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 815408: Ignore CSS transitions and animations in print and print preview. r=bzbarsky
Note that this patch has a little bit of a belt-and-braces aspect to it. In each file, either one of the changes should be sufficient, but one of them prevents us from doing unneeded work and the other one ensures that we never apply style resulting from transitions and animations even if somehow we do that work. Also note that the tests don't actually test anything usefully, since the reftest harness doesn't currently make the pres context non-dynamic. (Thus they're marked as failing.) I'm not sure what I should do about that, though I'm considering just deleting the tests entirely.
This commit is contained in:
parent
2b20096ae9
commit
926f95308f
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html class="reftest-print">
|
||||
<title>Static CSS animation</title>
|
||||
<style>
|
||||
|
||||
p {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
</style>
|
||||
<p>blue with animation support; olive without</p>
|
11
layout/reftests/css-animations/print-no-animations-ref.html
Normal file
11
layout/reftests/css-animations/print-no-animations-ref.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html class="reftest-print">
|
||||
<title>Static CSS animation</title>
|
||||
<style>
|
||||
|
||||
p {
|
||||
color: olive;
|
||||
}
|
||||
|
||||
</style>
|
||||
<p>blue with animation support; olive without</p>
|
16
layout/reftests/css-animations/print-no-animations.html
Normal file
16
layout/reftests/css-animations/print-no-animations.html
Normal file
@ -0,0 +1,16 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html class="reftest-print">
|
||||
<title>Static CSS animation</title>
|
||||
<style>
|
||||
|
||||
@keyframes a {
|
||||
from, to { color: blue }
|
||||
}
|
||||
|
||||
p {
|
||||
color: olive;
|
||||
animation: a 1s infinite;
|
||||
}
|
||||
|
||||
</style>
|
||||
<p>blue with animation support; olive without</p>
|
4
layout/reftests/css-animations/reftest.list
Normal file
4
layout/reftests/css-animations/reftest.list
Normal file
@ -0,0 +1,4 @@
|
||||
== screen-animations.html screen-animations-ref.html
|
||||
!= screen-animations.html screen-animations-notref.html
|
||||
fails == print-no-animations.html print-no-animations-ref.html # reftest harness doesn't actually make pres context non-dynamic for reftest-print tests
|
||||
fails != print-no-animations.html print-no-animations-notref.html # reftest harness doesn't actually make pres context non-dynamic for reftest-print tests
|
11
layout/reftests/css-animations/screen-animations-notref.html
Normal file
11
layout/reftests/css-animations/screen-animations-notref.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<title>Static CSS animation</title>
|
||||
<style>
|
||||
|
||||
p {
|
||||
color: olive;
|
||||
}
|
||||
|
||||
</style>
|
||||
<p>blue with animation support; olive without</p>
|
11
layout/reftests/css-animations/screen-animations-ref.html
Normal file
11
layout/reftests/css-animations/screen-animations-ref.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<title>Static CSS animation</title>
|
||||
<style>
|
||||
|
||||
p {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
</style>
|
||||
<p>blue with animation support; olive without</p>
|
16
layout/reftests/css-animations/screen-animations.html
Normal file
16
layout/reftests/css-animations/screen-animations.html
Normal file
@ -0,0 +1,16 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<title>Static CSS animation</title>
|
||||
<style>
|
||||
|
||||
@keyframes a {
|
||||
from, to { color: blue }
|
||||
}
|
||||
|
||||
p {
|
||||
color: olive;
|
||||
animation: a 1s infinite;
|
||||
}
|
||||
|
||||
</style>
|
||||
<p>blue with animation support; olive without</p>
|
@ -48,6 +48,9 @@ include bugs/reftest.list
|
||||
# canvas 2D
|
||||
include canvas/reftest.list
|
||||
|
||||
# css animations
|
||||
include css-animations/reftest.list
|
||||
|
||||
# css calc() tests
|
||||
include css-calc/reftest.list
|
||||
|
||||
|
@ -539,6 +539,11 @@ nsAnimationManager::CheckAnimationRule(nsStyleContext* aStyleContext,
|
||||
mozilla::dom::Element* aElement)
|
||||
{
|
||||
if (!mPresContext->IsProcessingAnimationStyleChange()) {
|
||||
if (!mPresContext->IsDynamic()) {
|
||||
// For print or print preview, ignore animations.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Everything that causes our animation data to change triggers a
|
||||
// style change, which in turn triggers a non-animation restyle.
|
||||
// Likewise, when we initially construct frames, we're not in a
|
||||
@ -949,6 +954,11 @@ nsAnimationManager::GetAnimationRule(mozilla::dom::Element* aElement,
|
||||
aPseudoType == nsCSSPseudoElements::ePseudo_after,
|
||||
"forbidden pseudo type");
|
||||
|
||||
if (!mPresContext->IsDynamic()) {
|
||||
// For print or print preview, ignore animations.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ElementAnimations *ea =
|
||||
GetElementAnimations(aElement, aPseudoType, false);
|
||||
if (!ea) {
|
||||
|
@ -451,6 +451,11 @@ nsTransitionManager::StyleContextChanged(dom::Element *aElement,
|
||||
aNewStyleContext->HasPseudoElementData(),
|
||||
"pseudo type mismatch");
|
||||
|
||||
if (!mPresContext->IsDynamic()) {
|
||||
// For print or print preview, ignore transitions.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// NOTE: Things in this function (and ConsiderStartingTransition)
|
||||
// should never call PeekStyleData because we don't preserve gotten
|
||||
// structs across reframes.
|
||||
@ -893,6 +898,11 @@ nsTransitionManager::WalkTransitionRule(ElementDependentRuleProcessorData* aData
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mPresContext->IsDynamic()) {
|
||||
// For print or print preview, ignore animations.
|
||||
return;
|
||||
}
|
||||
|
||||
if (aData->mPresContext->IsProcessingRestyles() &&
|
||||
!aData->mPresContext->IsProcessingAnimationStyleChange()) {
|
||||
// If we're processing a normal style change rather than one from
|
||||
|
Loading…
Reference in New Issue
Block a user