--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -10999,22 +10999,33 @@ nsIPresShell::HandleGlobalZoom()
}
void
nsIPresShell::SetGlobalZoom(const float& aZoomFactor)
{
MOZ_ASSERT(mPresContext, "our pres context should not be null");
PRES_LOG("%p: SetGlobalZoom: %f\n", this, aZoomFactor);
+ nsCOMPtr<nsIDocShell> docShell = mPresContext->GetDocShell();
+ if (!docShell) {
+ return;
+ }
+
+ nsCOMPtr<nsIContentViewer> cv;
+ docShell->GetContentViewer(getter_AddRefs(cv));
+ if (!cv) {
+ return;
+ }
+
if (nsLayoutUtils::BrowserGlobalZoomFull()) {
- mPresContext->SetFullZoom(aZoomFactor);
- mPresContext->SetTextZoom(1.0f);
+ cv->SetFullZoom(aZoomFactor);
+ cv->SetTextZoom(1.0f);
} else {
- mPresContext->SetFullZoom(1.0f);
- mPresContext->SetTextZoom(aZoomFactor);
+ cv->SetFullZoom(1.0f);
+ cv->SetTextZoom(aZoomFactor);
}
}
void
PresShell::PausePainting()
{
if (GetPresContext()->RefreshDriver()->GetPresContext() != GetPresContext())
return;