2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2006-03-30 12:03:04 +04:00
|
|
|
|
|
|
|
/*
|
2018-01-21 20:07:31 +03:00
|
|
|
* Implementation of DOM Core's Attr node.
|
2006-03-30 12:03:04 +04:00
|
|
|
*/
|
|
|
|
|
2013-04-09 19:29:44 +04:00
|
|
|
#ifndef mozilla_dom_Attr_h
|
|
|
|
#define mozilla_dom_Attr_h
|
1999-01-12 11:45:23 +03:00
|
|
|
|
2013-05-30 00:43:41 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2003-01-22 06:25:51 +03:00
|
|
|
#include "nsIAttribute.h"
|
2018-01-21 20:07:31 +03:00
|
|
|
#include "nsIDOMNode.h"
|
1999-01-12 11:45:23 +03:00
|
|
|
#include "nsIDOMText.h"
|
|
|
|
#include "nsIDOMNodeList.h"
|
|
|
|
#include "nsString.h"
|
2000-06-23 04:21:32 +04:00
|
|
|
#include "nsCOMPtr.h"
|
2007-01-05 01:31:26 +03:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2010-05-27 23:10:33 +04:00
|
|
|
#include "nsStubMutationObserver.h"
|
2014-08-18 18:44:50 +04:00
|
|
|
|
|
|
|
class nsIDocument;
|
1999-01-12 11:45:23 +03:00
|
|
|
|
2013-04-09 19:29:44 +04:00
|
|
|
namespace mozilla {
|
2014-03-18 08:48:19 +04:00
|
|
|
class EventChainPreVisitor;
|
2013-04-09 19:29:44 +04:00
|
|
|
namespace dom {
|
|
|
|
|
1999-01-12 11:45:23 +03:00
|
|
|
// Attribute helper class used to wrap up an attribute with a dom
|
2018-01-21 20:07:31 +03:00
|
|
|
// object that implements the DOM Attr interface.
|
2015-03-21 19:28:04 +03:00
|
|
|
class Attr final : public nsIAttribute,
|
2018-01-21 20:07:31 +03:00
|
|
|
public nsIDOMNode
|
1999-01-12 11:45:23 +03:00
|
|
|
{
|
2014-06-25 06:09:15 +04:00
|
|
|
virtual ~Attr() {}
|
|
|
|
|
1999-01-12 11:45:23 +03:00
|
|
|
public:
|
2013-04-09 19:29:44 +04:00
|
|
|
Attr(nsDOMAttributeMap* aAttrMap,
|
2014-06-20 06:01:40 +04:00
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
2016-01-11 21:01:31 +03:00
|
|
|
const nsAString& aValue);
|
1999-01-12 11:45:23 +03:00
|
|
|
|
2007-01-05 01:31:26 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2005-12-03 10:42:40 +03:00
|
|
|
|
2018-01-30 07:10:52 +03:00
|
|
|
// nsINode interface
|
2014-08-05 14:10:00 +04:00
|
|
|
virtual void GetTextContentInternal(nsAString& aTextContent,
|
2017-01-18 07:52:29 +03:00
|
|
|
OOMReporter& aError) override;
|
2012-10-09 16:31:24 +04:00
|
|
|
virtual void SetTextContentInternal(const nsAString& aTextContent,
|
2017-11-08 01:01:21 +03:00
|
|
|
nsIPrincipal* aSubjectPrincipal,
|
2015-03-21 19:28:04 +03:00
|
|
|
ErrorResult& aError) override;
|
|
|
|
virtual void GetNodeValueInternal(nsAString& aNodeValue) override;
|
2012-10-09 16:31:24 +04:00
|
|
|
virtual void SetNodeValueInternal(const nsAString& aNodeValue,
|
2015-03-21 19:28:04 +03:00
|
|
|
ErrorResult& aError) override;
|
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 20:46:42 +04:00
|
|
|
|
2016-10-21 05:11:07 +03:00
|
|
|
virtual nsresult GetEventTargetParent(EventChainPreVisitor& aVisitor) override;
|
2011-06-24 06:17:58 +04:00
|
|
|
|
2003-01-22 06:25:51 +03:00
|
|
|
// nsIAttribute interface
|
2015-03-21 19:28:04 +03:00
|
|
|
void SetMap(nsDOMAttributeMap *aMap) override;
|
2014-04-10 20:09:50 +04:00
|
|
|
Element* GetElement() const;
|
2015-03-21 19:28:04 +03:00
|
|
|
nsresult SetOwnerDocument(nsIDocument* aDocument) override;
|
2005-06-06 12:51:40 +04:00
|
|
|
|
2006-01-25 23:49:56 +03:00
|
|
|
// nsINode interface
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsNodeOfType(uint32_t aFlags) const override;
|
|
|
|
virtual uint32_t GetChildCount() const override;
|
2018-01-03 15:59:54 +03:00
|
|
|
virtual nsIContent *GetChildAt_Deprecated(uint32_t aIndex) const override;
|
2018-01-23 16:30:18 +03:00
|
|
|
virtual int32_t ComputeIndexOf(const nsINode* aPossibleChild) const override;
|
2018-01-25 17:59:42 +03:00
|
|
|
virtual nsresult InsertChildBefore(nsIContent* aKid, nsIContent* aBeforeThis,
|
|
|
|
bool aNotify) override;
|
2018-01-23 16:30:18 +03:00
|
|
|
virtual nsresult InsertChildAt_Deprecated(nsIContent* aKid, uint32_t aIndex,
|
|
|
|
bool aNotify) override;
|
2018-01-03 16:01:03 +03:00
|
|
|
virtual void RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify) override;
|
2018-01-15 19:18:38 +03:00
|
|
|
virtual void RemoveChildNode(nsIContent* aKid, bool aNotify) override;
|
2017-04-20 22:57:48 +03:00
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
|
|
|
|
bool aPreallocateChildren) const override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual already_AddRefed<nsIURI> GetBaseURI(bool aTryUseXHRDocBaseURI = false) const override;
|
2006-09-05 14:22:54 +04:00
|
|
|
|
2005-08-20 03:40:42 +04:00
|
|
|
static void Initialize();
|
|
|
|
static void Shutdown();
|
|
|
|
|
2013-05-07 03:37:47 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(Attr,
|
|
|
|
nsIAttribute)
|
2007-01-05 01:31:26 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIDOMNode* AsDOMNode() override { return this; }
|
2013-04-09 19:29:47 +04:00
|
|
|
|
|
|
|
// WebIDL
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2013-04-09 19:29:47 +04:00
|
|
|
|
2018-01-21 20:07:31 +03:00
|
|
|
void GetName(nsAString& aName);
|
|
|
|
void GetValue(nsAString& aValue);
|
2017-10-10 00:33:38 +03:00
|
|
|
|
|
|
|
void SetValue(const nsAString& aValue, nsIPrincipal* aTriggeringPrincipal, ErrorResult& aRv);
|
2018-01-21 20:07:31 +03:00
|
|
|
void SetValue(const nsAString& aValue, ErrorResult& aRv);
|
2013-04-09 19:29:47 +04:00
|
|
|
|
|
|
|
bool Specified() const;
|
|
|
|
|
|
|
|
// XPCOM GetNamespaceURI() is OK
|
|
|
|
// XPCOM GetPrefix() is OK
|
|
|
|
// XPCOM GetLocalName() is OK
|
|
|
|
|
2014-03-22 00:04:09 +04:00
|
|
|
Element* GetOwnerElement(ErrorResult& aRv);
|
|
|
|
|
2005-08-20 03:40:42 +04:00
|
|
|
protected:
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual Element* GetNameSpaceElement() override
|
2010-04-19 19:40:16 +04:00
|
|
|
{
|
2014-04-10 20:09:50 +04:00
|
|
|
return GetElement();
|
2010-04-19 19:40:16 +04:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool sInitialized;
|
1999-01-12 11:45:23 +03:00
|
|
|
|
|
|
|
private:
|
2012-04-03 11:25:39 +04:00
|
|
|
nsString mValue;
|
1999-01-12 11:45:23 +03:00
|
|
|
};
|
|
|
|
|
2013-04-09 19:29:44 +04:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
1999-01-12 11:45:23 +03:00
|
|
|
|
2013-04-09 19:29:44 +04:00
|
|
|
#endif /* mozilla_dom_Attr_h */
|