Bug 906979 - Make it possible again to force spell checking on text controls with spellcheck=false; r=roc

This commit is contained in:
Ehsan Akhgari 2013-08-22 17:49:11 -04:00
Родитель 3005147418
Коммит cb751a0c38
1 изменённых файлов: 16 добавлений и 0 удалений

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

@ -65,6 +65,7 @@
#include "nsEditor.h"
#include "mozilla/Services.h"
#include "nsIObserverService.h"
#include "nsITextControlElement.h"
using namespace mozilla::dom;
@ -1268,6 +1269,21 @@ mozInlineSpellChecker::SkipSpellCheckForNode(nsIEditor* aEditor,
return NS_OK;
}
// Make sure that we can always turn on spell checking for inputs/textareas.
// Note that because of the previous check, at this point we know that the
// node is editable.
if (content->IsInAnonymousSubtree()) {
nsCOMPtr<nsIContent> node = content->GetParent();
while (node && node->IsInNativeAnonymousSubtree()) {
node = node->GetParent();
}
nsCOMPtr<nsITextControlElement> textControl = do_QueryInterface(node);
if (textControl) {
*checkSpelling = true;
return NS_OK;
}
}
// Get HTML element ancestor (might be aNode itself, although probably that
// has to be a text node in real life here)
nsCOMPtr<nsIDOMHTMLElement> htmlElement = do_QueryInterface(content);