mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 23:08:39 +09:00
Issue #2112 - Part 5: Remove Servo from forwarding code used by magic pointer classes
This commit is contained in:
parent
b1c9206051
commit
a93a7bed47
52 changed files with 274 additions and 1116 deletions
|
|
@ -1130,10 +1130,6 @@ Loader::CreateSheet(nsIURI* aURI,
|
|||
}
|
||||
|
||||
if (sheet) {
|
||||
if (sheet->IsServo()) {
|
||||
MOZ_CRASH("stylo: can't clone ServoStyleSheets yet");
|
||||
}
|
||||
|
||||
// This sheet came from the XUL cache or our per-document hashtable; it
|
||||
// better be a complete sheet.
|
||||
NS_ASSERTION(sheet->AsGecko()->IsComplete(),
|
||||
|
|
@ -1193,9 +1189,6 @@ Loader::CreateSheet(nsIURI* aURI,
|
|||
|
||||
if (sheet) {
|
||||
// The sheet we have now should be either incomplete or unmodified
|
||||
if (sheet->IsServo()) {
|
||||
MOZ_CRASH("stylo: can't clone ServoStyleSheets yet");
|
||||
}
|
||||
NS_ASSERTION(!sheet->AsGecko()->IsModified() ||
|
||||
!sheet->AsGecko()->IsComplete(),
|
||||
"Unexpected modified complete sheet");
|
||||
|
|
@ -1252,11 +1245,7 @@ Loader::CreateSheet(nsIURI* aURI,
|
|||
&sriMetadata);
|
||||
}
|
||||
|
||||
if (GetStyleBackendType() == StyleBackendType::Gecko) {
|
||||
*aSheet = new CSSStyleSheet(aParsingMode, aCORSMode, aReferrerPolicy, sriMetadata);
|
||||
} else {
|
||||
*aSheet = new ServoStyleSheet(aParsingMode, aCORSMode, aReferrerPolicy, sriMetadata);
|
||||
}
|
||||
*aSheet = new CSSStyleSheet(aParsingMode, aCORSMode, aReferrerPolicy, sriMetadata);
|
||||
(*aSheet)->SetURIs(sheetURI, originalURI, baseURI);
|
||||
}
|
||||
|
||||
|
|
@ -1283,12 +1272,6 @@ Loader::PrepareSheet(StyleSheet* aSheet,
|
|||
{
|
||||
NS_PRECONDITION(aSheet, "Must have a sheet!");
|
||||
|
||||
// XXXheycam Need to set media, title, etc. on ServoStyleSheets.
|
||||
if (aSheet->IsServo()) {
|
||||
NS_WARNING("stylo: should set metadata on ServoStyleSheets. See bug 1290209.");
|
||||
return;
|
||||
}
|
||||
|
||||
CSSStyleSheet* sheet = aSheet->AsGecko();
|
||||
|
||||
RefPtr<nsMediaList> mediaList(aMediaList);
|
||||
|
|
@ -1414,12 +1397,6 @@ Loader::InsertChildSheet(StyleSheet* aSheet,
|
|||
NS_PRECONDITION(aParentSheet, "Need a parent to insert into");
|
||||
NS_PRECONDITION(aParentSheet, "How did we get imported?");
|
||||
|
||||
// XXXheycam The InsertChildSheet API doesn't work with ServoStyleSheets,
|
||||
// since they won't have Gecko ImportRules in them.
|
||||
if (aSheet->IsServo()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// child sheets should always start out enabled, even if they got
|
||||
// cloned off of top-level sheets which were disabled
|
||||
aSheet->AsGecko()->SetEnabled(true);
|
||||
|
|
@ -1766,17 +1743,10 @@ Loader::ParseSheet(const nsAString& aInput,
|
|||
|
||||
nsresult rv;
|
||||
|
||||
if (aLoadData->mSheet->IsGecko()) {
|
||||
nsCSSParser parser(this, aLoadData->mSheet->AsGecko());
|
||||
rv = parser.ParseSheet(aInput, sheetURI, baseURI,
|
||||
aLoadData->mSheet->Principal(),
|
||||
aLoadData->mLineNumber);
|
||||
} else {
|
||||
rv =
|
||||
aLoadData->mSheet->AsServo()->ParseSheet(aInput, sheetURI, baseURI,
|
||||
aLoadData->mSheet->Principal(),
|
||||
aLoadData->mLineNumber);
|
||||
}
|
||||
nsCSSParser parser(this, aLoadData->mSheet->AsGecko());
|
||||
rv = parser.ParseSheet(aInput, sheetURI, baseURI,
|
||||
aLoadData->mSheet->Principal(),
|
||||
aLoadData->mLineNumber);
|
||||
|
||||
mParsingDatas.RemoveElementAt(mParsingDatas.Length() - 1);
|
||||
|
||||
|
|
@ -1813,10 +1783,6 @@ Loader::SheetComplete(SheetLoadData* aLoadData, nsresult aStatus)
|
|||
{
|
||||
LOG(("css::Loader::SheetComplete"));
|
||||
|
||||
if (aLoadData->mSheet->IsServo() && NS_FAILED(aStatus)) {
|
||||
aLoadData->mSheet->AsServo()->LoadFailed();
|
||||
}
|
||||
|
||||
// 8 is probably big enough for all our common cases. It's not likely that
|
||||
// imports will nest more than 8 deep, and multiple sheets with the same URI
|
||||
// are rare.
|
||||
|
|
@ -1893,8 +1859,7 @@ Loader::DoSheetComplete(SheetLoadData* aLoadData, nsresult aStatus,
|
|||
// If mSheetAlreadyComplete, then the sheet could well be modified between
|
||||
// when we posted the async call to SheetComplete and now, since the sheet
|
||||
// was page-accessible during that whole time.
|
||||
MOZ_ASSERT(!(data->mSheet->IsGecko() &&
|
||||
data->mSheet->AsGecko()->IsModified()),
|
||||
MOZ_ASSERT(!data->mSheet->AsGecko()->IsModified(),
|
||||
"should not get marked modified during parsing");
|
||||
data->mSheet->SetComplete();
|
||||
data->ScheduleLoadEventIfNeeded(aStatus);
|
||||
|
|
@ -1935,43 +1900,38 @@ Loader::DoSheetComplete(SheetLoadData* aLoadData, nsresult aStatus,
|
|||
// one of the sheets that will be kept alive by a document or
|
||||
// parent sheet anyway, so that if someone then accesses it via
|
||||
// CSSOM we won't have extra clones of the inner lying around.
|
||||
if (aLoadData->mSheet->IsGecko()) {
|
||||
data = aLoadData;
|
||||
CSSStyleSheet* sheet = aLoadData->mSheet->AsGecko();
|
||||
while (data) {
|
||||
if (data->mSheet->GetParentSheet() || data->mSheet->GetOwnerNode()) {
|
||||
sheet = data->mSheet->AsGecko();
|
||||
break;
|
||||
}
|
||||
data = data->mNext;
|
||||
data = aLoadData;
|
||||
CSSStyleSheet* sheet = aLoadData->mSheet->AsGecko();
|
||||
while (data) {
|
||||
if (data->mSheet->GetParentSheet() || data->mSheet->GetOwnerNode()) {
|
||||
sheet = data->mSheet->AsGecko();
|
||||
break;
|
||||
}
|
||||
#ifdef MOZ_XUL
|
||||
if (IsChromeURI(aLoadData->mURI)) {
|
||||
nsXULPrototypeCache* cache = nsXULPrototypeCache::GetInstance();
|
||||
if (cache && cache->IsEnabled()) {
|
||||
if (!cache->GetStyleSheet(aLoadData->mURI)) {
|
||||
LOG((" Putting sheet in XUL prototype cache"));
|
||||
NS_ASSERTION(sheet->IsComplete(),
|
||||
"Should only be caching complete sheets");
|
||||
cache->PutStyleSheet(sheet);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
#endif
|
||||
URIPrincipalReferrerPolicyAndCORSModeHashKey key(aLoadData->mURI,
|
||||
aLoadData->mLoaderPrincipal,
|
||||
aLoadData->mSheet->GetCORSMode(),
|
||||
aLoadData->mSheet->GetReferrerPolicy());
|
||||
NS_ASSERTION(sheet->IsComplete(),
|
||||
"Should only be caching complete sheets");
|
||||
mSheets->mCompleteSheets.Put(&key, sheet);
|
||||
#ifdef MOZ_XUL
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
NS_WARNING("stylo: Stylesheet caching not yet supported - see bug 1290218.");
|
||||
data = data->mNext;
|
||||
}
|
||||
#ifdef MOZ_XUL
|
||||
if (IsChromeURI(aLoadData->mURI)) {
|
||||
nsXULPrototypeCache* cache = nsXULPrototypeCache::GetInstance();
|
||||
if (cache && cache->IsEnabled()) {
|
||||
if (!cache->GetStyleSheet(aLoadData->mURI)) {
|
||||
LOG((" Putting sheet in XUL prototype cache"));
|
||||
NS_ASSERTION(sheet->IsComplete(),
|
||||
"Should only be caching complete sheets");
|
||||
cache->PutStyleSheet(sheet);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
URIPrincipalReferrerPolicyAndCORSModeHashKey key(aLoadData->mURI,
|
||||
aLoadData->mLoaderPrincipal,
|
||||
aLoadData->mSheet->GetCORSMode(),
|
||||
aLoadData->mSheet->GetReferrerPolicy());
|
||||
NS_ASSERTION(sheet->IsComplete(),
|
||||
"Should only be caching complete sheets");
|
||||
mSheets->mCompleteSheets.Put(&key, sheet);
|
||||
#ifdef MOZ_XUL
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_RELEASE(aLoadData); // this will release parents and siblings and all that
|
||||
|
|
@ -2258,9 +2218,6 @@ Loader::LoadChildSheet(StyleSheet* aParentSheet,
|
|||
LOG((" No parent load; must be CSSOM"));
|
||||
// No parent load data, so the sheet will need to be notified when
|
||||
// we finish, if it can be, if we do the load asynchronously.
|
||||
// XXXheycam ServoStyleSheet doesn't implement nsICSSLoaderObserver yet.
|
||||
MOZ_ASSERT(aParentSheet->IsGecko(),
|
||||
"stylo: ServoStyleSheets don't support child sheet loading yet");
|
||||
observer = aParentSheet->AsGecko();
|
||||
}
|
||||
|
||||
|
|
@ -2628,10 +2585,8 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Loader)
|
|||
!iter.Done();
|
||||
iter.Next()) {
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "Sheet cache nsCSSLoader");
|
||||
if (iter.UserData()->IsGecko()) {
|
||||
CSSStyleSheet* sheet = iter.UserData()->AsGecko();
|
||||
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIDOMCSSStyleSheet*, sheet));
|
||||
}
|
||||
CSSStyleSheet* sheet = iter.UserData()->AsGecko();
|
||||
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIDOMCSSStyleSheet*, sheet));
|
||||
}
|
||||
}
|
||||
nsTObserverArray<nsCOMPtr<nsICSSLoaderObserver>>::ForwardIterator
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue