2013-02-01 04:28:36 -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_XMLStylesheetProcessingInstruction_h
|
|
|
|
#define mozilla_dom_XMLStylesheetProcessingInstruction_h
|
|
|
|
|
2013-05-29 13:43:41 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2013-02-01 04:28:36 -08:00
|
|
|
#include "mozilla/dom/ProcessingInstruction.h"
|
2014-03-16 23:56:53 -07:00
|
|
|
#include "nsIURI.h"
|
2013-02-01 04:28:36 -08:00
|
|
|
#include "nsStyleLinkElement.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2013-07-11 14:26:54 -07:00
|
|
|
class XMLStylesheetProcessingInstruction MOZ_FINAL
|
|
|
|
: public ProcessingInstruction
|
|
|
|
, public nsStyleLinkElement
|
2013-02-01 04:28:36 -08:00
|
|
|
{
|
|
|
|
public:
|
2014-06-19 19:01:40 -07:00
|
|
|
XMLStylesheetProcessingInstruction(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
2013-02-01 04:28:36 -08:00
|
|
|
const nsAString& aData)
|
2014-03-15 12:00:17 -07:00
|
|
|
: ProcessingInstruction(Move(aNodeInfo), aData)
|
2013-02-01 04:28:36 -08:00
|
|
|
{
|
|
|
|
}
|
2013-04-04 05:01:11 -07:00
|
|
|
|
|
|
|
XMLStylesheetProcessingInstruction(nsNodeInfoManager* aNodeInfoManager,
|
|
|
|
const nsAString& aData)
|
|
|
|
: ProcessingInstruction(aNodeInfoManager->GetNodeInfo(
|
|
|
|
nsGkAtoms::processingInstructionTagName,
|
|
|
|
nullptr, kNameSpaceID_None,
|
|
|
|
nsIDOMNode::PROCESSING_INSTRUCTION_NODE,
|
|
|
|
nsGkAtoms::xml_stylesheet), aData)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-04-08 15:27:17 -07:00
|
|
|
virtual JSObject* WrapNode(JSContext *aCx) MOZ_OVERRIDE;
|
2013-02-01 04:28:37 -08:00
|
|
|
|
2013-02-01 04:28:36 -08:00
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
// CC
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XMLStylesheetProcessingInstruction,
|
|
|
|
ProcessingInstruction)
|
|
|
|
|
|
|
|
// nsIDOMNode
|
|
|
|
virtual void SetNodeValueInternal(const nsAString& aNodeValue,
|
2013-05-29 13:43:41 -07:00
|
|
|
mozilla::ErrorResult& aError) MOZ_OVERRIDE;
|
2013-02-01 04:28:36 -08:00
|
|
|
|
|
|
|
// nsIContent
|
|
|
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
2013-05-29 13:43:41 -07:00
|
|
|
bool aCompileEventHandlers) MOZ_OVERRIDE;
|
2013-02-01 04:28:36 -08:00
|
|
|
virtual void UnbindFromTree(bool aDeep = true,
|
2013-05-29 13:43:41 -07:00
|
|
|
bool aNullParent = true) MOZ_OVERRIDE;
|
2013-02-01 04:28:36 -08:00
|
|
|
|
|
|
|
// nsIStyleSheetLinkingElement
|
2013-05-29 13:43:41 -07:00
|
|
|
virtual void OverrideBaseURI(nsIURI* aNewBaseURI) MOZ_OVERRIDE;
|
2013-02-01 04:28:36 -08:00
|
|
|
|
|
|
|
// nsStyleLinkElement
|
2013-05-29 13:43:41 -07:00
|
|
|
NS_IMETHOD GetCharset(nsAString& aCharset) MOZ_OVERRIDE;
|
2013-02-01 04:28:36 -08:00
|
|
|
|
2013-07-17 07:09:04 -07:00
|
|
|
virtual void SetData(const nsAString& aData, mozilla::ErrorResult& rv) MOZ_OVERRIDE
|
|
|
|
{
|
|
|
|
nsGenericDOMDataNode::SetData(aData, rv);
|
|
|
|
if (rv.Failed()) {
|
|
|
|
return;
|
|
|
|
}
|
2013-12-02 02:26:12 -08:00
|
|
|
UpdateStyleSheetInternal(nullptr, nullptr, true);
|
2013-07-17 07:09:04 -07:00
|
|
|
}
|
|
|
|
using ProcessingInstruction::SetData; // Prevent hiding overloaded virtual function.
|
|
|
|
|
2013-02-01 04:28:36 -08:00
|
|
|
protected:
|
2014-07-08 14:23:16 -07:00
|
|
|
virtual ~XMLStylesheetProcessingInstruction();
|
|
|
|
|
2013-02-01 04:28:36 -08:00
|
|
|
nsCOMPtr<nsIURI> mOverriddenBaseURI;
|
|
|
|
|
2013-05-29 13:43:41 -07:00
|
|
|
already_AddRefed<nsIURI> GetStyleSheetURL(bool* aIsInline) MOZ_OVERRIDE;
|
2013-02-01 04:28:36 -08:00
|
|
|
void GetStyleSheetInfo(nsAString& aTitle,
|
|
|
|
nsAString& aType,
|
|
|
|
nsAString& aMedia,
|
|
|
|
bool* aIsScoped,
|
2013-05-29 13:43:41 -07:00
|
|
|
bool* aIsAlternate) MOZ_OVERRIDE;
|
2014-06-19 19:01:40 -07:00
|
|
|
virtual nsGenericDOMDataNode* CloneDataNode(mozilla::dom::NodeInfo *aNodeInfo,
|
2013-05-29 13:43:41 -07:00
|
|
|
bool aCloneText) const MOZ_OVERRIDE;
|
2013-02-01 04:28:36 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_XMLStylesheetProcessingInstruction_h
|