diff --git a/layout/forms/nsTextControlFrame.cpp b/layout/forms/nsTextControlFrame.cpp index bfa134d104d0..c1a3ddd41ee9 100644 --- a/layout/forms/nsTextControlFrame.cpp +++ b/layout/forms/nsTextControlFrame.cpp @@ -119,6 +119,7 @@ #include "nsFocusManager.h" #include "nsTextEditRules.h" #include "nsIFontMetrics.h" +#include "nsIDOMNSHTMLElement.h" #include "mozilla/FunctionTimer.h" @@ -443,8 +444,17 @@ nsTextControlFrame::CreateAnonymousContent(nsTArray& aElements) rv = UpdateValueDisplay(PR_FALSE); NS_ENSURE_SUCCESS(rv, rv); - if (!IsSingleLineTextControl()) { - // textareas are eagerly initialized + // textareas are eagerly initialized + PRBool initEagerly = !IsSingleLineTextControl(); + if (!initEagerly) { + nsCOMPtr element = do_QueryInterface(txtCtrl); + if (element) { + // so are input text controls with spellcheck=true + element->GetSpellcheck(&initEagerly); + } + } + + if (initEagerly) { NS_ASSERTION(!nsContentUtils::IsSafeToRunScript(), "Someone forgot a script blocker?"); diff --git a/layout/reftests/editor/reftest.list b/layout/reftests/editor/reftest.list index 8e924e41e1be..8a65c717a1f2 100644 --- a/layout/reftests/editor/reftest.list +++ b/layout/reftests/editor/reftest.list @@ -17,3 +17,4 @@ include xul/reftest.list == emptypasswd-1.html emptypasswd-ref.html == emptypasswd-2.html emptypasswd-ref.html == caret_on_positioned.html caret_on_positioned-ref.html +== spellcheck-1.html spellcheck-ref.html diff --git a/layout/reftests/editor/spellcheck-1.html b/layout/reftests/editor/spellcheck-1.html new file mode 100644 index 000000000000..1e878b5d151f --- /dev/null +++ b/layout/reftests/editor/spellcheck-1.html @@ -0,0 +1,6 @@ + + + + + + diff --git a/layout/reftests/editor/spellcheck-ref.html b/layout/reftests/editor/spellcheck-ref.html new file mode 100644 index 000000000000..8dde5e6f1a74 --- /dev/null +++ b/layout/reftests/editor/spellcheck-ref.html @@ -0,0 +1,11 @@ + + + + + + +