Bug 686514 - Make ctrl-plus and ctrl-minus scale image documents. r=gavin.sharp,jonas
authorTimothy Zhu <nattofriends@gmail.com>
Wed, 16 Nov 2011 23:25:00 -0500
changeset 86410 043c16767e3355fbe6ae423d2b0e3f9e5eed0d89
parent 86400 444aae098b6a1b57178155ffba17d0689e5c4f44
child 86411 388edf50e323695b2254c775ddd63a8f23f23f50
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin
bugs686514
milestone12.0a1
Bug 686514 - Make ctrl-plus and ctrl-minus scale image documents. r=gavin.sharp,jonas
content/base/public/nsIDocument.h
content/events/src/nsEventStateManager.cpp
toolkit/content/viewZoomOverlay.js
--- a/content/base/public/nsIDocument.h
+++ b/content/base/public/nsIDocument.h
@@ -1595,16 +1595,18 @@ public:
   enum DeprecatedOperations {
 #include "nsDeprecatedOperationList.h"
     eDeprecatedOperationCount
   };
 #undef DEPRECATED_OPERATION
   void WarnOnceAbout(DeprecatedOperations aOperation);
 
   virtual void PostVisibilityUpdateEvent() = 0;
+  
+  bool IsSyntheticDocument() { return mIsSyntheticDocument; }
 
   void SetNeedLayoutFlush() {
     mNeedLayoutFlush = true;
     if (mDisplayDocument) {
       mDisplayDocument->SetNeedLayoutFlush();
     }
   }
 
--- a/content/events/src/nsEventStateManager.cpp
+++ b/content/events/src/nsEventStateManager.cpp
@@ -2511,17 +2511,17 @@ nsEventStateManager::DoScrollZoom(nsIFra
   nsIContent *content = aTargetFrame->GetContent();
   if (content &&
       !content->IsNodeOfType(nsINode::eHTML_FORM_CONTROL) &&
       !content->IsXUL())
     {
       // positive adjustment to decrease zoom, negative to increase
       PRInt32 change = (adjustment > 0) ? -1 : 1;
 
-      if (Preferences::GetBool("browser.zoom.full")) {
+      if (Preferences::GetBool("browser.zoom.full") || content->GetCurrentDoc()->IsSyntheticDocument()) {
         ChangeFullZoom(change);
       } else {
         ChangeTextSize(change);
       }
     }
 }
 
 static nsIFrame*
--- a/toolkit/content/viewZoomOverlay.js
+++ b/toolkit/content/viewZoomOverlay.js
@@ -74,32 +74,33 @@ var ZoomManager = {
 
   get zoom() {
     return this.getZoomForBrowser(getBrowser());
   },
 
   getZoomForBrowser: function ZoomManager_getZoomForBrowser(aBrowser) {
     var markupDocumentViewer = aBrowser.markupDocumentViewer;
 
-    return this.useFullZoom ? markupDocumentViewer.fullZoom
-                            : markupDocumentViewer.textZoom;
+    return this.useFullZoom || 
+      aBrowser.contentDocument.mozSyntheticDocument ?
+      markupDocumentViewer.fullZoom : markupDocumentViewer.textZoom;
   },
 
   set zoom(aVal) {
     this.setZoomForBrowser(getBrowser(), aVal);
     return aVal;
   },
 
   setZoomForBrowser: function ZoomManager_setZoomForBrowser(aBrowser, aVal) {
     if (aVal < this.MIN || aVal > this.MAX)
       throw Components.results.NS_ERROR_INVALID_ARG;
 
     var markupDocumentViewer = aBrowser.markupDocumentViewer;
 
-    if (this.useFullZoom) {
+    if (this.useFullZoom || aBrowser.contentDocument.mozSyntheticDocument) {
       markupDocumentViewer.textZoom = 1;
       markupDocumentViewer.fullZoom = aVal;
     } else {
       markupDocumentViewer.textZoom = aVal;
       markupDocumentViewer.fullZoom = 1;
     }
   },