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-01-05 05:50:21 +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_SVGStyleElement_h
|
|
|
|
#define mozilla_dom_SVGStyleElement_h
|
|
|
|
|
2013-05-30 00:43:41 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2018-12-21 11:58:14 +03:00
|
|
|
#include "SVGElement.h"
|
2013-01-05 05:50:21 +04:00
|
|
|
#include "nsStyleLinkElement.h"
|
|
|
|
#include "nsStubMutationObserver.h"
|
|
|
|
|
|
|
|
nsresult NS_NewSVGStyleElement(
|
2014-06-20 06:01:40 +04:00
|
|
|
nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
2013-01-05 05:50:21 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2018-12-21 11:58:14 +03:00
|
|
|
typedef SVGElement SVGStyleElementBase;
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class SVGStyleElement final : public SVGStyleElementBase,
|
2015-03-27 21:52:19 +03:00
|
|
|
public nsStyleLinkElement,
|
|
|
|
public nsStubMutationObserver {
|
2013-01-05 05:50:21 +04:00
|
|
|
protected:
|
|
|
|
friend nsresult(::NS_NewSVGStyleElement(
|
|
|
|
nsIContent** aResult,
|
2014-06-20 06:01:40 +04:00
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
|
2018-09-21 23:45:49 +03:00
|
|
|
explicit SVGStyleElement(
|
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
2014-07-09 01:23:16 +04:00
|
|
|
~SVGStyleElement();
|
2013-01-05 05:50:21 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual JSObject* WrapNode(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) override;
|
2013-01-05 05:50:21 +04:00
|
|
|
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SVGStyleElement, SVGStyleElementBase)
|
|
|
|
|
|
|
|
// nsIContent
|
|
|
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
2018-07-31 21:18:38 +03:00
|
|
|
nsIContent* aBindingParent) override;
|
2013-01-05 05:50:21 +04:00
|
|
|
virtual void UnbindFromTree(bool aDeep = true,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aNullParent = true) override;
|
2018-01-03 22:21:23 +03:00
|
|
|
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
|
|
|
const nsAttrValue* aValue,
|
|
|
|
const nsAttrValue* aOldValue,
|
|
|
|
nsIPrincipal* aMaybeScriptedPrincipal,
|
|
|
|
bool aNotify) override;
|
2013-01-05 05:50:21 +04:00
|
|
|
virtual bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
|
|
|
|
const nsAString& aValue,
|
2017-11-02 06:35:52 +03:00
|
|
|
nsIPrincipal* aMaybeScriptedPrincipal,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsAttrValue& aResult) override;
|
2013-01-05 05:50:21 +04:00
|
|
|
|
2018-08-09 02:58:44 +03:00
|
|
|
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
2013-01-05 05:50:21 +04:00
|
|
|
|
|
|
|
// nsIMutationObserver
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
|
|
|
|
|
|
|
|
// WebIDL
|
2013-02-03 00:23:19 +04:00
|
|
|
void GetXmlspace(nsAString& aXmlspace);
|
2013-01-05 05:50:21 +04:00
|
|
|
void SetXmlspace(const nsAString& aXmlspace, ErrorResult& rv);
|
2013-02-03 00:23:19 +04:00
|
|
|
void GetMedia(nsAString& aMedia);
|
|
|
|
void SetMedia(const nsAString& aMedia, ErrorResult& rv);
|
|
|
|
void GetType(nsAString& aType);
|
|
|
|
void SetType(const nsAString& aType, ErrorResult& rv);
|
|
|
|
void GetTitle(nsAString& aTitle);
|
|
|
|
void SetTitle(const nsAString& aTitle, ErrorResult& rv);
|
2013-01-05 05:50:21 +04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
// Dummy init method to make the NS_IMPL_NS_NEW_SVG_ELEMENT and
|
|
|
|
// NS_IMPL_ELEMENT_CLONE_WITH_INIT usable with this class. This should be
|
|
|
|
// completely optimized away.
|
|
|
|
inline nsresult Init() { return NS_OK; }
|
|
|
|
|
|
|
|
// nsStyleLinkElement overrides
|
2018-05-08 07:11:56 +03:00
|
|
|
Maybe<SheetInfo> GetStyleSheetInfo() final;
|
2013-01-05 05:50:21 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Common method to call from the various mutation observer methods.
|
|
|
|
* aContent is a content node that's either the one that changed or its
|
|
|
|
* parent; we should only respond to the change if aContent is non-anonymous.
|
|
|
|
*/
|
|
|
|
void ContentChanged(nsIContent* aContent);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_SVGStyleElement_h
|