mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
DeCOMtaminate nsIStyleSheet method signatures. (Bug 239008) r=dbaron
This commit is contained in:
parent
aac12d61e6
commit
d02574b6b4
@ -959,9 +959,7 @@ nsresult nsChromeRegistry::RefreshWindow(nsIDOMWindowInternal* aWindow)
|
||||
for (PRInt32 l = 0; l < agentSheets.Count(); ++l) {
|
||||
nsIStyleSheet *sheet = agentSheets[l];
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = sheet->GetSheetURI(getter_AddRefs(uri));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIURI> uri = sheet->GetSheetURI();
|
||||
|
||||
if (IsChromeURI(uri)) {
|
||||
// Reload the sheet.
|
||||
|
@ -1983,9 +1983,7 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
|
||||
nsIStyleSheet* sheet = mStyleSheets[indx];
|
||||
sheet->SetOwningDocument(nsnull);
|
||||
|
||||
PRBool applicable;
|
||||
sheet->GetApplicable(applicable);
|
||||
if (applicable) {
|
||||
if (sheet->GetApplicable()) {
|
||||
RemoveStyleSheetFromStyleSets(sheet);
|
||||
}
|
||||
|
||||
@ -1997,9 +1995,7 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
|
||||
nsIStyleSheet* sheet = mCatalogSheets[indx];
|
||||
sheet->SetOwningDocument(nsnull);
|
||||
|
||||
PRBool applicable;
|
||||
sheet->GetApplicable(applicable);
|
||||
if (applicable) {
|
||||
if (sheet->GetApplicable()) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
if (shell) {
|
||||
shell->StyleSet()->RemoveStyleSheet(nsStyleSet::eAgentSheet, sheet);
|
||||
@ -2092,18 +2088,14 @@ nsDocument::FillStyleSet(nsStyleSet* aStyleSet)
|
||||
PRInt32 i;
|
||||
for (i = mStyleSheets.Count() - 1; i >= 0; --i) {
|
||||
nsIStyleSheet* sheet = mStyleSheets[i];
|
||||
PRBool sheetApplicable;
|
||||
sheet->GetApplicable(sheetApplicable);
|
||||
if (sheetApplicable) {
|
||||
if (sheet->GetApplicable()) {
|
||||
aStyleSet->AddDocStyleSheet(sheet, this);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = mCatalogSheets.Count() - 1; i >= 0; --i) {
|
||||
nsIStyleSheet* sheet = mCatalogSheets[i];
|
||||
PRBool sheetApplicable;
|
||||
sheet->GetApplicable(sheetApplicable);
|
||||
if (sheetApplicable) {
|
||||
if (sheet->GetApplicable()) {
|
||||
aStyleSet->AppendStyleSheet(nsStyleSet::eAgentSheet, sheet);
|
||||
}
|
||||
}
|
||||
@ -3374,10 +3366,7 @@ nsDocument::AddStyleSheet(nsIStyleSheet* aSheet)
|
||||
mStyleSheets.AppendObject(aSheet);
|
||||
aSheet->SetOwningDocument(this);
|
||||
|
||||
PRBool applicable;
|
||||
aSheet->GetApplicable(applicable);
|
||||
|
||||
if (applicable) {
|
||||
if (aSheet->GetApplicable()) {
|
||||
AddStyleSheetToStyleSets(aSheet);
|
||||
}
|
||||
|
||||
@ -3405,9 +3394,7 @@ nsDocument::RemoveStyleSheet(nsIStyleSheet* aSheet)
|
||||
}
|
||||
|
||||
if (!mIsGoingAway) {
|
||||
PRBool applicable = PR_TRUE;
|
||||
aSheet->GetApplicable(applicable);
|
||||
if (applicable) {
|
||||
if (aSheet->GetApplicable()) {
|
||||
RemoveStyleSheetFromStyleSets(aSheet);
|
||||
}
|
||||
|
||||
@ -3443,9 +3430,7 @@ nsDocument::UpdateStyleSheets(nsCOMArray<nsIStyleSheet>& aOldSheets,
|
||||
if (newSheet) {
|
||||
mStyleSheets.InsertObjectAt(newSheet, oldIndex);
|
||||
newSheet->SetOwningDocument(this);
|
||||
PRBool applicable = PR_TRUE;
|
||||
newSheet->GetApplicable(applicable);
|
||||
if (applicable) {
|
||||
if (newSheet->GetApplicable()) {
|
||||
AddStyleSheetToStyleSets(newSheet);
|
||||
}
|
||||
|
||||
@ -3464,10 +3449,7 @@ nsDocument::InsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex)
|
||||
|
||||
aSheet->SetOwningDocument(this);
|
||||
|
||||
PRBool applicable;
|
||||
aSheet->GetApplicable(applicable);
|
||||
|
||||
if (applicable) {
|
||||
if (aSheet->GetApplicable()) {
|
||||
AddStyleSheetToStyleSets(aSheet);
|
||||
}
|
||||
|
||||
@ -3520,10 +3502,7 @@ nsDocument::AddCatalogStyleSheet(nsIStyleSheet* aSheet)
|
||||
mCatalogSheets.AppendObject(aSheet);
|
||||
aSheet->SetOwningDocument(this);
|
||||
|
||||
PRBool applicable;
|
||||
aSheet->GetApplicable(applicable);
|
||||
|
||||
if (applicable) {
|
||||
if (aSheet->GetApplicable()) {
|
||||
// This is like |AddStyleSheetToStyleSets|, but for an agent sheet.
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
if (shell) {
|
||||
@ -3544,8 +3523,7 @@ nsDocument::EnsureCatalogStyleSheet(const char *aStyleSheetURI)
|
||||
nsIStyleSheet* sheet = GetCatalogStyleSheetAt(i);
|
||||
NS_ASSERTION(sheet, "unexpected null stylesheet in the document");
|
||||
if (sheet) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
sheet->GetSheetURI(getter_AddRefs(uri));
|
||||
nsCOMPtr<nsIURI> uri = sheet->GetSheetURI();
|
||||
nsCAutoString uriStr;
|
||||
uri->GetSpec(uriStr);
|
||||
if (uriStr.Equals(aStyleSheetURI))
|
||||
@ -7752,9 +7730,7 @@ nsIDocument::CreateStaticClone(nsISupports* aCloneContainer)
|
||||
for (PRInt32 i = 0; i < sheetsCount; ++i) {
|
||||
nsRefPtr<nsCSSStyleSheet> sheet = do_QueryObject(GetStyleSheetAt(i));
|
||||
if (sheet) {
|
||||
PRBool applicable = PR_TRUE;
|
||||
sheet->GetApplicable(applicable);
|
||||
if (applicable) {
|
||||
if (sheet->GetApplicable()) {
|
||||
nsRefPtr<nsCSSStyleSheet> clonedSheet =
|
||||
sheet->Clone(nsnull, nsnull, clonedDoc, nsnull);
|
||||
NS_WARN_IF_FALSE(clonedSheet, "Cloning a stylesheet didn't work!");
|
||||
@ -7770,9 +7746,7 @@ nsIDocument::CreateStaticClone(nsISupports* aCloneContainer)
|
||||
nsRefPtr<nsCSSStyleSheet> sheet =
|
||||
do_QueryObject(GetCatalogStyleSheetAt(i));
|
||||
if (sheet) {
|
||||
PRBool applicable = PR_TRUE;
|
||||
sheet->GetApplicable(applicable);
|
||||
if (applicable) {
|
||||
if (sheet->GetApplicable()) {
|
||||
nsRefPtr<nsCSSStyleSheet> clonedSheet =
|
||||
sheet->Clone(nsnull, nsnull, clonedDoc, nsnull);
|
||||
NS_WARN_IF_FALSE(clonedSheet, "Cloning a stylesheet didn't work!");
|
||||
|
@ -248,9 +248,7 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument *aOldDocument,
|
||||
nsCOMPtr<nsIURI> uri = GetStyleSheetURL(&isInline);
|
||||
|
||||
if (!aForceUpdate && mStyleSheet && !isInline && uri) {
|
||||
nsCOMPtr<nsIURI> oldURI;
|
||||
|
||||
mStyleSheet->GetSheetURI(getter_AddRefs(oldURI));
|
||||
nsCOMPtr<nsIURI> oldURI = mStyleSheet->GetSheetURI();
|
||||
if (oldURI) {
|
||||
PRBool equal;
|
||||
nsresult rv = oldURI->Equals(uri, &equal);
|
||||
|
@ -121,8 +121,7 @@ nsXBLPrototypeResources::FlushSkinSheets()
|
||||
i < count; ++i) {
|
||||
nsCSSStyleSheet* oldSheet = oldSheets[i];
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
oldSheet->GetSheetURI(getter_AddRefs(uri));
|
||||
nsCOMPtr<nsIURI> uri = oldSheet->GetSheetURI();
|
||||
|
||||
nsRefPtr<nsCSSStyleSheet> newSheet;
|
||||
if (IsChromeURI(uri)) {
|
||||
|
@ -245,10 +245,7 @@ nsXULPrototypeCache::PutPrototype(nsXULPrototypeDocument* aDocument)
|
||||
nsresult
|
||||
nsXULPrototypeCache::PutStyleSheet(nsCSSStyleSheet* aStyleSheet)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = aStyleSheet->GetSheetURI(getter_AddRefs(uri));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
nsCOMPtr<nsIURI> uri = aStyleSheet->GetSheetURI();
|
||||
|
||||
NS_ENSURE_TRUE(mStyleSheetTable.Put(uri, aStyleSheet),
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
@ -347,8 +344,7 @@ FlushSkinXBL(nsIURI* aKey, nsCOMPtr<nsIXBLDocumentInfo>& aDocInfo, void* aClosur
|
||||
static PLDHashOperator
|
||||
FlushSkinSheets(nsIURI* aKey, nsRefPtr<nsCSSStyleSheet>& aSheet, void* aClosure)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
aSheet->GetSheetURI(getter_AddRefs(uri));
|
||||
nsCOMPtr<nsIURI> uri = aSheet->GetSheetURI();
|
||||
nsCAutoString str;
|
||||
uri->GetPath(str);
|
||||
|
||||
|
@ -3505,9 +3505,8 @@ nsHTMLEditor::EnableStyleSheet(const nsAString &aURL, PRBool aEnable)
|
||||
|
||||
// Ensure the style sheet is owned by our document.
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryReferent(mDocWeak);
|
||||
rv = sheet->SetOwningDocument(doc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
sheet->SetOwningDocument(doc);
|
||||
|
||||
return sheet->SetDisabled(!aEnable);
|
||||
}
|
||||
|
||||
@ -3524,9 +3523,7 @@ nsHTMLEditor::EnableExistingStyleSheet(const nsAString &aURL)
|
||||
{
|
||||
// Ensure the style sheet is owned by our document.
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryReferent(mDocWeak);
|
||||
rv = sheet->SetOwningDocument(doc);
|
||||
if (NS_FAILED(rv))
|
||||
return PR_FALSE;
|
||||
sheet->SetOwningDocument(doc);
|
||||
|
||||
sheet->SetDisabled(PR_FALSE);
|
||||
return PR_TRUE;
|
||||
@ -3902,22 +3899,18 @@ nsHTMLEditor::StyleSheetLoaded(nsCSSStyleSheet* aSheet, PRBool aWasAlternate,
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
// Get the URI, then url spec from the sheet
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = aSheet->GetSheetURI(getter_AddRefs(uri));
|
||||
nsCOMPtr<nsIURI> uri = aSheet->GetSheetURI();
|
||||
|
||||
nsCAutoString spec;
|
||||
rv = uri->GetSpec(spec);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCAutoString spec;
|
||||
rv = uri->GetSpec(spec);
|
||||
// Save it so we can remove before applying the next one
|
||||
mLastStyleSheetURL.AssignWithConversion(spec.get());
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
// Save it so we can remove before applying the next one
|
||||
mLastStyleSheetURL.AssignWithConversion(spec.get());
|
||||
|
||||
// Also save in our arrays of urls and sheets
|
||||
AddNewStyleSheetToList(mLastStyleSheetURL, aSheet);
|
||||
}
|
||||
// Also save in our arrays of urls and sheets
|
||||
AddNewStyleSheetToList(mLastStyleSheetURL, aSheet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4927,10 +4927,8 @@ PresShell::StyleSheetAdded(nsIDocument *aDocument,
|
||||
{
|
||||
// We only care when enabled sheets are added
|
||||
NS_PRECONDITION(aStyleSheet, "Must have a style sheet!");
|
||||
PRBool applicable;
|
||||
aStyleSheet->GetApplicable(applicable);
|
||||
|
||||
if (applicable && aStyleSheet->HasRules()) {
|
||||
if (aStyleSheet->GetApplicable() && aStyleSheet->HasRules()) {
|
||||
mStylesHaveChanged = PR_TRUE;
|
||||
}
|
||||
}
|
||||
@ -4942,9 +4940,8 @@ PresShell::StyleSheetRemoved(nsIDocument *aDocument,
|
||||
{
|
||||
// We only care when enabled sheets are removed
|
||||
NS_PRECONDITION(aStyleSheet, "Must have a style sheet!");
|
||||
PRBool applicable;
|
||||
aStyleSheet->GetApplicable(applicable);
|
||||
if (applicable && aStyleSheet->HasRules()) {
|
||||
|
||||
if (aStyleSheet->GetApplicable() && aStyleSheet->HasRules()) {
|
||||
mStylesHaveChanged = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -109,9 +109,8 @@ nsStyleSheetService::FindSheetByURI(const nsCOMArray<nsIStyleSheet> &sheets,
|
||||
{
|
||||
for (PRInt32 i = sheets.Count() - 1; i >= 0; i-- ) {
|
||||
PRBool bEqual;
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
if (NS_SUCCEEDED(sheets[i]->GetSheetURI(getter_AddRefs(uri)))
|
||||
&& uri
|
||||
nsCOMPtr<nsIURI> uri = sheets[i]->GetSheetURI();
|
||||
if (uri
|
||||
&& NS_SUCCEEDED(uri->Equals(sheetURI, &bEqual))
|
||||
&& bEqual) {
|
||||
return i;
|
||||
|
@ -791,12 +791,12 @@ SheetLoadData::OnDetermineCharset(nsIUnicharStreamLoader* aLoader,
|
||||
already_AddRefed<nsIURI>
|
||||
SheetLoadData::GetReferrerURI()
|
||||
{
|
||||
nsIURI* uri = nsnull;
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
if (mParentData)
|
||||
mParentData->mSheet->GetSheetURI(&uri);
|
||||
uri = mParentData->mSheet->GetSheetURI();
|
||||
if (!uri && mLoader->mDocument)
|
||||
NS_IF_ADDREF(uri = mLoader->mDocument->GetDocumentURI());
|
||||
return uri;
|
||||
uri = mLoader->mDocument->GetDocumentURI();
|
||||
return uri.forget();
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1107,8 +1107,7 @@ Loader::CreateSheet(nsIURI* aURI,
|
||||
#ifdef DEBUG
|
||||
// This sheet came from the XUL cache or our per-document hashtable; it
|
||||
// better be a complete sheet.
|
||||
PRBool complete = PR_FALSE;
|
||||
sheet->GetComplete(complete);
|
||||
PRBool complete = sheet->GetComplete();
|
||||
NS_ASSERTION(complete,
|
||||
"Sheet thinks it's not complete while we think it is");
|
||||
#endif
|
||||
@ -1166,8 +1165,7 @@ Loader::CreateSheet(nsIURI* aURI,
|
||||
if (sheet) {
|
||||
// The sheet we have now should be either incomplete or unmodified
|
||||
#ifdef DEBUG
|
||||
PRBool complete = PR_FALSE;
|
||||
sheet->GetComplete(complete);
|
||||
PRBool complete = sheet->GetComplete();
|
||||
NS_ASSERTION(!sheet->IsModified() || !complete,
|
||||
"Unexpected modified complete sheet");
|
||||
NS_ASSERTION(complete || aSheetState != eSheetComplete,
|
||||
@ -1648,8 +1646,8 @@ Loader::ParseSheet(nsIUnicharInputStream* aStream,
|
||||
// Push our load data on the stack so any kids can pick it up
|
||||
mParsingDatas.AppendElement(aLoadData);
|
||||
nsCOMPtr<nsIURI> sheetURI, baseURI;
|
||||
aLoadData->mSheet->GetSheetURI(getter_AddRefs(sheetURI));
|
||||
aLoadData->mSheet->GetBaseURI(getter_AddRefs(baseURI));
|
||||
sheetURI = aLoadData->mSheet->GetSheetURI();
|
||||
baseURI = aLoadData->mSheet->GetBaseURI();
|
||||
nsresult rv = parser.Parse(aStream, sheetURI, baseURI,
|
||||
aLoadData->mSheet->Principal(),
|
||||
aLoadData->mLineNumber,
|
||||
@ -2003,9 +2001,8 @@ Loader::LoadChildSheet(nsCSSStyleSheet* aParentSheet,
|
||||
|
||||
// check for an owning document: if none, don't bother walking up the parent
|
||||
// sheets
|
||||
nsCOMPtr<nsIDocument> owningDoc;
|
||||
nsresult rv = aParentSheet->GetOwningDocument(*getter_AddRefs(owningDoc));
|
||||
if (NS_SUCCEEDED(rv) && owningDoc) {
|
||||
nsCOMPtr<nsIDocument> owningDoc = aParentSheet->GetOwningDocument();
|
||||
if (owningDoc) {
|
||||
nsCOMPtr<nsIDOMStyleSheet> nextParentSheet(aParentSheet);
|
||||
NS_ENSURE_TRUE(nextParentSheet, NS_ERROR_FAILURE); //Not a stylesheet!?
|
||||
|
||||
@ -2025,7 +2022,7 @@ Loader::LoadChildSheet(nsCSSStyleSheet* aParentSheet,
|
||||
}
|
||||
|
||||
nsIPrincipal* principal = aParentSheet->Principal();
|
||||
rv = CheckLoadAllowed(principal, aURL, context);
|
||||
nsresult rv = CheckLoadAllowed(principal, aURL, context);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
LOG((" Passed load check"));
|
||||
|
@ -892,8 +892,7 @@ CSSParserImpl::Parse(nsIUnicharInputStream* aInput,
|
||||
NS_ENSURE_STATE(mSheet);
|
||||
|
||||
#ifdef DEBUG
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
mSheet->GetSheetURI(getter_AddRefs(uri));
|
||||
nsCOMPtr<nsIURI> uri = mSheet->GetSheetURI();
|
||||
PRBool equal;
|
||||
NS_ASSERTION(NS_SUCCEEDED(aSheetURI->Equals(uri, &equal)) && equal,
|
||||
"Sheet URI does not match passed URI");
|
||||
|
@ -2823,10 +2823,7 @@ CascadeRuleEnumFunc(nsICSSRule* aRule, void* aData)
|
||||
/* static */ PRBool
|
||||
nsCSSRuleProcessor::CascadeSheet(nsCSSStyleSheet* aSheet, CascadeEnumData* aData)
|
||||
{
|
||||
PRBool bSheetApplicable = PR_TRUE;
|
||||
aSheet->GetApplicable(bSheetApplicable);
|
||||
|
||||
if (bSheetApplicable &&
|
||||
if (aSheet->GetApplicable() &&
|
||||
aSheet->UseForPresentation(aData->mPresContext, aData->mCacheKey) &&
|
||||
aSheet->mInner) {
|
||||
nsCSSStyleSheet* child = aSheet->mInner->mFirstChild;
|
||||
|
@ -1082,16 +1082,15 @@ DOMCSSDeclarationImpl::GetCSSParsingEnvironment(nsIURI** aSheetURI,
|
||||
if (mRule) {
|
||||
mRule->GetStyleSheet(*getter_AddRefs(sheet));
|
||||
if (sheet) {
|
||||
sheet->GetSheetURI(aSheetURI);
|
||||
sheet->GetBaseURI(aBaseURI);
|
||||
*aSheetURI = sheet->GetSheetURI().get();
|
||||
*aBaseURI = sheet->GetBaseURI().get();
|
||||
|
||||
nsRefPtr<nsCSSStyleSheet> cssSheet(do_QueryObject(sheet));
|
||||
if (cssSheet) {
|
||||
NS_ADDREF(*aSheetPrincipal = cssSheet->Principal());
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
sheet->GetOwningDocument(*getter_AddRefs(document));
|
||||
nsCOMPtr<nsIDocument> document = sheet->GetOwningDocument();
|
||||
if (document) {
|
||||
NS_ADDREF(*aCSSLoader = document->CSSLoader());
|
||||
}
|
||||
@ -1130,7 +1129,7 @@ DOMCSSDeclarationImpl::DeclarationChanged()
|
||||
nsCOMPtr<nsIStyleSheet> sheet;
|
||||
mRule->GetStyleSheet(*getter_AddRefs(sheet));
|
||||
if (sheet) {
|
||||
sheet->GetOwningDocument(*getter_AddRefs(owningDoc));
|
||||
owningDoc = sheet->GetOwningDocument();
|
||||
}
|
||||
|
||||
mozAutoDocUpdate updateBatch(owningDoc, UPDATE_STYLE, PR_TRUE);
|
||||
|
@ -614,8 +614,7 @@ nsMediaList::GetMediaText(nsAString& aMediaText)
|
||||
// nsCOMPtr<nsIDocument>
|
||||
#define BEGIN_MEDIA_CHANGE(sheet, doc) \
|
||||
if (sheet) { \
|
||||
rv = sheet->GetOwningDocument(*getter_AddRefs(doc)); \
|
||||
NS_ENSURE_SUCCESS(rv, rv); \
|
||||
doc = sheet->GetOwningDocument(); \
|
||||
} \
|
||||
mozAutoDocUpdate updateBatch(doc, UPDATE_STYLE, PR_TRUE); \
|
||||
if (sheet) { \
|
||||
@ -1131,25 +1130,26 @@ nsCSSStyleSheet::Principal() const
|
||||
return mInner->mPrincipal;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCSSStyleSheet::GetSheetURI(nsIURI** aSheetURI) const
|
||||
already_AddRefed<nsIURI>
|
||||
nsCSSStyleSheet::GetSheetURI() const
|
||||
{
|
||||
NS_IF_ADDREF(*aSheetURI = mInner->mSheetURI.get());
|
||||
return NS_OK;
|
||||
nsIURI* sheetURI = mInner->mSheetURI;
|
||||
NS_IF_ADDREF(sheetURI);
|
||||
return sheetURI;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCSSStyleSheet::GetBaseURI(nsIURI** aBaseURI) const
|
||||
already_AddRefed<nsIURI>
|
||||
nsCSSStyleSheet::GetBaseURI() const
|
||||
{
|
||||
NS_IF_ADDREF(*aBaseURI = mInner->mBaseURI.get());
|
||||
return NS_OK;
|
||||
nsIURI* baseURI = mInner->mBaseURI;
|
||||
NS_IF_ADDREF(baseURI);
|
||||
return baseURI;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsCSSStyleSheet::GetType(nsString& aType) const
|
||||
{
|
||||
aType.AssignLiteral("text/css");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool
|
||||
@ -1169,20 +1169,19 @@ nsCSSStyleSheet::SetMedia(nsMediaList* aMedia)
|
||||
mMedia = aMedia;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(PRBool)
|
||||
PRBool
|
||||
nsCSSStyleSheet::HasRules() const
|
||||
{
|
||||
return StyleRuleCount() != 0;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCSSStyleSheet::GetApplicable(PRBool& aApplicable) const
|
||||
PRBool
|
||||
nsCSSStyleSheet::GetApplicable() const
|
||||
{
|
||||
aApplicable = !mDisabled && mInner->mComplete;
|
||||
return NS_OK;
|
||||
return !mDisabled && mInner->mComplete;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsCSSStyleSheet::SetEnabled(PRBool aEnabled)
|
||||
{
|
||||
// Internal method, so callers must handle BeginUpdate/EndUpdate
|
||||
@ -1196,18 +1195,15 @@ nsCSSStyleSheet::SetEnabled(PRBool aEnabled)
|
||||
mDocument->SetStyleSheetApplicableState(this, !mDisabled);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCSSStyleSheet::GetComplete(PRBool& aComplete) const
|
||||
PRBool
|
||||
nsCSSStyleSheet::GetComplete() const
|
||||
{
|
||||
aComplete = mInner->mComplete;
|
||||
return NS_OK;
|
||||
return mInner->mComplete;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsCSSStyleSheet::SetComplete()
|
||||
{
|
||||
NS_ASSERTION(!mDirty, "Can't set a dirty sheet complete!");
|
||||
@ -1218,26 +1214,23 @@ nsCSSStyleSheet::SetComplete()
|
||||
mDocument->SetStyleSheetApplicableState(this, PR_TRUE);
|
||||
mDocument->EndUpdate(UPDATE_STYLE);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCSSStyleSheet::GetParentSheet(nsIStyleSheet*& aParent) const
|
||||
already_AddRefed<nsIStyleSheet>
|
||||
nsCSSStyleSheet::GetParentSheet() const
|
||||
{
|
||||
aParent = mParent;
|
||||
NS_IF_ADDREF(aParent);
|
||||
return NS_OK;
|
||||
NS_IF_ADDREF(mParent);
|
||||
return mParent;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCSSStyleSheet::GetOwningDocument(nsIDocument*& aDocument) const
|
||||
already_AddRefed<nsIDocument>
|
||||
nsCSSStyleSheet::GetOwningDocument() const
|
||||
{
|
||||
aDocument = mDocument;
|
||||
NS_IF_ADDREF(aDocument);
|
||||
return NS_OK;
|
||||
NS_IF_ADDREF(mDocument);
|
||||
return mDocument;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsCSSStyleSheet::SetOwningDocument(nsIDocument* aDocument)
|
||||
{ // not ref counted
|
||||
mDocument = aDocument;
|
||||
@ -1250,7 +1243,6 @@ nsCSSStyleSheet::SetOwningDocument(nsIDocument* aDocument)
|
||||
child->SetOwningDocument(aDocument);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<nsICSSImportRule>
|
||||
@ -1630,8 +1622,8 @@ nsCSSStyleSheet::SetDisabled(PRBool aDisabled)
|
||||
{
|
||||
// DOM method, so handle BeginUpdate/EndUpdate
|
||||
MOZ_AUTO_DOC_UPDATE(mDocument, UPDATE_STYLE, PR_TRUE);
|
||||
nsresult rv = nsCSSStyleSheet::SetEnabled(!aDisabled);
|
||||
return rv;
|
||||
nsCSSStyleSheet::SetEnabled(!aDisabled);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -1673,11 +1665,10 @@ nsCSSStyleSheet::GetHref(nsAString& aHref)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsCSSStyleSheet::GetTitle(nsString& aTitle) const
|
||||
{
|
||||
aTitle = mTitle;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -1720,9 +1711,7 @@ NS_IMETHODIMP
|
||||
nsCSSStyleSheet::GetCssRules(nsIDOMCSSRuleList** aCssRules)
|
||||
{
|
||||
// No doing this on incomplete sheets!
|
||||
PRBool complete;
|
||||
GetComplete(complete);
|
||||
if (!complete) {
|
||||
if (!GetComplete()) {
|
||||
return NS_ERROR_DOM_INVALID_ACCESS_ERR;
|
||||
}
|
||||
|
||||
@ -1765,9 +1754,7 @@ nsCSSStyleSheet::InsertRuleInternal(const nsAString& aRule,
|
||||
PRUint32* aReturn)
|
||||
{
|
||||
// No doing this if the sheet is not complete!
|
||||
PRBool complete;
|
||||
GetComplete(complete);
|
||||
if (!complete) {
|
||||
if (!GetComplete()) {
|
||||
return NS_ERROR_DOM_INVALID_ACCESS_ERR;
|
||||
}
|
||||
|
||||
@ -1914,9 +1901,7 @@ nsCSSStyleSheet::DeleteRule(PRUint32 aIndex)
|
||||
{
|
||||
nsresult result = NS_ERROR_DOM_INDEX_SIZE_ERR;
|
||||
// No doing this if the sheet is not complete!
|
||||
PRBool complete;
|
||||
GetComplete(complete);
|
||||
if (!complete) {
|
||||
if (!GetComplete()) {
|
||||
return NS_ERROR_DOM_INVALID_ACCESS_ERR;
|
||||
}
|
||||
|
||||
@ -2094,8 +2079,7 @@ nsCSSStyleSheet::StyleSheetLoaded(nsCSSStyleSheet* aSheet,
|
||||
nsresult aStatus)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
nsCOMPtr<nsIStyleSheet> parentSheet;
|
||||
aSheet->GetParentSheet(*getter_AddRefs(parentSheet));
|
||||
nsCOMPtr<nsIStyleSheet> parentSheet = aSheet->GetParentSheet();
|
||||
NS_ASSERTION(this == parentSheet, "We are being notified of a sheet load for a sheet that is not our child!\n");
|
||||
#endif
|
||||
|
||||
|
@ -137,18 +137,18 @@ public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_CSS_STYLE_SHEET_IMPL_CID)
|
||||
|
||||
// nsIStyleSheet interface
|
||||
NS_IMETHOD GetSheetURI(nsIURI** aSheetURI) const;
|
||||
NS_IMETHOD GetBaseURI(nsIURI** aBaseURI) const;
|
||||
NS_IMETHOD GetTitle(nsString& aTitle) const;
|
||||
NS_IMETHOD GetType(nsString& aType) const;
|
||||
NS_IMETHOD_(PRBool) HasRules() const;
|
||||
NS_IMETHOD GetApplicable(PRBool& aApplicable) const;
|
||||
NS_IMETHOD SetEnabled(PRBool aEnabled);
|
||||
NS_IMETHOD GetComplete(PRBool& aComplete) const;
|
||||
NS_IMETHOD SetComplete();
|
||||
NS_IMETHOD GetParentSheet(nsIStyleSheet*& aParent) const; // may be null
|
||||
NS_IMETHOD GetOwningDocument(nsIDocument*& aDocument) const; // may be null
|
||||
NS_IMETHOD SetOwningDocument(nsIDocument* aDocument);
|
||||
virtual already_AddRefed<nsIURI> GetSheetURI() const;
|
||||
virtual already_AddRefed<nsIURI> GetBaseURI() const;
|
||||
virtual void GetTitle(nsString& aTitle) const;
|
||||
virtual void GetType(nsString& aType) const;
|
||||
virtual PRBool HasRules() const;
|
||||
virtual PRBool GetApplicable() const;
|
||||
virtual void SetEnabled(PRBool aEnabled);
|
||||
virtual PRBool GetComplete() const;
|
||||
virtual void SetComplete();
|
||||
virtual already_AddRefed<nsIStyleSheet> GetParentSheet() const; // may be null
|
||||
virtual already_AddRefed<nsIDocument> GetOwningDocument() const; // may be null
|
||||
virtual void SetOwningDocument(nsIDocument* aDocument);
|
||||
#ifdef DEBUG
|
||||
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
#endif
|
||||
|
@ -183,90 +183,79 @@ nsHTMLCSSStyleSheet::Reset(nsIURI* aURL)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLCSSStyleSheet::GetSheetURI(nsIURI** aSheetURL) const
|
||||
already_AddRefed<nsIURI>
|
||||
nsHTMLCSSStyleSheet::GetSheetURI() const
|
||||
{
|
||||
NS_IF_ADDREF(mURL);
|
||||
*aSheetURL = mURL;
|
||||
return NS_OK;
|
||||
return mURL;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLCSSStyleSheet::GetBaseURI(nsIURI** aBaseURL) const
|
||||
already_AddRefed<nsIURI>
|
||||
nsHTMLCSSStyleSheet::GetBaseURI() const
|
||||
{
|
||||
NS_IF_ADDREF(mURL);
|
||||
*aBaseURL = mURL;
|
||||
return NS_OK;
|
||||
return mURL;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsHTMLCSSStyleSheet::GetTitle(nsString& aTitle) const
|
||||
{
|
||||
aTitle.AssignLiteral("Internal HTML/CSS Style Sheet");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsHTMLCSSStyleSheet::GetType(nsString& aType) const
|
||||
{
|
||||
aType.AssignLiteral("text/html");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(PRBool)
|
||||
PRBool
|
||||
nsHTMLCSSStyleSheet::HasRules() const
|
||||
{
|
||||
// Say we always have rules, since we don't know.
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLCSSStyleSheet::GetApplicable(PRBool& aApplicable) const
|
||||
PRBool
|
||||
nsHTMLCSSStyleSheet::GetApplicable() const
|
||||
{
|
||||
aApplicable = PR_TRUE;
|
||||
return NS_OK;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsHTMLCSSStyleSheet::SetEnabled(PRBool aEnabled)
|
||||
{ // these can't be disabled
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLCSSStyleSheet::GetComplete(PRBool& aComplete) const
|
||||
PRBool
|
||||
nsHTMLCSSStyleSheet::GetComplete() const
|
||||
{
|
||||
aComplete = PR_TRUE;
|
||||
return NS_OK;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsHTMLCSSStyleSheet::SetComplete()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// style sheet owner info
|
||||
NS_IMETHODIMP
|
||||
nsHTMLCSSStyleSheet::GetParentSheet(nsIStyleSheet*& aParent) const
|
||||
already_AddRefed<nsIStyleSheet>
|
||||
nsHTMLCSSStyleSheet::GetParentSheet() const
|
||||
{
|
||||
aParent = nsnull;
|
||||
return NS_OK;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLCSSStyleSheet::GetOwningDocument(nsIDocument*& aDocument) const
|
||||
already_AddRefed<nsIDocument>
|
||||
nsHTMLCSSStyleSheet::GetOwningDocument() const
|
||||
{
|
||||
NS_IF_ADDREF(mDocument);
|
||||
aDocument = mDocument;
|
||||
return NS_OK;
|
||||
return mDocument;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsHTMLCSSStyleSheet::SetOwningDocument(nsIDocument* aDocument)
|
||||
{
|
||||
mDocument = aDocument;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -56,18 +56,18 @@ public:
|
||||
nsresult Reset(nsIURI* aURL);
|
||||
|
||||
// nsIStyleSheet
|
||||
NS_IMETHOD GetSheetURI(nsIURI** aSheetURL) const;
|
||||
NS_IMETHOD GetBaseURI(nsIURI** aBaseURL) const;
|
||||
NS_IMETHOD GetTitle(nsString& aTitle) const;
|
||||
NS_IMETHOD GetType(nsString& aType) const;
|
||||
NS_IMETHOD_(PRBool) HasRules() const;
|
||||
NS_IMETHOD GetApplicable(PRBool& aApplicable) const;
|
||||
NS_IMETHOD SetEnabled(PRBool aEnabled);
|
||||
NS_IMETHOD GetComplete(PRBool& aComplete) const;
|
||||
NS_IMETHOD SetComplete();
|
||||
NS_IMETHOD GetParentSheet(nsIStyleSheet*& aParent) const; // will be null
|
||||
NS_IMETHOD GetOwningDocument(nsIDocument*& aDocument) const;
|
||||
NS_IMETHOD SetOwningDocument(nsIDocument* aDocument);
|
||||
virtual already_AddRefed<nsIURI> GetSheetURI() const;
|
||||
virtual already_AddRefed<nsIURI> GetBaseURI() const;
|
||||
virtual void GetTitle(nsString& aTitle) const;
|
||||
virtual void GetType(nsString& aType) const;
|
||||
virtual PRBool HasRules() const;
|
||||
virtual PRBool GetApplicable() const;
|
||||
virtual void SetEnabled(PRBool aEnabled);
|
||||
virtual PRBool GetComplete() const;
|
||||
virtual void SetComplete();
|
||||
virtual already_AddRefed<nsIStyleSheet> GetParentSheet() const; // will be null
|
||||
virtual already_AddRefed<nsIDocument> GetOwningDocument() const;
|
||||
virtual void SetOwningDocument(nsIDocument* aDocument);
|
||||
#ifdef DEBUG
|
||||
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
#endif
|
||||
|
@ -374,88 +374,77 @@ nsHTMLStyleSheet::RulesMatching(XULTreeRuleProcessorData* aData)
|
||||
#endif
|
||||
|
||||
// nsIStyleSheet api
|
||||
NS_IMETHODIMP
|
||||
nsHTMLStyleSheet::GetSheetURI(nsIURI** aSheetURI) const
|
||||
already_AddRefed<nsIURI>
|
||||
nsHTMLStyleSheet::GetSheetURI() const
|
||||
{
|
||||
*aSheetURI = mURL;
|
||||
NS_IF_ADDREF(*aSheetURI);
|
||||
return NS_OK;
|
||||
NS_IF_ADDREF(mURL);
|
||||
return mURL;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLStyleSheet::GetBaseURI(nsIURI** aBaseURI) const
|
||||
already_AddRefed<nsIURI>
|
||||
nsHTMLStyleSheet::GetBaseURI() const
|
||||
{
|
||||
*aBaseURI = mURL;
|
||||
NS_IF_ADDREF(*aBaseURI);
|
||||
return NS_OK;
|
||||
NS_IF_ADDREF(mURL);
|
||||
return mURL;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsHTMLStyleSheet::GetTitle(nsString& aTitle) const
|
||||
{
|
||||
aTitle.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsHTMLStyleSheet::GetType(nsString& aType) const
|
||||
{
|
||||
aType.AssignLiteral("text/html");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(PRBool)
|
||||
PRBool
|
||||
nsHTMLStyleSheet::HasRules() const
|
||||
{
|
||||
return PR_TRUE; // We have rules at all reasonable times
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLStyleSheet::GetApplicable(PRBool& aApplicable) const
|
||||
PRBool
|
||||
nsHTMLStyleSheet::GetApplicable() const
|
||||
{
|
||||
aApplicable = PR_TRUE;
|
||||
return NS_OK;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsHTMLStyleSheet::SetEnabled(PRBool aEnabled)
|
||||
{ // these can't be disabled
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLStyleSheet::GetComplete(PRBool& aComplete) const
|
||||
PRBool
|
||||
nsHTMLStyleSheet::GetComplete() const
|
||||
{
|
||||
aComplete = PR_TRUE;
|
||||
return NS_OK;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsHTMLStyleSheet::SetComplete()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLStyleSheet::GetParentSheet(nsIStyleSheet*& aParent) const
|
||||
already_AddRefed<nsIStyleSheet>
|
||||
nsHTMLStyleSheet::GetParentSheet() const
|
||||
{
|
||||
aParent = nsnull;
|
||||
return NS_OK;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLStyleSheet::GetOwningDocument(nsIDocument*& aDocument) const
|
||||
already_AddRefed<nsIDocument>
|
||||
nsHTMLStyleSheet::GetOwningDocument() const
|
||||
{
|
||||
aDocument = mDocument;
|
||||
NS_IF_ADDREF(aDocument);
|
||||
return NS_OK;
|
||||
NS_IF_ADDREF(mDocument);
|
||||
return mDocument;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsHTMLStyleSheet::SetOwningDocument(nsIDocument* aDocument)
|
||||
{
|
||||
mDocument = aDocument; // not refcounted
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -61,18 +61,18 @@ public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIStyleSheet api
|
||||
NS_IMETHOD GetSheetURI(nsIURI** aSheetURL) const;
|
||||
NS_IMETHOD GetBaseURI(nsIURI** aBaseURL) const;
|
||||
NS_IMETHOD GetTitle(nsString& aTitle) const;
|
||||
NS_IMETHOD GetType(nsString& aType) const;
|
||||
NS_IMETHOD_(PRBool) HasRules() const;
|
||||
NS_IMETHOD GetApplicable(PRBool& aApplicable) const;
|
||||
NS_IMETHOD SetEnabled(PRBool aEnabled);
|
||||
NS_IMETHOD GetComplete(PRBool& aComplete) const;
|
||||
NS_IMETHOD SetComplete();
|
||||
NS_IMETHOD GetParentSheet(nsIStyleSheet*& aParent) const; // will be null
|
||||
NS_IMETHOD GetOwningDocument(nsIDocument*& aDocument) const;
|
||||
NS_IMETHOD SetOwningDocument(nsIDocument* aDocumemt);
|
||||
virtual already_AddRefed<nsIURI> GetSheetURI() const;
|
||||
virtual already_AddRefed<nsIURI> GetBaseURI() const;
|
||||
virtual void GetTitle(nsString& aTitle) const;
|
||||
virtual void GetType(nsString& aType) const;
|
||||
virtual PRBool HasRules() const;
|
||||
virtual PRBool GetApplicable() const;
|
||||
virtual void SetEnabled(PRBool aEnabled);
|
||||
virtual PRBool GetComplete() const;
|
||||
virtual void SetComplete();
|
||||
virtual already_AddRefed<nsIStyleSheet> GetParentSheet() const; // will be null
|
||||
virtual already_AddRefed<nsIDocument> GetOwningDocument() const;
|
||||
virtual void SetOwningDocument(nsIDocument* aDocumemt);
|
||||
#ifdef DEBUG
|
||||
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
#endif
|
||||
|
@ -46,19 +46,16 @@
|
||||
#include <stdio.h>
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsString;
|
||||
class nsIURI;
|
||||
class nsIStyleRule;
|
||||
class nsIContent;
|
||||
class nsIDocument;
|
||||
class nsIStyleRuleProcessor;
|
||||
template<class T> struct already_AddRefed;
|
||||
|
||||
// IID for the nsIStyleSheet interface
|
||||
// 7b2d31da-c3fb-4537-bd97-337272b83568
|
||||
// 0304a68a-3ab2-413e-9979-a256b3416caa
|
||||
#define NS_ISTYLE_SHEET_IID \
|
||||
{ 0x7b2d31da, 0xc3fb, 0x4537, \
|
||||
{ 0xbd, 0x97, 0x33, 0x72, 0x72, 0xb8, 0x35, 0x68 } }
|
||||
{ 0x0304a68a, 0x3ab2, 0x413e, \
|
||||
{ 0x99, 0x79, 0xa2, 0x56, 0xb3, 0x41, 0x6c, 0xaa } }
|
||||
|
||||
/**
|
||||
* A style sheet is a thing associated with a document that has style
|
||||
@ -73,11 +70,11 @@ public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISTYLE_SHEET_IID)
|
||||
|
||||
// basic style sheet data
|
||||
NS_IMETHOD GetSheetURI(nsIURI** aSheetURI) const = 0;
|
||||
NS_IMETHOD GetBaseURI(nsIURI** aBaseURI) const = 0;
|
||||
NS_IMETHOD GetTitle(nsString& aTitle) const = 0;
|
||||
NS_IMETHOD GetType(nsString& aType) const = 0;
|
||||
NS_IMETHOD_(PRBool) HasRules() const = 0;
|
||||
virtual already_AddRefed<nsIURI> GetSheetURI() const = 0;
|
||||
virtual already_AddRefed<nsIURI> GetBaseURI() const = 0;
|
||||
virtual void GetTitle(nsString& aTitle) const = 0;
|
||||
virtual void GetType(nsString& aType) const = 0;
|
||||
virtual PRBool HasRules() const = 0;
|
||||
|
||||
/**
|
||||
* Whether the sheet is applicable. A sheet that is not applicable
|
||||
@ -86,7 +83,7 @@ public:
|
||||
* being incomplete.
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetApplicable(PRBool& aApplicable) const = 0;
|
||||
virtual PRBool GetApplicable() const = 0;
|
||||
|
||||
/**
|
||||
* Set the stylesheet to be enabled. This may or may not make it
|
||||
@ -97,18 +94,18 @@ public:
|
||||
* batched updates are desired. If you want updates handled for
|
||||
* you, see nsIDOMStyleSheet::SetDisabled().
|
||||
*/
|
||||
NS_IMETHOD SetEnabled(PRBool aEnabled) = 0;
|
||||
virtual void SetEnabled(PRBool aEnabled) = 0;
|
||||
|
||||
/**
|
||||
* Whether the sheet is complete.
|
||||
*/
|
||||
NS_IMETHOD GetComplete(PRBool& aComplete) const = 0;
|
||||
NS_IMETHOD SetComplete() = 0;
|
||||
virtual PRBool GetComplete() const = 0;
|
||||
virtual void SetComplete() = 0;
|
||||
|
||||
// style sheet owner info
|
||||
NS_IMETHOD GetParentSheet(nsIStyleSheet*& aParent) const = 0; // may be null
|
||||
NS_IMETHOD GetOwningDocument(nsIDocument*& aDocument) const = 0; // may be null
|
||||
NS_IMETHOD SetOwningDocument(nsIDocument* aDocument) = 0;
|
||||
virtual already_AddRefed<nsIStyleSheet> GetParentSheet() const = 0; // may be null
|
||||
virtual already_AddRefed<nsIDocument> GetOwningDocument() const = 0; // may be null
|
||||
virtual void SetOwningDocument(nsIDocument* aDocument) = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const = 0;
|
||||
|
@ -235,22 +235,12 @@ nsStyleSet::GatherRuleProcessors(sheetType aType)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
#define CHECK_APPLICABLE \
|
||||
PR_BEGIN_MACRO \
|
||||
PRBool applicable = PR_TRUE; \
|
||||
aSheet->GetApplicable(applicable); \
|
||||
NS_ASSERTION(applicable, "Inapplicable sheet being placed in style set"); \
|
||||
PR_END_MACRO
|
||||
#else
|
||||
#define CHECK_APPLICABLE
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
nsStyleSet::AppendStyleSheet(sheetType aType, nsIStyleSheet *aSheet)
|
||||
{
|
||||
NS_PRECONDITION(aSheet, "null arg");
|
||||
CHECK_APPLICABLE;
|
||||
NS_ASSERTION(aSheet->GetApplicable(),
|
||||
"Inapplicable sheet being placed in style set");
|
||||
mSheets[aType].RemoveObject(aSheet);
|
||||
if (!mSheets[aType].AppendObject(aSheet))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
@ -266,7 +256,8 @@ nsresult
|
||||
nsStyleSet::PrependStyleSheet(sheetType aType, nsIStyleSheet *aSheet)
|
||||
{
|
||||
NS_PRECONDITION(aSheet, "null arg");
|
||||
CHECK_APPLICABLE;
|
||||
NS_ASSERTION(aSheet->GetApplicable(),
|
||||
"Inapplicable sheet being placed in style set");
|
||||
mSheets[aType].RemoveObject(aSheet);
|
||||
if (!mSheets[aType].InsertObjectAt(aSheet, 0))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
@ -282,11 +273,8 @@ nsresult
|
||||
nsStyleSet::RemoveStyleSheet(sheetType aType, nsIStyleSheet *aSheet)
|
||||
{
|
||||
NS_PRECONDITION(aSheet, "null arg");
|
||||
#ifdef DEBUG
|
||||
PRBool complete = PR_TRUE;
|
||||
aSheet->GetComplete(complete);
|
||||
NS_ASSERTION(complete, "Incomplete sheet being removed from style set");
|
||||
#endif
|
||||
NS_ASSERTION(aSheet->GetComplete(),
|
||||
"Incomplete sheet being removed from style set");
|
||||
mSheets[aType].RemoveObject(aSheet);
|
||||
if (!mBatching)
|
||||
return GatherRuleProcessors(aType);
|
||||
@ -337,7 +325,8 @@ nsresult
|
||||
nsStyleSet::AddDocStyleSheet(nsIStyleSheet* aSheet, nsIDocument* aDocument)
|
||||
{
|
||||
NS_PRECONDITION(aSheet && aDocument, "null arg");
|
||||
CHECK_APPLICABLE;
|
||||
NS_ASSERTION(aSheet->GetApplicable(),
|
||||
"Inapplicable sheet being placed in style set");
|
||||
|
||||
nsCOMArray<nsIStyleSheet>& docSheets = mSheets[eDocSheet];
|
||||
|
||||
@ -361,8 +350,6 @@ nsStyleSet::AddDocStyleSheet(nsIStyleSheet* aSheet, nsIDocument* aDocument)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#undef CHECK_APPLICABLE
|
||||
|
||||
// Batching
|
||||
void
|
||||
nsStyleSet::BeginUpdate()
|
||||
|
Loading…
Reference in New Issue
Block a user