Set zoom via content viewer draft
authorJan Henning <jh+bugzilla@buttercookie.de>
Mon, 26 Dec 2016 18:11:32 +0100
changeset 453936 77feac7e2be9a29440e440db51f2bfd9b23e4f15
parent 453935 140a2dfcdb13525740455d7510089d567bc7da72
child 453937 e0027a83247999dd501bb953affa481804043779
push id39769
push usermozilla@buttercookie.de
push dateMon, 26 Dec 2016 18:12:31 +0000
milestone53.0a1
Set zoom via content viewer MozReview-Commit-ID: AfAAHWgoTT4
layout/base/PresShell.cpp
--- 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;