Merge mozilla-central and mozilla-inbound to prepare for landing of bug 690892

Landing on a CLOSED TREE
This commit is contained in:
Ehsan Akhgari 2011-10-17 10:49:10 -04:00
commit ae1cb1c38e
24 changed files with 212 additions and 165 deletions

View File

@ -883,12 +883,7 @@ nsXULTreeItemAccessibleBase::DoAction(PRUint8 aIndex)
bool
nsXULTreeItemAccessibleBase::IsDefunct() const
{
if (nsAccessibleWrap::IsDefunct() || !mTree || !mTreeView || mRow < 0)
return PR_TRUE;
PRInt32 rowCount = 0;
nsresult rv = mTreeView->GetRowCount(&rowCount);
return NS_FAILED(rv) || mRow >= rowCount;
return nsAccessibleWrap::IsDefunct() || !mTree || !mTreeView || mRow < 0;
}
void

View File

@ -23,16 +23,33 @@ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
const Cc = Components.classes;
const Ci = Components.interfaces;
function openContextMenuFor(element, shiftkey) {
function openContextMenuFor(element, shiftkey, shouldWaitForFocus) {
// Context menu should be closed before we open it again.
is(contextMenu.state, "closed", "checking if popup is closed");
if (lastElement)
lastElement.blur();
element.focus();
lastElement = element;
var eventDetails = { type : "contextmenu", button : 2, shiftKey : shiftkey };
synthesizeMouse(element, 2, 2, eventDetails, element.ownerDocument.defaultView);
//Some elements need time to focus and spellcheck before any tests are
//run on them.
if(shouldWaitForFocus)
{
if (lastElement)
lastElement.blur();
element.focus();
SimpleTest.executeSoon(function() {
lastElement = element;
var eventDetails = { type : "contextmenu", button : 2, shiftKey : shiftkey };
synthesizeMouse(element, 2, 2, eventDetails, element.ownerDocument.defaultView);
});
}
else
{
if (lastElement)
lastElement.blur();
element.focus();
lastElement = element;
var eventDetails = { type : "contextmenu", button : 2, shiftKey : shiftkey };
synthesizeMouse(element, 2, 2, eventDetails, element.ownerDocument.defaultView);
}
}
function closeContextMenu() {
@ -421,7 +438,7 @@ function runTest(testNum) {
"---", null,
"context-inspect", true]);
closeContextMenu();
openContextMenuFor(textarea); // Invoke context menu for next test.
openContextMenuFor(textarea, false, true); // Invoke context menu for next test, but wait for the spellcheck.
break;
case 12:

View File

@ -1163,6 +1163,10 @@ nsTextEditorState::PrepareEditor(const nsAString *aValue)
// Use async reflow and painting for text widgets to improve
// performance.
editorFlags |= nsIPlaintextEditor::eEditorUseAsyncUpdatesMask;
// Spell check is diabled at creation time. It is enabled once
// the editor comes into focus.
editorFlags |= nsIPlaintextEditor::eEditorSkipSpellCheck;
bool shouldInitializeEditor = false;
nsCOMPtr<nsIEditor> newEditor; // the editor that we might create

View File

@ -201,6 +201,9 @@ PluginInstanceChild::~PluginInstanceChild()
if (mCGLayer) {
PluginUtilsOSX::ReleaseCGLayer(mCGLayer);
}
if (mDrawingModel == NPDrawingModelCoreAnimation) {
UnscheduleTimer(mCARefreshTimer);
}
#endif
}
@ -460,6 +463,22 @@ PluginInstanceChild::NPN_GetValue(NPNVariable aVar,
}
#ifdef MOZ_WIDGET_COCOA
#define DEFAULT_REFRESH_MS 20 // CoreAnimation: 50 FPS
void
CAUpdate(NPP npp, uint32_t timerID) {
static_cast<PluginInstanceChild*>(npp->ndata)->Invalidate();
}
void
PluginInstanceChild::Invalidate()
{
NPRect windowRect = {0, 0, mWindow.height, mWindow.width};
InvalidateRect(&windowRect);
}
#endif
NPError
PluginInstanceChild::NPN_SetValue(NPPVariable aVar, void* aValue)
@ -507,6 +526,10 @@ PluginInstanceChild::NPN_SetValue(NPPVariable aVar, void* aValue)
return NPERR_GENERIC_ERROR;
mDrawingModel = drawingModel;
if (drawingModel == NPDrawingModelCoreAnimation) {
mCARefreshTimer = ScheduleTimer(DEFAULT_REFRESH_MS, true, CAUpdate);
}
PLUGIN_LOG_DEBUG((" Plugin requested drawing model id #%i\n",
mDrawingModel));

View File

@ -236,6 +236,10 @@ public:
void InvalidateRect(NPRect* aInvalidRect);
#ifdef MOZ_WIDGET_COCOA
void Invalidate();
#endif // definied(MOZ_WIDGET_COCOA)
uint32_t ScheduleTimer(uint32_t interval, bool repeat, TimerFunc func);
void UnscheduleTimer(uint32_t id);
@ -426,6 +430,9 @@ private:
nsCARenderer mCARenderer;
void *mCGLayer;
// Core Animation drawing model requires a refresh timer.
uint32_t mCARefreshTimer;
public:
const NPCocoaEvent* getCurrentEvent() {
return mCurrentEvent;

View File

@ -96,7 +96,6 @@ PluginInstanceParent::PluginInstanceParent(PluginModuleParent* parent,
, mPluginWndProc(NULL)
, mNestedEventState(false)
#endif // defined(XP_WIN)
, mQuirks(0)
#if defined(XP_MACOSX)
, mShWidth(0)
, mShHeight(0)
@ -104,20 +103,6 @@ PluginInstanceParent::PluginInstanceParent(PluginModuleParent* parent,
, mDrawingModel(NPDrawingModelCoreGraphics)
#endif
{
InitQuirksModes(aMimeType);
}
void
PluginInstanceParent::InitQuirksModes(const nsCString& aMimeType)
{
#ifdef MOZ_WIDGET_COCOA
NS_NAMED_LITERAL_CSTRING(flash, "application/x-shockwave-flash");
// Flash sends us Invalidate events so we will use those
// instead of the refresh timer.
if (!FindInReadable(flash, aMimeType)) {
mQuirks |= COREANIMATION_REFRESH_TIMER;
}
#endif
}
PluginInstanceParent::~PluginInstanceParent()
@ -135,9 +120,6 @@ PluginInstanceParent::~PluginInstanceParent()
}
if (mShColorSpace)
::CGColorSpaceRelease(mShColorSpace);
if (mDrawingModel == NPDrawingModelCoreAnimation) {
mParent->RemoveFromRefreshTimer(this);
}
#endif
}
@ -394,10 +376,6 @@ PluginInstanceParent::AnswerNPN_SetValue_NPPVpluginDrawingModel(
mDrawingModel = drawingModel;
*result = mNPNIface->setvalue(mNPP, NPPVpluginDrawingModel,
(void*)NPDrawingModelCoreGraphics);
if (drawingModel == NPDrawingModelCoreAnimation &&
mQuirks & COREANIMATION_REFRESH_TIMER) {
mParent->AddToRefreshTimer(this);
}
} else {
mDrawingModel = drawingModel;
*result = mNPNIface->setvalue(mNPP, NPPVpluginDrawingModel,
@ -1863,12 +1841,3 @@ PluginInstanceParent::AnswerPluginFocusChange(const bool& gotFocus)
return false;
#endif
}
#ifdef MOZ_WIDGET_COCOA
void
PluginInstanceParent::Invalidate()
{
NPRect windowRect = {0, 0, mShHeight, mShWidth};
RecvNPN_InvalidateRect(windowRect);
}
#endif

View File

@ -279,10 +279,6 @@ public:
virtual bool
AnswerPluginFocusChange(const bool& gotFocus);
#ifdef MOZ_WIDGET_COCOA
void Invalidate();
#endif // definied(MOZ_WIDGET_COCOA)
nsresult AsyncSetWindow(NPWindow* window);
nsresult GetImage(mozilla::layers::ImageContainer* aContainer, mozilla::layers::Image** aImage);
nsresult GetImageSize(nsIntSize* aSize);
@ -313,16 +309,6 @@ private:
virtual bool
DeallocPPluginBackgroundDestroyer(PPluginBackgroundDestroyerParent* aActor);
// Quirks mode support for various plugin mime types
enum PluginQuirks {
// OSX: Don't use the refresh timer for plug-ins
// using this quirk. These plug-in most have another
// way to refresh the window.
COREANIMATION_REFRESH_TIMER = 1,
};
void InitQuirksModes(const nsCString& aMimeType);
bool InternalGetValueForNPObject(NPNVariable aVariable,
PPluginScriptableObjectParent** aValue,
NPError* aResult);
@ -332,7 +318,6 @@ private:
NPP mNPP;
const NPNetscapeFuncs* mNPNIface;
NPWindowType mWindowType;
int mQuirks;
nsDataHashtable<nsVoidPtrHashKey, PluginScriptableObjectParent*> mScriptableObjects;

View File

@ -146,12 +146,6 @@ PluginModuleParent::~PluginModuleParent()
{
NS_ASSERTION(OkToCleanup(), "unsafe destruction");
#ifdef OS_MACOSX
if (mCATimer) {
mCATimer->Cancel();
}
#endif
if (!mShutdown) {
NS_WARNING("Plugin host deleted the module without shutting down.");
NPError err;
@ -1171,52 +1165,6 @@ PluginModuleParent::RecvGetNativeCursorsSupported(bool* supported)
#endif
}
#ifdef OS_MACOSX
#define DEFAULT_REFRESH_MS 20 // CoreAnimation: 50 FPS
void
CAUpdate(nsITimer *aTimer, void *aClosure) {
nsTObserverArray<PluginInstanceParent*> *ips =
static_cast<nsTObserverArray<PluginInstanceParent*> *>(aClosure);
nsTObserverArray<PluginInstanceParent*>::ForwardIterator iter(*ips);
#ifdef MOZ_WIDGET_COCOA
while (iter.HasMore()) {
iter.GetNext()->Invalidate();
}
#endif // MOZ_WIDGET_COCOA
}
void
PluginModuleParent::AddToRefreshTimer(PluginInstanceParent *aInstance) {
if (mCATimerTargets.Contains(aInstance)) {
return;
}
mCATimerTargets.AppendElement(aInstance);
if (mCATimerTargets.Length() == 1) {
if (!mCATimer) {
nsresult rv;
nsCOMPtr<nsITimer> xpcomTimer = do_CreateInstance(NS_TIMER_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
NS_WARNING("Could not create Core Animation timer for plugin.");
return;
}
mCATimer = xpcomTimer;
}
mCATimer->InitWithFuncCallback(CAUpdate, &mCATimerTargets, DEFAULT_REFRESH_MS,
nsITimer::TYPE_REPEATING_SLACK);
}
}
void
PluginModuleParent::RemoveFromRefreshTimer(PluginInstanceParent *aInstance) {
bool visibleRemoved = mCATimerTargets.RemoveElement(aInstance);
if (visibleRemoved && mCATimerTargets.IsEmpty()) {
mCATimer->Cancel();
}
}
#endif
bool
PluginModuleParent::RecvNPN_SetException(PPluginScriptableObjectParent* aActor,
const nsCString& aMessage)

View File

@ -61,8 +61,6 @@
#include "nsDataHashtable.h"
#include "nsHashKeys.h"
#include "nsIFileStreams.h"
#include "nsTObserverArray.h"
#include "nsITimer.h"
namespace mozilla {
namespace dom {
@ -155,11 +153,6 @@ public:
void ProcessRemoteNativeEventsInRPCCall();
#ifdef OS_MACOSX
void AddToRefreshTimer(PluginInstanceParent *aInstance);
void RemoveFromRefreshTimer(PluginInstanceParent *aInstance);
#endif
protected:
NS_OVERRIDE
virtual mozilla::ipc::RPCChannel::RacyRPCPolicy
@ -335,11 +328,6 @@ private:
nsString mBrowserDumpID;
nsString mHangID;
#ifdef OS_MACOSX
nsCOMPtr<nsITimer> mCATimer;
nsTObserverArray<PluginInstanceParent*> mCATimerTargets;
#endif
#ifdef MOZ_X11
// Dup of plugin's X socket, used to scope its resources to this
// object instead of the plugin process's lifetime

View File

@ -12,7 +12,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338427
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=338427">Mozilla Bug 338427</a>
<p id="display"></p>
<div id="content">
<textarea id="editor" lang="testing-XX"></textarea>
<textarea id="editor" lang="testing-XX" spellcheck="true"></textarea>
</div>
<pre id="test">

View File

@ -77,6 +77,8 @@ interface nsIPlaintextEditor : nsISupports
const long eEditorRightToLeft = 0x2000;
// when this flag is set, the internal direction of the editor is LTR.
const long eEditorLeftToRight = 0x4000;
// when this flag is set, the editor's text content is not spell checked.
const long eEditorSkipSpellCheck = 0x8000;
/*
* The valid values for newlines handling.

View File

@ -396,8 +396,8 @@ protected:
bool CanEnableSpellCheck()
{
// Check for password/readonly/disabled, which are not spellchecked
// regardless of DOM
return !IsPasswordEditor() && !IsReadonly() && !IsDisabled();
// regardless of DOM. Also, check to see if spell check should be skipped or not.
return !IsPasswordEditor() && !IsReadonly() && !IsDisabled() && !ShouldSkipSpellCheck();
}
public:
@ -695,6 +695,11 @@ public:
{
return (mFlags & nsIPlaintextEditor::eEditorDontEchoPassword) != 0;
}
PRBool ShouldSkipSpellCheck() const
{
return (mFlags & nsIPlaintextEditor::eEditorSkipSpellCheck) != 0;
}
bool IsTabbable() const
{

View File

@ -905,6 +905,17 @@ nsEditorEventListener::Focus(nsIDOMEvent* aEvent)
if (mEditor->IsDisabled()) {
return NS_OK;
}
// If the spell check skip flag is still enabled from creation time,
// disable it because focused editors are allowed to spell check.
PRUint32 currentFlags = 0;
mEditor->GetFlags(&currentFlags);
if(currentFlags & nsIPlaintextEditor::eEditorSkipSpellCheck)
{
currentFlags ^= nsIPlaintextEditor::eEditorSkipSpellCheck;
mEditor->SetFlags(currentFlags);
}
nsCOMPtr<nsIDOMEventTarget> target;
aEvent->GetTarget(getter_AddRefs(target));

View File

@ -64,47 +64,57 @@ function paste(str) {
getEditor().pasteTransferable(trans);
}
function runTest() {
gMisspeltWords = ["haz", "cheezburger"];
is(isSpellingCheckOk(), true, "All misspellings before editing are accounted for.");
function runOnFocus() {
var edit = document.getElementById("edit");
append(" becaz I'm a lolcat!");
edit.removeEventListener("focus", runOnFocus, false);
SimpleTest.executeSoon(function() {
gMisspeltWords.push("becaz");
gMisspeltWords.push("lolcat");
is(isSpellingCheckOk(), true, "All misspellings after typing are accounted for.");
// Now, type an invalid word, and instead of hitting "space" at the end, just blur
// the textarea and see if the spell check after the blur event catches it.
append(" workd");
edit.blur();
gMisspeltWords = ["haz", "cheezburger"];
is(isSpellingCheckOk(), true, "All misspellings before editing are accounted for.");
append(" becaz I'm a lolcat!");
SimpleTest.executeSoon(function() {
gMisspeltWords.push("workd");
is(isSpellingCheckOk(), true, "All misspellings after blur are accounted for.");
gMisspeltWords.push("becaz");
gMisspeltWords.push("lolcat");
is(isSpellingCheckOk(), true, "All misspellings after typing are accounted for.");
// Also, test the case when we're entering the first word in a textarea
gMisspeltWords = ["workd"];
edit.value = "";
append("workd ");
// Now, type an invalid word, and instead of hitting "space" at the end, just blur
// the textarea and see if the spell check after the blur event catches it.
append(" workd");
edit.blur();
SimpleTest.executeSoon(function() {
is(isSpellingCheckOk(), true, "Misspelling in the first entered word is accounted for.");
gMisspeltWords.push("workd");
is(isSpellingCheckOk(), true, "All misspellings after blur are accounted for.");
// Make sure that pasting would also trigger spell checking for the previous word
// Also, test the case when we're entering the first word in a textarea
gMisspeltWords = ["workd"];
edit.value = "";
append("workd");
paste(" x");
append("workd ");
SimpleTest.executeSoon(function() {
is(isSpellingCheckOk(), true, "Misspelling is accounted for after pasting.");
is(isSpellingCheckOk(), true, "Misspelling in the first entered word is accounted for.");
SimpleTest.finish();
// Make sure that pasting would also trigger spell checking for the previous word
gMisspeltWords = ["workd"];
edit.value = "";
append("workd");
paste(" x");
SimpleTest.executeSoon(function() {
is(isSpellingCheckOk(), true, "Misspelling is accounted for after pasting.");
SimpleTest.finish();
});
});
});
});
});
}
function runTest()
{
var edit = document.getElementById("edit");
edit.addEventListener("focus", runOnFocus, false);
edit.focus();
}
function isSpellingCheckOk() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");

View File

@ -30,16 +30,20 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=636465
SimpleTest.waitForExplicitFinish();
function runTest() {
var x = document.getElementById("x");
x.focus();
setTimeout(function(){
x.blur();
setTimeout(function(){
var x = document.getElementById("x");
var spellCheckTrue = snapshotWindow(window);
x.setAttribute("spellcheck", "false");
setTimeout(function(){
setTimeout(function(){
var spellCheckFalse = snapshotWindow(window);
x.setAttribute("spellcheck", "true");
x.focus();
setTimeout(function(){
x.blur();
setTimeout(function(){
var spellCheckTrueAgain = snapshotWindow(window);
x.removeAttribute("spellcheck");

View File

@ -210,8 +210,10 @@
#endif
#ifdef _MSC_VER
#ifndef __cplusplus
#undef inline
#define inline __inline
#endif
/* there are currently linkage problems that arise when trying to include intrin.h in c++:
* D:\sdks\v7.0\include\winnt.h(3674) : error C2733: second C linkage of overloaded function '_interlockedbittestandset' not allowed

View File

@ -0,0 +1,24 @@
diff --git a/gfx/cairo/cairo/src/cairo-compiler-private.h b/gfx/cairo/cairo/src/cairo-compiler-private.h
--- a/gfx/cairo/cairo/src/cairo-compiler-private.h
+++ b/gfx/cairo/cairo/src/cairo-compiler-private.h
@@ -205,18 +205,20 @@
#if (defined(__WIN32__) && !defined(__WINE__)) || defined(_MSC_VER)
#define snprintf _snprintf
#define popen _popen
#define pclose _pclose
#define hypot _hypot
#endif
#ifdef _MSC_VER
+#ifndef __cplusplus
#undef inline
#define inline __inline
+#endif
/* there are currently linkage problems that arise when trying to include intrin.h in c++:
* D:\sdks\v7.0\include\winnt.h(3674) : error C2733: second C linkage of overloaded function '_interlockedbittestandset' not allowed
* so avoid defining ffs in c++ code for now */
#ifndef __cplusplus
/* Add a definition of ffs */
#include <intrin.h>
#pragma intrinsic(_BitScanForward)

View File

@ -7608,6 +7608,11 @@ nsresult nsTextFrame::GetRenderedText(nsAString* aAppendToString,
textFrame = static_cast<nsTextFrame*>(textFrame->GetNextContinuation())) {
// For each text frame continuation in this block ...
if (textFrame->GetStateBits() & NS_FRAME_IS_DIRTY) {
// We don't trust dirty frames, expecially when computing rendered text.
break;
}
// Ensure the text run and grab the gfxSkipCharsIterator for it
gfxSkipCharsIterator iter = textFrame->EnsureTextRun();
if (!textFrame->mTextRun)

View File

@ -18,18 +18,32 @@ needs-focus == passwd-4.html passwd-ref.html
== emptypasswd-2.html emptypasswd-ref.html
== caret_on_positioned.html caret_on_positioned-ref.html
fails-if(Android) != spellcheck-input-disabled.html spellcheck-input-ref.html
== spellcheck-input-attr-before.html spellcheck-input-ref.html
== spellcheck-input-attr-after.html spellcheck-input-ref.html
== spellcheck-input-attr-inherit.html spellcheck-input-ref.html
== spellcheck-input-attr-dynamic.html spellcheck-input-ref.html
== spellcheck-input-attr-dynamic-inherit.html spellcheck-input-ref.html
== spellcheck-input-property-dynamic.html spellcheck-input-ref.html
== spellcheck-input-property-dynamic-inherit.html spellcheck-input-ref.html
== spellcheck-input-attr-dynamic-override.html spellcheck-input-ref.html
== spellcheck-input-attr-dynamic-override-inherit.html spellcheck-input-ref.html
== spellcheck-input-property-dynamic-override.html spellcheck-input-ref.html
== spellcheck-input-property-dynamic-override-inherit.html spellcheck-input-ref.html
== spellcheck-textarea-attr.html spellcheck-textarea-ref.html
== spellcheck-input-attr-before.html spellcheck-input-nofocus-ref.html
!= spellcheck-input-attr-before.html spellcheck-input-ref.html
== spellcheck-input-attr-after.html spellcheck-input-nofocus-ref.html
!= spellcheck-input-attr-after.html spellcheck-input-ref.html
== spellcheck-input-attr-inherit.html spellcheck-input-nofocus-ref.html
!= spellcheck-input-attr-inherit.html spellcheck-input-ref.html
== spellcheck-input-attr-dynamic.html spellcheck-input-nofocus-ref.html
!= spellcheck-input-attr-dynamic.html spellcheck-input-ref.html
== spellcheck-input-attr-dynamic-inherit.html spellcheck-input-nofocus-ref.html
!= spellcheck-input-attr-dynamic-inherit.html spellcheck-input-ref.html
== spellcheck-input-property-dynamic.html spellcheck-input-nofocus-ref.html
!= spellcheck-input-property-dynamic.html spellcheck-input-ref.html
== spellcheck-input-property-dynamic-inherit.html spellcheck-input-nofocus-ref.html
!= spellcheck-input-property-dynamic-inherit.html spellcheck-input-ref.html
== spellcheck-input-attr-dynamic-override.html spellcheck-input-nofocus-ref.html
!= spellcheck-input-attr-dynamic-override.html spellcheck-input-ref.html
== spellcheck-input-attr-dynamic-override-inherit.html spellcheck-input-nofocus-ref.html
!= spellcheck-input-attr-dynamic-override-inherit.html spellcheck-input-ref.html
== spellcheck-input-property-dynamic-override.html spellcheck-input-nofocus-ref.html
!= spellcheck-input-property-dynamic-override.html spellcheck-input-ref.html
== spellcheck-input-property-dynamic-override-inherit.html spellcheck-input-nofocus-ref.html
!= spellcheck-input-property-dynamic-override-inherit.html spellcheck-input-ref.html
== spellcheck-textarea-attr.html spellcheck-textarea-nofocus-ref.html
!= spellcheck-textarea-attr.html spellcheck-textarea-ref.html
== spellcheck-textarea-focused.html spellcheck-textarea-ref.html
!= spellcheck-textarea-nofocus.html spellcheck-textarea-ref.html
fails-if(Android) != spellcheck-textarea-disabled.html spellcheck-textarea-ref.html
fails-if(Android) != spellcheck-textarea-attr-inherit.html spellcheck-textarea-ref.html
fails-if(Android) != spellcheck-textarea-attr-dynamic.html spellcheck-textarea-ref.html

View File

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

View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<body>
<textarea id="testBox">blahblahblah</textarea>
<script type="text/javascript">
//Adding focus to the textbox should trigger a spellcheck
document.getElementById("testBox").focus();
</script>
</body>
</html>

View File

@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<body>
<textarea spellcheck="true">blahblahblah</textarea>
</body>
</html>

View File

@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<body>
<textarea>blahblahblah</textarea>
</body>
</html>

View File

@ -2,5 +2,9 @@
<html>
<body>
<textarea spellcheck="true">blahblahblah</textarea>
<script type="text/javascript">
var box = document.getElementsByTagName("textarea")[0];
box.focus(); //Bring the textbox into focus, triggering a spellcheck
</script>
</body>
</html>