Issue #2112 - Part 5: Remove Servo from forwarding code used by magic pointer classes

This commit is contained in:
FranklinDM
2024-03-25 02:02:08 +08:00
committed by roytam1
parent b1c9206051
commit a93a7bed47
52 changed files with 278 additions and 1120 deletions
+5 -43
View File
@@ -569,10 +569,6 @@ static void
VerifyStyleTree(nsPresContext* aPresContext, nsFrameManager* aFrameManager)
{
if (nsFrame::GetVerifyStyleTreeEnable()) {
if (aPresContext->RestyleManager()->IsServo()) {
NS_ERROR("stylo: cannot verify style tree with a ServoRestyleManager");
return;
}
nsIFrame* rootFrame = aFrameManager->GetRootFrame();
aPresContext->RestyleManager()->AsGecko()->DebugVerifyStyleTree(rootFrame);
}
@@ -893,8 +889,7 @@ PresShell::Init(nsIDocument* aDocument,
// Bind the context to the presentation shell.
mPresContext = aPresContext;
StyleBackendType backend = aStyleSet->IsServo() ? StyleBackendType::Servo
: StyleBackendType::Gecko;
StyleBackendType backend = StyleBackendType::Gecko;
aPresContext->AttachShell(this, backend);
// Now we can initialize the style set. Make sure to set the member before
@@ -1425,11 +1420,6 @@ PresShell::RemovePreferenceStyles()
void
PresShell::AddUserSheet(nsISupports* aSheet)
{
if (mStyleSet->IsServo()) {
NS_ERROR("stylo: nsStyleSheetService doesn't handle ServoStyleSheets yet");
return;
}
// Make sure this does what nsDocumentViewer::CreateStyleSet does wrt
// ordering. We want this new sheet to come after all the existing stylesheet
// service sheets, but before other user sheets; see nsIStyleSheetService.idl
@@ -1692,17 +1682,6 @@ PresShell::Initialize(nscoord aWidth, nscoord aHeight)
mPresContext->SetVisibleArea(nsRect(0, 0, aWidth, aHeight));
if (mStyleSet->IsServo() && mDocument->GetRootElement()) {
// If we have the root element already, go ahead style it along with any
// descendants.
//
// Some things, like nsDocumentViewer::GetPageMode, recreate the PresShell
// while keeping the content tree alive (see bug 1292280) - so we
// unconditionally mark the root as dirty.
mDocument->GetRootElement()->SetIsDirtyForServo();
mStyleSet->AsServo()->StyleDocument(/* aLeaveDirtyBits = */ false);
}
// Get the root frame from the frame manager
// XXXbz it would be nice to move this somewhere else... like frame manager
// Init(), say. But we need to make sure our views are all set up by the
@@ -4508,15 +4487,9 @@ PresShell::RecordStyleSheetChange(StyleSheet* aStyleSheet)
if (mStylesHaveChanged)
return;
if (aStyleSheet->IsGecko()) {
// XXXheycam ServoStyleSheets don't support <style scoped> yet.
Element* scopeElement = aStyleSheet->AsGecko()->GetScopeElement();
if (scopeElement) {
mChangedScopeStyleRoots.AppendElement(scopeElement);
return;
}
} else {
NS_WARNING("stylo: ServoStyleSheets don't support <style scoped>");
Element* scopeElement = aStyleSheet->AsGecko()->GetScopeElement();
if (scopeElement) {
mChangedScopeStyleRoots.AppendElement(scopeElement);
return;
}
@@ -6773,10 +6746,7 @@ FlushThrottledStyles(nsIDocument *aDocument, void *aData)
if (shell && shell->IsVisible()) {
nsPresContext* presContext = shell->GetPresContext();
if (presContext) {
if (presContext->RestyleManager()->IsGecko()) {
// XXX stylo: ServoRestyleManager doesn't support animations yet.
presContext->RestyleManager()->AsGecko()->UpdateOnlyAnimationStyles();
}
presContext->RestyleManager()->AsGecko()->UpdateOnlyAnimationStyles();
}
}
@@ -9519,10 +9489,6 @@ PresShell::Observe(nsISupports* aSubject,
nsAutoScriptBlocker scriptBlocker;
++mChangeNestCount;
RestyleManagerHandle restyleManager = mPresContext->RestyleManager();
if (restyleManager->IsServo()) {
MOZ_CRASH("stylo: PresShell::Observe(\"chrome-flush-skin-caches\") "
"not implemented for Servo-backed style system");
}
restyleManager->AsGecko()->ProcessRestyledFrames(changeList);
restyleManager->AsGecko()->FlushOverflowChangedTracker();
--mChangeNestCount;
@@ -10004,10 +9970,6 @@ PresShell::VerifyIncrementalReflow()
// Create a new presentation shell to view the document. Use the
// exact same style information that this document has.
if (mStyleSet->IsServo()) {
NS_WARNING("VerifyIncrementalReflow cannot handle ServoStyleSets");
return true;
}
nsAutoPtr<nsStyleSet> newSet(CloneStyleSet(mStyleSet->AsGecko()));
nsCOMPtr<nsIPresShell> sh = mDocument->CreateShell(cx, vm, newSet.get());
NS_ENSURE_TRUE(sh, false);