Bug 528406 - XUL files opened via Browser.addTab do not display [r=stechz]
authorVivien Nicolas <21@vingtetun.org>
Fri, 11 Dec 2009 11:35:42 -0800
changeset 65908 73f16b4596a52045e4ef7405703c30769b45cb2f
parent 65907 5978783106d8f599824b993defe569a58c682e7b
child 65909 52c10b08328c6bf2dab99e32adca47083c9ab257
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstechz
bugs528406
Bug 528406 - XUL files opened via Browser.addTab do not display [r=stechz]
mobile/chrome/content/BrowserView.js
mobile/chrome/content/browser.js
--- a/mobile/chrome/content/BrowserView.js
+++ b/mobile/chrome/content/BrowserView.js
@@ -540,17 +540,18 @@ BrowserView.prototype = {
   },
 
   _ignorePageScroll: false,
   ignorePageScroll: function ignorePageScroll(aIgnoreScroll) {
     this._ignorePageScroll = aIgnoreScroll;
   },
 
   handleMozScrolledAreaChanged: function handleMozScrolledAreaChanged(ev) {
-    let tab = Browser.getTabForDocument(ev.originalTarget);
+    let tab = Browser.getTabForDocument(ev.originalTarget) || 
+             Browser.getTabForDocument(ev.target.contentDocument);
     if (!tab)
       return;
 
     let browser = tab.browser;
     let bvs = tab.browserViewportState;
     let { x: scrollX, y: scrollY } = BrowserView.Util.getContentScrollOffset(browser);
     let x = ev.x + scrollX;
     let y = ev.y + scrollY;
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -2726,16 +2726,26 @@ Tab.prototype = {
         viewportW = viewportH * (screenW / screenH);
       } else {
         viewportW = kDefaultBrowserWidth;
         viewportH = kDefaultBrowserWidth * (screenH / screenW);
       }
       browser.className = "browser-viewport";
       browser.style.width = viewportW + "px";
       browser.style.height = viewportH + "px";
+    } else if (browser.contentDocument instanceof XULDocument) {
+       // XXX XUL documents do not receive scroll change event
+       let [w, h] = BrowserView.Util.getBrowserDimensions(browser);
+       let event = document.createEvent("Event");
+       event.initEvent("MozScrolledAreaChanged", true, false);
+       event.x = 0;
+       event.y = 0;
+       event.width = w;
+       event.height = h;
+       browser.dispatchEvent(event);
     } else {
       browser.className = "browser";
     }
 
     this.setIcon(browser.mIconURL);
     this._loading = false;
 
     if (this == Browser.selectedTab)