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: */
|
2013-02-08 20:34:48 +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/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_HTMLAreaElement_h
|
|
|
|
#define mozilla_dom_HTMLAreaElement_h
|
|
|
|
|
2013-05-30 00:43:41 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2013-07-10 13:56:47 +04:00
|
|
|
#include "mozilla/dom/Link.h"
|
2013-02-08 20:34:48 +04:00
|
|
|
#include "nsGenericHTMLElement.h"
|
|
|
|
#include "nsGkAtoms.h"
|
2014-03-11 16:04:26 +04:00
|
|
|
#include "nsDOMTokenList.h"
|
2013-07-10 13:56:47 +04:00
|
|
|
#include "nsIDOMHTMLAreaElement.h"
|
2013-02-08 20:34:48 +04:00
|
|
|
#include "nsIURL.h"
|
|
|
|
|
2013-03-22 04:05:19 +04:00
|
|
|
class nsIDocument;
|
|
|
|
|
2013-02-08 20:34:48 +04:00
|
|
|
namespace mozilla {
|
2014-03-18 08:48:20 +04:00
|
|
|
class EventChainPostVisitor;
|
2014-03-18 08:48:19 +04:00
|
|
|
class EventChainPreVisitor;
|
2013-02-08 20:34:48 +04:00
|
|
|
namespace dom {
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class HTMLAreaElement final : public nsGenericHTMLElement,
|
2015-03-27 21:52:19 +03:00
|
|
|
public nsIDOMHTMLAreaElement,
|
|
|
|
public Link
|
2013-02-08 20:34:48 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-09-02 04:49:25 +04:00
|
|
|
explicit HTMLAreaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
2013-02-08 20:34:48 +04:00
|
|
|
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2013-12-12 23:30:27 +04:00
|
|
|
// CC
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLAreaElement,
|
|
|
|
nsGenericHTMLElement)
|
|
|
|
|
2013-02-08 20:34:48 +04:00
|
|
|
// DOM memory reporter participant
|
|
|
|
NS_DECL_SIZEOF_EXCLUDING_THIS
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual int32_t TabIndexDefault() override;
|
2013-02-08 20:34:48 +04:00
|
|
|
|
|
|
|
// nsIDOMHTMLAreaElement
|
|
|
|
NS_DECL_NSIDOMHTMLAREAELEMENT
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult PreHandleEvent(EventChainPreVisitor& aVisitor) override;
|
|
|
|
virtual nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) override;
|
|
|
|
virtual bool IsLink(nsIURI** aURI) const override;
|
|
|
|
virtual void GetLinkTarget(nsAString& aTarget) override;
|
|
|
|
virtual already_AddRefed<nsIURI> GetHrefURI() const override;
|
2013-02-08 20:34:48 +04:00
|
|
|
|
|
|
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aCompileEventHandlers) override;
|
2013-02-08 20:34:48 +04:00
|
|
|
virtual void UnbindFromTree(bool aDeep = true,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aNullParent = true) override;
|
2013-02-08 20:34:48 +04:00
|
|
|
nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|
|
|
const nsAString& aValue, bool aNotify)
|
|
|
|
{
|
|
|
|
return SetAttr(aNameSpaceID, aName, nullptr, aValue, aNotify);
|
|
|
|
}
|
|
|
|
virtual nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|
|
|
nsIAtom* aPrefix, const nsAString& aValue,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aNotify) override;
|
2013-02-08 20:34:48 +04:00
|
|
|
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aNotify) override;
|
2013-02-08 20:34:48 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const override;
|
2013-02-08 20:34:48 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual EventStates IntrinsicState() const override;
|
2013-02-08 20:34:48 +04:00
|
|
|
|
2013-02-08 20:34:48 +04:00
|
|
|
// WebIDL
|
|
|
|
|
|
|
|
// The XPCOM GetAlt is OK for us
|
|
|
|
void SetAlt(const nsAString& aAlt, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::alt, aAlt, aError);
|
|
|
|
}
|
|
|
|
|
|
|
|
// The XPCOM GetCoords is OK for us
|
|
|
|
void SetCoords(const nsAString& aCoords, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::coords, aCoords, aError);
|
|
|
|
}
|
|
|
|
|
|
|
|
// The XPCOM GetShape is OK for us
|
|
|
|
void SetShape(const nsAString& aShape, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::shape, aShape, aError);
|
|
|
|
}
|
|
|
|
|
2015-11-23 23:05:26 +03:00
|
|
|
// The XPCOM GetHref is OK for us
|
2013-02-08 21:56:59 +04:00
|
|
|
void SetHref(const nsAString& aHref, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
aError = SetHref(aHref);
|
|
|
|
}
|
2013-02-08 20:34:48 +04:00
|
|
|
|
|
|
|
// The XPCOM GetTarget is OK for us
|
|
|
|
void SetTarget(const nsAString& aTarget, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::target, aTarget, aError);
|
|
|
|
}
|
|
|
|
|
|
|
|
// The XPCOM GetDownload is OK for us
|
|
|
|
void SetDownload(const nsAString& aDownload, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::download, aDownload, aError);
|
|
|
|
}
|
|
|
|
|
|
|
|
// The XPCOM GetPing is OK for us
|
|
|
|
void SetPing(const nsAString& aPing, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::ping, aPing, aError);
|
|
|
|
}
|
2014-03-11 16:04:26 +04:00
|
|
|
|
2015-02-13 04:27:39 +03:00
|
|
|
void GetRel(DOMString& aValue)
|
2014-03-11 16:04:26 +04:00
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::rel, aValue);
|
|
|
|
}
|
2013-02-08 20:34:48 +04:00
|
|
|
|
2014-03-11 16:04:26 +04:00
|
|
|
void SetRel(const nsAString& aRel, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::rel, aRel, aError);
|
|
|
|
}
|
|
|
|
nsDOMTokenList* RelList();
|
2014-07-12 03:30:27 +04:00
|
|
|
|
2015-12-01 03:13:03 +03:00
|
|
|
void SetReferrerPolicy(const nsAString& aValue, mozilla::ErrorResult& rv)
|
2015-06-06 01:25:24 +03:00
|
|
|
{
|
2015-12-01 03:13:03 +03:00
|
|
|
SetHTMLAttr(nsGkAtoms::referrerpolicy, aValue, rv);
|
2015-06-06 01:25:24 +03:00
|
|
|
}
|
2015-12-01 03:13:03 +03:00
|
|
|
void GetReferrerPolicy(nsAString& aReferrer)
|
2015-06-06 01:25:24 +03:00
|
|
|
{
|
2016-04-18 13:35:47 +03:00
|
|
|
GetEnumAttr(nsGkAtoms::referrerpolicy, EmptyCString().get(), aReferrer);
|
2015-06-06 01:25:24 +03:00
|
|
|
}
|
|
|
|
|
2013-12-12 23:30:27 +04:00
|
|
|
// The Link::GetOrigin is OK for us
|
2013-09-04 21:05:10 +04:00
|
|
|
|
2015-11-23 23:05:26 +03:00
|
|
|
// Link::Link::GetProtocol is OK for us
|
|
|
|
// Link::Link::SetProtocol is OK for us
|
2013-02-08 20:34:48 +04:00
|
|
|
|
2013-12-12 23:30:27 +04:00
|
|
|
// The Link::GetUsername is OK for us
|
|
|
|
// The Link::SetUsername is OK for us
|
2013-09-04 21:05:10 +04:00
|
|
|
|
2013-12-12 23:30:27 +04:00
|
|
|
// The Link::GetPassword is OK for us
|
|
|
|
// The Link::SetPassword is OK for us
|
2013-09-04 21:05:10 +04:00
|
|
|
|
2015-11-23 23:05:26 +03:00
|
|
|
// Link::Link::GetHost is OK for us
|
|
|
|
// Link::Link::SetHost is OK for us
|
2013-02-08 20:34:48 +04:00
|
|
|
|
2015-11-23 23:05:26 +03:00
|
|
|
// Link::Link::GetHostname is OK for us
|
|
|
|
// Link::Link::SetHostname is OK for us
|
2013-02-08 20:34:48 +04:00
|
|
|
|
2015-11-23 23:05:26 +03:00
|
|
|
// Link::Link::GetPort is OK for us
|
|
|
|
// Link::Link::SetPort is OK for us
|
2013-02-08 20:34:48 +04:00
|
|
|
|
2015-11-23 23:05:26 +03:00
|
|
|
// Link::Link::GetPathname is OK for us
|
|
|
|
// Link::Link::SetPathname is OK for us
|
2013-02-08 20:34:48 +04:00
|
|
|
|
2015-11-23 23:05:26 +03:00
|
|
|
// Link::Link::GetSearch is OK for us
|
|
|
|
// Link::Link::SetSearch is OK for us
|
2013-02-08 20:34:48 +04:00
|
|
|
|
2015-11-23 23:05:26 +03:00
|
|
|
// Link::Link::GetHash is OK for us
|
|
|
|
// Link::Link::SetHash is OK for us
|
2013-02-08 20:34:48 +04:00
|
|
|
|
2013-12-12 23:30:27 +04:00
|
|
|
// The Link::GetSearchParams is OK for us
|
|
|
|
|
2013-02-08 20:34:48 +04:00
|
|
|
bool NoHref() const
|
|
|
|
{
|
|
|
|
return GetBoolAttr(nsGkAtoms::nohref);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetNoHref(bool aValue, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLBoolAttr(nsGkAtoms::nohref, aValue, aError);
|
|
|
|
}
|
|
|
|
|
2015-11-23 23:05:26 +03:00
|
|
|
void Stringify(nsAString& aResult)
|
2013-03-05 13:46:48 +04:00
|
|
|
{
|
2015-11-23 23:05:26 +03:00
|
|
|
GetHref(aResult);
|
2013-03-05 13:46:48 +04:00
|
|
|
}
|
|
|
|
|
2013-02-08 20:34:48 +04:00
|
|
|
protected:
|
2014-07-09 01:23:16 +04:00
|
|
|
virtual ~HTMLAreaElement();
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2013-02-08 20:34:48 +04:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsDOMTokenList > mRelList;
|
2013-02-08 20:34:48 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif /* mozilla_dom_HTMLAreaElement_h */
|