Bug 1343078 part 5. Change the restyle manager to handle style contexts with no parent in ReparentStyleContext (by doing nothing with them). r?dbaron draft
authorBoris Zbarsky <bzbarsky@mit.edu>
Wed, 01 Mar 2017 03:32:06 -0500
changeset 490766 8e20db804312ed7e9171edc5c0172f6adf7926b3
parent 490765 c95897eedd79937b3325063bdd23866c1dd69e9c
child 490767 1ce6974b0f7d6f83beb94fc574f78516e669dd7b
child 491027 7a90909df09311517ed42d0452492fd5feedc7b5
push id47215
push userbzbarsky@mozilla.com
push dateWed, 01 Mar 2017 08:32:45 +0000
reviewersdbaron
bugs1343078
milestone54.0a1
Bug 1343078 part 5. Change the restyle manager to handle style contexts with no parent in ReparentStyleContext (by doing nothing with them). r?dbaron MozReview-Commit-ID: 9a89RV8mKYn
layout/base/GeckoRestyleManager.cpp
--- a/layout/base/GeckoRestyleManager.cpp
+++ b/layout/base/GeckoRestyleManager.cpp
@@ -861,16 +861,22 @@ GeckoRestyleManager::ReparentStyleContex
   nsIFrame* providerChild = nullptr;
   if (isChild) {
     ReparentStyleContext(providerFrame);
     // Get the style context again after ReparentStyleContext() which might have
     // changed it.
     newParentContext = providerFrame->StyleContext();
     providerChild = providerFrame;
   }
+
+  if (!newParentContext && !oldContext->GetParent()) {
+    // No need to do anything here.
+    return NS_OK;
+  }
+
   NS_ASSERTION(newParentContext, "Reparenting something that has no usable"
                " parent? Shouldn't happen!");
   // XXX need to do something here to produce the correct style context for
   // an IB split whose first inline part is inside a first-line frame.
   // Currently the first IB anonymous block's style context takes the first
   // part's style context as parent, which is wrong since first-line style
   // should not apply to the anonymous block.