Commit 550ae0a5 authored by Chris H-C's avatar Chris H-C
Browse files

Bug 1249664 - Make stateful frames responsible for their own keys r=dbaron

nsFrameManager::CaptureFrameStateFor generates keys for stateful frames that
only take into account the document and element. This precluded saving pieces
of information coming from different frames responsible for the same element.

MozReview-Commit-ID: 29x3Gj66wAy

--HG--
extra : rebase_source : 9f6fc24ce88009b31dae9fc37bb2187cad8164f2
parent 32877f50
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -553,7 +553,7 @@ nsFrameManager::CaptureFrameStateFor(nsIFrame* aFrame,
  nsAutoCString stateKey;
  nsIContent* content = aFrame->GetContent();
  nsIDocument* doc = content ? content->GetCurrentDoc() : nullptr;
  rv = nsContentUtils::GenerateStateKey(content, doc, stateKey);
  rv = statefulFrame->GenerateStateKey(content, doc, stateKey);
  if(NS_FAILED(rv) || stateKey.IsEmpty()) {
    return;
  }
@@ -616,7 +616,7 @@ nsFrameManager::RestoreFrameStateFor(nsIFrame* aFrame,

  nsAutoCString stateKey;
  nsIDocument* doc = content->GetCurrentDoc();
  nsresult rv = nsContentUtils::GenerateStateKey(content, doc, stateKey);
  nsresult rv = statefulFrame->GenerateStateKey(content, doc, stateKey);
  if (NS_FAILED(rv) || stateKey.IsEmpty()) {
    return;
  }
+8 −0
Original line number Diff line number Diff line
@@ -25,6 +25,14 @@ class nsIStatefulFrame

  // Restore the state for this frame from aState
  NS_IMETHOD RestoreState(nsPresState* aState) = 0;

  // Generate a key for this stateful frame
  NS_IMETHOD GenerateStateKey(nsIContent* aContent,
                              nsIDocument* aDocument,
                              nsACString& aKey)
  {
    return nsContentUtils::GenerateStateKey(aContent, aDocument, aKey);
  };
};

#endif /* _nsIStatefulFrame_h */