Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1022855 - Rename nsCSSStyleSheet to mozilla::CSSStyleSheet; r=heycam
Browse files Browse the repository at this point in the history
  • Loading branch information
Ms2ger committed Jun 20, 2014
1 parent 371b470 commit 039322a
Show file tree
Hide file tree
Showing 80 changed files with 687 additions and 618 deletions.
14 changes: 9 additions & 5 deletions chrome/src/nsChromeRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
#include "nsNetUtil.h"
#include "nsString.h"

#include "nsCSSStyleSheet.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/dom/URL.h"
#include "nsIConsoleService.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
Expand All @@ -27,9 +28,12 @@
#include "nsIPresShell.h"
#include "nsIScriptError.h"
#include "nsIWindowMediator.h"
#include "mozilla/dom/URL.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::CSSStyleSheet;
using mozilla::dom::IsChromeURI;

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -415,7 +419,7 @@ nsresult nsChromeRegistry::RefreshWindow(nsIDOMWindow* aWindow)

if (IsChromeURI(uri)) {
// Reload the sheet.
nsRefPtr<nsCSSStyleSheet> newSheet;
nsRefPtr<CSSStyleSheet> newSheet;
rv = document->LoadChromeSheetSync(uri, true,
getter_AddRefs(newSheet));
if (NS_FAILED(rv)) return rv;
Expand Down Expand Up @@ -454,12 +458,12 @@ nsresult nsChromeRegistry::RefreshWindow(nsIDOMWindow* aWindow)
// Iterate over our old sheets and kick off a sync load of the new
// sheet if and only if it's a chrome URL.
for (i = 0; i < count; i++) {
nsRefPtr<nsCSSStyleSheet> sheet = do_QueryObject(oldSheets[i]);
nsRefPtr<CSSStyleSheet> sheet = do_QueryObject(oldSheets[i]);
nsIURI* uri = sheet ? sheet->GetOriginalURI() : nullptr;

if (uri && IsChromeURI(uri)) {
// Reload the sheet.
nsRefPtr<nsCSSStyleSheet> newSheet;
nsRefPtr<CSSStyleSheet> newSheet;
// XXX what about chrome sheets that have a title or are disabled? This
// only works by sheer dumb luck.
document->LoadChromeSheetSync(uri, false, getter_AddRefs(newSheet));
Expand Down
6 changes: 3 additions & 3 deletions content/base/public/nsIDocument.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
class imgIRequest;
class nsAString;
class nsBindingManager;
class nsCSSStyleSheet;
class nsIDocShell;
class nsDocShell;
class nsDOMNavigationTiming;
Expand Down Expand Up @@ -83,6 +82,7 @@ class nsIGlobalObject;
struct nsCSSSelectorList;

namespace mozilla {
class CSSStyleSheet;
class ErrorResult;
class EventStates;

Expand Down Expand Up @@ -779,7 +779,7 @@ class nsIDocument : public nsINode
* TODO We can get rid of the whole concept of delayed loading if we fix
* bug 77999.
*/
virtual void EnsureOnDemandBuiltInUASheet(nsCSSStyleSheet* aSheet) = 0;
virtual void EnsureOnDemandBuiltInUASheet(mozilla::CSSStyleSheet* aSheet) = 0;

/**
* Get the number of (document) stylesheets
Expand Down Expand Up @@ -1836,7 +1836,7 @@ class nsIDocument : public nsINode
* DO NOT USE FOR UNTRUSTED CONTENT.
*/
virtual nsresult LoadChromeSheetSync(nsIURI* aURI, bool aIsAgentSheet,
nsCSSStyleSheet** aSheet) = 0;
mozilla::CSSStyleSheet** aSheet) = 0;

/**
* Returns true if the locale used for the document specifies a direction of
Expand Down
7 changes: 5 additions & 2 deletions content/base/public/nsIStyleSheetLinkingElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ class nsIURI;
{ 0xb2, 0xe9, 0x63, 0x52, 0x8c, 0x87, 0x99, 0x7a } }

class nsIStyleSheet;
class nsCSSStyleSheet;

namespace mozilla {
class CSSStyleSheet;
} // namespace mozilla

class nsIStyleSheetLinkingElement : public nsISupports {
public:
Expand All @@ -29,7 +32,7 @@ class nsIStyleSheetLinkingElement : public nsISupports {
* @param aStyleSheet the style sheet associated with this
* element.
*/
NS_IMETHOD SetStyleSheet(nsCSSStyleSheet* aStyleSheet) = 0;
NS_IMETHOD SetStyleSheet(mozilla::CSSStyleSheet* aStyleSheet) = 0;

/**
* Used to obtain the style sheet linked in by this element.
Expand Down
6 changes: 3 additions & 3 deletions content/base/src/ShadowRoot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ ShadowRoot::StyleSheetChanged()
}

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

void
ShadowRoot::RemoveSheet(nsCSSStyleSheet* aSheet)
ShadowRoot::RemoveSheet(CSSStyleSheet* aSheet)
{
mProtoBinding->RemoveStyleSheet(aSheet);

Expand Down Expand Up @@ -719,7 +719,7 @@ ShadowRootStyleSheetList::~ShadowRootStyleSheetList()
MOZ_COUNT_DTOR(ShadowRootStyleSheetList);
}

nsCSSStyleSheet*
CSSStyleSheet*
ShadowRootStyleSheetList::IndexedGetter(uint32_t aIndex, bool& aFound)
{
aFound = aIndex < mShadowRoot->mProtoBinding->SheetCount();
Expand Down
6 changes: 3 additions & 3 deletions content/base/src/ShadowRoot.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class ShadowRoot : public DocumentFragment,

void AddToIdTable(Element* aElement, nsIAtom* aId);
void RemoveFromIdTable(Element* aElement, nsIAtom* aId);
void InsertSheet(nsCSSStyleSheet* aSheet, nsIContent* aLinkingContent);
void RemoveSheet(nsCSSStyleSheet* aSheet);
void InsertSheet(CSSStyleSheet* aSheet, nsIContent* aLinkingContent);
void RemoveSheet(CSSStyleSheet* aSheet);
bool ApplyAuthorStyles();
void SetApplyAuthorStyles(bool aApplyAuthorStyles);
StyleSheetList* StyleSheets();
Expand Down Expand Up @@ -187,7 +187,7 @@ class ShadowRootStyleSheetList : public StyleSheetList
}

virtual uint32_t Length() MOZ_OVERRIDE;
virtual nsCSSStyleSheet* IndexedGetter(uint32_t aIndex, bool& aFound) MOZ_OVERRIDE;
virtual CSSStyleSheet* IndexedGetter(uint32_t aIndex, bool& aFound) MOZ_OVERRIDE;

protected:
nsRefPtr<ShadowRoot> mShadowRoot;
Expand Down
2 changes: 1 addition & 1 deletion content/base/src/StyleSheetList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#include "mozilla/dom/StyleSheetList.h"

#include "mozilla/CSSStyleSheet.h"
#include "mozilla/dom/StyleSheetListBinding.h"
#include "nsCSSStyleSheet.h"

namespace mozilla {
namespace dom {
Expand Down
7 changes: 4 additions & 3 deletions content/base/src/StyleSheetList.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
#include "nsIDOMStyleSheetList.h"
#include "nsWrapperCache.h"

class nsCSSStyleSheet;
class nsINode;

namespace mozilla {
class CSSStyleSheet;

namespace dom {

class StyleSheetList : public nsIDOMStyleSheetList
Expand All @@ -34,8 +35,8 @@ class StyleSheetList : public nsIDOMStyleSheetList
virtual nsINode* GetParentObject() const = 0;

virtual uint32_t Length() = 0;
virtual nsCSSStyleSheet* IndexedGetter(uint32_t aIndex, bool& aFound) = 0;
nsCSSStyleSheet* Item(uint32_t aIndex)
virtual CSSStyleSheet* IndexedGetter(uint32_t aIndex, bool& aFound) = 0;
CSSStyleSheet* Item(uint32_t aIndex)
{
bool dummy = false;
return IndexedGetter(aIndex, dummy);
Expand Down
2 changes: 1 addition & 1 deletion content/base/src/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(nsCSSStyleSheet* aSheet,
nsContentSink::StyleSheetLoaded(CSSStyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus)
{
Expand Down
3 changes: 2 additions & 1 deletion content/base/src/nsContentSink.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ class nsContentSink : public nsICSSLoaderObserver,
NS_DECL_NSITIMERCALLBACK

// nsICSSLoaderObserver
NS_IMETHOD StyleSheetLoaded(nsCSSStyleSheet* aSheet, bool aWasAlternate,
NS_IMETHOD StyleSheetLoaded(mozilla::CSSStyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus) MOZ_OVERRIDE;

virtual nsresult ProcessMETATag(nsIContent* aContent);
Expand Down
22 changes: 11 additions & 11 deletions content/base/src/nsDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ nsDOMStyleSheetList::Length()
return mLength;
}

nsCSSStyleSheet*
CSSStyleSheet*
nsDOMStyleSheetList::IndexedGetter(uint32_t aIndex, bool& aFound)
{
if (!mDocument || aIndex >= (uint32_t)mDocument->GetNumberOfStyleSheets()) {
Expand All @@ -773,7 +773,7 @@ nsDOMStyleSheetList::IndexedGetter(uint32_t aIndex, bool& aFound)
nsIStyleSheet *sheet = mDocument->GetStyleSheetAt(aIndex);
NS_ASSERTION(sheet, "Must have a sheet");

return static_cast<nsCSSStyleSheet*>(sheet);
return static_cast<CSSStyleSheet*>(sheet);
}

void
Expand Down Expand Up @@ -3970,7 +3970,7 @@ nsDocument::RemoveChildAt(uint32_t aIndex, bool aNotify)
}

void
nsDocument::EnsureOnDemandBuiltInUASheet(nsCSSStyleSheet* aSheet)
nsDocument::EnsureOnDemandBuiltInUASheet(CSSStyleSheet* aSheet)
{
// Contains() takes nsISupport*, so annoyingly we have to cast here
if (mOnDemandBuiltInUASheets.Contains(static_cast<nsIStyleSheet*>(aSheet))) {
Expand All @@ -3982,7 +3982,7 @@ nsDocument::EnsureOnDemandBuiltInUASheet(nsCSSStyleSheet* aSheet)
}

void
nsDocument::AddOnDemandBuiltInUASheet(nsCSSStyleSheet* aSheet)
nsDocument::AddOnDemandBuiltInUASheet(CSSStyleSheet* aSheet)
{
// Contains() takes nsISupport*, so annoyingly we have to cast here
MOZ_ASSERT(!mOnDemandBuiltInUASheets.Contains(static_cast<nsIStyleSheet*>(aSheet)));
Expand Down Expand Up @@ -4280,7 +4280,7 @@ nsDocument::LoadAdditionalStyleSheet(additionalSheetType aType, nsIURI* aSheetUR
// Loading the sheet sync.
nsRefPtr<mozilla::css::Loader> loader = new mozilla::css::Loader();

nsRefPtr<nsCSSStyleSheet> sheet;
nsRefPtr<CSSStyleSheet> sheet;
nsresult rv = loader->LoadSheetSync(aSheetURI, aType == eAgentSheet,
true, getter_AddRefs(sheet));
NS_ENSURE_SUCCESS(rv, rv);
Expand Down Expand Up @@ -9331,7 +9331,7 @@ namespace {
class StubCSSLoaderObserver MOZ_FINAL : public nsICSSLoaderObserver {
public:
NS_IMETHOD
StyleSheetLoaded(nsCSSStyleSheet*, bool, nsresult)
StyleSheetLoaded(CSSStyleSheet*, bool, nsresult)
{
return NS_OK;
}
Expand All @@ -9357,7 +9357,7 @@ nsDocument::PreloadStyle(nsIURI* uri, const nsAString& charset,

nsresult
nsDocument::LoadChromeSheetSync(nsIURI* uri, bool isAgentSheet,
nsCSSStyleSheet** sheet)
CSSStyleSheet** sheet)
{
return CSSLoader()->LoadSheetSync(uri, isAgentSheet, isAgentSheet, sheet);
}
Expand Down Expand Up @@ -9706,10 +9706,10 @@ nsIDocument::CreateStaticClone(nsIDocShell* aCloneContainer)
}
int32_t sheetsCount = GetNumberOfStyleSheets();
for (int32_t i = 0; i < sheetsCount; ++i) {
nsRefPtr<nsCSSStyleSheet> sheet = do_QueryObject(GetStyleSheetAt(i));
nsRefPtr<CSSStyleSheet> sheet = do_QueryObject(GetStyleSheetAt(i));
if (sheet) {
if (sheet->IsApplicable()) {
nsRefPtr<nsCSSStyleSheet> clonedSheet =
nsRefPtr<CSSStyleSheet> clonedSheet =
sheet->Clone(nullptr, nullptr, clonedDoc, nullptr);
NS_WARN_IF_FALSE(clonedSheet, "Cloning a stylesheet didn't work!");
if (clonedSheet) {
Expand All @@ -9722,11 +9722,11 @@ nsIDocument::CreateStaticClone(nsIDocShell* aCloneContainer)
sheetsCount = thisAsDoc->mOnDemandBuiltInUASheets.Count();
// Iterate backwards to maintain order
for (int32_t i = sheetsCount - 1; i >= 0; --i) {
nsRefPtr<nsCSSStyleSheet> sheet =
nsRefPtr<CSSStyleSheet> sheet =
do_QueryObject(thisAsDoc->mOnDemandBuiltInUASheets[i]);
if (sheet) {
if (sheet->IsApplicable()) {
nsRefPtr<nsCSSStyleSheet> clonedSheet =
nsRefPtr<CSSStyleSheet> clonedSheet =
sheet->Clone(nullptr, nullptr, clonedDoc, nullptr);
NS_WARN_IF_FALSE(clonedSheet, "Cloning a stylesheet didn't work!");
if (clonedSheet) {
Expand Down
9 changes: 5 additions & 4 deletions content/base/src/nsDocument.h
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,8 @@ class nsDOMStyleSheetList : public mozilla::dom::StyleSheetList,
}

virtual uint32_t Length() MOZ_OVERRIDE;
virtual nsCSSStyleSheet* IndexedGetter(uint32_t aIndex, bool& aFound) MOZ_OVERRIDE;
virtual mozilla::CSSStyleSheet*
IndexedGetter(uint32_t aIndex, bool& aFound) MOZ_OVERRIDE;

protected:
int32_t mLength;
Expand Down Expand Up @@ -780,7 +781,7 @@ class nsDocument : public nsIDocument,
virtual Element* FindContentForSubDocument(nsIDocument *aDocument) const MOZ_OVERRIDE;
virtual Element* GetRootElementInternal() const MOZ_OVERRIDE;

virtual void EnsureOnDemandBuiltInUASheet(nsCSSStyleSheet* aSheet) MOZ_OVERRIDE;
virtual void EnsureOnDemandBuiltInUASheet(mozilla::CSSStyleSheet* aSheet) MOZ_OVERRIDE;

/**
* Get the (document) style sheets owned by this document.
Expand Down Expand Up @@ -932,7 +933,7 @@ class nsDocument : public nsIDocument,
virtual nsViewportInfo GetViewportInfo(const mozilla::ScreenIntSize& aDisplaySize) MOZ_OVERRIDE;

private:
void AddOnDemandBuiltInUASheet(nsCSSStyleSheet* aSheet);
void AddOnDemandBuiltInUASheet(mozilla::CSSStyleSheet* aSheet);
nsRadioGroupStruct* GetRadioGroupInternal(const nsAString& aName) const;
void SendToConsole(nsCOMArray<nsISecurityConsoleMessage>& aMessages);

Expand Down Expand Up @@ -1080,7 +1081,7 @@ class nsDocument : public nsIDocument,
const nsAString& aCrossOriginAttr) MOZ_OVERRIDE;

virtual nsresult LoadChromeSheetSync(nsIURI* uri, bool isAgentSheet,
nsCSSStyleSheet** sheet) MOZ_OVERRIDE;
mozilla::CSSStyleSheet** sheet) MOZ_OVERRIDE;

virtual nsISupports* GetCurrentContentSink() MOZ_OVERRIDE;

Expand Down
6 changes: 3 additions & 3 deletions content/base/src/nsStyleLinkElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@

#include "nsStyleLinkElement.h"

#include "mozilla/CSSStyleSheet.h"
#include "mozilla/css/Loader.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/FragmentOrElement.h"
#include "mozilla/dom/ShadowRoot.h"
#include "mozilla/Preferences.h"
#include "nsCSSStyleSheet.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIDOMComment.h"
Expand Down Expand Up @@ -60,7 +60,7 @@ nsStyleLinkElement::Traverse(nsCycleCollectionTraversalCallback &cb)
}

NS_IMETHODIMP
nsStyleLinkElement::SetStyleSheet(nsCSSStyleSheet* aStyleSheet)
nsStyleLinkElement::SetStyleSheet(CSSStyleSheet* aStyleSheet)
{
if (mStyleSheet) {
mStyleSheet->SetOwningNode(nullptr);
Expand Down Expand Up @@ -262,7 +262,7 @@ UpdateIsElementInStyleScopeFlagOnSubtree(Element* aElement)
static Element*
GetScopeElement(nsIStyleSheet* aSheet)
{
nsRefPtr<nsCSSStyleSheet> cssStyleSheet = do_QueryObject(aSheet);
nsRefPtr<CSSStyleSheet> cssStyleSheet = do_QueryObject(aSheet);
if (!cssStyleSheet) {
return nullptr;
}
Expand Down
10 changes: 5 additions & 5 deletions content/base/src/nsStyleLinkElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
#define nsStyleLinkElement_h___

#include "mozilla/Attributes.h"
#include "mozilla/CORSMode.h"
#include "mozilla/CSSStyleSheet.h"
#include "nsCOMPtr.h"
#include "nsIStyleSheetLinkingElement.h"
#include "nsCSSStyleSheet.h"
#include "nsTArray.h"
#include "mozilla/CORSMode.h"

class nsIDocument;
class nsIURI;
Expand All @@ -37,10 +37,10 @@ class nsStyleLinkElement : public nsIStyleSheetLinkingElement

NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) MOZ_OVERRIDE = 0;

nsCSSStyleSheet* GetSheet() const { return mStyleSheet; }
mozilla::CSSStyleSheet* GetSheet() const { return mStyleSheet; }

// nsIStyleSheetLinkingElement
NS_IMETHOD SetStyleSheet(nsCSSStyleSheet* aStyleSheet) MOZ_OVERRIDE;
NS_IMETHOD SetStyleSheet(mozilla::CSSStyleSheet* aStyleSheet) MOZ_OVERRIDE;
NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aStyleSheet) MOZ_OVERRIDE;
NS_IMETHOD InitStyleLinkElement(bool aDontLoadStyle) MOZ_OVERRIDE;
NS_IMETHOD UpdateStyleSheet(nsICSSLoaderObserver* aObserver,
Expand Down Expand Up @@ -122,7 +122,7 @@ class nsStyleLinkElement : public nsIStyleSheetLinkingElement
bool* aIsAlternate,
bool aForceUpdate);

nsRefPtr<nsCSSStyleSheet> mStyleSheet;
nsRefPtr<mozilla::CSSStyleSheet> mStyleSheet;
protected:
bool mDontLoadStyle;
bool mUpdatesEnabled;
Expand Down
Loading

0 comments on commit 039322a

Please sign in to comment.