зеркало из https://github.com/mozilla/gecko-dev.git
Bug 962594 - Don't build CSS animations for elements that are in a display:none subtree. r=heycam
This commit is contained in:
Родитель
a95ed2c938
Коммит
f64fcefe30
|
@ -3025,11 +3025,18 @@ ElementRestyler::ComputeRestyleResultFromNewContext(nsIFrame* aSelf,
|
|||
|
||||
if (oldContext->ShouldSuppressLineBreak() !=
|
||||
aNewContext->ShouldSuppressLineBreak()) {
|
||||
LOG_RESTYLE_CONTINUE("NS_STYLE_SUPPRESS_LINEBREAK differes"
|
||||
LOG_RESTYLE_CONTINUE("NS_STYLE_SUPPRESS_LINEBREAK differs"
|
||||
"between old and new style contexts");
|
||||
return eRestyleResult_Continue;
|
||||
}
|
||||
|
||||
if (oldContext->IsInDisplayNoneSubtree() !=
|
||||
aNewContext->IsInDisplayNoneSubtree()) {
|
||||
LOG_RESTYLE_CONTINUE("NS_STYLE_IN_DISPLAY_NONE_SUBTREE differs between old"
|
||||
" and new style contexts");
|
||||
return eRestyleResult_Continue;
|
||||
}
|
||||
|
||||
return eRestyleResult_Stop;
|
||||
}
|
||||
|
||||
|
|
|
@ -266,7 +266,9 @@ nsAnimationManager::CheckAnimationRule(nsStyleContext* aStyleContext,
|
|||
// build the animations list
|
||||
dom::AnimationTimeline* timeline = aElement->OwnerDoc()->Timeline();
|
||||
AnimationPlayerPtrArray newPlayers;
|
||||
BuildAnimations(aStyleContext, aElement, timeline, newPlayers);
|
||||
if (!aStyleContext->IsInDisplayNoneSubtree()) {
|
||||
BuildAnimations(aStyleContext, aElement, timeline, newPlayers);
|
||||
}
|
||||
|
||||
if (newPlayers.IsEmpty()) {
|
||||
if (collection) {
|
||||
|
|
|
@ -299,6 +299,12 @@ nsStyleContext::MoveTo(nsStyleContext* aNewParent)
|
|||
{
|
||||
MOZ_ASSERT(aNewParent != mParent);
|
||||
|
||||
// This function shouldn't be getting called if the parents have different
|
||||
// values for some flags in mBits, because if that were the case we would need
|
||||
// to recompute those bits for |this|. (TODO: add more flags to |mask|.)
|
||||
DebugOnly<uint64_t> mask = NS_STYLE_IN_DISPLAY_NONE_SUBTREE;
|
||||
MOZ_ASSERT((mParent->mBits & mask) == (aNewParent->mBits & mask));
|
||||
|
||||
// Assertions checking for visited style are just to avoid some tricky
|
||||
// cases we can't be bothered handling at the moment.
|
||||
MOZ_ASSERT(!IsStyleIfVisited());
|
||||
|
@ -688,6 +694,12 @@ nsStyleContext::ApplyStyleFixups(bool aSkipParentDisplayBasedStyleFixup)
|
|||
}
|
||||
}
|
||||
|
||||
// Set the NS_STYLE_IN_DISPLAY_NONE_SUBTREE bit
|
||||
if ((mParent && mParent->IsInDisplayNoneSubtree()) ||
|
||||
disp->mDisplay == NS_STYLE_DISPLAY_NONE) {
|
||||
mBits |= NS_STYLE_IN_DISPLAY_NONE_SUBTREE;
|
||||
}
|
||||
|
||||
// Suppress border/padding of ruby level containers
|
||||
if (disp->mDisplay == NS_STYLE_DISPLAY_RUBY_BASE_CONTAINER ||
|
||||
disp->mDisplay == NS_STYLE_DISPLAY_RUBY_TEXT_CONTAINER) {
|
||||
|
|
|
@ -160,6 +160,10 @@ public:
|
|||
bool ShouldSuppressLineBreak() const
|
||||
{ return !!(mBits & NS_STYLE_SUPPRESS_LINEBREAK); }
|
||||
|
||||
// Does this style context or any of its ancestors have display:none set?
|
||||
bool IsInDisplayNoneSubtree() const
|
||||
{ return !!(mBits & NS_STYLE_IN_DISPLAY_NONE_SUBTREE); }
|
||||
|
||||
// Does this style context represent the style for a pseudo-element or
|
||||
// inherit data from such a style context? Whether this returns true
|
||||
// is equivalent to whether it or any of its ancestors returns
|
||||
|
|
|
@ -58,8 +58,10 @@ class imgIContainer;
|
|||
#define NS_STYLE_IS_GOING_AWAY 0x040000000
|
||||
// See nsStyleContext::ShouldSuppressLineBreak
|
||||
#define NS_STYLE_SUPPRESS_LINEBREAK 0x080000000
|
||||
// See nsStyleContext::IsInDisplayNoneSubtree
|
||||
#define NS_STYLE_IN_DISPLAY_NONE_SUBTREE 0x100000000
|
||||
// See nsStyleContext::GetPseudoEnum
|
||||
#define NS_STYLE_CONTEXT_TYPE_SHIFT 32
|
||||
#define NS_STYLE_CONTEXT_TYPE_SHIFT 33
|
||||
|
||||
// Additional bits for nsRuleNode's mDependentBits:
|
||||
#define NS_RULE_NODE_GC_MARK 0x02000000
|
||||
|
|
Загрузка…
Ссылка в новой задаче