2001-09-25 01:32:19 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2005-09-21 19:14:30 +00:00
|
|
|
// vim:set et sw=2 sts=2 cin:
|
2001-09-25 01:32:19 +00:00
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-17 21:52:36 +00:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1998-07-14 18:52:27 +00:00
|
|
|
*
|
2004-04-17 21:52:36 +00: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-07-14 18:52:27 +00:00
|
|
|
*
|
2001-09-25 01:32:19 +00: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-07-14 18:52:27 +00:00
|
|
|
*
|
1998-07-15 00:21:51 +00:00
|
|
|
* The Original Code is Mozilla Communicator client code.
|
|
|
|
*
|
2004-04-17 21:52:36 +00:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-25 01:32:19 +00:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 03:40:37 +00:00
|
|
|
*
|
2001-09-25 01:32:19 +00:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-17 21:52:36 +00: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-25 01:32:19 +00: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-17 21:52:36 +00:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-25 01:32:19 +00: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-17 21:52:36 +00:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-25 01:32:19 +00:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2006-05-21 21:00:09 +00:00
|
|
|
|
1998-09-02 23:53:16 +00:00
|
|
|
#include "nsGenericHTMLElement.h"
|
2005-09-21 19:14:30 +00:00
|
|
|
#include "nsObjectLoadingContent.h"
|
2007-01-30 00:06:41 +00:00
|
|
|
#include "nsGkAtoms.h"
|
2000-04-18 22:57:42 +00:00
|
|
|
#include "nsDOMError.h"
|
2002-02-21 02:01:12 +00:00
|
|
|
#include "nsIDocument.h"
|
|
|
|
#include "nsIDOMDocument.h"
|
2006-05-21 21:00:09 +00:00
|
|
|
#include "nsIDOMHTMLObjectElement.h"
|
2005-03-09 17:01:22 +00:00
|
|
|
#include "nsIFormSubmission.h"
|
|
|
|
#include "nsIObjectFrame.h"
|
|
|
|
#include "nsIPluginInstance.h"
|
|
|
|
#include "nsIPluginInstanceInternal.h"
|
1998-07-14 18:52:27 +00:00
|
|
|
|
2004-02-10 19:36:43 +00:00
|
|
|
class nsHTMLObjectElement : public nsGenericHTMLFormElement,
|
2005-09-21 19:14:30 +00:00
|
|
|
public nsObjectLoadingContent,
|
2000-12-23 10:56:31 +00:00
|
|
|
public nsIDOMHTMLObjectElement
|
1998-09-01 01:31:20 +00:00
|
|
|
{
|
1998-07-14 18:52:27 +00:00
|
|
|
public:
|
2004-06-02 00:25:00 +00:00
|
|
|
nsHTMLObjectElement(nsINodeInfo *aNodeInfo, PRBool aFromParser = PR_FALSE);
|
2006-06-01 18:35:21 +00:00
|
|
|
virtual ~nsHTMLObjectElement();
|
1998-09-01 01:31:20 +00:00
|
|
|
|
|
|
|
// nsISupports
|
2000-12-23 10:56:31 +00:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
1998-09-01 01:31:20 +00:00
|
|
|
|
|
|
|
// nsIDOMNode
|
2006-09-05 10:22:54 +00:00
|
|
|
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
|
1998-09-01 01:31:20 +00:00
|
|
|
|
|
|
|
// nsIDOMElement
|
2004-02-10 19:36:43 +00:00
|
|
|
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)
|
1998-09-01 01:31:20 +00:00
|
|
|
|
|
|
|
// nsIDOMHTMLElement
|
2004-02-10 19:36:43 +00:00
|
|
|
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLFormElement::)
|
1998-09-01 01:31:20 +00:00
|
|
|
|
1998-09-02 23:53:16 +00:00
|
|
|
// nsIDOMHTMLObjectElement
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 16:46:42 +00:00
|
|
|
NS_DECL_NSIDOMHTMLOBJECTELEMENT
|
1998-09-01 01:31:20 +00:00
|
|
|
|
2006-05-21 21:00:09 +00:00
|
|
|
virtual nsresult BindToTree(nsIDocument *aDocument, nsIContent *aParent,
|
|
|
|
nsIContent *aBindingParent,
|
2005-09-21 19:14:30 +00:00
|
|
|
PRBool aCompileEventHandlers);
|
|
|
|
virtual void UnbindFromTree(PRBool aDeep = PR_TRUE,
|
|
|
|
PRBool aNullParent = PR_TRUE);
|
2006-05-21 21:00:09 +00:00
|
|
|
virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom *aName,
|
|
|
|
nsIAtom *aPrefix, const nsAString &aValue,
|
2005-09-21 19:14:30 +00:00
|
|
|
PRBool aNotify);
|
|
|
|
|
2005-10-03 19:29:52 +00:00
|
|
|
virtual PRBool IsFocusable(PRInt32 *aTabIndex = nsnull);
|
2005-11-14 23:55:24 +00:00
|
|
|
virtual PRUint32 GetDesiredIMEState();
|
2005-09-21 19:14:30 +00:00
|
|
|
|
2002-08-06 08:32:19 +00:00
|
|
|
// Overriden nsIFormControl methods
|
2006-05-21 21:00:09 +00:00
|
|
|
NS_IMETHOD_(PRInt32) GetType() const
|
|
|
|
{
|
|
|
|
return NS_FORM_OBJECT;
|
|
|
|
}
|
|
|
|
|
2002-08-06 08:32:19 +00:00
|
|
|
NS_IMETHOD Reset();
|
2006-05-21 21:00:09 +00:00
|
|
|
NS_IMETHOD SubmitNamesValues(nsIFormSubmission *aFormSubmission,
|
|
|
|
nsIContent *aSubmitElement);
|
2002-08-06 08:32:19 +00:00
|
|
|
|
2006-11-04 05:45:02 +00:00
|
|
|
virtual nsresult DoneAddingChildren(PRBool aHaveNotified);
|
2004-06-02 00:25:00 +00:00
|
|
|
virtual PRBool IsDoneAddingChildren();
|
|
|
|
|
2005-11-29 16:37:15 +00:00
|
|
|
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
|
2006-05-21 21:00:09 +00:00
|
|
|
nsIAtom *aAttribute,
|
|
|
|
const nsAString &aValue,
|
|
|
|
nsAttrValue &aResult);
|
2005-01-12 19:45:38 +00:00
|
|
|
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
|
2006-05-21 21:00:09 +00:00
|
|
|
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom *aAttribute) const;
|
2005-09-18 18:05:40 +00:00
|
|
|
virtual PRInt32 IntrinsicState() const;
|
2004-06-02 00:25:00 +00:00
|
|
|
|
2005-09-21 19:14:30 +00:00
|
|
|
// nsObjectLoadingContent
|
|
|
|
virtual PRUint32 GetCapabilities() const;
|
|
|
|
|
2006-09-05 10:22:54 +00:00
|
|
|
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
|
|
|
|
2006-05-21 21:00:09 +00:00
|
|
|
private:
|
2005-09-21 19:14:30 +00:00
|
|
|
/**
|
2006-05-21 21:00:09 +00:00
|
|
|
* Calls LoadObject with the correct arguments to start the plugin load.
|
2005-09-21 19:14:30 +00:00
|
|
|
*/
|
|
|
|
NS_HIDDEN_(void) StartObjectLoad(PRBool aNotify);
|
|
|
|
|
2004-06-02 00:25:00 +00:00
|
|
|
PRPackedBool mIsDoneAddingChildren;
|
1998-07-14 18:52:27 +00:00
|
|
|
};
|
|
|
|
|
2000-12-23 10:56:31 +00:00
|
|
|
|
2004-06-02 00:25:00 +00:00
|
|
|
NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Object)
|
1998-09-01 01:31:20 +00:00
|
|
|
|
1999-10-07 00:35:04 +00:00
|
|
|
|
2004-06-02 00:25:00 +00:00
|
|
|
nsHTMLObjectElement::nsHTMLObjectElement(nsINodeInfo *aNodeInfo,
|
|
|
|
PRBool aFromParser)
|
2006-05-21 21:00:09 +00:00
|
|
|
: nsGenericHTMLFormElement(aNodeInfo),
|
|
|
|
mIsDoneAddingChildren(!aFromParser)
|
1998-07-14 18:52:27 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2006-06-01 18:35:21 +00:00
|
|
|
nsHTMLObjectElement::~nsHTMLObjectElement()
|
|
|
|
{
|
|
|
|
DestroyImageLoadingContent();
|
|
|
|
}
|
|
|
|
|
2004-06-02 00:25:00 +00:00
|
|
|
PRBool
|
|
|
|
nsHTMLObjectElement::IsDoneAddingChildren()
|
|
|
|
{
|
|
|
|
return mIsDoneAddingChildren;
|
|
|
|
}
|
|
|
|
|
2006-11-04 05:45:02 +00:00
|
|
|
nsresult
|
2005-09-22 02:33:36 +00:00
|
|
|
nsHTMLObjectElement::DoneAddingChildren(PRBool aHaveNotified)
|
2004-06-02 00:25:00 +00:00
|
|
|
{
|
|
|
|
mIsDoneAddingChildren = PR_TRUE;
|
2005-09-21 19:14:30 +00:00
|
|
|
|
|
|
|
// If we're already in a document, we need to trigger the load
|
|
|
|
// Otherwise, BindToTree takes care of that.
|
|
|
|
if (IsInDoc()) {
|
2005-09-22 02:33:36 +00:00
|
|
|
StartObjectLoad(aHaveNotified);
|
2005-09-21 19:14:30 +00:00
|
|
|
}
|
2006-11-04 05:45:02 +00:00
|
|
|
return NS_OK;
|
2004-06-02 00:25:00 +00:00
|
|
|
}
|
1998-09-01 01:31:20 +00:00
|
|
|
|
2000-12-23 10:56:31 +00:00
|
|
|
NS_IMPL_ADDREF_INHERITED(nsHTMLObjectElement, nsGenericElement)
|
|
|
|
NS_IMPL_RELEASE_INHERITED(nsHTMLObjectElement, nsGenericElement)
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 16:46:42 +00:00
|
|
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLObjectElement,
|
2004-02-10 19:36:43 +00:00
|
|
|
nsGenericHTMLFormElement)
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 16:46:42 +00:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLObjectElement)
|
2003-03-19 03:47:09 +00:00
|
|
|
NS_INTERFACE_MAP_ENTRY(imgIDecoderObserver)
|
2005-09-21 19:14:30 +00:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIRequestObserver)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIStreamListener)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIFrameLoaderOwner)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIObjectLoadingContent)
|
2003-03-19 03:47:09 +00:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIImageLoadingContent)
|
2005-09-21 19:14:30 +00:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIChannelEventSink)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 16:46:42 +00:00
|
|
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLObjectElement)
|
|
|
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
1998-09-01 01:31:20 +00:00
|
|
|
|
2006-09-05 10:22:54 +00:00
|
|
|
NS_IMPL_ELEMENT_CLONE(nsHTMLObjectElement)
|
2000-12-23 10:56:31 +00:00
|
|
|
|
1998-09-01 01:31:20 +00:00
|
|
|
|
1998-09-02 23:53:16 +00:00
|
|
|
NS_IMETHODIMP
|
2006-05-21 21:00:09 +00:00
|
|
|
nsHTMLObjectElement::GetForm(nsIDOMHTMLFormElement **aForm)
|
1998-09-02 23:53:16 +00:00
|
|
|
{
|
2004-02-10 19:36:43 +00:00
|
|
|
return nsGenericHTMLFormElement::GetForm(aForm);
|
2002-08-06 08:32:19 +00:00
|
|
|
}
|
|
|
|
|
2005-09-21 19:14:30 +00:00
|
|
|
nsresult
|
2006-05-21 21:00:09 +00:00
|
|
|
nsHTMLObjectElement::BindToTree(nsIDocument *aDocument,
|
|
|
|
nsIContent *aParent,
|
|
|
|
nsIContent *aBindingParent,
|
2005-09-21 19:14:30 +00:00
|
|
|
PRBool aCompileEventHandlers)
|
|
|
|
{
|
|
|
|
nsresult rv = nsGenericHTMLFormElement::BindToTree(aDocument, aParent,
|
|
|
|
aBindingParent,
|
|
|
|
aCompileEventHandlers);
|
2006-05-21 21:00:09 +00:00
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
2005-09-21 19:14:30 +00:00
|
|
|
|
|
|
|
// If we already have all the children, start the load.
|
|
|
|
if (mIsDoneAddingChildren) {
|
|
|
|
// Don't need to notify: We have no frames yet, since we weren't in a
|
|
|
|
// document
|
|
|
|
StartObjectLoad(PR_FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsHTMLObjectElement::UnbindFromTree(PRBool aDeep,
|
|
|
|
PRBool aNullParent)
|
|
|
|
{
|
|
|
|
RemovedFromDocument();
|
|
|
|
nsGenericHTMLFormElement::UnbindFromTree(aDeep, aNullParent);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nsresult
|
2006-05-21 21:00:09 +00:00
|
|
|
nsHTMLObjectElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom *aName,
|
|
|
|
nsIAtom *aPrefix, const nsAString &aValue,
|
2005-09-21 19:14:30 +00:00
|
|
|
PRBool aNotify)
|
|
|
|
{
|
2006-01-01 11:25:43 +00:00
|
|
|
// If we plan to call LoadObject, we want to do it first so that the
|
2005-09-21 19:14:30 +00:00
|
|
|
// object load kicks off _before_ the reflow triggered by the SetAttr. But if
|
|
|
|
// aNotify is false, we are coming from the parser or some such place; we'll
|
|
|
|
// get bound after all the attributes have been set, so we'll do the
|
|
|
|
// object load from BindToTree/DoneAddingChildren.
|
2006-01-01 11:25:43 +00:00
|
|
|
// Skip the LoadObject call in that case.
|
2006-05-21 21:00:09 +00:00
|
|
|
if (aNotify && aNameSpaceID == kNameSpaceID_None &&
|
|
|
|
aName == nsGkAtoms::data) {
|
2005-09-21 19:14:30 +00:00
|
|
|
nsAutoString type;
|
2006-05-21 21:00:09 +00:00
|
|
|
GetAttr(kNameSpaceID_None, nsGkAtoms::type, type);
|
2006-01-05 13:30:19 +00:00
|
|
|
LoadObject(aValue, aNotify, NS_ConvertUTF16toUTF8(type), PR_TRUE);
|
2005-09-21 19:14:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return nsGenericHTMLFormElement::SetAttr(aNameSpaceID, aName, aPrefix,
|
|
|
|
aValue, aNotify);
|
|
|
|
}
|
|
|
|
|
2006-05-21 21:00:09 +00:00
|
|
|
PRBool
|
|
|
|
nsHTMLObjectElement::IsFocusable(PRInt32 *aTabIndex)
|
2005-10-03 19:29:52 +00:00
|
|
|
{
|
|
|
|
if (Type() == eType_Plugin) {
|
|
|
|
// Has plugin content: let the plugin decide what to do in terms of
|
|
|
|
// internal focus from mouse clicks
|
2005-10-04 23:43:54 +00:00
|
|
|
if (aTabIndex) {
|
|
|
|
GetTabIndex(aTabIndex);
|
|
|
|
}
|
|
|
|
|
2005-10-03 19:29:52 +00:00
|
|
|
return PR_TRUE;
|
|
|
|
}
|
2005-10-04 23:43:54 +00:00
|
|
|
|
|
|
|
return nsGenericHTMLFormElement::IsFocusable(aTabIndex);
|
2005-10-03 19:29:52 +00:00
|
|
|
}
|
|
|
|
|
2005-11-14 23:55:24 +00:00
|
|
|
PRUint32
|
|
|
|
nsHTMLObjectElement::GetDesiredIMEState()
|
|
|
|
{
|
2006-05-21 21:00:09 +00:00
|
|
|
if (Type() == eType_Plugin) {
|
2005-11-14 23:55:24 +00:00
|
|
|
return nsIContent::IME_STATUS_ENABLE;
|
2006-05-21 21:00:09 +00:00
|
|
|
}
|
|
|
|
|
2005-11-14 23:55:24 +00:00
|
|
|
return nsGenericHTMLFormElement::GetDesiredIMEState();
|
|
|
|
}
|
|
|
|
|
2002-08-06 08:32:19 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHTMLObjectElement::Reset()
|
|
|
|
{
|
1998-09-02 23:53:16 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2002-08-06 08:32:19 +00:00
|
|
|
NS_IMETHODIMP
|
2006-05-21 21:00:09 +00:00
|
|
|
nsHTMLObjectElement::SubmitNamesValues(nsIFormSubmission *aFormSubmission,
|
|
|
|
nsIContent *aSubmitElement)
|
2002-08-06 08:32:19 +00:00
|
|
|
{
|
2005-03-09 17:01:22 +00:00
|
|
|
nsAutoString name;
|
2006-05-21 21:00:09 +00:00
|
|
|
if (!GetAttr(kNameSpaceID_None, nsGkAtoms::name, name)) {
|
2005-03-09 17:01:22 +00:00
|
|
|
// No name, don't submit.
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-12 16:14:31 +00:00
|
|
|
nsIFrame* frame = GetPrimaryFrame();
|
2005-03-09 17:01:22 +00:00
|
|
|
|
|
|
|
nsIObjectFrame *objFrame = nsnull;
|
|
|
|
if (frame) {
|
|
|
|
CallQueryInterface(frame, &objFrame);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!objFrame) {
|
|
|
|
// No frame, nothing to submit.
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsCOMPtr<nsIPluginInstance> pi;
|
|
|
|
objFrame->GetPluginInstance(*getter_AddRefs(pi));
|
|
|
|
|
|
|
|
nsCOMPtr<nsIPluginInstanceInternal> pi_internal(do_QueryInterface(pi));
|
|
|
|
|
|
|
|
if (!pi_internal) {
|
|
|
|
// No plugin, nothing to submit.
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsAutoString value;
|
2005-10-28 11:25:24 +00:00
|
|
|
nsresult rv = pi_internal->GetFormValue(value);
|
2005-03-09 17:01:22 +00:00
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
return aFormSubmission->AddNameValuePair(this, name, value);
|
2002-08-06 08:32:19 +00:00
|
|
|
}
|
|
|
|
|
1998-11-03 01:08:02 +00:00
|
|
|
NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Align, align)
|
|
|
|
NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Archive, archive)
|
|
|
|
NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Border, border)
|
2006-07-20 23:42:51 +00:00
|
|
|
NS_IMPL_URI_ATTR_WITH_BASE(nsHTMLObjectElement, Code, code, codebase)
|
2003-07-08 05:35:04 +00:00
|
|
|
NS_IMPL_URI_ATTR(nsHTMLObjectElement, CodeBase, codebase)
|
1998-11-03 01:08:02 +00:00
|
|
|
NS_IMPL_STRING_ATTR(nsHTMLObjectElement, CodeType, codetype)
|
2006-07-20 23:42:51 +00:00
|
|
|
NS_IMPL_URI_ATTR_WITH_BASE(nsHTMLObjectElement, Data, data, codebase)
|
1998-11-03 01:08:02 +00:00
|
|
|
NS_IMPL_BOOL_ATTR(nsHTMLObjectElement, Declare, declare)
|
|
|
|
NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Height, height)
|
2004-02-11 00:09:59 +00:00
|
|
|
NS_IMPL_INT_ATTR(nsHTMLObjectElement, Hspace, hspace)
|
1998-11-03 01:08:02 +00:00
|
|
|
NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Name, name)
|
|
|
|
NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Standby, standby)
|
2005-09-28 02:20:51 +00:00
|
|
|
NS_IMPL_INT_ATTR(nsHTMLObjectElement, TabIndex, tabindex)
|
2005-08-22 23:44:55 +00:00
|
|
|
NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Type, type)
|
1998-11-03 01:08:02 +00:00
|
|
|
NS_IMPL_STRING_ATTR(nsHTMLObjectElement, UseMap, usemap)
|
2004-02-11 00:09:59 +00:00
|
|
|
NS_IMPL_INT_ATTR(nsHTMLObjectElement, Vspace, vspace)
|
1998-11-03 01:08:02 +00:00
|
|
|
NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Width, width)
|
1998-09-01 01:31:20 +00:00
|
|
|
|
2000-04-18 22:57:42 +00:00
|
|
|
NS_IMETHODIMP
|
2006-05-21 21:00:09 +00:00
|
|
|
nsHTMLObjectElement::GetContentDocument(nsIDOMDocument **aContentDocument)
|
2000-04-18 22:57:42 +00:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aContentDocument);
|
2002-02-21 02:01:12 +00:00
|
|
|
|
2000-04-18 22:57:42 +00:00
|
|
|
*aContentDocument = nsnull;
|
|
|
|
|
2004-08-10 10:22:36 +00:00
|
|
|
if (!IsInDoc()) {
|
2002-04-17 04:17:16 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2002-04-05 05:42:10 +00:00
|
|
|
|
2004-10-11 16:14:27 +00:00
|
|
|
// XXXbz should this use GetCurrentDoc()? sXBL/XBL2 issue!
|
2004-08-10 10:22:36 +00:00
|
|
|
nsIDocument *sub_doc = GetOwnerDoc()->GetSubDocumentFor(this);
|
2002-04-17 04:17:16 +00:00
|
|
|
if (!sub_doc) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2002-04-05 05:42:10 +00:00
|
|
|
|
2002-04-17 04:17:16 +00:00
|
|
|
return CallQueryInterface(sub_doc, aContentDocument);
|
2000-04-18 22:57:42 +00:00
|
|
|
}
|
|
|
|
|
2004-03-04 02:06:28 +00:00
|
|
|
PRBool
|
2005-11-29 16:37:15 +00:00
|
|
|
nsHTMLObjectElement::ParseAttribute(PRInt32 aNamespaceID,
|
2006-05-21 21:00:09 +00:00
|
|
|
nsIAtom *aAttribute,
|
|
|
|
const nsAString &aValue,
|
|
|
|
nsAttrValue &aResult)
|
1998-09-01 01:31:20 +00:00
|
|
|
{
|
2005-11-29 16:37:15 +00:00
|
|
|
if (aNamespaceID == kNameSpaceID_None) {
|
2006-05-21 21:00:09 +00:00
|
|
|
if (aAttribute == nsGkAtoms::align) {
|
2005-11-29 16:37:15 +00:00
|
|
|
return ParseAlignValue(aValue, aResult);
|
|
|
|
}
|
|
|
|
if (ParseImageAttribute(aAttribute, aValue, aResult)) {
|
|
|
|
return PR_TRUE;
|
|
|
|
}
|
1998-09-01 01:31:20 +00:00
|
|
|
}
|
2000-12-23 10:56:31 +00:00
|
|
|
|
2005-11-29 16:37:15 +00:00
|
|
|
return nsGenericHTMLFormElement::ParseAttribute(aNamespaceID, aAttribute,
|
|
|
|
aValue, aResult);
|
1998-09-01 01:31:20 +00:00
|
|
|
}
|
|
|
|
|
1998-09-05 04:00:06 +00:00
|
|
|
static void
|
2006-05-21 21:00:09 +00:00
|
|
|
MapAttributesIntoRule(const nsMappedAttributes *aAttributes,
|
|
|
|
nsRuleData *aData)
|
1998-09-05 04:00:06 +00:00
|
|
|
{
|
2004-02-10 19:36:43 +00:00
|
|
|
nsGenericHTMLFormElement::MapImageAlignAttributeInto(aAttributes, aData);
|
|
|
|
nsGenericHTMLFormElement::MapImageBorderAttributeInto(aAttributes, aData);
|
|
|
|
nsGenericHTMLFormElement::MapImageMarginAttributeInto(aAttributes, aData);
|
|
|
|
nsGenericHTMLFormElement::MapImageSizeAttributesInto(aAttributes, aData);
|
|
|
|
nsGenericHTMLFormElement::MapCommonAttributesInto(aAttributes, aData);
|
1998-09-05 04:00:06 +00:00
|
|
|
}
|
|
|
|
|
2003-07-11 21:16:12 +00:00
|
|
|
NS_IMETHODIMP_(PRBool)
|
2006-05-21 21:00:09 +00:00
|
|
|
nsHTMLObjectElement::IsAttributeMapped(const nsIAtom *aAttribute) const
|
1999-07-07 01:24:40 +00:00
|
|
|
{
|
2004-02-25 21:04:50 +00:00
|
|
|
static const MappedAttributeEntry* const map[] = {
|
2003-04-16 20:54:20 +00:00
|
|
|
sCommonAttributeMap,
|
2003-07-11 21:16:12 +00:00
|
|
|
sImageMarginSizeAttributeMap,
|
2003-04-16 20:54:20 +00:00
|
|
|
sImageBorderAttributeMap,
|
|
|
|
sImageAlignAttributeMap,
|
|
|
|
};
|
|
|
|
|
2003-07-11 21:16:12 +00:00
|
|
|
return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
|
1999-07-07 01:24:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-01-12 19:45:38 +00:00
|
|
|
nsMapRuleToAttributesFunc
|
|
|
|
nsHTMLObjectElement::GetAttributeMappingFunction() const
|
1998-09-01 01:31:20 +00:00
|
|
|
{
|
2005-01-12 19:45:38 +00:00
|
|
|
return &MapAttributesIntoRule;
|
1998-09-01 01:31:20 +00:00
|
|
|
}
|
2005-09-18 18:05:40 +00:00
|
|
|
|
2005-09-21 19:14:30 +00:00
|
|
|
void
|
|
|
|
nsHTMLObjectElement::StartObjectLoad(PRBool aNotify)
|
|
|
|
{
|
2006-05-21 21:00:09 +00:00
|
|
|
nsAutoString type;
|
|
|
|
GetAttr(kNameSpaceID_None, nsGkAtoms::type, type);
|
2005-09-21 19:14:30 +00:00
|
|
|
NS_ConvertUTF16toUTF8 ctype(type);
|
|
|
|
|
2006-05-21 21:00:09 +00:00
|
|
|
nsAutoString uri;
|
|
|
|
if (GetAttr(kNameSpaceID_None, nsGkAtoms::data, uri)) {
|
2006-01-01 11:25:43 +00:00
|
|
|
LoadObject(uri, aNotify, ctype);
|
2005-09-21 19:14:30 +00:00
|
|
|
}
|
2006-05-21 21:00:09 +00:00
|
|
|
else {
|
|
|
|
// Be sure to call the nsIURI version if we have no attribute
|
|
|
|
// That handles the case where no URI is specified. An empty string would
|
|
|
|
// get interpreted as the page itself, instead of absence of URI.
|
|
|
|
LoadObject(nsnull, aNotify, ctype);
|
|
|
|
}
|
2005-09-21 19:14:30 +00:00
|
|
|
}
|
|
|
|
|
2005-09-18 18:05:40 +00:00
|
|
|
PRInt32
|
|
|
|
nsHTMLObjectElement::IntrinsicState() const
|
|
|
|
{
|
2005-09-21 19:14:30 +00:00
|
|
|
return nsGenericHTMLFormElement::IntrinsicState() | ObjectState();
|
|
|
|
}
|
2005-09-18 18:05:40 +00:00
|
|
|
|
2005-09-21 19:14:30 +00:00
|
|
|
PRUint32
|
|
|
|
nsHTMLObjectElement::GetCapabilities() const
|
|
|
|
{
|
|
|
|
return nsObjectLoadingContent::GetCapabilities() | eSupportClassID;
|
|
|
|
}
|