Bug 1287983 part 5 - Clarify the function name of creating transition. r=hiro
authorMantaroh Yoshinaga <mantaroh@gmail.com>
Wed, 19 Oct 2016 15:16:52 +0900
changeset 319519 41870a71d1f4ae1d207fb656585888c93edf400f
parent 319518 2f525f7afa56a4bef3419ee7d9c4faefb394d2d3
child 319520 be44e592e9e7795256ccba49f4b36e549babf758
push id30872
push userphilringnalda@gmail.com
push dateThu, 27 Oct 2016 01:30:58 +0000
treeherdermozilla-central@54f7bdea8976 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershiro
bugs1287983
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1287983 part 5 - Clarify the function name of creating transition. r=hiro MozReview-Commit-ID: AW5qD8uBQxf
layout/base/RestyleManager.cpp
layout/base/RestyleManager.h
layout/base/nsCSSFrameConstructor.cpp
layout/generic/nsFrame.cpp
layout/style/nsStyleSet.cpp
layout/style/nsTransitionManager.cpp
layout/style/nsTransitionManager.h
layout/style/test/test_transitions.html
layout/style/test/test_transitions_and_reframes.html
layout/style/test/test_transitions_and_restyles.html
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -180,17 +180,17 @@ RestyleManager::ReframingStyleContexts::
   MOZ_ASSERT(!mRestyleManager->mReframingStyleContexts,
              "shouldn't construct recursively");
   mRestyleManager->mReframingStyleContexts = this;
 }
 
 RestyleManager::ReframingStyleContexts::~ReframingStyleContexts()
 {
   // Before we go away, we need to flush out any frame construction that
-  // was enqueued, so that we start transitions.
+  // was enqueued, so that we initiate transitions.
   // Note that this is a little bit evil in that we're calling into code
   // that calls our member functions from our destructor, but it's at
   // the beginning of our destructor, so it shouldn't be too bad.
   mRestyleManager->PresContext()->FrameConstructor()->CreateNeededFrames();
 }
 
 RestyleManager::AnimationsWithDestroyedFrame::AnimationsWithDestroyedFrame(
                                           RestyleManager* aRestyleManager)
@@ -985,21 +985,21 @@ RestyleManager::PostRebuildAllStyleDataE
 
   // Get a restyle event posted if necessary
   PostRestyleEventInternal(false);
 }
 
 // aContent must be the content for the frame in question, which may be
 // :before/:after content
 /* static */ bool
-RestyleManager::TryStartingTransition(nsPresContext* aPresContext,
-                                      nsIContent* aContent,
-                                      nsStyleContext* aOldStyleContext,
-                                      RefPtr<nsStyleContext>*
-                                        aNewStyleContext /* inout */)
+RestyleManager::TryInitiatingTransition(nsPresContext* aPresContext,
+                                        nsIContent* aContent,
+                                        nsStyleContext* aOldStyleContext,
+                                        RefPtr<nsStyleContext>*
+                                          aNewStyleContext /* inout */)
 {
   if (!aContent || !aContent->IsElement()) {
     return false;
   }
 
   // Notify the transition manager.  If it starts a transition,
   // it might modify the new style context.
   RefPtr<nsStyleContext> sc = *aNewStyleContext;
@@ -1252,21 +1252,21 @@ RestyleManager::ReparentStyleContext(nsI
   }
 
   if (newContext) {
     if (newContext != oldContext) {
       // We probably don't want to initiate transitions from
       // ReparentStyleContext, since we call it during frame
       // construction rather than in response to dynamic changes.
       // Also see the comment at the start of
-      // nsTransitionManager::ConsiderStartingTransition.
+      // nsTransitionManager::ConsiderInitiatingTransition.
 #if 0
       if (!copyFromContinuation) {
-        TryStartingTransition(mPresContext, aFrame->GetContent(),
-                              oldContext, &newContext);
+        TryInitiatingTransition(mPresContext, aFrame->GetContent(),
+                                oldContext, &newContext);
       }
 #endif
 
       // Make sure to call CalcStyleDifference so that the new context ends
       // up resolving all the structs the old context resolved.
       if (!copyFromContinuation) {
         uint32_t equalStructs;
         uint32_t samePointerStructs;
@@ -2959,20 +2959,22 @@ ElementRestyler::RestyleSelf(nsIFrame* a
           LOG_RESTYLE_CONTINUE("there is different style data: %s",
                       RestyleManager::StructNamesToString(
                         ~equalStructs & NS_STYLE_INHERIT_MASK).get());
           result = RestyleResult::eContinue;
         }
       }
     } else {
       bool changedStyle =
-        RestyleManager::TryStartingTransition(mPresContext, aSelf->GetContent(),
-                                              oldContext, &newContext);
+        RestyleManager::TryInitiatingTransition(mPresContext,
+                                                aSelf->GetContent(),
+                                                oldContext, &newContext);
       if (changedStyle) {
-        LOG_RESTYLE_CONTINUE("TryStartingTransition changed the new style context");
+        LOG_RESTYLE_CONTINUE("TryInitiatingTransition changed the new style "
+                             "context");
         result = RestyleResult::eContinue;
         canStopWithStyleChange = false;
       }
       CaptureChange(oldContext, newContext, assumeDifferenceHint,
                     &equalStructs, &samePointerStructs);
       if (equalStructs != NS_STYLE_INHERIT_MASK) {
         // At least one struct had different data in it, so we must
         // continue restyling children.
--- a/layout/base/RestyleManager.h
+++ b/layout/base/RestyleManager.h
@@ -203,28 +203,28 @@ public:
    * Return the current ReframingStyleContexts struct, or null if we're
    * not currently in a restyling operation.
    */
   ReframingStyleContexts* GetReframingStyleContexts() {
     return mReframingStyleContexts;
   }
 
   /**
-   * Try starting a transition for an element or a ::before or ::after
+   * Try initiating 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.  Returns
-   * true iff it does change aNewStyleContext.
+   * true if 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 bool
-  TryStartingTransition(nsPresContext* aPresContext, nsIContent* aContent,
-                        nsStyleContext* aOldStyleContext,
-                        RefPtr<nsStyleContext>* aNewStyleContext /* inout */);
+  TryInitiatingTransition(nsPresContext* aPresContext, nsIContent* aContent,
+                          nsStyleContext* aOldStyleContext,
+                          RefPtr<nsStyleContext>* aNewStyleContext /* inout */);
 
   // AnimationsWithDestroyedFrame is used to stop animations and transitions
   // on elements that have no frame at the end of the restyling process.
   // It only lives during the restyling process.
   class MOZ_STACK_CLASS AnimationsWithDestroyedFrame final {
   public:
     // Construct a AnimationsWithDestroyedFrame object.  The caller must
     // ensure that aRestyleManager lives at least as long as the
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -1869,20 +1869,20 @@ nsCSSFrameConstructor::CreateGeneratedCo
   // does it probably won't need to track reframed style contexts to start
   // transitions correctly.
   if (mozilla::RestyleManager* geckoRM = RestyleManager()->GetAsGecko()) {
     RestyleManager::ReframingStyleContexts* rsc =
       geckoRM->GetReframingStyleContexts();
     if (rsc) {
       nsStyleContext* oldStyleContext = rsc->Get(container, aPseudoElement);
       if (oldStyleContext) {
-        RestyleManager::TryStartingTransition(aState.mPresContext,
-                                              container,
-                                              oldStyleContext,
-                                              &pseudoStyleContext);
+        RestyleManager::TryInitiatingTransition(aState.mPresContext,
+                                                container,
+                                                oldStyleContext,
+                                                &pseudoStyleContext);
       } else {
         aState.mPresContext->TransitionManager()->
           PruneCompletedTransitions(container, aPseudoElement,
                                     pseudoStyleContext);
       }
     }
   }
 
@@ -5044,18 +5044,18 @@ nsCSSFrameConstructor::ResolveStyleConte
   if (mozilla::RestyleManager* geckoRM = RestyleManager()->GetAsGecko()) {
     RestyleManager::ReframingStyleContexts* rsc =
       geckoRM->GetReframingStyleContexts();
     if (rsc) {
       nsStyleContext* oldStyleContext =
         rsc->Get(aContent, CSSPseudoElementType::NotPseudo);
       nsPresContext* presContext = mPresShell->GetPresContext();
       if (oldStyleContext) {
-        RestyleManager::TryStartingTransition(presContext, aContent,
-                                              oldStyleContext, &result);
+        RestyleManager::TryInitiatingTransition(presContext, aContent,
+                                                oldStyleContext, &result);
       } else if (aContent->IsElement()) {
         presContext->TransitionManager()->
           PruneCompletedTransitions(aContent->AsElement(),
             CSSPseudoElementType::NotPseudo, result);
       }
     }
   }
 
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -680,17 +680,17 @@ nsFrame::DestroyFrom(nsIFrame* aDestruct
 
     // Unfortunately, we need to do this for all frames being reframed
     // and not only those whose current style involves CSS transitions,
     // because what matters is whether the new style (not the old)
     // specifies CSS transitions.
     if (presContext->RestyleManager()->IsGecko()) {
       // stylo: ServoRestyleManager does not handle transitions yet, and when
       // it does it probably won't need to track reframed style contexts to
-      // start transitions correctly.
+      // initiate transitions correctly.
       RestyleManager::ReframingStyleContexts* rsc =
         presContext->RestyleManager()->AsGecko()->GetReframingStyleContexts();
       if (rsc) {
         rsc->Put(mContent, mStyleContext);
       }
     }
   }
 
--- a/layout/style/nsStyleSet.cpp
+++ b/layout/style/nsStyleSet.cpp
@@ -2226,17 +2226,17 @@ nsStyleSet::GCRuleTrees()
 
 already_AddRefed<nsStyleContext>
 nsStyleSet::ReparentStyleContext(nsStyleContext* aStyleContext,
                                  nsStyleContext* aNewParentContext,
                                  Element* aElement)
 {
   MOZ_ASSERT(aStyleContext, "aStyleContext must not be null");
 
-  // This short-circuit is OK because we don't call TryStartingTransition
+  // This short-circuit is OK because we don't call TryInitatingTransition
   // during style reresolution if the style context pointer hasn't changed.
   if (aStyleContext->GetParent() == aNewParentContext) {
     RefPtr<nsStyleContext> ret = aStyleContext;
     return ret.forget();
   }
 
   nsIAtom* pseudoTag = aStyleContext->GetPseudo();
   CSSPseudoElementType pseudoType = aStyleContext->GetPseudoType();
--- a/layout/style/nsTransitionManager.cpp
+++ b/layout/style/nsTransitionManager.cpp
@@ -454,17 +454,17 @@ nsTransitionManager::StyleContextChanged
     // rather than having bogus transitions that we shouldn't.
     //
     // We could consider changing this handling, although it's worth
     // thinking about whether the code below could do anything weird in
     // this case.
     return;
   }
 
-  // NOTE: Things in this function (and ConsiderStartingTransition)
+  // NOTE: Things in this function (and ConsiderInitiatingTransition)
   // should never call PeekStyleData because we don't preserve gotten
   // structs across reframes.
 
   // Return sooner (before the startedAny check below) for the most
   // common case: no transitions specified or running.
   const nsStyleDisplay *disp = newStyleContext->StyleDisplay();
   CSSPseudoElementType pseudoType = newStyleContext->GetPseudoType();
   if (pseudoType != CSSPseudoElementType::NotPseudo) {
@@ -604,32 +604,33 @@ nsTransitionManager::UpdateTransitions(
       if (property == eCSSPropertyExtra_no_properties ||
           property == eCSSPropertyExtra_variable ||
           property == eCSSProperty_UNKNOWN) {
         // Nothing to do, but need to exclude this from cases below.
       } else if (property == eCSSPropertyExtra_all_properties) {
         for (nsCSSPropertyID p = nsCSSPropertyID(0);
              p < eCSSProperty_COUNT_no_shorthands;
              p = nsCSSPropertyID(p + 1)) {
-          ConsiderStartingTransition(p, t, aElement, aElementTransitions,
-                                     aOldStyleContext, aNewStyleContext,
-                                     &startedAny, &whichStarted);
+          ConsiderInitiatingTransition(p, t, aElement, aElementTransitions,
+                                       aOldStyleContext, aNewStyleContext,
+                                       &startedAny, &whichStarted);
         }
       } else if (nsCSSProps::IsShorthand(property)) {
         CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(subprop, property,
                                              CSSEnabledState::eForAllContent)
         {
-          ConsiderStartingTransition(*subprop, t, aElement, aElementTransitions,
+          ConsiderInitiatingTransition(*subprop, t, aElement,
+                                       aElementTransitions,
+                                       aOldStyleContext, aNewStyleContext,
+                                       &startedAny, &whichStarted);
+        }
+      } else {
+        ConsiderInitiatingTransition(property, t, aElement, aElementTransitions,
                                      aOldStyleContext, aNewStyleContext,
                                      &startedAny, &whichStarted);
-        }
-      } else {
-        ConsiderStartingTransition(property, t, aElement, aElementTransitions,
-                                   aOldStyleContext, aNewStyleContext,
-                                   &startedAny, &whichStarted);
       }
     }
   }
 
   // Stop any transitions for properties that are no longer in
   // 'transition-property', including finished transitions.
   // Also stop any transitions (and remove any finished transitions)
   // for properties that just changed (and are still in the set of
@@ -706,17 +707,17 @@ nsTransitionManager::UpdateTransitions(
       aElementTransitions = nullptr;
     }
   }
 
   return startedAny;
 }
 
 void
-nsTransitionManager::ConsiderStartingTransition(
+nsTransitionManager::ConsiderInitiatingTransition(
   nsCSSPropertyID aProperty,
   const StyleTransition& aTransition,
   dom::Element* aElement,
   CSSTransitionCollection*& aElementTransitions,
   nsStyleContext* aOldStyleContext,
   nsStyleContext* aNewStyleContext,
   bool* aStartedAny,
   nsCSSPropertyIDSet* aWhichStarted)
--- a/layout/style/nsTransitionManager.h
+++ b/layout/style/nsTransitionManager.h
@@ -348,17 +348,17 @@ public:
   NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsTransitionManager)
 
   typedef mozilla::AnimationCollection<mozilla::dom::CSSTransition>
     CSSTransitionCollection;
 
   /**
    * StyleContextChanged
    *
-   * To be called from RestyleManager::TryStartingTransition when the
+   * To be called from RestyleManager::TryInitiatingTransition when the
    * style of an element has changed, to initiate transitions from
    * that style change.  For style contexts with :before and :after
    * pseudos, aElement is expected to be the generated before/after
    * element.
    *
    * It may modify the new style context (by replacing
    * *aNewStyleContext) to cover up some of the changes for the duration
    * of the restyling of descendants.  If it does, this function will
@@ -421,24 +421,24 @@ protected:
   bool
   UpdateTransitions(const nsStyleDisplay* aDisp,
                     mozilla::dom::Element* aElement,
                     CSSTransitionCollection*& aElementTransitions,
                     nsStyleContext* aOldStyleContext,
                     nsStyleContext* aNewStyleContext);
 
   void
-  ConsiderStartingTransition(nsCSSPropertyID aProperty,
-                             const mozilla::StyleTransition& aTransition,
-                             mozilla::dom::Element* aElement,
-                             CSSTransitionCollection*& aElementTransitions,
-                             nsStyleContext* aOldStyleContext,
-                             nsStyleContext* aNewStyleContext,
-                             bool* aStartedAny,
-                             nsCSSPropertyIDSet* aWhichStarted);
+  ConsiderInitiatingTransition(nsCSSPropertyID aProperty,
+                               const mozilla::StyleTransition& aTransition,
+                               mozilla::dom::Element* aElement,
+                               CSSTransitionCollection*& aElementTransitions,
+                               nsStyleContext* aOldStyleContext,
+                               nsStyleContext* aNewStyleContext,
+                               bool* aStartedAny,
+                               nsCSSPropertyIDSet* aWhichStarted);
 
   nsTArray<mozilla::Keyframe> GetTransitionKeyframes(
     nsStyleContext* aStyleContext,
     nsCSSPropertyID aProperty,
     mozilla::StyleAnimationValue&& aStartValue,
     mozilla::StyleAnimationValue&& aEndValue,
     const nsTimingFunction& aTimingFunction);
 
--- a/layout/style/test/test_transitions.html
+++ b/layout/style/test/test_transitions.html
@@ -113,17 +113,17 @@ var timingFunctions = {
   "cubic-bezier(0.4, 0.1, 0.7, 0.95)": bezier(0.4, 0.1, 0.7, 0.95),
   "cubic-bezier(1, 0, 0, 1)": bezier(1, 0, 0, 1),
   "cubic-bezier(0, 1, 1, 0)": bezier(0, 1, 1, 0),
 
 };
 
 var div = document.getElementById("display");
 
-// Set up all the elements on which we are going to start transitions.
+// Set up all the elements on which we are going to initiate transitions.
 
 // We have two reference elements to check the expected timing range.
 // They both have 8s linear transitions from 0 to 1000px.
 function make_reference_p() {
     var p = document.createElement("p");
     p.appendChild(document.createTextNode("reference"));
     p.style.textIndent = "0px";
     p.style.transition = "8s text-indent linear";
--- a/layout/style/test/test_transitions_and_reframes.html
+++ b/layout/style/test/test_transitions_and_reframes.html
@@ -182,17 +182,17 @@ var tests = [
   { element:"a1", test_child:false, pseudo:"::after", passes:true,
     dynamic_change_transition:true, start_from_none:false },
   { element:"a2", test_child:true, pseudo:"::after", passes:true,
     dynamic_change_transition:true, start_from_none:false },
   { element:document.documentElement, test_child:false, pseudo:"", passes:true,
     dynamic_change_transition:true, start_from_none:false },
   // Recheck starting from display:none.  Note that these tests all fail,
   // although we could get *some* of them to pass by calling
-  // RestyleManager::TryStartingTransition from
+  // RestyleManager::TryInitiatingTransition from
   // ElementRestyler::RestyleUndisplayedChildren.
   { element:"e1", test_child:false, pseudo:"", passes:false,
     dynamic_change_transition:false, start_from_none:true },
   { element:"e2", test_child:true, pseudo:"", passes:false,
     dynamic_change_transition:false, start_from_none:true },
   { element:"b1", test_child:false, pseudo:"::before", passes:false,
     dynamic_change_transition:false, start_from_none:true },
   { element:"b2", test_child:true, pseudo:"::before", passes:false,
--- a/layout/style/test/test_transitions_and_restyles.html
+++ b/layout/style/test/test_transitions_and_restyles.html
@@ -27,17 +27,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 function advance_clock(milliseconds) {
   SpecialPowers.DOMWindowUtils.advanceTimeAndRefresh(milliseconds);
 }
 
 var p = document.getElementById("display");
 var cs = getComputedStyle(p, "");
 advance_clock(0);
 cs.width; // flush
-p.style.width = "1000px"; // start transition
+p.style.width = "1000px"; // initiate transition
 is(cs.width, "0px", "transition at 0ms"); // flush (and test)
 advance_clock(100);
 is(cs.width, "100px", "transition at 100ms"); // flush
 // restyle *and* trigger new transitions
 p.style.color = "blue";
 // flush again, at the same timestamp
 is(cs.width, "100px", "transition at 100ms, after restyle");