From e425638f171c8f1f48f12c8e4214d6e1b2b76a47 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Wed, 13 Aug 2014 15:39:01 -0700 Subject: [PATCH] Bug 625289 patch 7 - Expose TryStartingTransition. r=heycam --- layout/base/RestyleManager.cpp | 14 ++++++++------ layout/base/RestyleManager.h | 13 +++++++++++++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/layout/base/RestyleManager.cpp b/layout/base/RestyleManager.cpp index 482b9612c181..759e06e4a622 100644 --- a/layout/base/RestyleManager.cpp +++ b/layout/base/RestyleManager.cpp @@ -1821,10 +1821,12 @@ RestyleManager::DebugVerifyStyleTree(nsIFrame* aFrame) // aContent must be the content for the frame in question, which may be // :before/:after content -static void -TryStartingTransition(nsPresContext *aPresContext, nsIContent *aContent, - nsStyleContext *aOldStyleContext, - nsRefPtr *aNewStyleContext /* inout */) +/* static */ void +RestyleManager::TryStartingTransition(nsPresContext* aPresContext, + nsIContent* aContent, + nsStyleContext* aOldStyleContext, + nsRefPtr* + aNewStyleContext /* inout */) { if (!aContent || !aContent->IsElement()) { return; @@ -2608,8 +2610,8 @@ ElementRestyler::RestyleSelf(nsIFrame* aSelf, nsRestyleHint aRestyleHint) if (newContext != oldContext) { if (!copyFromContinuation) { - TryStartingTransition(mPresContext, aSelf->GetContent(), - oldContext, &newContext); + RestyleManager::TryStartingTransition(mPresContext, aSelf->GetContent(), + oldContext, &newContext); CaptureChange(oldContext, newContext, assumeDifferenceHint); } diff --git a/layout/base/RestyleManager.h b/layout/base/RestyleManager.h index 6c3e60f9a681..516f1fbb1d71 100644 --- a/layout/base/RestyleManager.h +++ b/layout/base/RestyleManager.h @@ -176,6 +176,19 @@ public: return mReframingStyleContexts; } + /** + * 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. + * + * For the pseudo-elements, aContent must be the anonymous content + * that we're creating for that pseudo-element, not the real element. + */ + static void + TryStartingTransition(nsPresContext* aPresContext, nsIContent* aContent, + nsStyleContext* aOldStyleContext, + nsRefPtr* aNewStyleContext /* inout */); + private: void RestyleForEmptyChange(Element* aContainer);