diff --git a/layout/base/RestyleManager.cpp b/layout/base/RestyleManager.cpp index abd17646d6d..46a6a63b7bb 100644 --- a/layout/base/RestyleManager.cpp +++ b/layout/base/RestyleManager.cpp @@ -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 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) { diff --git a/layout/base/RestyleManager.h b/layout/base/RestyleManager.h index b9623a4fd53..72919391b83 100644 --- a/layout/base/RestyleManager.h +++ b/layout/base/RestyleManager.h @@ -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* aNewStyleContext /* inout */);