From b5969880ad0ebf3f088d08e26db00a000df4ff4f Mon Sep 17 00:00:00 2001 From: "jst%mozilla.jstenback.com" Date: Thu, 4 Nov 2004 01:32:40 +0000 Subject: [PATCH] Fixing bug 265055. Prevent textarea.select() in a hidden tab from stealing focus(). r+sr=bryner@brianryner.com git-svn-id: svn://10.0.0.236/trunk@164899 18797224-902f-48f8-a5cc-f745e15eee43 --- .../html/content/src/nsHTMLTextAreaElement.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp b/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp index e5b5298fac0..aa065338011 100644 --- a/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp @@ -286,13 +286,19 @@ nsHTMLTextAreaElement::Select() // If the DOM event was not canceled (e.g. by a JS event handler // returning false) if (status == nsEventStatus_eIgnore) { - presContext->EventStateManager()->SetContentState(this, - NS_EVENT_STATE_FOCUS); + PRBool shouldFocus = ShouldFocus(this); + + if (shouldFocus) { + presContext->EventStateManager()->SetContentState(this, + NS_EVENT_STATE_FOCUS); + } nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_TRUE); if (formControlFrame) { - formControlFrame->SetFocus(PR_TRUE, PR_TRUE); + if (shouldFocus) { + formControlFrame->SetFocus(PR_TRUE, PR_TRUE); + } // Now Select all the text! SelectAll(presContext);