mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 847287 patch 5 - Add method to update animations on layer. r=birtles
This does somewhat less work than PostRestyleForAnimation, although I believe PostRestyleForAnimation would be a sufficient alternative. This is used in patch 6.
This commit is contained in:
parent
ee1b9da9da
commit
31e337af48
@ -404,6 +404,21 @@ CommonAnimationManager::GetAnimationRule(mozilla::dom::Element* aElement,
|
||||
nsDisplayItem::TYPE_OPACITY,
|
||||
nsChangeHint_UpdateOpacityLayer } };
|
||||
|
||||
/* static */ const CommonAnimationManager::LayerAnimationRecord*
|
||||
CommonAnimationManager::LayerAnimationRecordFor(nsCSSProperty aProperty)
|
||||
{
|
||||
MOZ_ASSERT(nsCSSProps::PropHasFlags(aProperty,
|
||||
CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR),
|
||||
"unexpected property");
|
||||
const auto& info = sLayerAnimationInfo;
|
||||
for (size_t i = 0; i < ArrayLength(info); ++i) {
|
||||
if (aProperty == info[i].mProperty) {
|
||||
return &info[i];
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/* static */ void
|
||||
CommonAnimationManager::Initialize()
|
||||
@ -641,6 +656,30 @@ AnimationPlayerCollection::CanPerformOnCompositorThread(
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
AnimationPlayerCollection::PostUpdateLayerAnimations()
|
||||
{
|
||||
nsCSSPropertySet propsHandled;
|
||||
for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) {
|
||||
const auto& properties = mPlayers[playerIdx]->GetSource()->Properties();
|
||||
for (size_t propIdx = properties.Length(); propIdx-- != 0; ) {
|
||||
nsCSSProperty prop = properties[propIdx].mProperty;
|
||||
if (nsCSSProps::PropHasFlags(prop,
|
||||
CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR) &&
|
||||
!propsHandled.HasProperty(prop)) {
|
||||
propsHandled.AddProperty(prop);
|
||||
nsChangeHint changeHint = css::CommonAnimationManager::
|
||||
LayerAnimationRecordFor(prop)->mChangeHint;
|
||||
dom::Element* element = GetElementToRestyle();
|
||||
if (element) {
|
||||
mManager->mPresContext->RestyleManager()->
|
||||
PostRestyleEvent(element, nsRestyleHint(0), changeHint);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
AnimationPlayerCollection::HasAnimationOfProperty(
|
||||
nsCSSProperty aProperty) const
|
||||
|
@ -128,6 +128,12 @@ protected:
|
||||
public:
|
||||
static const LayerAnimationRecord sLayerAnimationInfo[kLayerRecords];
|
||||
|
||||
// Will return non-null for any property with the
|
||||
// CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR flag; should only be called
|
||||
// on such properties.
|
||||
static const LayerAnimationRecord*
|
||||
LayerAnimationRecordFor(nsCSSProperty aProperty);
|
||||
|
||||
protected:
|
||||
virtual ~CommonAnimationManager();
|
||||
|
||||
@ -295,6 +301,9 @@ struct AnimationPlayerCollection : public PRCList
|
||||
// (This is useful for determining whether throttle the animation
|
||||
// (suppress main-thread style updates).)
|
||||
bool CanPerformOnCompositorThread(CanAnimateFlags aFlags) const;
|
||||
|
||||
void PostUpdateLayerAnimations();
|
||||
|
||||
bool HasAnimationOfProperty(nsCSSProperty aProperty) const;
|
||||
|
||||
bool IsForElement() const { // rather than for a pseudo-element
|
||||
|
Loading…
Reference in New Issue
Block a user