2015-05-03 19:32:37 +00: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 16:34:48 +00: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-29 20:43:41 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2013-07-10 09:56:47 +00:00
|
|
|
#include "mozilla/dom/Link.h"
|
2013-02-08 16:34:48 +00:00
|
|
|
#include "nsGenericHTMLElement.h"
|
|
|
|
#include "nsGkAtoms.h"
|
2014-03-11 12:04:26 +00:00
|
|
|
#include "nsDOMTokenList.h"
|
2013-07-10 09:56:47 +00:00
|
|
|
#include "nsIDOMHTMLAreaElement.h"
|
2013-02-08 16:34:48 +00:00
|
|
|
#include "nsIURL.h"
|
|
|
|
|
2013-03-22 00:05:19 +00:00
|
|
|
class nsIDocument;
|
|
|
|
|
2013-02-08 16:34:48 +00:00
|
|
|
namespace mozilla {
|
2014-03-18 04:48:20 +00:00
|
|
|
class EventChainPostVisitor;
|
2014-03-18 04:48:19 +00:00
|
|
|
class EventChainPreVisitor;
|
2013-02-08 16:34:48 +00:00
|
|
|
namespace dom {
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
class HTMLAreaElement final : public nsGenericHTMLElement,
|
2015-03-27 18:52:19 +00:00
|
|
|
public nsIDOMHTMLAreaElement,
|
|
|
|
public Link
|
2013-02-08 16:34:48 +00:00
|
|
|
{
|
|
|
|
public:
|
2014-09-02 00:49:25 +00:00
|
|
|
explicit HTMLAreaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
2013-02-08 16:34:48 +00:00
|
|
|
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2013-12-12 19:30:27 +00:00
|
|
|
// CC
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLAreaElement,
|
|
|
|
nsGenericHTMLElement)
|
|
|
|
|
2013-02-08 16:34:48 +00:00
|
|
|
// DOM memory reporter participant
|
|
|
|
NS_DECL_SIZEOF_EXCLUDING_THIS
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual int32_t TabIndexDefault() override;
|
2013-02-08 16:34:48 +00:00
|
|
|
|
|
|
|
// nsIDOMHTMLAreaElement
|
|
|
|
NS_DECL_NSIDOMHTMLAREAELEMENT
|
|
|
|
|
2015-03-21 16:28:04 +00: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 16:34:48 +00:00
|
|
|
|
|
|
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
2015-03-21 16:28:04 +00:00
|
|
|
bool aCompileEventHandlers) override;
|
2013-02-08 16:34:48 +00:00
|
|
|
virtual void UnbindFromTree(bool aDeep = true,
|
2015-03-21 16:28:04 +00:00
|
|
|
bool aNullParent = true) override;
|
2013-02-08 16:34:48 +00: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 16:28:04 +00:00
|
|
|
bool aNotify) override;
|
2013-02-08 16:34:48 +00:00
|
|
|
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
2015-03-21 16:28:04 +00:00
|
|
|
bool aNotify) override;
|
2013-02-08 16:34:48 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const override;
|
2013-02-08 16:34:48 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual EventStates IntrinsicState() const override;
|
2013-02-08 16:34:48 +00:00
|
|
|
|
2013-02-08 16:34:48 +00: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);
|
|
|
|
}
|
|
|
|
|
2014-07-11 23:30:27 +00:00
|
|
|
void GetHref(nsAString& aHref, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
aError = GetHref(aHref);
|
|
|
|
}
|
2013-02-08 17:56:59 +00:00
|
|
|
void SetHref(const nsAString& aHref, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
aError = SetHref(aHref);
|
|
|
|
}
|
2013-02-08 16:34:48 +00: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 12:04:26 +00:00
|
|
|
|
2015-02-13 01:27:39 +00:00
|
|
|
void GetRel(DOMString& aValue)
|
2014-03-11 12:04:26 +00:00
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::rel, aValue);
|
|
|
|
}
|
2013-02-08 16:34:48 +00:00
|
|
|
|
2014-03-11 12:04:26 +00:00
|
|
|
void SetRel(const nsAString& aRel, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::rel, aRel, aError);
|
|
|
|
}
|
|
|
|
nsDOMTokenList* RelList();
|
2014-07-11 23:30:27 +00:00
|
|
|
|
2013-12-12 19:30:27 +00:00
|
|
|
// The Link::GetOrigin is OK for us
|
2013-09-04 17:05:10 +00:00
|
|
|
|
2014-07-11 23:30:27 +00:00
|
|
|
using Link::GetProtocol;
|
|
|
|
using Link::SetProtocol;
|
2013-02-08 16:34:48 +00:00
|
|
|
|
2013-12-12 19:30:27 +00:00
|
|
|
// The Link::GetUsername is OK for us
|
|
|
|
// The Link::SetUsername is OK for us
|
2013-09-04 17:05:10 +00:00
|
|
|
|
2013-12-12 19:30:27 +00:00
|
|
|
// The Link::GetPassword is OK for us
|
|
|
|
// The Link::SetPassword is OK for us
|
2013-09-04 17:05:10 +00:00
|
|
|
|
2014-07-11 23:30:27 +00:00
|
|
|
using Link::GetHost;
|
|
|
|
using Link::SetHost;
|
2013-02-08 16:34:48 +00:00
|
|
|
|
2014-07-11 23:30:27 +00:00
|
|
|
using Link::GetHostname;
|
|
|
|
using Link::SetHostname;
|
2013-02-08 16:34:48 +00:00
|
|
|
|
2014-07-11 23:30:27 +00:00
|
|
|
using Link::GetPort;
|
|
|
|
using Link::SetPort;
|
2013-02-08 16:34:48 +00:00
|
|
|
|
2014-07-11 23:30:27 +00:00
|
|
|
using Link::GetPathname;
|
|
|
|
using Link::SetPathname;
|
2013-02-08 16:34:48 +00:00
|
|
|
|
2014-07-11 23:30:27 +00:00
|
|
|
using Link::GetSearch;
|
|
|
|
using Link::SetSearch;
|
2013-02-08 16:34:48 +00:00
|
|
|
|
2014-07-11 23:30:27 +00:00
|
|
|
using Link::GetHash;
|
|
|
|
using Link::SetHash;
|
2013-02-08 16:34:48 +00:00
|
|
|
|
2013-12-12 19:30:27 +00:00
|
|
|
// The Link::GetSearchParams is OK for us
|
|
|
|
// The Link::SetSearchParams is OK for us
|
|
|
|
|
2013-02-08 16:34:48 +00:00
|
|
|
bool NoHref() const
|
|
|
|
{
|
|
|
|
return GetBoolAttr(nsGkAtoms::nohref);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetNoHref(bool aValue, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLBoolAttr(nsGkAtoms::nohref, aValue, aError);
|
|
|
|
}
|
|
|
|
|
2014-07-11 23:30:27 +00:00
|
|
|
void Stringify(nsAString& aResult, ErrorResult& aError)
|
2013-03-05 09:46:48 +00:00
|
|
|
{
|
2014-07-11 23:30:27 +00:00
|
|
|
GetHref(aResult, aError);
|
2013-03-05 09:46:48 +00:00
|
|
|
}
|
|
|
|
|
2013-02-08 16:34:48 +00:00
|
|
|
protected:
|
2014-07-08 21:23:16 +00:00
|
|
|
virtual ~HTMLAreaElement();
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2013-02-08 16:34:48 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void GetItemValueText(DOMString& text) override;
|
|
|
|
virtual void SetItemValueText(const nsAString& text) override;
|
2014-03-11 12:04:26 +00:00
|
|
|
nsRefPtr<nsDOMTokenList > mRelList;
|
2013-02-08 16:34:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif /* mozilla_dom_HTMLAreaElement_h */
|