diff --git a/mozilla/content/base/src/nsContentSink.cpp b/mozilla/content/base/src/nsContentSink.cpp index 51c0d8ccfa8..2385f00ac37 100644 --- a/mozilla/content/base/src/nsContentSink.cpp +++ b/mozilla/content/base/src/nsContentSink.cpp @@ -1,4 +1,5 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 sw=2 et tw=78: */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * @@ -1404,6 +1405,11 @@ nsContentSink::FavorPerformanceHint(PRBool perfOverStarvation, PRUint32 starvati void nsContentSink::BeginUpdate(nsIDocument *aDocument, nsUpdateType aUpdateType) { + // Remember nested updates from updates that we started. + if (mInNotification && mUpdatesInNotification < 2) { + ++mUpdatesInNotification; + } + // If we're in a script and we didn't do the notification, // something else in the script processing caused the // notification to occur. Since this could result in frame diff --git a/mozilla/content/base/src/nsContentSink.h b/mozilla/content/base/src/nsContentSink.h index 2fb2afb65dc..3d5afd1c438 100644 --- a/mozilla/content/base/src/nsContentSink.h +++ b/mozilla/content/base/src/nsContentSink.h @@ -293,6 +293,7 @@ protected: PRInt32 mInMonolithicContainer; PRInt32 mInNotification; + PRUint32 mUpdatesInNotification; PRUint32 mPendingSheetCount; diff --git a/mozilla/content/html/document/src/nsHTMLContentSink.cpp b/mozilla/content/html/document/src/nsHTMLContentSink.cpp index 39ecd6206e4..57033c85cc0 100644 --- a/mozilla/content/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/content/html/document/src/nsHTMLContentSink.cpp @@ -1346,8 +1346,10 @@ nsresult SinkContext::FlushTags() { PRBool oldBeganUpdate = mSink->mBeganUpdate; + PRUint32 oldUpdates = mSink->mUpdatesInNotification; ++(mSink->mInNotification); + mSink->mUpdatesInNotification = 0; { // Scope so we call EndUpdate before we decrease mInNotification mozAutoDocUpdate updateBatch(mSink->mDocument, UPDATE_CONTENT_MODEL, @@ -1406,6 +1408,11 @@ SinkContext::FlushTags() } --(mSink->mInNotification); + if (mSink->mUpdatesInNotification > 1) { + UpdateChildCounts(); + } + + mSink->mUpdatesInNotification = oldUpdates; mSink->mBeganUpdate = oldBeganUpdate; return NS_OK; diff --git a/mozilla/content/xml/document/src/nsXMLContentSink.cpp b/mozilla/content/xml/document/src/nsXMLContentSink.cpp index 0a06802710d..d08dbaf07c9 100644 --- a/mozilla/content/xml/document/src/nsXMLContentSink.cpp +++ b/mozilla/content/xml/document/src/nsXMLContentSink.cpp @@ -1534,7 +1534,9 @@ nsresult nsXMLContentSink::FlushTags() { PRBool oldBeganUpdate = mBeganUpdate; + PRUint32 oldUpdates = mUpdatesInNotification; + mUpdatesInNotification = 0; ++mInNotification; { // Scope so we call EndUpdate before we decrease mInNotification @@ -1569,6 +1571,11 @@ nsXMLContentSink::FlushTags() } --mInNotification; + if (mUpdatesInNotification > 1) { + UpdateChildCounts(); + } + + mUpdatesInNotification = oldUpdates; mBeganUpdate = oldBeganUpdate; return NS_OK;