2001-09-25 01:32:19 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-17 21:52:36 +00:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1999-01-12 08:45:23 +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/
|
1999-01-12 08:45:23 +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.
|
1999-01-12 08:45:23 +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-03-30 08:03:04 +00:00
|
|
|
|
|
|
|
/*
|
2006-03-31 08:41:49 +00:00
|
|
|
* Implementation of DOM Core's nsIDOMAttr node.
|
2006-03-30 08:03:04 +00:00
|
|
|
*/
|
|
|
|
|
1999-01-12 08:45:23 +00:00
|
|
|
#ifndef nsDOMAttribute_h___
|
|
|
|
#define nsDOMAttribute_h___
|
|
|
|
|
2003-01-22 03:25:51 +00:00
|
|
|
#include "nsIAttribute.h"
|
1999-01-12 08:45:23 +00:00
|
|
|
#include "nsIDOMAttr.h"
|
|
|
|
#include "nsIDOMText.h"
|
|
|
|
#include "nsIDOMNodeList.h"
|
|
|
|
#include "nsString.h"
|
2000-06-23 00:21:32 +00:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsINodeInfo.h"
|
2005-06-01 13:46:20 +00:00
|
|
|
#include "nsDOMAttributeMap.h"
|
2007-01-04 22:31:26 +00:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2010-05-27 19:10:33 +00:00
|
|
|
#include "nsStubMutationObserver.h"
|
1999-01-12 08:45:23 +00:00
|
|
|
|
|
|
|
// Attribute helper class used to wrap up an attribute with a dom
|
2011-06-25 07:33:32 +00:00
|
|
|
// object that implements nsIDOMAttr and nsIDOMNode
|
2007-12-15 09:45:33 +00:00
|
|
|
class nsDOMAttribute : public nsIAttribute,
|
2012-04-03 07:25:39 +00:00
|
|
|
public nsIDOMAttr
|
1999-01-12 08:45:23 +00:00
|
|
|
{
|
|
|
|
public:
|
2010-07-23 09:49:57 +00:00
|
|
|
nsDOMAttribute(nsDOMAttributeMap* aAttrMap,
|
|
|
|
already_AddRefed<nsINodeInfo> aNodeInfo,
|
2010-10-14 14:07:20 +00:00
|
|
|
const nsAString& aValue,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aNsAware);
|
2012-04-03 07:25:39 +00:00
|
|
|
virtual ~nsDOMAttribute() {}
|
1999-01-12 08:45:23 +00:00
|
|
|
|
2007-01-04 22:31:26 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2005-12-03 07:42:40 +00:00
|
|
|
|
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
|
|
|
// nsIDOMNode interface
|
|
|
|
NS_DECL_NSIDOMNODE
|
|
|
|
|
1999-01-12 08:45:23 +00:00
|
|
|
// nsIDOMAttr interface
|
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_NSIDOMATTR
|
2004-01-24 00:46:17 +00:00
|
|
|
|
2011-06-24 02:17:59 +00:00
|
|
|
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
|
2011-06-24 02:17:58 +00:00
|
|
|
|
2003-01-22 03:25:51 +00:00
|
|
|
// nsIAttribute interface
|
2005-06-01 13:46:20 +00:00
|
|
|
void SetMap(nsDOMAttributeMap *aMap);
|
2005-06-06 08:51:40 +00:00
|
|
|
nsIContent *GetContent() const;
|
2005-12-29 03:01:58 +00:00
|
|
|
nsresult SetOwnerDocument(nsIDocument* aDocument);
|
2005-06-06 08:51:40 +00:00
|
|
|
|
2006-01-25 20:49:56 +00:00
|
|
|
// nsINode interface
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool IsNodeOfType(PRUint32 aFlags) const;
|
2006-01-25 20:49:56 +00:00
|
|
|
virtual PRUint32 GetChildCount() const;
|
|
|
|
virtual nsIContent *GetChildAt(PRUint32 aIndex) const;
|
2008-12-03 14:02:03 +00:00
|
|
|
virtual nsIContent * const * GetChildArray(PRUint32* aChildCount) const;
|
2006-05-16 14:51:52 +00:00
|
|
|
virtual PRInt32 IndexOf(nsINode* aPossibleChild) const;
|
2006-01-25 20:49:56 +00:00
|
|
|
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aNotify);
|
|
|
|
virtual nsresult AppendChildTo(nsIContent* aKid, bool aNotify);
|
2012-03-29 21:09:07 +00:00
|
|
|
virtual void RemoveChildAt(PRUint32 aIndex, bool aNotify);
|
2006-09-05 10:22:54 +00:00
|
|
|
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
2010-04-19 15:40:15 +00:00
|
|
|
virtual already_AddRefed<nsIURI> GetBaseURI() const;
|
2006-09-05 10:22:54 +00:00
|
|
|
|
2005-08-19 23:40:42 +00:00
|
|
|
static void Initialize();
|
|
|
|
static void Shutdown();
|
|
|
|
|
2009-05-12 20:20:42 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsDOMAttribute,
|
|
|
|
nsIAttribute)
|
2007-01-04 22:31:26 +00:00
|
|
|
|
2010-07-23 09:49:57 +00:00
|
|
|
virtual nsXPCClassInfo* GetClassInfo();
|
2012-04-25 13:47:30 +00:00
|
|
|
|
|
|
|
virtual nsIDOMNode* AsDOMNode() { return this; }
|
2005-08-19 23:40:42 +00:00
|
|
|
protected:
|
2010-04-19 15:40:16 +00:00
|
|
|
virtual mozilla::dom::Element* GetNameSpaceElement()
|
|
|
|
{
|
2010-07-30 13:42:11 +00:00
|
|
|
return GetContentInternal();
|
2010-04-19 15:40:16 +00:00
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
static bool sInitialized;
|
1999-01-12 08:45:23 +00:00
|
|
|
|
|
|
|
private:
|
2009-12-28 14:35:06 +00:00
|
|
|
already_AddRefed<nsIAtom> GetNameAtom(nsIContent* aContent);
|
2010-07-30 13:42:11 +00:00
|
|
|
mozilla::dom::Element *GetContentInternal() const
|
2005-06-01 13:46:20 +00:00
|
|
|
{
|
|
|
|
return mAttrMap ? mAttrMap->GetContent() : nsnull;
|
|
|
|
}
|
2012-04-03 07:25:39 +00:00
|
|
|
|
|
|
|
nsString mValue;
|
1999-01-12 08:45:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* nsDOMAttribute_h___ */
|