Bug 1399546: Implement the tables inherit from body quirk in a more straight-forward way. r=heycam draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Fri, 15 Sep 2017 22:54:59 +0200
changeset 665720 eb4a9b4c68aa9b5eb70c1ce59d7da8f1dfa07af7
parent 665718 15cadfb0d81411ec285e2d5232fb4dd90399682e
child 731859 36160f7436c044c9a2b97fadc6fa9324a7bebf7a
push id80149
push userbmo:emilio@crisal.io
push dateFri, 15 Sep 2017 21:03:46 +0000
reviewersheycam
bugs1399546
milestone57.0a1
Bug 1399546: Implement the tables inherit from body quirk in a more straight-forward way. r=heycam MozReview-Commit-ID: 8mtd4CsoSlU
layout/style/ServoBindings.cpp
layout/style/ServoBindings.h
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -839,20 +839,21 @@ Gecko_FillAllBackgroundLists(nsStyleImag
 }
 
 void
 Gecko_FillAllMaskLists(nsStyleImageLayers* aLayers, uint32_t aMaxLen)
 {
   nsRuleNode::FillAllMaskLists(*aLayers, aMaxLen);
 }
 
-RawGeckoElementBorrowedOrNull
-Gecko_GetBody(RawGeckoPresContextBorrowed aPresContext)
+bool
+Gecko_IsDocumentBody(RawGeckoElementBorrowed aElement)
 {
-  return aPresContext->Document()->GetBodyElement();
+  nsIDocument* doc = aElement->GetUncomposedDoc();
+  return doc && doc->GetBodyElement() == aElement;
 }
 
 nscolor
 Gecko_GetLookAndFeelSystemColor(int32_t aId,
                                 RawGeckoPresContextBorrowed aPresContext)
 {
   bool useStandinsForNativeColors = aPresContext && !aPresContext->IsChrome();
   nscolor result;
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -626,17 +626,17 @@ NS_DECL_FFI_REFCOUNTING(nsCSSFontFaceRul
 
 // Counter style rule
 // Creates and returns a new (already-addrefed) nsCSSCounterStyleRule object.
 nsCSSCounterStyleRule* Gecko_CSSCounterStyle_Create(nsIAtom* name);
 nsCSSCounterStyleRule* Gecko_CSSCounterStyle_Clone(const nsCSSCounterStyleRule* rule);
 void Gecko_CSSCounterStyle_GetCssText(const nsCSSCounterStyleRule* rule, nsAString* result);
 NS_DECL_FFI_REFCOUNTING(nsCSSCounterStyleRule, CSSCounterStyleRule);
 
-RawGeckoElementBorrowedOrNull Gecko_GetBody(RawGeckoPresContextBorrowed pres_context);
+bool Gecko_IsDocumentBody(RawGeckoElementBorrowed element);
 
 // We use an int32_t here instead of a LookAndFeel::ColorID
 // because forward-declaring a nested enum/struct is impossible
 nscolor Gecko_GetLookAndFeelSystemColor(int32_t color_id,
                                         RawGeckoPresContextBorrowed pres_context);
 
 bool Gecko_MatchStringArgPseudo(RawGeckoElementBorrowed element,
                                 mozilla::CSSPseudoClassType type,