2016-02-24 10:01:11 +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: */
|
|
|
|
/* 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_ServoStyleSheet_h
|
|
|
|
#define mozilla_ServoStyleSheet_h
|
|
|
|
|
2016-02-26 04:51:01 +03:00
|
|
|
#include "mozilla/dom/SRIMetadata.h"
|
|
|
|
#include "mozilla/RefPtr.h"
|
2016-02-26 05:11:43 +03:00
|
|
|
#include "mozilla/ServoBindingHelpers.h"
|
2016-02-26 04:51:01 +03:00
|
|
|
#include "mozilla/StyleSheet.h"
|
|
|
|
#include "mozilla/StyleSheetInfo.h"
|
2016-02-24 10:01:11 +03:00
|
|
|
#include "nsStringFwd.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* CSS style sheet object that is a wrapper for a Servo Stylesheet.
|
|
|
|
*/
|
2016-02-26 04:51:01 +03:00
|
|
|
class ServoStyleSheet : public StyleSheet
|
2016-02-24 10:01:11 +03:00
|
|
|
{
|
|
|
|
public:
|
2016-08-02 23:12:27 +03:00
|
|
|
ServoStyleSheet(css::SheetParsingMode aParsingMode,
|
|
|
|
CORSMode aCORSMode,
|
2016-02-26 04:51:01 +03:00
|
|
|
net::ReferrerPolicy aReferrerPolicy,
|
|
|
|
const dom::SRIMetadata& aIntegrity);
|
2016-02-24 10:01:11 +03:00
|
|
|
|
2016-10-14 14:25:38 +03:00
|
|
|
NS_DECL_ISUPPORTS
|
2016-02-24 10:01:11 +03:00
|
|
|
|
|
|
|
bool HasRules() const;
|
|
|
|
|
|
|
|
void SetOwningDocument(nsIDocument* aDocument);
|
|
|
|
|
2016-09-26 15:03:25 +03:00
|
|
|
ServoStyleSheet* GetParentSheet() const;
|
|
|
|
void AppendStyleSheet(ServoStyleSheet* aSheet);
|
2016-02-24 10:01:11 +03:00
|
|
|
|
2016-08-31 13:10:10 +03:00
|
|
|
MOZ_MUST_USE nsresult ParseSheet(const nsAString& aInput,
|
|
|
|
nsIURI* aSheetURI,
|
|
|
|
nsIURI* aBaseURI,
|
|
|
|
nsIPrincipal* aSheetPrincipal,
|
|
|
|
uint32_t aLineNumber);
|
2016-02-24 10:01:11 +03:00
|
|
|
|
|
|
|
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
void List(FILE* aOut = stdout, int32_t aIndex = 0) const;
|
|
|
|
#endif
|
|
|
|
|
2016-02-26 05:57:42 +03:00
|
|
|
RawServoStyleSheet* RawSheet() const { return mSheet; }
|
|
|
|
|
2016-10-14 14:25:38 +03:00
|
|
|
// WebIDL StyleSheet API
|
|
|
|
nsMediaList* Media() final;
|
|
|
|
|
|
|
|
// WebIDL CSSStyleSheet API
|
|
|
|
// Can't be inline because we can't include ImportRule here. And can't be
|
|
|
|
// called GetOwnerRule because that would be ambiguous with the ImportRule
|
|
|
|
// version.
|
|
|
|
nsIDOMCSSRule* GetDOMOwnerRule() const final;
|
2016-10-14 14:25:38 +03:00
|
|
|
|
2016-10-14 14:25:38 +03:00
|
|
|
void WillDirty() {}
|
|
|
|
void DidDirty() {}
|
|
|
|
|
2016-02-24 10:01:11 +03:00
|
|
|
protected:
|
2016-02-26 04:51:01 +03:00
|
|
|
~ServoStyleSheet();
|
|
|
|
|
2016-10-14 14:25:38 +03:00
|
|
|
// Internal methods which do not have security check and completeness check.
|
|
|
|
dom::CSSRuleList* GetCssRulesInternal(ErrorResult& aRv);
|
|
|
|
uint32_t InsertRuleInternal(const nsAString& aRule,
|
|
|
|
uint32_t aIndex, ErrorResult& aRv);
|
|
|
|
void DeleteRuleInternal(uint32_t aIndex, ErrorResult& aRv);
|
|
|
|
|
2016-02-26 04:51:01 +03:00
|
|
|
private:
|
|
|
|
void DropSheet();
|
|
|
|
|
|
|
|
RefPtr<RawServoStyleSheet> mSheet;
|
2016-09-29 09:11:52 +03:00
|
|
|
StyleSheetInfo mSheetInfo;
|
|
|
|
|
|
|
|
friend class StyleSheet;
|
2016-02-24 10:01:11 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_ServoStyleSheet_h
|