Bug 1407463 - Drop unused pseudo atom argument from ResolveStyleLazily and ResolveStyleLazilyInternal. r?heycam draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Wed, 11 Oct 2017 10:00:28 +0900
changeset 678286 d6ca42d98a8e51c71232419eb40cac3be4d40521
parent 678275 e897e367d3bd489422d86fbdfac54925c18329d2
child 678287 8abb6023c6d31f0ba38db39d0f3d41f392017947
push id83864
push userhikezoe@mozilla.com
push dateWed, 11 Oct 2017 01:00:54 +0000
reviewersheycam
bugs1407463
milestone58.0a1
Bug 1407463 - Drop unused pseudo atom argument from ResolveStyleLazily and ResolveStyleLazilyInternal. r?heycam MozReview-Commit-ID: Lmjqbr7QsTU
dom/canvas/CanvasRenderingContext2D.cpp
dom/html/nsGenericHTMLElement.cpp
layout/style/ServoStyleSet.cpp
layout/style/ServoStyleSet.h
layout/style/nsComputedDOMStyle.cpp
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -2872,19 +2872,17 @@ GetFontStyleForServo(Element* aElement, 
   // values (2em, bolder, etc.)
   if (aElement && aElement->IsInUncomposedDoc()) {
     // Inherit from the canvas element.
     aPresShell->FlushPendingNotifications(FlushType::Style);
     // We need to use ResolveStyleLazily, which involves traversal,
     // instead of ResolvestyleFor() because we need up-to-date style even if
     // the canvas element is display:none.
     parentStyle =
-      styleSet->ResolveStyleLazily(aElement,
-                                   CSSPseudoElementType::NotPseudo,
-                                   nullptr);
+      styleSet->ResolveStyleLazily(aElement, CSSPseudoElementType::NotPseudo);
   } else {
     RefPtr<RawServoDeclarationBlock> declarations =
       CreateFontDeclarationForServo(NS_LITERAL_STRING("10px sans-serif"),
                                     aPresShell->GetDocument());
     MOZ_ASSERT(declarations);
 
     parentStyle = aPresShell->StyleSet()->AsServo()->
       ResolveForDeclarations(nullptr, declarations);
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -3047,17 +3047,17 @@ IsOrHasAncestorWithDisplayNone(Element* 
     if (sc) {
       if (styleSet->IsGecko()) {
         sc = styleSet->ResolveStyleFor(element, sc,
                                        LazyComputeBehavior::Assert);
       } else {
         // Call ResolveStyleLazily to protect against stale element data in
         // the tree when styled by Servo.
         sc = styleSet->AsServo()->ResolveStyleLazily(
-            element, CSSPseudoElementType::NotPseudo, nullptr);
+            element, CSSPseudoElementType::NotPseudo);
       }
     } else {
       sc = nsComputedDOMStyle::GetStyleContextNoFlush(element,
                                                       nullptr, aPresShell);
     }
     if (sc->StyleDisplay()->mDisplay == StyleDisplay::None) {
       return true;
     }
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -339,17 +339,17 @@ already_AddRefed<ServoStyleContext>
 ServoStyleSet::ResolveStyleFor(Element* aElement,
                                ServoStyleContext* aParentContext,
                                LazyComputeBehavior aMayCompute)
 {
   RefPtr<ServoStyleContext> computedValues;
   if (aMayCompute == LazyComputeBehavior::Allow) {
     PreTraverseSync();
     return ResolveStyleLazilyInternal(
-        aElement, CSSPseudoElementType::NotPseudo, nullptr);
+        aElement, CSSPseudoElementType::NotPseudo);
   }
 
   return ResolveServoStyle(aElement);
 }
 
 /**
  * Clears any stale Servo element data that might existing in the specified
  * element's document.  Upon destruction, asserts that the element and all
@@ -595,17 +595,16 @@ ServoStyleSet::ResolvePseudoElementStyle
 
   MOZ_ASSERT(computedValues);
   return computedValues.forget();
 }
 
 already_AddRefed<ServoStyleContext>
 ServoStyleSet::ResolveStyleLazily(Element* aElement,
                                   CSSPseudoElementType aPseudoType,
-                                  nsAtom* aPseudoTag,
                                   StyleRuleInclusion aRuleInclusion)
 {
   // Lazy style computation avoids storing any new data in the tree.
   // If the tree has stale data in it, then the AutoClearStaleData below
   // will ensure it's cleared so we don't use it. But if the document is
   // in the bfcache, then we will have valid, usable data in the tree,
   // but we don't want to use it. Instead we want to pretend as if the
   // document has no pres shell and no styles.
@@ -617,17 +616,17 @@ ServoStyleSet::ResolveStyleLazily(Elemen
   // existing styles in the DOM, then we would do selector matching on the
   // undisplayed element with the caller's style set's rules, but inherit from
   // values that were computed with the style set from the target element's
   // hidden-by-the-bfcache-entry pres shell.
   bool ignoreExistingStyles = aElement->OwnerDoc()->GetBFCacheEntry();
 
   AutoClearStaleData guard(aElement);
   PreTraverseSync();
-  return ResolveStyleLazilyInternal(aElement, aPseudoType, aPseudoTag,
+  return ResolveStyleLazilyInternal(aElement, aPseudoType,
                                     aRuleInclusion,
                                     ignoreExistingStyles);
 }
 
 already_AddRefed<ServoStyleContext>
 ServoStyleSet::ResolveInheritingAnonymousBoxStyle(nsAtom* aPseudoTag,
                                                   ServoStyleContext* aParentContext)
 {
@@ -1329,17 +1328,16 @@ ServoStyleSet::ClearNonInheritingStyleCo
   for (RefPtr<ServoStyleContext>& ptr : mNonInheritingStyleContexts) {
     ptr = nullptr;
   }
 }
 
 already_AddRefed<ServoStyleContext>
 ServoStyleSet::ResolveStyleLazilyInternal(Element* aElement,
                                           CSSPseudoElementType aPseudoType,
-                                          nsAtom* aPseudoTag,
                                           StyleRuleInclusion aRuleInclusion,
                                           bool aIgnoreExistingStyles)
 {
   mPresContext->EffectCompositor()->PreTraverse(aElement, aPseudoType);
   MOZ_ASSERT(!StylistNeedsUpdate());
 
   AutoSetInServoTraversal guard(this);
 
--- a/layout/style/ServoStyleSet.h
+++ b/layout/style/ServoStyleSet.h
@@ -214,21 +214,20 @@ public:
   ResolvePseudoElementStyle(dom::Element* aOriginatingElement,
                             CSSPseudoElementType aType,
                             ServoStyleContext* aParentContext,
                             dom::Element* aPseudoElement);
 
   // Resolves style for a (possibly-pseudo) Element without assuming that the
   // style has been resolved. If the element was unstyled and a new style
   // context was resolved, it is not stored in the DOM. (That is, the element
-  // remains unstyled.) |aPeudoTag| and |aPseudoType| must match.
+  // remains unstyled.)
   already_AddRefed<ServoStyleContext>
   ResolveStyleLazily(dom::Element* aElement,
                      CSSPseudoElementType aPseudoType,
-                     nsAtom* aPseudoTag,
                      StyleRuleInclusion aRules =
                        StyleRuleInclusion::All);
 
   // Get a style context for an anonymous box.  aPseudoTag is the pseudo-tag to
   // use and must be non-null.  It must be an anon box, and must be one that
   // inherits style from the given aParentContext.
   already_AddRefed<ServoStyleContext>
   ResolveInheritingAnonymousBoxStyle(nsAtom* aPseudoTag,
@@ -553,17 +552,16 @@ private:
    *
    * This should only be called if StylistNeedsUpdate returns true.
    */
   void UpdateStylist();
 
   already_AddRefed<ServoStyleContext>
     ResolveStyleLazilyInternal(dom::Element* aElement,
                                CSSPseudoElementType aPseudoType,
-                               nsAtom* aPseudoTag,
                                StyleRuleInclusion aRules =
                                  StyleRuleInclusion::All,
                                bool aIgnoreExistingStyles = false);
 
   void RunPostTraversalTasks();
 
   void PrependSheetOfType(SheetType aType,
                           ServoStyleSheet* aSheet);
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -737,17 +737,17 @@ nsComputedDOMStyle::DoGetStyleContextNoF
 
   // For Servo, compute the result directly without recursively building up
   // a throwaway style context chain.
   if (ServoStyleSet* servoSet = styleSet->GetAsServo()) {
     StyleRuleInclusion rules = aStyleType == eDefaultOnly
                                ? StyleRuleInclusion::DefaultOnly
                                : StyleRuleInclusion::All;
     RefPtr<ServoStyleContext> result =
-       servoSet->ResolveStyleLazily(aElement, pseudoType, aPseudo, rules);
+       servoSet->ResolveStyleLazily(aElement, pseudoType, rules);
     if (aAnimationFlag == eWithAnimation) {
       return result.forget();
     }
 
     return servoSet->GetBaseContextForElement(aElement, presContext,
                                               aPseudo, pseudoType, result);
   }