Bug 1389743: Remove various Stylo hacks to deal with XBL edge cases. r=heycam
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sun, 13 Aug 2017 20:44:58 +0200
changeset 376271 6406fed0a0473626bdfd4307e27034ccd2ddf7f9
parent 376270 5c0a8f5eb8c9f1e26411bd9d48ad1d8da9ef60a2
child 376272 24e3a5c84776c6e7613915c392f08224802dcffd
push id49389
push userecoal95@gmail.com
push dateWed, 23 Aug 2017 08:46:22 +0000
treeherderautoland@6406fed0a047 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1389743
milestone57.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 1389743: Remove various Stylo hacks to deal with XBL edge cases. r=heycam MozReview-Commit-ID: HN7PfsNrh9e
layout/base/nsCSSFrameConstructor.cpp
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -2580,19 +2580,16 @@ nsCSSFrameConstructor::ConstructDocEleme
     }
 
     RefPtr<nsXBLBinding> binding;
     rv = xblService->LoadBindings(aDocElement, display->mBinding->GetURI(),
                                   display->mBinding->mExtraData->GetPrincipal(),
                                   getter_AddRefs(binding), &resolveStyle);
     if (NS_FAILED(rv) && rv != NS_ERROR_XBL_BLOCKED) {
       // Binding will load asynchronously.
-      if (aDocElement->IsStyledByServo()) {
-        ServoRestyleManager::ClearServoDataFromSubtree(aDocElement);
-      }
       return nullptr;
     }
 
     if (binding) {
       // For backwards compat, keep firing the root's constructor
       // after all of its kids' constructors.  So tell the binding
       // manager about it right now.
       mDocument->BindingManager()->AddToAttachedQueue(binding);
@@ -8659,45 +8656,16 @@ nsCSSFrameConstructor::ContentRemoved(ns
   *aDidReconstruct = false;
 
   // Only recreate sync if we're already in frame construction, that is,
   // recreate async for XBL DOM changes, and normal content removals.
   const InsertionKind insertionKind = (aFlags == REMOVE_FOR_RECONSTRUCTION)
                                         ? InsertionKind::Sync
                                         : InsertionKind::Async;
 
-  // We're destroying our frame(s). This normally happens either when the
-  // content is being removed from the DOM (in which case we'll drop all Servo
-  // data in UnbindFromTree), or when we're recreating frames (usually in
-  // response to having retrieved a ReconstructFrame change hint after
-  // restyling). In both of those cases, there are no pending restyles we need
-  // to worry about.
-  //
-  // However, there is also the (rare) DestroyFramesFor path, in which we tear
-  // down (and usually recreate) the frames for a subtree. In this case, leaving
-  // the style data on the elements is problematic for our invariants, because
-  // there might be pending restyles in the subtree. If we simply leave them
-  // as-is, the subsequent traversal when recreating frames will generate a
-  // bunch of bogus change hints to update frames that no longer exist.
-  //
-  // So the two obvious options are to (1) process all pending restyles and take
-  // all the change hints before destroying the frames, or (2) drop all the
-  // style data.  We chose the latter, since that matches the performance
-  // characteristics of the old Gecko style system.
-  //
-  // That said, it's almost certainly possible to optimize this if it turns out
-  // to be hot. It's just not a priority at the moment.
-  //
-  // FIXME(emilio): This really really feels like a hack, and it's only for the
-  // XBL/Shadow DOM path, so we should do this there instead.
-  if (aFlags == REMOVE_DESTROY_FRAMES && aChild->IsElement() &&
-      aChild->IsStyledByServo()) {
-    ServoRestyleManager::ClearServoDataFromSubtree(aChild->AsElement());
-  }
-
   nsPresContext* presContext = mPresShell->GetPresContext();
   MOZ_ASSERT(presContext, "Our presShell should have a valid presContext");
 
   if (aChild->IsHTMLElement(nsGkAtoms::body) ||
       (!aContainer && aChild->IsElement())) {
     // We might be removing the element that we propagated viewport scrollbar
     // styles from.  Recompute those. (This clause covers two of the three
     // possible scrollbar-propagation sources: the <body> [as aChild or a