mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 02:14:43 +00:00
Bug 1333990: Part 2b - Don't enable editor until layout has started. r=ehsan
In order to support asynchronous loading of extension content scripts, we need to be able to exit the HTML parser flush loop immediately after inserting the document element. Normally this doesn't cause problems, but when we enter edit mode with an empty element selected, the editor inserts a <br> node, and a <br> node at the start of the <html> element causes issues. These changes solve that issue by putting off entering editor mode until we begin laying out the document. MozReview-Commit-ID: H2ksNz0jRxs --HG-- extra : rebase_source : 26e0d254744363f5bd60f3b4f4df7b51c3dc446f
This commit is contained in:
parent
45b222c3b2
commit
9e1cbea297
@ -40,7 +40,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=386782
|
||||
var gTestNum = -1;
|
||||
var gTest = null;
|
||||
|
||||
window.onload = goNext();
|
||||
window.onload = goNext;
|
||||
|
||||
function goNext() {
|
||||
gTestNum++;
|
||||
|
@ -1977,7 +1977,7 @@ public:
|
||||
return mMayStartLayout;
|
||||
}
|
||||
|
||||
void SetMayStartLayout(bool aMayStartLayout)
|
||||
virtual void SetMayStartLayout(bool aMayStartLayout)
|
||||
{
|
||||
mMayStartLayout = aMayStartLayout;
|
||||
}
|
||||
|
@ -2411,7 +2411,7 @@ nsHTMLDocument::GetDesignMode(nsAString& aDesignMode)
|
||||
void
|
||||
nsHTMLDocument::MaybeEditingStateChanged()
|
||||
{
|
||||
if (!mPendingMaybeEditingStateChanged &&
|
||||
if (!mPendingMaybeEditingStateChanged && mMayStartLayout &&
|
||||
mUpdateNestLevel == 0 && (mContentEditableCount > 0) != IsEditingOn()) {
|
||||
if (nsContentUtils::IsSafeToRunScript()) {
|
||||
EditingStateChanged();
|
||||
@ -2434,6 +2434,15 @@ nsHTMLDocument::EndUpdate(nsUpdateType aUpdateType)
|
||||
MaybeEditingStateChanged();
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLDocument::SetMayStartLayout(bool aMayStartLayout)
|
||||
{
|
||||
nsIDocument::SetMayStartLayout(aMayStartLayout);
|
||||
|
||||
MaybeEditingStateChanged();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Helper class, used below in ChangeContentEditableCount().
|
||||
class DeferredContentEditableCountChangeEvent : public Runnable
|
||||
|
@ -144,6 +144,8 @@ public:
|
||||
|
||||
void EndUpdate(nsUpdateType aUpdateType) override;
|
||||
|
||||
virtual void SetMayStartLayout(bool aMayStartLayout) override;
|
||||
|
||||
virtual nsresult SetEditingState(EditingState aState) override;
|
||||
|
||||
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
|
||||
|
Loading…
Reference in New Issue
Block a user