зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1341985 - Update CSS animations in a SequentialTask. r=heycam
We create the SequentialTask only if: * We have no old computed values and we have animation name style in the new computed values. * Any animation properties is changed. * display property is changed from 'none' and we have animation name style. * display property is changed to 'none'. In a subsequent patch we skip the SequentialTask if we have no running animations and the display propery is changed to 'none'. MozReview-Commit-ID: JRSZznufOS2 --HG-- extra : rebase_source : 566026c21c6357f77df55e3bd588835f5fd6c3d4
This commit is contained in:
Родитель
11184fb1e8
Коммит
96240dbfc8
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "ChildIterator.h"
|
||||
#include "gfxFontFamilyList.h"
|
||||
#include "nsAnimationManager.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "nsCSSFrameConstructor.h"
|
||||
#include "nsCSSProps.h"
|
||||
|
@ -431,6 +432,28 @@ Gecko_StyleAnimationsEquals(RawGeckoStyleAnimationListBorrowed aA,
|
|||
return *aA == *aB;
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_UpdateAnimations(RawGeckoElementBorrowed aElement,
|
||||
nsIAtom* aPseudoTagOrNull,
|
||||
ServoComputedValuesBorrowed aComputedValues,
|
||||
ServoComputedValuesBorrowedOrNull aParentComputedValues)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aElement);
|
||||
MOZ_ASSERT(aComputedValues);
|
||||
|
||||
nsPresContext* presContext = nsContentUtils::GetContextForContent(aElement);
|
||||
if (!presContext) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (presContext->IsDynamic() && aElement->IsInComposedDoc()) {
|
||||
presContext->AnimationManager()->
|
||||
UpdateAnimations(const_cast<dom::Element*>(aElement), aPseudoTagOrNull,
|
||||
aComputedValues, aParentComputedValues);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_FillAllBackgroundLists(nsStyleImageLayers* aLayers, uint32_t aMaxLen)
|
||||
{
|
||||
|
|
|
@ -193,6 +193,10 @@ Gecko_GetAnimationRule(RawGeckoElementBorrowed aElement,
|
|||
mozilla::EffectCompositor::CascadeLevel aCascadeLevel);
|
||||
bool Gecko_StyleAnimationsEquals(RawGeckoStyleAnimationListBorrowed,
|
||||
RawGeckoStyleAnimationListBorrowed);
|
||||
void Gecko_UpdateAnimations(RawGeckoElementBorrowed aElement,
|
||||
nsIAtom* aPseudoTagOrNull,
|
||||
ServoComputedValuesBorrowed aComputedValues,
|
||||
ServoComputedValuesBorrowedOrNull aParentComputedValues);
|
||||
|
||||
// Atoms.
|
||||
nsIAtom* Gecko_Atomize(const char* aString, uint32_t aLength);
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "mozilla/dom/ChildIterator.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/ElementInlines.h"
|
||||
#include "nsAnimationManager.h"
|
||||
#include "nsCSSAnonBoxes.h"
|
||||
#include "nsCSSPseudoElements.h"
|
||||
#include "nsHTMLStyleSheet.h"
|
||||
|
@ -164,33 +163,8 @@ ServoStyleSet::GetContext(already_AddRefed<ServoComputedValues> aComputedValues,
|
|||
// See bug 1344914.
|
||||
bool skipFixup = false;
|
||||
|
||||
RefPtr<nsStyleContext> result =
|
||||
NS_NewStyleContext(aParentContext, mPresContext, aPseudoTag,
|
||||
aPseudoType, Move(aComputedValues), skipFixup);
|
||||
|
||||
// Ignore animations for print or print preview, and for elements
|
||||
// that are not attached to the document tree.
|
||||
if (mPresContext->IsDynamic() &&
|
||||
aElementForAnimation &&
|
||||
aElementForAnimation->IsInComposedDoc()) {
|
||||
// Update/build CSS animations in the case where animation properties are
|
||||
// changed.
|
||||
// FIXME: Bug 1341985: This isn't right place to update CSS animations.
|
||||
// We should do it in a SequentialTask and trigger the second traversal for
|
||||
// the animation's restyle after the SequentialTask.
|
||||
const ServoComputedValues* currentStyle =
|
||||
result->StyleSource().AsServoComputedValues();
|
||||
const ServoComputedValues* parentStyle =
|
||||
result->GetParent()
|
||||
? result->GetParent()->StyleSource().AsServoComputedValues()
|
||||
: nullptr;
|
||||
mPresContext->AnimationManager()->UpdateAnimations(aElementForAnimation,
|
||||
aPseudoTag,
|
||||
currentStyle,
|
||||
parentStyle);
|
||||
}
|
||||
|
||||
return result.forget();
|
||||
return NS_NewStyleContext(aParentContext, mPresContext, aPseudoTag,
|
||||
aPseudoType, Move(aComputedValues), skipFixup);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Загрузка…
Ссылка в новой задаче