Bug 1290209 - Part 9: Don't return early from Loader::PrepareSheet for a ServoStyleSheet. r=xidorn
authorCameron McCormack <cam@mcc.id.au>
Fri, 06 Jan 2017 15:05:24 +0800
changeset 328192 613c5d1ec7b91e8637f4d08156ab2019d3873b8c
parent 328191 19fcced7d097c3405c40d933b43a124a6888d822
child 328193 cfc41cf8b0b316f7884c997d309fa177b28cb468
push id85395
push usercmccormack@mozilla.com
push dateFri, 06 Jan 2017 07:21:28 +0000
treeherdermozilla-inbound@cfc41cf8b0b3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxidorn
bugs1290209
milestone53.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 1290209 - Part 9: Don't return early from Loader::PrepareSheet for a ServoStyleSheet. r=xidorn MozReview-Commit-ID: 8NXajQ6pMqi
layout/style/Loader.cpp
--- a/layout/style/Loader.cpp
+++ b/layout/style/Loader.cpp
@@ -1277,24 +1277,16 @@ Loader::PrepareSheet(StyleSheet* aSheet,
                      const nsSubstring& aTitle,
                      const nsSubstring& aMediaString,
                      nsMediaList* aMediaList,
                      Element* aScopeElement,
                      bool aIsAlternate)
 {
   NS_PRECONDITION(aSheet, "Must have a sheet!");
 
-  // XXXheycam Need to set media, title, etc. on ServoStyleSheets.
-  if (aSheet->IsServo()) {
-    NS_WARNING("stylo: should set metadata on ServoStyleSheets. See bug 1290209.");
-    return;
-  }
-
-  CSSStyleSheet* sheet = aSheet->AsGecko();
-
   RefPtr<nsMediaList> mediaList(aMediaList);
 
   if (!aMediaString.IsEmpty()) {
     NS_ASSERTION(!aMediaList,
                  "must not provide both aMediaString and aMediaList");
     mediaList = new nsMediaList();
 
     nsCSSParser mediumParser(this);
@@ -1303,17 +1295,24 @@ Loader::PrepareSheet(StyleSheet* aSheet,
     // elements, or PIs, so pass true.
     mediumParser.ParseMediaList(aMediaString, nullptr, 0, mediaList);
   }
 
   aSheet->SetMedia(mediaList);
 
   aSheet->SetTitle(aTitle);
   aSheet->SetEnabled(!aIsAlternate);
-  sheet->SetScopeElement(aScopeElement);
+
+  if (aSheet->IsGecko()) {
+    aSheet->AsGecko()->SetScopeElement(aScopeElement);
+  } else {
+    if (aScopeElement) {
+      NS_WARNING("stylo: scoped style sheets not supported");
+    }
+  }
 }
 
 /**
  * InsertSheetInDoc handles ordering of sheets in the document.  Here
  * we have two types of sheets -- those with linking elements and
  * those without.  The latter are loaded by Link: headers.
  * The following constraints are observed:
  * 1) Any sheet with a linking element comes after all sheets without