зеркало из https://github.com/mozilla/pjs.git
Fix for 46129. r=waterson,attinasi,pierre
This commit is contained in:
Родитель
169b89ecfe
Коммит
1436977acc
|
@ -2101,20 +2101,8 @@ void nsChromeRegistry::LoadStyleSheet(nsICSSStyleSheet** aSheet, const nsCString
|
|||
|
||||
void nsChromeRegistry::LoadStyleSheetWithURL(nsIURI* aURL, nsICSSStyleSheet** aSheet)
|
||||
{
|
||||
// Load the style sheet
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIXULPrototypeCache, xulCache, "component://netscape/rdf/xul-prototype-cache", &rv);
|
||||
|
||||
nsCOMPtr<nsICSSStyleSheet> sheet;
|
||||
rv = xulCache->GetStyleSheet(aURL, getter_AddRefs(sheet));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && sheet) {
|
||||
sheet->Clone(*aSheet);
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsICSSLoader> loader;
|
||||
rv = nsComponentManager::CreateInstance(kCSSLoaderCID,
|
||||
nsresult rv = nsComponentManager::CreateInstance(kCSSLoaderCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsICSSLoader),
|
||||
getter_AddRefs(loader));
|
||||
|
|
|
@ -875,26 +875,6 @@ XULContentSinkImpl::ProcessStyleLink(nsIContent* aElement,
|
|||
// Add the style sheet reference to the prototype
|
||||
mPrototype->AddStyleSheetReference(url);
|
||||
|
||||
// See if the style sheet is in the style sheet cache. If so,
|
||||
// just use it.
|
||||
if (gXULUtils->UseXULCache()) {
|
||||
nsCOMPtr<nsICSSStyleSheet> sheet;
|
||||
rv = gXULCache->GetStyleSheet(url, getter_AddRefs(sheet));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && sheet) {
|
||||
nsCOMPtr<nsICSSStyleSheet> newsheet;
|
||||
rv = sheet->Clone(*getter_AddRefs(newsheet));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && newsheet) {
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryReferent(mDocument);
|
||||
if (doc) {
|
||||
doc->AddStyleSheet(newsheet);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Nope, we need to load it asynchronously
|
||||
PRBool blockParser = PR_FALSE;
|
||||
if (! aAlternate) {
|
||||
|
|
|
@ -1166,15 +1166,6 @@ nsXULDocument::AddStyleSheet(nsIStyleSheet* aSheet)
|
|||
else {
|
||||
mStyleSheets.AppendElement(aSheet);
|
||||
}
|
||||
|
||||
// Put the style sheet into the XUL cache if the XUL cache is
|
||||
// actually enabled and the document is chrome.
|
||||
if (gXULUtils->UseXULCache() && IsChromeURI(mDocumentURL)) {
|
||||
nsCOMPtr<nsICSSStyleSheet> css = do_QueryInterface(aSheet);
|
||||
if (css) {
|
||||
gXULCache->PutStyleSheet(css);
|
||||
}
|
||||
}
|
||||
}
|
||||
NS_ADDREF(aSheet);
|
||||
|
||||
|
@ -1243,15 +1234,6 @@ nsXULDocument::UpdateStyleSheets(nsISupportsArray* aOldSheets, nsISupportsArray*
|
|||
else {
|
||||
mStyleSheets.AppendElement(sheet);
|
||||
}
|
||||
|
||||
// Put the style sheet into the XUL cache if the XUL cache is
|
||||
// actually enabled and the document is chrome.
|
||||
if (gXULUtils->UseXULCache() && IsChromeURI(mDocumentURL)) {
|
||||
nsCOMPtr<nsICSSStyleSheet> css = do_QueryInterface(sheet);
|
||||
if (css) {
|
||||
gXULCache->PutStyleSheet(css);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsIStyleSheet* sheetPtr = sheet;
|
||||
|
@ -1325,15 +1307,6 @@ nsXULDocument::InsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex, PRBool
|
|||
{
|
||||
NS_PRECONDITION(nsnull != aSheet, "null ptr");
|
||||
|
||||
// Put the style sheet into the XUL cache if the XUL cache is
|
||||
// actually enabled and the document is chrome.
|
||||
if (gXULUtils->UseXULCache() && IsChromeURI(mDocumentURL)) {
|
||||
nsCOMPtr<nsICSSStyleSheet> css = do_QueryInterface(aSheet);
|
||||
if (css) {
|
||||
gXULCache->PutStyleSheet(css);
|
||||
}
|
||||
}
|
||||
|
||||
mStyleSheets.InsertElementAt(aSheet, aIndex + 1); // offset by one for attribute sheet
|
||||
|
||||
NS_ADDREF(aSheet);
|
||||
|
|
|
@ -193,7 +193,7 @@ nsXULPrototypeCache::PutStyleSheet(nsICSSStyleSheet* aStyleSheet)
|
|||
|
||||
nsIURIKey key(uri);
|
||||
mStyleSheetTable.Put(&key, aStyleSheet);
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -2101,20 +2101,8 @@ void nsChromeRegistry::LoadStyleSheet(nsICSSStyleSheet** aSheet, const nsCString
|
|||
|
||||
void nsChromeRegistry::LoadStyleSheetWithURL(nsIURI* aURL, nsICSSStyleSheet** aSheet)
|
||||
{
|
||||
// Load the style sheet
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIXULPrototypeCache, xulCache, "component://netscape/rdf/xul-prototype-cache", &rv);
|
||||
|
||||
nsCOMPtr<nsICSSStyleSheet> sheet;
|
||||
rv = xulCache->GetStyleSheet(aURL, getter_AddRefs(sheet));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && sheet) {
|
||||
sheet->Clone(*aSheet);
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsICSSLoader> loader;
|
||||
rv = nsComponentManager::CreateInstance(kCSSLoaderCID,
|
||||
nsresult rv = nsComponentManager::CreateInstance(kCSSLoaderCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsICSSLoader),
|
||||
getter_AddRefs(loader));
|
||||
|
|
|
@ -875,26 +875,6 @@ XULContentSinkImpl::ProcessStyleLink(nsIContent* aElement,
|
|||
// Add the style sheet reference to the prototype
|
||||
mPrototype->AddStyleSheetReference(url);
|
||||
|
||||
// See if the style sheet is in the style sheet cache. If so,
|
||||
// just use it.
|
||||
if (gXULUtils->UseXULCache()) {
|
||||
nsCOMPtr<nsICSSStyleSheet> sheet;
|
||||
rv = gXULCache->GetStyleSheet(url, getter_AddRefs(sheet));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && sheet) {
|
||||
nsCOMPtr<nsICSSStyleSheet> newsheet;
|
||||
rv = sheet->Clone(*getter_AddRefs(newsheet));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && newsheet) {
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryReferent(mDocument);
|
||||
if (doc) {
|
||||
doc->AddStyleSheet(newsheet);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Nope, we need to load it asynchronously
|
||||
PRBool blockParser = PR_FALSE;
|
||||
if (! aAlternate) {
|
||||
|
|
|
@ -1166,15 +1166,6 @@ nsXULDocument::AddStyleSheet(nsIStyleSheet* aSheet)
|
|||
else {
|
||||
mStyleSheets.AppendElement(aSheet);
|
||||
}
|
||||
|
||||
// Put the style sheet into the XUL cache if the XUL cache is
|
||||
// actually enabled and the document is chrome.
|
||||
if (gXULUtils->UseXULCache() && IsChromeURI(mDocumentURL)) {
|
||||
nsCOMPtr<nsICSSStyleSheet> css = do_QueryInterface(aSheet);
|
||||
if (css) {
|
||||
gXULCache->PutStyleSheet(css);
|
||||
}
|
||||
}
|
||||
}
|
||||
NS_ADDREF(aSheet);
|
||||
|
||||
|
@ -1243,15 +1234,6 @@ nsXULDocument::UpdateStyleSheets(nsISupportsArray* aOldSheets, nsISupportsArray*
|
|||
else {
|
||||
mStyleSheets.AppendElement(sheet);
|
||||
}
|
||||
|
||||
// Put the style sheet into the XUL cache if the XUL cache is
|
||||
// actually enabled and the document is chrome.
|
||||
if (gXULUtils->UseXULCache() && IsChromeURI(mDocumentURL)) {
|
||||
nsCOMPtr<nsICSSStyleSheet> css = do_QueryInterface(sheet);
|
||||
if (css) {
|
||||
gXULCache->PutStyleSheet(css);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsIStyleSheet* sheetPtr = sheet;
|
||||
|
@ -1325,15 +1307,6 @@ nsXULDocument::InsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex, PRBool
|
|||
{
|
||||
NS_PRECONDITION(nsnull != aSheet, "null ptr");
|
||||
|
||||
// Put the style sheet into the XUL cache if the XUL cache is
|
||||
// actually enabled and the document is chrome.
|
||||
if (gXULUtils->UseXULCache() && IsChromeURI(mDocumentURL)) {
|
||||
nsCOMPtr<nsICSSStyleSheet> css = do_QueryInterface(aSheet);
|
||||
if (css) {
|
||||
gXULCache->PutStyleSheet(css);
|
||||
}
|
||||
}
|
||||
|
||||
mStyleSheets.InsertElementAt(aSheet, aIndex + 1); // offset by one for attribute sheet
|
||||
|
||||
NS_ADDREF(aSheet);
|
||||
|
|
|
@ -193,7 +193,7 @@ nsXULPrototypeCache::PutStyleSheet(nsICSSStyleSheet* aStyleSheet)
|
|||
|
||||
nsIURIKey key(uri);
|
||||
mStyleSheetTable.Put(&key, aStyleSheet);
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче