2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 18:30:37 +04:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1998-09-23 21:16:51 +04:00
|
|
|
*
|
2004-04-18 18:30:37 +04:00
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
1998-09-23 21:16:51 +04:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1998-09-23 21:16:51 +04:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-18 18:30:37 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-29 00:14:13 +04:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 06:40:37 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Contributor(s):
|
2007-02-24 07:42:53 +03:00
|
|
|
* Mats Palmgren <mats.palmgren@bredband.net>
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-18 18:30:37 +04:00
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
2001-09-29 00:14:13 +04:00
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
2004-04-18 18:30:37 +04:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-29 00:14:13 +04:00
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
2004-04-18 18:30:37 +04:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1998-09-23 21:16:51 +04:00
|
|
|
|
|
|
|
#include "nsFileControlFrame.h"
|
2000-05-02 07:40:44 +04:00
|
|
|
|
1998-09-23 21:16:51 +04:00
|
|
|
#include "nsIContent.h"
|
|
|
|
#include "prtypes.h"
|
|
|
|
#include "nsIAtom.h"
|
2004-08-01 03:15:21 +04:00
|
|
|
#include "nsPresContext.h"
|
2006-12-26 20:47:52 +03:00
|
|
|
#include "nsGkAtoms.h"
|
1998-09-23 21:16:51 +04:00
|
|
|
#include "nsWidgetsCID.h"
|
1999-03-09 12:44:27 +03:00
|
|
|
#include "nsIComponentManager.h"
|
1998-09-23 21:16:51 +04:00
|
|
|
#include "nsHTMLParts.h"
|
|
|
|
#include "nsIDOMHTMLInputElement.h"
|
|
|
|
#include "nsIFormControl.h"
|
1998-12-20 04:21:23 +03:00
|
|
|
#include "nsINameSpaceManager.h"
|
1999-02-18 03:13:39 +03:00
|
|
|
#include "nsCOMPtr.h"
|
1999-07-01 02:17:43 +04:00
|
|
|
#include "nsIDOMElement.h"
|
|
|
|
#include "nsIDOMDocument.h"
|
2000-12-30 22:22:22 +03:00
|
|
|
#include "nsIDocument.h"
|
1999-07-01 02:17:43 +04:00
|
|
|
#include "nsIDOMMouseListener.h"
|
1999-08-21 04:09:24 +04:00
|
|
|
#include "nsIPresShell.h"
|
1999-09-08 03:20:32 +04:00
|
|
|
#include "nsIDOMHTMLInputElement.h"
|
2002-09-04 03:36:13 +04:00
|
|
|
#include "nsXPCOM.h"
|
1999-09-15 09:31:31 +04:00
|
|
|
#include "nsISupportsPrimitives.h"
|
|
|
|
#include "nsIComponentManager.h"
|
2005-11-29 02:56:44 +03:00
|
|
|
#include "nsPIDOMWindow.h"
|
2000-08-18 22:16:12 +04:00
|
|
|
#include "nsIFilePicker.h"
|
2000-08-25 17:25:50 +04:00
|
|
|
#include "nsIDOMMouseEvent.h"
|
2000-12-30 22:22:22 +03:00
|
|
|
#include "nsINodeInfo.h"
|
2007-05-14 13:11:38 +04:00
|
|
|
#include "nsIDOMEventTarget.h"
|
2002-06-04 04:44:04 +04:00
|
|
|
#include "nsILocalFile.h"
|
2006-04-25 13:18:42 +04:00
|
|
|
#include "nsIFileControlElement.h"
|
2004-06-25 16:26:02 +04:00
|
|
|
#include "nsNodeInfoManager.h"
|
|
|
|
#include "nsContentCreatorFunctions.h"
|
2004-12-17 23:40:48 +03:00
|
|
|
#include "nsContentUtils.h"
|
2006-01-26 05:29:17 +03:00
|
|
|
#include "nsDisplayList.h"
|
2007-09-28 05:09:14 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
|
|
|
#include "nsIAccessibilityService.h"
|
|
|
|
#endif
|
1998-09-23 21:16:51 +04:00
|
|
|
|
2002-06-12 11:58:26 +04:00
|
|
|
#define SYNC_TEXT 0x1
|
|
|
|
#define SYNC_BUTTON 0x2
|
|
|
|
#define SYNC_BOTH 0x3
|
|
|
|
|
2005-11-04 05:38:33 +03:00
|
|
|
nsIFrame*
|
2006-03-27 01:30:36 +04:00
|
|
|
NS_NewFileControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
1998-09-23 21:16:51 +04:00
|
|
|
{
|
2006-03-27 01:30:36 +04:00
|
|
|
return new (aPresShell) nsFileControlFrame(aContext);
|
1998-09-23 21:16:51 +04:00
|
|
|
}
|
|
|
|
|
2006-03-27 01:30:36 +04:00
|
|
|
nsFileControlFrame::nsFileControlFrame(nsStyleContext* aContext):
|
|
|
|
nsAreaFrame(aContext),
|
1999-08-19 18:03:53 +04:00
|
|
|
mTextFrame(nsnull),
|
2006-04-25 13:18:42 +04:00
|
|
|
mCachedState(nsnull)
|
1998-09-23 21:16:51 +04:00
|
|
|
{
|
1999-07-01 02:17:43 +04:00
|
|
|
}
|
|
|
|
|
1999-08-19 18:03:53 +04:00
|
|
|
nsFileControlFrame::~nsFileControlFrame()
|
|
|
|
{
|
1999-09-15 09:31:31 +04:00
|
|
|
if (mCachedState) {
|
|
|
|
delete mCachedState;
|
|
|
|
mCachedState = nsnull;
|
|
|
|
}
|
1999-08-19 18:03:53 +04:00
|
|
|
}
|
|
|
|
|
2006-11-14 01:05:25 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFileControlFrame::Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow)
|
|
|
|
{
|
|
|
|
nsresult rv = nsAreaFrame::Init(aContent, aParent, aPrevInFlow);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
mMouseListener = new MouseListener(this);
|
|
|
|
NS_ENSURE_TRUE(mMouseListener, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2006-04-10 04:16:29 +04:00
|
|
|
void
|
|
|
|
nsFileControlFrame::Destroy()
|
2004-05-22 05:17:00 +04:00
|
|
|
{
|
2004-01-18 07:35:54 +03:00
|
|
|
mTextFrame = nsnull;
|
2006-11-14 01:05:25 +03:00
|
|
|
// remove mMouseListener as a mouse event listener (bug 40533, bug 355931)
|
|
|
|
if (mBrowse) {
|
2007-05-14 13:11:38 +04:00
|
|
|
mBrowse->RemoveEventListenerByIID(mMouseListener,
|
2006-11-14 01:05:25 +03:00
|
|
|
NS_GET_IID(nsIDOMMouseListener));
|
2007-02-18 20:34:09 +03:00
|
|
|
nsContentUtils::DestroyAnonymousContent(&mBrowse);
|
2006-11-14 01:05:25 +03:00
|
|
|
}
|
|
|
|
if (mTextContent) {
|
2007-05-14 13:11:38 +04:00
|
|
|
mTextContent->RemoveEventListenerByIID(mMouseListener,
|
|
|
|
NS_GET_IID(nsIDOMMouseListener));
|
2007-02-18 20:34:09 +03:00
|
|
|
nsContentUtils::DestroyAnonymousContent(&mTextContent);
|
2006-11-14 01:05:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
mMouseListener->ForgetFrame();
|
2006-04-10 04:16:29 +04:00
|
|
|
nsAreaFrame::Destroy();
|
2002-12-20 08:40:37 +03:00
|
|
|
}
|
|
|
|
|
2007-02-18 20:34:09 +03:00
|
|
|
nsresult
|
|
|
|
nsFileControlFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
|
1999-07-01 02:17:43 +04:00
|
|
|
{
|
2002-06-12 11:58:26 +04:00
|
|
|
// Get the NodeInfoManager and tag necessary to create input elements
|
2003-07-29 01:25:13 +04:00
|
|
|
nsCOMPtr<nsIDocument> doc = mContent->GetDocument();
|
2000-05-10 17:13:39 +04:00
|
|
|
|
|
|
|
nsCOMPtr<nsINodeInfo> nodeInfo;
|
2006-12-26 20:47:52 +03:00
|
|
|
doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::input, nsnull,
|
2004-06-25 16:26:02 +04:00
|
|
|
kNameSpaceID_None,
|
|
|
|
getter_AddRefs(nodeInfo));
|
2001-02-20 00:50:04 +03:00
|
|
|
|
2002-06-12 11:58:26 +04:00
|
|
|
// Create the text content
|
2007-02-18 20:34:09 +03:00
|
|
|
NS_NewHTMLElement(getter_AddRefs(mTextContent), nodeInfo);
|
|
|
|
if (!mTextContent)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
mTextContent->SetAttr(kNameSpaceID_None, nsGkAtoms::type,
|
|
|
|
NS_LITERAL_STRING("text"), PR_FALSE);
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMHTMLInputElement> textControl = do_QueryInterface(mTextContent);
|
|
|
|
if (textControl) {
|
|
|
|
nsCOMPtr<nsIFileControlElement> fileControl = do_QueryInterface(mContent);
|
|
|
|
if (fileControl) {
|
|
|
|
// Initialize value when we create the content in case the value was set
|
|
|
|
// before we got here
|
|
|
|
nsAutoString value;
|
|
|
|
fileControl->GetFileName(value);
|
|
|
|
textControl->SetValue(value);
|
1999-08-19 18:03:53 +04:00
|
|
|
}
|
2005-10-01 02:01:54 +04:00
|
|
|
|
2007-02-18 20:34:09 +03:00
|
|
|
textControl->SetTabIndex(-1);
|
|
|
|
textControl->SetReadOnly(PR_TRUE);
|
1999-08-19 18:03:53 +04:00
|
|
|
}
|
1999-07-01 02:17:43 +04:00
|
|
|
|
2007-02-18 20:34:09 +03:00
|
|
|
if (!aElements.AppendElement(mTextContent))
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
1999-07-01 02:17:43 +04:00
|
|
|
|
2007-02-18 20:34:09 +03:00
|
|
|
// register as an event listener of the textbox to open file dialog on mouse click
|
2007-05-14 13:11:38 +04:00
|
|
|
mTextContent->AddEventListenerByIID(mMouseListener,
|
|
|
|
NS_GET_IID(nsIDOMMouseListener));
|
1999-08-19 18:03:53 +04:00
|
|
|
|
2007-02-18 20:34:09 +03:00
|
|
|
// Create the browse button
|
|
|
|
NS_NewHTMLElement(getter_AddRefs(mBrowse), nodeInfo);
|
|
|
|
if (!mBrowse)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
mBrowse->SetAttr(kNameSpaceID_None, nsGkAtoms::type,
|
|
|
|
NS_LITERAL_STRING("button"), PR_FALSE);
|
|
|
|
nsCOMPtr<nsIDOMHTMLInputElement> fileContent = do_QueryInterface(mContent);
|
|
|
|
nsCOMPtr<nsIDOMHTMLInputElement> browseControl = do_QueryInterface(mBrowse);
|
|
|
|
if (fileContent && browseControl) {
|
|
|
|
PRInt32 tabIndex;
|
|
|
|
nsAutoString accessKey;
|
|
|
|
|
|
|
|
fileContent->GetAccessKey(accessKey);
|
|
|
|
browseControl->SetAccessKey(accessKey);
|
|
|
|
fileContent->GetTabIndex(&tabIndex);
|
|
|
|
browseControl->SetTabIndex(tabIndex);
|
1999-08-19 18:03:53 +04:00
|
|
|
}
|
1999-07-01 02:17:43 +04:00
|
|
|
|
2007-02-18 20:34:09 +03:00
|
|
|
if (!aElements.AppendElement(mBrowse))
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
// register as an event listener of the button to open file dialog on mouse click
|
2007-05-14 13:11:38 +04:00
|
|
|
mBrowse->AddEventListenerByIID(mMouseListener,
|
|
|
|
NS_GET_IID(nsIDOMMouseListener));
|
2007-02-18 20:34:09 +03:00
|
|
|
|
2006-12-26 20:47:52 +03:00
|
|
|
SyncAttr(kNameSpaceID_None, nsGkAtoms::size, SYNC_TEXT);
|
|
|
|
SyncAttr(kNameSpaceID_None, nsGkAtoms::disabled, SYNC_BOTH);
|
2000-01-14 02:34:01 +03:00
|
|
|
|
1999-07-01 02:17:43 +04:00
|
|
|
return NS_OK;
|
1998-09-23 21:16:51 +04:00
|
|
|
}
|
|
|
|
|
1999-11-02 04:50:15 +03:00
|
|
|
// Frames are not refcounted, no need to AddRef
|
1999-09-15 09:31:31 +04:00
|
|
|
NS_IMETHODIMP
|
1998-09-23 21:16:51 +04:00
|
|
|
nsFileControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
|
|
|
{
|
2007-07-04 06:15:31 +04:00
|
|
|
NS_PRECONDITION(aInstancePtr, "null out param");
|
|
|
|
|
2007-02-24 07:42:53 +03:00
|
|
|
if (aIID.Equals(NS_GET_IID(nsIAnonymousContentCreator))) {
|
2007-07-08 11:08:04 +04:00
|
|
|
*aInstancePtr = static_cast<nsIAnonymousContentCreator*>(this);
|
1999-09-15 09:31:31 +04:00
|
|
|
return NS_OK;
|
2007-02-24 07:42:53 +03:00
|
|
|
}
|
|
|
|
if (aIID.Equals(NS_GET_IID(nsIFormControlFrame))) {
|
2007-07-08 11:08:04 +04:00
|
|
|
*aInstancePtr = static_cast<nsIFormControlFrame*>(this);
|
1998-09-23 21:16:51 +04:00
|
|
|
return NS_OK;
|
1999-09-15 09:31:31 +04:00
|
|
|
}
|
2007-07-04 06:15:31 +04:00
|
|
|
|
2007-02-24 07:42:53 +03:00
|
|
|
return nsAreaFrame::QueryInterface(aIID, aInstancePtr);
|
1998-09-23 21:16:51 +04:00
|
|
|
}
|
|
|
|
|
1998-10-23 03:00:37 +04:00
|
|
|
void
|
|
|
|
nsFileControlFrame::SetFocus(PRBool aOn, PRBool aRepaint)
|
|
|
|
{
|
2000-12-01 00:39:28 +03:00
|
|
|
// Fix for Bug 6133
|
1998-10-23 03:00:37 +04:00
|
|
|
if (mTextFrame) {
|
2003-07-04 16:50:32 +04:00
|
|
|
nsIContent* content = mTextFrame->GetContent();
|
2000-12-01 00:39:28 +03:00
|
|
|
if (content) {
|
2007-03-31 01:11:41 +04:00
|
|
|
content->SetFocus(PresContext());
|
2000-12-01 00:39:28 +03:00
|
|
|
}
|
1998-10-23 03:00:37 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-07-01 02:17:43 +04:00
|
|
|
/**
|
|
|
|
* This is called when our browse button is clicked
|
|
|
|
*/
|
|
|
|
nsresult
|
|
|
|
nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent)
|
1998-09-23 21:16:51 +04:00
|
|
|
{
|
2000-08-25 17:25:50 +04:00
|
|
|
// only allow the left button
|
|
|
|
nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aMouseEvent);
|
|
|
|
if (mouseEvent) {
|
|
|
|
PRUint16 whichButton;
|
|
|
|
if (NS_SUCCEEDED(mouseEvent->GetButton(&whichButton))) {
|
2001-03-02 21:39:22 +03:00
|
|
|
if (whichButton != 0) {
|
2000-08-25 17:25:50 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-08-18 22:16:12 +04:00
|
|
|
nsresult result;
|
2000-06-07 05:21:20 +04:00
|
|
|
|
2000-09-01 05:54:35 +04:00
|
|
|
// Get parent nsIDOMWindowInternal object.
|
2003-07-04 16:50:32 +04:00
|
|
|
nsIContent* content = GetContent();
|
2000-08-18 22:16:12 +04:00
|
|
|
if (!content)
|
2003-07-04 16:50:32 +04:00
|
|
|
return NS_ERROR_FAILURE;
|
2000-08-18 22:16:12 +04:00
|
|
|
|
2003-07-29 01:25:13 +04:00
|
|
|
nsCOMPtr<nsIDocument> doc = content->GetDocument();
|
2000-08-18 22:16:12 +04:00
|
|
|
if (!doc)
|
2003-07-29 01:25:13 +04:00
|
|
|
return NS_ERROR_FAILURE;
|
2000-08-18 22:16:12 +04:00
|
|
|
|
|
|
|
// Get Loc title
|
2005-01-19 02:46:59 +03:00
|
|
|
nsXPIDLString title;
|
2004-12-17 23:40:48 +03:00
|
|
|
nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
|
|
|
|
"FileUpload", title);
|
2000-05-27 17:03:18 +04:00
|
|
|
|
2000-09-14 03:57:52 +04:00
|
|
|
nsCOMPtr<nsIFilePicker> filePicker = do_CreateInstance("@mozilla.org/filepicker;1");
|
2000-08-18 22:16:12 +04:00
|
|
|
if (!filePicker)
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
2005-11-29 02:56:44 +03:00
|
|
|
result = filePicker->Init(doc->GetWindow(), title, nsIFilePicker::modeOpen);
|
2000-08-18 22:16:12 +04:00
|
|
|
if (NS_FAILED(result))
|
|
|
|
return result;
|
|
|
|
|
|
|
|
// Set filter "All Files"
|
|
|
|
filePicker->AppendFilters(nsIFilePicker::filterAll);
|
|
|
|
|
|
|
|
// Set default directry and filename
|
|
|
|
nsAutoString defaultName;
|
2006-12-26 20:47:52 +03:00
|
|
|
GetFormProperty(nsGkAtoms::value, defaultName);
|
2000-08-18 22:16:12 +04:00
|
|
|
|
2000-09-14 03:57:52 +04:00
|
|
|
nsCOMPtr<nsILocalFile> currentFile = do_CreateInstance("@mozilla.org/file/local;1");
|
2000-08-18 22:16:12 +04:00
|
|
|
if (currentFile && !defaultName.IsEmpty()) {
|
2002-05-08 03:07:19 +04:00
|
|
|
result = currentFile->InitWithPath(defaultName);
|
2000-08-18 22:16:12 +04:00
|
|
|
if (NS_SUCCEEDED(result)) {
|
2002-05-08 03:07:19 +04:00
|
|
|
nsAutoString leafName;
|
2002-04-27 09:33:09 +04:00
|
|
|
currentFile->GetLeafName(leafName);
|
|
|
|
if (!leafName.IsEmpty()) {
|
2004-04-22 03:38:22 +04:00
|
|
|
filePicker->SetDefaultString(leafName);
|
2000-08-18 22:16:12 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// set directory
|
|
|
|
nsCOMPtr<nsIFile> parentFile;
|
|
|
|
currentFile->GetParent(getter_AddRefs(parentFile));
|
|
|
|
if (parentFile) {
|
|
|
|
nsCOMPtr<nsILocalFile> parentLocalFile = do_QueryInterface(parentFile, &result);
|
|
|
|
if (parentLocalFile)
|
|
|
|
filePicker->SetDisplayDirectory(parentLocalFile);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-02-20 01:13:47 +03:00
|
|
|
// Tell our textframe to remember the currently focused value
|
|
|
|
mTextFrame->InitFocusedValue();
|
|
|
|
|
2000-08-18 22:16:12 +04:00
|
|
|
// Open dialog
|
|
|
|
PRInt16 mode;
|
|
|
|
result = filePicker->Show(&mode);
|
|
|
|
if (NS_FAILED(result))
|
|
|
|
return result;
|
|
|
|
if (mode == nsIFilePicker::returnCancel)
|
|
|
|
return NS_OK;
|
|
|
|
|
2004-01-18 07:35:54 +03:00
|
|
|
if (!mTextFrame) {
|
|
|
|
// We got destroyed while the filepicker was up. Don't do anything here.
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2000-08-18 22:16:12 +04:00
|
|
|
// Set property
|
|
|
|
nsCOMPtr<nsILocalFile> localFile;
|
|
|
|
result = filePicker->GetFile(getter_AddRefs(localFile));
|
|
|
|
if (localFile) {
|
2002-05-08 03:07:19 +04:00
|
|
|
nsAutoString unicodePath;
|
2002-04-27 09:33:09 +04:00
|
|
|
result = localFile->GetPath(unicodePath);
|
|
|
|
if (!unicodePath.IsEmpty()) {
|
2007-01-05 19:31:07 +03:00
|
|
|
// Tell mTextFrame that this update of the value is a user initiated
|
|
|
|
// change. Otherwise it'll think that the value is being set by a script
|
|
|
|
// and not fire onchange when it should.
|
|
|
|
PRBool oldState = mTextFrame->GetFireChangeEventState();
|
|
|
|
mTextFrame->SetFireChangeEventState(PR_TRUE);
|
2006-04-25 13:18:42 +04:00
|
|
|
nsCOMPtr<nsIFileControlElement> fileControl = do_QueryInterface(mContent);
|
|
|
|
if (fileControl) {
|
|
|
|
fileControl->SetFileName(unicodePath);
|
|
|
|
}
|
|
|
|
|
2007-07-14 08:46:09 +04:00
|
|
|
mTextFrame->SetFireChangeEventState(oldState);
|
2004-02-20 01:13:47 +03:00
|
|
|
// May need to fire an onchange here
|
|
|
|
mTextFrame->CheckFireOnChange();
|
2000-08-18 22:16:12 +04:00
|
|
|
return NS_OK;
|
1999-09-19 11:25:12 +04:00
|
|
|
}
|
1998-09-23 21:16:51 +04:00
|
|
|
}
|
2000-08-18 22:16:12 +04:00
|
|
|
|
|
|
|
return NS_FAILED(result) ? result : NS_ERROR_FAILURE;
|
1998-09-23 21:16:51 +04:00
|
|
|
}
|
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
nscoord
|
|
|
|
nsFileControlFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
|
|
|
|
{
|
|
|
|
nscoord result;
|
|
|
|
DISPLAY_MIN_WIDTH(this, result);
|
|
|
|
|
|
|
|
// Our min width is our pref width
|
|
|
|
result = GetPrefWidth(aRenderingContext);
|
|
|
|
return result;
|
|
|
|
}
|
1998-09-23 21:16:51 +04:00
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
NS_IMETHODIMP nsFileControlFrame::Reflow(nsPresContext* aPresContext,
|
1998-10-02 08:10:00 +04:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus)
|
1998-09-23 21:16:51 +04:00
|
|
|
{
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
DO_GLOBAL_REFLOW_COUNT("nsFileControlFrame");
|
2001-11-14 16:40:03 +03:00
|
|
|
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
2000-04-22 01:51:35 +04:00
|
|
|
|
2000-09-10 02:13:12 +04:00
|
|
|
aStatus = NS_FRAME_COMPLETE;
|
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
if (mState & NS_FRAME_FIRST_REFLOW) {
|
2000-01-22 04:16:50 +03:00
|
|
|
mTextFrame = GetTextControlFrame(aPresContext, this);
|
2005-12-13 02:53:06 +03:00
|
|
|
NS_ENSURE_TRUE(mTextFrame, NS_ERROR_UNEXPECTED);
|
1999-09-15 09:31:31 +04:00
|
|
|
if (mCachedState) {
|
2006-12-26 20:47:52 +03:00
|
|
|
mTextFrame->SetFormProperty(nsGkAtoms::value, *mCachedState);
|
1999-09-15 09:31:31 +04:00
|
|
|
delete mCachedState;
|
|
|
|
mCachedState = nsnull;
|
|
|
|
}
|
1999-05-08 00:30:16 +04:00
|
|
|
}
|
|
|
|
|
2000-03-28 02:20:06 +04:00
|
|
|
// The Areaframe takes care of all our reflow
|
|
|
|
// except for when style is used to change its size.
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
// XXXbz do we care? This setup just needs to die.... Leaving it
|
|
|
|
// in for now just because I don't want to regress things, but....
|
|
|
|
nsresult rv = nsAreaFrame::Reflow(aPresContext, aDesiredSize, aReflowState,
|
|
|
|
aStatus);
|
2000-08-18 22:16:12 +04:00
|
|
|
if (NS_SUCCEEDED(rv) && mTextFrame != nsnull) {
|
2004-01-09 17:20:53 +03:00
|
|
|
nsIFrame* child = GetFirstChild(nsnull);
|
2003-07-04 16:50:32 +04:00
|
|
|
if (child == mTextFrame) {
|
|
|
|
child = child->GetNextSibling();
|
2000-03-28 02:20:06 +04:00
|
|
|
}
|
2003-07-04 16:50:32 +04:00
|
|
|
if (child) {
|
|
|
|
nsRect buttonRect = child->GetRect();
|
|
|
|
nsRect txtRect = mTextFrame->GetRect();
|
2000-03-28 02:20:06 +04:00
|
|
|
|
2002-02-27 16:03:00 +03:00
|
|
|
// check to see if we must reflow just the area frame again
|
|
|
|
// in order for the text field to be the correct height
|
|
|
|
// reflowing just the textfield (for some reason)
|
|
|
|
// messes up the button's rect
|
2000-03-28 02:20:06 +04:00
|
|
|
if (txtRect.width + buttonRect.width != aDesiredSize.width ||
|
|
|
|
txtRect.height != aDesiredSize.height) {
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
nsHTMLReflowMetrics txtKidSize;
|
2002-02-27 16:03:00 +03:00
|
|
|
nsSize txtAvailSize(aReflowState.availableWidth, aDesiredSize.height);
|
2005-12-21 06:31:47 +03:00
|
|
|
nsHTMLReflowState txtKidReflowState(aPresContext,
|
|
|
|
*aReflowState.parentReflowState,
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
this, txtAvailSize);
|
2007-08-02 22:08:05 +04:00
|
|
|
txtKidReflowState.SetComputedHeight(aDesiredSize.height);
|
2002-02-27 16:03:00 +03:00
|
|
|
rv = nsAreaFrame::WillReflow(aPresContext);
|
|
|
|
NS_ASSERTION(NS_SUCCEEDED(rv), "Should have succeeded");
|
|
|
|
rv = nsAreaFrame::Reflow(aPresContext, txtKidSize, txtKidReflowState, aStatus);
|
|
|
|
NS_ASSERTION(NS_SUCCEEDED(rv), "Should have succeeded");
|
|
|
|
rv = nsAreaFrame::DidReflow(aPresContext, &txtKidReflowState, aStatus);
|
|
|
|
NS_ASSERTION(NS_SUCCEEDED(rv), "Should have succeeded");
|
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
// And now manually resize the frame...
|
|
|
|
txtRect = mTextFrame->GetRect();
|
2006-08-07 10:31:55 +04:00
|
|
|
txtRect.y = aReflowState.mComputedBorderPadding.top;
|
|
|
|
txtRect.height = aDesiredSize.height;
|
|
|
|
mTextFrame->SetRect(txtRect);
|
2002-02-27 16:03:00 +03:00
|
|
|
}
|
2000-03-28 02:20:06 +04:00
|
|
|
}
|
|
|
|
}
|
2002-05-29 02:50:43 +04:00
|
|
|
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
|
2000-03-28 02:20:06 +04:00
|
|
|
return rv;
|
1999-07-01 02:17:43 +04:00
|
|
|
}
|
1998-09-23 21:16:51 +04:00
|
|
|
|
1999-07-01 02:17:43 +04:00
|
|
|
/*
|
|
|
|
NS_IMETHODIMP
|
2006-04-10 04:16:29 +04:00
|
|
|
nsFileControlFrame::SetInitialChildList(nsIAtom* aListName,
|
|
|
|
nsIFrame* aChildList)
|
1999-07-01 02:17:43 +04:00
|
|
|
{
|
2006-04-10 04:16:29 +04:00
|
|
|
nsAreaFrame::SetInitialChildList(aListName, aChildList);
|
1998-09-23 21:16:51 +04:00
|
|
|
|
2005-11-21 01:05:24 +03:00
|
|
|
// given that the CSS frame constructor created all our frames. We need to find the text field
|
1999-07-01 02:17:43 +04:00
|
|
|
// so we can get info from it.
|
|
|
|
mTextFrame = GetTextControlFrame(this);
|
|
|
|
}
|
|
|
|
*/
|
1998-09-23 21:16:51 +04:00
|
|
|
|
2000-05-17 03:29:35 +04:00
|
|
|
nsNewFrame*
|
2004-08-01 03:15:21 +04:00
|
|
|
nsFileControlFrame::GetTextControlFrame(nsPresContext* aPresContext, nsIFrame* aStart)
|
1999-07-01 02:17:43 +04:00
|
|
|
{
|
2000-05-17 03:29:35 +04:00
|
|
|
nsNewFrame* result = nsnull;
|
2000-08-18 22:16:12 +04:00
|
|
|
#ifndef DEBUG_NEWFRAME
|
1999-07-01 02:17:43 +04:00
|
|
|
// find the text control frame.
|
2004-01-09 17:20:53 +03:00
|
|
|
nsIFrame* childFrame = aStart->GetFirstChild(nsnull);
|
1999-07-01 02:17:43 +04:00
|
|
|
|
1999-09-15 09:31:31 +04:00
|
|
|
while (childFrame) {
|
1999-07-01 02:17:43 +04:00
|
|
|
// see if the child is a text control
|
2003-11-19 04:20:56 +03:00
|
|
|
nsCOMPtr<nsIFormControl> formCtrl =
|
|
|
|
do_QueryInterface(childFrame->GetContent());
|
|
|
|
|
|
|
|
if (formCtrl && formCtrl->GetType() == NS_FORM_INPUT_TEXT) {
|
|
|
|
result = (nsNewFrame*)childFrame;
|
1998-10-01 08:46:11 +04:00
|
|
|
}
|
1998-09-23 21:16:51 +04:00
|
|
|
|
1999-07-01 02:17:43 +04:00
|
|
|
// if not continue looking
|
2000-05-17 03:29:35 +04:00
|
|
|
nsNewFrame* frame = GetTextControlFrame(aPresContext, childFrame);
|
1999-09-15 09:31:31 +04:00
|
|
|
if (frame)
|
2000-02-23 23:58:42 +03:00
|
|
|
result = frame;
|
1999-07-01 02:17:43 +04:00
|
|
|
|
2003-07-04 16:50:32 +04:00
|
|
|
childFrame = childFrame->GetNextSibling();
|
1998-09-23 21:16:51 +04:00
|
|
|
}
|
|
|
|
|
2000-02-23 23:58:42 +03:00
|
|
|
return result;
|
2000-08-18 22:16:12 +04:00
|
|
|
#else
|
|
|
|
return nsnull;
|
|
|
|
#endif
|
1998-09-23 21:16:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
PRIntn
|
|
|
|
nsFileControlFrame::GetSkipSides() const
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-06-12 11:58:26 +04:00
|
|
|
void
|
|
|
|
nsFileControlFrame::SyncAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
|
|
|
PRInt32 aWhichControls)
|
|
|
|
{
|
|
|
|
nsAutoString value;
|
2005-10-28 15:25:24 +04:00
|
|
|
if (mContent->GetAttr(aNameSpaceID, aAttribute, value)) {
|
2002-06-12 11:58:26 +04:00
|
|
|
if (aWhichControls & SYNC_TEXT && mTextContent) {
|
|
|
|
mTextContent->SetAttr(aNameSpaceID, aAttribute, value, PR_TRUE);
|
|
|
|
}
|
|
|
|
if (aWhichControls & SYNC_BUTTON && mBrowse) {
|
|
|
|
mBrowse->SetAttr(aNameSpaceID, aAttribute, value, PR_TRUE);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (aWhichControls & SYNC_TEXT && mTextContent) {
|
|
|
|
mTextContent->UnsetAttr(aNameSpaceID, aAttribute, PR_TRUE);
|
|
|
|
}
|
|
|
|
if (aWhichControls & SYNC_BUTTON && mBrowse) {
|
|
|
|
mBrowse->UnsetAttr(aNameSpaceID, aAttribute, PR_TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1999-02-11 04:13:28 +03:00
|
|
|
|
1999-08-19 18:03:53 +04:00
|
|
|
NS_IMETHODIMP
|
2005-09-07 20:49:21 +04:00
|
|
|
nsFileControlFrame::AttributeChanged(PRInt32 aNameSpaceID,
|
2004-12-31 04:13:27 +03:00
|
|
|
nsIAtom* aAttribute,
|
|
|
|
PRInt32 aModType)
|
1999-08-19 18:03:53 +04:00
|
|
|
{
|
2002-06-12 11:58:26 +04:00
|
|
|
// propagate disabled to text / button inputs
|
|
|
|
if (aNameSpaceID == kNameSpaceID_None &&
|
2006-12-26 20:47:52 +03:00
|
|
|
aAttribute == nsGkAtoms::disabled) {
|
2002-06-12 11:58:26 +04:00
|
|
|
SyncAttr(aNameSpaceID, aAttribute, SYNC_BOTH);
|
|
|
|
// propagate size to text
|
|
|
|
} else if (aNameSpaceID == kNameSpaceID_None &&
|
2006-12-26 20:47:52 +03:00
|
|
|
aAttribute == nsGkAtoms::size) {
|
2002-06-12 11:58:26 +04:00
|
|
|
SyncAttr(aNameSpaceID, aAttribute, SYNC_TEXT);
|
1999-08-19 18:03:53 +04:00
|
|
|
}
|
|
|
|
|
2005-09-07 20:49:21 +04:00
|
|
|
return nsAreaFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
|
1999-08-19 18:03:53 +04:00
|
|
|
}
|
|
|
|
|
2005-08-17 02:52:48 +04:00
|
|
|
PRBool
|
|
|
|
nsFileControlFrame::IsLeaf() const
|
|
|
|
{
|
|
|
|
return PR_TRUE;
|
|
|
|
}
|
|
|
|
|
1999-11-02 01:12:45 +03:00
|
|
|
#ifdef NS_DEBUG
|
1998-11-19 20:22:29 +03:00
|
|
|
NS_IMETHODIMP
|
2001-11-14 04:33:42 +03:00
|
|
|
nsFileControlFrame::GetFrameName(nsAString& aResult) const
|
1998-11-19 20:22:29 +03:00
|
|
|
{
|
2001-11-14 04:33:42 +03:00
|
|
|
return MakeFrameName(NS_LITERAL_STRING("FileControl"), aResult);
|
1998-11-19 20:22:29 +03:00
|
|
|
}
|
1999-11-02 01:12:45 +03:00
|
|
|
#endif
|
1999-01-22 18:32:57 +03:00
|
|
|
|
2005-12-13 03:57:56 +03:00
|
|
|
nsresult
|
|
|
|
nsFileControlFrame::SetFormProperty(nsIAtom* aName,
|
|
|
|
const nsAString& aValue)
|
1999-01-26 01:16:27 +03:00
|
|
|
{
|
2006-12-26 20:47:52 +03:00
|
|
|
if (nsGkAtoms::value == aName) {
|
1999-09-19 11:25:12 +04:00
|
|
|
if (mTextFrame) {
|
2002-05-16 22:26:05 +04:00
|
|
|
mTextFrame->SetValue(aValue);
|
1999-09-19 11:25:12 +04:00
|
|
|
} else {
|
|
|
|
if (mCachedState) delete mCachedState;
|
|
|
|
mCachedState = new nsString(aValue);
|
2005-12-13 02:53:06 +03:00
|
|
|
NS_ENSURE_TRUE(mCachedState, NS_ERROR_OUT_OF_MEMORY);
|
1999-09-19 11:25:12 +04:00
|
|
|
}
|
1999-02-11 04:13:28 +03:00
|
|
|
}
|
2005-12-13 02:53:06 +03:00
|
|
|
return NS_OK;
|
1999-02-11 04:13:28 +03:00
|
|
|
}
|
1999-01-26 01:16:27 +03:00
|
|
|
|
2005-12-13 02:53:06 +03:00
|
|
|
nsresult
|
|
|
|
nsFileControlFrame::GetFormProperty(nsIAtom* aName, nsAString& aValue) const
|
1999-01-26 01:16:27 +03:00
|
|
|
{
|
2001-04-24 12:33:57 +04:00
|
|
|
aValue.Truncate(); // initialize out param
|
1999-02-11 04:13:28 +03:00
|
|
|
|
2006-12-26 20:47:52 +03:00
|
|
|
if (nsGkAtoms::value == aName) {
|
2006-02-03 21:45:01 +03:00
|
|
|
NS_ASSERTION(!mCachedState || !mTextFrame,
|
|
|
|
"If we have a cached state, we better have no mTextFrame");
|
|
|
|
if (mCachedState) {
|
2001-04-24 12:33:57 +04:00
|
|
|
aValue.Assign(*mCachedState);
|
2007-08-14 22:42:10 +04:00
|
|
|
} else {
|
|
|
|
nsCOMPtr<nsIFileControlElement> fileControl =
|
|
|
|
do_QueryInterface(mContent);
|
2006-04-25 13:18:42 +04:00
|
|
|
if (fileControl) {
|
|
|
|
fileControl->GetFileName(aValue);
|
|
|
|
}
|
2001-04-24 12:33:57 +04:00
|
|
|
}
|
1999-02-11 04:13:28 +03:00
|
|
|
}
|
1999-01-26 01:16:27 +03:00
|
|
|
return NS_OK;
|
1999-02-18 03:13:39 +03:00
|
|
|
}
|
|
|
|
|
2006-01-26 05:29:17 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFileControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists)
|
1999-02-11 04:13:28 +03:00
|
|
|
{
|
2006-02-07 01:27:58 +03:00
|
|
|
// Our background is inherited to the text input, and we don't really want to
|
|
|
|
// paint it or out padding and borders (which we never have anyway, per
|
|
|
|
// styles in forms.css) -- doing it just makes us look ugly in some cases and
|
|
|
|
// has no effect in others.
|
2006-02-07 01:08:10 +03:00
|
|
|
nsDisplayListCollection tempList;
|
|
|
|
nsresult rv = nsAreaFrame::BuildDisplayList(aBuilder, aDirtyRect, tempList);
|
2006-01-26 05:29:17 +03:00
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
2006-02-07 01:08:10 +03:00
|
|
|
|
|
|
|
tempList.BorderBackground()->DeleteAll();
|
|
|
|
tempList.MoveTo(aLists);
|
2001-04-13 04:30:37 +04:00
|
|
|
|
2006-01-26 05:29:17 +03:00
|
|
|
// Disabled file controls don't pass mouse events to their children, so we
|
|
|
|
// put an invisible item in the display list above the children
|
|
|
|
// just to catch events
|
|
|
|
// REVIEW: I'm not sure why we do this, but that's what nsFileControlFrame::
|
|
|
|
// GetFrameForPoint was doing
|
2006-12-26 20:47:52 +03:00
|
|
|
if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::disabled) &&
|
2006-01-26 05:29:17 +03:00
|
|
|
IsVisibleForPainting(aBuilder)) {
|
|
|
|
nsDisplayItem* item = new (aBuilder) nsDisplayEventReceiver(this);
|
|
|
|
if (!item)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
aLists.Content()->AppendToTop(item);
|
|
|
|
}
|
1999-09-15 09:31:31 +04:00
|
|
|
|
2006-01-26 05:29:17 +03:00
|
|
|
return DisplaySelectionOverlay(aBuilder, aLists);
|
|
|
|
}
|
2006-11-14 01:05:25 +03:00
|
|
|
|
2007-09-28 05:09:14 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
|
|
|
NS_IMETHODIMP nsFileControlFrame::GetAccessible(nsIAccessible** aAccessible)
|
|
|
|
{
|
2007-11-20 23:39:36 +03:00
|
|
|
// Accessible object exists just to hold onto its children, for later shutdown
|
|
|
|
nsCOMPtr<nsIAccessibilityService> accService = do_GetService("@mozilla.org/accessibilityService;1");
|
|
|
|
|
|
|
|
if (accService) {
|
|
|
|
return accService->CreateHTMLGenericAccessible(static_cast<nsIFrame*>(this), aAccessible);
|
|
|
|
}
|
|
|
|
|
2007-09-28 05:09:14 +04:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2006-11-14 01:05:25 +03:00
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
// Mouse listener implementation
|
|
|
|
|
|
|
|
NS_IMPL_ISUPPORTS1(nsFileControlFrame::MouseListener, nsIDOMMouseListener)
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFileControlFrame::MouseListener::MouseClick(nsIDOMEvent* aMouseEvent)
|
|
|
|
{
|
|
|
|
if (mFrame) {
|
|
|
|
return mFrame->MouseClick(aMouseEvent);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|