Bug 1527210 - Drop KeyframeEffect::MaybeUpdateFrameForCompositor; r=hiro

Since bug 1524480 we set the NS_FRAME_MAY_BE_TRANSFORMED frame bit when needed
in RestyleManager::ProcessRestyledFrames so that it is now redundant to also set
it from KeyframeEffect.

Furthermore, setting frame bits from KeyframeEffect is a little fragile since it
depends on the life cycle of the KeyframeEffect which is independent of the
nsFrame. If we can avoid doing that, we probably should.

Differential Revision: https://phabricator.services.mozilla.com/D21885

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Brian Birtles 2019-03-05 03:09:48 +00:00
Родитель d83da99f63
Коммит 8ed54f03c6
3 изменённых файлов: 6 добавлений и 30 удалений

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

@ -227,7 +227,6 @@ void KeyframeEffect::SetKeyframes(nsTArray<Keyframe>&& aKeyframes,
// style (e.g. the target element is not associated with any document).
if (aStyle) {
UpdateProperties(aStyle);
MaybeUpdateFrameForCompositor();
}
}
@ -956,8 +955,6 @@ void KeyframeEffect::SetTarget(
UpdateProperties(computedStyle);
}
MaybeUpdateFrameForCompositor();
RequestRestyle(EffectCompositor::RestyleType::Layer);
nsAutoAnimationMutationBatch mb(mTarget->mElement->OwnerDoc());
@ -1647,24 +1644,6 @@ bool KeyframeEffect::CanIgnoreIfNotVisible() const {
nsChangeHint_Hints_CanIgnoreIfNotVisible);
}
void KeyframeEffect::MaybeUpdateFrameForCompositor() {
nsIFrame* frame = GetStyleFrame();
if (!frame) {
return;
}
// FIXME: Bug 1272495: If this effect does not win in the cascade, the
// NS_FRAME_MAY_BE_TRANSFORMED flag should be removed when the animation
// will be removed from effect set or the transform keyframes are removed
// by setKeyframes. The latter case will be hard to solve though.
for (const AnimationProperty& property : mProperties) {
if (property.mProperty == eCSSProperty_transform) {
frame->AddStateBits(NS_FRAME_MAY_BE_TRANSFORMED);
return;
}
}
}
void KeyframeEffect::MarkCascadeNeedsUpdate() {
if (!mTarget) {
return;

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

@ -359,12 +359,6 @@ class KeyframeEffect : public AnimationEffect {
// Remove the current effect target from its EffectSet.
void UnregisterTarget();
// Update the associated frame state bits so that, if necessary, a stacking
// context will be created and the effect sent to the compositor. We
// typically need to do this when the properties referenced by the keyframe
// have changed, or when the target frame might have changed.
void MaybeUpdateFrameForCompositor();
// Looks up the ComputedStyle associated with the target element, if any.
// We need to be careful to *not* call this when we are updating the style
// context. That's because calling GetComputedStyle when we are in the process

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

@ -1633,9 +1633,12 @@ void RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList) {
!(primaryFrame->GetStateBits() & NS_FRAME_MAY_BE_TRANSFORMED) &&
primaryFrame->HasAnimationOfTransform()) {
// If we have an nsChangeHint_UpdateTransformLayer hint but no
// corresponding frame bit, it's possible we have a transform animation
// with transform style 'none' that was initialized independently from
// this frame and associated after the fact.
// corresponding frame bit, we most likely have a transform animation
// that was added or updated after this frame was created (otherwise
// we would have set the frame bit when we initialized the frame)
// and which sets the transform to 'none' (otherwise we would have set
// the frame bit when we got the nsChangeHint_AddOrRemoveTransform
// hint).
//
// In that case we should set the frame bit.
for (nsIFrame* cont = primaryFrame; cont;