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/. */
|
2009-04-29 08:31:34 +04:00
|
|
|
|
2013-01-10 09:30:13 +04:00
|
|
|
#ifndef mozilla_dom_SVGAElement_h
|
|
|
|
#define mozilla_dom_SVGAElement_h
|
2010-05-27 00:01:10 +04:00
|
|
|
|
2012-01-26 13:57:21 +04:00
|
|
|
#include "Link.h"
|
2018-04-14 16:53:37 +03:00
|
|
|
#include "nsDOMTokenList.h"
|
2019-04-04 20:40:56 +03:00
|
|
|
#include "SVGAnimatedString.h"
|
2013-01-10 09:30:13 +04:00
|
|
|
#include "mozilla/dom/SVGGraphicsElement.h"
|
2009-10-14 02:13:41 +04:00
|
|
|
|
2013-01-10 09:30:13 +04:00
|
|
|
nsresult NS_NewSVGAElement(
|
2014-06-20 06:01:40 +04:00
|
|
|
nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
2009-04-29 08:31:34 +04:00
|
|
|
|
2013-01-10 09:30:13 +04:00
|
|
|
namespace mozilla {
|
2014-03-18 08:48:19 +04:00
|
|
|
|
2014-03-18 08:48:20 +04:00
|
|
|
class EventChainPostVisitor;
|
2014-03-18 08:48:19 +04:00
|
|
|
class EventChainPreVisitor;
|
|
|
|
|
2013-01-10 09:30:13 +04:00
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
typedef SVGGraphicsElement SVGAElementBase;
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class SVGAElement final : public SVGAElementBase, public Link {
|
2009-04-29 08:31:34 +04:00
|
|
|
protected:
|
2018-04-14 16:53:37 +03:00
|
|
|
using Element::GetText;
|
|
|
|
|
2018-09-21 23:45:49 +03:00
|
|
|
explicit SVGAElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
2013-01-10 09:30:13 +04:00
|
|
|
friend nsresult(::NS_NewSVGAElement(
|
|
|
|
nsIContent** aResult,
|
2014-06-20 06:01:40 +04:00
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual JSObject* WrapNode(JSContext* cx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) override;
|
2009-04-29 08:31:34 +04:00
|
|
|
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2018-04-14 16:53:37 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SVGAElement, SVGAElementBase)
|
|
|
|
|
2009-04-29 08:31:34 +04:00
|
|
|
// nsINode interface methods
|
2018-04-05 20:42:41 +03:00
|
|
|
void GetEventTargetParent(EventChainPreVisitor& aVisitor) override;
|
2019-04-02 22:06:11 +03:00
|
|
|
MOZ_CAN_RUN_SCRIPT
|
|
|
|
nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) override;
|
2018-08-09 02:58:44 +03:00
|
|
|
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
2009-04-29 08:31:34 +04:00
|
|
|
|
|
|
|
// nsIContent
|
Bug 1555216 - Change the signature of BindToTree to be (BindContext&, nsINode& aParentNode). r=bzbarsky
BindContext was going to have way more information at first, but then I realized
that most of the things I wanted to know were basically a flag away using the
parent node.
Still I think it's worth it, now experimenting with BindToTree will only mean
adding a field to a struct that's included from a couple cpp files, instead of a
massive pain.
I also think this is clearer, and doing this highlights quite a few
inconsistencies in our code which I've left untouched, but commented with
FIXMEs.
Steps are:
$ for file in $(rg 'nsresult BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's#nsresult BindToTree(Document\* aDocument, nsIContent\* aParent,#nsresult BindToTree(BindContext\&, nsINode\& aParent)#g' $file; done
$ for file in $(rg 'nsresult BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's# nsIContent\* aBindingParent) override#override#g' $file; done
$ for file in $(rg '::BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's#::BindToTree(Document\* aDocument, nsIContent\* aParent,#::BindToTree(BindContext\& aContext, nsINode\& aParent)#g' $file; done
$ for file in $(rg '::BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's#nsIContent\* aBindingParent)##g' $file; done
$ for file in $(rg '::BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's#::BindToTree(aDocument, aParent, aBindingParent)#::BindToTree(aContext, aParent)#g' $file; done
$ ./mach clang-format
Then manual fixups.
Depends on D32948
Differential Revision: https://phabricator.services.mozilla.com/D32949
2019-05-29 07:27:04 +03:00
|
|
|
virtual nsresult BindToTree(BindContext&, nsINode& aParent) override;
|
2019-05-29 01:47:08 +03:00
|
|
|
virtual void UnbindFromTree(bool aNullParent = true) override;
|
2017-10-03 01:05:19 +03:00
|
|
|
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
|
2016-09-28 05:21:50 +03:00
|
|
|
virtual int32_t TabIndexDefault() override;
|
2018-12-19 12:41:11 +03:00
|
|
|
bool IsFocusableInternal(int32_t* aTabIndex, bool aWithMouse) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsLink(nsIURI** aURI) const override;
|
|
|
|
virtual void GetLinkTarget(nsAString& aTarget) override;
|
|
|
|
virtual already_AddRefed<nsIURI> GetHrefURI() const override;
|
|
|
|
virtual EventStates IntrinsicState() const override;
|
2018-01-03 22:21:22 +03:00
|
|
|
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
|
|
|
const nsAttrValue* aValue,
|
|
|
|
const nsAttrValue* aOldValue,
|
|
|
|
nsIPrincipal* aMaybeScriptedPrincipal,
|
|
|
|
bool aNotify) override;
|
2009-04-29 08:31:34 +04:00
|
|
|
|
2017-05-06 22:32:14 +03:00
|
|
|
// Link
|
|
|
|
virtual bool ElementHasHref() const override;
|
|
|
|
|
2013-01-10 09:30:13 +04:00
|
|
|
// WebIDL
|
2019-03-19 03:01:03 +03:00
|
|
|
already_AddRefed<DOMSVGAnimatedString> Href();
|
|
|
|
already_AddRefed<DOMSVGAnimatedString> Target();
|
2018-04-14 16:53:37 +03:00
|
|
|
void GetDownload(nsAString& aDownload);
|
|
|
|
void SetDownload(const nsAString& aDownload, ErrorResult& rv);
|
|
|
|
void GetPing(nsAString& aPing);
|
|
|
|
void SetPing(const nsAString& aPing, mozilla::ErrorResult& rv);
|
|
|
|
void GetRel(nsAString& aRel);
|
|
|
|
void SetRel(const nsAString& aRel, mozilla::ErrorResult& rv);
|
2019-04-27 10:57:50 +03:00
|
|
|
void SetReferrerPolicy(const nsAString& aPolicy, mozilla::ErrorResult& rv);
|
|
|
|
void GetReferrerPolicy(nsAString& aPolicy);
|
2018-04-14 16:53:37 +03:00
|
|
|
nsDOMTokenList* RelList();
|
|
|
|
void GetHreflang(nsAString& aHreflang);
|
|
|
|
void SetHreflang(const nsAString& aHreflang, mozilla::ErrorResult& rv);
|
|
|
|
void GetType(nsAString& aType);
|
|
|
|
void SetType(const nsAString& aType, mozilla::ErrorResult& rv);
|
|
|
|
void GetText(nsAString& aText, mozilla::ErrorResult& rv);
|
|
|
|
void SetText(const nsAString& aText, mozilla::ErrorResult& rv);
|
2013-01-10 09:30:13 +04:00
|
|
|
|
2019-01-02 16:05:23 +03:00
|
|
|
void NodeInfoChanged(Document* aOldDoc) final {
|
2017-04-15 18:55:05 +03:00
|
|
|
ClearHasPendingLinkUpdate();
|
|
|
|
SVGAElementBase::NodeInfoChanged(aOldDoc);
|
|
|
|
}
|
|
|
|
|
2009-04-29 08:31:34 +04:00
|
|
|
protected:
|
2019-04-18 01:38:02 +03:00
|
|
|
virtual ~SVGAElement() = default;
|
2009-04-29 08:31:34 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual StringAttributesInfo GetStringInfo() override;
|
2009-04-29 08:31:34 +04:00
|
|
|
|
2016-06-28 12:22:30 +03:00
|
|
|
enum { HREF, XLINK_HREF, TARGET };
|
2019-04-04 20:40:56 +03:00
|
|
|
SVGAnimatedString mStringAttributes[3];
|
2016-06-28 12:22:30 +03:00
|
|
|
static StringInfo sStringInfo[3];
|
2018-04-14 16:53:37 +03:00
|
|
|
|
|
|
|
RefPtr<nsDOMTokenList> mRelList;
|
|
|
|
static DOMTokenListSupportedToken sSupportedRelValues[];
|
2009-04-29 08:31:34 +04:00
|
|
|
};
|
2010-05-27 00:01:10 +04:00
|
|
|
|
2013-01-10 09:30:13 +04:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_SVGAElement_h
|