Bug 1461299: Ensure the editor root node is marked as NAC even if BindToFrame fails. r=smaug

We do the following:

  CreateRootNode();
  nsresult rv = BindToFrame(this);
  NS_ENSURE_SUCCESS(rv, rv);
  aElements.AppendElement(mRootNode);

That means that if BindToFrame fails, mRootNode will never be appended to
aElements, and thus will never get the native anonymous bits in [1].

BindToFrame should assert, but it indeed can fail due to it being bound to a
different frame in print preview, because nsCSSFrameConstructor's
ReplicateFixedFrames is a massive hack. :(

Just ensure the NAC bit is properly set for now...

[1]: https://searchfox.org/mozilla-central/rev/a85db9e29eb3f022dbaf8b9a6390ecbacf51e7dd/layout/base/nsCSSFrameConstructor.cpp#4193

MozReview-Commit-ID: 6sE8iUk4PCG
This commit is contained in:
Emilio Cobos Álvarez 2018-05-14 17:52:09 +02:00
parent eecbbcc8a7
commit f4898626f9

View File

@ -451,6 +451,7 @@ nsTextControlFrame::CreateRootNode()
MOZ_ASSERT(!mRootNode);
mRootNode = CreateEmptyDiv(*this);
mRootNode->SetIsNativeAnonymousRoot();
mMutationObserver = new nsAnonDivObserver(*this);
mRootNode->AddMutationObserver(mMutationObserver);