Bug 1022855 - Rename nsCSSStyleSheet to mozilla::CSSStyleSheet; r=heycam

--HG--
rename : layout/style/nsCSSStyleSheet.cpp => layout/style/CSSStyleSheet.cpp
rename : layout/style/nsCSSStyleSheet.h => layout/style/CSSStyleSheet.h
This commit is contained in:
Ms2ger 2014-06-20 12:32:49 +02:00
parent 82f2df73ba
commit 9fb7f507f0
80 changed files with 684 additions and 618 deletions

View File

@ -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"
@ -27,9 +28,10 @@
#include "nsIPresShell.h"
#include "nsIScriptError.h"
#include "nsIWindowMediator.h"
#include "mozilla/dom/URL.h"
nsChromeRegistry* nsChromeRegistry::gChromeRegistry;
using namespace mozilla;
using mozilla::dom::IsChromeURI;
////////////////////////////////////////////////////////////////////////////////
@ -415,7 +417,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;
@ -454,12 +456,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));

View File

@ -29,7 +29,6 @@
class imgIRequest;
class nsAString;
class nsBindingManager;
class nsCSSStyleSheet;
class nsIDocShell;
class nsDocShell;
class nsDOMNavigationTiming;
@ -83,6 +82,7 @@ class nsIGlobalObject;
struct nsCSSSelectorList;
namespace mozilla {
class CSSStyleSheet;
class ErrorResult;
class EventStates;
@ -779,7 +779,7 @@ public:
* 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
@ -1836,7 +1836,7 @@ public:
* 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

View File

@ -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:
@ -29,7 +32,7 @@ public:
* @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.

View File

@ -137,7 +137,7 @@ ShadowRoot::StyleSheetChanged()
}
void
ShadowRoot::InsertSheet(nsCSSStyleSheet* aSheet,
ShadowRoot::InsertSheet(CSSStyleSheet* aSheet,
nsIContent* aLinkingContent)
{
nsCOMPtr<nsIStyleSheetLinkingElement>
@ -168,7 +168,7 @@ ShadowRoot::InsertSheet(nsCSSStyleSheet* aSheet,
}
void
ShadowRoot::RemoveSheet(nsCSSStyleSheet* aSheet)
ShadowRoot::RemoveSheet(CSSStyleSheet* aSheet)
{
mProtoBinding->RemoveStyleSheet(aSheet);
@ -719,7 +719,7 @@ ShadowRootStyleSheetList::~ShadowRootStyleSheetList()
MOZ_COUNT_DTOR(ShadowRootStyleSheetList);
}
nsCSSStyleSheet*
CSSStyleSheet*
ShadowRootStyleSheetList::IndexedGetter(uint32_t aIndex, bool& aFound)
{
aFound = aIndex < mShadowRoot->mProtoBinding->SheetCount();

View File

@ -48,8 +48,8 @@ public:
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();
@ -187,7 +187,7 @@ public:
}
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;

View File

@ -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 {

View File

@ -9,10 +9,11 @@
#include "nsIDOMStyleSheetList.h"
#include "nsWrapperCache.h"
class nsCSSStyleSheet;
class nsINode;
namespace mozilla {
class CSSStyleSheet;
namespace dom {
class StyleSheetList : public nsIDOMStyleSheetList
@ -34,8 +35,8 @@ public:
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);

View File

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

View File

@ -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);

View File

@ -761,7 +761,7 @@ nsDOMStyleSheetList::Length()
return mLength;
}
nsCSSStyleSheet*
CSSStyleSheet*
nsDOMStyleSheetList::IndexedGetter(uint32_t aIndex, bool& aFound)
{
if (!mDocument || aIndex >= (uint32_t)mDocument->GetNumberOfStyleSheets()) {
@ -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
@ -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))) {
@ -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)));
@ -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);
@ -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;
}
@ -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);
}
@ -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) {
@ -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) {

View File

@ -457,7 +457,8 @@ public:
}
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;
@ -780,7 +781,7 @@ public:
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.
@ -932,7 +933,7 @@ public:
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);
@ -1080,7 +1081,7 @@ public:
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;

View File

@ -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"
@ -60,7 +60,7 @@ nsStyleLinkElement::Traverse(nsCycleCollectionTraversalCallback &cb)
}
NS_IMETHODIMP
nsStyleLinkElement::SetStyleSheet(nsCSSStyleSheet* aStyleSheet)
nsStyleLinkElement::SetStyleSheet(CSSStyleSheet* aStyleSheet)
{
if (mStyleSheet) {
mStyleSheet->SetOwningNode(nullptr);
@ -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;
}

View File

@ -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;
@ -37,10 +37,10 @@ public:
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,
@ -122,7 +122,7 @@ private:
bool* aIsAlternate,
bool aForceUpdate);
nsRefPtr<nsCSSStyleSheet> mStyleSheet;
nsRefPtr<mozilla::CSSStyleSheet> mStyleSheet;
protected:
bool mDontLoadStyle;
bool mUpdatesEnabled;

View File

@ -4,16 +4,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/ArrayUtils.h"
#include "nsTreeSanitizer.h"
#include "nsCSSParser.h"
#include "nsCSSProperty.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/css/Declaration.h"
#include "mozilla/css/StyleRule.h"
#include "mozilla/css/Rule.h"
#include "nsCSSParser.h"
#include "nsCSSProperty.h"
#include "nsUnicharInputStream.h"
#include "nsCSSStyleSheet.h"
#include "nsIDOMCSSRule.h"
#include "nsAttrName.h"
#include "nsIScriptSecurityManager.h"
@ -1098,7 +1098,7 @@ nsTreeSanitizer::SanitizeStyleSheet(const nsAString& aOriginal,
// -moz-binding is blacklisted.
bool didSanitize = false;
// Create a sheet to hold the parsed CSS
nsRefPtr<nsCSSStyleSheet> sheet = new nsCSSStyleSheet(CORS_NONE);
nsRefPtr<CSSStyleSheet> sheet = new CSSStyleSheet(CORS_NONE);
sheet->SetURIs(aDocument->GetDocumentURI(), nullptr, aBaseURI);
sheet->SetPrincipal(aDocument->NodePrincipal());
// Create the CSS parser, and parse the CSS text.

View File

@ -81,7 +81,7 @@ NS_IMPL_ELEMENT_CLONE(HTMLLinkElement)
bool
HTMLLinkElement::Disabled()
{
nsCSSStyleSheet* ss = GetSheet();
CSSStyleSheet* ss = GetSheet();
return ss && ss->Disabled();
}
@ -95,11 +95,10 @@ HTMLLinkElement::GetMozDisabled(bool* aDisabled)
void
HTMLLinkElement::SetDisabled(bool aDisabled)
{
nsCSSStyleSheet* ss = GetSheet();
CSSStyleSheet* ss = GetSheet();
if (ss) {
ss->SetDisabled(aDisabled);
}
}
NS_IMETHODIMP

View File

@ -69,7 +69,7 @@ HTMLStyleElement::GetMozDisabled(bool* aDisabled)
bool
HTMLStyleElement::Disabled()
{
nsCSSStyleSheet* ss = GetSheet();
CSSStyleSheet* ss = GetSheet();
return ss && ss->Disabled();
}
@ -83,7 +83,7 @@ HTMLStyleElement::SetMozDisabled(bool aDisabled)
void
HTMLStyleElement::SetDisabled(bool aDisabled)
{
nsCSSStyleSheet* ss = GetSheet();
CSSStyleSheet* ss = GetSheet();
if (ss) {
ss->SetDisabled(aDisabled);
}

View File

@ -2756,7 +2756,7 @@ nsHTMLDocument::EditingStateChanged()
rv = NS_NewURI(getter_AddRefs(uri), NS_LITERAL_STRING("resource://gre/res/contenteditable.css"));
NS_ENSURE_SUCCESS(rv, rv);
nsRefPtr<nsCSSStyleSheet> sheet;
nsRefPtr<CSSStyleSheet> sheet;
rv = LoadChromeSheetSync(uri, true, getter_AddRefs(sheet));
NS_ENSURE_TRUE(sheet, rv);

View File

@ -143,7 +143,7 @@ SVGDocument::EnsureNonSVGUserAgentStyleSheetsLoaded()
nsCOMPtr<nsIURI> uri;
NS_NewURI(getter_AddRefs(uri), spec);
if (uri) {
nsRefPtr<nsCSSStyleSheet> cssSheet;
nsRefPtr<CSSStyleSheet> cssSheet;
cssLoader->LoadSheetSync(uri, true, true, getter_AddRefs(cssSheet));
if (cssSheet) {
EnsureOnDemandBuiltInUASheet(cssSheet);
@ -155,7 +155,7 @@ SVGDocument::EnsureNonSVGUserAgentStyleSheetsLoaded()
}
}
nsCSSStyleSheet* sheet = nsLayoutStylesheetCache::NumberControlSheet();
CSSStyleSheet* sheet = nsLayoutStylesheetCache::NumberControlSheet();
if (sheet) {
// number-control.css can be behind a pref
EnsureOnDemandBuiltInUASheet(sheet);

View File

@ -20,7 +20,7 @@
#include "DocumentType.h"
#include "nsHTMLParts.h"
#include "nsCRT.h"
#include "nsCSSStyleSheet.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/css/Loader.h"
#include "nsGkAtoms.h"
#include "nsContentUtils.h"
@ -63,6 +63,7 @@
#include "mozilla/dom/HTMLTemplateElement.h"
#include "mozilla/dom/ProcessingInstruction.h"
using namespace mozilla;
using namespace mozilla::dom;
// XXX Open Issues:
@ -414,7 +415,7 @@ nsXMLContentSink::OnTransformDone(nsresult aResult,
}
NS_IMETHODIMP
nsXMLContentSink::StyleSheetLoaded(nsCSSStyleSheet* aSheet,
nsXMLContentSink::StyleSheetLoaded(CSSStyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus)
{

View File

@ -83,7 +83,8 @@ public:
NS_IMETHOD OnTransformDone(nsresult aResult, nsIDocument *aResultDocument) MOZ_OVERRIDE;
// nsICSSLoaderObserver
NS_IMETHOD StyleSheetLoaded(nsCSSStyleSheet* aSheet, bool aWasAlternate,
NS_IMETHOD StyleSheetLoaded(mozilla::CSSStyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus) MOZ_OVERRIDE;
static bool ParsePIData(const nsString &aData, nsString &aHref,
nsString &aTitle, nsString &aMedia,

View File

@ -71,7 +71,7 @@
#include "nsIParser.h"
#include "nsCharsetSource.h"
#include "nsIParserService.h"
#include "nsCSSStyleSheet.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/css/Loader.h"
#include "nsIScriptError.h"
#include "nsIStyleSheetLinkingElement.h"
@ -3288,7 +3288,7 @@ XULDocument::DoneWalking()
}
NS_IMETHODIMP
XULDocument::StyleSheetLoaded(nsCSSStyleSheet* aSheet,
XULDocument::StyleSheetLoaded(CSSStyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus)
{
@ -3939,7 +3939,7 @@ XULDocument::AddPrototypeSheets()
for (int32_t i = 0; i < sheets.Count(); i++) {
nsCOMPtr<nsIURI> uri = sheets[i];
nsRefPtr<nsCSSStyleSheet> incompleteSheet;
nsRefPtr<CSSStyleSheet> incompleteSheet;
rv = CSSLoader()->LoadSheet(uri,
mCurrentPrototype->DocumentPrincipal(),
EmptyCString(), this,

View File

@ -163,7 +163,7 @@ public:
NS_DECL_NSIDOMXULDOCUMENT
// nsICSSLoaderObserver
NS_IMETHOD StyleSheetLoaded(nsCSSStyleSheet* aSheet,
NS_IMETHOD StyleSheetLoaded(CSSStyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus) MOZ_OVERRIDE;
@ -336,7 +336,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<nsRefPtr<nsCSSStyleSheet> > mOverlaySheets;
nsTArray<nsRefPtr<CSSStyleSheet>> mOverlaySheets;
nsCOMPtr<nsIDOMXULCommandDispatcher> mCommandDispatcher; // [OWNER] of the focus tracker

View File

@ -7,7 +7,6 @@
#include "plstr.h"
#include "nsXULPrototypeDocument.h"
#include "nsCSSStyleSheet.h"
#include "nsIServiceManager.h"
#include "nsIURI.h"
@ -24,6 +23,7 @@
#include "js/TracingAPI.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/Preferences.h"
#include "mozilla/scache/StartupCache.h"
#include "mozilla/scache/StartupCacheUtils.h"
@ -172,7 +172,7 @@ nsXULPrototypeCache::PutPrototype(nsXULPrototypeDocument* aDocument)
}
nsresult
nsXULPrototypeCache::PutStyleSheet(nsCSSStyleSheet* aStyleSheet)
nsXULPrototypeCache::PutStyleSheet(CSSStyleSheet* aStyleSheet)
{
nsIURI* uri = aStyleSheet->GetSheetURI();
@ -239,7 +239,7 @@ FlushSkinXBL(nsIURI* aKey, nsRefPtr<nsXBLDocumentInfo>& aDocInfo, void* aClosure
}
static PLDHashOperator
FlushSkinSheets(nsIURI* aKey, nsRefPtr<nsCSSStyleSheet>& aSheet, void* aClosure)
FlushSkinSheets(nsIURI* aKey, nsRefPtr<CSSStyleSheet>& aSheet, void* aClosure)
{
nsAutoCString str;
aSheet->GetSheetURI()->GetPath(str);

View File

@ -19,7 +19,9 @@
#include "mozilla/scache/StartupCache.h"
class nsCSSStyleSheet;
namespace mozilla {
class CSSStyleSheet;
} // namespace mozilla
/**
* The XUL prototype cache can be used to store and retrieve shared data for
@ -72,7 +74,7 @@ public:
* Get a style sheet by URI. If the style sheet is not in the cache,
* returns nullptr.
*/
nsCSSStyleSheet* GetStyleSheet(nsIURI* aURI) {
mozilla::CSSStyleSheet* GetStyleSheet(nsIURI* aURI) {
return mStyleSheetTable.GetWeak(aURI);
}
@ -80,7 +82,7 @@ public:
* Store a style sheet in the cache. The key, style sheet's URI is obtained
* from the style sheet itself.
*/
nsresult PutStyleSheet(nsCSSStyleSheet* aStyleSheet);
nsresult PutStyleSheet(mozilla::CSSStyleSheet* aStyleSheet);
/**
* Write the XUL prototype document to a cache file. The proto must be
@ -121,7 +123,7 @@ protected:
void FlushSkinFiles();
nsRefPtrHashtable<nsURIHashKey,nsXULPrototypeDocument> mPrototypeTable; // owns the prototypes
nsRefPtrHashtable<nsURIHashKey,nsCSSStyleSheet> mStyleSheetTable;
nsRefPtrHashtable<nsURIHashKey,mozilla::CSSStyleSheet> mStyleSheetTable;
nsJSThingHashtable<nsURIHashKey, JSScript*> mScriptTable;
nsRefPtrHashtable<nsURIHashKey,nsXBLDocumentInfo> mXBLDocTable;

View File

@ -263,7 +263,7 @@ DOMInterfaces = {
},
'CSSStyleSheet': {
'nativeType': 'nsCSSStyleSheet',
'nativeType': 'mozilla::CSSStyleSheet',
'binaryNames': { 'ownerRule': 'DOMOwnerRule' },
},
@ -1066,7 +1066,7 @@ DOMInterfaces = {
},
'StyleSheet': {
'nativeType': 'nsCSSStyleSheet',
'nativeType': 'mozilla::CSSStyleSheet',
},
'SVGAnimatedLengthList': {

View File

@ -813,8 +813,8 @@ static PLDHashOperator
EnumAppendAllSheets(nsRefPtrHashKey<nsIContent> *aKey, void* aClosure)
{
nsIContent *boundContent = aKey->GetKey();
nsTArray<nsCSSStyleSheet*>* array =
static_cast<nsTArray<nsCSSStyleSheet*>*>(aClosure);
nsTArray<CSSStyleSheet*>* array =
static_cast<nsTArray<CSSStyleSheet*>*>(aClosure);
for (nsXBLBinding *binding = boundContent->GetXBLBinding(); binding;
binding = binding->GetBaseBinding()) {
binding->PrototypeBinding()->AppendStyleSheetsTo(*array);
@ -823,7 +823,7 @@ EnumAppendAllSheets(nsRefPtrHashKey<nsIContent> *aKey, void* aClosure)
}
void
nsBindingManager::AppendAllSheets(nsTArray<nsCSSStyleSheet*>& aArray)
nsBindingManager::AppendAllSheets(nsTArray<CSSStyleSheet*>& aArray)
{
if (mBoundContentSet) {
mBoundContentSet->EnumerateEntries(EnumAppendAllSheets, &aArray);

View File

@ -30,7 +30,10 @@ class nsXBLBinding;
template<class E> class nsRefPtr;
typedef nsTArray<nsRefPtr<nsXBLBinding> > nsBindingList;
class nsIPrincipal;
class nsCSSStyleSheet;
namespace mozilla {
class CSSStyleSheet;
} // namespace mozilla
class nsBindingManager MOZ_FINAL : public nsStubMutationObserver
{
@ -116,7 +119,7 @@ public:
nsresult MediumFeaturesChanged(nsPresContext* aPresContext,
bool* aRulesChanged);
void AppendAllSheets(nsTArray<nsCSSStyleSheet*>& aArray);
void AppendAllSheets(nsTArray<mozilla::CSSStyleSheet*>& aArray);
void Traverse(nsIContent *aContent,
nsCycleCollectionTraversalCallback &cb);

View File

@ -1686,14 +1686,14 @@ nsXBLPrototypeBinding::EnsureResources()
}
void
nsXBLPrototypeBinding::AppendStyleSheet(nsCSSStyleSheet* aSheet)
nsXBLPrototypeBinding::AppendStyleSheet(CSSStyleSheet* aSheet)
{
EnsureResources();
mResources->AppendStyleSheet(aSheet);
}
void
nsXBLPrototypeBinding::RemoveStyleSheet(nsCSSStyleSheet* aSheet)
nsXBLPrototypeBinding::RemoveStyleSheet(CSSStyleSheet* aSheet)
{
if (!mResources) {
MOZ_ASSERT(false, "Trying to remove a sheet that does not exist.");
@ -1703,13 +1703,13 @@ nsXBLPrototypeBinding::RemoveStyleSheet(nsCSSStyleSheet* aSheet)
mResources->RemoveStyleSheet(aSheet);
}
void
nsXBLPrototypeBinding::InsertStyleSheetAt(size_t aIndex, nsCSSStyleSheet* aSheet)
nsXBLPrototypeBinding::InsertStyleSheetAt(size_t aIndex, CSSStyleSheet* aSheet)
{
EnsureResources();
mResources->InsertStyleSheetAt(aIndex, aSheet);
}
nsCSSStyleSheet*
CSSStyleSheet*
nsXBLPrototypeBinding::StyleSheetAt(size_t aIndex) const
{
MOZ_ASSERT(mResources);
@ -1730,7 +1730,7 @@ nsXBLPrototypeBinding::HasStyleSheets() const
void
nsXBLPrototypeBinding::AppendStyleSheetsTo(
nsTArray<nsCSSStyleSheet*>& aResult) const
nsTArray<CSSStyleSheet*>& aResult) const
{
if (mResources) {
mResources->AppendStyleSheetsTo(aResult);

View File

@ -25,6 +25,10 @@ class nsXBLAttributeEntry;
class nsXBLBinding;
class nsXBLProtoImplField;
namespace mozilla {
class CSSStyleSheet;
} // namespace mozilla
// *********************************************************************/
// The XBLPrototypeBinding class
@ -113,13 +117,13 @@ public:
void SetInitialAttributes(nsIContent* aBoundElement, nsIContent* aAnonymousContent);
void AppendStyleSheet(nsCSSStyleSheet* aSheet);
void RemoveStyleSheet(nsCSSStyleSheet* aSheet);
void InsertStyleSheetAt(size_t aIndex, nsCSSStyleSheet* aSheet);
nsCSSStyleSheet* StyleSheetAt(size_t aIndex) const;
void AppendStyleSheet(mozilla::CSSStyleSheet* aSheet);
void RemoveStyleSheet(mozilla::CSSStyleSheet* aSheet);
void InsertStyleSheetAt(size_t aIndex, mozilla::CSSStyleSheet* aSheet);
mozilla::CSSStyleSheet* StyleSheetAt(size_t aIndex) const;
size_t SheetCount() const;
bool HasStyleSheets() const;
void AppendStyleSheetsTo(nsTArray<nsCSSStyleSheet*>& aResult) const;
void AppendStyleSheetsTo(nsTArray<mozilla::CSSStyleSheet*>& aResult) const;
nsIStyleRuleProcessor* GetRuleProcessor();

View File

@ -80,18 +80,18 @@ nsXBLPrototypeResources::FlushSkinSheets()
// they'll still be in the chrome cache.
mRuleProcessor = nullptr;
nsTArray<nsRefPtr<nsCSSStyleSheet>> oldSheets;
nsTArray<nsRefPtr<CSSStyleSheet>> oldSheets;
oldSheets.SwapElements(mStyleSheetList);
mozilla::css::Loader* cssLoader = doc->CSSLoader();
for (size_t i = 0, count = oldSheets.Length(); i < count; ++i) {
nsCSSStyleSheet* oldSheet = oldSheets[i];
CSSStyleSheet* oldSheet = oldSheets[i];
nsIURI* uri = oldSheet->GetSheetURI();
nsRefPtr<nsCSSStyleSheet> newSheet;
nsRefPtr<CSSStyleSheet> newSheet;
if (IsChromeURI(uri)) {
if (NS_FAILED(cssLoader->LoadSheetSync(uri, getter_AddRefs(newSheet))))
continue;
@ -138,25 +138,25 @@ nsXBLPrototypeResources::GatherRuleProcessor()
}
void
nsXBLPrototypeResources::AppendStyleSheet(nsCSSStyleSheet* aSheet)
nsXBLPrototypeResources::AppendStyleSheet(CSSStyleSheet* aSheet)
{
mStyleSheetList.AppendElement(aSheet);
}
void
nsXBLPrototypeResources::RemoveStyleSheet(nsCSSStyleSheet* aSheet)
nsXBLPrototypeResources::RemoveStyleSheet(CSSStyleSheet* aSheet)
{
DebugOnly<bool> found = mStyleSheetList.RemoveElement(aSheet);
MOZ_ASSERT(found, "Trying to remove a sheet that does not exist.");
}
void
nsXBLPrototypeResources::InsertStyleSheetAt(size_t aIndex, nsCSSStyleSheet* aSheet)
nsXBLPrototypeResources::InsertStyleSheetAt(size_t aIndex, CSSStyleSheet* aSheet)
{
mStyleSheetList.InsertElementAt(aIndex, aSheet);
}
nsCSSStyleSheet*
CSSStyleSheet*
nsXBLPrototypeResources::StyleSheetAt(size_t aIndex) const
{
return mStyleSheetList[aIndex];
@ -176,7 +176,7 @@ nsXBLPrototypeResources::HasStyleSheets() const
void
nsXBLPrototypeResources::AppendStyleSheetsTo(
nsTArray<nsCSSStyleSheet*>& aResult) const
nsTArray<CSSStyleSheet*>& aResult) const
{
aResult.AppendElements(mStyleSheetList);
}

View File

@ -10,12 +10,15 @@
#include "nsICSSLoaderObserver.h"
class nsCSSRuleProcessor;
class nsCSSStyleSheet;
class nsIAtom;
class nsIContent;
class nsXBLPrototypeBinding;
class nsXBLResourceLoader;
namespace mozilla {
class CSSStyleSheet;
} // namespace mozilla
// *********************************************************************/
// The XBLPrototypeResources class
@ -36,13 +39,13 @@ public:
void ClearLoader();
void AppendStyleSheet(nsCSSStyleSheet* aSheet);
void RemoveStyleSheet(nsCSSStyleSheet* aSheet);
void InsertStyleSheetAt(size_t aIndex, nsCSSStyleSheet* aSheet);
nsCSSStyleSheet* StyleSheetAt(size_t aIndex) const;
void AppendStyleSheet(mozilla::CSSStyleSheet* aSheet);
void RemoveStyleSheet(mozilla::CSSStyleSheet* aSheet);
void InsertStyleSheetAt(size_t aIndex, mozilla::CSSStyleSheet* aSheet);
mozilla::CSSStyleSheet* StyleSheetAt(size_t aIndex) const;
size_t SheetCount() const;
bool HasStyleSheets() const;
void AppendStyleSheetsTo(nsTArray<nsCSSStyleSheet*>& aResult) const;
void AppendStyleSheetsTo(nsTArray<mozilla::CSSStyleSheet*>& aResult) const;
/**
* Recreates mRuleProcessor to represent the current list of style sheets
@ -58,7 +61,7 @@ private:
nsRefPtr<nsXBLResourceLoader> mLoader;
// A list of loaded stylesheets for this binding.
nsTArray<nsRefPtr<nsCSSStyleSheet>> mStyleSheetList;
nsTArray<nsRefPtr<mozilla::CSSStyleSheet>> mStyleSheetList;
// The list of stylesheets converted to a rule processor.
nsRefPtr<nsCSSRuleProcessor> mRuleProcessor;

View File

@ -5,7 +5,6 @@
#include "nsTArray.h"
#include "nsString.h"
#include "nsCSSStyleSheet.h"
#include "nsIStyleRuleProcessor.h"
#include "nsIDocument.h"
#include "nsIContent.h"
@ -17,6 +16,7 @@
#include "nsIDocumentObserver.h"
#include "imgILoader.h"
#include "imgRequestProxy.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/css/Loader.h"
#include "nsIURI.h"
#include "nsNetUtil.h"
@ -29,6 +29,8 @@
#include "nsStyleSet.h"
#include "nsIScriptSecurityManager.h"
using namespace mozilla;
NS_IMPL_CYCLE_COLLECTION(nsXBLResourceLoader, mBoundElements)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXBLResourceLoader)
@ -135,7 +137,7 @@ nsXBLResourceLoader::LoadResources(bool* aResult)
CheckLoadURIWithPrincipal(docPrincipal, url,
nsIScriptSecurityManager::ALLOW_CHROME);
if (NS_SUCCEEDED(rv)) {
nsRefPtr<nsCSSStyleSheet> sheet;
nsRefPtr<CSSStyleSheet> sheet;
rv = cssLoader->LoadSheetSync(url, getter_AddRefs(sheet));
NS_ASSERTION(NS_SUCCEEDED(rv), "Load failed!!!");
if (NS_SUCCEEDED(rv))
@ -164,7 +166,7 @@ nsXBLResourceLoader::LoadResources(bool* aResult)
// nsICSSLoaderObserver
NS_IMETHODIMP
nsXBLResourceLoader::StyleSheetLoaded(nsCSSStyleSheet* aSheet,
nsXBLResourceLoader::StyleSheetLoaded(CSSStyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus)
{

View File

@ -29,7 +29,8 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS(nsXBLResourceLoader)
// nsICSSLoaderObserver
NS_IMETHOD StyleSheetLoaded(nsCSSStyleSheet* aSheet, bool aWasAlternate,
NS_IMETHOD StyleSheetLoaded(mozilla::CSSStyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus) MOZ_OVERRIDE;
void LoadResources(bool* aResult);

View File

@ -23,12 +23,12 @@
#include "nsIConsoleService.h"
#include "nsIDOMDocumentFragment.h"
#include "nsNameSpaceManager.h"
#include "nsCSSStyleSheet.h"
#include "txStringUtils.h"
#include "txURIUtils.h"
#include "nsIHTMLDocument.h"
#include "nsIStyleSheetLinkingElement.h"
#include "nsIDocumentTransformer.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/css/Loader.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/EncodingUtils.h"
@ -981,7 +981,7 @@ txTransformNotifier::ScriptEvaluated(nsresult aResult,
}
NS_IMETHODIMP
txTransformNotifier::StyleSheetLoaded(nsCSSStyleSheet* aSheet,
txTransformNotifier::StyleSheetLoaded(CSSStyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus)
{

View File

@ -38,7 +38,7 @@ public:
NS_DECL_NSISCRIPTLOADEROBSERVER
// nsICSSLoaderObserver
NS_IMETHOD StyleSheetLoaded(nsCSSStyleSheet* aSheet,
NS_IMETHOD StyleSheetLoaded(mozilla::CSSStyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus) MOZ_OVERRIDE;

View File

@ -6,10 +6,12 @@
#include "nsISupports.idl"
%{C++
class nsCSSStyleSheet;
namespace mozilla {
class CSSStyleSheet;
} // namespace mozilla
%}
[ptr] native nsCSSStyleSheet(nsCSSStyleSheet);
[ptr] native CSSStyleSheet(mozilla::CSSStyleSheet);
[scriptable, uuid(4805e682-49b9-11d3-9ce4-ed60bd6cb5bc)]
@ -75,17 +77,17 @@ interface nsIEditorStyleSheets : nsISupports
*/
void enableStyleSheet(in AString aURL, in boolean aEnable);
/** Get the nsCSSStyleSheet associated with the given URL.
/** Get the CSSStyleSheet associated with the given URL.
*
* @param aURL The style sheet's URL
* @return the style sheet
*/
[noscript] nsCSSStyleSheet getStyleSheetForURL(in AString aURL);
[noscript] CSSStyleSheet getStyleSheetForURL(in AString aURL);
/** Get the URL associated with the given nsCSSStyleSheet.
/** Get the URL associated with the given CSSStyleSheet.
*
* @param aStyleSheet The style sheet
* @return the style sheet's URL
*/
[noscript] AString getURLForStyleSheet(in nsCSSStyleSheet aStyleSheet);
[noscript] AString getURLForStyleSheet(in CSSStyleSheet aStyleSheet);
};

View File

@ -4426,7 +4426,7 @@ nsEditor::CreateTxnForIMEText(const nsAString& aStringToInsert,
NS_IMETHODIMP
nsEditor::CreateTxnForAddStyleSheet(nsCSSStyleSheet* aSheet, AddStyleSheetTxn* *aTxn)
nsEditor::CreateTxnForAddStyleSheet(CSSStyleSheet* aSheet, AddStyleSheetTxn* *aTxn)
{
nsRefPtr<AddStyleSheetTxn> txn = new AddStyleSheetTxn();
@ -4442,7 +4442,7 @@ nsEditor::CreateTxnForAddStyleSheet(nsCSSStyleSheet* aSheet, AddStyleSheetTxn* *
NS_IMETHODIMP
nsEditor::CreateTxnForRemoveStyleSheet(nsCSSStyleSheet* aSheet, RemoveStyleSheetTxn* *aTxn)
nsEditor::CreateTxnForRemoveStyleSheet(CSSStyleSheet* aSheet, RemoveStyleSheetTxn* *aTxn)
{
nsRefPtr<RemoveStyleSheetTxn> txn = new RemoveStyleSheetTxn();

View File

@ -39,7 +39,6 @@ class InsertTextTxn;
class JoinElementTxn;
class RemoveStyleSheetTxn;
class SplitElementTxn;
class nsCSSStyleSheet;
class nsIAtom;
class nsIContent;
class nsIDOMCharacterData;
@ -68,6 +67,7 @@ class nsString;
class nsTransactionManager;
namespace mozilla {
class CSSStyleSheet;
class ErrorResult;
class TextComposition;
@ -321,11 +321,13 @@ protected:
/** create a transaction for adding a style sheet
*/
NS_IMETHOD CreateTxnForAddStyleSheet(nsCSSStyleSheet* aSheet, AddStyleSheetTxn* *aTxn);
NS_IMETHOD CreateTxnForAddStyleSheet(mozilla::CSSStyleSheet* aSheet,
AddStyleSheetTxn* *aTxn);
/** create a transaction for removing a style sheet
*/
NS_IMETHOD CreateTxnForRemoveStyleSheet(nsCSSStyleSheet* aSheet, RemoveStyleSheetTxn* *aTxn);
NS_IMETHOD CreateTxnForRemoveStyleSheet(mozilla::CSSStyleSheet* aSheet,
RemoveStyleSheetTxn* *aTxn);
NS_IMETHOD DeleteText(nsIDOMCharacterData *aElement,
uint32_t aOffset,

View File

@ -8,7 +8,7 @@
#include "nsAString.h"
#include "nsCOMPtr.h" // for nsCOMPtr, do_QueryInterface, etc
#include "nsCSSStyleSheet.h" // for nsCSSStyleSheet
#include "mozilla/CSSStyleSheet.h" // for mozilla::CSSStyleSheet
#include "nsDebug.h" // for NS_ENSURE_TRUE
#include "nsError.h" // for NS_OK, etc
#include "nsIDOMDocument.h" // for nsIDOMDocument
@ -17,6 +17,8 @@
#include "nsIEditor.h" // for nsIEditor
#include "nsStyleSheetTxns.h"
using namespace mozilla;
class nsIStyleSheet;
static void
@ -58,7 +60,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(AddStyleSheetTxn)
NS_INTERFACE_MAP_END_INHERITING(EditTxn)
NS_IMETHODIMP
AddStyleSheetTxn::Init(nsIEditor *aEditor, nsCSSStyleSheet *aSheet)
AddStyleSheetTxn::Init(nsIEditor *aEditor, CSSStyleSheet *aSheet)
{
NS_ENSURE_TRUE(aEditor && aSheet, NS_ERROR_INVALID_ARG);
@ -108,7 +110,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(RemoveStyleSheetTxn)
NS_INTERFACE_MAP_END_INHERITING(EditTxn)
NS_IMETHODIMP
RemoveStyleSheetTxn::Init(nsIEditor *aEditor, nsCSSStyleSheet *aSheet)
RemoveStyleSheetTxn::Init(nsIEditor *aEditor, CSSStyleSheet *aSheet)
{
NS_ENSURE_TRUE(aEditor && aSheet, NS_ERROR_INVALID_ARG);

View File

@ -8,10 +8,10 @@
#include "EditTxn.h" // for EditTxn, NS_DECL_EDITTXN
#include "nsAutoPtr.h" // for nsRefPtr
#include "nsCSSStyleSheet.h" // for nsCSSStyleSheet
#include "mozilla/CSSStyleSheet.h" // for mozilla::CSSStyleSheet
#include "nsCycleCollectionParticipant.h"
#include "nsID.h" // for REFNSIID
#include "nsISupportsImpl.h" // for nsCSSStyleSheet::Release
#include "nsISupportsImpl.h" // for CSSStyleSheet::Release
#include "nscore.h" // for NS_IMETHOD
class nsIEditor;
@ -23,8 +23,8 @@ public:
* @param aEditor the object providing core editing operations
* @param aSheet the stylesheet to add
*/
NS_IMETHOD Init(nsIEditor *aEditor,
nsCSSStyleSheet *aSheet);
NS_IMETHOD Init(nsIEditor* aEditor,
mozilla::CSSStyleSheet* aSheet);
AddStyleSheetTxn();
@ -35,8 +35,8 @@ public:
protected:
nsIEditor* mEditor; // the editor that created this transaction
nsRefPtr<nsCSSStyleSheet> mSheet; // the style sheet to add
nsIEditor* mEditor; // the editor that created this transaction
nsRefPtr<mozilla::CSSStyleSheet> mSheet; // the style sheet to add
};
@ -48,8 +48,8 @@ public:
* @param aEditor the object providing core editing operations
* @param aSheet the stylesheet to remove
*/
NS_IMETHOD Init(nsIEditor *aEditor,
nsCSSStyleSheet *aSheet);
NS_IMETHOD Init(nsIEditor* aEditor,
mozilla::CSSStyleSheet* aSheet);
RemoveStyleSheetTxn();
@ -60,8 +60,8 @@ public:
protected:
nsIEditor* mEditor; // the editor that created this transaction
nsRefPtr<nsCSSStyleSheet> mSheet; // the style sheet to remove
nsIEditor* mEditor; // the editor that created this transaction
nsRefPtr<mozilla::CSSStyleSheet> mSheet; // the style sheet to remove
};

View File

@ -36,8 +36,8 @@
#include "nsILinkHandler.h"
#include "nsIInlineSpellChecker.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/css/Loader.h"
#include "nsCSSStyleSheet.h"
#include "nsIDOMStyleSheet.h"
#include "nsIContent.h"
@ -2854,7 +2854,7 @@ nsHTMLEditor::ReplaceStyleSheet(const nsAString& aURL)
NS_IMETHODIMP
nsHTMLEditor::RemoveStyleSheet(const nsAString &aURL)
{
nsRefPtr<nsCSSStyleSheet> sheet;
nsRefPtr<CSSStyleSheet> sheet;
nsresult rv = GetStyleSheetForURL(aURL, getter_AddRefs(sheet));
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(sheet, NS_ERROR_UNEXPECTED);
@ -2894,7 +2894,7 @@ nsHTMLEditor::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..
nsRefPtr<nsCSSStyleSheet> sheet;
nsRefPtr<CSSStyleSheet> sheet;
// Editor override style sheets may want to style Gecko anonymous boxes
rv = ps->GetDocument()->CSSLoader()->
LoadSheetSync(uaURI, true, true, getter_AddRefs(sheet));
@ -2938,7 +2938,7 @@ nsHTMLEditor::ReplaceOverrideStyleSheet(const nsAString& aURL)
NS_IMETHODIMP
nsHTMLEditor::RemoveOverrideStyleSheet(const nsAString &aURL)
{
nsRefPtr<nsCSSStyleSheet> sheet;
nsRefPtr<CSSStyleSheet> sheet;
GetStyleSheetForURL(aURL, getter_AddRefs(sheet));
// Make sure we remove the stylesheet from our internal list in all
@ -2961,7 +2961,7 @@ nsHTMLEditor::RemoveOverrideStyleSheet(const nsAString &aURL)
NS_IMETHODIMP
nsHTMLEditor::EnableStyleSheet(const nsAString &aURL, bool aEnable)
{
nsRefPtr<nsCSSStyleSheet> sheet;
nsRefPtr<CSSStyleSheet> sheet;
nsresult rv = GetStyleSheetForURL(aURL, getter_AddRefs(sheet));
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(sheet, NS_OK); // Don't fail if sheet not found
@ -2976,7 +2976,7 @@ nsHTMLEditor::EnableStyleSheet(const nsAString &aURL, bool aEnable)
bool
nsHTMLEditor::EnableExistingStyleSheet(const nsAString &aURL)
{
nsRefPtr<nsCSSStyleSheet> sheet;
nsRefPtr<CSSStyleSheet> sheet;
nsresult rv = GetStyleSheetForURL(aURL, getter_AddRefs(sheet));
NS_ENSURE_SUCCESS(rv, false);
@ -2995,7 +2995,7 @@ nsHTMLEditor::EnableExistingStyleSheet(const nsAString &aURL)
nsresult
nsHTMLEditor::AddNewStyleSheetToList(const nsAString &aURL,
nsCSSStyleSheet *aStyleSheet)
CSSStyleSheet* aStyleSheet)
{
uint32_t countSS = mStyleSheets.Length();
uint32_t countU = mStyleSheetURLs.Length();
@ -3027,7 +3027,7 @@ nsHTMLEditor::RemoveStyleSheetFromList(const nsAString &aURL)
NS_IMETHODIMP
nsHTMLEditor::GetStyleSheetForURL(const nsAString &aURL,
nsCSSStyleSheet **aStyleSheet)
CSSStyleSheet** aStyleSheet)
{
NS_ENSURE_ARG_POINTER(aStyleSheet);
*aStyleSheet = 0;
@ -3047,7 +3047,7 @@ nsHTMLEditor::GetStyleSheetForURL(const nsAString &aURL,
}
NS_IMETHODIMP
nsHTMLEditor::GetURLForStyleSheet(nsCSSStyleSheet *aStyleSheet,
nsHTMLEditor::GetURLForStyleSheet(CSSStyleSheet* aStyleSheet,
nsAString &aURL)
{
// is it already in the list?
@ -3425,7 +3425,7 @@ nsHTMLEditor::DebugUnitTests(int32_t *outNumTests, int32_t *outNumTestsFailed)
NS_IMETHODIMP
nsHTMLEditor::StyleSheetLoaded(nsCSSStyleSheet* aSheet, bool aWasAlternate,
nsHTMLEditor::StyleSheetLoaded(CSSStyleSheet* aSheet, bool aWasAlternate,
nsresult aStatus)
{
nsresult rv = NS_OK;

View File

@ -329,8 +329,8 @@ public:
NS_IMETHOD GetRootElement(nsIDOMElement **aRootElement);
/* ------------ nsICSSLoaderObserver -------------- */
NS_IMETHOD StyleSheetLoaded(nsCSSStyleSheet*aSheet, bool aWasAlternate,
nsresult aStatus);
NS_IMETHOD StyleSheetLoaded(mozilla::CSSStyleSheet* aSheet,
bool aWasAlternate, nsresult aStatus);
/* ------------ Utility Routines, not part of public API -------------- */
NS_IMETHOD TypedText(const nsAString& aString, ETypingAction aAction);
@ -375,12 +375,13 @@ public:
// Dealing with the internal style sheet lists:
NS_IMETHOD GetStyleSheetForURL(const nsAString &aURL,
nsCSSStyleSheet **_retval);
NS_IMETHOD GetURLForStyleSheet(nsCSSStyleSheet *aStyleSheet, nsAString &aURL);
mozilla::CSSStyleSheet** _retval);
NS_IMETHOD GetURLForStyleSheet(mozilla::CSSStyleSheet* aStyleSheet,
nsAString& aURL);
// Add a url + known style sheet to the internal lists:
nsresult AddNewStyleSheetToList(const nsAString &aURL,
nsCSSStyleSheet *aStyleSheet);
mozilla::CSSStyleSheet* aStyleSheet);
nsresult RemoveStyleSheetFromList(const nsAString &aURL);
@ -774,7 +775,7 @@ protected:
// Maintain a list of associated style sheets and their urls.
nsTArray<nsString> mStyleSheetURLs;
nsTArray<nsRefPtr<nsCSSStyleSheet> > mStyleSheets;
nsTArray<nsRefPtr<mozilla::CSSStyleSheet>> mStyleSheets;
// an array for holding default style settings
nsTArray<PropItem*> mDefaultStyles;

View File

@ -51,7 +51,7 @@ exclude_automatic_type_include = [
xpidl_to_native = [
['nsIDOMDocument', 'nsIDocument', 'nsIDocument'],
['nsIDOMElement', 'mozilla::dom::Element', 'mozilla::dom::Element'],
['nsIDOMCSSStyleSheet', 'nsCSSStyleSheet', 'nsIStyleSheet'],
['nsIDOMCSSStyleSheet', 'mozilla::CSSStyleSheet', 'nsIStyleSheet'],
['nsIDOMWindow', 'nsGlobalWindow', 'nsIDOMEventTarget']
]

View File

@ -21,7 +21,6 @@
#include "nsPresContext.h"
#include "nsIPresShell.h"
#include "nsStyleSet.h"
#include "nsCSSStyleSheet.h"
#include "nsIFrame.h"
#include "nsIWritablePropertyBag2.h"
#include "nsSubDocumentFrame.h"
@ -49,6 +48,7 @@
#include "nsNetUtil.h"
#include "nsIContentViewerEdit.h"
#include "nsIContentViewerFile.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/css/Loader.h"
#include "nsIMarkupDocumentViewer.h"
#include "nsIInterfaceRequestor.h"
@ -2215,7 +2215,7 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument,
}
// Handle the user sheets.
nsCSSStyleSheet* sheet = nullptr;
CSSStyleSheet* sheet = nullptr;
if (nsContentUtils::IsInChromeDocshell(aDocument)) {
sheet = nsLayoutStylesheetCache::UserChromeSheet();
}
@ -2233,7 +2233,7 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument,
nsCOMPtr<nsIDocShell> ds(mContainer);
nsCOMPtr<nsIDOMEventTarget> chromeHandler;
nsCOMPtr<nsIURI> uri;
nsRefPtr<nsCSSStyleSheet> csssheet;
nsRefPtr<CSSStyleSheet> csssheet;
if (ds) {
ds->GetChromeEventHandler(getter_AddRefs(chromeHandler));
@ -2302,8 +2302,8 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument,
// Make sure to clone the quirk sheet so that it can be usefully
// enabled/disabled as needed.
nsRefPtr<nsCSSStyleSheet> quirkClone;
nsCSSStyleSheet* quirkSheet;
nsRefPtr<CSSStyleSheet> quirkClone;
CSSStyleSheet* quirkSheet;
if (!nsLayoutStylesheetCache::UASheet() ||
!(quirkSheet = nsLayoutStylesheetCache::QuirkSheet()) ||
!(quirkClone = quirkSheet->Clone(nullptr, nullptr, nullptr, nullptr)) ||

View File

@ -2255,14 +2255,14 @@ nsPresContext::RebuildCounterStyles()
void
nsPresContext::EnsureSafeToHandOutCSSRules()
{
nsCSSStyleSheet::EnsureUniqueInnerResult res =
CSSStyleSheet::EnsureUniqueInnerResult res =
mShell->StyleSet()->EnsureUniqueInnerOnCSSSheets();
if (res == nsCSSStyleSheet::eUniqueInner_AlreadyUnique) {
if (res == CSSStyleSheet::eUniqueInner_AlreadyUnique) {
// Nothing to do.
return;
}
MOZ_ASSERT(res == nsCSSStyleSheet::eUniqueInner_ClonedInner);
MOZ_ASSERT(res == CSSStyleSheet::eUniqueInner_ClonedInner);
RebuildAllStyleData(nsChangeHint(0));
}

View File

@ -24,6 +24,7 @@
#include "prlog.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/EventStateManager.h"
#include "mozilla/EventStates.h"
@ -48,7 +49,6 @@
#include "mozilla/dom/ShadowRoot.h"
#include "mozilla/dom/PointerEvent.h"
#include "nsIDocument.h"
#include "nsCSSStyleSheet.h"
#include "nsAnimationManager.h"
#include "nsNameSpaceManager.h" // for Pref-related rule management (bugs 22963,20760,31816)
#include "nsFrame.h"
@ -1384,7 +1384,7 @@ nsresult
PresShell::CreatePreferenceStyleSheet()
{
NS_ASSERTION(!mPrefStyleSheet, "prefStyleSheet already exists");
mPrefStyleSheet = new nsCSSStyleSheet(CORS_NONE);
mPrefStyleSheet = new CSSStyleSheet(CORS_NONE);
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_NewURI(getter_AddRefs(uri), "about:PreferenceStyleSheet", nullptr);
if (NS_FAILED(rv)) {
@ -4616,7 +4616,7 @@ PresShell::RecordStyleSheetChange(nsIStyleSheet* aStyleSheet)
if (mStylesHaveChanged)
return;
nsRefPtr<nsCSSStyleSheet> cssStyleSheet = do_QueryObject(aStyleSheet);
nsRefPtr<CSSStyleSheet> cssStyleSheet = do_QueryObject(aStyleSheet);
if (cssStyleSheet) {
Element* scopeElement = cssStyleSheet->GetScopeElement();
if (scopeElement) {

View File

@ -39,7 +39,6 @@
class nsRange;
class nsIDragService;
class nsCSSStyleSheet;
struct RangePaintInfo;
struct nsCallbackEventRequest;
@ -50,6 +49,10 @@ class ReflowCountMgr;
class nsPresShellEventCB;
class nsAutoCauseReflowNotifier;
namespace mozilla {
class CSSStyleSheet;
} // namespace mozilla
// 250ms. This is actually pref-controlled, but we use this value if we fail
// to get the pref for any reason.
#define PAINTLOCK_EVENT_DELAY 250
@ -754,7 +757,7 @@ protected:
nsPoint mMouseLocation;
// mStyleSet owns it but we maintain a ref, may be null
nsRefPtr<nsCSSStyleSheet> mPrefStyleSheet;
nsRefPtr<mozilla::CSSStyleSheet> mPrefStyleSheet;
// Set of frames that we should mark with NS_FRAME_HAS_DIRTY_CHILDREN after
// we finish reflowing mCurrentReflowRoot.

View File

@ -8,12 +8,12 @@
#include "nsStyleSheetService.h"
#include "nsIStyleSheet.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/unused.h"
#include "mozilla/css/Loader.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/ipc/URIUtils.h"
#include "nsCSSStyleSheet.h"
#include "nsIURI.h"
#include "nsCOMPtr.h"
#include "nsICategoryManager.h"
@ -186,7 +186,7 @@ nsStyleSheetService::LoadAndRegisterSheetInternal(nsIURI *aSheetURI,
nsRefPtr<css::Loader> loader = new css::Loader();
nsRefPtr<nsCSSStyleSheet> sheet;
nsRefPtr<CSSStyleSheet> sheet;
// Allow UA sheets, but not user sheets, to use unsafe rules
nsresult rv = loader->LoadSheetSync(aSheetURI, aSheetType == AGENT_SHEET,
true, getter_AddRefs(sheet));

View File

@ -4,8 +4,8 @@
#include "inCSSValueSearch.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/dom/StyleSheetList.h"
#include "nsCSSStyleSheet.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsReadableUtils.h"
@ -98,7 +98,7 @@ inCSSValueSearch::SearchSync()
uint32_t length = sheets->Length();
for (uint32_t i = 0; i < length; ++i) {
nsRefPtr<nsCSSStyleSheet> sheet = sheets->Item(i);
nsRefPtr<CSSStyleSheet> sheet = sheets->Item(i);
SearchStyleSheet(sheet, baseURI);
}

View File

@ -32,8 +32,8 @@
#include "nsIAtom.h"
#include "nsRange.h"
#include "nsContentList.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/dom/Element.h"
#include "nsCSSStyleSheet.h"
#include "nsRuleWalker.h"
#include "nsRuleProcessorData.h"
#include "nsCSSRuleProcessor.h"
@ -874,7 +874,7 @@ NS_IMETHODIMP
inDOMUtils::ParseStyleSheet(nsIDOMCSSStyleSheet *aSheet,
const nsAString& aInput)
{
nsRefPtr<nsCSSStyleSheet> sheet = do_QueryObject(aSheet);
nsRefPtr<CSSStyleSheet> sheet = do_QueryObject(aSheet);
NS_ENSURE_ARG_POINTER(sheet);
return sheet->ParseSheet(aInput);

View File

@ -10,9 +10,9 @@
#include "nsIDOMCSSRuleList.h"
#include "nsWrapperCache.h"
class nsCSSStyleSheet;
namespace mozilla {
class CSSStyleSheet;
namespace dom {
// IID for the CSSRuleList interface
@ -35,7 +35,7 @@ public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(CSSRuleList)
virtual nsCSSStyleSheet* GetParentObject() = 0;
virtual CSSStyleSheet* GetParentObject() = 0;
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE MOZ_FINAL;
NS_IMETHOD

View File

@ -6,7 +6,7 @@
/* representation of a CSS style sheet */
#include "nsCSSStyleSheet.h"
#include "mozilla/CSSStyleSheet.h"
#include "nsIAtom.h"
#include "nsCSSRuleProcessor.h"
@ -47,16 +47,15 @@
using namespace mozilla;
using namespace mozilla::dom;
// -------------------------------
// Style Rule List for the DOM
//
class CSSRuleListImpl : public CSSRuleList
{
public:
CSSRuleListImpl(nsCSSStyleSheet *aStyleSheet);
CSSRuleListImpl(CSSStyleSheet *aStyleSheet);
virtual nsCSSStyleSheet* GetParentObject() MOZ_OVERRIDE;
virtual CSSStyleSheet* GetParentObject() MOZ_OVERRIDE;
virtual nsIDOMCSSRule*
IndexedGetter(uint32_t aIndex, bool& aFound) MOZ_OVERRIDE;
@ -68,10 +67,10 @@ public:
protected:
virtual ~CSSRuleListImpl();
nsCSSStyleSheet* mStyleSheet;
CSSStyleSheet* mStyleSheet;
};
CSSRuleListImpl::CSSRuleListImpl(nsCSSStyleSheet *aStyleSheet)
CSSRuleListImpl::CSSRuleListImpl(CSSStyleSheet *aStyleSheet)
{
// Not reference counted to avoid circular references.
// The style sheet will tell us when its going away.
@ -82,7 +81,7 @@ CSSRuleListImpl::~CSSRuleListImpl()
{
}
nsCSSStyleSheet*
CSSStyleSheet*
CSSRuleListImpl::GetParentObject()
{
return mStyleSheet;
@ -545,7 +544,7 @@ nsMediaList::Matches(nsPresContext* aPresContext,
}
nsresult
nsMediaList::SetStyleSheet(nsCSSStyleSheet *aSheet)
nsMediaList::SetStyleSheet(CSSStyleSheet* aSheet)
{
NS_ASSERTION(aSheet == mStyleSheet || !aSheet || !mStyleSheet,
"multiple style sheets competing for one media list");
@ -572,7 +571,7 @@ nsMediaList::GetMediaText(nsAString& aMediaText)
return NS_OK;
}
// "sheet" should be an nsCSSStyleSheet and "doc" should be an
// "sheet" should be a CSSStyleSheet and "doc" should be an
// nsCOMPtr<nsIDocument>
#define BEGIN_MEDIA_CHANGE(sheet, doc) \
if (sheet) { \
@ -715,13 +714,15 @@ nsMediaList::Append(const nsAString& aNewMedium)
return rv;
}
namespace mozilla {
// -------------------------------
// CSS Style Sheet Inner Data Container
//
nsCSSStyleSheetInner::nsCSSStyleSheetInner(nsCSSStyleSheet* aPrimarySheet,
CORSMode aCORSMode)
CSSStyleSheetInner::CSSStyleSheetInner(CSSStyleSheet* aPrimarySheet,
CORSMode aCORSMode)
: mSheets(),
mCORSMode(aCORSMode),
mComplete(false)
@ -729,7 +730,7 @@ nsCSSStyleSheetInner::nsCSSStyleSheetInner(nsCSSStyleSheet* aPrimarySheet,
, mPrincipalSet(false)
#endif
{
MOZ_COUNT_CTOR(nsCSSStyleSheetInner);
MOZ_COUNT_CTOR(CSSStyleSheetInner);
mSheets.AppendElement(aPrimarySheet);
mPrincipal = do_CreateInstance("@mozilla.org/nullprincipal;1");
@ -741,24 +742,24 @@ nsCSSStyleSheetInner::nsCSSStyleSheetInner(nsCSSStyleSheet* aPrimarySheet,
static bool SetStyleSheetReference(css::Rule* aRule, void* aSheet)
{
if (aRule) {
aRule->SetStyleSheet(static_cast<nsCSSStyleSheet*>(aSheet));
aRule->SetStyleSheet(static_cast<CSSStyleSheet*>(aSheet));
}
return true;
}
struct ChildSheetListBuilder {
nsRefPtr<nsCSSStyleSheet>* sheetSlot;
nsCSSStyleSheet* parent;
nsRefPtr<CSSStyleSheet>* sheetSlot;
CSSStyleSheet* parent;
void SetParentLinks(nsCSSStyleSheet* aSheet) {
void SetParentLinks(CSSStyleSheet* aSheet) {
aSheet->mParent = parent;
aSheet->SetOwningDocument(parent->mDocument);
}
static void ReparentChildList(nsCSSStyleSheet* aPrimarySheet,
nsCSSStyleSheet* aFirstChild)
static void ReparentChildList(CSSStyleSheet* aPrimarySheet,
CSSStyleSheet* aFirstChild)
{
for (nsCSSStyleSheet *child = aFirstChild; child; child = child->mNext) {
for (CSSStyleSheet *child = aFirstChild; child; child = child->mNext) {
child->mParent = aPrimarySheet;
child->SetOwningDocument(aPrimarySheet->mDocument);
}
@ -766,7 +767,7 @@ struct ChildSheetListBuilder {
};
bool
nsCSSStyleSheet::RebuildChildList(css::Rule* aRule, void* aBuilder)
CSSStyleSheet::RebuildChildList(css::Rule* aRule, void* aBuilder)
{
int32_t type = aRule->GetType();
if (type < css::Rule::IMPORT_RULE) {
@ -783,7 +784,7 @@ nsCSSStyleSheet::RebuildChildList(css::Rule* aRule, void* aBuilder)
static_cast<ChildSheetListBuilder*>(aBuilder);
// XXXbz We really need to decomtaminate all this stuff. Is there a reason
// that I can't just QI to ImportRule and get an nsCSSStyleSheet
// that I can't just QI to ImportRule and get a CSSStyleSheet
// directly from it?
nsCOMPtr<nsIDOMCSSImportRule> importRule(do_QueryInterface(aRule));
NS_ASSERTION(importRule, "GetType lied");
@ -793,7 +794,7 @@ nsCSSStyleSheet::RebuildChildList(css::Rule* aRule, void* aBuilder)
// Have to do this QI to be safe, since XPConnect can fake
// nsIDOMCSSStyleSheets
nsRefPtr<nsCSSStyleSheet> cssSheet = do_QueryObject(childSheet);
nsRefPtr<CSSStyleSheet> cssSheet = do_QueryObject(childSheet);
if (!cssSheet) {
return true;
}
@ -805,10 +806,10 @@ nsCSSStyleSheet::RebuildChildList(css::Rule* aRule, void* aBuilder)
}
size_t
nsCSSStyleSheet::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
CSSStyleSheet::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
{
size_t n = 0;
const nsCSSStyleSheet* s = this;
const CSSStyleSheet* s = this;
while (s) {
n += aMallocSizeOf(s);
@ -836,8 +837,8 @@ nsCSSStyleSheet::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
return n;
}
nsCSSStyleSheetInner::nsCSSStyleSheetInner(nsCSSStyleSheetInner& aCopy,
nsCSSStyleSheet* aPrimarySheet)
CSSStyleSheetInner::CSSStyleSheetInner(CSSStyleSheetInner& aCopy,
CSSStyleSheet* aPrimarySheet)
: mSheets(),
mSheetURI(aCopy.mSheetURI),
mOriginalSheetURI(aCopy.mOriginalSheetURI),
@ -849,37 +850,37 @@ nsCSSStyleSheetInner::nsCSSStyleSheetInner(nsCSSStyleSheetInner& aCopy,
, mPrincipalSet(aCopy.mPrincipalSet)
#endif
{
MOZ_COUNT_CTOR(nsCSSStyleSheetInner);
MOZ_COUNT_CTOR(CSSStyleSheetInner);
AddSheet(aPrimarySheet);
aCopy.mOrderedRules.EnumerateForwards(css::GroupRule::CloneRuleInto, &mOrderedRules);
mOrderedRules.EnumerateForwards(SetStyleSheetReference, aPrimarySheet);
ChildSheetListBuilder builder = { &mFirstChild, aPrimarySheet };
mOrderedRules.EnumerateForwards(nsCSSStyleSheet::RebuildChildList, &builder);
mOrderedRules.EnumerateForwards(CSSStyleSheet::RebuildChildList, &builder);
RebuildNameSpaces();
}
nsCSSStyleSheetInner::~nsCSSStyleSheetInner()
CSSStyleSheetInner::~CSSStyleSheetInner()
{
MOZ_COUNT_DTOR(nsCSSStyleSheetInner);
MOZ_COUNT_DTOR(CSSStyleSheetInner);
mOrderedRules.EnumerateForwards(SetStyleSheetReference, nullptr);
}
nsCSSStyleSheetInner*
nsCSSStyleSheetInner::CloneFor(nsCSSStyleSheet* aPrimarySheet)
CSSStyleSheetInner*
CSSStyleSheetInner::CloneFor(CSSStyleSheet* aPrimarySheet)
{
return new nsCSSStyleSheetInner(*this, aPrimarySheet);
return new CSSStyleSheetInner(*this, aPrimarySheet);
}
void
nsCSSStyleSheetInner::AddSheet(nsCSSStyleSheet* aSheet)
CSSStyleSheetInner::AddSheet(CSSStyleSheet* aSheet)
{
mSheets.AppendElement(aSheet);
}
void
nsCSSStyleSheetInner::RemoveSheet(nsCSSStyleSheet* aSheet)
CSSStyleSheetInner::RemoveSheet(CSSStyleSheet* aSheet)
{
if (1 == mSheets.Length()) {
NS_ASSERTION(aSheet == mSheets.ElementAt(0), "bad parent");
@ -927,7 +928,7 @@ CreateNameSpace(css::Rule* aRule, void* aNameSpacePtr)
}
void
nsCSSStyleSheetInner::RebuildNameSpaces()
CSSStyleSheetInner::RebuildNameSpaces()
{
// Just nuke our existing namespace map, if any
if (NS_SUCCEEDED(CreateNamespaceMap())) {
@ -936,7 +937,7 @@ nsCSSStyleSheetInner::RebuildNameSpaces()
}
nsresult
nsCSSStyleSheetInner::CreateNamespaceMap()
CSSStyleSheetInner::CreateNamespaceMap()
{
mNameSpaceMap = nsXMLNameSpaceMap::Create(false);
NS_ENSURE_TRUE(mNameSpaceMap, NS_ERROR_OUT_OF_MEMORY);
@ -947,7 +948,7 @@ nsCSSStyleSheetInner::CreateNamespaceMap()
}
size_t
nsCSSStyleSheetInner::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
CSSStyleSheetInner::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
{
size_t n = aMallocSizeOf(this);
n += mOrderedRules.SizeOfExcludingThis(css::Rule::SizeOfCOMArrayElementIncludingThis,
@ -972,7 +973,7 @@ nsCSSStyleSheetInner::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
// CSS Style Sheet
//
nsCSSStyleSheet::nsCSSStyleSheet(CORSMode aCORSMode)
CSSStyleSheet::CSSStyleSheet(CORSMode aCORSMode)
: mTitle(),
mParent(nullptr),
mOwnerRule(nullptr),
@ -983,16 +984,16 @@ nsCSSStyleSheet::nsCSSStyleSheet(CORSMode aCORSMode)
mScopeElement(nullptr),
mRuleProcessors(nullptr)
{
mInner = new nsCSSStyleSheetInner(this, aCORSMode);
mInner = new CSSStyleSheetInner(this, aCORSMode);
SetIsDOMBinding();
}
nsCSSStyleSheet::nsCSSStyleSheet(const nsCSSStyleSheet& aCopy,
nsCSSStyleSheet* aParentToUse,
css::ImportRule* aOwnerRuleToUse,
nsIDocument* aDocumentToUse,
nsINode* aOwningNodeToUse)
CSSStyleSheet::CSSStyleSheet(const CSSStyleSheet& aCopy,
CSSStyleSheet* aParentToUse,
css::ImportRule* aOwnerRuleToUse,
nsIDocument* aDocumentToUse,
nsINode* aOwningNodeToUse)
: mTitle(aCopy.mTitle),
mParent(aParentToUse),
mOwnerRule(aOwnerRuleToUse),
@ -1022,9 +1023,9 @@ nsCSSStyleSheet::nsCSSStyleSheet(const nsCSSStyleSheet& aCopy,
SetIsDOMBinding();
}
nsCSSStyleSheet::~nsCSSStyleSheet()
CSSStyleSheet::~CSSStyleSheet()
{
for (nsCSSStyleSheet* child = mInner->mFirstChild;
for (CSSStyleSheet* child = mInner->mFirstChild;
child;
child = child->mNext) {
// XXXbz this is a little bogus; see the XXX comment where we
@ -1047,7 +1048,7 @@ nsCSSStyleSheet::~nsCSSStyleSheet()
}
void
nsCSSStyleSheet::DropRuleCollection()
CSSStyleSheet::DropRuleCollection()
{
if (mRuleCollection) {
mRuleCollection->DropReference();
@ -1056,7 +1057,7 @@ nsCSSStyleSheet::DropRuleCollection()
}
void
nsCSSStyleSheet::DropMedia()
CSSStyleSheet::DropMedia()
{
if (mMedia) {
mMedia->SetStyleSheet(nullptr);
@ -1065,7 +1066,7 @@ nsCSSStyleSheet::DropMedia()
}
void
nsCSSStyleSheet::UnlinkInner()
CSSStyleSheet::UnlinkInner()
{
// We can only have a cycle through our inner if we have a unique inner,
// because otherwise there are no JS wrappers for anything in the inner.
@ -1082,13 +1083,13 @@ nsCSSStyleSheet::UnlinkInner()
// don't want to do any addrefing in the process, just to make sure
// we don't confuse the cycle collector (though on the face of it,
// addref/release pairs during unlink should probably be ok).
nsRefPtr<nsCSSStyleSheet> child;
nsRefPtr<CSSStyleSheet> child;
child.swap(mInner->mFirstChild);
while (child) {
MOZ_ASSERT(child->mParent == this, "We have a unique inner!");
child->mParent = nullptr;
child->mDocument = nullptr;
nsRefPtr<nsCSSStyleSheet> next;
nsRefPtr<CSSStyleSheet> next;
// Null out child->mNext, but don't let it die yet
next.swap(child->mNext);
// Switch to looking at the old value of child->mNext next iteration
@ -1099,7 +1100,7 @@ nsCSSStyleSheet::UnlinkInner()
}
void
nsCSSStyleSheet::TraverseInner(nsCycleCollectionTraversalCallback &cb)
CSSStyleSheet::TraverseInner(nsCycleCollectionTraversalCallback &cb)
{
// We can only have a cycle through our inner if we have a unique inner,
// because otherwise there are no JS wrappers for anything in the inner.
@ -1107,7 +1108,7 @@ nsCSSStyleSheet::TraverseInner(nsCycleCollectionTraversalCallback &cb)
return;
}
nsRefPtr<nsCSSStyleSheet>* childSheetSlot = &mInner->mFirstChild;
nsRefPtr<CSSStyleSheet>* childSheetSlot = &mInner->mFirstChild;
while (*childSheetSlot) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "child sheet");
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIStyleSheet*, childSheetSlot->get()));
@ -1121,26 +1122,26 @@ nsCSSStyleSheet::TraverseInner(nsCycleCollectionTraversalCallback &cb)
}
}
// QueryInterface implementation for nsCSSStyleSheet
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsCSSStyleSheet)
// QueryInterface implementation for CSSStyleSheet
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CSSStyleSheet)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsIStyleSheet)
NS_INTERFACE_MAP_ENTRY(nsIDOMStyleSheet)
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSStyleSheet)
NS_INTERFACE_MAP_ENTRY(nsICSSLoaderObserver)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIStyleSheet)
if (aIID.Equals(NS_GET_IID(nsCSSStyleSheet)))
if (aIID.Equals(NS_GET_IID(CSSStyleSheet)))
foundInterface = reinterpret_cast<nsISupports*>(this);
else
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsCSSStyleSheet)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsCSSStyleSheet)
NS_IMPL_CYCLE_COLLECTING_ADDREF(CSSStyleSheet)
NS_IMPL_CYCLE_COLLECTING_RELEASE(CSSStyleSheet)
NS_IMPL_CYCLE_COLLECTION_CLASS(nsCSSStyleSheet)
NS_IMPL_CYCLE_COLLECTION_CLASS(CSSStyleSheet)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsCSSStyleSheet)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(CSSStyleSheet)
tmp->DropMedia();
// We do not unlink mNext; our parent will handle that. If we
// unlinked it here, our parent would not be able to walk its list
@ -1152,7 +1153,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsCSSStyleSheet)
tmp->ClearRuleCascades();
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsCSSStyleSheet)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(CSSStyleSheet)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMedia)
// We do not traverse mNext; our parent will handle that. See
// comments in Unlink for why.
@ -1161,10 +1162,10 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsCSSStyleSheet)
tmp->TraverseInner(cb);
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(nsCSSStyleSheet)
NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(CSSStyleSheet)
nsresult
nsCSSStyleSheet::AddRuleProcessor(nsCSSRuleProcessor* aProcessor)
CSSStyleSheet::AddRuleProcessor(nsCSSRuleProcessor* aProcessor)
{
if (! mRuleProcessors) {
mRuleProcessors = new nsAutoTArray<nsCSSRuleProcessor*, 8>();
@ -1178,7 +1179,7 @@ nsCSSStyleSheet::AddRuleProcessor(nsCSSRuleProcessor* aProcessor)
}
nsresult
nsCSSStyleSheet::DropRuleProcessor(nsCSSRuleProcessor* aProcessor)
CSSStyleSheet::DropRuleProcessor(nsCSSRuleProcessor* aProcessor)
{
if (!mRuleProcessors)
return NS_ERROR_FAILURE;
@ -1189,8 +1190,8 @@ nsCSSStyleSheet::DropRuleProcessor(nsCSSRuleProcessor* aProcessor)
void
nsCSSStyleSheet::SetURIs(nsIURI* aSheetURI, nsIURI* aOriginalSheetURI,
nsIURI* aBaseURI)
CSSStyleSheet::SetURIs(nsIURI* aSheetURI, nsIURI* aOriginalSheetURI,
nsIURI* aBaseURI)
{
NS_PRECONDITION(aSheetURI && aBaseURI, "null ptr");
@ -1203,7 +1204,7 @@ nsCSSStyleSheet::SetURIs(nsIURI* aSheetURI, nsIURI* aOriginalSheetURI,
}
void
nsCSSStyleSheet::SetPrincipal(nsIPrincipal* aPrincipal)
CSSStyleSheet::SetPrincipal(nsIPrincipal* aPrincipal)
{
NS_PRECONDITION(!mInner->mPrincipalSet,
"Should have an inner whose principal has not yet been set");
@ -1216,26 +1217,26 @@ nsCSSStyleSheet::SetPrincipal(nsIPrincipal* aPrincipal)
}
/* virtual */ nsIURI*
nsCSSStyleSheet::GetSheetURI() const
CSSStyleSheet::GetSheetURI() const
{
return mInner->mSheetURI;
}
/* virtual */ nsIURI*
nsCSSStyleSheet::GetBaseURI() const
CSSStyleSheet::GetBaseURI() const
{
return mInner->mBaseURI;
}
/* virtual */ void
nsCSSStyleSheet::GetType(nsString& aType) const
CSSStyleSheet::GetType(nsString& aType) const
{
aType.AssignLiteral("text/css");
}
bool
nsCSSStyleSheet::UseForPresentation(nsPresContext* aPresContext,
nsMediaQueryResultCacheKey& aKey) const
CSSStyleSheet::UseForPresentation(nsPresContext* aPresContext,
nsMediaQueryResultCacheKey& aKey) const
{
if (mMedia) {
return mMedia->Matches(aPresContext, &aKey);
@ -1245,25 +1246,25 @@ nsCSSStyleSheet::UseForPresentation(nsPresContext* aPresContext,
void
nsCSSStyleSheet::SetMedia(nsMediaList* aMedia)
CSSStyleSheet::SetMedia(nsMediaList* aMedia)
{
mMedia = aMedia;
}
/* virtual */ bool
nsCSSStyleSheet::HasRules() const
CSSStyleSheet::HasRules() const
{
return StyleRuleCount() != 0;
}
/* virtual */ bool
nsCSSStyleSheet::IsApplicable() const
CSSStyleSheet::IsApplicable() const
{
return !mDisabled && mInner->mComplete;
}
/* virtual */ void
nsCSSStyleSheet::SetEnabled(bool aEnabled)
CSSStyleSheet::SetEnabled(bool aEnabled)
{
// Internal method, so callers must handle BeginUpdate/EndUpdate
bool oldDisabled = mDisabled;
@ -1279,13 +1280,13 @@ nsCSSStyleSheet::SetEnabled(bool aEnabled)
}
/* virtual */ bool
nsCSSStyleSheet::IsComplete() const
CSSStyleSheet::IsComplete() const
{
return mInner->mComplete;
}
/* virtual */ void
nsCSSStyleSheet::SetComplete()
CSSStyleSheet::SetComplete()
{
NS_ASSERTION(!mDirty, "Can't set a dirty sheet complete!");
mInner->mComplete = true;
@ -1305,25 +1306,25 @@ nsCSSStyleSheet::SetComplete()
}
/* virtual */ nsIStyleSheet*
nsCSSStyleSheet::GetParentSheet() const
CSSStyleSheet::GetParentSheet() const
{
return mParent;
}
/* virtual */ nsIDocument*
nsCSSStyleSheet::GetOwningDocument() const
CSSStyleSheet::GetOwningDocument() const
{
return mDocument;
}
/* virtual */ void
nsCSSStyleSheet::SetOwningDocument(nsIDocument* aDocument)
CSSStyleSheet::SetOwningDocument(nsIDocument* aDocument)
{ // not ref counted
mDocument = aDocument;
// Now set the same document on all our child sheets....
// XXXbz this is a little bogus; see the XXX comment where we
// declare mFirstChild.
for (nsCSSStyleSheet* child = mInner->mFirstChild;
for (CSSStyleSheet* child = mInner->mFirstChild;
child; child = child->mNext) {
if (child->mParent == this) {
child->SetOwningDocument(aDocument);
@ -1332,7 +1333,7 @@ nsCSSStyleSheet::SetOwningDocument(nsIDocument* aDocument)
}
uint64_t
nsCSSStyleSheet::FindOwningWindowInnerID() const
CSSStyleSheet::FindOwningWindowInnerID() const
{
uint64_t windowID = 0;
if (mDocument) {
@ -1346,7 +1347,7 @@ nsCSSStyleSheet::FindOwningWindowInnerID() const
if (windowID == 0 && mOwnerRule) {
nsCOMPtr<nsIStyleSheet> sheet = static_cast<css::Rule*>(mOwnerRule)->GetStyleSheet();
if (sheet) {
nsRefPtr<nsCSSStyleSheet> cssSheet = do_QueryObject(sheet);
nsRefPtr<CSSStyleSheet> cssSheet = do_QueryObject(sheet);
if (cssSheet) {
windowID = cssSheet->FindOwningWindowInnerID();
}
@ -1361,12 +1362,12 @@ nsCSSStyleSheet::FindOwningWindowInnerID() const
}
void
nsCSSStyleSheet::AppendStyleSheet(nsCSSStyleSheet* aSheet)
CSSStyleSheet::AppendStyleSheet(CSSStyleSheet* aSheet)
{
NS_PRECONDITION(nullptr != aSheet, "null arg");
WillDirty();
nsRefPtr<nsCSSStyleSheet>* tail = &mInner->mFirstChild;
nsRefPtr<CSSStyleSheet>* tail = &mInner->mFirstChild;
while (*tail) {
tail = &(*tail)->mNext;
}
@ -1380,12 +1381,12 @@ nsCSSStyleSheet::AppendStyleSheet(nsCSSStyleSheet* aSheet)
}
void
nsCSSStyleSheet::InsertStyleSheetAt(nsCSSStyleSheet* aSheet, int32_t aIndex)
CSSStyleSheet::InsertStyleSheetAt(CSSStyleSheet* aSheet, int32_t aIndex)
{
NS_PRECONDITION(nullptr != aSheet, "null arg");
WillDirty();
nsRefPtr<nsCSSStyleSheet>* tail = &mInner->mFirstChild;
nsRefPtr<CSSStyleSheet>* tail = &mInner->mFirstChild;
while (*tail && aIndex) {
--aIndex;
tail = &(*tail)->mNext;
@ -1401,7 +1402,7 @@ nsCSSStyleSheet::InsertStyleSheetAt(nsCSSStyleSheet* aSheet, int32_t aIndex)
}
void
nsCSSStyleSheet::PrependStyleRule(css::Rule* aRule)
CSSStyleSheet::PrependStyleRule(css::Rule* aRule)
{
NS_PRECONDITION(nullptr != aRule, "null arg");
@ -1417,7 +1418,7 @@ nsCSSStyleSheet::PrependStyleRule(css::Rule* aRule)
}
void
nsCSSStyleSheet::AppendStyleRule(css::Rule* aRule)
CSSStyleSheet::AppendStyleRule(css::Rule* aRule)
{
NS_PRECONDITION(nullptr != aRule, "null arg");
@ -1437,7 +1438,7 @@ nsCSSStyleSheet::AppendStyleRule(css::Rule* aRule)
}
void
nsCSSStyleSheet::ReplaceStyleRule(css::Rule* aOld, css::Rule* aNew)
CSSStyleSheet::ReplaceStyleRule(css::Rule* aOld, css::Rule* aNew)
{
NS_PRECONDITION(mInner->mOrderedRules.Count() != 0, "can't have old rule");
NS_PRECONDITION(mInner->mComplete, "No replacing in an incomplete sheet!");
@ -1458,13 +1459,13 @@ nsCSSStyleSheet::ReplaceStyleRule(css::Rule* aOld, css::Rule* aNew)
}
int32_t
nsCSSStyleSheet::StyleRuleCount() const
CSSStyleSheet::StyleRuleCount() const
{
return mInner->mOrderedRules.Count();
}
css::Rule*
nsCSSStyleSheet::GetStyleRuleAt(int32_t aIndex) const
CSSStyleSheet::GetStyleRuleAt(int32_t aIndex) const
{
// Important: If this function is ever made scriptable, we must add
// a security check here. See GetCssRules below for an example.
@ -1472,14 +1473,14 @@ nsCSSStyleSheet::GetStyleRuleAt(int32_t aIndex) const
}
int32_t
nsCSSStyleSheet::StyleSheetCount() const
CSSStyleSheet::StyleSheetCount() const
{
// XXX Far from an ideal way to do this, but the hope is that
// it won't be done too often. If it is, we might want to
// consider storing the children in an array.
int32_t count = 0;
const nsCSSStyleSheet* child = mInner->mFirstChild;
const CSSStyleSheet* child = mInner->mFirstChild;
while (child) {
count++;
child = child->mNext;
@ -1488,8 +1489,8 @@ nsCSSStyleSheet::StyleSheetCount() const
return count;
}
nsCSSStyleSheet::EnsureUniqueInnerResult
nsCSSStyleSheet::EnsureUniqueInner()
CSSStyleSheet::EnsureUniqueInnerResult
CSSStyleSheet::EnsureUniqueInner()
{
mDirty = true;
@ -1498,7 +1499,7 @@ nsCSSStyleSheet::EnsureUniqueInner()
if (mInner->mSheets.Length() == 1) {
return eUniqueInner_AlreadyUnique;
}
nsCSSStyleSheetInner* clone = mInner->CloneFor(this);
CSSStyleSheetInner* clone = mInner->CloneFor(this);
MOZ_ASSERT(clone);
mInner->RemoveSheet(this);
mInner = clone;
@ -1510,25 +1511,25 @@ nsCSSStyleSheet::EnsureUniqueInner()
}
void
nsCSSStyleSheet::AppendAllChildSheets(nsTArray<nsCSSStyleSheet*>& aArray)
CSSStyleSheet::AppendAllChildSheets(nsTArray<CSSStyleSheet*>& aArray)
{
for (nsCSSStyleSheet* child = mInner->mFirstChild; child;
for (CSSStyleSheet* child = mInner->mFirstChild; child;
child = child->mNext) {
aArray.AppendElement(child);
}
}
already_AddRefed<nsCSSStyleSheet>
nsCSSStyleSheet::Clone(nsCSSStyleSheet* aCloneParent,
css::ImportRule* aCloneOwnerRule,
nsIDocument* aCloneDocument,
nsINode* aCloneOwningNode) const
already_AddRefed<CSSStyleSheet>
CSSStyleSheet::Clone(CSSStyleSheet* aCloneParent,
css::ImportRule* aCloneOwnerRule,
nsIDocument* aCloneDocument,
nsINode* aCloneOwningNode) const
{
nsRefPtr<nsCSSStyleSheet> clone = new nsCSSStyleSheet(*this,
aCloneParent,
aCloneOwnerRule,
aCloneDocument,
aCloneOwningNode);
nsRefPtr<CSSStyleSheet> clone = new CSSStyleSheet(*this,
aCloneParent,
aCloneOwnerRule,
aCloneDocument,
aCloneOwningNode);
return clone.forget();
}
@ -1552,7 +1553,7 @@ struct ListEnumData {
};
/* virtual */ void
nsCSSStyleSheet::List(FILE* out, int32_t aIndent) const
CSSStyleSheet::List(FILE* out, int32_t aIndent) const
{
int32_t index;
@ -1575,7 +1576,7 @@ nsCSSStyleSheet::List(FILE* out, int32_t aIndent) const
}
fputs("\n", out);
for (const nsCSSStyleSheet* child = mInner->mFirstChild;
for (const CSSStyleSheet* child = mInner->mFirstChild;
child;
child = child->mNext) {
child->List(out, aIndent + 1);
@ -1587,7 +1588,7 @@ nsCSSStyleSheet::List(FILE* out, int32_t aIndent) const
#endif
void
nsCSSStyleSheet::ClearRuleCascades()
CSSStyleSheet::ClearRuleCascades()
{
if (mRuleProcessors) {
nsCSSRuleProcessor **iter = mRuleProcessors->Elements(),
@ -1597,13 +1598,13 @@ nsCSSStyleSheet::ClearRuleCascades()
}
}
if (mParent) {
nsCSSStyleSheet* parent = (nsCSSStyleSheet*)mParent;
CSSStyleSheet* parent = (CSSStyleSheet*)mParent;
parent->ClearRuleCascades();
}
}
void
nsCSSStyleSheet::WillDirty()
CSSStyleSheet::WillDirty()
{
if (mInner->mComplete) {
EnsureUniqueInner();
@ -1611,7 +1612,7 @@ nsCSSStyleSheet::WillDirty()
}
void
nsCSSStyleSheet::DidDirty()
CSSStyleSheet::DidDirty()
{
NS_ABORT_IF_FALSE(!mInner->mComplete || mDirty,
"caller must have called WillDirty()");
@ -1619,7 +1620,7 @@ nsCSSStyleSheet::DidDirty()
}
nsresult
nsCSSStyleSheet::SubjectSubsumesInnerPrincipal()
CSSStyleSheet::SubjectSubsumesInnerPrincipal()
{
nsCOMPtr<nsIPrincipal> subjectPrincipal = nsContentUtils::SubjectPrincipal();
if (subjectPrincipal->Subsumes(mInner->mPrincipal)) {
@ -1650,7 +1651,7 @@ nsCSSStyleSheet::SubjectSubsumesInnerPrincipal()
}
nsresult
nsCSSStyleSheet::RegisterNamespaceRule(css::Rule* aRule)
CSSStyleSheet::RegisterNamespaceRule(css::Rule* aRule)
{
if (!mInner->mNameSpaceMap) {
nsresult rv = mInner->CreateNamespaceMap();
@ -1663,30 +1664,30 @@ nsCSSStyleSheet::RegisterNamespaceRule(css::Rule* aRule)
// nsIDOMStyleSheet interface
NS_IMETHODIMP
nsCSSStyleSheet::GetType(nsAString& aType)
CSSStyleSheet::GetType(nsAString& aType)
{
aType.AssignLiteral("text/css");
return NS_OK;
}
NS_IMETHODIMP
nsCSSStyleSheet::GetDisabled(bool* aDisabled)
CSSStyleSheet::GetDisabled(bool* aDisabled)
{
*aDisabled = Disabled();
return NS_OK;
}
NS_IMETHODIMP
nsCSSStyleSheet::SetDisabled(bool aDisabled)
CSSStyleSheet::SetDisabled(bool aDisabled)
{
// DOM method, so handle BeginUpdate/EndUpdate
MOZ_AUTO_DOC_UPDATE(mDocument, UPDATE_STYLE, true);
nsCSSStyleSheet::SetEnabled(!aDisabled);
CSSStyleSheet::SetEnabled(!aDisabled);
return NS_OK;
}
NS_IMETHODIMP
nsCSSStyleSheet::GetOwnerNode(nsIDOMNode** aOwnerNode)
CSSStyleSheet::GetOwnerNode(nsIDOMNode** aOwnerNode)
{
nsCOMPtr<nsIDOMNode> ownerNode = do_QueryInterface(GetOwnerNode());
ownerNode.forget(aOwnerNode);
@ -1694,7 +1695,7 @@ nsCSSStyleSheet::GetOwnerNode(nsIDOMNode** aOwnerNode)
}
NS_IMETHODIMP
nsCSSStyleSheet::GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet)
CSSStyleSheet::GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet)
{
NS_ENSURE_ARG_POINTER(aParentStyleSheet);
@ -1704,7 +1705,7 @@ nsCSSStyleSheet::GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet)
}
NS_IMETHODIMP
nsCSSStyleSheet::GetHref(nsAString& aHref)
CSSStyleSheet::GetHref(nsAString& aHref)
{
if (mInner->mOriginalSheetURI) {
nsAutoCString str;
@ -1718,27 +1719,27 @@ nsCSSStyleSheet::GetHref(nsAString& aHref)
}
/* virtual */ void
nsCSSStyleSheet::GetTitle(nsString& aTitle) const
CSSStyleSheet::GetTitle(nsString& aTitle) const
{
aTitle = mTitle;
}
NS_IMETHODIMP
nsCSSStyleSheet::GetTitle(nsAString& aTitle)
CSSStyleSheet::GetTitle(nsAString& aTitle)
{
aTitle.Assign(mTitle);
return NS_OK;
}
NS_IMETHODIMP
nsCSSStyleSheet::GetMedia(nsIDOMMediaList** aMedia)
CSSStyleSheet::GetMedia(nsIDOMMediaList** aMedia)
{
NS_ADDREF(*aMedia = Media());
return NS_OK;
}
nsMediaList*
nsCSSStyleSheet::Media()
CSSStyleSheet::Media()
{
if (!mMedia) {
mMedia = new nsMediaList();
@ -1749,20 +1750,20 @@ nsCSSStyleSheet::Media()
}
NS_IMETHODIMP
nsCSSStyleSheet::GetOwnerRule(nsIDOMCSSRule** aOwnerRule)
CSSStyleSheet::GetOwnerRule(nsIDOMCSSRule** aOwnerRule)
{
NS_IF_ADDREF(*aOwnerRule = GetOwnerRule());
return NS_OK;
}
nsIDOMCSSRule*
nsCSSStyleSheet::GetDOMOwnerRule() const
CSSStyleSheet::GetDOMOwnerRule() const
{
return mOwnerRule ? mOwnerRule->GetDOMRule() : nullptr;
}
NS_IMETHODIMP
nsCSSStyleSheet::GetCssRules(nsIDOMCSSRuleList** aCssRules)
CSSStyleSheet::GetCssRules(nsIDOMCSSRuleList** aCssRules)
{
ErrorResult rv;
nsCOMPtr<nsIDOMCSSRuleList> rules = GetCssRules(rv);
@ -1771,7 +1772,7 @@ nsCSSStyleSheet::GetCssRules(nsIDOMCSSRuleList** aCssRules)
}
CSSRuleList*
nsCSSStyleSheet::GetCssRules(ErrorResult& aRv)
CSSStyleSheet::GetCssRules(ErrorResult& aRv)
{
// No doing this on incomplete sheets!
if (!mInner->mComplete) {
@ -1796,9 +1797,9 @@ nsCSSStyleSheet::GetCssRules(ErrorResult& aRv)
}
NS_IMETHODIMP
nsCSSStyleSheet::InsertRule(const nsAString& aRule,
uint32_t aIndex,
uint32_t* aReturn)
CSSStyleSheet::InsertRule(const nsAString& aRule,
uint32_t aIndex,
uint32_t* aReturn)
{
//-- Security check: Only scripts whose principal subsumes that of the
// style sheet can modify rule collections.
@ -1815,14 +1816,14 @@ RuleHasPendingChildSheet(css::Rule *cssRule)
NS_ASSERTION(importRule, "Rule which has type IMPORT_RULE and does not implement nsIDOMCSSImportRule!");
nsCOMPtr<nsIDOMCSSStyleSheet> childSheet;
importRule->GetStyleSheet(getter_AddRefs(childSheet));
nsRefPtr<nsCSSStyleSheet> cssSheet = do_QueryObject(childSheet);
nsRefPtr<CSSStyleSheet> cssSheet = do_QueryObject(childSheet);
return cssSheet != nullptr && !cssSheet->IsComplete();
}
nsresult
nsCSSStyleSheet::InsertRuleInternal(const nsAString& aRule,
uint32_t aIndex,
uint32_t* aReturn)
CSSStyleSheet::InsertRuleInternal(const nsAString& aRule,
uint32_t aIndex,
uint32_t* aReturn)
{
// No doing this if the sheet is not complete!
if (!mInner->mComplete) {
@ -1930,7 +1931,7 @@ nsCSSStyleSheet::InsertRuleInternal(const nsAString& aRule,
}
NS_IMETHODIMP
nsCSSStyleSheet::DeleteRule(uint32_t aIndex)
CSSStyleSheet::DeleteRule(uint32_t aIndex)
{
// No doing this if the sheet is not complete!
if (!mInner->mComplete) {
@ -1974,7 +1975,7 @@ nsCSSStyleSheet::DeleteRule(uint32_t aIndex)
}
nsresult
nsCSSStyleSheet::DeleteRuleFromGroup(css::GroupRule* aGroup, uint32_t aIndex)
CSSStyleSheet::DeleteRuleFromGroup(css::GroupRule* aGroup, uint32_t aIndex)
{
NS_ENSURE_ARG_POINTER(aGroup);
NS_ASSERTION(mInner->mComplete, "No deleting from an incomplete sheet!");
@ -2005,10 +2006,10 @@ nsCSSStyleSheet::DeleteRuleFromGroup(css::GroupRule* aGroup, uint32_t aIndex)
}
nsresult
nsCSSStyleSheet::InsertRuleIntoGroup(const nsAString & aRule,
css::GroupRule* aGroup,
uint32_t aIndex,
uint32_t* _retval)
CSSStyleSheet::InsertRuleIntoGroup(const nsAString & aRule,
css::GroupRule* aGroup,
uint32_t aIndex,
uint32_t* _retval)
{
NS_ASSERTION(mInner->mComplete, "No inserting into an incomplete sheet!");
// check that the group actually belongs to this sheet!
@ -2071,8 +2072,8 @@ nsCSSStyleSheet::InsertRuleIntoGroup(const nsAString & aRule,
}
nsresult
nsCSSStyleSheet::ReplaceRuleInGroup(css::GroupRule* aGroup,
css::Rule* aOld, css::Rule* aNew)
CSSStyleSheet::ReplaceRuleInGroup(css::GroupRule* aGroup,
css::Rule* aOld, css::Rule* aNew)
{
NS_PRECONDITION(mInner->mComplete, "No replacing in an incomplete sheet!");
NS_ASSERTION(this == aGroup->GetStyleSheet(), "group doesn't belong to this sheet");
@ -2086,9 +2087,9 @@ nsCSSStyleSheet::ReplaceRuleInGroup(css::GroupRule* aGroup,
// nsICSSLoaderObserver implementation
NS_IMETHODIMP
nsCSSStyleSheet::StyleSheetLoaded(nsCSSStyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus)
CSSStyleSheet::StyleSheetLoaded(CSSStyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus)
{
if (aSheet->GetParentSheet() == nullptr) {
return NS_OK; // ignore if sheet has been detached already (see parseSheet)
@ -2108,7 +2109,7 @@ nsCSSStyleSheet::StyleSheetLoaded(nsCSSStyleSheet* aSheet,
}
nsresult
nsCSSStyleSheet::ParseSheet(const nsAString& aInput)
CSSStyleSheet::ParseSheet(const nsAString& aInput)
{
// Not doing this if the sheet is not complete!
if (!mInner->mComplete) {
@ -2141,7 +2142,7 @@ nsCSSStyleSheet::ParseSheet(const nsAString& aInput)
}
// nuke child sheets list and current namespace map
for (nsCSSStyleSheet* child = mInner->mFirstChild; child; child = child->mNext) {
for (CSSStyleSheet* child = mInner->mFirstChild; child; child = child->mNext) {
NS_ASSERTION(child->mParent == this, "Child sheet is not parented to this!");
child->mParent = nullptr;
child->mDocument = nullptr;
@ -2173,14 +2174,16 @@ nsCSSStyleSheet::ParseSheet(const nsAString& aInput)
}
/* virtual */ nsIURI*
nsCSSStyleSheet::GetOriginalURI() const
CSSStyleSheet::GetOriginalURI() const
{
return mInner->mOriginalSheetURI;
}
/* virtual */
JSObject*
nsCSSStyleSheet::WrapObject(JSContext* aCx)
CSSStyleSheet::WrapObject(JSContext* aCx)
{
return CSSStyleSheetBinding::Wrap(aCx, this);
}
} // namespace mozilla

View File

@ -6,8 +6,8 @@
/* representation of a CSS style sheet */
#ifndef nsCSSStyleSheet_h_
#define nsCSSStyleSheet_h_
#ifndef mozilla_CSSStyleSheet_h
#define mozilla_CSSStyleSheet_h
#include "mozilla/Attributes.h"
#include "mozilla/MemoryReporting.h"
@ -26,16 +26,20 @@
#include "nsCycleCollectionParticipant.h"
#include "nsWrapperCache.h"
class nsXMLNameSpaceMap;
class CSSRuleListImpl;
class nsCSSRuleProcessor;
class nsICSSRuleList;
class nsIPrincipal;
class nsIURI;
class nsMediaList;
class nsMediaQueryResultCacheKey;
class nsCSSStyleSheet;
class nsPresContext;
class nsXMLNameSpaceMap;
namespace mozilla {
class ChildSheetListBuilder;
class CSSStyleSheet;
namespace css {
class Rule;
class GroupRule;
@ -44,48 +48,48 @@ class ImportRule;
namespace dom {
class CSSRuleList;
}
}
// -------------------------------
// CSS Style Sheet Inner Data Container
//
class nsCSSStyleSheetInner {
class CSSStyleSheetInner
{
public:
friend class nsCSSStyleSheet;
friend class nsCSSRuleProcessor;
friend class mozilla::CSSStyleSheet;
friend class ::nsCSSRuleProcessor;
private:
nsCSSStyleSheetInner(nsCSSStyleSheet* aPrimarySheet,
mozilla::CORSMode aCORSMode);
nsCSSStyleSheetInner(nsCSSStyleSheetInner& aCopy,
nsCSSStyleSheet* aPrimarySheet);
~nsCSSStyleSheetInner();
CSSStyleSheetInner(CSSStyleSheet* aPrimarySheet,
CORSMode aCORSMode);
CSSStyleSheetInner(CSSStyleSheetInner& aCopy,
CSSStyleSheet* aPrimarySheet);
~CSSStyleSheetInner();
nsCSSStyleSheetInner* CloneFor(nsCSSStyleSheet* aPrimarySheet);
void AddSheet(nsCSSStyleSheet* aSheet);
void RemoveSheet(nsCSSStyleSheet* aSheet);
CSSStyleSheetInner* CloneFor(CSSStyleSheet* aPrimarySheet);
void AddSheet(CSSStyleSheet* aSheet);
void RemoveSheet(CSSStyleSheet* aSheet);
void RebuildNameSpaces();
// Create a new namespace map
nsresult CreateNamespaceMap();
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
nsAutoTArray<nsCSSStyleSheet*, 8> mSheets;
nsAutoTArray<CSSStyleSheet*, 8> mSheets;
nsCOMPtr<nsIURI> mSheetURI; // for error reports, etc.
nsCOMPtr<nsIURI> mOriginalSheetURI; // for GetHref. Can be null.
nsCOMPtr<nsIURI> mBaseURI; // for resolving relative URIs
nsCOMPtr<nsIPrincipal> mPrincipal;
nsCOMArray<mozilla::css::Rule> mOrderedRules;
nsCOMArray<css::Rule> mOrderedRules;
nsAutoPtr<nsXMLNameSpaceMap> mNameSpaceMap;
// Linked list of child sheets. This is al fundamentally broken, because
// each of the child sheets has a unique parent... We can only hope (and
// currently this is the case) that any time page JS can get ts hands on a
// child sheet that means we've already ensured unique inners throughout its
// parent chain and things are good.
nsRefPtr<nsCSSStyleSheet> mFirstChild;
mozilla::CORSMode mCORSMode;
nsRefPtr<CSSStyleSheet> mFirstChild;
CORSMode mCORSMode;
bool mComplete;
#ifdef DEBUG
@ -98,25 +102,23 @@ private:
// CSS Style Sheet
//
class CSSRuleListImpl;
// CID for the nsCSSStyleSheet class
// CID for the CSSStyleSheet class
// ca926f30-2a7e-477e-8467-803fb32af20a
#define NS_CSS_STYLE_SHEET_IMPL_CID \
{ 0xca926f30, 0x2a7e, 0x477e, \
{ 0x84, 0x67, 0x80, 0x3f, 0xb3, 0x2a, 0xf2, 0x0a } }
class nsCSSStyleSheet MOZ_FINAL : public nsIStyleSheet,
public nsIDOMCSSStyleSheet,
public nsICSSLoaderObserver,
public nsWrapperCache
class CSSStyleSheet MOZ_FINAL : public nsIStyleSheet,
public nsIDOMCSSStyleSheet,
public nsICSSLoaderObserver,
public nsWrapperCache
{
public:
nsCSSStyleSheet(mozilla::CORSMode aCORSMode);
CSSStyleSheet(CORSMode aCORSMode);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsCSSStyleSheet,
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(CSSStyleSheet,
nsIStyleSheet)
NS_DECLARE_STATIC_IID_ACCESSOR(NS_CSS_STYLE_SHEET_IMPL_CID)
@ -141,20 +143,20 @@ public:
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const MOZ_OVERRIDE;
#endif
void AppendStyleSheet(nsCSSStyleSheet* aSheet);
void InsertStyleSheetAt(nsCSSStyleSheet* aSheet, int32_t aIndex);
void AppendStyleSheet(CSSStyleSheet* aSheet);
void InsertStyleSheetAt(CSSStyleSheet* aSheet, int32_t aIndex);
// XXX do these belong here or are they generic?
void PrependStyleRule(mozilla::css::Rule* aRule);
void AppendStyleRule(mozilla::css::Rule* aRule);
void ReplaceStyleRule(mozilla::css::Rule* aOld, mozilla::css::Rule* aNew);
void PrependStyleRule(css::Rule* aRule);
void AppendStyleRule(css::Rule* aRule);
void ReplaceStyleRule(css::Rule* aOld, css::Rule* aNew);
int32_t StyleRuleCount() const;
mozilla::css::Rule* GetStyleRuleAt(int32_t aIndex) const;
css::Rule* GetStyleRuleAt(int32_t aIndex) const;
nsresult DeleteRuleFromGroup(mozilla::css::GroupRule* aGroup, uint32_t aIndex);
nsresult InsertRuleIntoGroup(const nsAString& aRule, mozilla::css::GroupRule* aGroup, uint32_t aIndex, uint32_t* _retval);
nsresult ReplaceRuleInGroup(mozilla::css::GroupRule* aGroup, mozilla::css::Rule* aOld, mozilla::css::Rule* aNew);
nsresult DeleteRuleFromGroup(css::GroupRule* aGroup, uint32_t aIndex);
nsresult InsertRuleIntoGroup(const nsAString& aRule, css::GroupRule* aGroup, uint32_t aIndex, uint32_t* _retval);
nsresult ReplaceRuleInGroup(css::GroupRule* aGroup, css::Rule* aOld, css::Rule* aNew);
int32_t StyleSheetCount() const;
@ -182,15 +184,15 @@ public:
void SetMedia(nsMediaList* aMedia);
void SetOwningNode(nsINode* aOwningNode) { mOwningNode = aOwningNode; /* Not ref counted */ }
void SetOwnerRule(mozilla::css::ImportRule* aOwnerRule) { mOwnerRule = aOwnerRule; /* Not ref counted */ }
mozilla::css::ImportRule* GetOwnerRule() const { return mOwnerRule; }
void SetOwnerRule(css::ImportRule* aOwnerRule) { mOwnerRule = aOwnerRule; /* Not ref counted */ }
css::ImportRule* GetOwnerRule() const { return mOwnerRule; }
nsXMLNameSpaceMap* GetNameSpaceMap() const { return mInner->mNameSpaceMap; }
already_AddRefed<nsCSSStyleSheet> Clone(nsCSSStyleSheet* aCloneParent,
mozilla::css::ImportRule* aCloneOwnerRule,
nsIDocument* aCloneDocument,
nsINode* aCloneOwningNode) const;
already_AddRefed<CSSStyleSheet> Clone(CSSStyleSheet* aCloneParent,
css::ImportRule* aCloneOwnerRule,
nsIDocument* aCloneDocument,
nsINode* aCloneOwningNode) const;
bool IsModified() const { return mDirty; }
@ -214,7 +216,7 @@ public:
virtual nsIURI* GetOriginalURI() const;
// nsICSSLoaderObserver interface
NS_IMETHOD StyleSheetLoaded(nsCSSStyleSheet* aSheet, bool aWasAlternate,
NS_IMETHOD StyleSheetLoaded(CSSStyleSheet* aSheet, bool aWasAlternate,
nsresult aStatus) MOZ_OVERRIDE;
enum EnsureUniqueInnerResult {
@ -227,7 +229,7 @@ public:
EnsureUniqueInnerResult EnsureUniqueInner();
// Append all of this sheet's child sheets to aArray.
void AppendAllChildSheets(nsTArray<nsCSSStyleSheet*>& aArray);
void AppendAllChildSheets(nsTArray<CSSStyleSheet*>& aArray);
bool UseForPresentation(nsPresContext* aPresContext,
nsMediaQueryResultCacheKey& aKey) const;
@ -242,15 +244,15 @@ public:
// Function used as a callback to rebuild our inner's child sheet
// list after we clone a unique inner for ourselves.
static bool RebuildChildList(mozilla::css::Rule* aRule, void* aBuilder);
static bool RebuildChildList(css::Rule* aRule, void* aBuilder);
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
// Get this style sheet's CORS mode
mozilla::CORSMode GetCORSMode() const { return mInner->mCORSMode; }
CORSMode GetCORSMode() const { return mInner->mCORSMode; }
mozilla::dom::Element* GetScopeElement() const { return mScopeElement; }
void SetScopeElement(mozilla::dom::Element* aScopeElement)
dom::Element* GetScopeElement() const { return mScopeElement; }
void SetScopeElement(dom::Element* aScopeElement)
{
mScopeElement = aScopeElement;
}
@ -259,15 +261,15 @@ public:
// Our nsIStyleSheet::GetType is a const method, so it ends up
// ambiguous with with the XPCOM version. Just disambiguate.
void GetType(nsString& aType) {
const_cast<const nsCSSStyleSheet*>(this)->GetType(aType);
const_cast<const CSSStyleSheet*>(this)->GetType(aType);
}
// Our XPCOM GetHref is fine for WebIDL
nsINode* GetOwnerNode() const { return mOwningNode; }
nsCSSStyleSheet* GetParentStyleSheet() const { return mParent; }
CSSStyleSheet* GetParentStyleSheet() const { return mParent; }
// Our nsIStyleSheet::GetTitle is a const method, so it ends up
// ambiguous with with the XPCOM version. Just disambiguate.
void GetTitle(nsString& aTitle) {
const_cast<const nsCSSStyleSheet*>(this)->GetTitle(aTitle);
const_cast<const CSSStyleSheet*>(this)->GetTitle(aTitle);
}
nsMediaList* Media();
bool Disabled() const { return mDisabled; }
@ -278,40 +280,39 @@ public:
// called GetOwnerRule because that would be ambiguous with the ImportRule
// version.
nsIDOMCSSRule* GetDOMOwnerRule() const;
mozilla::dom::CSSRuleList* GetCssRules(mozilla::ErrorResult& aRv);
dom::CSSRuleList* GetCssRules(ErrorResult& aRv);
uint32_t InsertRule(const nsAString& aRule, uint32_t aIndex,
mozilla::ErrorResult& aRv) {
ErrorResult& aRv) {
uint32_t retval;
aRv = InsertRule(aRule, aIndex, &retval);
return retval;
}
void DeleteRule(uint32_t aIndex, mozilla::ErrorResult& aRv) {
void DeleteRule(uint32_t aIndex, ErrorResult& aRv) {
aRv = DeleteRule(aIndex);
}
// WebIDL miscellaneous bits
mozilla::dom::ParentObject GetParentObject() const {
dom::ParentObject GetParentObject() const {
if (mOwningNode) {
return mozilla::dom::ParentObject(mOwningNode);
return dom::ParentObject(mOwningNode);
}
return mozilla::dom::ParentObject(static_cast<nsIStyleSheet*>(mParent),
mParent);
return dom::ParentObject(static_cast<nsIStyleSheet*>(mParent), mParent);
}
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
private:
nsCSSStyleSheet(const nsCSSStyleSheet& aCopy,
nsCSSStyleSheet* aParentToUse,
mozilla::css::ImportRule* aOwnerRuleToUse,
nsIDocument* aDocumentToUse,
nsINode* aOwningNodeToUse);
CSSStyleSheet(const CSSStyleSheet& aCopy,
CSSStyleSheet* aParentToUse,
css::ImportRule* aOwnerRuleToUse,
nsIDocument* aDocumentToUse,
nsINode* aOwningNodeToUse);
nsCSSStyleSheet(const nsCSSStyleSheet& aCopy) MOZ_DELETE;
nsCSSStyleSheet& operator=(const nsCSSStyleSheet& aCopy) MOZ_DELETE;
CSSStyleSheet(const CSSStyleSheet& aCopy) MOZ_DELETE;
CSSStyleSheet& operator=(const CSSStyleSheet& aCopy) MOZ_DELETE;
protected:
virtual ~nsCSSStyleSheet();
virtual ~CSSStyleSheet();
void ClearRuleCascades();
@ -325,7 +326,7 @@ protected:
nsresult SubjectSubsumesInnerPrincipal();
// Add the namespace mapping from this @namespace rule to our namespace map
nsresult RegisterNamespaceRule(mozilla::css::Rule* aRule);
nsresult RegisterNamespaceRule(css::Rule* aRule);
// Drop our reference to mRuleCollection
void DropRuleCollection();
@ -341,26 +342,28 @@ protected:
protected:
nsString mTitle;
nsRefPtr<nsMediaList> mMedia;
nsRefPtr<nsCSSStyleSheet> mNext;
nsCSSStyleSheet* mParent; // weak ref
mozilla::css::ImportRule* mOwnerRule; // weak ref
nsRefPtr<CSSStyleSheet> mNext;
CSSStyleSheet* mParent; // weak ref
css::ImportRule* mOwnerRule; // weak ref
nsRefPtr<CSSRuleListImpl> mRuleCollection;
nsIDocument* mDocument; // weak ref; parents maintain this for their children
nsINode* mOwningNode; // weak ref
bool mDisabled;
bool mDirty; // has been modified
nsRefPtr<mozilla::dom::Element> mScopeElement;
nsRefPtr<dom::Element> mScopeElement;
nsCSSStyleSheetInner* mInner;
CSSStyleSheetInner* mInner;
nsAutoTArray<nsCSSRuleProcessor*, 8>* mRuleProcessors;
friend class nsMediaList;
friend class nsCSSRuleProcessor;
friend struct ChildSheetListBuilder;
friend class ::nsMediaList;
friend class ::nsCSSRuleProcessor;
friend struct mozilla::ChildSheetListBuilder;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsCSSStyleSheet, NS_CSS_STYLE_SHEET_IMPL_CID)
NS_DEFINE_STATIC_IID_ACCESSOR(CSSStyleSheet, NS_CSS_STYLE_SHEET_IMPL_CID)
#endif /* !defined(nsCSSStyleSheet_h_) */
} // namespace mozilla
#endif /* !defined(mozilla_CSSStyleSheet_h) */

View File

@ -6,11 +6,12 @@
/* diagnostic reporting for CSS style sheet parser */
#include "mozilla/css/ErrorReporter.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/css/Loader.h"
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
#include "nsCSSScanner.h"
#include "nsCSSStyleSheet.h"
#include "nsIConsoleService.h"
#include "nsIDocument.h"
#include "nsIFactory.h"
@ -22,8 +23,7 @@
#ifdef CSS_REPORT_PARSE_ERRORS
using mozilla::Preferences;
namespace services = mozilla::services;
using namespace mozilla;
namespace {
class ShortTermURISpecCache : public nsRunnable {
@ -132,7 +132,7 @@ ErrorReporter::ReleaseGlobals()
}
ErrorReporter::ErrorReporter(const nsCSSScanner& aScanner,
const nsCSSStyleSheet* aSheet,
const CSSStyleSheet* aSheet,
const Loader* aLoader,
nsIURI* aURI)
: mScanner(&aScanner), mSheet(aSheet), mLoader(aLoader), mURI(aURI),

View File

@ -14,11 +14,12 @@
#include "nsString.h"
struct nsCSSToken;
class nsCSSStyleSheet;
class nsCSSScanner;
class nsIURI;
namespace mozilla {
class CSSStyleSheet;
namespace css {
class Loader;
@ -28,7 +29,7 @@ class Loader;
class MOZ_STACK_CLASS ErrorReporter {
public:
ErrorReporter(const nsCSSScanner &aScanner,
const nsCSSStyleSheet *aSheet,
const CSSStyleSheet *aSheet,
const Loader *aLoader,
nsIURI *aURI);
~ErrorReporter();
@ -67,7 +68,7 @@ private:
nsString mErrorLine;
nsString mFileName;
const nsCSSScanner *mScanner;
const nsCSSStyleSheet *mSheet;
const CSSStyleSheet *mSheet;
const Loader *mLoader;
nsIURI *mURI;
uint64_t mInnerWindowID;
@ -79,7 +80,7 @@ private:
#ifndef CSS_REPORT_PARSE_ERRORS
inline ErrorReporter::ErrorReporter(const nsCSSScanner&,
const nsCSSStyleSheet*,
const CSSStyleSheet*,
const Loader*,
nsIURI*) {}
inline ErrorReporter::~ErrorReporter() {}

View File

@ -22,6 +22,9 @@ class nsPresContext;
class nsMediaQueryResultCacheKey;
namespace mozilla {
class CSSStyleSheet;
namespace css {
class GroupRuleRuleList;
@ -41,7 +44,7 @@ public:
// implement part of nsIStyleRule and Rule
DECL_STYLE_RULE_INHERIT_NO_DOMRULE
virtual void SetStyleSheet(nsCSSStyleSheet* aSheet);
virtual void SetStyleSheet(CSSStyleSheet* aSheet);
// to help implement nsIStyleRule
#ifdef DEBUG

View File

@ -18,6 +18,9 @@ class nsMediaList;
class nsString;
namespace mozilla {
class CSSStyleSheet;
namespace css {
class ImportRule MOZ_FINAL : public Rule,
@ -47,7 +50,7 @@ public:
virtual int32_t GetType() const;
virtual already_AddRefed<Rule> Clone() const;
void SetSheet(nsCSSStyleSheet*);
void SetSheet(CSSStyleSheet*);
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
@ -60,7 +63,7 @@ public:
private:
nsString mURLSpec;
nsRefPtr<nsMediaList> mMedia;
nsRefPtr<nsCSSStyleSheet> mChildSheet;
nsRefPtr<CSSStyleSheet> mChildSheet;
};
} // namespace css

View File

@ -38,10 +38,10 @@
#include "nsIHttpChannelInternal.h"
#include "nsIScriptError.h"
#include "nsMimeTypes.h"
#include "nsCSSStyleSheet.h"
#include "nsIStyleSheetLinkingElement.h"
#include "nsICSSLoaderObserver.h"
#include "nsCSSParser.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/css/ImportRule.h"
#include "nsThreadUtils.h"
#include "nsGkAtoms.h"
@ -113,7 +113,7 @@ public:
SheetLoadData(Loader* aLoader,
const nsSubstring& aTitle,
nsIURI* aURI,
nsCSSStyleSheet* aSheet,
CSSStyleSheet* aSheet,
nsIStyleSheetLinkingElement* aOwningElement,
bool aIsAlternate,
nsICSSLoaderObserver* aObserver,
@ -122,7 +122,7 @@ public:
// Data for loading a sheet linked from an @import rule
SheetLoadData(Loader* aLoader,
nsIURI* aURI,
nsCSSStyleSheet* aSheet,
CSSStyleSheet* aSheet,
SheetLoadData* aParentData,
nsICSSLoaderObserver* aObserver,
nsIPrincipal* aLoaderPrincipal);
@ -130,7 +130,7 @@ public:
// Data for loading a non-document sheet
SheetLoadData(Loader* aLoader,
nsIURI* aURI,
nsCSSStyleSheet* aSheet,
CSSStyleSheet* aSheet,
bool aSyncLoad,
bool aAllowUnsafeRules,
bool aUseSystemPrincipal,
@ -165,7 +165,7 @@ public:
uint32_t mLineNumber;
// The sheet we're loading data for
nsRefPtr<nsCSSStyleSheet> mSheet;
nsRefPtr<CSSStyleSheet> mSheet;
// Linked list of datas for the same URI as us
SheetLoadData* mNext; // strong ref
@ -308,7 +308,7 @@ NS_IMPL_ISUPPORTS(SheetLoadData, nsIUnicharStreamLoaderObserver, nsIRunnable,
SheetLoadData::SheetLoadData(Loader* aLoader,
const nsSubstring& aTitle,
nsIURI* aURI,
nsCSSStyleSheet* aSheet,
CSSStyleSheet* aSheet,
nsIStyleSheetLinkingElement* aOwningElement,
bool aIsAlternate,
nsICSSLoaderObserver* aObserver,
@ -340,7 +340,7 @@ SheetLoadData::SheetLoadData(Loader* aLoader,
SheetLoadData::SheetLoadData(Loader* aLoader,
nsIURI* aURI,
nsCSSStyleSheet* aSheet,
CSSStyleSheet* aSheet,
SheetLoadData* aParentData,
nsICSSLoaderObserver* aObserver,
nsIPrincipal* aLoaderPrincipal)
@ -381,7 +381,7 @@ SheetLoadData::SheetLoadData(Loader* aLoader,
SheetLoadData::SheetLoadData(Loader* aLoader,
nsIURI* aURI,
nsCSSStyleSheet* aSheet,
CSSStyleSheet* aSheet,
bool aSyncLoad,
bool aAllowUnsafeRules,
bool aUseSystemPrincipal,
@ -970,7 +970,7 @@ Loader::IsAlternate(const nsAString& aTitle, bool aHasAlternateRel)
/* static */ PLDHashOperator
Loader::RemoveEntriesWithURI(URIPrincipalAndCORSModeHashKey* aKey,
nsRefPtr<nsCSSStyleSheet> &aSheet,
nsRefPtr<CSSStyleSheet>& aSheet,
void* aUserData)
{
nsIURI* obsoleteURI = static_cast<nsIURI*>(aUserData);
@ -1050,7 +1050,7 @@ Loader::CheckLoadAllowed(nsIPrincipal* aSourcePrincipal,
}
/**
* CreateSheet() creates an nsCSSStyleSheet object for the given URI,
* CreateSheet() creates a CSSStyleSheet object for the given URI,
* if any. If there is no URI given, we just create a new style sheet
* object. Otherwise, we check for an existing style sheet object for
* that uri in various caches and clone it if we find it. Cloned
@ -1068,7 +1068,7 @@ Loader::CreateSheet(nsIURI* aURI,
const nsAString& aTitle,
StyleSheetState& aSheetState,
bool *aIsAlternate,
nsCSSStyleSheet** aSheet)
CSSStyleSheet** aSheet)
{
LOG(("css::Loader::CreateSheet"));
NS_PRECONDITION(aSheet, "Null out param!");
@ -1086,7 +1086,7 @@ Loader::CreateSheet(nsIURI* aURI,
if (aURI) {
aSheetState = eSheetComplete;
nsRefPtr<nsCSSStyleSheet> sheet;
nsRefPtr<CSSStyleSheet> sheet;
// First, the XUL cache
#ifdef MOZ_XUL
@ -1210,7 +1210,7 @@ Loader::CreateSheet(nsIURI* aURI,
originalURI = aURI;
}
nsRefPtr<nsCSSStyleSheet> sheet = new nsCSSStyleSheet(aCORSMode);
nsRefPtr<CSSStyleSheet> sheet = new CSSStyleSheet(aCORSMode);
sheet->SetURIs(sheetURI, originalURI, baseURI);
sheet.forget(aSheet);
}
@ -1228,7 +1228,7 @@ Loader::CreateSheet(nsIURI* aURI,
* the sheet had "alternate" in its rel.
*/
void
Loader::PrepareSheet(nsCSSStyleSheet* aSheet,
Loader::PrepareSheet(CSSStyleSheet* aSheet,
const nsSubstring& aTitle,
const nsSubstring& aMediaString,
nsMediaList* aMediaList,
@ -1272,7 +1272,7 @@ Loader::PrepareSheet(nsCSSStyleSheet* aSheet,
* as determined by CompareDocumentPosition.
*/
nsresult
Loader::InsertSheetInDoc(nsCSSStyleSheet* aSheet,
Loader::InsertSheetInDoc(CSSStyleSheet* aSheet,
nsIContent* aLinkingContent,
nsIDocument* aDocument)
{
@ -1352,8 +1352,8 @@ Loader::InsertSheetInDoc(nsCSSStyleSheet* aSheet,
* to put it anyway. So just append for now.
*/
nsresult
Loader::InsertChildSheet(nsCSSStyleSheet* aSheet,
nsCSSStyleSheet* aParentSheet,
Loader::InsertChildSheet(CSSStyleSheet* aSheet,
CSSStyleSheet* aParentSheet,
ImportRule* aParentRule)
{
LOG(("css::Loader::InsertChildSheet"));
@ -1814,7 +1814,7 @@ Loader::DoSheetComplete(SheetLoadData* aLoadData, nsresult aStatus,
// parent sheet anyway, so that if someone then accesses it via
// CSSOM we won't have extra clones of the inner lying around.
data = aLoadData;
nsCSSStyleSheet* sheet = aLoadData->mSheet;
CSSStyleSheet* sheet = aLoadData->mSheet;
while (data) {
if (data->mSheet->GetParentSheet() || data->mSheet->GetOwnerNode()) {
sheet = data->mSheet;
@ -1880,7 +1880,7 @@ Loader::LoadInlineStyle(nsIContent* aElement,
// load data or to CreateSheet(). Also, OK to use CORS_NONE for the CORS
// mode.
StyleSheetState state;
nsRefPtr<nsCSSStyleSheet> sheet;
nsRefPtr<CSSStyleSheet> sheet;
nsresult rv = CreateSheet(nullptr, aElement, nullptr, CORS_NONE, false, false,
aTitle, state, aIsAlternate, getter_AddRefs(sheet));
NS_ENSURE_SUCCESS(rv, rv);
@ -1959,7 +1959,7 @@ Loader::LoadStyleLink(nsIContent* aElement,
LOG((" Passed load check"));
StyleSheetState state;
nsRefPtr<nsCSSStyleSheet> sheet;
nsRefPtr<CSSStyleSheet> sheet;
rv = CreateSheet(aURL, aElement, principal, aCORSMode, false,
aHasAlternateRel, aTitle, state, aIsAlternate,
getter_AddRefs(sheet));
@ -2043,7 +2043,7 @@ HaveAncestorDataWithURI(SheetLoadData *aData, nsIURI *aURI)
}
nsresult
Loader::LoadChildSheet(nsCSSStyleSheet* aParentSheet,
Loader::LoadChildSheet(CSSStyleSheet* aParentSheet,
nsIURI* aURL,
nsMediaList* aMedia,
ImportRule* aParentRule)
@ -2114,7 +2114,7 @@ Loader::LoadChildSheet(nsCSSStyleSheet* aParentSheet,
// Now that we know it's safe to load this (passes security check and not a
// loop) do so.
nsRefPtr<nsCSSStyleSheet> sheet;
nsRefPtr<CSSStyleSheet> sheet;
bool isAlternate;
StyleSheetState state;
const nsSubstring& empty = EmptyString();
@ -2157,7 +2157,7 @@ Loader::LoadChildSheet(nsCSSStyleSheet* aParentSheet,
nsresult
Loader::LoadSheetSync(nsIURI* aURL, bool aAllowUnsafeRules,
bool aUseSystemPrincipal,
nsCSSStyleSheet** aSheet)
CSSStyleSheet** aSheet)
{
LOG(("css::Loader::LoadSheetSync"));
return InternalLoadNonDocumentSheet(aURL, aAllowUnsafeRules,
@ -2170,7 +2170,7 @@ Loader::LoadSheet(nsIURI* aURL,
nsIPrincipal* aOriginPrincipal,
const nsCString& aCharset,
nsICSSLoaderObserver* aObserver,
nsCSSStyleSheet** aSheet)
CSSStyleSheet** aSheet)
{
LOG(("css::Loader::LoadSheet(aURL, aObserver, aSheet) api call"));
NS_PRECONDITION(aSheet, "aSheet is null");
@ -2198,7 +2198,7 @@ Loader::InternalLoadNonDocumentSheet(nsIURI* aURL,
bool aUseSystemPrincipal,
nsIPrincipal* aOriginPrincipal,
const nsCString& aCharset,
nsCSSStyleSheet** aSheet,
CSSStyleSheet** aSheet,
nsICSSLoaderObserver* aObserver,
CORSMode aCORSMode)
{
@ -2226,7 +2226,7 @@ Loader::InternalLoadNonDocumentSheet(nsIURI* aURL,
StyleSheetState state;
bool isAlternate;
nsRefPtr<nsCSSStyleSheet> sheet;
nsRefPtr<CSSStyleSheet> sheet;
bool syncLoad = (aObserver == nullptr);
const nsSubstring& empty = EmptyString();
@ -2268,7 +2268,7 @@ Loader::InternalLoadNonDocumentSheet(nsIURI* aURL,
nsresult
Loader::PostLoadEvent(nsIURI* aURI,
nsCSSStyleSheet* aSheet,
CSSStyleSheet* aSheet,
nsICSSLoaderObserver* aObserver,
bool aWasAlternate,
nsIStyleSheetLinkingElement* aElement)
@ -2450,7 +2450,7 @@ Loader::StartAlternateLoads()
static PLDHashOperator
TraverseSheet(URIPrincipalAndCORSModeHashKey*,
nsCSSStyleSheet* aSheet,
CSSStyleSheet* aSheet,
void* aClosure)
{
nsCycleCollectionTraversalCallback* cb =
@ -2483,7 +2483,7 @@ struct SheetMemoryCounter {
static size_t
CountSheetMemory(URIPrincipalAndCORSModeHashKey* /* unused */,
const nsRefPtr<nsCSSStyleSheet>& aSheet,
const nsRefPtr<CSSStyleSheet>& aSheet,
mozilla::MallocSizeOf aMallocSizeOf,
void* /* unused */)
{

View File

@ -23,7 +23,6 @@
class nsIAtom;
class nsICSSLoaderObserver;
class nsCSSStyleSheet;
class nsIContent;
class nsIDocument;
class nsCSSParser;
@ -32,6 +31,7 @@ class nsIStyleSheetLinkingElement;
class nsCycleCollectionTraversalCallback;
namespace mozilla {
class CSSStyleSheet;
namespace dom {
class Element;
}
@ -222,7 +222,7 @@ public:
* @param aRule the @import rule importing this child. This is used to
* properly order the child sheet list of aParentSheet.
*/
nsresult LoadChildSheet(nsCSSStyleSheet* aParentSheet,
nsresult LoadChildSheet(CSSStyleSheet* aParentSheet,
nsIURI* aURL,
nsMediaList* aMedia,
ImportRule* aRule);
@ -256,12 +256,12 @@ public:
*/
nsresult LoadSheetSync(nsIURI* aURL, bool aEnableUnsafeRules,
bool aUseSystemPrincipal,
nsCSSStyleSheet** aSheet);
CSSStyleSheet** aSheet);
/**
* As above, but aUseSystemPrincipal and aEnableUnsafeRules are assumed false.
*/
nsresult LoadSheetSync(nsIURI* aURL, nsCSSStyleSheet** aSheet) {
nsresult LoadSheetSync(nsIURI* aURL, CSSStyleSheet** aSheet) {
return LoadSheetSync(aURL, false, false, aSheet);
}
@ -289,7 +289,7 @@ public:
nsIPrincipal* aOriginPrincipal,
const nsCString& aCharset,
nsICSSLoaderObserver* aObserver,
nsCSSStyleSheet** aSheet);
CSSStyleSheet** aSheet);
/**
* Same as above, to be used when the caller doesn't care about the
@ -385,7 +385,7 @@ private:
static PLDHashOperator
RemoveEntriesWithURI(URIPrincipalAndCORSModeHashKey* aKey,
nsRefPtr<nsCSSStyleSheet> &aSheet,
nsRefPtr<CSSStyleSheet>& aSheet,
void* aUserData);
// Note: null aSourcePrincipal indicates that the content policy and
@ -408,24 +408,24 @@ private:
const nsAString& aTitle,
StyleSheetState& aSheetState,
bool *aIsAlternate,
nsCSSStyleSheet** aSheet);
CSSStyleSheet** 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(nsCSSStyleSheet* aSheet,
void PrepareSheet(CSSStyleSheet* aSheet,
const nsAString& aTitle,
const nsAString& aMediaString,
nsMediaList* aMediaList,
dom::Element* aScopeElement,
bool isAlternate);
nsresult InsertSheetInDoc(nsCSSStyleSheet* aSheet,
nsresult InsertSheetInDoc(CSSStyleSheet* aSheet,
nsIContent* aLinkingContent,
nsIDocument* aDocument);
nsresult InsertChildSheet(nsCSSStyleSheet* aSheet,
nsCSSStyleSheet* aParentSheet,
nsresult InsertChildSheet(CSSStyleSheet* aSheet,
CSSStyleSheet* aParentSheet,
ImportRule* aParentRule);
nsresult InternalLoadNonDocumentSheet(nsIURI* aURL,
@ -433,7 +433,7 @@ private:
bool aUseSystemPrincipal,
nsIPrincipal* aOriginPrincipal,
const nsCString& aCharset,
nsCSSStyleSheet** aSheet,
CSSStyleSheet** aSheet,
nsICSSLoaderObserver* aObserver,
CORSMode aCORSMode = CORS_NONE);
@ -445,7 +445,7 @@ private:
// sheet was loaded from (may be null for inline sheets). aElement is the
// owning element for this sheet.
nsresult PostLoadEvent(nsIURI* aURI,
nsCSSStyleSheet* aSheet,
CSSStyleSheet* aSheet,
nsICSSLoaderObserver* aObserver,
bool aWasAlternate,
nsIStyleSheetLinkingElement* aElement);
@ -479,7 +479,7 @@ private:
LoadDataArray& aDatasToNotify);
struct Sheets {
nsRefPtrHashtable<URIPrincipalAndCORSModeHashKey, nsCSSStyleSheet>
nsRefPtrHashtable<URIPrincipalAndCORSModeHashKey, CSSStyleSheet>
mCompleteSheets;
nsDataHashtable<URIPrincipalAndCORSModeHashKey, SheetLoadData*>
mLoadingDatas; // weak refs

View File

@ -8,10 +8,10 @@
#ifndef mozilla_css_Rule_h___
#define mozilla_css_Rule_h___
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/MemoryReporting.h"
#include "nsIStyleRule.h"
#include "nsIDOMCSSRule.h"
#include "nsCSSStyleSheet.h"
class nsIStyleSheet;
class nsIDocument;
@ -52,7 +52,7 @@ public:
// The constants in this list must maintain the following invariants:
// If a rule of type N must appear before a rule of type M in stylesheets
// then N < M
// Note that nsCSSStyleSheet::RebuildChildList assumes that no other kinds of
// Note that CSSStyleSheet::RebuildChildList assumes that no other kinds of
// rules can come between two rules of type IMPORT_RULE.
enum {
UNKNOWN_RULE = 0,
@ -73,17 +73,17 @@ public:
virtual int32_t GetType() const = 0;
nsCSSStyleSheet* GetStyleSheet() const;
CSSStyleSheet* GetStyleSheet() const;
nsHTMLCSSStyleSheet* GetHTMLCSSStyleSheet() const;
// Return the document the rule lives in, if any
nsIDocument* GetDocument() const
{
nsCSSStyleSheet* sheet = GetStyleSheet();
CSSStyleSheet* sheet = GetStyleSheet();
return sheet ? sheet->GetDocument() : nullptr;
}
virtual void SetStyleSheet(nsCSSStyleSheet* aSheet);
virtual void SetStyleSheet(CSSStyleSheet* aSheet);
// This does not need to be virtual, because GroupRule and MediaRule are not
// used for inline style.
void SetHTMLCSSStyleSheet(nsHTMLCSSStyleSheet* aSheet);
@ -122,7 +122,7 @@ public:
void* aData);
protected:
// This is either an nsCSSStyleSheet* or a nsHTMLStyleSheet*. The former
// This is either a CSSStyleSheet* or an nsHTMLStyleSheet*. The former
// if the low bit is 0, the latter if the low bit is 1.
uintptr_t mSheet;
GroupRule* mParentRule;

View File

@ -11,10 +11,10 @@
#include "mozilla/css/StyleRule.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/css/GroupRule.h"
#include "mozilla/css/Declaration.h"
#include "nsCSSStyleSheet.h"
#include "nsIDocument.h"
#include "nsIAtom.h"
#include "nsString.h"
@ -541,7 +541,7 @@ int32_t nsCSSSelector::CalcWeight() const
// StyleRule:selectorText
//
void
nsCSSSelector::ToString(nsAString& aString, nsCSSStyleSheet* aSheet,
nsCSSSelector::ToString(nsAString& aString, CSSStyleSheet* aSheet,
bool aAppend) const
{
if (!aAppend)
@ -584,7 +584,7 @@ nsCSSSelector::ToString(nsAString& aString, nsCSSStyleSheet* aSheet,
void
nsCSSSelector::AppendToStringWithoutCombinators
(nsAString& aString, nsCSSStyleSheet* aSheet) const
(nsAString& aString, CSSStyleSheet* aSheet) const
{
AppendToStringWithoutCombinatorsOrNegations(aString, aSheet, false);
@ -599,7 +599,7 @@ nsCSSSelector::AppendToStringWithoutCombinators
void
nsCSSSelector::AppendToStringWithoutCombinatorsOrNegations
(nsAString& aString, nsCSSStyleSheet* aSheet,
(nsAString& aString, CSSStyleSheet* aSheet,
bool aIsNegated) const
{
nsAutoString temp;
@ -895,7 +895,7 @@ nsCSSSelectorList::AddSelector(char16_t aOperator)
}
void
nsCSSSelectorList::ToString(nsAString& aResult, nsCSSStyleSheet* aSheet)
nsCSSSelectorList::ToString(nsAString& aResult, CSSStyleSheet* aSheet)
{
aResult.Truncate();
nsCSSSelectorList *p = this;
@ -1438,7 +1438,7 @@ StyleRule::DeclarationChanged(Declaration* aDecl,
nsRefPtr<StyleRule> clone = new StyleRule(*this, aDecl);
if (aHandleContainer) {
nsCSSStyleSheet* sheet = GetStyleSheet();
CSSStyleSheet* sheet = GetStyleSheet();
if (mParentRule) {
if (sheet) {
sheet->ReplaceRuleInGroup(mParentRule, this, clone);

View File

@ -21,10 +21,13 @@
#include "nsCSSPseudoClasses.h"
class nsIAtom;
class nsCSSStyleSheet;
struct nsCSSSelectorList;
class nsCSSCompressedDataBlock;
namespace mozilla {
class CSSStyleSheet;
} // namespace mozilla
struct nsAtomList {
public:
nsAtomList(nsIAtom* aAtom);
@ -154,7 +157,7 @@ public:
// Calculate the specificity of this selector (not including its mNext!).
int32_t CalcWeight() const;
void ToString(nsAString& aString, nsCSSStyleSheet* aSheet,
void ToString(nsAString& aString, mozilla::CSSStyleSheet* aSheet,
bool aAppend = false) const;
private:
@ -162,9 +165,9 @@ private:
nsCSSSelector* Clone(bool aDeepNext, bool aDeepNegations) const;
void AppendToStringWithoutCombinators(nsAString& aString,
nsCSSStyleSheet* aSheet) const;
mozilla::CSSStyleSheet* aSheet) const;
void AppendToStringWithoutCombinatorsOrNegations(nsAString& aString,
nsCSSStyleSheet* aSheet,
mozilla::CSSStyleSheet* aSheet,
bool aIsNegated)
const;
// Returns true if this selector can have a namespace specified (which
@ -238,7 +241,7 @@ struct nsCSSSelectorList {
/**
* Should be used only on the first in the list
*/
void ToString(nsAString& aResult, nsCSSStyleSheet* aSheet);
void ToString(nsAString& aResult, mozilla::CSSStyleSheet* aSheet);
/**
* Do a deep clone. Should be used only on the first in the list.

View File

@ -29,7 +29,6 @@ EXPORTS += [
'nsCSSPseudoElements.h',
'nsCSSRuleProcessor.h',
'nsCSSScanner.h',
'nsCSSStyleSheet.h',
'nsCSSValue.h',
'nsDOMCSSAttrDeclaration.h',
'nsDOMCSSDeclaration.h',
@ -59,6 +58,7 @@ EXPORTS += [
]
EXPORTS.mozilla += [
'CSSStyleSheet.h',
'CSSVariableDeclarations.h',
'CSSVariableResolver.h',
'CSSVariableValues.h',
@ -88,6 +88,7 @@ UNIFIED_SOURCES += [
'CounterStyleManager.cpp',
'CSS.cpp',
'CSSRuleList.cpp',
'CSSStyleSheet.cpp',
'CSSVariableDeclarations.cpp',
'CSSVariableResolver.cpp',
'CSSVariableValues.cpp',
@ -107,7 +108,6 @@ UNIFIED_SOURCES += [
'nsCSSPseudoElements.cpp',
'nsCSSRules.cpp',
'nsCSSScanner.cpp',
'nsCSSStyleSheet.cpp',
'nsCSSValue.cpp',
'nsDOMCSSAttrDeclaration.cpp',
'nsDOMCSSDeclaration.cpp',

View File

@ -22,7 +22,7 @@
#include "nsCSSRules.h"
#include "mozilla/css/NameSpaceRule.h"
#include "nsTArray.h"
#include "nsCSSStyleSheet.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/css/Declaration.h"
#include "nsStyleConsts.h"
#include "nsNetUtil.h"
@ -102,7 +102,7 @@ public:
CSSParserImpl();
~CSSParserImpl();
nsresult SetStyleSheet(nsCSSStyleSheet* aSheet);
nsresult SetStyleSheet(CSSStyleSheet* aSheet);
nsresult SetQuirkMode(bool aQuirkMode);
@ -279,7 +279,7 @@ public:
nsIURI* aDocURL,
nsIURI* aBaseURL,
nsIPrincipal* aDocPrincipal,
nsCSSStyleSheet* aSheet,
CSSStyleSheet* aSheet,
uint32_t aLineNumber,
uint32_t aLineOffset);
@ -971,7 +971,7 @@ protected:
nsCOMPtr<nsIPrincipal> mSheetPrincipal;
// The sheet we're parsing into
nsRefPtr<nsCSSStyleSheet> mSheet;
nsRefPtr<CSSStyleSheet> mSheet;
// Used for @import rules
mozilla::css::Loader* mChildLoader; // not ref counted, it owns us
@ -979,7 +979,7 @@ protected:
// Sheet section we're in. This is used to enforce correct ordering of the
// various rule types (eg the fact that a @charset rule must come before
// anything else). Note that there are checks of similar things in various
// places in nsCSSStyleSheet.cpp (e.g in insertRule, RebuildChildList).
// places in CSSStyleSheet.cpp (e.g in insertRule, RebuildChildList).
enum nsCSSSection {
eCSSSection_Charset,
eCSSSection_Import,
@ -1124,7 +1124,7 @@ CSSParserImpl::~CSSParserImpl()
}
nsresult
CSSParserImpl::SetStyleSheet(nsCSSStyleSheet* aSheet)
CSSParserImpl::SetStyleSheet(CSSStyleSheet* aSheet)
{
if (aSheet != mSheet) {
// Switch to using the new sheet, if any
@ -2313,7 +2313,7 @@ CSSParserImpl::ParsePropertyWithVariableReferences(
nsIURI* aDocURL,
nsIURI* aBaseURL,
nsIPrincipal* aDocPrincipal,
nsCSSStyleSheet* aSheet,
CSSStyleSheet* aSheet,
uint32_t aLineNumber,
uint32_t aLineOffset)
{
@ -14505,7 +14505,7 @@ CSSParserImpl::ParseValueWithVariables(CSSVariableDeclarations::Type* aType,
static CSSParserImpl* gFreeList = nullptr;
nsCSSParser::nsCSSParser(mozilla::css::Loader* aLoader,
nsCSSStyleSheet* aSheet)
CSSStyleSheet* aSheet)
{
CSSParserImpl *impl = gFreeList;
if (impl) {
@ -14551,7 +14551,7 @@ nsCSSParser::Shutdown()
// Wrapper methods
nsresult
nsCSSParser::SetStyleSheet(nsCSSStyleSheet* aSheet)
nsCSSParser::SetStyleSheet(CSSStyleSheet* aSheet)
{
return static_cast<CSSParserImpl*>(mImpl)->
SetStyleSheet(aSheet);
@ -14766,7 +14766,7 @@ nsCSSParser::ParsePropertyWithVariableReferences(
nsIURI* aDocURL,
nsIURI* aBaseURL,
nsIPrincipal* aDocPrincipal,
nsCSSStyleSheet* aSheet,
CSSStyleSheet* aSheet,
uint32_t aLineNumber,
uint32_t aLineOffset)
{

View File

@ -16,7 +16,6 @@
#include "nsStringFwd.h"
#include "nsTArrayForwardDeclare.h"
class nsCSSStyleSheet;
class nsIPrincipal;
class nsIURI;
struct nsCSSSelectorList;
@ -26,6 +25,7 @@ class nsCSSValue;
struct nsRuleData;
namespace mozilla {
class CSSStyleSheet;
class CSSVariableValues;
namespace css {
class Rule;
@ -40,7 +40,7 @@ class StyleRule;
class MOZ_STACK_CLASS nsCSSParser {
public:
nsCSSParser(mozilla::css::Loader* aLoader = nullptr,
nsCSSStyleSheet* aSheet = nullptr);
mozilla::CSSStyleSheet* aSheet = nullptr);
~nsCSSParser();
static void Shutdown();
@ -51,9 +51,9 @@ private:
public:
// Set a style sheet for the parser to fill in. The style sheet must
// implement the nsCSSStyleSheet interface. Null can be passed in to clear
// implement the CSSStyleSheet interface. Null can be passed in to clear
// out an existing stylesheet reference.
nsresult SetStyleSheet(nsCSSStyleSheet* aSheet);
nsresult SetStyleSheet(mozilla::CSSStyleSheet* aSheet);
// Set whether or not to emulate Nav quirks
nsresult SetQuirkMode(bool aQuirkMode);
@ -260,7 +260,7 @@ public:
nsIURI* aDocURL,
nsIURI* aBaseURL,
nsIPrincipal* aDocPrincipal,
nsCSSStyleSheet* aSheet,
mozilla::CSSStyleSheet* aSheet,
uint32_t aLineNumber,
uint32_t aLineOffset);

View File

@ -562,7 +562,7 @@ RuleHash::~RuleHash()
uint32_t lineNumber = value->mRule->GetLineNumber();
nsCOMPtr<nsIStyleSheet> sheet;
value->mRule->GetStyleSheet(*getter_AddRefs(sheet));
nsRefPtr<nsCSSStyleSheet> cssSheet = do_QueryObject(sheet);
nsRefPtr<CSSStyleSheet> cssSheet = do_QueryObject(sheet);
value->mSelector->ToString(selectorText, cssSheet);
printf(" line %d, %s\n",
@ -3399,12 +3399,12 @@ CascadeRuleEnumFunc(css::Rule* aRule, void* aData)
}
/* static */ bool
nsCSSRuleProcessor::CascadeSheet(nsCSSStyleSheet* aSheet, CascadeEnumData* aData)
nsCSSRuleProcessor::CascadeSheet(CSSStyleSheet* aSheet, CascadeEnumData* aData)
{
if (aSheet->IsApplicable() &&
aSheet->UseForPresentation(aData->mPresContext, aData->mCacheKey) &&
aSheet->mInner) {
nsCSSStyleSheet* child = aSheet->mInner->mFirstChild;
CSSStyleSheet* child = aSheet->mInner->mFirstChild;
while (child) {
CascadeSheet(child, aData);
child = child->mNext;

View File

@ -28,9 +28,12 @@ struct TreeMatchContext;
class nsCSSKeyframesRule;
class nsCSSPageRule;
class nsCSSFontFeatureValuesRule;
class nsCSSStyleSheet;
class nsCSSCounterStyleRule;
namespace mozilla {
class CSSStyleSheet;
} // namespace mozilla
/**
* The CSS style rule processor provides a mechanism for sibling style
* sheets to combine their rule processing in order to allow proper
@ -44,7 +47,7 @@ class nsCSSCounterStyleRule;
class nsCSSRuleProcessor: public nsIStyleRuleProcessor {
public:
typedef nsTArray<nsRefPtr<nsCSSStyleSheet> > sheet_array_type;
typedef nsTArray<nsRefPtr<mozilla::CSSStyleSheet>> sheet_array_type;
// aScopeElement must be non-null iff aSheetType is
// nsStyleSet::eScopedDocSheet.
@ -173,7 +176,8 @@ public:
};
private:
static bool CascadeSheet(nsCSSStyleSheet* aSheet, CascadeEnumData* aData);
static bool CascadeSheet(mozilla::CSSStyleSheet* aSheet,
CascadeEnumData* aData);
RuleCascadeData* GetRuleCascade(nsPresContext* aPresContext);
void RefreshRuleCascade(nsPresContext* aPresContext);

View File

@ -9,6 +9,7 @@
#include "nsCSSRules.h"
#include "nsCSSValue.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/css/ImportRule.h"
#include "mozilla/css/NameSpaceRule.h"
@ -17,7 +18,6 @@
#include "nsIAtom.h"
#include "nsCSSProps.h"
#include "nsCSSStyleSheet.h"
#include "nsCOMPtr.h"
#include "nsIDOMCSSStyleSheet.h"
@ -59,11 +59,11 @@ IMPL_STYLE_RULE_INHERIT_MAP_RULE_INFO_INTO(class_, super_)
namespace mozilla {
namespace css {
nsCSSStyleSheet*
CSSStyleSheet*
Rule::GetStyleSheet() const
{
if (!(mSheet & 0x1)) {
return reinterpret_cast<nsCSSStyleSheet*>(mSheet);
return reinterpret_cast<CSSStyleSheet*>(mSheet);
}
return nullptr;
@ -80,7 +80,7 @@ Rule::GetHTMLCSSStyleSheet() const
}
/* virtual */ void
Rule::SetStyleSheet(nsCSSStyleSheet* aSheet)
Rule::SetStyleSheet(CSSStyleSheet* aSheet)
{
// We don't reference count this up reference. The style sheet
// will tell us when it's going away or when we're detached from
@ -135,7 +135,7 @@ class GroupRuleRuleList MOZ_FINAL : public dom::CSSRuleList
public:
GroupRuleRuleList(GroupRule *aGroupRule);
virtual nsCSSStyleSheet* GetParentObject() MOZ_OVERRIDE;
virtual CSSStyleSheet* GetParentObject() MOZ_OVERRIDE;
virtual nsIDOMCSSRule*
IndexedGetter(uint32_t aIndex, bool& aFound) MOZ_OVERRIDE;
@ -162,7 +162,7 @@ GroupRuleRuleList::~GroupRuleRuleList()
{
}
nsCSSStyleSheet*
CSSStyleSheet*
GroupRuleRuleList::GetParentObject()
{
if (!mGroupRule) {
@ -343,7 +343,7 @@ ImportRule::ImportRule(const ImportRule& aCopy)
// property of that @import rule, since it is null only if the target
// sheet failed security checks.
if (aCopy.mChildSheet) {
nsRefPtr<nsCSSStyleSheet> sheet =
nsRefPtr<CSSStyleSheet> sheet =
aCopy.mChildSheet->Clone(nullptr, this, nullptr, nullptr);
SetSheet(sheet);
// SetSheet sets mMedia appropriately
@ -403,7 +403,7 @@ ImportRule::Clone() const
}
void
ImportRule::SetSheet(nsCSSStyleSheet* aSheet)
ImportRule::SetSheet(CSSStyleSheet* aSheet)
{
NS_PRECONDITION(aSheet, "null arg");
@ -494,8 +494,8 @@ ImportRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
// - mURLSpec
//
// The following members are not measured:
// - mMedia, because it is measured via nsCSSStyleSheet::mMedia
// - mChildSheet, because it is measured via nsCSSStyleSheetInner::mSheets
// - mMedia, because it is measured via CSSStyleSheet::mMedia
// - mChildSheet, because it is measured via CSSStyleSheetInner::mSheets
}
} // namespace css
@ -547,7 +547,7 @@ IMPL_STYLE_RULE_INHERIT_MAP_RULE_INFO_INTO(GroupRule, Rule)
static bool
SetStyleSheetReference(Rule* aRule, void* aSheet)
{
nsCSSStyleSheet* sheet = (nsCSSStyleSheet*)aSheet;
CSSStyleSheet* sheet = (CSSStyleSheet*)aSheet;
aRule->SetStyleSheet(sheet);
return true;
}
@ -582,7 +582,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(GroupRule)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
/* virtual */ void
GroupRule::SetStyleSheet(nsCSSStyleSheet* aSheet)
GroupRule::SetStyleSheet(CSSStyleSheet* aSheet)
{
// Don't set the sheet on the kids if it's already the same as the sheet we
// already have. This is needed to avoid O(N^2) behavior in group nesting
@ -613,7 +613,7 @@ void
GroupRule::AppendStyleRule(Rule* aRule)
{
mRules.AppendObject(aRule);
nsCSSStyleSheet* sheet = GetStyleSheet();
CSSStyleSheet* sheet = GetStyleSheet();
aRule->SetStyleSheet(sheet);
aRule->SetParentRule(this);
if (sheet) {
@ -711,7 +711,7 @@ GroupRule::GetCssRules(nsIDOMCSSRuleList* *aRuleList)
nsresult
GroupRule::InsertRule(const nsAString & aRule, uint32_t aIndex, uint32_t* _retval)
{
nsCSSStyleSheet* sheet = GetStyleSheet();
CSSStyleSheet* sheet = GetStyleSheet();
NS_ENSURE_TRUE(sheet, NS_ERROR_FAILURE);
if (aIndex > uint32_t(mRules.Count()))
@ -726,7 +726,7 @@ GroupRule::InsertRule(const nsAString & aRule, uint32_t aIndex, uint32_t* _retva
nsresult
GroupRule::DeleteRule(uint32_t aIndex)
{
nsCSSStyleSheet* sheet = GetStyleSheet();
CSSStyleSheet* sheet = GetStyleSheet();
NS_ENSURE_TRUE(sheet, NS_ERROR_FAILURE);
if (aIndex >= uint32_t(mRules.Count()))
@ -789,7 +789,7 @@ NS_INTERFACE_MAP_BEGIN(MediaRule)
NS_INTERFACE_MAP_END_INHERITING(GroupRule)
/* virtual */ void
MediaRule::SetStyleSheet(nsCSSStyleSheet* aSheet)
MediaRule::SetStyleSheet(CSSStyleSheet* aSheet)
{
if (mMedia) {
// Set to null so it knows it's leaving one sheet and joining another.
@ -2367,7 +2367,7 @@ nsCSSKeyframeRule::SetKeyText(const nsAString& aKeyText)
newSelectors.SwapElements(mKeys);
nsCSSStyleSheet* sheet = GetStyleSheet();
CSSStyleSheet* sheet = GetStyleSheet();
if (sheet) {
sheet->SetModifiedByChildRule();
@ -2404,7 +2404,7 @@ nsCSSKeyframeRule::ChangeDeclaration(css::Declaration* aDeclaration)
mDeclaration = aDeclaration;
}
nsCSSStyleSheet* sheet = GetStyleSheet();
CSSStyleSheet* sheet = GetStyleSheet();
if (sheet) {
sheet->SetModifiedByChildRule();
@ -2543,7 +2543,7 @@ nsCSSKeyframesRule::SetName(const nsAString& aName)
mName = aName;
nsCSSStyleSheet* sheet = GetStyleSheet();
CSSStyleSheet* sheet = GetStyleSheet();
if (sheet) {
sheet->SetModifiedByChildRule();
@ -2578,7 +2578,7 @@ nsCSSKeyframesRule::AppendRule(const nsAString& aRule)
AppendStyleRule(rule);
nsCSSStyleSheet* sheet = GetStyleSheet();
CSSStyleSheet* sheet = GetStyleSheet();
if (sheet) {
sheet->SetModifiedByChildRule();
@ -2626,7 +2626,7 @@ nsCSSKeyframesRule::DeleteRule(const nsAString& aKey)
mRules.RemoveObjectAt(index);
nsCSSStyleSheet* sheet = GetStyleSheet();
CSSStyleSheet* sheet = GetStyleSheet();
if (sheet) {
sheet->SetModifiedByChildRule();
@ -2887,7 +2887,7 @@ nsCSSPageRule::ChangeDeclaration(css::Declaration* aDeclaration)
mDeclaration = aDeclaration;
}
nsCSSStyleSheet* sheet = GetStyleSheet();
CSSStyleSheet* sheet = GetStyleSheet();
if (sheet) {
sheet->SetModifiedByChildRule();
}
@ -3181,7 +3181,7 @@ nsCSSCounterStyleRule::SetName(const nsAString& aName)
mName = name;
nsCSSStyleSheet* sheet = GetStyleSheet();
CSSStyleSheet* sheet = GetStyleSheet();
if (sheet) {
sheet->SetModifiedByChildRule();
if (doc) {
@ -3227,7 +3227,7 @@ nsCSSCounterStyleRule::SetDesc(nsCSSCounterDesc aDescID, const nsCSSValue& aValu
mValues[aDescID] = aValue;
mGeneration++;
nsCSSStyleSheet* sheet = GetStyleSheet();
CSSStyleSheet* sheet = GetStyleSheet();
if (sheet) {
sheet->SetModifiedByChildRule();
if (doc) {
@ -3457,7 +3457,7 @@ nsCSSCounterStyleRule::SetDescriptor(nsCSSCounterDesc aDescID,
{
nsCSSParser parser;
nsCSSValue value;
nsCSSStyleSheet* sheet = GetStyleSheet();
CSSStyleSheet* sheet = GetStyleSheet();
nsIURI* baseURL = nullptr;
nsIPrincipal* principal = nullptr;
if (sheet) {

View File

@ -61,7 +61,7 @@ public:
#endif
// Rule methods
virtual void SetStyleSheet(nsCSSStyleSheet* aSheet); //override GroupRule
virtual void SetStyleSheet(mozilla::CSSStyleSheet* aSheet); //override GroupRule
virtual int32_t GetType() const;
virtual already_AddRefed<Rule> Clone() const;
virtual nsIDOMCSSRule* GetDOMRule()

View File

@ -8,6 +8,7 @@
#include "nsCSSValue.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/Likely.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/css/ImageLoader.h"
@ -18,7 +19,6 @@
#include "nsIDocument.h"
#include "nsIPrincipal.h"
#include "nsCSSProps.h"
#include "nsCSSStyleSheet.h"
#include "nsNetUtil.h"
#include "nsPresContext.h"
#include "nsStyleUtil.h"

View File

@ -26,7 +26,6 @@
#include "gfxFontFamilyList.h"
class imgRequestProxy;
class nsCSSStyleSheet;
class nsIDocument;
class nsIPrincipal;
class nsIURI;
@ -34,6 +33,10 @@ class nsPresContext;
template <class T>
class nsPtrHashKey;
namespace mozilla {
class CSSStyleSheet;
} // namespace mozilla
// Deletes a linked list iteratively to avoid blowing up the stack (bug 456196).
#define NS_CSS_DELETE_LIST_MEMBER(type_, ptr_, member_) \
{ \
@ -1456,7 +1459,7 @@ public:
nsCOMPtr<nsIURI> mBaseURI;
nsCOMPtr<nsIURI> mSheetURI;
nsCOMPtr<nsIPrincipal> mSheetPrincipal;
nsCSSStyleSheet* mSheet;
mozilla::CSSStyleSheet* mSheet;
uint32_t mLineNumber;
uint32_t mLineOffset;

View File

@ -8,7 +8,7 @@
#include "nsDOMCSSDeclaration.h"
#include "nsCSSParser.h"
#include "nsCSSStyleSheet.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/css/Rule.h"
#include "mozilla/css/Declaration.h"
#include "mozilla/dom/CSS2PropertiesBinding.h"
@ -292,7 +292,7 @@ nsDOMCSSDeclaration::GetCSSParsingEnvironmentForRule(css::Rule* aRule,
CSSParsingEnvironment& aCSSParseEnv)
{
nsIStyleSheet* sheet = aRule ? aRule->GetStyleSheet() : nullptr;
nsRefPtr<nsCSSStyleSheet> cssSheet(do_QueryObject(sheet));
nsRefPtr<CSSStyleSheet> cssSheet(do_QueryObject(sheet));
if (!cssSheet) {
aCSSParseEnv.mPrincipal = nullptr;
return;

View File

@ -14,7 +14,9 @@
{ 0x7eb90c74, 0xea0c, 0x4df5, \
{0xa1, 0x5f, 0x95, 0xf0, 0x6a, 0x98, 0xb9, 0x40} }
class nsCSSStyleSheet;
namespace mozilla {
class CSSStyleSheet;
} // namespace mozilla
class nsICSSLoaderObserver : public nsISupports {
public:
@ -35,7 +37,8 @@ public:
* as CSS, and doesn't indicate anything about the status of any child
* sheets of aSheet.
*/
NS_IMETHOD StyleSheetLoaded(nsCSSStyleSheet* aSheet, bool aWasAlternate,
NS_IMETHOD StyleSheetLoaded(mozilla::CSSStyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus) = 0;
};

View File

@ -21,10 +21,13 @@
#include "mozilla/ErrorResult.h"
class nsPresContext;
class nsCSSStyleSheet;
class nsAString;
struct nsMediaFeature;
namespace mozilla {
class CSSStyleSheet;
} // namespace mozilla
struct nsMediaExpression {
enum Range { eMin, eMax, eEqual };
@ -173,7 +176,7 @@ public:
bool Matches(nsPresContext* aPresContext,
nsMediaQueryResultCacheKey* aKey);
nsresult SetStyleSheet(nsCSSStyleSheet* aSheet);
nsresult SetStyleSheet(mozilla::CSSStyleSheet* aSheet);
void AppendQuery(nsAutoPtr<nsMediaQuery>& aQuery) {
// Takes ownership of aQuery
mArray.AppendElement(aQuery.forget());
@ -208,6 +211,6 @@ protected:
// not refcounted; sheet will let us know when it goes away
// mStyleSheet is the sheet that needs to be dirtied when this medialist
// changes
nsCSSStyleSheet* mStyleSheet;
mozilla::CSSStyleSheet* mStyleSheet;
};
#endif /* !defined(nsIMediaList_h_) */

View File

@ -30,7 +30,7 @@ class nsIDocument;
* rules. Those style rules can be reached in one of two ways, depending
* on which level of the nsStyleSet it is in:
* 1) It can be |QueryInterface|d to nsIStyleRuleProcessor
* 2) It can be |QueryInterface|d to nsCSSStyleSheet, with which the
* 2) It can be |QueryInterface|d to CSSStyleSheet, with which the
* |nsStyleSet| uses an |nsCSSRuleProcessor| to access the rules.
*/
class nsIStyleSheet : public nsISupports {

View File

@ -7,6 +7,7 @@
#include "nsLayoutStylesheetCache.h"
#include "nsAppDirectoryServiceDefs.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/Preferences.h"
#include "mozilla/css/Loader.h"
@ -15,7 +16,6 @@
#include "nsIObserverService.h"
#include "nsServiceManagerUtils.h"
#include "nsIXULRuntime.h"
#include "nsCSSStyleSheet.h"
using namespace mozilla;
@ -50,7 +50,7 @@ nsLayoutStylesheetCache::Observe(nsISupports* aSubject,
return NS_OK;
}
nsCSSStyleSheet*
CSSStyleSheet*
nsLayoutStylesheetCache::ScrollbarsSheet()
{
EnsureGlobal();
@ -71,7 +71,7 @@ nsLayoutStylesheetCache::ScrollbarsSheet()
return gStyleCache->mScrollbarsSheet;
}
nsCSSStyleSheet*
CSSStyleSheet*
nsLayoutStylesheetCache::FormsSheet()
{
EnsureGlobal();
@ -93,7 +93,7 @@ nsLayoutStylesheetCache::FormsSheet()
return gStyleCache->mFormsSheet;
}
nsCSSStyleSheet*
CSSStyleSheet*
nsLayoutStylesheetCache::NumberControlSheet()
{
EnsureGlobal();
@ -118,7 +118,7 @@ nsLayoutStylesheetCache::NumberControlSheet()
return gStyleCache->mNumberControlSheet;
}
nsCSSStyleSheet*
CSSStyleSheet*
nsLayoutStylesheetCache::UserContentSheet()
{
EnsureGlobal();
@ -128,7 +128,7 @@ nsLayoutStylesheetCache::UserContentSheet()
return gStyleCache->mUserContentSheet;
}
nsCSSStyleSheet*
CSSStyleSheet*
nsLayoutStylesheetCache::UserChromeSheet()
{
EnsureGlobal();
@ -138,7 +138,7 @@ nsLayoutStylesheetCache::UserChromeSheet()
return gStyleCache->mUserChromeSheet;
}
nsCSSStyleSheet*
CSSStyleSheet*
nsLayoutStylesheetCache::UASheet()
{
EnsureGlobal();
@ -148,7 +148,7 @@ nsLayoutStylesheetCache::UASheet()
return gStyleCache->mUASheet;
}
nsCSSStyleSheet*
CSSStyleSheet*
nsLayoutStylesheetCache::HTMLSheet()
{
EnsureGlobal();
@ -158,7 +158,7 @@ nsLayoutStylesheetCache::HTMLSheet()
return gStyleCache->mHTMLSheet;
}
nsCSSStyleSheet*
CSSStyleSheet*
nsLayoutStylesheetCache::MinimalXULSheet()
{
EnsureGlobal();
@ -168,7 +168,7 @@ nsLayoutStylesheetCache::MinimalXULSheet()
return gStyleCache->mMinimalXULSheet;
}
nsCSSStyleSheet*
CSSStyleSheet*
nsLayoutStylesheetCache::XULSheet()
{
EnsureGlobal();
@ -178,7 +178,7 @@ nsLayoutStylesheetCache::XULSheet()
return gStyleCache->mXULSheet;
}
nsCSSStyleSheet*
CSSStyleSheet*
nsLayoutStylesheetCache::QuirkSheet()
{
EnsureGlobal();
@ -188,7 +188,7 @@ nsLayoutStylesheetCache::QuirkSheet()
return gStyleCache->mQuirkSheet;
}
nsCSSStyleSheet*
CSSStyleSheet*
nsLayoutStylesheetCache::FullScreenOverrideSheet()
{
EnsureGlobal();
@ -198,7 +198,7 @@ nsLayoutStylesheetCache::FullScreenOverrideSheet()
return gStyleCache->mFullScreenOverrideSheet;
}
nsCSSStyleSheet*
CSSStyleSheet*
nsLayoutStylesheetCache::SVGSheet()
{
EnsureGlobal();
@ -208,7 +208,7 @@ nsLayoutStylesheetCache::SVGSheet()
return gStyleCache->mSVGSheet;
}
nsCSSStyleSheet*
CSSStyleSheet*
nsLayoutStylesheetCache::MathMLSheet()
{
EnsureGlobal();
@ -227,7 +227,7 @@ nsLayoutStylesheetCache::MathMLSheet()
return gStyleCache->mMathMLSheet;
}
nsCSSStyleSheet*
CSSStyleSheet*
nsLayoutStylesheetCache::CounterStylesSheet()
{
EnsureGlobal();
@ -417,7 +417,7 @@ nsLayoutStylesheetCache::InitFromProfile()
}
void
nsLayoutStylesheetCache::LoadSheetFile(nsIFile* aFile, nsRefPtr<nsCSSStyleSheet> &aSheet)
nsLayoutStylesheetCache::LoadSheetFile(nsIFile* aFile, nsRefPtr<CSSStyleSheet>& aSheet)
{
bool exists = false;
aFile->Exists(&exists);
@ -432,7 +432,7 @@ nsLayoutStylesheetCache::LoadSheetFile(nsIFile* aFile, nsRefPtr<nsCSSStyleSheet>
void
nsLayoutStylesheetCache::LoadSheet(nsIURI* aURI,
nsRefPtr<nsCSSStyleSheet> &aSheet,
nsRefPtr<CSSStyleSheet>& aSheet,
bool aEnableUnsafeRules)
{
if (!aURI) {

View File

@ -13,11 +13,11 @@
#include "mozilla/Attributes.h"
#include "mozilla/MemoryReporting.h"
class nsCSSStyleSheet;
class nsIFile;
class nsIURI;
namespace mozilla {
class CSSStyleSheet;
namespace css {
class Loader;
}
@ -31,22 +31,22 @@ class nsLayoutStylesheetCache MOZ_FINAL
NS_DECL_NSIOBSERVER
NS_DECL_NSIMEMORYREPORTER
static nsCSSStyleSheet* ScrollbarsSheet();
static nsCSSStyleSheet* FormsSheet();
static mozilla::CSSStyleSheet* ScrollbarsSheet();
static mozilla::CSSStyleSheet* FormsSheet();
// This function is expected to return nullptr when the dom.forms.number
// pref is disabled.
static nsCSSStyleSheet* NumberControlSheet();
static nsCSSStyleSheet* UserContentSheet();
static nsCSSStyleSheet* UserChromeSheet();
static nsCSSStyleSheet* UASheet();
static nsCSSStyleSheet* HTMLSheet();
static nsCSSStyleSheet* MinimalXULSheet();
static nsCSSStyleSheet* XULSheet();
static nsCSSStyleSheet* QuirkSheet();
static nsCSSStyleSheet* FullScreenOverrideSheet();
static nsCSSStyleSheet* SVGSheet();
static nsCSSStyleSheet* MathMLSheet();
static nsCSSStyleSheet* CounterStylesSheet();
static mozilla::CSSStyleSheet* NumberControlSheet();
static mozilla::CSSStyleSheet* UserContentSheet();
static mozilla::CSSStyleSheet* UserChromeSheet();
static mozilla::CSSStyleSheet* UASheet();
static mozilla::CSSStyleSheet* HTMLSheet();
static mozilla::CSSStyleSheet* MinimalXULSheet();
static mozilla::CSSStyleSheet* XULSheet();
static mozilla::CSSStyleSheet* QuirkSheet();
static mozilla::CSSStyleSheet* FullScreenOverrideSheet();
static mozilla::CSSStyleSheet* SVGSheet();
static mozilla::CSSStyleSheet* MathMLSheet();
static mozilla::CSSStyleSheet* CounterStylesSheet();
static void Shutdown();
@ -59,26 +59,27 @@ private:
static void EnsureGlobal();
void InitFromProfile();
void InitMemoryReporter();
static void LoadSheetFile(nsIFile* aFile, nsRefPtr<nsCSSStyleSheet> &aSheet);
static void LoadSheet(nsIURI* aURI, nsRefPtr<nsCSSStyleSheet> &aSheet,
static void LoadSheetFile(nsIFile* aFile,
nsRefPtr<mozilla::CSSStyleSheet>& aSheet);
static void LoadSheet(nsIURI* aURI, nsRefPtr<mozilla::CSSStyleSheet>& aSheet,
bool aEnableUnsafeRules);
static nsLayoutStylesheetCache* gStyleCache;
static mozilla::css::Loader* gCSSLoader;
nsRefPtr<nsCSSStyleSheet> mScrollbarsSheet;
nsRefPtr<nsCSSStyleSheet> mFormsSheet;
nsRefPtr<nsCSSStyleSheet> mNumberControlSheet;
nsRefPtr<nsCSSStyleSheet> mUserContentSheet;
nsRefPtr<nsCSSStyleSheet> mUserChromeSheet;
nsRefPtr<nsCSSStyleSheet> mUASheet;
nsRefPtr<nsCSSStyleSheet> mHTMLSheet;
nsRefPtr<nsCSSStyleSheet> mMinimalXULSheet;
nsRefPtr<nsCSSStyleSheet> mXULSheet;
nsRefPtr<nsCSSStyleSheet> mQuirkSheet;
nsRefPtr<nsCSSStyleSheet> mFullScreenOverrideSheet;
nsRefPtr<nsCSSStyleSheet> mSVGSheet;
nsRefPtr<nsCSSStyleSheet> mMathMLSheet;
nsRefPtr<nsCSSStyleSheet> mCounterStylesSheet;
nsRefPtr<mozilla::CSSStyleSheet> mScrollbarsSheet;
nsRefPtr<mozilla::CSSStyleSheet> mFormsSheet;
nsRefPtr<mozilla::CSSStyleSheet> mNumberControlSheet;
nsRefPtr<mozilla::CSSStyleSheet> mUserContentSheet;
nsRefPtr<mozilla::CSSStyleSheet> mUserChromeSheet;
nsRefPtr<mozilla::CSSStyleSheet> mUASheet;
nsRefPtr<mozilla::CSSStyleSheet> mHTMLSheet;
nsRefPtr<mozilla::CSSStyleSheet> mMinimalXULSheet;
nsRefPtr<mozilla::CSSStyleSheet> mXULSheet;
nsRefPtr<mozilla::CSSStyleSheet> mQuirkSheet;
nsRefPtr<mozilla::CSSStyleSheet> mFullScreenOverrideSheet;
nsRefPtr<mozilla::CSSStyleSheet> mSVGSheet;
nsRefPtr<mozilla::CSSStyleSheet> mMathMLSheet;
nsRefPtr<mozilla::CSSStyleSheet> mCounterStylesSheet;
};
#endif

View File

@ -9,12 +9,12 @@
* potentially re-creating) style contexts
*/
#include "nsStyleSet.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/EventStates.h"
#include "mozilla/MemoryReporting.h"
#include "nsStyleSet.h"
#include "nsCSSStyleSheet.h"
#include "nsIDocumentInlines.h"
#include "nsRuleWalker.h"
#include "nsStyleContext.h"
@ -282,7 +282,7 @@ GetScopeDepth(nsINode* aScopeElement, ScopeDepthCache& aCache)
struct ScopedSheetOrder
{
nsCSSStyleSheet* mSheet;
CSSStyleSheet* mSheet;
uint32_t mDepth;
uint32_t mOrder;
@ -305,7 +305,7 @@ struct ScopedSheetOrder
// before those for descendant scopes, and with sheets for a single
// scope in document order.
static void
SortStyleSheetsByScope(nsTArray<nsCSSStyleSheet*>& aSheets)
SortStyleSheetsByScope(nsTArray<CSSStyleSheet*>& aSheets)
{
uint32_t n = aSheets.Length();
if (n == 1) {
@ -382,11 +382,11 @@ nsStyleSet::GatherRuleProcessors(sheetType aType)
uint32_t count = mSheets[eScopedDocSheet].Count();
if (count) {
// Gather the scoped style sheets into an array as
// nsCSSStyleSheets, and mark all of their scope elements
// CSSStyleSheets, and mark all of their scope elements
// as scoped style roots.
nsTArray<nsCSSStyleSheet*> sheets(count);
nsTArray<CSSStyleSheet*> sheets(count);
for (uint32_t i = 0; i < count; i++) {
nsRefPtr<nsCSSStyleSheet> sheet =
nsRefPtr<CSSStyleSheet> sheet =
do_QueryObject(mSheets[eScopedDocSheet].ObjectAt(i));
sheets.AppendElement(sheet);
@ -410,7 +410,7 @@ nsStyleSet::GatherRuleProcessors(sheetType aType)
scope->SetIsScopedStyleRoot();
// Create a rule processor for the scope.
nsTArray< nsRefPtr<nsCSSStyleSheet> > sheetsForScope;
nsTArray<nsRefPtr<CSSStyleSheet>> sheetsForScope;
sheetsForScope.AppendElements(sheets.Elements() + start, end - start);
mScopedDocSheetRuleProcessors.AppendElement
(new nsCSSRuleProcessor(sheetsForScope, uint8_t(aType), scope));
@ -428,9 +428,9 @@ nsStyleSet::GatherRuleProcessors(sheetType aType)
case eOverrideSheet: {
// levels containing CSS stylesheets (apart from eScopedDocSheet)
nsCOMArray<nsIStyleSheet>& sheets = mSheets[aType];
nsTArray<nsRefPtr<nsCSSStyleSheet> > cssSheets(sheets.Count());
nsTArray<nsRefPtr<CSSStyleSheet>> cssSheets(sheets.Count());
for (int32_t i = 0, i_end = sheets.Count(); i < i_end; ++i) {
nsRefPtr<nsCSSStyleSheet> cssSheet = do_QueryObject(sheets[i]);
nsRefPtr<CSSStyleSheet> cssSheet = do_QueryObject(sheets[i]);
NS_ASSERTION(cssSheet, "not a CSS sheet");
cssSheets.AppendElement(cssSheet);
}
@ -452,8 +452,8 @@ nsStyleSet::GatherRuleProcessors(sheetType aType)
static bool
IsScopedStyleSheet(nsIStyleSheet* aSheet)
{
nsRefPtr<nsCSSStyleSheet> cssSheet = do_QueryObject(aSheet);
NS_ASSERTION(cssSheet, "expected aSheet to be an nsCSSStyleSheet");
nsRefPtr<CSSStyleSheet> cssSheet = do_QueryObject(aSheet);
NS_ASSERTION(cssSheet, "expected aSheet to be a CSSStyleSheet");
return cssSheet->GetScopeElement();
}
@ -602,7 +602,7 @@ nsStyleSet::AddDocStyleSheet(nsIStyleSheet* aSheet, nsIDocument* aDocument)
nsresult
nsStyleSet::RemoveDocStyleSheet(nsIStyleSheet *aSheet)
{
nsRefPtr<nsCSSStyleSheet> cssSheet = do_QueryObject(aSheet);
nsRefPtr<CSSStyleSheet> cssSheet = do_QueryObject(aSheet);
bool isScoped = cssSheet && cssSheet->GetScopeElement();
return RemoveStyleSheet(isScoped ? eScopedDocSheet : eDocSheet, aSheet);
}
@ -2065,14 +2065,14 @@ nsStyleSet::MediumFeaturesChanged(nsPresContext* aPresContext)
return stylesChanged;
}
nsCSSStyleSheet::EnsureUniqueInnerResult
CSSStyleSheet::EnsureUniqueInnerResult
nsStyleSet::EnsureUniqueInnerOnCSSSheets()
{
nsAutoTArray<nsCSSStyleSheet*, 32> queue;
nsAutoTArray<CSSStyleSheet*, 32> queue;
for (uint32_t i = 0; i < ArrayLength(gCSSSheetTypes); ++i) {
nsCOMArray<nsIStyleSheet> &sheets = mSheets[gCSSSheetTypes[i]];
for (uint32_t j = 0, j_end = sheets.Count(); j < j_end; ++j) {
nsCSSStyleSheet *sheet = static_cast<nsCSSStyleSheet*>(sheets[j]);
CSSStyleSheet* sheet = static_cast<CSSStyleSheet*>(sheets[j]);
queue.AppendElement(sheet);
}
}
@ -2081,16 +2081,16 @@ nsStyleSet::EnsureUniqueInnerOnCSSSheets()
mBindingManager->AppendAllSheets(queue);
}
nsCSSStyleSheet::EnsureUniqueInnerResult res =
nsCSSStyleSheet::eUniqueInner_AlreadyUnique;
CSSStyleSheet::EnsureUniqueInnerResult res =
CSSStyleSheet::eUniqueInner_AlreadyUnique;
while (!queue.IsEmpty()) {
uint32_t idx = queue.Length() - 1;
nsCSSStyleSheet *sheet = queue[idx];
CSSStyleSheet* sheet = queue[idx];
queue.RemoveElementAt(idx);
nsCSSStyleSheet::EnsureUniqueInnerResult sheetRes =
CSSStyleSheet::EnsureUniqueInnerResult sheetRes =
sheet->EnsureUniqueInner();
if (sheetRes == nsCSSStyleSheet::eUniqueInner_ClonedInner) {
if (sheetRes == CSSStyleSheet::eUniqueInner_ClonedInner) {
res = sheetRes;
}

View File

@ -13,10 +13,10 @@
#define nsStyleSet_h_
#include "mozilla/Attributes.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/MemoryReporting.h"
#include "nsIStyleRuleProcessor.h"
#include "nsCSSStyleSheet.h"
#include "nsBindingManager.h"
#include "nsRuleNode.h"
#include "nsTArray.h"
@ -338,7 +338,7 @@ class nsStyleSet
--mUnusedRuleNodeCount;
}
nsCSSStyleSheet::EnsureUniqueInnerResult EnsureUniqueInnerOnCSSSheets();
mozilla::CSSStyleSheet::EnsureUniqueInnerResult EnsureUniqueInnerOnCSSSheets();
nsIStyleRule* InitialStyleRule();

View File

@ -19,8 +19,10 @@
#include "nsNetUtil.h"
#include "nsContentCID.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/css/Loader.h"
#include "nsCSSStyleSheet.h"
using namespace mozilla;
static already_AddRefed<nsIURI>
FileToURI(const char *aFilename, nsresult *aRv = 0)
@ -41,7 +43,7 @@ static int
ParseCSSFile(nsIURI *aSheetURI)
{
nsRefPtr<mozilla::css::Loader> = new mozilla::css::Loader();
nsRefPtr<nsCSSStyleSheet> sheet;
nsRefPtr<CSSStyleSheet> sheet;
loader->LoadSheetSync(aSheetURI, getter_AddRefs(sheet));
NS_ASSERTION(sheet, "sheet load failed");
/* This can happen if the file can't be found (e.g. you