When setting the textfield value via the filepicker, tell it that it's not
focused so that onchange will fire as it should. Bug 355362, r+sr=jst git-svn-id: svn://10.0.0.236/trunk@213672 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
2b9f079df7
commit
4fe7e728a5
@ -318,7 +318,13 @@ nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent)
|
||||
nsAutoString unicodePath;
|
||||
result = localFile->GetPath(unicodePath);
|
||||
if (!unicodePath.IsEmpty()) {
|
||||
// Tell mTextFrame that it doesn't have focus while we're setting the
|
||||
// value. Otherwise it'll think that the value is being set by a script
|
||||
// while it has focus and not fire onchange when it should.
|
||||
PRBool hasFocus = mTextFrame->GetHasFocus();
|
||||
mTextFrame->SetHasFocus(PR_FALSE);
|
||||
mTextFrame->SetFormProperty(nsHTMLAtoms::value, unicodePath);
|
||||
mTextFrame->SetHasFocus(hasFocus);
|
||||
nsCOMPtr<nsIFileControlElement> fileControl = do_QueryInterface(mContent);
|
||||
if (fileControl) {
|
||||
fileControl->SetFileName(unicodePath);
|
||||
|
||||
@ -191,6 +191,11 @@ public: //for methods who access nsTextControlFrame directly
|
||||
mHasFocus = aHasFocus;
|
||||
};
|
||||
|
||||
PRBool GetHasFocus() const
|
||||
{
|
||||
return mHasFocus;
|
||||
}
|
||||
|
||||
/* called to free up native keybinding services */
|
||||
static NS_HIDDEN_(void) ShutDown();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user