зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1532568 - Look up the animation generation on the primary frame for transform display items; r=hiro
Differential Revision: https://phabricator.services.mozilla.com/D22443 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
47cdd9e060
Коммит
46f45a965b
|
@ -203,8 +203,14 @@ void AnimationInfo::EnumerateGenerationOnFrame(
|
|||
}
|
||||
|
||||
for (auto displayItem : LayerAnimationInfo::sDisplayItemTypes) {
|
||||
// For transform animations, the animation is on the primary frame but
|
||||
// |aFrame| is the style frame.
|
||||
const nsIFrame* frameToQuery =
|
||||
displayItem == DisplayItemType::TYPE_TRANSFORM
|
||||
? nsLayoutUtils::GetPrimaryFrameFromStyleFrame(aFrame)
|
||||
: aFrame;
|
||||
RefPtr<WebRenderAnimationData> animationData =
|
||||
GetWebRenderUserData<WebRenderAnimationData>(aFrame,
|
||||
GetWebRenderUserData<WebRenderAnimationData>(frameToQuery,
|
||||
(uint32_t)displayItem);
|
||||
Maybe<uint64_t> generation;
|
||||
if (animationData) {
|
||||
|
|
|
@ -1885,14 +1885,14 @@ void RestyleManager::IncrementAnimationGeneration() {
|
|||
|
||||
/* static */
|
||||
void RestyleManager::AddLayerChangesForAnimation(
|
||||
nsIFrame* aFrame, nsIContent* aContent, nsChangeHint aHintForThisFrame,
|
||||
nsIFrame* aStyleFrame, nsIContent* aContent, nsChangeHint aHintForThisFrame,
|
||||
nsStyleChangeList& aChangeListToProcess) {
|
||||
if (!aFrame || !aContent) {
|
||||
if (!aStyleFrame || !aContent) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint64_t frameGeneration =
|
||||
RestyleManager::GetAnimationGenerationForFrame(aFrame);
|
||||
RestyleManager::GetAnimationGenerationForFrame(aStyleFrame);
|
||||
|
||||
Maybe<nsCSSPropertyIDSet> effectiveAnimationProperties;
|
||||
|
||||
|
@ -1920,7 +1920,7 @@ void RestyleManager::AddLayerChangesForAnimation(
|
|||
// did, ApplyRenderingChangeToTree would complain that we're updating a
|
||||
// transform layer without a transform.
|
||||
if (aDisplayItemType == DisplayItemType::TYPE_TRANSFORM &&
|
||||
!aFrame->StyleDisplay()->HasTransformStyle()) {
|
||||
!aStyleFrame->StyleDisplay()->HasTransformStyle()) {
|
||||
// Add all the hints for a removing a transform if they are not already
|
||||
// set for this frame.
|
||||
if (!(NS_IsHintSubset(nsChangeHint_ComprehensiveAddOrRemoveTransform,
|
||||
|
@ -1956,7 +1956,7 @@ void RestyleManager::AddLayerChangesForAnimation(
|
|||
|
||||
if (!effectiveAnimationProperties) {
|
||||
effectiveAnimationProperties.emplace(
|
||||
nsLayoutUtils::GetAnimationPropertiesForCompositor(aFrame));
|
||||
nsLayoutUtils::GetAnimationPropertiesForCompositor(aStyleFrame));
|
||||
}
|
||||
const nsCSSPropertyIDSet& propertiesForDisplayItem =
|
||||
LayerAnimationInfo::GetCSSPropertiesFor(aDisplayItemType);
|
||||
|
@ -1968,11 +1968,11 @@ void RestyleManager::AddLayerChangesForAnimation(
|
|||
};
|
||||
|
||||
AnimationInfo::EnumerateGenerationOnFrame(
|
||||
aFrame, aContent, LayerAnimationInfo::sDisplayItemTypes,
|
||||
aStyleFrame, aContent, LayerAnimationInfo::sDisplayItemTypes,
|
||||
maybeApplyChangeHint);
|
||||
|
||||
if (hint) {
|
||||
aChangeListToProcess.AppendChange(aFrame, aContent, hint);
|
||||
aChangeListToProcess.AppendChange(aStyleFrame, aContent, hint);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1449,6 +1449,13 @@ nsIFrame* nsLayoutUtils::GetPrimaryFrameFromStyleFrame(nsIFrame* aStyleFrame) {
|
|||
return parent && parent->IsTableWrapperFrame() ? parent : aStyleFrame;
|
||||
}
|
||||
|
||||
/* static */
|
||||
const nsIFrame* nsLayoutUtils::GetPrimaryFrameFromStyleFrame(
|
||||
const nsIFrame* aStyleFrame) {
|
||||
return nsLayoutUtils::GetPrimaryFrameFromStyleFrame(
|
||||
const_cast<nsIFrame*>(aStyleFrame));
|
||||
}
|
||||
|
||||
/*static*/
|
||||
bool nsLayoutUtils::IsPrimaryStyleFrame(const nsIFrame* aFrame) {
|
||||
if (aFrame->IsTableWrapperFrame()) {
|
||||
|
|
|
@ -398,6 +398,8 @@ class nsLayoutUtils {
|
|||
* table frame, in which case the table wrapper frame is returned.
|
||||
*/
|
||||
static nsIFrame* GetPrimaryFrameFromStyleFrame(nsIFrame* aStyleFrame);
|
||||
static const nsIFrame* GetPrimaryFrameFromStyleFrame(
|
||||
const nsIFrame* aStyleFrame);
|
||||
|
||||
/**
|
||||
* Similar to nsIFrame::IsPrimaryFrame except that this will return true
|
||||
|
|
|
@ -6427,43 +6427,49 @@ void FrameLayerBuilder::EnumerateGenerationForDedicatedLayers(
|
|||
const CompositorAnimatableDisplayItemTypes& aDisplayItemTypes,
|
||||
const AnimationGenerationCallback& aCallback) {
|
||||
std::bitset<static_cast<uint32_t>(DisplayItemType::TYPE_MAX)> notFoundTypes;
|
||||
for (auto displayItem : aDisplayItemTypes) {
|
||||
notFoundTypes.set(static_cast<uint32_t>(displayItem));
|
||||
for (auto displayItemType : aDisplayItemTypes) {
|
||||
notFoundTypes.set(static_cast<uint32_t>(displayItemType));
|
||||
}
|
||||
|
||||
const SmallPointerArray<DisplayItemData>& array = aFrame->DisplayItemData();
|
||||
for (auto displayItemType : aDisplayItemTypes) {
|
||||
// For transform animations, the animation is on the primary frame but
|
||||
// |aFrame| is the style frame.
|
||||
const nsIFrame* frameToQuery =
|
||||
displayItemType == DisplayItemType::TYPE_TRANSFORM
|
||||
? nsLayoutUtils::GetPrimaryFrameFromStyleFrame(aFrame)
|
||||
: aFrame;
|
||||
const nsIFrame::DisplayItemDataArray& displayItemDataArray =
|
||||
frameToQuery->DisplayItemData();
|
||||
|
||||
for (uint32_t i = 0; i < array.Length(); i++) {
|
||||
DisplayItemData* element =
|
||||
DisplayItemData::AssertDisplayItemData(array.ElementAt(i));
|
||||
if (!element->mParent->mLayerManager->IsWidgetLayerManager()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
DisplayItemType foundType = DisplayItemType::TYPE_ZERO;
|
||||
for (auto displayItem : aDisplayItemTypes) {
|
||||
if (GetDisplayItemTypeFromKey(element->mDisplayItemKey) == displayItem) {
|
||||
foundType = displayItem;
|
||||
notFoundTypes.reset(static_cast<uint32_t>(displayItem));
|
||||
break;
|
||||
for (uint32_t i = 0; i < displayItemDataArray.Length(); i++) {
|
||||
DisplayItemData* element = DisplayItemData::AssertDisplayItemData(
|
||||
displayItemDataArray.ElementAt(i));
|
||||
if (!element->mParent->mLayerManager->IsWidgetLayerManager()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (foundType == DisplayItemType::TYPE_ZERO) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Maybe<uint64_t> generation;
|
||||
if (element->mOptLayer) {
|
||||
generation = element->mOptLayer->GetAnimationGeneration();
|
||||
} else if (!element->mLayer->HasUserData(&gColorLayerUserData) &&
|
||||
!element->mLayer->HasUserData(&gImageLayerUserData) &&
|
||||
!element->mLayer->HasUserData(
|
||||
&gPaintedDisplayItemLayerUserData)) {
|
||||
generation = element->mLayer->GetAnimationGeneration();
|
||||
}
|
||||
if (GetDisplayItemTypeFromKey(element->mDisplayItemKey) !=
|
||||
displayItemType) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!aCallback(generation, foundType)) {
|
||||
return;
|
||||
notFoundTypes.reset(static_cast<uint32_t>(displayItemType));
|
||||
|
||||
Maybe<uint64_t> generation;
|
||||
if (element->mOptLayer) {
|
||||
generation = element->mOptLayer->GetAnimationGeneration();
|
||||
} else if (!element->mLayer->HasUserData(&gColorLayerUserData) &&
|
||||
!element->mLayer->HasUserData(&gImageLayerUserData) &&
|
||||
!element->mLayer->HasUserData(
|
||||
&gPaintedDisplayItemLayerUserData)) {
|
||||
generation = element->mLayer->GetAnimationGeneration();
|
||||
}
|
||||
|
||||
if (!aCallback(generation, displayItemType)) {
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6475,9 +6481,9 @@ void FrameLayerBuilder::EnumerateGenerationForDedicatedLayers(
|
|||
|
||||
// If there are any display item types that the nsIFrame doesn't have, we need
|
||||
// to call the callback function for them respectively.
|
||||
for (auto displayItem : aDisplayItemTypes) {
|
||||
if (notFoundTypes[static_cast<uint32_t>(displayItem)] &&
|
||||
!aCallback(Nothing(), displayItem)) {
|
||||
for (auto displayItemType : aDisplayItemTypes) {
|
||||
if (notFoundTypes[static_cast<uint32_t>(displayItemType)] &&
|
||||
!aCallback(Nothing(), displayItemType)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче