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