Skip to content

Commit

Permalink
Bug 1304302 part 10 - Replace all uses of StyleSheetHandle. r=heycam
Browse files Browse the repository at this point in the history
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
  • Loading branch information
upsuper committed Sep 26, 2016
1 parent 4be4e1b commit 2f49a48
Show file tree
Hide file tree
Showing 59 changed files with 454 additions and 454 deletions.
24 changes: 12 additions & 12 deletions chrome/nsChromeRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -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) {
Expand All @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions dom/base/ShadowRoot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -132,7 +132,7 @@ ShadowRoot::StyleSheetChanged()
}

void
ShadowRoot::InsertSheet(StyleSheetHandle aSheet,
ShadowRoot::InsertSheet(StyleSheet* aSheet,
nsIContent* aLinkingContent)
{
nsCOMPtr<nsIStyleSheetLinkingElement>
Expand Down Expand Up @@ -163,7 +163,7 @@ ShadowRoot::InsertSheet(StyleSheetHandle aSheet,
}

void
ShadowRoot::RemoveSheet(StyleSheetHandle aSheet)
ShadowRoot::RemoveSheet(StyleSheet* aSheet)
{
mProtoBinding->RemoveStyleSheet(aSheet);

Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions dom/base/ShadowRoot.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -47,8 +47,8 @@ class ShadowRoot final : public DocumentFragment,

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();
Expand Down
2 changes: 1 addition & 1 deletion dom/base/nsContentSink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ nsContentSink::Init(nsIDocument* aDoc,
}

NS_IMETHODIMP
nsContentSink::StyleSheetLoaded(StyleSheetHandle aSheet,
nsContentSink::StyleSheetLoaded(StyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus)
{
Expand Down
2 changes: 1 addition & 1 deletion dom/base/nsContentSink.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Loading

0 comments on commit 2f49a48

Please sign in to comment.