Bug 1639392 - Remove nsIStyleSheetLinkingElement::InitStyleLinkElement. r=jwatt
☠☠ backed out by a0d10a7e5c3f ☠ ☠
authorEmilio Cobos Álvarez <emilio@crisal.io>
Wed, 20 May 2020 10:30:32 +0000
changeset 531266 cee5116fbef3b3e1f2a90461db2259fb2cfdeb8d
parent 531265 7c5823c53db8e9f3f759816a5492d92d296cd3e5
child 531267 ce2500faad3817560e106e9ff0588cca6fcfee27
push id37436
push userncsoregi@mozilla.com
push dateWed, 20 May 2020 21:30:50 +0000
treeherdermozilla-central@6c10970490f3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwatt
bugs1639392
milestone78.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 1639392 - Remove nsIStyleSheetLinkingElement::InitStyleLinkElement. r=jwatt Always gets false as an argument, and the value starts false, so it's just dead code. Depends on D76067 Differential Revision: https://phabricator.services.mozilla.com/D76068
dom/base/nsIStyleSheetLinkingElement.h
dom/base/nsStyleLinkElement.cpp
dom/base/nsStyleLinkElement.h
dom/prototype/PrototypeDocumentContentSink.cpp
dom/xml/nsXMLContentSink.cpp
dom/xslt/xslt/txMozillaXMLOutput.cpp
parser/html/nsHtml5TreeOperation.cpp
--- a/dom/base/nsIStyleSheetLinkingElement.h
+++ b/dom/base/nsIStyleSheetLinkingElement.h
@@ -122,25 +122,16 @@ class nsIStyleSheetLinkingElement : publ
    * Used to make the association between a style sheet and
    * the element that linked it to the document.
    *
    * @param aStyleSheet the style sheet associated with this
    *                    element.
    */
   virtual void SetStyleSheet(mozilla::StyleSheet* aStyleSheet) = 0;
 
-
-  /**
-   * Initialize the stylesheet linking element. If aDontLoadStyle is
-   * true the element will ignore the first modification to the
-   * element that would cause a stylesheet to be loaded. Subsequent
-   * modifications to the element will not be ignored.
-   */
-  virtual void InitStyleLinkElement(bool aDontLoadStyle) = 0;
-
   /**
    * Tells this element to update the stylesheet.
    *
    * @param aObserver    observer to notify once the stylesheet is loaded.
    *                     This will be passed to the CSSLoader
    */
   virtual mozilla::Result<Update, nsresult> UpdateStyleSheet(
       nsICSSLoaderObserver* aObserver) = 0;
--- a/dom/base/nsStyleLinkElement.cpp
+++ b/dom/base/nsStyleLinkElement.cpp
@@ -60,18 +60,17 @@ nsStyleLinkElement::SheetInfo::SheetInfo
   MOZ_ASSERT(mReferrerInfo);
   MOZ_ASSERT(mIntegrity.IsEmpty() || !mIsInline,
              "Integrity only applies to <link>");
 }
 
 nsStyleLinkElement::SheetInfo::~SheetInfo() = default;
 
 nsStyleLinkElement::nsStyleLinkElement()
-    : mDontLoadStyle(false),
-      mUpdatesEnabled(true),
+    : mUpdatesEnabled(true),
       mLineNumber(1),
       mColumnNumber(1) {}
 
 nsStyleLinkElement::~nsStyleLinkElement() {
   nsStyleLinkElement::SetStyleSheet(nullptr);
 }
 
 void nsStyleLinkElement::GetTitleAndMediaForElement(const Element& aSelf,
@@ -126,20 +125,16 @@ void nsStyleLinkElement::SetStyleSheet(S
   if (mStyleSheet) {
     nsCOMPtr<nsINode> node = do_QueryObject(this);
     if (node) {
       mStyleSheet->SetOwningNode(node);
     }
   }
 }
 
-void nsStyleLinkElement::InitStyleLinkElement(bool aDontLoadStyle) {
-  mDontLoadStyle = aDontLoadStyle;
-}
-
 void nsStyleLinkElement::SetEnableUpdates(bool aEnableUpdates) {
   mUpdatesEnabled = aEnableUpdates;
 }
 
 void nsStyleLinkElement::GetCharset(nsAString& aCharset) {
   aCharset.Truncate();
 }
 
@@ -269,17 +264,17 @@ nsStyleLinkElement::DoUpdateStyleSheet(D
   Document* doc = thisContent->GetComposedDoc();
 
   // Loader could be null during unlink, see bug 1425866.
   if (!doc || !doc->CSSLoader() || !doc->CSSLoader()->GetEnabled()) {
     return Update{};
   }
 
   // When static documents are created, stylesheets are cloned manually.
-  if (mDontLoadStyle || !mUpdatesEnabled || doc->IsStaticDocument()) {
+  if (!mUpdatesEnabled || doc->IsStaticDocument()) {
     return Update{};
   }
 
   Maybe<SheetInfo> info = GetStyleSheetInfo();
   if (aForceUpdate == ForceUpdate::No && mStyleSheet && info &&
       !info->mIsInline && info->mURI) {
     if (nsIURI* oldURI = mStyleSheet->GetSheetURI()) {
       bool equal;
--- a/dom/base/nsStyleLinkElement.h
+++ b/dom/base/nsStyleLinkElement.h
@@ -37,17 +37,16 @@ class nsStyleLinkElement : public nsISty
   virtual ~nsStyleLinkElement();
 
   NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override = 0;
 
   mozilla::StyleSheet* GetSheet() const { return mStyleSheet; }
 
   // nsIStyleSheetLinkingElement
   void SetStyleSheet(mozilla::StyleSheet* aStyleSheet) override;
-  void InitStyleLinkElement(bool aDontLoadStyle) override;
 
   mozilla::Result<Update, nsresult> UpdateStyleSheet(
       nsICSSLoaderObserver*) override;
 
   void SetEnableUpdates(bool aEnableUpdates) override;
   void GetCharset(nsAString& aCharset) override;
 
   void OverrideBaseURI(nsIURI* aNewBaseURI) override;
@@ -127,15 +126,14 @@ class nsStyleLinkElement : public nsISty
       mozilla::dom::Document* aOldDocument,
       mozilla::dom::ShadowRoot* aOldShadowRoot, nsICSSLoaderObserver* aObserver,
       ForceUpdate);
 
   RefPtr<mozilla::StyleSheet> mStyleSheet;
 
  protected:
   nsCOMPtr<nsIPrincipal> mTriggeringPrincipal;
-  bool mDontLoadStyle;
   bool mUpdatesEnabled;
   uint32_t mLineNumber;
   uint32_t mColumnNumber;
 };
 
 #endif /* nsStyleLinkElement_h___ */
--- a/dom/prototype/PrototypeDocumentContentSink.cpp
+++ b/dom/prototype/PrototypeDocumentContentSink.cpp
@@ -359,17 +359,16 @@ nsresult PrototypeDocumentContentSink::I
     nsIContent* aPINode) {
   nsCOMPtr<nsIStyleSheetLinkingElement> ssle(do_QueryInterface(aPINode));
   NS_ASSERTION(ssle,
                "passed XML Stylesheet node does not "
                "implement nsIStyleSheetLinkingElement!");
 
   nsresult rv;
 
-  ssle->InitStyleLinkElement(false);
   // We want to be notified when the style sheet finishes loading, so
   // disable style sheet loading for now.
   ssle->SetEnableUpdates(false);
   ssle->OverrideBaseURI(mCurrentPrototype->GetURI());
 
   rv = aParent->InsertChildBefore(
       aPINode->AsContent(), aBeforeThis ? aBeforeThis->AsContent() : nullptr,
       false);
--- a/dom/xml/nsXMLContentSink.cpp
+++ b/dom/xml/nsXMLContentSink.cpp
@@ -496,17 +496,16 @@ nsresult nsXMLContentSink::CreateElement
     }
   }
 
   if (aNodeInfo->Equals(nsGkAtoms::link, kNameSpaceID_XHTML) ||
       aNodeInfo->Equals(nsGkAtoms::style, kNameSpaceID_XHTML) ||
       aNodeInfo->Equals(nsGkAtoms::style, kNameSpaceID_SVG)) {
     nsCOMPtr<nsIStyleSheetLinkingElement> ssle(do_QueryInterface(content));
     if (ssle) {
-      ssle->InitStyleLinkElement(false);
       if (aFromParser) {
         ssle->SetEnableUpdates(false);
       }
       if (!aNodeInfo->Equals(nsGkAtoms::link, kNameSpaceID_XHTML)) {
         ssle->SetLineNumber(aFromParser ? aLineNumber : 0);
         ssle->SetColumnNumber(aFromParser ? aColumnNumber : 0);
       }
     }
@@ -1163,17 +1162,16 @@ nsXMLContentSink::HandleProcessingInstru
   const nsDependentString data(aData);
 
   RefPtr<ProcessingInstruction> node =
       NS_NewXMLProcessingInstruction(mNodeInfoManager, target, data);
 
   nsCOMPtr<nsIStyleSheetLinkingElement> ssle =
       do_QueryInterface(ToSupports(node));
   if (ssle) {
-    ssle->InitStyleLinkElement(false);
     ssle->SetEnableUpdates(false);
     mPrettyPrintXML = false;
   }
 
   nsresult rv = AddContentAsLeaf(node);
   NS_ENSURE_SUCCESS(rv, rv);
   DidAddContent();
 
--- a/dom/xslt/xslt/txMozillaXMLOutput.cpp
+++ b/dom/xslt/xslt/txMozillaXMLOutput.cpp
@@ -351,17 +351,16 @@ nsresult txMozillaXMLOutput::processingI
 
   nsCOMPtr<nsIContent> pi =
       NS_NewXMLProcessingInstruction(mNodeInfoManager, aTarget, aData);
 
   nsCOMPtr<nsIStyleSheetLinkingElement> ssle;
   if (mCreatingNewDocument) {
     ssle = do_QueryInterface(pi);
     if (ssle) {
-      ssle->InitStyleLinkElement(false);
       ssle->SetEnableUpdates(false);
     }
   }
 
   rv = mCurrentNode->AppendChildTo(pi, true);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (ssle) {
@@ -496,17 +495,16 @@ nsresult txMozillaXMLOutput::startElemen
     }
   }
 
   if (mCreatingNewDocument) {
     // Handle all sorts of stylesheets
     nsCOMPtr<nsIStyleSheetLinkingElement> ssle =
         do_QueryInterface(mOpenedElement);
     if (ssle) {
-      ssle->InitStyleLinkElement(false);
       ssle->SetEnableUpdates(false);
     }
   }
 
   return NS_OK;
 }
 
 nsresult txMozillaXMLOutput::closePrevious(bool aFlushText) {
--- a/parser/html/nsHtml5TreeOperation.cpp
+++ b/parser/html/nsHtml5TreeOperation.cpp
@@ -453,17 +453,16 @@ nsIContent* nsHtml5TreeOperation::Create
 
     MOZ_ASSERT(newElement, "Element creation created null pointer.");
     newContent = newElement;
     aBuilder->HoldElement(newElement.forget());
 
     if (MOZ_UNLIKELY(aName == nsGkAtoms::style || aName == nsGkAtoms::link)) {
       nsCOMPtr<nsIStyleSheetLinkingElement> ssle(do_QueryInterface(newContent));
       if (ssle) {
-        ssle->InitStyleLinkElement(false);
         ssle->SetEnableUpdates(false);
       }
     }
 
     if (!aAttributes) {
       return newContent;
     }
 
@@ -481,17 +480,16 @@ nsIContent* nsHtml5TreeOperation::Create
     MOZ_ASSERT(newElement, "Element creation created null pointer.");
 
     newContent = newElement;
     aBuilder->HoldElement(newElement.forget());
 
     if (MOZ_UNLIKELY(aName == nsGkAtoms::style || aName == nsGkAtoms::link)) {
       nsCOMPtr<nsIStyleSheetLinkingElement> ssle(do_QueryInterface(newContent));
       if (ssle) {
-        ssle->InitStyleLinkElement(false);
         ssle->SetEnableUpdates(false);
       }
     }
 
     if (!aAttributes) {
       return newContent;
     }
 
@@ -530,17 +528,16 @@ nsIContent* nsHtml5TreeOperation::Create
   }
 
   dom::Element* newContent = newElement->AsElement();
   aBuilder->HoldElement(newElement.forget());
 
   if (MOZ_UNLIKELY(aName == nsGkAtoms::style)) {
     nsCOMPtr<nsIStyleSheetLinkingElement> ssle(do_QueryInterface(newContent));
     if (ssle) {
-      ssle->InitStyleLinkElement(false);
       ssle->SetEnableUpdates(false);
     }
   }
 
   if (!aAttributes) {
     return newContent;
   }