Bug 569397 - Eagerly initialize the input controls with spellcheck="true"; r=roc ui-r=faaborg approval2.0=benjamin

This commit is contained in:
Ehsan Akhgari 2010-06-02 22:39:29 -04:00
Родитель 3abf2243f2
Коммит 48b4d58926
4 изменённых файлов: 30 добавлений и 2 удалений

Просмотреть файл

@ -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<nsIContent*>& 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<nsIDOMNSHTMLElement> 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?");

Просмотреть файл

@ -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

Просмотреть файл

@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<body>
<input type="text" value="blahblahblah" spellcheck="true">
</body>
</html>

Просмотреть файл

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<body>
<input type="text" value="blahblahblah" spellcheck="true">
<script>
var i = document.getElementsByTagName("input")[0];
i.focus(); // init the editor
i.blur(); // we actually don't need the focus
</script>
</body>
</html>