Bug 1389743: Remove various Stylo hacks to deal with XBL edge cases. r?heycam
MozReview-Commit-ID: HN7PfsNrh9e
--- 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