Bug 1304302 part 10 - Replace all uses of StyleSheetHandle. r=heycam

This commit is generated by the following commands with some minor
manual adjustment:

find . \( -name '*.h' -or -name '*.cpp' \) -not -path './layout/style/StyleSheet*' -exec sed -i -b \
  -e '/^\(#include\|using\)/s/StyleSheetHandle/StyleSheet/g' \
  -e 's/\(mozilla::\)\?StyleSheetHandle::RefPtr/RefPtr<\1StyleSheet>/g' \
  -e 's/StyleSheetHandle()/nullptr/g' \
  -e 's/->AsStyleSheet()//g' \
  -e 's/StyleSheetHandle/StyleSheet*/g' {} +
sed -i -b 's/sheet->AsVoidPtr()/sheet.get()/' layout/style/Loader.cpp
sed -i -b 's/AsHandle()/this/' layout/style/StyleSheet.cpp

MozReview-Commit-ID: 7abdvlKHukd

--HG--
extra : source : e5682242db07203b5a91810fe1e243c955310588
This commit is contained in:
Xidorn Quan 2016-09-26 22:03:25 +10:00
parent 4be4e1b982
commit 2f49a48a09
59 changed files with 454 additions and 454 deletions

View File

@ -29,14 +29,14 @@
#include "nsIScriptError.h"
#include "nsIWindowMediator.h"
#include "nsIPrefService.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
nsChromeRegistry* nsChromeRegistry::gChromeRegistry;
// DO NOT use namespace mozilla; it'll break due to a naming conflict between
// mozilla::TextRange and a TextRange in OSX headers.
using mozilla::StyleSheetHandle;
using mozilla::StyleSheet;
using mozilla::dom::IsChromeURI;
////////////////////////////////////////////////////////////////////////////////
@ -402,17 +402,17 @@ nsresult nsChromeRegistry::RefreshWindow(nsPIDOMWindowOuter* aWindow)
nsCOMPtr<nsIPresShell> shell = document->GetShell();
if (shell) {
// Reload only the chrome URL agent style sheets.
nsTArray<StyleSheetHandle::RefPtr> agentSheets;
nsTArray<RefPtr<StyleSheet>> agentSheets;
rv = shell->GetAgentStyleSheets(agentSheets);
NS_ENSURE_SUCCESS(rv, rv);
nsTArray<StyleSheetHandle::RefPtr> newAgentSheets;
for (StyleSheetHandle sheet : agentSheets) {
nsTArray<RefPtr<StyleSheet>> newAgentSheets;
for (StyleSheet* sheet : agentSheets) {
nsIURI* uri = sheet->GetSheetURI();
if (IsChromeURI(uri)) {
// Reload the sheet.
StyleSheetHandle::RefPtr newSheet;
RefPtr<StyleSheet> newSheet;
rv = document->LoadChromeSheetSync(uri, true, &newSheet);
if (NS_FAILED(rv)) return rv;
if (newSheet) {
@ -433,26 +433,26 @@ nsresult nsChromeRegistry::RefreshWindow(nsPIDOMWindowOuter* aWindow)
int32_t count = document->GetNumberOfStyleSheets();
// Build an array of style sheets we need to reload.
nsTArray<StyleSheetHandle::RefPtr> oldSheets(count);
nsTArray<StyleSheetHandle::RefPtr> newSheets(count);
nsTArray<RefPtr<StyleSheet>> oldSheets(count);
nsTArray<RefPtr<StyleSheet>> newSheets(count);
// Iterate over the style sheets.
for (int32_t i = 0; i < count; i++) {
// Get the style sheet
StyleSheetHandle styleSheet = document->GetStyleSheetAt(i);
StyleSheet* styleSheet = document->GetStyleSheetAt(i);
oldSheets.AppendElement(styleSheet);
}
// Iterate over our old sheets and kick off a sync load of the new
// sheet if and only if it's a non-inline sheet with a chrome URL.
for (StyleSheetHandle sheet : oldSheets) {
for (StyleSheet* sheet : oldSheets) {
MOZ_ASSERT(sheet, "GetStyleSheetAt shouldn't return nullptr for "
"in-range sheet indexes");
nsIURI* uri = sheet->GetSheetURI();
if (!sheet->IsInline() && IsChromeURI(uri)) {
// Reload the sheet.
StyleSheetHandle::RefPtr newSheet;
RefPtr<StyleSheet> newSheet;
// XXX what about chrome sheets that have a title or are disabled? This
// only works by sheer dumb luck.
document->LoadChromeSheetSync(uri, false, &newSheet);

View File

@ -17,8 +17,8 @@
#include "mozilla/dom/HTMLContentElement.h"
#include "mozilla/dom/HTMLShadowElement.h"
#include "nsXBLPrototypeBinding.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -132,7 +132,7 @@ ShadowRoot::StyleSheetChanged()
}
void
ShadowRoot::InsertSheet(StyleSheetHandle aSheet,
ShadowRoot::InsertSheet(StyleSheet* aSheet,
nsIContent* aLinkingContent)
{
nsCOMPtr<nsIStyleSheetLinkingElement>
@ -163,7 +163,7 @@ ShadowRoot::InsertSheet(StyleSheetHandle aSheet,
}
void
ShadowRoot::RemoveSheet(StyleSheetHandle aSheet)
ShadowRoot::RemoveSheet(StyleSheet* aSheet)
{
mProtoBinding->RemoveStyleSheet(aSheet);
@ -756,7 +756,7 @@ ShadowRootStyleSheetList::IndexedGetter(uint32_t aIndex, bool& aFound)
// XXXheycam Return null until ServoStyleSheet implements the right
// DOM interfaces.
StyleSheetHandle sheet = mShadowRoot->mProtoBinding->StyleSheetAt(aIndex);
StyleSheet* sheet = mShadowRoot->mProtoBinding->StyleSheetAt(aIndex);
if (sheet->IsServo()) {
NS_ERROR("stylo: can't return ServoStyleSheets to script yet");
return nullptr;

View File

@ -9,7 +9,7 @@
#include "mozilla/dom/DocumentFragment.h"
#include "mozilla/dom/StyleSheetList.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheet.h"
#include "nsCOMPtr.h"
#include "nsCycleCollectionParticipant.h"
#include "nsIContentInlines.h"
@ -47,8 +47,8 @@ public:
void AddToIdTable(Element* aElement, nsIAtom* aId);
void RemoveFromIdTable(Element* aElement, nsIAtom* aId);
void InsertSheet(StyleSheetHandle aSheet, nsIContent* aLinkingContent);
void RemoveSheet(StyleSheetHandle aSheet);
void InsertSheet(StyleSheet* aSheet, nsIContent* aLinkingContent);
void RemoveSheet(StyleSheet* aSheet);
bool ApplyAuthorStyles();
void SetApplyAuthorStyles(bool aApplyAuthorStyles);
StyleSheetList* StyleSheets();

View File

@ -207,7 +207,7 @@ nsContentSink::Init(nsIDocument* aDoc,
}
NS_IMETHODIMP
nsContentSink::StyleSheetLoaded(StyleSheetHandle aSheet,
nsContentSink::StyleSheetLoaded(StyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus)
{

View File

@ -85,7 +85,7 @@ class nsContentSink : public nsICSSLoaderObserver,
NS_DECL_NSITIMERCALLBACK
// nsICSSLoaderObserver
NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheetHandle aSheet,
NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus) override;

View File

@ -250,8 +250,8 @@
#include "nsISupportsPrimitives.h"
#include "mozilla/StyleSetHandle.h"
#include "mozilla/StyleSetHandleInlines.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/DocLoadingTimelineMarker.h"
@ -600,7 +600,7 @@ nsDOMStyleSheetList::IndexedGetter(uint32_t aIndex, bool& aFound)
}
aFound = true;
StyleSheetHandle sheet = mDocument->GetStyleSheetAt(aIndex);
StyleSheet* sheet = mDocument->GetStyleSheetAt(aIndex);
NS_ASSERTION(sheet, "Must have a sheet");
// XXXheycam Return null until ServoStyleSheet implements the right DOM
@ -619,7 +619,7 @@ nsDOMStyleSheetList::NodeWillBeDestroyed(const nsINode *aNode)
}
void
nsDOMStyleSheetList::StyleSheetAdded(StyleSheetHandle aStyleSheet,
nsDOMStyleSheetList::StyleSheetAdded(StyleSheet* aStyleSheet,
bool aDocumentSheet)
{
if (aDocumentSheet && -1 != mLength) {
@ -628,7 +628,7 @@ nsDOMStyleSheetList::StyleSheetAdded(StyleSheetHandle aStyleSheet,
}
void
nsDOMStyleSheetList::StyleSheetRemoved(StyleSheetHandle aStyleSheet,
nsDOMStyleSheetList::StyleSheetRemoved(StyleSheet* aStyleSheet,
bool aDocumentSheet)
{
if (aDocumentSheet && -1 != mLength) {
@ -1196,7 +1196,7 @@ nsDOMStyleSheetSetList::EnsureFresh()
int32_t count = mDocument->GetNumberOfStyleSheets();
nsAutoString title;
for (int32_t index = 0; index < count; index++) {
StyleSheetHandle sheet = mDocument->GetStyleSheetAt(index);
StyleSheet* sheet = mDocument->GetStyleSheetAt(index);
NS_ASSERTION(sheet, "Null sheet in sheet list!");
// XXXheycam ServoStyleSheets don't expose their title yet.
if (sheet->IsServo()) {
@ -1497,7 +1497,7 @@ nsDocument::~nsDocument()
mCachedRootElement = nullptr;
// Let the stylesheets know we're going away
for (StyleSheetHandle sheet : mStyleSheets) {
for (StyleSheet* sheet : mStyleSheets) {
sheet->SetOwningDocument(nullptr);
}
if (mAttrStyleSheet) {
@ -2153,7 +2153,7 @@ void
nsDocument::RemoveDocStyleSheetsFromStyleSets()
{
// The stylesheets should forget us
for (StyleSheetHandle sheet : Reversed(mStyleSheets)) {
for (StyleSheet* sheet : Reversed(mStyleSheets)) {
sheet->SetOwningDocument(nullptr);
if (sheet->IsApplicable()) {
@ -2168,11 +2168,11 @@ nsDocument::RemoveDocStyleSheetsFromStyleSets()
void
nsDocument::RemoveStyleSheetsFromStyleSets(
const nsTArray<StyleSheetHandle::RefPtr>& aSheets,
const nsTArray<RefPtr<StyleSheet>>& aSheets,
SheetType aType)
{
// The stylesheets should forget us
for (StyleSheetHandle sheet : Reversed(aSheets)) {
for (StyleSheet* sheet : Reversed(aSheets)) {
sheet->SetOwningDocument(nullptr);
if (sheet->IsApplicable()) {
@ -2250,10 +2250,10 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
static void
AppendSheetsToStyleSet(StyleSetHandle aStyleSet,
const nsTArray<StyleSheetHandle::RefPtr>& aSheets,
const nsTArray<RefPtr<StyleSheet>>& aSheets,
SheetType aType)
{
for (StyleSheetHandle sheet : Reversed(aSheets)) {
for (StyleSheet* sheet : Reversed(aSheets)) {
aStyleSet->AppendStyleSheet(aType, sheet);
}
}
@ -2268,7 +2268,7 @@ nsDocument::FillStyleSet(StyleSetHandle aStyleSet)
MOZ_ASSERT(!mStyleSetFilled);
for (StyleSheetHandle sheet : Reversed(mStyleSheets)) {
for (StyleSheet* sheet : Reversed(mStyleSheets)) {
if (sheet->IsApplicable()) {
aStyleSet->AddDocStyleSheet(sheet, this);
}
@ -2277,13 +2277,13 @@ nsDocument::FillStyleSet(StyleSetHandle aStyleSet)
if (aStyleSet->IsGecko()) {
nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance();
if (sheetService) {
for (StyleSheetHandle sheet : *sheetService->AuthorStyleSheets()) {
for (StyleSheet* sheet : *sheetService->AuthorStyleSheets()) {
aStyleSet->AppendStyleSheet(SheetType::Doc, sheet);
}
}
// Iterate backwards to maintain order
for (StyleSheetHandle sheet : Reversed(mOnDemandBuiltInUASheets)) {
for (StyleSheet* sheet : Reversed(mOnDemandBuiltInUASheets)) {
if (sheet->IsApplicable()) {
aStyleSet->PrependStyleSheet(SheetType::Agent, sheet);
}
@ -3939,7 +3939,7 @@ nsDocument::RemoveChildAt(uint32_t aIndex, bool aNotify)
}
void
nsDocument::EnsureOnDemandBuiltInUASheet(StyleSheetHandle aSheet)
nsDocument::EnsureOnDemandBuiltInUASheet(StyleSheet* aSheet)
{
if (mOnDemandBuiltInUASheets.Contains(aSheet)) {
return;
@ -3950,7 +3950,7 @@ nsDocument::EnsureOnDemandBuiltInUASheet(StyleSheetHandle aSheet)
}
void
nsDocument::AddOnDemandBuiltInUASheet(StyleSheetHandle aSheet)
nsDocument::AddOnDemandBuiltInUASheet(StyleSheet* aSheet)
{
MOZ_ASSERT(!mOnDemandBuiltInUASheets.Contains(aSheet));
@ -3979,20 +3979,20 @@ nsDocument::GetNumberOfStyleSheets() const
return mStyleSheets.Length();
}
StyleSheetHandle
StyleSheet*
nsDocument::GetStyleSheetAt(int32_t aIndex) const
{
return mStyleSheets.SafeElementAt(aIndex, StyleSheetHandle());
return mStyleSheets.SafeElementAt(aIndex, nullptr);
}
int32_t
nsDocument::GetIndexOfStyleSheet(const StyleSheetHandle aSheet) const
nsDocument::GetIndexOfStyleSheet(const StyleSheet* aSheet) const
{
return mStyleSheets.IndexOf(aSheet);
}
void
nsDocument::AddStyleSheetToStyleSets(StyleSheetHandle aSheet)
nsDocument::AddStyleSheetToStyleSets(StyleSheet* aSheet)
{
nsCOMPtr<nsIPresShell> shell = GetShell();
if (shell) {
@ -4023,7 +4023,7 @@ nsDocument::AddStyleSheetToStyleSets(StyleSheetHandle aSheet)
} while (0);
void
nsDocument::NotifyStyleSheetAdded(StyleSheetHandle aSheet, bool aDocumentSheet)
nsDocument::NotifyStyleSheetAdded(StyleSheet* aSheet, bool aDocumentSheet)
{
NS_DOCUMENT_NOTIFY_OBSERVERS(StyleSheetAdded, (aSheet, aDocumentSheet));
@ -4036,7 +4036,7 @@ nsDocument::NotifyStyleSheetAdded(StyleSheetHandle aSheet, bool aDocumentSheet)
}
void
nsDocument::NotifyStyleSheetRemoved(StyleSheetHandle aSheet, bool aDocumentSheet)
nsDocument::NotifyStyleSheetRemoved(StyleSheet* aSheet, bool aDocumentSheet)
{
NS_DOCUMENT_NOTIFY_OBSERVERS(StyleSheetRemoved, (aSheet, aDocumentSheet));
@ -4049,7 +4049,7 @@ nsDocument::NotifyStyleSheetRemoved(StyleSheetHandle aSheet, bool aDocumentSheet
}
void
nsDocument::AddStyleSheet(StyleSheetHandle aSheet)
nsDocument::AddStyleSheet(StyleSheet* aSheet)
{
NS_PRECONDITION(aSheet, "null arg");
mStyleSheets.AppendElement(aSheet);
@ -4063,7 +4063,7 @@ nsDocument::AddStyleSheet(StyleSheetHandle aSheet)
}
void
nsDocument::RemoveStyleSheetFromStyleSets(StyleSheetHandle aSheet)
nsDocument::RemoveStyleSheetFromStyleSets(StyleSheet* aSheet)
{
nsCOMPtr<nsIPresShell> shell = GetShell();
if (shell) {
@ -4072,10 +4072,10 @@ nsDocument::RemoveStyleSheetFromStyleSets(StyleSheetHandle aSheet)
}
void
nsDocument::RemoveStyleSheet(StyleSheetHandle aSheet)
nsDocument::RemoveStyleSheet(StyleSheet* aSheet)
{
NS_PRECONDITION(aSheet, "null arg");
StyleSheetHandle::RefPtr sheet = aSheet; // hold ref so it won't die too soon
RefPtr<StyleSheet> sheet = aSheet; // hold ref so it won't die too soon
if (!mStyleSheets.RemoveElement(aSheet)) {
NS_ASSERTION(mInUnlinkOrDeletion, "stylesheet not found");
@ -4094,8 +4094,8 @@ nsDocument::RemoveStyleSheet(StyleSheetHandle aSheet)
}
void
nsDocument::UpdateStyleSheets(nsTArray<StyleSheetHandle::RefPtr>& aOldSheets,
nsTArray<StyleSheetHandle::RefPtr>& aNewSheets)
nsDocument::UpdateStyleSheets(nsTArray<RefPtr<StyleSheet>>& aOldSheets,
nsTArray<RefPtr<StyleSheet>>& aNewSheets)
{
BeginUpdate(UPDATE_STYLE);
@ -4104,7 +4104,7 @@ nsDocument::UpdateStyleSheets(nsTArray<StyleSheetHandle::RefPtr>& aOldSheets,
"The lists must be the same length!");
int32_t count = aOldSheets.Length();
StyleSheetHandle::RefPtr oldSheet;
RefPtr<StyleSheet> oldSheet;
int32_t i;
for (i = 0; i < count; ++i) {
oldSheet = aOldSheets[i];
@ -4115,7 +4115,7 @@ nsDocument::UpdateStyleSheets(nsTArray<StyleSheetHandle::RefPtr>& aOldSheets,
RemoveStyleSheet(oldSheet); // This does the right notifications
// Now put the new one in its place. If it's null, just ignore it.
StyleSheetHandle newSheet = aNewSheets[i];
StyleSheet* newSheet = aNewSheets[i];
if (newSheet) {
mStyleSheets.InsertElementAt(oldIndex, newSheet);
newSheet->SetOwningDocument(this);
@ -4131,7 +4131,7 @@ nsDocument::UpdateStyleSheets(nsTArray<StyleSheetHandle::RefPtr>& aOldSheets,
}
void
nsDocument::InsertStyleSheetAt(StyleSheetHandle aSheet, int32_t aIndex)
nsDocument::InsertStyleSheetAt(StyleSheet* aSheet, int32_t aIndex)
{
NS_PRECONDITION(aSheet, "null ptr");
@ -4148,7 +4148,7 @@ nsDocument::InsertStyleSheetAt(StyleSheetHandle aSheet, int32_t aIndex)
void
nsDocument::SetStyleSheetApplicableState(StyleSheetHandle aSheet,
nsDocument::SetStyleSheetApplicableState(StyleSheet* aSheet,
bool aApplicable)
{
NS_PRECONDITION(aSheet, "null arg");
@ -4214,7 +4214,7 @@ ConvertAdditionalSheetType(nsIDocument::additionalSheetType aType)
}
static int32_t
FindSheet(const nsTArray<StyleSheetHandle::RefPtr>& aSheets, nsIURI* aSheetURI)
FindSheet(const nsTArray<RefPtr<StyleSheet>>& aSheets, nsIURI* aSheetURI)
{
for (int32_t i = aSheets.Length() - 1; i >= 0; i-- ) {
bool bEqual;
@ -4258,7 +4258,7 @@ nsDocument::LoadAdditionalStyleSheet(additionalSheetType aType,
MOZ_CRASH("impossible value for aType");
}
StyleSheetHandle::RefPtr sheet;
RefPtr<StyleSheet> sheet;
nsresult rv = loader->LoadSheetSync(aSheetURI, parsingMode, true, &sheet);
NS_ENSURE_SUCCESS(rv, rv);
@ -4269,7 +4269,7 @@ nsDocument::LoadAdditionalStyleSheet(additionalSheetType aType,
}
nsresult
nsDocument::AddAdditionalStyleSheet(additionalSheetType aType, StyleSheetHandle aSheet)
nsDocument::AddAdditionalStyleSheet(additionalSheetType aType, StyleSheet* aSheet)
{
if (mAdditionalSheets[aType].Contains(aSheet))
return NS_ERROR_INVALID_ARG;
@ -4298,11 +4298,11 @@ nsDocument::RemoveAdditionalStyleSheet(additionalSheetType aType, nsIURI* aSheet
{
MOZ_ASSERT(aSheetURI);
nsTArray<StyleSheetHandle::RefPtr>& sheets = mAdditionalSheets[aType];
nsTArray<RefPtr<StyleSheet>>& sheets = mAdditionalSheets[aType];
int32_t i = FindSheet(mAdditionalSheets[aType], aSheetURI);
if (i >= 0) {
StyleSheetHandle::RefPtr sheetRef = sheets[i];
RefPtr<StyleSheet> sheetRef = sheets[i];
sheets.RemoveElementAt(i);
BeginUpdate(UPDATE_STYLE);
@ -4324,10 +4324,10 @@ nsDocument::RemoveAdditionalStyleSheet(additionalSheetType aType, nsIURI* aSheet
}
}
StyleSheetHandle
StyleSheet*
nsDocument::GetFirstAdditionalAuthorSheet()
{
return mAdditionalSheets[eAuthorSheet].SafeElementAt(0, StyleSheetHandle());
return mAdditionalSheets[eAuthorSheet].SafeElementAt(0);
}
nsIGlobalObject*
@ -5132,7 +5132,7 @@ nsDocument::DocumentStatesChanged(EventStates aStateMask)
}
void
nsDocument::StyleRuleChanged(StyleSheetHandle aSheet,
nsDocument::StyleRuleChanged(StyleSheet* aSheet,
css::Rule* aStyleRule)
{
NS_DOCUMENT_NOTIFY_OBSERVERS(StyleRuleChanged, (aSheet));
@ -5146,7 +5146,7 @@ nsDocument::StyleRuleChanged(StyleSheetHandle aSheet,
}
void
nsDocument::StyleRuleAdded(StyleSheetHandle aSheet,
nsDocument::StyleRuleAdded(StyleSheet* aSheet,
css::Rule* aStyleRule)
{
NS_DOCUMENT_NOTIFY_OBSERVERS(StyleRuleAdded, (aSheet));
@ -5161,7 +5161,7 @@ nsDocument::StyleRuleAdded(StyleSheetHandle aSheet,
}
void
nsDocument::StyleRuleRemoved(StyleSheetHandle aSheet,
nsDocument::StyleRuleRemoved(StyleSheet* aSheet,
css::Rule* aStyleRule)
{
NS_DOCUMENT_NOTIFY_OBSERVERS(StyleRuleRemoved, (aSheet));
@ -6029,7 +6029,7 @@ nsIDocument::GetSelectedStyleSheetSet(nsAString& aSheetSet)
int32_t count = GetNumberOfStyleSheets();
nsAutoString title;
for (int32_t index = 0; index < count; index++) {
StyleSheetHandle sheet = GetStyleSheetAt(index);
StyleSheet* sheet = GetStyleSheetAt(index);
NS_ASSERTION(sheet, "Null sheet in sheet list!");
// XXXheycam Make this work with ServoStyleSheets.
@ -6149,7 +6149,7 @@ nsDocument::EnableStyleSheetsForSetInternal(const nsAString& aSheetSet,
int32_t count = GetNumberOfStyleSheets();
nsAutoString title;
for (int32_t index = 0; index < count; index++) {
StyleSheetHandle sheet = GetStyleSheetAt(index);
StyleSheet* sheet = GetStyleSheetAt(index);
NS_ASSERTION(sheet, "Null sheet in sheet list!");
// XXXheycam Make this work with ServoStyleSheets.
@ -9432,7 +9432,7 @@ class StubCSSLoaderObserver final : public nsICSSLoaderObserver {
~StubCSSLoaderObserver() {}
public:
NS_IMETHOD
StyleSheetLoaded(StyleSheetHandle, bool, nsresult) override
StyleSheetLoaded(StyleSheet*, bool, nsresult) override
{
return NS_OK;
}
@ -9461,7 +9461,7 @@ nsDocument::PreloadStyle(nsIURI* uri, const nsAString& charset,
nsresult
nsDocument::LoadChromeSheetSync(nsIURI* uri, bool isAgentSheet,
mozilla::StyleSheetHandle::RefPtr* aSheet)
RefPtr<mozilla::StyleSheet>* aSheet)
{
css::SheetParsingMode mode =
isAgentSheet ? css::eAgentSheetFeatures
@ -9797,7 +9797,7 @@ nsIDocument::CreateStaticClone(nsIDocShell* aCloneContainer)
int32_t sheetsCount = GetNumberOfStyleSheets();
for (int32_t i = 0; i < sheetsCount; ++i) {
StyleSheetHandle::RefPtr sheet = GetStyleSheetAt(i);
RefPtr<StyleSheet> sheet = GetStyleSheetAt(i);
if (sheet) {
if (sheet->IsApplicable()) {
// XXXheycam Need to make ServoStyleSheet cloning work.
@ -9817,7 +9817,7 @@ nsIDocument::CreateStaticClone(nsIDocShell* aCloneContainer)
}
// Iterate backwards to maintain order
for (StyleSheetHandle sheet : Reversed(thisAsDoc->mOnDemandBuiltInUASheets)) {
for (StyleSheet* sheet : Reversed(thisAsDoc->mOnDemandBuiltInUASheets)) {
if (sheet) {
if (sheet->IsApplicable()) {
// XXXheycam Need to make ServoStyleSheet cloning work.
@ -12009,7 +12009,7 @@ nsDocument::OnAppThemeChanged()
}
for (int32_t i = 0; i < GetNumberOfStyleSheets(); i++) {
StyleSheetHandle::RefPtr sheet = GetStyleSheetAt(i);
RefPtr<StyleSheet> sheet = GetStyleSheetAt(i);
if (!sheet) {
continue;
}
@ -12164,12 +12164,12 @@ nsIDocument::DocAddSizeOfIncludingThis(nsWindowSizes* aWindowSizes) const
}
static size_t
SizeOfOwnedSheetArrayExcludingThis(const nsTArray<StyleSheetHandle::RefPtr>& aSheets,
SizeOfOwnedSheetArrayExcludingThis(const nsTArray<RefPtr<StyleSheet>>& aSheets,
MallocSizeOf aMallocSizeOf)
{
size_t n = 0;
n += aSheets.ShallowSizeOfExcludingThis(aMallocSizeOf);
for (StyleSheetHandle sheet : aSheets) {
for (StyleSheet* sheet : aSheets) {
if (!sheet->GetOwningDocument()) {
// Avoid over-reporting shared sheets.
continue;

View File

@ -621,37 +621,37 @@ public:
virtual Element* FindContentForSubDocument(nsIDocument *aDocument) const override;
virtual Element* GetRootElementInternal() const override;
virtual void EnsureOnDemandBuiltInUASheet(mozilla::StyleSheetHandle aSheet) override;
virtual void EnsureOnDemandBuiltInUASheet(mozilla::StyleSheet* aSheet) override;
/**
* Get the (document) style sheets owned by this document.
* These are ordered, highest priority last
*/
virtual int32_t GetNumberOfStyleSheets() const override;
virtual mozilla::StyleSheetHandle GetStyleSheetAt(int32_t aIndex) const override;
virtual mozilla::StyleSheet* GetStyleSheetAt(int32_t aIndex) const override;
virtual int32_t GetIndexOfStyleSheet(
const mozilla::StyleSheetHandle aSheet) const override;
virtual void AddStyleSheet(mozilla::StyleSheetHandle aSheet) override;
virtual void RemoveStyleSheet(mozilla::StyleSheetHandle aSheet) override;
const mozilla::StyleSheet* aSheet) const override;
virtual void AddStyleSheet(mozilla::StyleSheet* aSheet) override;
virtual void RemoveStyleSheet(mozilla::StyleSheet* aSheet) override;
virtual void UpdateStyleSheets(
nsTArray<mozilla::StyleSheetHandle::RefPtr>& aOldSheets,
nsTArray<mozilla::StyleSheetHandle::RefPtr>& aNewSheets) override;
virtual void AddStyleSheetToStyleSets(mozilla::StyleSheetHandle aSheet);
virtual void RemoveStyleSheetFromStyleSets(mozilla::StyleSheetHandle aSheet);
nsTArray<RefPtr<mozilla::StyleSheet>>& aOldSheets,
nsTArray<RefPtr<mozilla::StyleSheet>>& aNewSheets) override;
virtual void AddStyleSheetToStyleSets(mozilla::StyleSheet* aSheet);
virtual void RemoveStyleSheetFromStyleSets(mozilla::StyleSheet* aSheet);
virtual void InsertStyleSheetAt(mozilla::StyleSheetHandle aSheet,
virtual void InsertStyleSheetAt(mozilla::StyleSheet* aSheet,
int32_t aIndex) override;
virtual void SetStyleSheetApplicableState(mozilla::StyleSheetHandle aSheet,
virtual void SetStyleSheetApplicableState(mozilla::StyleSheet* aSheet,
bool aApplicable) override;
virtual nsresult LoadAdditionalStyleSheet(additionalSheetType aType,
nsIURI* aSheetURI) override;
virtual nsresult AddAdditionalStyleSheet(additionalSheetType aType,
mozilla::StyleSheetHandle aSheet) override;
mozilla::StyleSheet* aSheet) override;
virtual void RemoveAdditionalStyleSheet(additionalSheetType aType,
nsIURI* sheetURI) override;
virtual mozilla::StyleSheetHandle GetFirstAdditionalAuthorSheet() override;
virtual mozilla::StyleSheet* GetFirstAdditionalAuthorSheet() override;
virtual nsIChannel* GetChannel() const override {
return mChannel;
@ -711,11 +711,11 @@ public:
virtual void DocumentStatesChanged(
mozilla::EventStates aStateMask) override;
virtual void StyleRuleChanged(mozilla::StyleSheetHandle aStyleSheet,
virtual void StyleRuleChanged(mozilla::StyleSheet* aStyleSheet,
mozilla::css::Rule* aStyleRule) override;
virtual void StyleRuleAdded(mozilla::StyleSheetHandle aStyleSheet,
virtual void StyleRuleAdded(mozilla::StyleSheet* aStyleSheet,
mozilla::css::Rule* aStyleRule) override;
virtual void StyleRuleRemoved(mozilla::StyleSheetHandle aStyleSheet,
virtual void StyleRuleRemoved(mozilla::StyleSheet* aStyleSheet,
mozilla::css::Rule* aStyleRule) override;
virtual void FlushPendingNotifications(mozFlushType aType) override;
@ -787,7 +787,7 @@ public:
void ReportUseCounters();
private:
void AddOnDemandBuiltInUASheet(mozilla::StyleSheetHandle aSheet);
void AddOnDemandBuiltInUASheet(mozilla::StyleSheet* aSheet);
nsRadioGroupStruct* GetRadioGroupInternal(const nsAString& aName) const;
void SendToConsole(nsCOMArray<nsISecurityConsoleMessage>& aMessages);
@ -970,7 +970,7 @@ public:
const nsAString& aIntegrity) override;
virtual nsresult LoadChromeSheetSync(nsIURI* uri, bool isAgentSheet,
mozilla::StyleSheetHandle::RefPtr* aSheet) override;
RefPtr<mozilla::StyleSheet>* aSheet) override;
virtual nsISupports* GetCurrentContentSink() override;
@ -1288,7 +1288,7 @@ protected:
void RemoveDocStyleSheetsFromStyleSets();
void RemoveStyleSheetsFromStyleSets(
const nsTArray<mozilla::StyleSheetHandle::RefPtr>& aSheets,
const nsTArray<RefPtr<mozilla::StyleSheet>>& aSheets,
mozilla::SheetType aType);
void ResetStylesheetsToURI(nsIURI* aURI);
void FillStyleSet(mozilla::StyleSetHandle aStyleSet);
@ -1342,9 +1342,9 @@ protected:
// EndLoad() has already happened.
nsWeakPtr mWeakSink;
nsTArray<mozilla::StyleSheetHandle::RefPtr> mStyleSheets;
nsTArray<mozilla::StyleSheetHandle::RefPtr> mOnDemandBuiltInUASheets;
nsTArray<mozilla::StyleSheetHandle::RefPtr> mAdditionalSheets[AdditionalSheetTypeCount];
nsTArray<RefPtr<mozilla::StyleSheet>> mStyleSheets;
nsTArray<RefPtr<mozilla::StyleSheet>> mOnDemandBuiltInUASheets;
nsTArray<RefPtr<mozilla::StyleSheet>> mAdditionalSheets[AdditionalSheetTypeCount];
// Array of observers
nsTObserverArray<nsIDocumentObserver*> mObservers;
@ -1498,8 +1498,8 @@ private:
friend class nsUnblockOnloadEvent;
// Recomputes the visibility state but doesn't set the new value.
mozilla::dom::VisibilityState GetVisibilityState() const;
void NotifyStyleSheetAdded(mozilla::StyleSheetHandle aSheet, bool aDocumentSheet);
void NotifyStyleSheetRemoved(mozilla::StyleSheetHandle aSheet, bool aDocumentSheet);
void NotifyStyleSheetAdded(mozilla::StyleSheet* aSheet, bool aDocumentSheet);
void NotifyStyleSheetRemoved(mozilla::StyleSheet* aSheet, bool aDocumentSheet);
void PostUnblockOnloadEvent();
void DoUnblockOnload();

View File

@ -34,7 +34,7 @@
#include "mozilla/UniquePtr.h"
#include "mozilla/CORSMode.h"
#include "mozilla/StyleBackendType.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheet.h"
#include <bitset> // for member
#ifdef MOZILLA_INTERNAL_API
@ -997,7 +997,7 @@ public:
* TODO We can get rid of the whole concept of delayed loading if we fix
* bug 77999.
*/
virtual void EnsureOnDemandBuiltInUASheet(mozilla::StyleSheetHandle aSheet) = 0;
virtual void EnsureOnDemandBuiltInUASheet(mozilla::StyleSheet* aSheet) = 0;
/**
* Get the number of (document) stylesheets
@ -1013,7 +1013,7 @@ public:
* @return the stylesheet at aIndex. Null if aIndex is out of range.
* @throws no exceptions
*/
virtual mozilla::StyleSheetHandle GetStyleSheetAt(int32_t aIndex) const = 0;
virtual mozilla::StyleSheet* GetStyleSheetAt(int32_t aIndex) const = 0;
/**
* Insert a sheet at a particular spot in the stylesheet list (zero-based)
@ -1022,7 +1022,7 @@ public:
* adjusted for the "special" sheets.
* @throws no exceptions
*/
virtual void InsertStyleSheetAt(mozilla::StyleSheetHandle aSheet,
virtual void InsertStyleSheetAt(mozilla::StyleSheet* aSheet,
int32_t aIndex) = 0;
/**
@ -1032,7 +1032,7 @@ public:
* @return aIndex the index of the sheet in the full list
*/
virtual int32_t GetIndexOfStyleSheet(
const mozilla::StyleSheetHandle aSheet) const = 0;
const mozilla::StyleSheet* aSheet) const = 0;
/**
* Replace the stylesheets in aOldSheets with the stylesheets in
@ -1043,24 +1043,24 @@ public:
* will simply be removed.
*/
virtual void UpdateStyleSheets(
nsTArray<mozilla::StyleSheetHandle::RefPtr>& aOldSheets,
nsTArray<mozilla::StyleSheetHandle::RefPtr>& aNewSheets) = 0;
nsTArray<RefPtr<mozilla::StyleSheet>>& aOldSheets,
nsTArray<RefPtr<mozilla::StyleSheet>>& aNewSheets) = 0;
/**
* Add a stylesheet to the document
*/
virtual void AddStyleSheet(mozilla::StyleSheetHandle aSheet) = 0;
virtual void AddStyleSheet(mozilla::StyleSheet* aSheet) = 0;
/**
* Remove a stylesheet from the document
*/
virtual void RemoveStyleSheet(mozilla::StyleSheetHandle aSheet) = 0;
virtual void RemoveStyleSheet(mozilla::StyleSheet* aSheet) = 0;
/**
* Notify the document that the applicable state of the sheet changed
* and that observers should be notified and style sets updated
*/
virtual void SetStyleSheetApplicableState(mozilla::StyleSheetHandle aSheet,
virtual void SetStyleSheetApplicableState(mozilla::StyleSheet* aSheet,
bool aApplicable) = 0;
enum additionalSheetType {
@ -1073,10 +1073,10 @@ public:
virtual nsresult LoadAdditionalStyleSheet(additionalSheetType aType,
nsIURI* aSheetURI) = 0;
virtual nsresult AddAdditionalStyleSheet(additionalSheetType aType,
mozilla::StyleSheetHandle aSheet) = 0;
mozilla::StyleSheet* aSheet) = 0;
virtual void RemoveAdditionalStyleSheet(additionalSheetType aType,
nsIURI* sheetURI) = 0;
virtual mozilla::StyleSheetHandle GetFirstAdditionalAuthorSheet() = 0;
virtual mozilla::StyleSheet* GetFirstAdditionalAuthorSheet() = 0;
/**
* Assuming that aDocSheets is an array of document-level style
@ -1397,11 +1397,11 @@ public:
// Observation hooks for style data to propagate notifications
// to document observers
virtual void StyleRuleChanged(mozilla::StyleSheetHandle aStyleSheet,
virtual void StyleRuleChanged(mozilla::StyleSheet* aStyleSheet,
mozilla::css::Rule* aStyleRule) = 0;
virtual void StyleRuleAdded(mozilla::StyleSheetHandle aStyleSheet,
virtual void StyleRuleAdded(mozilla::StyleSheet* aStyleSheet,
mozilla::css::Rule* aStyleRule) = 0;
virtual void StyleRuleRemoved(mozilla::StyleSheetHandle aStyleSheet,
virtual void StyleRuleRemoved(mozilla::StyleSheet* aStyleSheet,
mozilla::css::Rule* aStyleRule) = 0;
/**
@ -2209,7 +2209,7 @@ public:
* DO NOT USE FOR UNTRUSTED CONTENT.
*/
virtual nsresult LoadChromeSheetSync(nsIURI* aURI, bool aIsAgentSheet,
mozilla::StyleSheetHandle::RefPtr* aSheet) = 0;
RefPtr<mozilla::StyleSheet>* aSheet) = 0;
/**
* Returns true if the locale used for the document specifies a direction of

View File

@ -35,7 +35,7 @@ nsIDocument::FindDocStyleSheetInsertionPoint(
if (sheetDocIndex > newDocIndex)
break;
mozilla::StyleSheetHandle sheetHandle = sheet;
mozilla::StyleSheet* sheetHandle = sheet;
// If the sheet is not owned by the document it can be an author
// sheet registered at nsStyleSheetService or an additional author

View File

@ -7,7 +7,7 @@
#define nsIDocumentObserver_h___
#include "mozilla/EventStates.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheet.h"
#include "nsISupports.h"
#include "nsIMutationObserver.h"
@ -100,7 +100,7 @@ public:
* @param aDocumentSheet True if sheet is in document's style sheet list,
* false if sheet is not (i.e., UA or user sheet)
*/
virtual void StyleSheetAdded(mozilla::StyleSheetHandle aStyleSheet,
virtual void StyleSheetAdded(mozilla::StyleSheet* aStyleSheet,
bool aDocumentSheet) = 0;
/**
@ -113,7 +113,7 @@ public:
* @param aDocumentSheet True if sheet is in document's style sheet list,
* false if sheet is not (i.e., UA or user sheet)
*/
virtual void StyleSheetRemoved(mozilla::StyleSheetHandle aStyleSheet,
virtual void StyleSheetRemoved(mozilla::StyleSheet* aStyleSheet,
bool aDocumentSheet) = 0;
/**
@ -125,7 +125,7 @@ public:
*
* @param aStyleSheet the StyleSheet that has changed state
*/
virtual void StyleSheetApplicableStateChanged(mozilla::StyleSheetHandle aStyleSheet) = 0;
virtual void StyleSheetApplicableStateChanged(mozilla::StyleSheet* aStyleSheet) = 0;
/**
* A StyleRule has just been modified within a style sheet.
@ -136,7 +136,7 @@ public:
*
* @param aStyleSheet the StyleSheet that contians the rule
*/
virtual void StyleRuleChanged(mozilla::StyleSheetHandle aStyleSheet) = 0;
virtual void StyleRuleChanged(mozilla::StyleSheet* aStyleSheet) = 0;
/**
* A StyleRule has just been added to a style sheet.
@ -147,7 +147,7 @@ public:
*
* @param aStyleSheet the StyleSheet that has been modified
*/
virtual void StyleRuleAdded(mozilla::StyleSheetHandle aStyleSheet) = 0;
virtual void StyleRuleAdded(mozilla::StyleSheet* aStyleSheet) = 0;
/**
* A StyleRule has just been removed from a style sheet.
@ -158,7 +158,7 @@ public:
*
* @param aStyleSheet the StyleSheet that has been modified
*/
virtual void StyleRuleRemoved(mozilla::StyleSheetHandle aStyleSheet) = 0;
virtual void StyleRuleRemoved(mozilla::StyleSheet* aStyleSheet) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumentObserver, NS_IDOCUMENT_OBSERVER_IID)
@ -186,25 +186,25 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumentObserver, NS_IDOCUMENT_OBSERVER_IID)
mozilla::EventStates aStateMask) override;
#define NS_DECL_NSIDOCUMENTOBSERVER_STYLESHEETADDED \
virtual void StyleSheetAdded(mozilla::StyleSheetHandle aStyleSheet, \
virtual void StyleSheetAdded(mozilla::StyleSheet* aStyleSheet, \
bool aDocumentSheet) override;
#define NS_DECL_NSIDOCUMENTOBSERVER_STYLESHEETREMOVED \
virtual void StyleSheetRemoved(mozilla::StyleSheetHandle aStyleSheet, \
virtual void StyleSheetRemoved(mozilla::StyleSheet* aStyleSheet, \
bool aDocumentSheet) override;
#define NS_DECL_NSIDOCUMENTOBSERVER_STYLESHEETAPPLICABLESTATECHANGED \
virtual void StyleSheetApplicableStateChanged( \
mozilla::StyleSheetHandle aStyleSheet) override;
mozilla::StyleSheet* aStyleSheet) override;
#define NS_DECL_NSIDOCUMENTOBSERVER_STYLERULECHANGED \
virtual void StyleRuleChanged(mozilla::StyleSheetHandle aStyleSheet) override;
virtual void StyleRuleChanged(mozilla::StyleSheet* aStyleSheet) override;
#define NS_DECL_NSIDOCUMENTOBSERVER_STYLERULEADDED \
virtual void StyleRuleAdded(mozilla::StyleSheetHandle aStyleSheet) override;
virtual void StyleRuleAdded(mozilla::StyleSheet* aStyleSheet) override;
#define NS_DECL_NSIDOCUMENTOBSERVER_STYLERULEREMOVED \
virtual void StyleRuleRemoved(mozilla::StyleSheetHandle aStyleSheet) override;
virtual void StyleRuleRemoved(mozilla::StyleSheet* aStyleSheet) override;
#define NS_DECL_NSIDOCUMENTOBSERVER \
NS_DECL_NSIDOCUMENTOBSERVER_BEGINUPDATE \
@ -262,29 +262,29 @@ NS_IMPL_NSIMUTATIONOBSERVER_CONTENT(_class)
#define NS_IMPL_NSIDOCUMENTOBSERVER_STYLE_STUB(_class) \
void \
_class::StyleSheetAdded(mozilla::StyleSheetHandle aStyleSheet, \
_class::StyleSheetAdded(mozilla::StyleSheet* aStyleSheet, \
bool aDocumentSheet) \
{ \
} \
void \
_class::StyleSheetRemoved(mozilla::StyleSheetHandle aStyleSheet, \
_class::StyleSheetRemoved(mozilla::StyleSheet* aStyleSheet, \
bool aDocumentSheet) \
{ \
} \
void \
_class::StyleSheetApplicableStateChanged(mozilla::StyleSheetHandle aStyleSheet) \
_class::StyleSheetApplicableStateChanged(mozilla::StyleSheet* aStyleSheet)\
{ \
} \
void \
_class::StyleRuleChanged(mozilla::StyleSheetHandle aStyleSheet) \
_class::StyleRuleChanged(mozilla::StyleSheet* aStyleSheet) \
{ \
} \
void \
_class::StyleRuleAdded(mozilla::StyleSheetHandle aStyleSheet) \
_class::StyleRuleAdded(mozilla::StyleSheet* aStyleSheet) \
{ \
} \
void \
_class::StyleRuleRemoved(mozilla::StyleSheetHandle aStyleSheet) \
_class::StyleRuleRemoved(mozilla::StyleSheet* aStyleSheet) \
{ \
}

View File

@ -8,7 +8,7 @@
#include "nsISupports.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheet.h"
class nsICSSLoaderObserver;
class nsIURI;
@ -28,14 +28,14 @@ public:
* @param aStyleSheet the style sheet associated with this
* element.
*/
NS_IMETHOD SetStyleSheet(mozilla::StyleSheetHandle aStyleSheet) = 0;
NS_IMETHOD SetStyleSheet(mozilla::StyleSheet* aStyleSheet) = 0;
/**
* Used to obtain the style sheet linked in by this element.
*
* @return the style sheet associated with this element.
*/
NS_IMETHOD_(mozilla::StyleSheetHandle) GetStyleSheet() = 0;
NS_IMETHOD_(mozilla::StyleSheet*) GetStyleSheet() = 0;
/**
* Initialize the stylesheet linking element. If aDontLoadStyle is

View File

@ -12,8 +12,8 @@
#include "nsStyleLinkElement.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/css/Loader.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/FragmentOrElement.h"
@ -63,7 +63,7 @@ nsStyleLinkElement::Traverse(nsCycleCollectionTraversalCallback &cb)
}
NS_IMETHODIMP
nsStyleLinkElement::SetStyleSheet(StyleSheetHandle aStyleSheet)
nsStyleLinkElement::SetStyleSheet(StyleSheet* aStyleSheet)
{
if (mStyleSheet) {
mStyleSheet->SetOwningNode(nullptr);
@ -80,7 +80,7 @@ nsStyleLinkElement::SetStyleSheet(StyleSheetHandle aStyleSheet)
return NS_OK;
}
NS_IMETHODIMP_(StyleSheetHandle)
NS_IMETHODIMP_(StyleSheet*)
nsStyleLinkElement::GetStyleSheet()
{
return mStyleSheet;

View File

@ -50,8 +50,8 @@ public:
}
// nsIStyleSheetLinkingElement
NS_IMETHOD SetStyleSheet(mozilla::StyleSheetHandle aStyleSheet) override;
NS_IMETHOD_(mozilla::StyleSheetHandle) GetStyleSheet() override;
NS_IMETHOD SetStyleSheet(mozilla::StyleSheet* aStyleSheet) override;
NS_IMETHOD_(mozilla::StyleSheet*) GetStyleSheet() override;
NS_IMETHOD InitStyleLinkElement(bool aDontLoadStyle) override;
NS_IMETHOD UpdateStyleSheet(nsICSSLoaderObserver* aObserver,
bool* aWillNotify,
@ -143,7 +143,7 @@ private:
bool* aIsAlternate,
bool aForceUpdate);
mozilla::StyleSheetHandle::RefPtr mStyleSheet;
RefPtr<mozilla::StyleSheet> mStyleSheet;
protected:
bool mDontLoadStyle;
bool mUpdatesEnabled;

View File

@ -114,8 +114,8 @@
#include "nsIFrame.h"
#include "nsIContent.h"
#include "nsLayoutStylesheetCache.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -2550,7 +2550,7 @@ nsHTMLDocument::TearingDownEditor(nsIEditor *aEditor)
if (!presShell)
return;
nsTArray<StyleSheetHandle::RefPtr> agentSheets;
nsTArray<RefPtr<StyleSheet>> agentSheets;
presShell->GetAgentStyleSheets(agentSheets);
auto cache = nsLayoutStylesheetCache::For(GetStyleBackendType());
@ -2693,13 +2693,13 @@ nsHTMLDocument::EditingStateChanged()
// Before making this window editable, we need to modify UA style sheet
// because new style may change whether focused element will be focusable
// or not.
nsTArray<StyleSheetHandle::RefPtr> agentSheets;
nsTArray<RefPtr<StyleSheet>> agentSheets;
rv = presShell->GetAgentStyleSheets(agentSheets);
NS_ENSURE_SUCCESS(rv, rv);
auto cache = nsLayoutStylesheetCache::For(GetStyleBackendType());
StyleSheetHandle contentEditableSheet = cache->ContentEditableSheet();
StyleSheet* contentEditableSheet = cache->ContentEditableSheet();
if (!agentSheets.Contains(contentEditableSheet)) {
agentSheets.AppendElement(contentEditableSheet);
@ -2710,7 +2710,7 @@ nsHTMLDocument::EditingStateChanged()
// specific states on the elements.
if (designMode) {
// designMode is being turned on (overrides contentEditable).
StyleSheetHandle designModeSheet = cache->DesignModeSheet();
StyleSheet* designModeSheet = cache->DesignModeSheet();
if (!agentSheets.Contains(designModeSheet)) {
agentSheets.AppendElement(designModeSheet);
}

View File

@ -187,8 +187,8 @@
#include "nsPluginHost.h"
#include "nsPluginTags.h"
#include "nsIBlocklistService.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#include "nsHostObjectProtocolHandler.h"
#include "nsIBidiKeyboard.h"
@ -2267,19 +2267,19 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority,
// This looks like a lot of work, but in a normal browser session we just
// send two loads.
for (StyleSheetHandle sheet : *sheetService->AgentStyleSheets()) {
for (StyleSheet* sheet : *sheetService->AgentStyleSheets()) {
URIParams uri;
SerializeURI(sheet->GetSheetURI(), uri);
Unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::AGENT_SHEET);
}
for (StyleSheetHandle sheet : *sheetService->UserStyleSheets()) {
for (StyleSheet* sheet : *sheetService->UserStyleSheets()) {
URIParams uri;
SerializeURI(sheet->GetSheetURI(), uri);
Unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::USER_SHEET);
}
for (StyleSheetHandle sheet : *sheetService->AuthorStyleSheets()) {
for (StyleSheet* sheet : *sheetService->AuthorStyleSheets()) {
URIParams uri;
SerializeURI(sheet->GetSheetURI(), uri);
Unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::AUTHOR_SHEET);

View File

@ -20,8 +20,8 @@
#include "mozilla/dom/Element.h"
#include "nsSVGElement.h"
#include "mozilla/dom/SVGDocumentBinding.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
using namespace mozilla::css;
using namespace mozilla::dom;
@ -157,7 +157,7 @@ SVGDocument::EnsureNonSVGUserAgentStyleSheetsLoaded()
nsCOMPtr<nsIURI> uri;
NS_NewURI(getter_AddRefs(uri), spec);
if (uri) {
StyleSheetHandle::RefPtr sheet;
RefPtr<StyleSheet> sheet;
cssLoader->LoadSheetSync(uri,
mozilla::css::eAgentSheetFeatures,
true, &sheet);
@ -173,7 +173,7 @@ SVGDocument::EnsureNonSVGUserAgentStyleSheetsLoaded()
auto cache = nsLayoutStylesheetCache::For(GetStyleBackendType());
StyleSheetHandle sheet = cache->NumberControlSheet();
StyleSheet* sheet = cache->NumberControlSheet();
if (sheet) {
// number-control.css can be behind a pref
EnsureOnDemandBuiltInUASheet(sheet);

View File

@ -770,7 +770,7 @@ nsBindingManager::MediumFeaturesChanged(nsPresContext* aPresContext,
}
void
nsBindingManager::AppendAllSheets(nsTArray<StyleSheetHandle>& aArray)
nsBindingManager::AppendAllSheets(nsTArray<StyleSheet*>& aArray)
{
if (!mBoundContentSet) {
return;

View File

@ -18,7 +18,7 @@
#include "nsXBLBinding.h"
#include "nsTArray.h"
#include "nsThreadUtils.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheet.h"
struct ElementDependentRuleProcessorData;
class nsIXPConnectWrappedJS;
@ -138,7 +138,7 @@ public:
nsresult MediumFeaturesChanged(nsPresContext* aPresContext,
bool* aRulesChanged);
void AppendAllSheets(nsTArray<mozilla::StyleSheetHandle>& aArray);
void AppendAllSheets(nsTArray<mozilla::StyleSheet*>& aArray);
void Traverse(nsIContent *aContent,
nsCycleCollectionTraversalCallback &cb);

View File

@ -44,8 +44,8 @@
#include "mozilla/dom/CDATASection.h"
#include "mozilla/dom/Comment.h"
#include "mozilla/dom/Element.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#ifdef MOZ_XUL
#include "nsXULElement.h"
@ -1644,14 +1644,14 @@ nsXBLPrototypeBinding::EnsureResources()
}
void
nsXBLPrototypeBinding::AppendStyleSheet(StyleSheetHandle aSheet)
nsXBLPrototypeBinding::AppendStyleSheet(StyleSheet* aSheet)
{
EnsureResources();
mResources->AppendStyleSheet(aSheet);
}
void
nsXBLPrototypeBinding::RemoveStyleSheet(StyleSheetHandle aSheet)
nsXBLPrototypeBinding::RemoveStyleSheet(StyleSheet* aSheet)
{
if (!mResources) {
MOZ_ASSERT(false, "Trying to remove a sheet that does not exist.");
@ -1661,13 +1661,13 @@ nsXBLPrototypeBinding::RemoveStyleSheet(StyleSheetHandle aSheet)
mResources->RemoveStyleSheet(aSheet);
}
void
nsXBLPrototypeBinding::InsertStyleSheetAt(size_t aIndex, StyleSheetHandle aSheet)
nsXBLPrototypeBinding::InsertStyleSheetAt(size_t aIndex, StyleSheet* aSheet)
{
EnsureResources();
mResources->InsertStyleSheetAt(aIndex, aSheet);
}
StyleSheetHandle
StyleSheet*
nsXBLPrototypeBinding::StyleSheetAt(size_t aIndex) const
{
MOZ_ASSERT(mResources);
@ -1688,7 +1688,7 @@ nsXBLPrototypeBinding::HasStyleSheets() const
void
nsXBLPrototypeBinding::AppendStyleSheetsTo(
nsTArray<StyleSheetHandle>& aResult) const
nsTArray<StyleSheet*>& aResult) const
{
if (mResources) {
mResources->AppendStyleSheetsTo(aResult);

View File

@ -20,7 +20,7 @@
#include "nsXBLPrototypeHandler.h"
#include "nsXBLPrototypeResources.h"
#include "mozilla/WeakPtr.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheet.h"
class nsIAtom;
class nsIContent;
@ -120,13 +120,13 @@ public:
void SetInitialAttributes(nsIContent* aBoundElement, nsIContent* aAnonymousContent);
void AppendStyleSheet(mozilla::StyleSheetHandle aSheet);
void RemoveStyleSheet(mozilla::StyleSheetHandle aSheet);
void InsertStyleSheetAt(size_t aIndex, mozilla::StyleSheetHandle aSheet);
mozilla::StyleSheetHandle StyleSheetAt(size_t aIndex) const;
void AppendStyleSheet(mozilla::StyleSheet* aSheet);
void RemoveStyleSheet(mozilla::StyleSheet* aSheet);
void InsertStyleSheetAt(size_t aIndex, mozilla::StyleSheet* aSheet);
mozilla::StyleSheet* StyleSheetAt(size_t aIndex) const;
size_t SheetCount() const;
bool HasStyleSheets() const;
void AppendStyleSheetsTo(nsTArray<mozilla::StyleSheetHandle>& aResult) const;
void AppendStyleSheetsTo(nsTArray<mozilla::StyleSheet*>& aResult) const;
nsIStyleRuleProcessor* GetRuleProcessor();

View File

@ -19,8 +19,8 @@
#include "nsStyleSet.h"
#include "mozilla/dom/URL.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
using namespace mozilla;
using mozilla::dom::IsChromeURI;
@ -84,18 +84,18 @@ nsXBLPrototypeResources::FlushSkinSheets()
// skin sheets can't be, and which in any case don't have a usable
// URL to reload.)
nsTArray<StyleSheetHandle::RefPtr> oldSheets;
nsTArray<RefPtr<StyleSheet>> oldSheets;
oldSheets.SwapElements(mStyleSheetList);
mozilla::css::Loader* cssLoader = doc->CSSLoader();
for (size_t i = 0, count = oldSheets.Length(); i < count; ++i) {
StyleSheetHandle oldSheet = oldSheets[i];
StyleSheet* oldSheet = oldSheets[i];
nsIURI* uri = oldSheet->GetSheetURI();
StyleSheetHandle::RefPtr newSheet;
RefPtr<StyleSheet> newSheet;
if (!oldSheet->IsInline() && IsChromeURI(uri)) {
if (NS_FAILED(cssLoader->LoadSheetSync(uri, &newSheet)))
continue;
@ -147,7 +147,7 @@ void
nsXBLPrototypeResources::GatherRuleProcessor()
{
nsTArray<RefPtr<CSSStyleSheet>> sheets(mStyleSheetList.Length());
for (StyleSheetHandle sheet : mStyleSheetList) {
for (StyleSheet* sheet : mStyleSheetList) {
MOZ_ASSERT(sheet->IsGecko(),
"GatherRuleProcessor must only be called for "
"nsXBLPrototypeResources objects with Gecko-flavored style "
@ -161,24 +161,24 @@ nsXBLPrototypeResources::GatherRuleProcessor()
}
void
nsXBLPrototypeResources::AppendStyleSheet(StyleSheetHandle aSheet)
nsXBLPrototypeResources::AppendStyleSheet(StyleSheet* aSheet)
{
mStyleSheetList.AppendElement(aSheet);
}
void
nsXBLPrototypeResources::RemoveStyleSheet(StyleSheetHandle aSheet)
nsXBLPrototypeResources::RemoveStyleSheet(StyleSheet* aSheet)
{
mStyleSheetList.RemoveElement(aSheet);
}
void
nsXBLPrototypeResources::InsertStyleSheetAt(size_t aIndex, StyleSheetHandle aSheet)
nsXBLPrototypeResources::InsertStyleSheetAt(size_t aIndex, StyleSheet* aSheet)
{
mStyleSheetList.InsertElementAt(aIndex, aSheet);
}
StyleSheetHandle
StyleSheet*
nsXBLPrototypeResources::StyleSheetAt(size_t aIndex) const
{
return mStyleSheetList[aIndex];
@ -198,7 +198,7 @@ nsXBLPrototypeResources::HasStyleSheets() const
void
nsXBLPrototypeResources::AppendStyleSheetsTo(
nsTArray<StyleSheetHandle>& aResult) const
nsTArray<StyleSheet*>& aResult) const
{
aResult.AppendElements(mStyleSheetList);
}

View File

@ -7,7 +7,7 @@
#ifndef nsXBLPrototypeResources_h__
#define nsXBLPrototypeResources_h__
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheet.h"
#include "nsICSSLoaderObserver.h"
class nsCSSRuleProcessor;
@ -41,13 +41,13 @@ public:
void ClearLoader();
void AppendStyleSheet(mozilla::StyleSheetHandle aSheet);
void RemoveStyleSheet(mozilla::StyleSheetHandle aSheet);
void InsertStyleSheetAt(size_t aIndex, mozilla::StyleSheetHandle aSheet);
mozilla::StyleSheetHandle StyleSheetAt(size_t aIndex) const;
void AppendStyleSheet(mozilla::StyleSheet* aSheet);
void RemoveStyleSheet(mozilla::StyleSheet* aSheet);
void InsertStyleSheetAt(size_t aIndex, mozilla::StyleSheet* aSheet);
mozilla::StyleSheet* StyleSheetAt(size_t aIndex) const;
size_t SheetCount() const;
bool HasStyleSheets() const;
void AppendStyleSheetsTo(nsTArray<mozilla::StyleSheetHandle>& aResult) const;
void AppendStyleSheetsTo(nsTArray<mozilla::StyleSheet*>& aResult) const;
/**
* Recreates mRuleProcessor to represent the current list of style sheets
@ -63,7 +63,7 @@ private:
RefPtr<nsXBLResourceLoader> mLoader;
// A list of loaded stylesheets for this binding.
nsTArray<mozilla::StyleSheetHandle::RefPtr> mStyleSheetList;
nsTArray<RefPtr<mozilla::StyleSheet>> mStyleSheetList;
// The list of stylesheets converted to a rule processor.
RefPtr<nsCSSRuleProcessor> mRuleProcessor;

View File

@ -17,8 +17,8 @@
#include "nsIDocumentObserver.h"
#include "imgILoader.h"
#include "imgRequestProxy.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/css/Loader.h"
#include "nsIURI.h"
#include "nsNetUtil.h"
@ -135,7 +135,7 @@ nsXBLResourceLoader::LoadResources(bool* aResult)
CheckLoadURIWithPrincipal(docPrincipal, url,
nsIScriptSecurityManager::ALLOW_CHROME);
if (NS_SUCCEEDED(rv)) {
StyleSheetHandle::RefPtr sheet;
RefPtr<StyleSheet> sheet;
rv = cssLoader->LoadSheetSync(url, &sheet);
NS_ASSERTION(NS_SUCCEEDED(rv), "Load failed!!!");
if (NS_SUCCEEDED(rv))
@ -164,7 +164,7 @@ nsXBLResourceLoader::LoadResources(bool* aResult)
// nsICSSLoaderObserver
NS_IMETHODIMP
nsXBLResourceLoader::StyleSheetLoaded(StyleSheetHandle aSheet,
nsXBLResourceLoader::StyleSheetLoaded(StyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus)
{

View File

@ -30,7 +30,7 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS(nsXBLResourceLoader)
// nsICSSLoaderObserver
NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheetHandle aSheet,
NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus) override;

View File

@ -411,7 +411,7 @@ nsXMLContentSink::OnTransformDone(nsresult aResult,
}
NS_IMETHODIMP
nsXMLContentSink::StyleSheetLoaded(StyleSheetHandle aSheet,
nsXMLContentSink::StyleSheetLoaded(StyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus)
{

View File

@ -82,7 +82,7 @@ public:
NS_IMETHOD OnTransformDone(nsresult aResult, nsIDocument *aResultDocument) override;
// nsICSSLoaderObserver
NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheetHandle aSheet,
NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus) override;
static bool ParsePIData(const nsString &aData, nsString &aHref,

View File

@ -976,7 +976,7 @@ txTransformNotifier::ScriptEvaluated(nsresult aResult,
}
NS_IMETHODIMP
txTransformNotifier::StyleSheetLoaded(StyleSheetHandle aSheet,
txTransformNotifier::StyleSheetLoaded(StyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus)
{

View File

@ -35,7 +35,7 @@ public:
NS_DECL_NSISCRIPTLOADEROBSERVER
// nsICSSLoaderObserver
NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheetHandle aSheet,
NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus) override;

View File

@ -94,8 +94,8 @@
#include "nsIContentPolicy.h"
#include "mozAutoDocUpdate.h"
#include "xpcpublic.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -3106,7 +3106,7 @@ XULDocument::DoneWalking()
}
NS_IMETHODIMP
XULDocument::StyleSheetLoaded(StyleSheetHandle aSheet,
XULDocument::StyleSheetLoaded(StyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus)
{
@ -3730,7 +3730,7 @@ XULDocument::AddPrototypeSheets()
for (int32_t i = 0; i < sheets.Count(); i++) {
nsCOMPtr<nsIURI> uri = sheets[i];
StyleSheetHandle::RefPtr incompleteSheet;
RefPtr<StyleSheet> incompleteSheet;
rv = CSSLoader()->LoadSheet(uri,
mCurrentPrototype->DocumentPrincipal(),
EmptyCString(), this,

View File

@ -13,7 +13,7 @@
#include "nsTArray.h"
#include "mozilla/dom/XMLDocument.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheet.h"
#include "nsForwardReference.h"
#include "nsIContent.h"
#include "nsIDOMXULCommandDispatcher.h"
@ -163,7 +163,7 @@ public:
NS_DECL_NSIDOMXULDOCUMENT
// nsICSSLoaderObserver
NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheetHandle aSheet,
NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus) override;
@ -344,7 +344,7 @@ protected:
* An array of style sheets, that will be added (preserving order) to the
* document after all of them are loaded (in DoneWalking).
*/
nsTArray<StyleSheetHandle::RefPtr> mOverlaySheets;
nsTArray<RefPtr<StyleSheet>> mOverlaySheets;
nsCOMPtr<nsIDOMXULCommandDispatcher> mCommandDispatcher; // [OWNER] of the focus tracker

View File

@ -4237,7 +4237,7 @@ EditorBase::CreateTxnForComposition(const nsAString& aStringToInsert)
}
NS_IMETHODIMP
EditorBase::CreateTxnForAddStyleSheet(StyleSheetHandle aSheet,
EditorBase::CreateTxnForAddStyleSheet(StyleSheet* aSheet,
AddStyleSheetTransaction** aTransaction)
{
RefPtr<AddStyleSheetTransaction> transaction = new AddStyleSheetTransaction();
@ -4252,7 +4252,7 @@ EditorBase::CreateTxnForAddStyleSheet(StyleSheetHandle aSheet,
NS_IMETHODIMP
EditorBase::CreateTxnForRemoveStyleSheet(
StyleSheetHandle aSheet,
StyleSheet* aSheet,
RemoveStyleSheetTransaction** aTransaction)
{
RefPtr<RemoveStyleSheetTransaction> transaction =

View File

@ -9,7 +9,7 @@
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc.
#include "mozilla/OwningNonNull.h" // for OwningNonNull
#include "mozilla/SelectionState.h" // for RangeUpdater, etc.
#include "mozilla/StyleSheetHandle.h" // for StyleSheetHandle
#include "mozilla/StyleSheet.h" // for StyleSheet
#include "mozilla/dom/Text.h"
#include "nsCOMPtr.h" // for already_AddRefed, nsCOMPtr
#include "nsCycleCollectionParticipant.h"
@ -328,14 +328,14 @@ protected:
* Create a transaction for adding a style sheet.
*/
NS_IMETHOD CreateTxnForAddStyleSheet(
StyleSheetHandle aSheet,
StyleSheet* aSheet,
AddStyleSheetTransaction** aTransaction);
/**
* Create a transaction for removing a style sheet.
*/
NS_IMETHOD CreateTxnForRemoveStyleSheet(
StyleSheetHandle aSheet,
StyleSheet* aSheet,
RemoveStyleSheetTransaction** aTransaction);
nsresult DeleteText(nsGenericDOMDataNode& aElement,

View File

@ -72,8 +72,8 @@
#include "mozilla/dom/HTMLBodyElement.h"
#include "nsTextFragment.h"
#include "nsContentList.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
namespace mozilla {
@ -2854,7 +2854,7 @@ HTMLEditor::ReplaceStyleSheet(const nsAString& aURL)
NS_IMETHODIMP
HTMLEditor::RemoveStyleSheet(const nsAString& aURL)
{
StyleSheetHandle::RefPtr sheet = GetStyleSheetForURL(aURL);
RefPtr<StyleSheet> sheet = GetStyleSheetForURL(aURL);
NS_ENSURE_TRUE(sheet, NS_ERROR_UNEXPECTED);
RefPtr<RemoveStyleSheetTransaction> transaction;
@ -2894,7 +2894,7 @@ HTMLEditor::AddOverrideStyleSheet(const nsAString& aURL)
// We MUST ONLY load synchronous local files (no @import)
// XXXbz Except this will actually try to load remote files
// synchronously, of course..
StyleSheetHandle::RefPtr sheet;
RefPtr<StyleSheet> sheet;
// Editor override style sheets may want to style Gecko anonymous boxes
rv = ps->GetDocument()->CSSLoader()->
LoadSheetSync(uaURI, mozilla::css::eAgentSheetFeatures, true,
@ -2939,7 +2939,7 @@ HTMLEditor::ReplaceOverrideStyleSheet(const nsAString& aURL)
NS_IMETHODIMP
HTMLEditor::RemoveOverrideStyleSheet(const nsAString& aURL)
{
StyleSheetHandle::RefPtr sheet = GetStyleSheetForURL(aURL);
RefPtr<StyleSheet> sheet = GetStyleSheetForURL(aURL);
// Make sure we remove the stylesheet from our internal list in all
// cases.
@ -2962,7 +2962,7 @@ NS_IMETHODIMP
HTMLEditor::EnableStyleSheet(const nsAString& aURL,
bool aEnable)
{
StyleSheetHandle::RefPtr sheet = GetStyleSheetForURL(aURL);
RefPtr<StyleSheet> sheet = GetStyleSheetForURL(aURL);
NS_ENSURE_TRUE(sheet, NS_OK); // Don't fail if sheet not found
// Ensure the style sheet is owned by our document.
@ -2980,7 +2980,7 @@ HTMLEditor::EnableStyleSheet(const nsAString& aURL,
bool
HTMLEditor::EnableExistingStyleSheet(const nsAString& aURL)
{
StyleSheetHandle::RefPtr sheet = GetStyleSheetForURL(aURL);
RefPtr<StyleSheet> sheet = GetStyleSheetForURL(aURL);
// Enable sheet if already loaded.
if (sheet)
@ -3002,7 +3002,7 @@ HTMLEditor::EnableExistingStyleSheet(const nsAString& aURL)
nsresult
HTMLEditor::AddNewStyleSheetToList(const nsAString& aURL,
StyleSheetHandle aStyleSheet)
StyleSheet* aStyleSheet)
{
uint32_t countSS = mStyleSheets.Length();
uint32_t countU = mStyleSheetURLs.Length();
@ -3032,7 +3032,7 @@ HTMLEditor::RemoveStyleSheetFromList(const nsAString& aURL)
return NS_OK;
}
StyleSheetHandle
StyleSheet*
HTMLEditor::GetStyleSheetForURL(const nsAString& aURL)
{
// is it already in the list?
@ -3047,7 +3047,7 @@ HTMLEditor::GetStyleSheetForURL(const nsAString& aURL)
}
void
HTMLEditor::GetURLForStyleSheet(StyleSheetHandle aStyleSheet,
HTMLEditor::GetURLForStyleSheet(StyleSheet* aStyleSheet,
nsAString& aURL)
{
// is it already in the list?
@ -3426,7 +3426,7 @@ HTMLEditor::DebugUnitTests(int32_t* outNumTests,
}
NS_IMETHODIMP
HTMLEditor::StyleSheetLoaded(StyleSheetHandle aSheet,
HTMLEditor::StyleSheetLoaded(StyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus)
{

View File

@ -8,7 +8,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/CSSEditUtils.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/TextEditor.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/File.h"
@ -365,7 +365,7 @@ public:
NS_IMETHOD GetRootElement(nsIDOMElement** aRootElement) override;
// nsICSSLoaderObserver
NS_IMETHOD StyleSheetLoaded(StyleSheetHandle aSheet,
NS_IMETHOD StyleSheetLoaded(StyleSheet* aSheet,
bool aWasAlternate, nsresult aStatus) override;
// Utility Routines, not part of public API
@ -417,15 +417,15 @@ public:
/**
* Dealing with the internal style sheet lists.
*/
StyleSheetHandle GetStyleSheetForURL(const nsAString& aURL);
void GetURLForStyleSheet(StyleSheetHandle aStyleSheet,
StyleSheet* GetStyleSheetForURL(const nsAString& aURL);
void GetURLForStyleSheet(StyleSheet* aStyleSheet,
nsAString& aURL);
/**
* Add a url + known style sheet to the internal lists.
*/
nsresult AddNewStyleSheetToList(const nsAString &aURL,
StyleSheetHandle aStyleSheet);
StyleSheet* aStyleSheet);
nsresult RemoveStyleSheetFromList(const nsAString &aURL);
bool IsCSSEnabled()
@ -907,7 +907,7 @@ protected:
// Maintain a list of associated style sheets and their urls.
nsTArray<nsString> mStyleSheetURLs;
nsTArray<StyleSheetHandle::RefPtr> mStyleSheets;
nsTArray<RefPtr<StyleSheet>> mStyleSheets;
// an array for holding default style settings
nsTArray<PropItem*> mDefaultStyles;

View File

@ -9,8 +9,8 @@
#include "nsAString.h"
#include "nsCOMPtr.h" // for nsCOMPtr, do_QueryInterface, etc.
#include "mozilla/StyleSheetHandle.h" // for mozilla::StyleSheetHandle
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h" // for mozilla::StyleSheet
#include "mozilla/StyleSheetInlines.h"
#include "nsDebug.h" // for NS_ENSURE_TRUE
#include "nsError.h" // for NS_OK, etc.
#include "nsIDOMDocument.h" // for nsIDOMDocument
@ -21,7 +21,7 @@
namespace mozilla {
static void
AddStyleSheet(nsIEditor* aEditor, StyleSheetHandle aSheet)
AddStyleSheet(nsIEditor* aEditor, StyleSheet* aSheet)
{
nsCOMPtr<nsIDOMDocument> domDoc;
aEditor->GetDocument(getter_AddRefs(domDoc));
@ -34,7 +34,7 @@ AddStyleSheet(nsIEditor* aEditor, StyleSheetHandle aSheet)
}
static void
RemoveStyleSheet(nsIEditor* aEditor, StyleSheetHandle aSheet)
RemoveStyleSheet(nsIEditor* aEditor, StyleSheet* aSheet)
{
nsCOMPtr<nsIDOMDocument> domDoc;
aEditor->GetDocument(getter_AddRefs(domDoc));
@ -64,7 +64,7 @@ NS_INTERFACE_MAP_END_INHERITING(EditTransactionBase)
NS_IMETHODIMP
AddStyleSheetTransaction::Init(nsIEditor* aEditor,
StyleSheetHandle aSheet)
StyleSheet* aSheet)
{
NS_ENSURE_TRUE(aEditor && aSheet, NS_ERROR_INVALID_ARG);
@ -118,7 +118,7 @@ NS_INTERFACE_MAP_END_INHERITING(EditTransactionBase)
NS_IMETHODIMP
RemoveStyleSheetTransaction::Init(nsIEditor* aEditor,
StyleSheetHandle aSheet)
StyleSheet* aSheet)
{
NS_ENSURE_TRUE(aEditor && aSheet, NS_ERROR_INVALID_ARG);

View File

@ -7,7 +7,7 @@
#define StylesheetTransactions_h
#include "mozilla/EditTransactionBase.h" // for EditTransactionBase, etc.
#include "mozilla/StyleSheetHandle.h" // for mozilla::StyleSheetHandle
#include "mozilla/StyleSheet.h" // for mozilla::StyleSheet
#include "nsCycleCollectionParticipant.h"
#include "nsID.h" // for REFNSIID
#include "nscore.h" // for NS_IMETHOD
@ -24,7 +24,7 @@ public:
* @param aEditor The object providing core editing operations
* @param aSheet The stylesheet to add
*/
NS_IMETHOD Init(nsIEditor* aEditor, StyleSheetHandle aSheet);
NS_IMETHOD Init(nsIEditor* aEditor, StyleSheet* aSheet);
AddStyleSheetTransaction();
@ -38,7 +38,7 @@ protected:
// The editor that created this transaction.
nsIEditor* mEditor;
// The style sheet to add.
mozilla::StyleSheetHandle::RefPtr mSheet;
RefPtr<mozilla::StyleSheet> mSheet;
};
@ -50,7 +50,7 @@ public:
* @param aEditor The object providing core editing operations.
* @param aSheet The stylesheet to remove.
*/
NS_IMETHOD Init(nsIEditor* aEditor, StyleSheetHandle aSheet);
NS_IMETHOD Init(nsIEditor* aEditor, StyleSheet* aSheet);
RemoveStyleSheetTransaction();
@ -64,7 +64,7 @@ protected:
// The editor that created this transaction.
nsIEditor* mEditor;
// The style sheet to remove.
StyleSheetHandle::RefPtr mSheet;
RefPtr<StyleSheet> mSheet;
};

View File

@ -42,8 +42,8 @@
#include "mozilla/Preferences.h"
#include "mozilla/dom/EncodingUtils.h"
#include "mozilla/WeakPtr.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#include "nsViewManager.h"
#include "nsView.h"
@ -2205,7 +2205,7 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument)
auto cache = nsLayoutStylesheetCache::For(backendType);
// Handle the user sheets.
StyleSheetHandle sheet = nullptr;
StyleSheet* sheet = nullptr;
if (nsContentUtils::IsInChromeDocshell(aDocument)) {
sheet = cache->UserChromeSheet();
} else {
@ -2222,7 +2222,7 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument)
nsCOMPtr<nsIDocShell> ds(mContainer);
nsCOMPtr<nsIDOMEventTarget> chromeHandler;
nsCOMPtr<nsIURI> uri;
StyleSheetHandle::RefPtr chromeSheet;
RefPtr<StyleSheet> chromeSheet;
if (ds) {
ds->GetChromeEventHandler(getter_AddRefs(chromeHandler));
@ -2341,10 +2341,10 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument)
if (styleSet->IsGecko()) {
nsStyleSheetService* sheetService = nsStyleSheetService::GetInstance();
if (sheetService) {
for (StyleSheetHandle sheet : *sheetService->AgentStyleSheets()) {
for (StyleSheet* sheet : *sheetService->AgentStyleSheets()) {
styleSet->AppendStyleSheet(SheetType::Agent, sheet);
}
for (StyleSheetHandle sheet : Reversed(*sheetService->UserStyleSheets())) {
for (StyleSheet* sheet : Reversed(*sheetService->UserStyleSheets())) {
styleSet->PrependStyleSheet(SheetType::User, sheet);
}
}

View File

@ -25,7 +25,7 @@
#include "mozilla/MemoryReporting.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/StyleSetHandle.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/WeakPtr.h"
#include "gfxPoint.h"
#include "nsTHashtable.h"
@ -960,23 +960,23 @@ public:
* Get the set of agent style sheets for this presentation
*/
virtual nsresult GetAgentStyleSheets(
nsTArray<mozilla::StyleSheetHandle::RefPtr>& aSheets) = 0;
nsTArray<RefPtr<mozilla::StyleSheet>>& aSheets) = 0;
/**
* Replace the set of agent style sheets
*/
virtual nsresult SetAgentStyleSheets(
const nsTArray<mozilla::StyleSheetHandle::RefPtr>& aSheets) = 0;
const nsTArray<RefPtr<mozilla::StyleSheet>>& aSheets) = 0;
/**
* Add an override style sheet for this presentation
*/
virtual nsresult AddOverrideStyleSheet(mozilla::StyleSheetHandle aSheet) = 0;
virtual nsresult AddOverrideStyleSheet(mozilla::StyleSheet* aSheet) = 0;
/**
* Remove an override style sheet
*/
virtual nsresult RemoveOverrideStyleSheet(mozilla::StyleSheetHandle aSheet) = 0;
virtual nsresult RemoveOverrideStyleSheet(mozilla::StyleSheet* aSheet) = 0;
/**
* Reconstruct frames for all elements in the document

View File

@ -74,8 +74,8 @@
#include "gfxTextRun.h"
#include "nsFontFaceUtils.h"
#include "nsLayoutStylesheetCache.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#if defined(MOZ_WIDGET_GTK)
#include "gfxPlatformGtk.h" // xxx - for UseFcFontList
@ -1156,7 +1156,7 @@ nsPresContext::CompatibilityModeChanged()
StyleSetHandle styleSet = mShell->StyleSet();
auto cache = nsLayoutStylesheetCache::For(styleSet->BackendType());
StyleSheetHandle sheet = cache->QuirkSheet();
StyleSheet* sheet = cache->QuirkSheet();
if (needsQuirkSheet) {
// quirk.css needs to come after html.css; we just keep it at the end.

View File

@ -193,8 +193,8 @@
#include "nsStyleSet.h"
#include "mozilla/StyleSetHandle.h"
#include "mozilla/StyleSetHandleInlines.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#ifdef ANDROID
#include "nsIDocShellTreeOwner.h"
@ -1404,7 +1404,7 @@ PresShell::UpdatePreferenceStyles()
// (See nsPresContext::GetDocumentColorPreferences for how whether we
// are a chrome origin image affects some pref styling information.)
auto cache = nsLayoutStylesheetCache::For(mStyleSet->BackendType());
StyleSheetHandle::RefPtr newPrefSheet =
RefPtr<StyleSheet> newPrefSheet =
mPresContext->IsChromeOriginImage() ?
cache->ChromePreferenceSheet(mPresContext) :
cache->ContentPreferenceSheet(mPresContext);
@ -1451,16 +1451,16 @@ PresShell::AddUserSheet(nsISupports* aSheet)
mStyleSet->BeginUpdate();
nsStyleSheetService* sheetService = nsStyleSheetService::gInstance;
nsTArray<StyleSheetHandle::RefPtr>& userSheets = *sheetService->UserStyleSheets();
nsTArray<RefPtr<StyleSheet>>& userSheets = *sheetService->UserStyleSheets();
// Iterate forwards when removing so the searches for RemoveStyleSheet are as
// short as possible.
for (StyleSheetHandle sheet : userSheets) {
for (StyleSheet* sheet : userSheets) {
mStyleSet->RemoveStyleSheet(SheetType::User, sheet);
}
// Now iterate backwards, so that the order of userSheets will be the same as
// the order of sheets from it in the style set.
for (StyleSheetHandle sheet : Reversed(userSheets)) {
for (StyleSheet* sheet : Reversed(userSheets)) {
mStyleSet->PrependStyleSheet(SheetType::User, sheet);
}
@ -1497,7 +1497,7 @@ PresShell::AddAuthorSheet(nsISupports* aSheet)
// Document specific "additional" Author sheets should be stronger than the
// ones added with the StyleSheetService.
StyleSheetHandle firstAuthorSheet =
StyleSheet* firstAuthorSheet =
mDocument->GetFirstAdditionalAuthorSheet();
if (firstAuthorSheet) {
mStyleSet->InsertStyleSheetBefore(SheetType::Doc, sheet, firstAuthorSheet);
@ -4530,7 +4530,7 @@ nsIPresShell::RestyleForCSSRuleChanges()
}
void
PresShell::RecordStyleSheetChange(StyleSheetHandle aStyleSheet)
PresShell::RecordStyleSheetChange(StyleSheet* aStyleSheet)
{
// too bad we can't check that the update is UPDATE_STYLE
NS_ASSERTION(mUpdateCount != 0, "must be in an update");
@ -4554,7 +4554,7 @@ PresShell::RecordStyleSheetChange(StyleSheetHandle aStyleSheet)
}
void
PresShell::StyleSheetAdded(StyleSheetHandle aStyleSheet,
PresShell::StyleSheetAdded(StyleSheet* aStyleSheet,
bool aDocumentSheet)
{
// We only care when enabled sheets are added
@ -4566,7 +4566,7 @@ PresShell::StyleSheetAdded(StyleSheetHandle aStyleSheet,
}
void
PresShell::StyleSheetRemoved(StyleSheetHandle aStyleSheet,
PresShell::StyleSheetRemoved(StyleSheet* aStyleSheet,
bool aDocumentSheet)
{
// We only care when enabled sheets are removed
@ -4578,7 +4578,7 @@ PresShell::StyleSheetRemoved(StyleSheetHandle aStyleSheet,
}
void
PresShell::StyleSheetApplicableStateChanged(StyleSheetHandle aStyleSheet)
PresShell::StyleSheetApplicableStateChanged(StyleSheet* aStyleSheet)
{
if (aStyleSheet->HasRules()) {
RecordStyleSheetChange(aStyleSheet);
@ -4586,19 +4586,19 @@ PresShell::StyleSheetApplicableStateChanged(StyleSheetHandle aStyleSheet)
}
void
PresShell::StyleRuleChanged(StyleSheetHandle aStyleSheet)
PresShell::StyleRuleChanged(StyleSheet* aStyleSheet)
{
RecordStyleSheetChange(aStyleSheet);
}
void
PresShell::StyleRuleAdded(StyleSheetHandle aStyleSheet)
PresShell::StyleRuleAdded(StyleSheet* aStyleSheet)
{
RecordStyleSheetChange(aStyleSheet);
}
void
PresShell::StyleRuleRemoved(StyleSheetHandle aStyleSheet)
PresShell::StyleRuleRemoved(StyleSheet* aStyleSheet)
{
RecordStyleSheetChange(aStyleSheet);
}
@ -8942,7 +8942,7 @@ PresShell::IsVisible()
}
nsresult
PresShell::GetAgentStyleSheets(nsTArray<StyleSheetHandle::RefPtr>& aSheets)
PresShell::GetAgentStyleSheets(nsTArray<RefPtr<StyleSheet>>& aSheets)
{
aSheets.Clear();
int32_t sheetCount = mStyleSet->SheetCount(SheetType::Agent);
@ -8952,7 +8952,7 @@ PresShell::GetAgentStyleSheets(nsTArray<StyleSheetHandle::RefPtr>& aSheets)
}
for (int32_t i = 0; i < sheetCount; ++i) {
StyleSheetHandle sheet = mStyleSet->StyleSheetAt(SheetType::Agent, i);
StyleSheet* sheet = mStyleSet->StyleSheetAt(SheetType::Agent, i);
aSheets.AppendElement(sheet);
}
@ -8960,19 +8960,19 @@ PresShell::GetAgentStyleSheets(nsTArray<StyleSheetHandle::RefPtr>& aSheets)
}
nsresult
PresShell::SetAgentStyleSheets(const nsTArray<StyleSheetHandle::RefPtr>& aSheets)
PresShell::SetAgentStyleSheets(const nsTArray<RefPtr<StyleSheet>>& aSheets)
{
return mStyleSet->ReplaceSheets(SheetType::Agent, aSheets);
}
nsresult
PresShell::AddOverrideStyleSheet(StyleSheetHandle aSheet)
PresShell::AddOverrideStyleSheet(StyleSheet* aSheet)
{
return mStyleSet->PrependStyleSheet(SheetType::Override, aSheet);
}
nsresult
PresShell::RemoveOverrideStyleSheet(StyleSheetHandle aSheet)
PresShell::RemoveOverrideStyleSheet(StyleSheet* aSheet)
{
return mStyleSet->RemoveStyleSheet(SheetType::Override, aSheet);
}

View File

@ -182,12 +182,12 @@ public:
virtual void UnsuppressPainting() override;
virtual nsresult GetAgentStyleSheets(
nsTArray<mozilla::StyleSheetHandle::RefPtr>& aSheets) override;
nsTArray<RefPtr<mozilla::StyleSheet>>& aSheets) override;
virtual nsresult SetAgentStyleSheets(
const nsTArray<mozilla::StyleSheetHandle::RefPtr>& aSheets) override;
const nsTArray<RefPtr<mozilla::StyleSheet>>& aSheets) override;
virtual nsresult AddOverrideStyleSheet(mozilla::StyleSheetHandle aSheet) override;
virtual nsresult RemoveOverrideStyleSheet(mozilla::StyleSheetHandle aSheet) override;
virtual nsresult AddOverrideStyleSheet(mozilla::StyleSheet* aSheet) override;
virtual nsresult RemoveOverrideStyleSheet(mozilla::StyleSheet* aSheet) override;
virtual nsresult HandleEventWithTarget(
mozilla::WidgetEvent* aEvent,
@ -541,7 +541,7 @@ protected:
void ShowEventTargetDebug();
#endif
void RecordStyleSheetChange(mozilla::StyleSheetHandle aStyleSheet);
void RecordStyleSheetChange(mozilla::StyleSheet* aStyleSheet);
void RemovePreferenceStyles();
@ -862,7 +862,7 @@ protected:
mozilla::layers::ScrollableLayerGuid mMouseEventTargetGuid;
// mStyleSet owns it but we maintain a ref, may be null
mozilla::StyleSheetHandle::RefPtr mPrefStyleSheet;
RefPtr<mozilla::StyleSheet> mPrefStyleSheet;
// Set of frames that we should mark with NS_FRAME_HAS_DIRTY_CHILDREN after
// we finish reflowing mCurrentReflowRoot.

View File

@ -9,8 +9,8 @@
#include "nsStyleSheetService.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/Unused.h"
#include "mozilla/css/Loader.h"
#include "mozilla/dom/ContentParent.h"
@ -81,7 +81,7 @@ nsStyleSheetService::RegisterFromEnumerator(nsICategoryManager *aManager,
}
int32_t
nsStyleSheetService::FindSheetByURI(const nsTArray<StyleSheetHandle::RefPtr>& aSheets,
nsStyleSheetService::FindSheetByURI(const nsTArray<RefPtr<StyleSheet>>& aSheets,
nsIURI* aSheetURI)
{
for (int32_t i = aSheets.Length() - 1; i >= 0; i-- ) {
@ -158,7 +158,7 @@ nsStyleSheetService::LoadAndRegisterSheet(nsIURI *aSheetURI,
// XXXheycam Once the nsStyleSheetService can hold ServoStyleSheets too,
// we'll need to include them in the notification.
StyleSheetHandle sheet = mSheets[aSheetType].LastElement();
StyleSheet* sheet = mSheets[aSheetType].LastElement();
if (sheet->IsGecko()) {
CSSStyleSheet* cssSheet = sheet->AsGecko();
serv->NotifyObservers(NS_ISUPPORTS_CAST(nsIDOMCSSStyleSheet*, cssSheet),
@ -216,7 +216,7 @@ nsStyleSheetService::LoadAndRegisterSheetInternal(nsIURI *aSheetURI,
// style sheet.
RefPtr<css::Loader> loader = new css::Loader(StyleBackendType::Gecko);
StyleSheetHandle::RefPtr sheet;
RefPtr<StyleSheet> sheet;
nsresult rv = loader->LoadSheetSync(aSheetURI, parsingMode, true, &sheet);
NS_ENSURE_SUCCESS(rv, rv);
@ -270,7 +270,7 @@ nsStyleSheetService::PreloadSheet(nsIURI *aSheetURI, uint32_t aSheetType,
RefPtr<css::Loader> loader = new css::Loader(StyleBackendType::Gecko);
StyleSheetHandle::RefPtr sheet;
RefPtr<StyleSheet> sheet;
nsresult rv = loader->LoadSheetSync(aSheetURI, parsingMode, true, &sheet);
NS_ENSURE_SUCCESS(rv, rv);
@ -293,7 +293,7 @@ nsStyleSheetService::UnregisterSheet(nsIURI *aSheetURI, uint32_t aSheetType)
int32_t foundIndex = FindSheetByURI(mSheets[aSheetType], aSheetURI);
NS_ENSURE_TRUE(foundIndex >= 0, NS_ERROR_INVALID_ARG);
StyleSheetHandle::RefPtr sheet = mSheets[aSheetType][foundIndex];
RefPtr<StyleSheet> sheet = mSheets[aSheetType][foundIndex];
mSheets[aSheetType].RemoveElementAt(foundIndex);
const char* message;
@ -376,7 +376,7 @@ nsStyleSheetService::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) co
size_t n = aMallocSizeOf(this);
for (auto& sheetArray : mSheets) {
n += sheetArray.ShallowSizeOfExcludingThis(aMallocSizeOf);
for (StyleSheetHandle sheet : sheetArray) {
for (StyleSheet* sheet : sheetArray) {
n += sheet->SizeOfIncludingThis(aMallocSizeOf);
}
}

View File

@ -15,7 +15,7 @@
#include "nsIStyleSheetService.h"
#include "mozilla/Attributes.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheet.h"
class nsICategoryManager;
class nsIMemoryReporter;
@ -41,15 +41,15 @@ class nsStyleSheetService final
nsresult Init();
nsTArray<mozilla::StyleSheetHandle::RefPtr>* AgentStyleSheets()
nsTArray<RefPtr<mozilla::StyleSheet>>* AgentStyleSheets()
{
return &mSheets[AGENT_SHEET];
}
nsTArray<mozilla::StyleSheetHandle::RefPtr>* UserStyleSheets()
nsTArray<RefPtr<mozilla::StyleSheet>>* UserStyleSheets()
{
return &mSheets[USER_SHEET];
}
nsTArray<mozilla::StyleSheetHandle::RefPtr>* AuthorStyleSheets()
nsTArray<RefPtr<mozilla::StyleSheet>>* AuthorStyleSheets()
{
return &mSheets[AUTHOR_SHEET];
}
@ -67,7 +67,7 @@ class nsStyleSheetService final
nsISimpleEnumerator *aEnumerator,
uint32_t aSheetType);
int32_t FindSheetByURI(const nsTArray<mozilla::StyleSheetHandle::RefPtr>& aSheets,
int32_t FindSheetByURI(const nsTArray<RefPtr<mozilla::StyleSheet>>& aSheets,
nsIURI* aSheetURI);
// Like LoadAndRegisterSheet, but doesn't notify. If successful, the
@ -75,7 +75,7 @@ class nsStyleSheetService final
nsresult LoadAndRegisterSheetInternal(nsIURI *aSheetURI,
uint32_t aSheetType);
nsTArray<mozilla::StyleSheetHandle::RefPtr> mSheets[3];
nsTArray<RefPtr<mozilla::StyleSheet>> mSheets[3];
};
#endif

View File

@ -2086,7 +2086,7 @@ CSSStyleSheet::InsertRuleIntoGroup(const nsAString & aRule,
// nsICSSLoaderObserver implementation
NS_IMETHODIMP
CSSStyleSheet::StyleSheetLoaded(StyleSheetHandle aSheet,
CSSStyleSheet::StyleSheetLoaded(StyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus)
{

View File

@ -195,7 +195,7 @@ public:
uint32_t aIndex, uint32_t* aReturn);
// nsICSSLoaderObserver interface
NS_IMETHOD StyleSheetLoaded(StyleSheetHandle aSheet, bool aWasAlternate,
NS_IMETHOD StyleSheetLoaded(StyleSheet* aSheet, bool aWasAlternate,
nsresult aStatus) override;
void EnsureUniqueInner();

View File

@ -1692,7 +1692,7 @@ FontFaceSet::PrefEnabled()
// nsICSSLoaderObserver
NS_IMETHODIMP
FontFaceSet::StyleSheetLoaded(StyleSheetHandle aSheet,
FontFaceSet::StyleSheetLoaded(StyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus)
{

View File

@ -148,7 +148,7 @@ public:
static bool PrefEnabled();
// nsICSSLoaderObserver
NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheetHandle aSheet,
NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus) override;

View File

@ -19,7 +19,7 @@ namespace mozilla {
/**
* A class for holding strong references to handle-managed objects.
*
* This is intended for use with objects like StyleSheetHandle, where
* This is intended for use with objects like StyleSheet*, where
* the handle type is not a pointer but which can still have ->AddRef()
* and ->Release() called on it.
*/

View File

@ -53,8 +53,8 @@
#include "mozilla/dom/ShadowRoot.h"
#include "mozilla/dom/URL.h"
#include "mozilla/AsyncEventDispatcher.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/ConsoleReportCollector.h"
#ifdef MOZ_XUL
@ -124,7 +124,7 @@ public:
SheetLoadData(Loader* aLoader,
const nsSubstring& aTitle,
nsIURI* aURI,
StyleSheetHandle aSheet,
StyleSheet* aSheet,
nsIStyleSheetLinkingElement* aOwningElement,
bool aIsAlternate,
nsICSSLoaderObserver* aObserver,
@ -134,7 +134,7 @@ public:
// Data for loading a sheet linked from an @import rule
SheetLoadData(Loader* aLoader,
nsIURI* aURI,
StyleSheetHandle aSheet,
StyleSheet* aSheet,
SheetLoadData* aParentData,
nsICSSLoaderObserver* aObserver,
nsIPrincipal* aLoaderPrincipal,
@ -143,7 +143,7 @@ public:
// Data for loading a non-document sheet
SheetLoadData(Loader* aLoader,
nsIURI* aURI,
StyleSheetHandle aSheet,
StyleSheet* aSheet,
bool aSyncLoad,
bool aUseSystemPrincipal,
const nsCString& aCharset,
@ -178,7 +178,7 @@ public:
uint32_t mLineNumber;
// The sheet we're loading data for
StyleSheetHandle::RefPtr mSheet;
RefPtr<StyleSheet> mSheet;
// Linked list of datas for the same URI as us
SheetLoadData* mNext; // strong ref
@ -300,7 +300,7 @@ NS_IMPL_ISUPPORTS(SheetLoadData, nsIUnicharStreamLoaderObserver, nsIRunnable,
SheetLoadData::SheetLoadData(Loader* aLoader,
const nsSubstring& aTitle,
nsIURI* aURI,
StyleSheetHandle aSheet,
StyleSheet* aSheet,
nsIStyleSheetLinkingElement* aOwningElement,
bool aIsAlternate,
nsICSSLoaderObserver* aObserver,
@ -331,7 +331,7 @@ SheetLoadData::SheetLoadData(Loader* aLoader,
SheetLoadData::SheetLoadData(Loader* aLoader,
nsIURI* aURI,
StyleSheetHandle aSheet,
StyleSheet* aSheet,
SheetLoadData* aParentData,
nsICSSLoaderObserver* aObserver,
nsIPrincipal* aLoaderPrincipal,
@ -370,7 +370,7 @@ SheetLoadData::SheetLoadData(Loader* aLoader,
SheetLoadData::SheetLoadData(Loader* aLoader,
nsIURI* aURI,
StyleSheetHandle aSheet,
StyleSheet* aSheet,
bool aSyncLoad,
bool aUseSystemPrincipal,
const nsCString& aCharset,
@ -1081,7 +1081,7 @@ Loader::CreateSheet(nsIURI* aURI,
const nsAString& aTitle,
StyleSheetState& aSheetState,
bool *aIsAlternate,
StyleSheetHandle::RefPtr* aSheet)
RefPtr<StyleSheet>* aSheet)
{
LOG(("css::Loader::CreateSheet"));
NS_PRECONDITION(aSheet, "Null out param!");
@ -1100,7 +1100,7 @@ Loader::CreateSheet(nsIURI* aURI,
// XXXheycam Cached sheets currently must be CSSStyleSheets.
if (aURI && GetStyleBackendType() == StyleBackendType::Gecko) {
aSheetState = eSheetComplete;
StyleSheetHandle::RefPtr sheet;
RefPtr<StyleSheet> sheet;
// First, the XUL cache
#ifdef MOZ_XUL
@ -1109,7 +1109,7 @@ Loader::CreateSheet(nsIURI* aURI,
if (cache) {
if (cache->IsEnabled()) {
sheet = cache->GetStyleSheet(aURI);
LOG((" From XUL cache: %p", sheet->AsVoidPtr()));
LOG((" From XUL cache: %p", sheet.get()));
}
}
}
@ -1120,10 +1120,10 @@ Loader::CreateSheet(nsIURI* aURI,
// Then our per-document complete sheets.
URIPrincipalReferrerPolicyAndCORSModeHashKey key(aURI, aLoaderPrincipal, aCORSMode, aReferrerPolicy);
StyleSheetHandle completeSheet = nullptr;
StyleSheet* completeSheet = nullptr;
mSheets->mCompleteSheets.Get(&key, &completeSheet);
sheet = completeSheet;
LOG((" From completed: %p", sheet->AsVoidPtr()));
LOG((" From completed: %p", sheet.get()));
fromCompleteSheets = !!sheet;
}
@ -1141,7 +1141,7 @@ Loader::CreateSheet(nsIURI* aURI,
// Make sure it hasn't been modified; if it has, we can't use it
if (sheet->AsGecko()->IsModified()) {
LOG((" Not cloning completed sheet %p because it's been modified",
sheet->AsVoidPtr()));
sheet.get()));
sheet = nullptr;
fromCompleteSheets = false;
}
@ -1155,7 +1155,7 @@ Loader::CreateSheet(nsIURI* aURI,
mSheets->mLoadingDatas.Get(&key, &loadData);
if (loadData) {
sheet = loadData->mSheet;
LOG((" From loading: %p", sheet->AsVoidPtr()));
LOG((" From loading: %p", sheet.get()));
#ifdef DEBUG
bool debugEqual;
@ -1175,7 +1175,7 @@ Loader::CreateSheet(nsIURI* aURI,
mSheets->mPendingDatas.Get(&key, &loadData);
if (loadData) {
sheet = loadData->mSheet;
LOG((" From pending: %p", sheet->AsVoidPtr()));
LOG((" From pending: %p", sheet.get()));
#ifdef DEBUG
bool debugEqual;
@ -1272,7 +1272,7 @@ Loader::CreateSheet(nsIURI* aURI,
* the sheet had "alternate" in its rel.
*/
void
Loader::PrepareSheet(StyleSheetHandle aSheet,
Loader::PrepareSheet(StyleSheet* aSheet,
const nsSubstring& aTitle,
const nsSubstring& aMediaString,
nsMediaList* aMediaList,
@ -1324,7 +1324,7 @@ Loader::PrepareSheet(StyleSheetHandle aSheet,
* as determined by CompareDocumentPosition.
*/
nsresult
Loader::InsertSheetInDoc(StyleSheetHandle aSheet,
Loader::InsertSheetInDoc(StyleSheet* aSheet,
nsIContent* aLinkingContent,
nsIDocument* aDocument)
{
@ -1346,7 +1346,7 @@ Loader::InsertSheetInDoc(StyleSheetHandle aSheet,
*/
int32_t insertionPoint;
for (insertionPoint = sheetCount - 1; insertionPoint >= 0; --insertionPoint) {
StyleSheetHandle curSheet = aDocument->GetStyleSheetAt(insertionPoint);
StyleSheet* curSheet = aDocument->GetStyleSheetAt(insertionPoint);
NS_ASSERTION(curSheet, "There must be a sheet here!");
nsCOMPtr<nsINode> sheetOwner = curSheet->GetOwnerNode();
if (sheetOwner && !aLinkingContent) {
@ -1403,8 +1403,8 @@ Loader::InsertSheetInDoc(StyleSheetHandle aSheet,
* bug 1220506.)
*/
nsresult
Loader::InsertChildSheet(StyleSheetHandle aSheet,
StyleSheetHandle aParentSheet,
Loader::InsertChildSheet(StyleSheet* aSheet,
StyleSheet* aParentSheet,
ImportRule* aParentRule)
{
LOG(("css::Loader::InsertChildSheet"));
@ -1894,7 +1894,7 @@ Loader::DoSheetComplete(SheetLoadData* aLoadData, nsresult aStatus,
MOZ_ASSERT(!(data->mSheet->IsGecko() &&
data->mSheet->AsGecko()->IsModified()),
"should not get marked modified during parsing");
data->mSheet->AsStyleSheet()->SetComplete();
data->mSheet->SetComplete();
data->ScheduleLoadEventIfNeeded(aStatus);
}
if (data->mMustNotify && (data->mObserver || !mObservers.IsEmpty())) {
@ -2005,7 +2005,7 @@ Loader::LoadInlineStyle(nsIContent* aElement,
// load data or to CreateSheet(). Also, OK to use CORS_NONE for the CORS
// mode and mDocument's ReferrerPolicy.
StyleSheetState state;
StyleSheetHandle::RefPtr sheet;
RefPtr<StyleSheet> sheet;
nsresult rv = CreateSheet(nullptr, aElement, nullptr, eAuthorSheetFeatures,
CORS_NONE, mDocument->GetReferrerPolicy(),
EmptyString(), // no inline integrity checks
@ -2103,7 +2103,7 @@ Loader::LoadStyleLink(nsIContent* aElement,
}
StyleSheetState state;
StyleSheetHandle::RefPtr sheet;
RefPtr<StyleSheet> sheet;
rv = CreateSheet(aURL, aElement, principal, eAuthorSheetFeatures,
aCORSMode, aReferrerPolicy, aIntegrity, false,
aHasAlternateRel, aTitle, state, aIsAlternate,
@ -2120,7 +2120,7 @@ Loader::LoadStyleLink(nsIContent* aElement,
nsCOMPtr<nsIStyleSheetLinkingElement> owningElement(do_QueryInterface(aElement));
if (state == eSheetComplete) {
LOG((" Sheet already complete: 0x%p", sheet->AsVoidPtr()));
LOG((" Sheet already complete: 0x%p", sheet.get()));
if (aObserver || !mObservers.IsEmpty() || owningElement) {
rv = PostLoadEvent(aURL, sheet, aObserver, *aIsAlternate,
owningElement);
@ -2190,7 +2190,7 @@ HaveAncestorDataWithURI(SheetLoadData *aData, nsIURI *aURI)
}
nsresult
Loader::LoadChildSheet(StyleSheetHandle aParentSheet,
Loader::LoadChildSheet(StyleSheet* aParentSheet,
nsIURI* aURL,
nsMediaList* aMedia,
ImportRule* aParentRule,
@ -2212,8 +2212,8 @@ Loader::LoadChildSheet(StyleSheetHandle aParentSheet,
// check for an owning document: if none, don't bother walking up the parent
// sheets
if (aParentSheet->GetOwningDocument()) {
StyleSheetHandle topSheet = aParentSheet;
while (StyleSheetHandle parent = topSheet->GetParentSheet()) {
StyleSheet* topSheet = aParentSheet;
while (StyleSheet* parent = topSheet->GetParentSheet()) {
topSheet = parent;
}
owningNode = topSheet->GetOwnerNode();
@ -2257,7 +2257,7 @@ Loader::LoadChildSheet(StyleSheetHandle aParentSheet,
// Now that we know it's safe to load this (passes security check and not a
// loop) do so.
StyleSheetHandle::RefPtr sheet;
RefPtr<StyleSheet> sheet;
RefPtr<CSSStyleSheet> reusableSheet;
StyleSheetState state;
if (aReusableSheets && aReusableSheets->FindReusableStyleSheet(aURL, reusableSheet)) {
@ -2269,7 +2269,7 @@ Loader::LoadChildSheet(StyleSheetHandle aParentSheet,
const nsSubstring& empty = EmptyString();
// For now, use CORS_NONE for child sheets
rv = CreateSheet(aURL, nullptr, principal,
aParentSheet->AsStyleSheet()->ParsingMode(),
aParentSheet->ParsingMode(),
CORS_NONE, aParentSheet->GetReferrerPolicy(),
EmptyString(), // integrity is only checked on main sheet
parentData ? parentData->mSyncLoad : false,
@ -2312,7 +2312,7 @@ nsresult
Loader::LoadSheetSync(nsIURI* aURL,
SheetParsingMode aParsingMode,
bool aUseSystemPrincipal,
StyleSheetHandle::RefPtr* aSheet)
RefPtr<StyleSheet>* aSheet)
{
LOG(("css::Loader::LoadSheetSync"));
return InternalLoadNonDocumentSheet(aURL,
@ -2326,7 +2326,7 @@ Loader::LoadSheet(nsIURI* aURL,
nsIPrincipal* aOriginPrincipal,
const nsCString& aCharset,
nsICSSLoaderObserver* aObserver,
StyleSheetHandle::RefPtr* aSheet)
RefPtr<StyleSheet>* aSheet)
{
LOG(("css::Loader::LoadSheet(aURL, aObserver, aSheet) api call"));
NS_PRECONDITION(aSheet, "aSheet is null");
@ -2361,7 +2361,7 @@ Loader::InternalLoadNonDocumentSheet(nsIURI* aURL,
bool aUseSystemPrincipal,
nsIPrincipal* aOriginPrincipal,
const nsCString& aCharset,
StyleSheetHandle::RefPtr* aSheet,
RefPtr<StyleSheet>* aSheet,
nsICSSLoaderObserver* aObserver,
CORSMode aCORSMode,
ReferrerPolicy aReferrerPolicy,
@ -2389,7 +2389,7 @@ Loader::InternalLoadNonDocumentSheet(nsIURI* aURL,
StyleSheetState state;
bool isAlternate;
StyleSheetHandle::RefPtr sheet;
RefPtr<StyleSheet> sheet;
bool syncLoad = (aObserver == nullptr);
const nsSubstring& empty = EmptyString();
@ -2432,7 +2432,7 @@ Loader::InternalLoadNonDocumentSheet(nsIURI* aURL,
nsresult
Loader::PostLoadEvent(nsIURI* aURI,
StyleSheetHandle aSheet,
StyleSheet* aSheet,
nsICSSLoaderObserver* aObserver,
bool aWasAlternate,
nsIStyleSheetLinkingElement* aElement)
@ -2652,7 +2652,7 @@ Loader::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
// If aSheet has a parent, then its parent will report it so we don't
// have to worry about it here. Likewise, if aSheet has an owning node,
// then the document that node is in will report it.
const StyleSheetHandle sheet = iter.UserData();
const StyleSheet* sheet = iter.UserData();
n += (sheet->GetOwnerNode() || sheet->GetParentSheet())
? 0
: sheet->SizeOfIncludingThis(aMallocSizeOf);

View File

@ -24,7 +24,7 @@
#include "mozilla/Maybe.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/StyleBackendType.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/net/ReferrerPolicy.h"
class nsICSSLoaderObserver;
@ -290,7 +290,7 @@ public:
* @param aSavedSheets any saved style sheets which could be reused
* for this load
*/
nsresult LoadChildSheet(StyleSheetHandle aParentSheet,
nsresult LoadChildSheet(StyleSheet* aParentSheet,
nsIURI* aURL,
nsMediaList* aMedia,
ImportRule* aRule,
@ -321,13 +321,13 @@ public:
nsresult LoadSheetSync(nsIURI* aURL,
SheetParsingMode aParsingMode,
bool aUseSystemPrincipal,
StyleSheetHandle::RefPtr* aSheet);
RefPtr<StyleSheet>* aSheet);
/**
* As above, but defaults aParsingMode to eAuthorSheetFeatures and
* aUseSystemPrincipal to false.
*/
nsresult LoadSheetSync(nsIURI* aURL, StyleSheetHandle::RefPtr* aSheet) {
nsresult LoadSheetSync(nsIURI* aURL, RefPtr<StyleSheet>* aSheet) {
return LoadSheetSync(aURL, eAuthorSheetFeatures, false, aSheet);
}
@ -356,7 +356,7 @@ public:
nsIPrincipal* aOriginPrincipal,
const nsCString& aCharset,
nsICSSLoaderObserver* aObserver,
StyleSheetHandle::RefPtr* aSheet);
RefPtr<StyleSheet>* aSheet);
/**
* Same as above, to be used when the caller doesn't care about the
@ -466,24 +466,24 @@ private:
const nsAString& aTitle,
StyleSheetState& aSheetState,
bool *aIsAlternate,
StyleSheetHandle::RefPtr* aSheet);
RefPtr<StyleSheet>* aSheet);
// Pass in either a media string or the nsMediaList from the
// CSSParser. Don't pass both.
// This method will set the sheet's enabled state based on isAlternate
void PrepareSheet(StyleSheetHandle aSheet,
void PrepareSheet(StyleSheet* aSheet,
const nsAString& aTitle,
const nsAString& aMediaString,
nsMediaList* aMediaList,
dom::Element* aScopeElement,
bool isAlternate);
nsresult InsertSheetInDoc(StyleSheetHandle aSheet,
nsresult InsertSheetInDoc(StyleSheet* aSheet,
nsIContent* aLinkingContent,
nsIDocument* aDocument);
nsresult InsertChildSheet(StyleSheetHandle aSheet,
StyleSheetHandle aParentSheet,
nsresult InsertChildSheet(StyleSheet* aSheet,
StyleSheet* aParentSheet,
ImportRule* aParentRule);
nsresult InternalLoadNonDocumentSheet(nsIURI* aURL,
@ -492,7 +492,7 @@ private:
bool aUseSystemPrincipal,
nsIPrincipal* aOriginPrincipal,
const nsCString& aCharset,
StyleSheetHandle::RefPtr* aSheet,
RefPtr<StyleSheet>* aSheet,
nsICSSLoaderObserver* aObserver,
CORSMode aCORSMode = CORS_NONE,
ReferrerPolicy aReferrerPolicy = mozilla::net::RP_Default,
@ -506,7 +506,7 @@ private:
// sheet was loaded from (may be null for inline sheets). aElement is the
// owning element for this sheet.
nsresult PostLoadEvent(nsIURI* aURI,
StyleSheetHandle aSheet,
StyleSheet* aSheet,
nsICSSLoaderObserver* aObserver,
bool aWasAlternate,
nsIStyleSheetLinkingElement* aElement);
@ -545,8 +545,8 @@ private:
struct Sheets {
nsBaseHashtable<URIPrincipalReferrerPolicyAndCORSModeHashKey,
StyleSheetHandle::RefPtr,
StyleSheetHandle> mCompleteSheets;
RefPtr<StyleSheet>,
StyleSheet*> mCompleteSheets;
nsDataHashtable<URIPrincipalReferrerPolicyAndCORSModeHashKey, SheetLoadData*>
mLoadingDatas; // weak refs
nsDataHashtable<URIPrincipalReferrerPolicyAndCORSModeHashKey, SheetLoadData*>

View File

@ -352,7 +352,7 @@ nsresult
ServoStyleSet::AddDocStyleSheet(ServoStyleSheet* aSheet,
nsIDocument* aDocument)
{
StyleSheetHandle::RefPtr strong(aSheet);
RefPtr<StyleSheet> strong(aSheet);
mSheets[SheetType::Doc].RemoveElement(aSheet);

View File

@ -11,7 +11,7 @@
#include "mozilla/RefPtr.h"
#include "mozilla/SheetType.h"
#include "mozilla/StyleBackendType.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheet.h"
#include "nsChangeHint.h"
#include "nsCSSPseudoElements.h"
#include "nsTArray.h"
@ -132,18 +132,18 @@ public:
inline already_AddRefed<nsStyleContext>
ResolveAnonymousBoxStyle(nsIAtom* aPseudoTag, nsStyleContext* aParentContext,
uint32_t aFlags = 0);
inline nsresult AppendStyleSheet(SheetType aType, StyleSheetHandle aSheet);
inline nsresult PrependStyleSheet(SheetType aType, StyleSheetHandle aSheet);
inline nsresult RemoveStyleSheet(SheetType aType, StyleSheetHandle aSheet);
inline nsresult AppendStyleSheet(SheetType aType, StyleSheet* aSheet);
inline nsresult PrependStyleSheet(SheetType aType, StyleSheet* aSheet);
inline nsresult RemoveStyleSheet(SheetType aType, StyleSheet* aSheet);
inline nsresult ReplaceSheets(SheetType aType,
const nsTArray<StyleSheetHandle::RefPtr>& aNewSheets);
const nsTArray<RefPtr<StyleSheet>>& aNewSheets);
inline nsresult InsertStyleSheetBefore(SheetType aType,
StyleSheetHandle aNewSheet,
StyleSheetHandle aReferenceSheet);
StyleSheet* aNewSheet,
StyleSheet* aReferenceSheet);
inline int32_t SheetCount(SheetType aType) const;
inline StyleSheetHandle StyleSheetAt(SheetType aType, int32_t aIndex) const;
inline nsresult RemoveDocStyleSheet(StyleSheetHandle aSheet);
inline nsresult AddDocStyleSheet(StyleSheetHandle aSheet, nsIDocument* aDocument);
inline StyleSheet* StyleSheetAt(SheetType aType, int32_t aIndex) const;
inline nsresult RemoveDocStyleSheet(StyleSheet* aSheet);
inline nsresult AddDocStyleSheet(StyleSheet* aSheet, nsIDocument* aDocument);
inline already_AddRefed<nsStyleContext>
ProbePseudoElementStyle(dom::Element* aParentElement,
mozilla::CSSPseudoElementType aType,

View File

@ -126,21 +126,21 @@ StyleSetHandle::Ptr::ResolveAnonymousBoxStyle(nsIAtom* aPseudoTag,
// manage the set of style sheets in the style set
nsresult
StyleSetHandle::Ptr::AppendStyleSheet(SheetType aType, StyleSheetHandle aSheet)
StyleSetHandle::Ptr::AppendStyleSheet(SheetType aType, StyleSheet* aSheet)
{
FORWARD_CONCRETE(AppendStyleSheet, (aType, aSheet->AsGecko()),
(aType, aSheet->AsServo()));
}
nsresult
StyleSetHandle::Ptr::PrependStyleSheet(SheetType aType, StyleSheetHandle aSheet)
StyleSetHandle::Ptr::PrependStyleSheet(SheetType aType, StyleSheet* aSheet)
{
FORWARD_CONCRETE(PrependStyleSheet, (aType, aSheet->AsGecko()),
(aType, aSheet->AsServo()));
}
nsresult
StyleSetHandle::Ptr::RemoveStyleSheet(SheetType aType, StyleSheetHandle aSheet)
StyleSetHandle::Ptr::RemoveStyleSheet(SheetType aType, StyleSheet* aSheet)
{
FORWARD_CONCRETE(RemoveStyleSheet, (aType, aSheet->AsGecko()),
(aType, aSheet->AsServo()));
@ -148,7 +148,7 @@ StyleSetHandle::Ptr::RemoveStyleSheet(SheetType aType, StyleSheetHandle aSheet)
nsresult
StyleSetHandle::Ptr::ReplaceSheets(SheetType aType,
const nsTArray<StyleSheetHandle::RefPtr>& aNewSheets)
const nsTArray<RefPtr<StyleSheet>>& aNewSheets)
{
if (IsGecko()) {
nsTArray<RefPtr<CSSStyleSheet>> newSheets(aNewSheets.Length());
@ -167,8 +167,8 @@ StyleSetHandle::Ptr::ReplaceSheets(SheetType aType,
nsresult
StyleSetHandle::Ptr::InsertStyleSheetBefore(SheetType aType,
StyleSheetHandle aNewSheet,
StyleSheetHandle aReferenceSheet)
StyleSheet* aNewSheet,
StyleSheet* aReferenceSheet)
{
FORWARD_CONCRETE(
InsertStyleSheetBefore,
@ -182,21 +182,21 @@ StyleSetHandle::Ptr::SheetCount(SheetType aType) const
FORWARD(SheetCount, (aType));
}
StyleSheetHandle
StyleSheet*
StyleSetHandle::Ptr::StyleSheetAt(SheetType aType, int32_t aIndex) const
{
FORWARD(StyleSheetAt, (aType, aIndex));
}
nsresult
StyleSetHandle::Ptr::RemoveDocStyleSheet(StyleSheetHandle aSheet)
StyleSetHandle::Ptr::RemoveDocStyleSheet(StyleSheet* aSheet)
{
FORWARD_CONCRETE(RemoveDocStyleSheet, (aSheet->AsGecko()),
(aSheet->AsServo()));
}
nsresult
StyleSetHandle::Ptr::AddDocStyleSheet(StyleSheetHandle aSheet,
StyleSetHandle::Ptr::AddDocStyleSheet(StyleSheet* aSheet,
nsIDocument* aDocument)
{
FORWARD_CONCRETE(AddDocStyleSheet, (aSheet->AsGecko(), aDocument),

View File

@ -64,7 +64,7 @@ StyleSheet::SetComplete()
if (mDocument && !mDisabled) {
// Let the document know
mDocument->BeginUpdate(UPDATE_STYLE);
mDocument->SetStyleSheetApplicableState(AsHandle(), true);
mDocument->SetStyleSheetApplicableState(this, true);
mDocument->EndUpdate(UPDATE_STYLE);
}

View File

@ -9,7 +9,7 @@
#define nsICSSLoaderObserver_h___
#include "nsISupports.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheet.h"
#define NS_ICSSLOADEROBSERVER_IID \
{ 0xf51fbf2c, 0xfe4b, 0x4a15, \
@ -34,7 +34,7 @@ public:
* as CSS, and doesn't indicate anything about the status of any child
* sheets of aSheet.
*/
NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheetHandle aSheet,
NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus) = 0;
};

View File

@ -10,8 +10,8 @@
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/Preferences.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/css/Loader.h"
#include "mozilla/dom/SRIMetadata.h"
#include "nsIFile.h"
@ -68,7 +68,7 @@ nsLayoutStylesheetCache::Observe(nsISupports* aSubject,
return NS_OK;
}
StyleSheetHandle
StyleSheet*
nsLayoutStylesheetCache::ScrollbarsSheet()
{
if (!mScrollbarsSheet) {
@ -80,7 +80,7 @@ nsLayoutStylesheetCache::ScrollbarsSheet()
return mScrollbarsSheet;
}
StyleSheetHandle
StyleSheet*
nsLayoutStylesheetCache::FormsSheet()
{
if (!mFormsSheet) {
@ -92,7 +92,7 @@ nsLayoutStylesheetCache::FormsSheet()
return mFormsSheet;
}
StyleSheetHandle
StyleSheet*
nsLayoutStylesheetCache::NumberControlSheet()
{
if (!sNumberControlEnabled) {
@ -107,19 +107,19 @@ nsLayoutStylesheetCache::NumberControlSheet()
return mNumberControlSheet;
}
StyleSheetHandle
StyleSheet*
nsLayoutStylesheetCache::UserContentSheet()
{
return mUserContentSheet;
}
StyleSheetHandle
StyleSheet*
nsLayoutStylesheetCache::UserChromeSheet()
{
return mUserChromeSheet;
}
StyleSheetHandle
StyleSheet*
nsLayoutStylesheetCache::UASheet()
{
if (!mUASheet) {
@ -130,7 +130,7 @@ nsLayoutStylesheetCache::UASheet()
return mUASheet;
}
StyleSheetHandle
StyleSheet*
nsLayoutStylesheetCache::HTMLSheet()
{
if (!mHTMLSheet) {
@ -141,31 +141,31 @@ nsLayoutStylesheetCache::HTMLSheet()
return mHTMLSheet;
}
StyleSheetHandle
StyleSheet*
nsLayoutStylesheetCache::MinimalXULSheet()
{
return mMinimalXULSheet;
}
StyleSheetHandle
StyleSheet*
nsLayoutStylesheetCache::XULSheet()
{
return mXULSheet;
}
StyleSheetHandle
StyleSheet*
nsLayoutStylesheetCache::QuirkSheet()
{
return mQuirkSheet;
}
StyleSheetHandle
StyleSheet*
nsLayoutStylesheetCache::SVGSheet()
{
return mSVGSheet;
}
StyleSheetHandle
StyleSheet*
nsLayoutStylesheetCache::MathMLSheet()
{
if (!mMathMLSheet) {
@ -176,13 +176,13 @@ nsLayoutStylesheetCache::MathMLSheet()
return mMathMLSheet;
}
StyleSheetHandle
StyleSheet*
nsLayoutStylesheetCache::CounterStylesSheet()
{
return mCounterStylesSheet;
}
StyleSheetHandle
StyleSheet*
nsLayoutStylesheetCache::NoScriptSheet()
{
if (!mNoScriptSheet) {
@ -193,7 +193,7 @@ nsLayoutStylesheetCache::NoScriptSheet()
return mNoScriptSheet;
}
StyleSheetHandle
StyleSheet*
nsLayoutStylesheetCache::NoFramesSheet()
{
if (!mNoFramesSheet) {
@ -204,7 +204,7 @@ nsLayoutStylesheetCache::NoFramesSheet()
return mNoFramesSheet;
}
StyleSheetHandle
StyleSheet*
nsLayoutStylesheetCache::ChromePreferenceSheet(nsPresContext* aPresContext)
{
if (!mChromePreferenceSheet) {
@ -214,7 +214,7 @@ nsLayoutStylesheetCache::ChromePreferenceSheet(nsPresContext* aPresContext)
return mChromePreferenceSheet;
}
StyleSheetHandle
StyleSheet*
nsLayoutStylesheetCache::ContentPreferenceSheet(nsPresContext* aPresContext)
{
if (!mContentPreferenceSheet) {
@ -224,7 +224,7 @@ nsLayoutStylesheetCache::ContentPreferenceSheet(nsPresContext* aPresContext)
return mContentPreferenceSheet;
}
StyleSheetHandle
StyleSheet*
nsLayoutStylesheetCache::ContentEditableSheet()
{
if (!mContentEditableSheet) {
@ -235,7 +235,7 @@ nsLayoutStylesheetCache::ContentEditableSheet()
return mContentEditableSheet;
}
StyleSheetHandle
StyleSheet*
nsLayoutStylesheetCache::DesignModeSheet()
{
if (!mDesignModeSheet) {
@ -418,7 +418,7 @@ nsLayoutStylesheetCache::InitFromProfile()
void
nsLayoutStylesheetCache::LoadSheetURL(const char* aURL,
StyleSheetHandle::RefPtr* aSheet,
RefPtr<StyleSheet>* aSheet,
SheetParsingMode aParsingMode)
{
nsCOMPtr<nsIURI> uri;
@ -431,7 +431,7 @@ nsLayoutStylesheetCache::LoadSheetURL(const char* aURL,
void
nsLayoutStylesheetCache::LoadSheetFile(nsIFile* aFile,
StyleSheetHandle::RefPtr* aSheet,
RefPtr<StyleSheet>* aSheet,
SheetParsingMode aParsingMode)
{
bool exists = false;
@ -733,7 +733,7 @@ ErrorLoadingBuiltinSheet(nsIURI* aURI, const char* aMsg)
void
nsLayoutStylesheetCache::LoadSheet(nsIURI* aURI,
StyleSheetHandle::RefPtr* aSheet,
RefPtr<StyleSheet>* aSheet,
SheetParsingMode aParsingMode)
{
if (!aURI) {
@ -764,8 +764,8 @@ nsLayoutStylesheetCache::LoadSheet(nsIURI* aURI,
}
/* static */ void
nsLayoutStylesheetCache::InvalidateSheet(StyleSheetHandle::RefPtr* aGeckoSheet,
StyleSheetHandle::RefPtr* aServoSheet)
nsLayoutStylesheetCache::InvalidateSheet(RefPtr<StyleSheet>* aGeckoSheet,
RefPtr<StyleSheet>* aServoSheet)
{
MOZ_ASSERT(gCSSLoader_Gecko || gCSSLoader_Servo,
"pref changed before we loaded a sheet?");
@ -839,7 +839,7 @@ nsLayoutStylesheetCache::InvalidatePreferenceSheets()
}
void
nsLayoutStylesheetCache::BuildPreferenceSheet(StyleSheetHandle::RefPtr* aSheet,
nsLayoutStylesheetCache::BuildPreferenceSheet(RefPtr<StyleSheet>* aSheet,
nsPresContext* aPresContext)
{
if (mBackendType == StyleBackendType::Gecko) {
@ -850,14 +850,14 @@ nsLayoutStylesheetCache::BuildPreferenceSheet(StyleSheetHandle::RefPtr* aSheet,
mozilla::net::RP_Default, dom::SRIMetadata());
}
StyleSheetHandle sheet = *aSheet;
StyleSheet* sheet = *aSheet;
nsCOMPtr<nsIURI> uri;
NS_NewURI(getter_AddRefs(uri), "about:PreferenceStyleSheet", nullptr);
MOZ_ASSERT(uri, "URI creation shouldn't fail");
sheet->SetURIs(uri, uri, uri);
sheet->AsStyleSheet()->SetComplete();
sheet->SetComplete();
static const uint32_t kPreallocSize = 1024;

View File

@ -40,27 +40,27 @@ class nsLayoutStylesheetCache final
*/
static nsLayoutStylesheetCache* For(mozilla::StyleBackendType aType);
mozilla::StyleSheetHandle ScrollbarsSheet();
mozilla::StyleSheetHandle FormsSheet();
mozilla::StyleSheet* ScrollbarsSheet();
mozilla::StyleSheet* FormsSheet();
// This function is expected to return nullptr when the dom.forms.number
// pref is disabled.
mozilla::StyleSheetHandle NumberControlSheet();
mozilla::StyleSheetHandle UserContentSheet();
mozilla::StyleSheetHandle UserChromeSheet();
mozilla::StyleSheetHandle UASheet();
mozilla::StyleSheetHandle HTMLSheet();
mozilla::StyleSheetHandle MinimalXULSheet();
mozilla::StyleSheetHandle XULSheet();
mozilla::StyleSheetHandle QuirkSheet();
mozilla::StyleSheetHandle SVGSheet();
mozilla::StyleSheetHandle MathMLSheet();
mozilla::StyleSheetHandle CounterStylesSheet();
mozilla::StyleSheetHandle NoScriptSheet();
mozilla::StyleSheetHandle NoFramesSheet();
mozilla::StyleSheetHandle ChromePreferenceSheet(nsPresContext* aPresContext);
mozilla::StyleSheetHandle ContentPreferenceSheet(nsPresContext* aPresContext);
mozilla::StyleSheetHandle ContentEditableSheet();
mozilla::StyleSheetHandle DesignModeSheet();
mozilla::StyleSheet* NumberControlSheet();
mozilla::StyleSheet* UserContentSheet();
mozilla::StyleSheet* UserChromeSheet();
mozilla::StyleSheet* UASheet();
mozilla::StyleSheet* HTMLSheet();
mozilla::StyleSheet* MinimalXULSheet();
mozilla::StyleSheet* XULSheet();
mozilla::StyleSheet* QuirkSheet();
mozilla::StyleSheet* SVGSheet();
mozilla::StyleSheet* MathMLSheet();
mozilla::StyleSheet* CounterStylesSheet();
mozilla::StyleSheet* NoScriptSheet();
mozilla::StyleSheet* NoFramesSheet();
mozilla::StyleSheet* ChromePreferenceSheet(nsPresContext* aPresContext);
mozilla::StyleSheet* ContentPreferenceSheet(nsPresContext* aPresContext);
mozilla::StyleSheet* ContentEditableSheet();
mozilla::StyleSheet* DesignModeSheet();
static void InvalidatePreferenceSheets();
@ -75,17 +75,17 @@ private:
void InitFromProfile();
void InitMemoryReporter();
void LoadSheetURL(const char* aURL,
mozilla::StyleSheetHandle::RefPtr* aSheet,
RefPtr<mozilla::StyleSheet>* aSheet,
mozilla::css::SheetParsingMode aParsingMode);
void LoadSheetFile(nsIFile* aFile,
mozilla::StyleSheetHandle::RefPtr* aSheet,
RefPtr<mozilla::StyleSheet>* aSheet,
mozilla::css::SheetParsingMode aParsingMode);
void LoadSheet(nsIURI* aURI, mozilla::StyleSheetHandle::RefPtr* aSheet,
void LoadSheet(nsIURI* aURI, RefPtr<mozilla::StyleSheet>* aSheet,
mozilla::css::SheetParsingMode aParsingMode);
static void InvalidateSheet(mozilla::StyleSheetHandle::RefPtr* aGeckoSheet,
mozilla::StyleSheetHandle::RefPtr* aServoSheet);
static void InvalidateSheet(RefPtr<mozilla::StyleSheet>* aGeckoSheet,
RefPtr<mozilla::StyleSheet>* aServoSheet);
static void DependentPrefChanged(const char* aPref, void* aData);
void BuildPreferenceSheet(mozilla::StyleSheetHandle::RefPtr* aSheet,
void BuildPreferenceSheet(RefPtr<mozilla::StyleSheet>* aSheet,
nsPresContext* aPresContext);
static mozilla::StaticRefPtr<nsLayoutStylesheetCache> gStyleCache_Gecko;
@ -93,25 +93,25 @@ private:
static mozilla::StaticRefPtr<mozilla::css::Loader> gCSSLoader_Gecko;
static mozilla::StaticRefPtr<mozilla::css::Loader> gCSSLoader_Servo;
mozilla::StyleBackendType mBackendType;
mozilla::StyleSheetHandle::RefPtr mChromePreferenceSheet;
mozilla::StyleSheetHandle::RefPtr mContentEditableSheet;
mozilla::StyleSheetHandle::RefPtr mContentPreferenceSheet;
mozilla::StyleSheetHandle::RefPtr mCounterStylesSheet;
mozilla::StyleSheetHandle::RefPtr mDesignModeSheet;
mozilla::StyleSheetHandle::RefPtr mFormsSheet;
mozilla::StyleSheetHandle::RefPtr mHTMLSheet;
mozilla::StyleSheetHandle::RefPtr mMathMLSheet;
mozilla::StyleSheetHandle::RefPtr mMinimalXULSheet;
mozilla::StyleSheetHandle::RefPtr mNoFramesSheet;
mozilla::StyleSheetHandle::RefPtr mNoScriptSheet;
mozilla::StyleSheetHandle::RefPtr mNumberControlSheet;
mozilla::StyleSheetHandle::RefPtr mQuirkSheet;
mozilla::StyleSheetHandle::RefPtr mSVGSheet;
mozilla::StyleSheetHandle::RefPtr mScrollbarsSheet;
mozilla::StyleSheetHandle::RefPtr mUASheet;
mozilla::StyleSheetHandle::RefPtr mUserChromeSheet;
mozilla::StyleSheetHandle::RefPtr mUserContentSheet;
mozilla::StyleSheetHandle::RefPtr mXULSheet;
RefPtr<mozilla::StyleSheet> mChromePreferenceSheet;
RefPtr<mozilla::StyleSheet> mContentEditableSheet;
RefPtr<mozilla::StyleSheet> mContentPreferenceSheet;
RefPtr<mozilla::StyleSheet> mCounterStylesSheet;
RefPtr<mozilla::StyleSheet> mDesignModeSheet;
RefPtr<mozilla::StyleSheet> mFormsSheet;
RefPtr<mozilla::StyleSheet> mHTMLSheet;
RefPtr<mozilla::StyleSheet> mMathMLSheet;
RefPtr<mozilla::StyleSheet> mMinimalXULSheet;
RefPtr<mozilla::StyleSheet> mNoFramesSheet;
RefPtr<mozilla::StyleSheet> mNoScriptSheet;
RefPtr<mozilla::StyleSheet> mNumberControlSheet;
RefPtr<mozilla::StyleSheet> mQuirkSheet;
RefPtr<mozilla::StyleSheet> mSVGSheet;
RefPtr<mozilla::StyleSheet> mScrollbarsSheet;
RefPtr<mozilla::StyleSheet> mUASheet;
RefPtr<mozilla::StyleSheet> mUserChromeSheet;
RefPtr<mozilla::StyleSheet> mUserContentSheet;
RefPtr<mozilla::StyleSheet> mXULSheet;
};
#endif

View File

@ -20,8 +20,8 @@
#include "nsIBaseWindow.h"
#include "nsIDocument.h"
#include "nsContentUtils.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
using namespace mozilla;

View File

@ -18,7 +18,7 @@
#include "mozilla/EventStates.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/RuleProcessorCache.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheetInlines.h"
#include "nsIDocumentInlines.h"
#include "nsRuleWalker.h"
#include "nsStyleContext.h"
@ -751,9 +751,9 @@ nsStyleSet::AppendAllXBLStyleSheets(nsTArray<mozilla::CSSStyleSheet*>& aArray) c
// XXXheycam stylo: AppendAllSheets will need to be able to return either
// CSSStyleSheets or ServoStyleSheets, on request (and then here requesting
// CSSStyleSheets).
AutoTArray<StyleSheetHandle, 32> sheets;
AutoTArray<StyleSheet*, 32> sheets;
mBindingManager->AppendAllSheets(sheets);
for (StyleSheetHandle handle : sheets) {
for (StyleSheet* handle : sheets) {
MOZ_ASSERT(handle->IsGecko(), "stylo: AppendAllSheets shouldn't give us "
"ServoStyleSheets yet");
aArray.AppendElement(handle->AsGecko());
@ -2474,12 +2474,12 @@ nsStyleSet::EnsureUniqueInnerOnCSSSheets()
}
if (mBindingManager) {
AutoTArray<StyleSheetHandle, 32> sheets;
AutoTArray<StyleSheet*, 32> sheets;
// XXXheycam stylo: AppendAllSheets will need to be able to return either
// CSSStyleSheets or ServoStyleSheets, on request (and then here requesting
// CSSStyleSheets).
mBindingManager->AppendAllSheets(sheets);
for (StyleSheetHandle sheet : sheets) {
for (StyleSheet* sheet : sheets) {
MOZ_ASSERT(sheet->IsGecko(), "stylo: AppendAllSheets shouldn't give us "
"ServoStyleSheets yet");
queue.AppendElement(sheet->AsGecko());