Create a mozAutoDocUpdate class to handle automatically calling

BeginUpdate/EndUpdate on documents.  Use this in a bunch of places to make sure
that EndUpdate is called in the face of early returns.  Bug 131775, also fixes
bug 211022, r=caillon, sr=jst
This commit is contained in:
bzbarsky@mit.edu
2003-10-16 18:14:25 +00:00
parent 251668a66c
commit 88358c59ac
14 changed files with 325 additions and 427 deletions

View File

@@ -284,9 +284,9 @@ nsHTMLFramesetFrame::Observe(nsISupports* aObject, const char* aAction,
{
nsAutoString prefName(aPrefName);
if (prefName.Equals(NS_LITERAL_STRING(kFrameResizePref))) {
nsCOMPtr<nsIDocument> doc = mContent->GetDocument();
nsIDocument* doc = mContent->GetDocument();
mozAutoDocUpdate updateBatch(doc, UPDATE_CONTENT_MODEL, PR_TRUE);
if (doc) {
doc->BeginUpdate(UPDATE_CONTENT_MODEL);
doc->AttributeWillChange(mContent,
kNameSpaceID_None,
nsHTMLAtoms::frameborder);
@@ -301,7 +301,6 @@ nsHTMLFramesetFrame::Observe(nsISupports* aObject, const char* aAction,
kNameSpaceID_None,
nsHTMLAtoms::frameborder,
nsIDOMMutationEvent::MODIFICATION);
doc->EndUpdate(UPDATE_CONTENT_MODEL);
}
}
return NS_OK;