Bug 1436782: Insert the prefs sheet at the UA level. r?bholley draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Fri, 09 Feb 2018 22:46:06 +0100
changeset 753256 80fab259e94d17ff9045b028c9b154614149c90e
parent 753255 23c8b93228783491710110cf1622bb8e2394b549
child 753420 9940672e8abee020f63d9a8b836e3dec2ce76875
child 753422 177e80acc94036247a9a4582ae934d82d91bf0cc
push id98536
push userbmo:emilio@crisal.io
push dateFri, 09 Feb 2018 21:48:04 +0000
reviewersbholley
bugs1436782
milestone60.0a1
Bug 1436782: Insert the prefs sheet at the UA level. r?bholley Since that's what it's effectively happening anyway. MozReview-Commit-ID: AZGONTbCTNa
layout/base/PresShell.cpp
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -1297,16 +1297,19 @@ PresShell::Destroy()
   }
 
   if (mAccessibleCaretEventHub) {
     mAccessibleCaretEventHub->Terminate();
     mAccessibleCaretEventHub = nullptr;
   }
 
   // release our pref style sheet, if we have one still
+  //
+  // FIXME(emilio): Why do we need to do this? The stylist is getting nixed with
+  // us anyway.
   RemovePreferenceStyles();
 
   mIsDestroying = true;
 
   // We can't release all the event content in
   // mCurrentEventContentStack here since there might be code on the
   // stack that will release the event content too. Double release
   // bad!
@@ -1489,27 +1492,27 @@ PresShell::UpdatePreferenceStyles()
   }
 
   mStyleSet->BeginUpdate();
 
   RemovePreferenceStyles();
 
   // FIXME(emilio): This sheet is added as an user sheet, but parsed as an agent
   // style sheet... Servo effectively inserts it as a UA sheet! See bug 1291390.
-  mStyleSet->AppendStyleSheet(SheetType::User, newPrefSheet);
+  mStyleSet->AppendStyleSheet(SheetType::Agent, newPrefSheet);
   mPrefStyleSheet = newPrefSheet;
 
   mStyleSet->EndUpdate();
 }
 
 void
 PresShell::RemovePreferenceStyles()
 {
   if (mPrefStyleSheet) {
-    mStyleSet->RemoveStyleSheet(SheetType::User, mPrefStyleSheet);
+    mStyleSet->RemoveStyleSheet(SheetType::Agent, mPrefStyleSheet);
     mPrefStyleSheet = nullptr;
   }
 }
 
 void
 PresShell::AddUserSheet(StyleSheet* aSheet)
 {
   // Make sure this does what nsDocumentViewer::CreateStyleSet does wrt