Commit 296dd12f authored by Andrew McCreight's avatar Andrew McCreight
Browse files

Bug 735342 - CanSkip for unoptimizable nodes held by binding manager. r=smaug

parent a13cc9c3
Loading
Loading
Loading
Loading
+16 −7
Original line number Diff line number Diff line
@@ -4616,18 +4616,18 @@ nsGenericElement::CanSkipInCC(nsINode* aNode)
    return false;
  }

  // Bail out early if aNode is somewhere in anonymous content,
  // or otherwise unusual.
  if (UnoptimizableCCNode(aNode)) {
    return false;
  }

  nsIDocument* currentDoc = aNode->GetCurrentDoc();
  if (currentDoc &&
      nsCCUncollectableMarker::InGeneration(currentDoc->GetMarkedCCGeneration())) {
    return !NeedsScriptTraverse(aNode);
  }

  // Bail out early if aNode is somewhere in anonymous content,
  // or otherwise unusual.
  if (UnoptimizableCCNode(aNode)) {
    return false;
  }

  nsINode* root =
    currentDoc ? static_cast<nsINode*>(currentDoc) :
                 FindOptimizableSubtreeRoot(aNode);
@@ -4762,6 +4762,13 @@ NodeHasActiveFrame(nsIDocument* aCurrentDoc, nsINode* aNode)
         aNode->AsElement()->GetPrimaryFrame();
}

bool
OwnedByBindingManager(nsIDocument* aCurrentDoc, nsINode* aNode)
{
  return aNode->IsElement() &&
    aCurrentDoc->BindingManager()->GetBinding(aNode->AsElement());
}

// CanSkip checks if aNode is black, and if it is, returns
// true. If aNode is in a black DOM tree, CanSkip may also remove other objects
// from purple buffer and unmark event listeners and user data.
@@ -4780,10 +4787,12 @@ nsGenericElement::CanSkip(nsINode* aNode, bool aRemovingAllowed)
  nsIDocument* currentDoc = aNode->GetCurrentDoc();
  if (currentDoc &&
      nsCCUncollectableMarker::InGeneration(currentDoc->GetMarkedCCGeneration()) &&
      (!unoptimizable || NodeHasActiveFrame(currentDoc, aNode))) {
      (!unoptimizable || NodeHasActiveFrame(currentDoc, aNode) ||
       OwnedByBindingManager(currentDoc, aNode))) {
    MarkNodeChildren(aNode);
    return true;
  }

  if (unoptimizable) {
    return false;
  }