Bug 1460389 - Use non-animated (static) value if the animation is in not in-effect. r=birtles,kats

MozReview-Commit-ID: 87YgNy0RkKt

--HG--
extra : rebase_source : ac77b639a558197082f4ac52c02a9988bb2a9194
This commit is contained in:
Hiroyuki Ikezoe 2018-05-15 09:02:38 +09:00
Родитель b63fbaf5f6
Коммит ea397e2c09
2 изменённых файлов: 24 добавлений и 15 удалений

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

@ -1620,25 +1620,40 @@ pub extern "C" fn wr_dp_push_stacking_context(state: &mut WrState,
None => None,
};
let opacity_ref = unsafe { opacity.as_ref() };
if let Some(opacity) = opacity_ref {
if *opacity < 1.0 {
filters.push(FilterOp::Opacity(PropertyBinding::Value(*opacity), *opacity));
}
}
let transform_ref = unsafe { transform.as_ref() };
let mut transform_binding = match transform_ref {
Some(transform) => Some(PropertyBinding::Value(transform.clone())),
None => None,
};
let opacity_ref = unsafe { opacity.as_ref() };
let mut has_opacity_animation = false;
let anim = unsafe { animation.as_ref() };
if let Some(anim) = anim {
debug_assert!(anim.id > 0);
match anim.effect_type {
WrAnimationType::Opacity => filters.push(FilterOp::Opacity(PropertyBinding::Binding(PropertyBindingKey::new(anim.id), 1.0), 1.0)),
WrAnimationType::Transform => transform_binding = Some(PropertyBinding::Binding(PropertyBindingKey::new(anim.id), LayoutTransform::identity())),
WrAnimationType::Opacity => {
filters.push(FilterOp::Opacity(PropertyBinding::Binding(PropertyBindingKey::new(anim.id),
// We have to set the static opacity value as
// the value for the case where the animation is
// in not in-effect (e.g. in the delay phase
// with no corresponding fill mode).
opacity_ref.cloned().unwrap_or(1.0)),
1.0));
has_opacity_animation = true;
},
WrAnimationType::Transform => {
transform_binding =
Some(PropertyBinding::Binding(PropertyBindingKey::new(anim.id),
// Same as above opacity case.
transform_ref.cloned().unwrap_or(LayoutTransform::identity())));
},
}
}
if let Some(opacity) = opacity_ref {
if !has_opacity_animation && *opacity < 1.0 {
filters.push(FilterOp::Opacity(PropertyBinding::Value(*opacity), *opacity));
}
}

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

@ -6739,7 +6739,6 @@ nsDisplayOpacity::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuil
wr::WrAnimationProperty prop;
if (!animationInfo.GetAnimations().IsEmpty()) {
opacityForSC = nullptr;
prop.id = animationsId;
prop.effect_type = wr::WrAnimationType::Opacity;
@ -8611,11 +8610,6 @@ nsDisplayTransform::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBu
uint64_t animationsId = animationInfo.GetCompositorAnimationsId();
wr::WrAnimationProperty prop;
if (!animationInfo.GetAnimations().IsEmpty()) {
// Update transfrom as nullptr in stacking context if there exists
// transform animation, the transform value will be resolved
// after animation sampling on the compositor
transformForSC = nullptr;
prop.id = animationsId;
prop.effect_type = wr::WrAnimationType::Transform;