From 78f820bd79664176167c49ab5c3a951a5bd7cad2 Mon Sep 17 00:00:00 2001 From: Benjamin Stover Date: Thu, 19 Aug 2010 16:28:44 -0700 Subject: [PATCH] fix keyboard and mouse, and remove more tile cruft --- mobile/chrome/content/AnimatedZoom.js | 3 + mobile/chrome/content/BrowserView.js | 1 - mobile/chrome/content/InputHandler.js | 4 +- mobile/chrome/content/browser-ui.js | 4 - mobile/chrome/content/browser.js | 121 +++++--------------------- mobile/chrome/content/content.js | 2 +- mobile/themes/core/browser.css | 5 -- 7 files changed, 26 insertions(+), 114 deletions(-) diff --git a/mobile/chrome/content/AnimatedZoom.js b/mobile/chrome/content/AnimatedZoom.js index 3d45eb053d4e..c01477da4c05 100644 --- a/mobile/chrome/content/AnimatedZoom.js +++ b/mobile/chrome/content/AnimatedZoom.js @@ -49,6 +49,7 @@ let Cu = Components.utils; * @param aZoomRect Optional. Zoom rectangle to be configured */ function AnimatedZoom(aBrowserView) { + return; this.bv = aBrowserView; // Render a snapshot of the viewport contents around the visible rect @@ -104,6 +105,7 @@ AnimatedZoom.createCanvas = function(aRemote) { AnimatedZoom.prototype.startAnimation = function() { + return; // stop live rendering during zooming this.bv.pauseRendering(); @@ -230,6 +232,7 @@ AnimatedZoom.prototype._callback = function() { /** Stop animation, zoom to point, and clean up. */ AnimatedZoom.prototype.finish = function() { + return; try { // resume live rendering this.bv.resumeRendering(true); diff --git a/mobile/chrome/content/BrowserView.js b/mobile/chrome/content/BrowserView.js index d45768f2de83..206262d6df15 100644 --- a/mobile/chrome/content/BrowserView.js +++ b/mobile/chrome/content/BrowserView.js @@ -412,7 +412,6 @@ BrowserView.prototype = { let scaley = (destHeight / srcRect.height) || 1; srcRect.restrictTo(bvs.viewportRect); - this._tileManager.renderRectToCanvas(srcRect, destCanvas, scalex, scaley); }, viewportToBrowser: function viewportToBrowser(x) { diff --git a/mobile/chrome/content/InputHandler.js b/mobile/chrome/content/InputHandler.js index 796f8f64aa7c..d8001341c77b 100644 --- a/mobile/chrome/content/InputHandler.js +++ b/mobile/chrome/content/InputHandler.js @@ -561,7 +561,7 @@ MouseModule.prototype = { * Check if the event concern the browser content */ _targetIsContent: function _targetIsContent(aEvent) { - return aEvent.view !== window; + return aEvent.view !== window || aEvent.target.tagName == "browser"; }, /** @@ -1296,7 +1296,7 @@ GestureModule.prototype = { this._owner.grab(this); // hide element highlight - document.getElementById("tile-container").customClicker.panBegin(); + //document.getElementById("tile-container").customClicker.panBegin(); // create the AnimatedZoom object for fast arbitrary zooming this._pinchZoom = new AnimatedZoom(bv); diff --git a/mobile/chrome/content/browser-ui.js b/mobile/chrome/content/browser-ui.js index b89a34f572f4..acfb8106371f 100644 --- a/mobile/chrome/content/browser-ui.js +++ b/mobile/chrome/content/browser-ui.js @@ -1442,7 +1442,6 @@ var FindHelperUI = { show: function findHelperShow() { BrowserUI.pushPopup(this, this._container); - Browser._browserView.ignorePageScroll(true); this._container.show(this); this.search(""); this._textbox.focus(); @@ -1450,7 +1449,6 @@ var FindHelperUI = { hide: function findHelperHide() { BrowserUI.popPopup(); - Browser._browserView.ignorePageScroll(false); this._textbox.value = ""; this._container.hide(this); }, @@ -1609,8 +1607,6 @@ var FormHelperUI = { if (aVal == this._open) return; - let bv = Browser._browserView; - bv.ignorePageScroll(aVal); this._container.hidden = !aVal; if (aVal) { diff --git a/mobile/chrome/content/browser.js b/mobile/chrome/content/browser.js index f7436c7e3b91..818155b9930d 100644 --- a/mobile/chrome/content/browser.js +++ b/mobile/chrome/content/browser.js @@ -70,66 +70,6 @@ XPCOMUtils.defineLazyServiceGetter(this, "CrashReporter", const endl = '\n'; -function debug() { - let bv = Browser._browserView; - let tc = bv._tileManager._tileCache; - let scrollbox = document.getElementById("content-scrollbox") - .boxObject.QueryInterface(Ci.nsIScrollBoxObject); - - let x = {}; - let y = {}; - let w = {}; - let h = {}; - scrollbox.getPosition(x, y); - scrollbox.getScrolledSize(w, h); - let container = document.getElementById("tile-container"); - let [x, y] = [x.value, y.value]; - let [w, h] = [w.value, h.value]; - if (bv) { - dump('----------------------DEBUG!-------------------------\n'); - dump(bv._browserViewportState.toString() + endl); - - dump(endl); - - dump('location from Browser: ' + Browser.selectedBrowser.currentURI.spec + endl); - dump('location from BV : ' + bv.getBrowser().currentURI.spec + endl); - - dump(endl + endl); - - let cr = bv._tileManager._criticalRect; - dump('criticalRect from BV: ' + (cr ? cr.toString() : null) + endl); - dump('visibleRect from BV : ' + bv.getVisibleRect().toString() + endl); - dump('visibleRect from foo: ' + Browser.getVisibleRect().toString() + endl); - - dump('bv batchops depth: ' + bv._batchOps.length + endl); - dump('renderpause depth: ' + bv._renderMode + endl); - - dump(endl); - - dump('window.innerWidth : ' + window.innerWidth + endl); - dump('window.innerHeight: ' + window.innerHeight + endl); - - dump(endl); - - dump('container width,height from BV: ' + bv._container.style.width + ', ' - + bv._container.style.height + endl); - dump('container width,height via DOM: ' + container.style.width + ', ' - + container.style.height + endl); - - dump(endl); - - dump('scrollbox position : ' + x + ', ' + y + endl); - dump('scrollbox scrolledsize: ' + w + ', ' + h + endl); - - - let sb = document.getElementById("content-scrollbox"); - dump('container location: ' + Math.round(container.getBoundingClientRect().left) + " " + - Math.round(container.getBoundingClientRect().top) + endl); - - dump(endl); - } -} - function onDebugKeyPress(ev) { let bv = Browser._browserView; @@ -138,8 +78,8 @@ function onDebugKeyPress(ev) { // use capitals so we require SHIFT here too - const a = 65; // debug all critical tiles - const b = 66; // dump an ASCII graphic of the tile map + const a = 65; + const b = 66; const c = 67; const d = 68; // debug dump const e = 69; @@ -153,12 +93,12 @@ function onDebugKeyPress(ev) { const m = 77; // fix mouseout const n = 78; const o = 79; - const p = 80; // debug tiles in pool order + const p = 80; const q = 81; // toggle orientation const r = 82; // reset visible rect const s = 83; const t = 84; - const u = 85; // debug given list of tiles separated by space + const u = 85; const v = 86; const w = 87; const x = 88; @@ -169,25 +109,6 @@ function onDebugKeyPress(ev) { case f: MemoryObserver.observe(); dump("Forced a GC\n"); - break; - case d: - debug(); - break; - case a: - let cr = bv._tileManager._criticalRect; - dump('>>>>>> critical rect is ' + (cr ? cr.toString() : cr) + '\n'); - if (cr) { - let starti = cr.left >> kTileExponentWidth; - let endi = cr.right >> kTileExponentWidth; - - let startj = cr.top >> kTileExponentHeight; - let endj = cr.bottom >> kTileExponentHeight; - - for (var jj = startj; jj <= endj; ++jj) - for (var ii = starti; ii <= endi; ++ii) - debugTile(ii, jj); - } - break; case i: window.infoMode = !window.infoMode; @@ -240,11 +161,14 @@ var Browser = { let container = document.getElementById("browsers"); let bv = this._browserView = new BrowserView(container, Browser.getVisibleRect); - /* handles dispatching clicks on tiles into clicks in content or zooms */ + /* handles dispatching clicks on browser into clicks in content or zooms */ container.customClicker = new ContentCustomClicker(bv); container.customKeySender = new ContentCustomKeySender(bv); container.customDragger = new Browser.MainDragger(bv); + // Warning, total hack ahead. All of the real-browser related scrolling code + // lies in a pretend scrollbox here. Let's not land this as-is. Maybe it's time + // to redo all the dragging code. this.contentScrollbox = container; this.contentScrollboxScroller = { position: new Point(0, 0), @@ -1065,10 +989,6 @@ var Browser = { let scrollX = rect.left * zoomRatio; let scrollY = rect.top * zoomRatio; - // The order of operations below is important for artifacting and for performance. Important - // side effects of functions are noted below. - - // Critical rect changes when controls are hidden. Must hide before tilemanager viewport. this.hideSidebars(); this.hideTitlebar(); @@ -1147,7 +1067,7 @@ var Browser = { /** * Return the visible rect in coordinates with origin at the (left, top) of - * the tile container, i.e. BrowserView coordinates. + * the browser container, i.e. BrowserView coordinates. */ getVisibleRect: function getVisibleRect() { let stack = document.getElementById("tile-stack"); @@ -1465,42 +1385,41 @@ ContentCustomClicker.prototype = { }, mouseDown: function mouseDown(aX, aY) { -// XXX disable highlight for now -/* // Ensure that the content process has gets an activate event + // Ensure that the content process has gets an activate event let browser = this._browserView.getBrowser(); let fl = browser.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader; + browser.focus(); try { fl.activateRemoteFrame(); - } catch (e) {} - this._dispatchMouseEvent("Browser:MouseDown", aX, aY); */ + } catch (e) { + } + this._dispatchMouseEvent("Browser:MouseDown", aX, aY); }, mouseUp: function mouseUp(aX, aY) { }, panBegin: function panBegin() { -// XXX -/* TapHighlightHelper.hide(); + TapHighlightHelper.hide(); - this._dispatchMouseEvent("Browser:MouseCancel"); */ + this._dispatchMouseEvent("Browser:MouseCancel"); }, singleClick: function singleClick(aX, aY, aModifiers) { -// XXX -/* TapHighlightHelper.hide(); + TapHighlightHelper.hide(); // Cancel the mouse click if we are showing a context menu if (!ContextHelper.popupState) this._dispatchMouseEvent("Browser:MouseUp", aX, aY, aModifiers); - this._dispatchMouseEvent("Browser:MouseCancel"); */ + this._dispatchMouseEvent("Browser:MouseCancel"); }, doubleClick: function doubleClick(aX1, aY1, aX2, aY2) { -/* TapHighlightHelper.hide(); + TapHighlightHelper.hide(); this._dispatchMouseEvent("Browser:MouseCancel"); - const kDoubleClickRadius = 32; +/* const kDoubleClickRadius = 32; let maxRadius = kDoubleClickRadius * Browser._browserView.getZoomLevel(); let isClickInRadius = (Math.abs(aX1 - aX2) < maxRadius && Math.abs(aY1 - aY2) < maxRadius); diff --git a/mobile/chrome/content/content.js b/mobile/chrome/content/content.js index 2167378d69c8..5e2efbaa4772 100644 --- a/mobile/chrome/content/content.js +++ b/mobile/chrome/content/content.js @@ -431,12 +431,12 @@ Content.prototype = { case "Browser:MouseDown": this._overlayTimeout.clear(); - this._overlayTimeout.clear(); let element = elementFromPoint(x, y); if (!element) return; +// XXX somehow this always take up the entire screen /* if (element.mozMatchesSelector("*:link,*:visited,*:link *,*:visited *,*[role=button],button,input,option,select,textarea,label")) { this._overlayTimeout.once(kTapOverlayTimeout, function() { let rects = getContentClientRects(element); diff --git a/mobile/themes/core/browser.css b/mobile/themes/core/browser.css index c49da6d89bfc..8426638153e4 100644 --- a/mobile/themes/core/browser.css +++ b/mobile/themes/core/browser.css @@ -35,11 +35,6 @@ * * ***** END LICENSE BLOCK ***** */ -/* browser area -------------------------------------------------- */ -#tile-container { - background-image: url("chrome://browser/content/checkerboard.png"); -} - /* main toolbar (URL bar) -------------------------------------------------- */ #toolbar-main { -moz-appearance: none;