Bug 1443950: Go back to using getComposedDoc for the computed style by default. r?bz draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Wed, 28 Mar 2018 03:25:47 +0200
changeset 773573 94c452bb8eb98effcb324dc39b9b180fabd3bf62
parent 773572 abd8fae2ef8eae4c03b71b6c0337e84421e0fc13
push id104249
push userbmo:emilio@crisal.io
push dateWed, 28 Mar 2018 01:29:38 +0000
reviewersbz
bugs1443950, 1432490
milestone61.0a1
Bug 1443950: Go back to using getComposedDoc for the computed style by default. r?bz Now that NODE_FORCE_XBL_BINDINGS is gone, the only reason OwnerDoc() was added in bug 1432490 is also gone. Let's go back to using the composed doc, at least until the CSSWG decides on what's the computed style of something that's not in[1]. [1]: https://github.com/w3c/csswg-drafts/issues/1548 MozReview-Commit-ID: EV1c46kkUva
layout/style/nsComputedDOMStyle.h
--- a/layout/style/nsComputedDOMStyle.h
+++ b/layout/style/nsComputedDOMStyle.h
@@ -10,25 +10,25 @@
 #define nsComputedDOMStyle_h__
 
 #include "mozilla/ArenaRefPtr.h"
 #include "mozilla/ArenaRefPtrInlines.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/StyleComplexColor.h"
 #include "mozilla/UniquePtr.h"
 #include "nsCOMPtr.h"
+#include "nsContentUtils.h"
 #include "nscore.h"
 #include "nsCSSProps.h"
 #include "nsDOMCSSDeclaration.h"
 #include "mozilla/ComputedStyle.h"
 #include "nsIWeakReferenceUtils.h"
 #include "mozilla/gfx/Types.h"
 #include "nsCoord.h"
 #include "nsColor.h"
-#include "nsIContent.h"
 #include "nsStyleStruct.h"
 #include "mozilla/WritingModes.h"
 
 namespace mozilla {
 namespace dom {
 class DocGroup;
 class Element;
 } // namespace dom
@@ -102,17 +102,17 @@ public:
 
   static already_AddRefed<mozilla::ComputedStyle>
   GetComputedStyleNoFlush(mozilla::dom::Element* aElement,
                           nsAtom* aPseudo,
                           StyleType aStyleType = eAll)
   {
     return DoGetComputedStyleNoFlush(aElement,
                                      aPseudo,
-                                     aElement->OwnerDoc()->GetShell(),
+                                     nsContentUtils::GetPresShellForContent(aElement),
                                      aStyleType);
   }
 
   static already_AddRefed<mozilla::ComputedStyle>
   GetUnanimatedComputedStyleNoFlush(mozilla::dom::Element* aElement,
                                     nsAtom* aPseudo);
 
   // Helper for nsDOMWindowUtils::GetVisitedDependentComputedStyle