зеркало из https://github.com/mozilla/gecko-dev.git
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
This commit is contained in:
Родитель
c9c3c05646
Коммит
618c586548
|
@ -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();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче