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
Родитель ed57682ba9
Коммит 3d4a394d35
2 изменённых файлов: 14 добавлений и 7 удалений

Просмотреть файл

@ -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) {

Просмотреть файл

@ -228,12 +228,13 @@ public:
/**
* Try starting a transition for an element or a ::before or ::after
* pseudo-element, given an old and new style context. This may
* change the new style context if a transition is started.
* change the new style context if a transition is started. Returns
* true iff it does change aNewStyleContext.
*
* For the pseudo-elements, aContent must be the anonymous content
* that we're creating for that pseudo-element, not the real element.
*/
static void
static bool
TryStartingTransition(nsPresContext* aPresContext, nsIContent* aContent,
nsStyleContext* aOldStyleContext,
nsRefPtr<nsStyleContext>* aNewStyleContext /* inout */);