diff --git a/mozilla/content/base/src/nsDocument.h b/mozilla/content/base/src/nsDocument.h index 0440c8098bc..235b2606474 100644 --- a/mozilla/content/base/src/nsDocument.h +++ b/mozilla/content/base/src/nsDocument.h @@ -792,6 +792,9 @@ protected: nsString mBaseTarget; + // Our update nesting level + PRUint32 mUpdateNestLevel; + private: friend class nsUnblockOnloadEvent; @@ -833,9 +836,6 @@ private: // Member to store out last-selected stylesheet set. nsString mLastStyleSheetSet; - - // Our update nesting level - PRUint32 mUpdateNestLevel; }; diff --git a/mozilla/content/html/document/src/nsHTMLDocument.cpp b/mozilla/content/html/document/src/nsHTMLDocument.cpp index 5fe09f474f1..f50661161f3 100644 --- a/mozilla/content/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/content/html/document/src/nsHTMLDocument.cpp @@ -3732,6 +3732,16 @@ nsHTMLDocument::GetDesignMode(nsAString & aDesignMode) return NS_OK; } +void +nsHTMLDocument::EndUpdate(nsUpdateType aUpdateType) +{ + nsDocument::EndUpdate(aUpdateType); + + if (mUpdateNestLevel == 0 && EditingShouldBeOn() != IsEditingOn()) { + EditingStateChanged(); + } +} + nsresult nsHTMLDocument::ChangeContentEditableCount(nsIContent *aElement, PRInt32 aChange) @@ -3741,7 +3751,8 @@ nsHTMLDocument::ChangeContentEditableCount(nsIContent *aElement, mContentEditableCount += aChange; - if (mParser) { + if (mParser || + (mUpdateNestLevel > 0 && EditingShouldBeOn() != IsEditingOn())) { return NS_OK; } diff --git a/mozilla/content/html/document/src/nsHTMLDocument.h b/mozilla/content/html/document/src/nsHTMLDocument.h index 0b895a8ef57..7e9606a5289 100644 --- a/mozilla/content/html/document/src/nsHTMLDocument.h +++ b/mozilla/content/html/document/src/nsHTMLDocument.h @@ -212,6 +212,17 @@ public: mDisableCookieAccess = PR_TRUE; } + /** + * Returns whether the document should be editable. This can be different from + * IsEditingOn() (for example if we're delaying turning the editor on/off). + */ + PRBool EditingShouldBeOn() + { + return HasFlag(NODE_IS_EDITABLE) || mContentEditableCount > 0; + } + + void EndUpdate(nsUpdateType aUpdateType); + NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(nsHTMLDocument, nsDocument) protected: