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"
|
2016-02-24 10:01:11 +03:00
|
|
|
#include "mozilla/StyleSheetHandle.h"
|
2016-02-26 04:51:01 +03:00
|
|
|
#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
|
|
|
|
, public StyleSheetInfo
|
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-02-26 04:51:01 +03:00
|
|
|
NS_INLINE_DECL_REFCOUNTING(ServoStyleSheet)
|
2016-02-24 10:01:11 +03:00
|
|
|
|
|
|
|
bool IsApplicable() const;
|
|
|
|
bool HasRules() const;
|
|
|
|
|
|
|
|
nsIDocument* GetOwningDocument() const;
|
|
|
|
void SetOwningDocument(nsIDocument* aDocument);
|
|
|
|
|
|
|
|
StyleSheetHandle GetParentSheet() const;
|
|
|
|
void AppendStyleSheet(StyleSheetHandle aSheet);
|
|
|
|
|
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-02-24 10:01:11 +03:00
|
|
|
protected:
|
2016-02-26 04:51:01 +03:00
|
|
|
~ServoStyleSheet();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void DropSheet();
|
|
|
|
|
|
|
|
RefPtr<RawServoStyleSheet> mSheet;
|
2016-02-24 10:01:11 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_ServoStyleSheet_h
|