2013-02-03 09:42:39 -08:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* 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_HTMLStyleElement_h
|
|
|
|
#define mozilla_dom_HTMLStyleElement_h
|
|
|
|
|
2013-05-29 13:43:41 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2013-02-03 09:42:39 -08:00
|
|
|
#include "nsIDOMHTMLStyleElement.h"
|
|
|
|
#include "nsGenericHTMLElement.h"
|
|
|
|
#include "nsStyleLinkElement.h"
|
|
|
|
#include "nsStubMutationObserver.h"
|
|
|
|
|
|
|
|
class nsIDocument;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
class HTMLStyleElement MOZ_FINAL : public nsGenericHTMLElement,
|
|
|
|
public nsIDOMHTMLStyleElement,
|
|
|
|
public nsStyleLinkElement,
|
|
|
|
public nsStubMutationObserver
|
|
|
|
{
|
|
|
|
public:
|
2014-09-01 17:49:25 -07:00
|
|
|
explicit HTMLStyleElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
2013-02-03 09:42:39 -08:00
|
|
|
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
// CC
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLStyleElement,
|
|
|
|
nsGenericHTMLElement)
|
|
|
|
|
2013-10-08 12:25:01 -07:00
|
|
|
NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) MOZ_OVERRIDE;
|
2013-08-07 13:23:08 -07:00
|
|
|
using nsGenericHTMLElement::SetInnerHTML;
|
2013-02-03 09:42:39 -08:00
|
|
|
virtual void SetInnerHTML(const nsAString& aInnerHTML,
|
|
|
|
mozilla::ErrorResult& aError) MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
// nsIDOMHTMLStyleElement
|
|
|
|
NS_DECL_NSIDOMHTMLSTYLEELEMENT
|
|
|
|
|
|
|
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
2013-05-29 13:43:41 -07:00
|
|
|
bool aCompileEventHandlers) MOZ_OVERRIDE;
|
2013-02-03 09:42:39 -08:00
|
|
|
virtual void UnbindFromTree(bool aDeep = true,
|
2013-05-29 13:43:41 -07:00
|
|
|
bool aNullParent = true) MOZ_OVERRIDE;
|
2013-02-03 09:42:39 -08: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,
|
2013-05-29 13:43:41 -07:00
|
|
|
bool aNotify) MOZ_OVERRIDE;
|
2013-02-03 09:42:39 -08:00
|
|
|
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
2013-05-29 13:43:41 -07:00
|
|
|
bool aNotify) MOZ_OVERRIDE;
|
2013-02-03 09:42:39 -08:00
|
|
|
|
2014-06-19 19:01:40 -07:00
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
|
2013-02-03 09:42:39 -08:00
|
|
|
|
|
|
|
// nsIMutationObserver
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
|
|
|
|
|
2013-02-03 09:42:40 -08:00
|
|
|
bool Disabled();
|
2013-03-17 07:42:59 -07:00
|
|
|
void SetDisabled(bool aDisabled);
|
2013-02-03 09:42:40 -08:00
|
|
|
void SetMedia(const nsAString& aMedia, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::media, aMedia, aError);
|
|
|
|
}
|
|
|
|
void SetType(const nsAString& aType, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::type, aType, aError);
|
|
|
|
}
|
|
|
|
bool Scoped()
|
|
|
|
{
|
|
|
|
return GetBoolAttr(nsGkAtoms::scoped);
|
|
|
|
}
|
|
|
|
void SetScoped(bool aScoped, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLBoolAttr(nsGkAtoms::scoped, aScoped, aError);
|
|
|
|
}
|
|
|
|
|
2014-04-08 15:27:17 -07:00
|
|
|
virtual JSObject* WrapNode(JSContext *aCx) MOZ_OVERRIDE;
|
2013-02-03 09:42:40 -08:00
|
|
|
|
2013-02-03 09:42:39 -08:00
|
|
|
protected:
|
2014-07-08 14:23:16 -07:00
|
|
|
virtual ~HTMLStyleElement();
|
|
|
|
|
2013-05-29 13:43:41 -07:00
|
|
|
already_AddRefed<nsIURI> GetStyleSheetURL(bool* aIsInline) MOZ_OVERRIDE;
|
2013-02-03 09:42:39 -08:00
|
|
|
void GetStyleSheetInfo(nsAString& aTitle,
|
|
|
|
nsAString& aType,
|
|
|
|
nsAString& aMedia,
|
|
|
|
bool* aIsScoped,
|
2013-05-29 13:43:41 -07:00
|
|
|
bool* aIsAlternate) MOZ_OVERRIDE;
|
2013-02-03 09:42:39 -08: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
|
|
|
|
|