Bug 1406277 - Completely remove xml:base for style attribute. r?bz draft
authorXidorn Quan <me@upsuper.org>
Fri, 06 Oct 2017 15:45:33 +1100
changeset 675895 c40312c8907dc481f0a3ea54e4ce1339f560ae0d
parent 675847 96f0861cafe1c496ae764aea21baf501a95c056d
child 734752 8f2560f9712cb8266731dbf080899583171efd51
push id83288
push userxquan@mozilla.com
push dateFri, 06 Oct 2017 04:50:35 +0000
reviewersbz
bugs1406277
milestone58.0a1
Bug 1406277 - Completely remove xml:base for style attribute. r?bz This commit removes: * layout.css.style-attr-with-xml-base.disabled pref * deprecation XMLBaseAttributeForStyleAttr * code path for getting base URI of style attr considering xml:base MozReview-Commit-ID: 1w96eqhHPab
dom/base/FragmentOrElement.cpp
dom/base/nsDeprecatedOperationList.h
dom/base/nsIContent.h
layout/base/nsLayoutUtils.cpp
layout/base/nsLayoutUtils.h
modules/libpref/init/all.js
--- a/dom/base/FragmentOrElement.cpp
+++ b/dom/base/FragmentOrElement.cpp
@@ -440,65 +440,42 @@ nsIContent::GetBaseURI(bool aTryUseXHRDo
       }
     }
   }
 
   return base.forget();
 }
 
 nsIURI*
-nsIContent::GetBaseURIWithoutXMLBase() const
+nsIContent::GetBaseURIForStyleAttr() const
 {
   if (IsInAnonymousSubtree() && IsAnonymousContentInSVGUseSubtree()) {
     nsIContent* bindingParent = GetBindingParent();
     MOZ_ASSERT(bindingParent);
     SVGUseElement* useElement = static_cast<SVGUseElement*>(bindingParent);
     if (URLExtraData* data = useElement->GetContentURLData()) {
       return data->BaseURI();
     }
   }
   // This also ignores the case that SVG inside XBL binding.
   // But it is probably fine.
   return OwnerDoc()->GetDocBaseURI();
 }
 
-already_AddRefed<nsIURI>
-nsIContent::GetBaseURIForStyleAttr() const
-{
-  nsIDocument* doc = OwnerDoc();
-  nsIURI* baseWithoutXMLBase = GetBaseURIWithoutXMLBase();
-  nsCOMPtr<nsIURI> base = GetBaseURI();
-  // If eXMLBaseAttribute is not triggered in GetBaseURI() call above,
-  // we don't need to count eXMLBaseAttributeForStyleAttr either.
-  if (doc->HasWarnedAbout(nsIDocument::eXMLBaseAttribute) &&
-      !doc->HasWarnedAbout(nsIDocument::eXMLBaseAttributeForStyleAttr)) {
-    bool isEqual = false;
-    base->Equals(baseWithoutXMLBase, &isEqual);
-    if (!isEqual) {
-      doc->WarnOnceAbout(nsIDocument::eXMLBaseAttributeForStyleAttr);
-    }
-  }
-  return nsLayoutUtils::StyleAttrWithXMLBaseDisabled()
-    ? do_AddRef(baseWithoutXMLBase) : base.forget();
-}
-
 URLExtraData*
 nsIContent::GetURLDataForStyleAttr() const
 {
   if (IsInAnonymousSubtree() && IsAnonymousContentInSVGUseSubtree()) {
     nsIContent* bindingParent = GetBindingParent();
     MOZ_ASSERT(bindingParent);
     SVGUseElement* useElement = static_cast<SVGUseElement*>(bindingParent);
     if (URLExtraData* data = useElement->GetContentURLData()) {
       return data;
     }
   }
-  // We are not going to support xml:base for stylo, but we want to
-  // ensure we unship that support before we enabling stylo.
-  MOZ_ASSERT(nsLayoutUtils::StyleAttrWithXMLBaseDisabled());
   // This also ignores the case that SVG inside XBL binding.
   // But it is probably fine.
   return OwnerDoc()->DefaultStyleAttrURLData();
 }
 
 //----------------------------------------------------------------------
 
 static inline JSObject*
--- a/dom/base/nsDeprecatedOperationList.h
+++ b/dom/base/nsDeprecatedOperationList.h
@@ -44,10 +44,9 @@ DEPRECATED_OPERATION(RTCPeerConnectionGe
 DEPRECATED_OPERATION(AppCache)
 DEPRECATED_OPERATION(PrefixedImageSmoothingEnabled)
 DEPRECATED_OPERATION(PrefixedFullscreenAPI)
 DEPRECATED_OPERATION(LenientSetter)
 DEPRECATED_OPERATION(FileLastModifiedDate)
 DEPRECATED_OPERATION(ImageBitmapRenderingContext_TransferImageBitmap)
 DEPRECATED_OPERATION(URLCreateObjectURL_MediaStream)
 DEPRECATED_OPERATION(XMLBaseAttribute)
-DEPRECATED_OPERATION(XMLBaseAttributeForStyleAttr)
 DEPRECATED_OPERATION(WindowContentUntrusted)
--- a/dom/base/nsIContent.h
+++ b/dom/base/nsIContent.h
@@ -960,17 +960,17 @@ public:
                               nsGkAtoms::resizer,
                               nsGkAtoms::scrollcorner);
   }
 
   // Overloaded from nsINode
   virtual already_AddRefed<nsIURI> GetBaseURI(bool aTryUseXHRDocBaseURI = false) const override;
 
   // Returns base URI for style attribute.
-  already_AddRefed<nsIURI> GetBaseURIForStyleAttr() const;
+  nsIURI* GetBaseURIForStyleAttr() const;
 
   // Returns the URL data for style attribute.
   mozilla::URLExtraData* GetURLDataForStyleAttr() const;
 
   virtual nsresult GetEventTargetParent(
                      mozilla::EventChainPreVisitor& aVisitor) override;
 
   virtual bool IsPurple() = 0;
@@ -985,19 +985,16 @@ public:
 
 protected:
   /**
    * Hook for implementing GetID.  This is guaranteed to only be
    * called if HasID() is true.
    */
   nsIAtom* DoGetID() const;
 
-  // Returns base URI without considering xml:base.
-  inline nsIURI* GetBaseURIWithoutXMLBase() const;
-
 public:
 #ifdef DEBUG
   /**
    * List the content (and anything it contains) out to the given
    * file stream. Use aIndent as the base indent during formatting.
    */
   virtual void List(FILE* out = stdout, int32_t aIndent = 0) const = 0;
 
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -188,17 +188,16 @@ typedef nsStyleTransformMatrix::Transfor
 /* static */ uint32_t nsLayoutUtils::sZoomMinPercent;
 /* static */ bool nsLayoutUtils::sInvalidationDebuggingIsEnabled;
 /* static */ bool nsLayoutUtils::sInterruptibleReflowEnabled;
 /* static */ bool nsLayoutUtils::sSVGTransformBoxEnabled;
 /* static */ bool nsLayoutUtils::sTextCombineUprightDigitsEnabled;
 #ifdef MOZ_STYLO
 /* static */ bool nsLayoutUtils::sStyloEnabled;
 #endif
-/* static */ bool nsLayoutUtils::sStyleAttrWithXMLBaseDisabled;
 /* static */ uint32_t nsLayoutUtils::sIdlePeriodDeadlineLimit;
 /* static */ uint32_t nsLayoutUtils::sQuiescentFramesBeforeIdlePeriod;
 
 static ViewID sScrollIdCounter = FrameMetrics::START_SCROLL_ID;
 
 typedef nsDataHashtable<nsUint64HashKey, nsIContent*> ContentMap;
 static ContentMap* sContentMap = nullptr;
 static ContentMap& GetContentMap() {
@@ -7968,18 +7967,16 @@ nsLayoutUtils::Initialize()
     sStyloEnabled = true;
   } else if (PR_GetEnv("STYLO_FORCE_DISABLED")) {
     sStyloEnabled = false;
   } else {
     Preferences::AddBoolVarCache(&sStyloEnabled,
                                  "layout.css.servo.enabled");
   }
 #endif
-  Preferences::AddBoolVarCache(&sStyleAttrWithXMLBaseDisabled,
-                               "layout.css.style-attr-with-xml-base.disabled");
   Preferences::AddUintVarCache(&sIdlePeriodDeadlineLimit,
                                "layout.idle_period.time_limit",
                                DEFAULT_IDLE_PERIOD_TIME_LIMIT);
   Preferences::AddUintVarCache(&sQuiescentFramesBeforeIdlePeriod,
                                "layout.idle_period.required_quiescent_frames",
                                DEFAULT_QUIESCENT_FRAMES);
 
   for (auto& callback : kPrefCallbacks) {
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -2525,20 +2525,16 @@ public:
 
   // Whether Stylo should be allowed to be enabled in this process.  This
   // returns true for content processes and the non-e10s parent process.
   static bool StyloSupportedInCurrentProcess() {
      return XRE_IsContentProcess() ||
             (XRE_IsParentProcess() && !XRE_IsE10sParentProcess());
   }
 
-  static bool StyleAttrWithXMLBaseDisabled() {
-    return sStyleAttrWithXMLBaseDisabled;
-  }
-
   static uint32_t IdlePeriodDeadlineLimit() {
     return sIdlePeriodDeadlineLimit;
   }
 
   static uint32_t QuiescentFramesBeforeIdlePeriod() {
     return sQuiescentFramesBeforeIdlePeriod;
   }
 
@@ -3025,17 +3021,16 @@ private:
   static uint32_t sZoomMinPercent;
   static bool sInvalidationDebuggingIsEnabled;
   static bool sInterruptibleReflowEnabled;
   static bool sSVGTransformBoxEnabled;
   static bool sTextCombineUprightDigitsEnabled;
 #ifdef MOZ_STYLO
   static bool sStyloEnabled;
 #endif
-  static bool sStyleAttrWithXMLBaseDisabled;
   static uint32_t sIdlePeriodDeadlineLimit;
   static uint32_t sQuiescentFramesBeforeIdlePeriod;
 
   /**
    * Helper function for LogTestDataForPaint().
    */
   static void DoLogTestDataForPaint(mozilla::layers::LayerManager* aManager,
                                     ViewID aScrollId,
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -3091,19 +3091,16 @@ pref("layout.css.font-loading-api.enable
 pref("layout.css.control-characters.visible", false);
 #else
 pref("layout.css.control-characters.visible", true);
 #endif
 
 // Is support for column-span enabled?
 pref("layout.css.column-span.enabled", false);
 
-// Is effect of xml:base disabled for style attribute?
-pref("layout.css.style-attr-with-xml-base.disabled", true);
-
 // Are inter-character ruby annotations enabled?
 pref("layout.css.ruby.intercharacter.enabled", false);
 
 // pref for which side vertical scrollbars should be on
 // 0 = end-side in UI direction
 // 1 = end-side in document/content direction
 // 2 = right
 // 3 = left