Bug 1137031 - Do not stop restyling when TryStartingTransitiosn gives us a new style context. r=dbaron

It is not correct to stop restyling by leaving the old style context on
the frame and returning eRestyleResult_Stop when TryStartingTransition
provides a new, without-animations style context.  This is at least
because the new new style context could have different styles from the
old new style context.
This commit is contained in:
Cameron McCormack
2015-03-04 16:08:00 +11:00
parent 05599a2ce9
commit 9389a0404c
2 changed files with 14 additions and 7 deletions

View File

@@ -2015,7 +2015,7 @@ RestyleManager::DebugVerifyStyleTree(nsIFrame* aFrame)
// aContent must be the content for the frame in question, which may be
// :before/:after content
/* static */ void
/* static */ bool
RestyleManager::TryStartingTransition(nsPresContext* aPresContext,
nsIContent* aContent,
nsStyleContext* aOldStyleContext,
@@ -2023,13 +2023,15 @@ RestyleManager::TryStartingTransition(nsPresContext* aPresContext,
aNewStyleContext /* inout */)
{
if (!aContent || !aContent->IsElement()) {
return;
return false;
}
// Notify the transition manager. If it starts a transition,
// it might modify the new style context.
nsRefPtr<nsStyleContext> sc = *aNewStyleContext;
aPresContext->TransitionManager()->StyleContextChanged(
aContent->AsElement(), aOldStyleContext, aNewStyleContext);
return *aNewStyleContext != sc;
}
static dom::Element*
@@ -3300,9 +3302,13 @@ ElementRestyler::RestyleSelf(nsIFrame* aSelf,
}
}
} else {
RestyleManager::TryStartingTransition(mPresContext, aSelf->GetContent(),
oldContext, &newContext);
bool changedStyle =
RestyleManager::TryStartingTransition(mPresContext, aSelf->GetContent(),
oldContext, &newContext);
if (changedStyle) {
LOG_RESTYLE_CONTINUE("TryStartingTransition changed the new style context");
result = eRestyleResult_Continue;
}
CaptureChange(oldContext, newContext, assumeDifferenceHint,
&equalStructs);
if (equalStructs != NS_STYLE_INHERIT_MASK) {