зеркало из https://github.com/mozilla/gecko-dev.git
fix keyboard and mouse, and remove more tile cruft
This commit is contained in:
Родитель
ccd05cf2f3
Коммит
78f820bd79
|
@ -49,6 +49,7 @@ let Cu = Components.utils;
|
||||||
* @param aZoomRect Optional. Zoom rectangle to be configured
|
* @param aZoomRect Optional. Zoom rectangle to be configured
|
||||||
*/
|
*/
|
||||||
function AnimatedZoom(aBrowserView) {
|
function AnimatedZoom(aBrowserView) {
|
||||||
|
return;
|
||||||
this.bv = aBrowserView;
|
this.bv = aBrowserView;
|
||||||
|
|
||||||
// Render a snapshot of the viewport contents around the visible rect
|
// Render a snapshot of the viewport contents around the visible rect
|
||||||
|
@ -104,6 +105,7 @@ AnimatedZoom.createCanvas = function(aRemote) {
|
||||||
|
|
||||||
AnimatedZoom.prototype.startAnimation = function()
|
AnimatedZoom.prototype.startAnimation = function()
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
// stop live rendering during zooming
|
// stop live rendering during zooming
|
||||||
this.bv.pauseRendering();
|
this.bv.pauseRendering();
|
||||||
|
|
||||||
|
@ -230,6 +232,7 @@ AnimatedZoom.prototype._callback = function() {
|
||||||
|
|
||||||
/** Stop animation, zoom to point, and clean up. */
|
/** Stop animation, zoom to point, and clean up. */
|
||||||
AnimatedZoom.prototype.finish = function() {
|
AnimatedZoom.prototype.finish = function() {
|
||||||
|
return;
|
||||||
try {
|
try {
|
||||||
// resume live rendering
|
// resume live rendering
|
||||||
this.bv.resumeRendering(true);
|
this.bv.resumeRendering(true);
|
||||||
|
|
|
@ -412,7 +412,6 @@ BrowserView.prototype = {
|
||||||
let scaley = (destHeight / srcRect.height) || 1;
|
let scaley = (destHeight / srcRect.height) || 1;
|
||||||
|
|
||||||
srcRect.restrictTo(bvs.viewportRect);
|
srcRect.restrictTo(bvs.viewportRect);
|
||||||
this._tileManager.renderRectToCanvas(srcRect, destCanvas, scalex, scaley);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
viewportToBrowser: function viewportToBrowser(x) {
|
viewportToBrowser: function viewportToBrowser(x) {
|
||||||
|
|
|
@ -561,7 +561,7 @@ MouseModule.prototype = {
|
||||||
* Check if the event concern the browser content
|
* Check if the event concern the browser content
|
||||||
*/
|
*/
|
||||||
_targetIsContent: function _targetIsContent(aEvent) {
|
_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);
|
this._owner.grab(this);
|
||||||
|
|
||||||
// hide element highlight
|
// hide element highlight
|
||||||
document.getElementById("tile-container").customClicker.panBegin();
|
//document.getElementById("tile-container").customClicker.panBegin();
|
||||||
|
|
||||||
// create the AnimatedZoom object for fast arbitrary zooming
|
// create the AnimatedZoom object for fast arbitrary zooming
|
||||||
this._pinchZoom = new AnimatedZoom(bv);
|
this._pinchZoom = new AnimatedZoom(bv);
|
||||||
|
|
|
@ -1442,7 +1442,6 @@ var FindHelperUI = {
|
||||||
|
|
||||||
show: function findHelperShow() {
|
show: function findHelperShow() {
|
||||||
BrowserUI.pushPopup(this, this._container);
|
BrowserUI.pushPopup(this, this._container);
|
||||||
Browser._browserView.ignorePageScroll(true);
|
|
||||||
this._container.show(this);
|
this._container.show(this);
|
||||||
this.search("");
|
this.search("");
|
||||||
this._textbox.focus();
|
this._textbox.focus();
|
||||||
|
@ -1450,7 +1449,6 @@ var FindHelperUI = {
|
||||||
|
|
||||||
hide: function findHelperHide() {
|
hide: function findHelperHide() {
|
||||||
BrowserUI.popPopup();
|
BrowserUI.popPopup();
|
||||||
Browser._browserView.ignorePageScroll(false);
|
|
||||||
this._textbox.value = "";
|
this._textbox.value = "";
|
||||||
this._container.hide(this);
|
this._container.hide(this);
|
||||||
},
|
},
|
||||||
|
@ -1609,8 +1607,6 @@ var FormHelperUI = {
|
||||||
if (aVal == this._open)
|
if (aVal == this._open)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let bv = Browser._browserView;
|
|
||||||
bv.ignorePageScroll(aVal);
|
|
||||||
this._container.hidden = !aVal;
|
this._container.hidden = !aVal;
|
||||||
|
|
||||||
if (aVal) {
|
if (aVal) {
|
||||||
|
|
|
@ -70,66 +70,6 @@ XPCOMUtils.defineLazyServiceGetter(this, "CrashReporter",
|
||||||
|
|
||||||
const endl = '\n';
|
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) {
|
function onDebugKeyPress(ev) {
|
||||||
let bv = Browser._browserView;
|
let bv = Browser._browserView;
|
||||||
|
|
||||||
|
@ -138,8 +78,8 @@ function onDebugKeyPress(ev) {
|
||||||
|
|
||||||
// use capitals so we require SHIFT here too
|
// use capitals so we require SHIFT here too
|
||||||
|
|
||||||
const a = 65; // debug all critical tiles
|
const a = 65;
|
||||||
const b = 66; // dump an ASCII graphic of the tile map
|
const b = 66;
|
||||||
const c = 67;
|
const c = 67;
|
||||||
const d = 68; // debug dump
|
const d = 68; // debug dump
|
||||||
const e = 69;
|
const e = 69;
|
||||||
|
@ -153,12 +93,12 @@ function onDebugKeyPress(ev) {
|
||||||
const m = 77; // fix mouseout
|
const m = 77; // fix mouseout
|
||||||
const n = 78;
|
const n = 78;
|
||||||
const o = 79;
|
const o = 79;
|
||||||
const p = 80; // debug tiles in pool order
|
const p = 80;
|
||||||
const q = 81; // toggle orientation
|
const q = 81; // toggle orientation
|
||||||
const r = 82; // reset visible rect
|
const r = 82; // reset visible rect
|
||||||
const s = 83;
|
const s = 83;
|
||||||
const t = 84;
|
const t = 84;
|
||||||
const u = 85; // debug given list of tiles separated by space
|
const u = 85;
|
||||||
const v = 86;
|
const v = 86;
|
||||||
const w = 87;
|
const w = 87;
|
||||||
const x = 88;
|
const x = 88;
|
||||||
|
@ -169,25 +109,6 @@ function onDebugKeyPress(ev) {
|
||||||
case f:
|
case f:
|
||||||
MemoryObserver.observe();
|
MemoryObserver.observe();
|
||||||
dump("Forced a GC\n");
|
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;
|
break;
|
||||||
case i:
|
case i:
|
||||||
window.infoMode = !window.infoMode;
|
window.infoMode = !window.infoMode;
|
||||||
|
@ -240,11 +161,14 @@ var Browser = {
|
||||||
let container = document.getElementById("browsers");
|
let container = document.getElementById("browsers");
|
||||||
let bv = this._browserView = new BrowserView(container, Browser.getVisibleRect);
|
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.customClicker = new ContentCustomClicker(bv);
|
||||||
container.customKeySender = new ContentCustomKeySender(bv);
|
container.customKeySender = new ContentCustomKeySender(bv);
|
||||||
container.customDragger = new Browser.MainDragger(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.contentScrollbox = container;
|
||||||
this.contentScrollboxScroller = {
|
this.contentScrollboxScroller = {
|
||||||
position: new Point(0, 0),
|
position: new Point(0, 0),
|
||||||
|
@ -1065,10 +989,6 @@ var Browser = {
|
||||||
let scrollX = rect.left * zoomRatio;
|
let scrollX = rect.left * zoomRatio;
|
||||||
let scrollY = rect.top * 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.hideSidebars();
|
||||||
this.hideTitlebar();
|
this.hideTitlebar();
|
||||||
|
|
||||||
|
@ -1147,7 +1067,7 @@ var Browser = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the visible rect in coordinates with origin at the (left, top) of
|
* 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() {
|
getVisibleRect: function getVisibleRect() {
|
||||||
let stack = document.getElementById("tile-stack");
|
let stack = document.getElementById("tile-stack");
|
||||||
|
@ -1465,42 +1385,41 @@ ContentCustomClicker.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
mouseDown: function mouseDown(aX, aY) {
|
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 browser = this._browserView.getBrowser();
|
||||||
let fl = browser.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader;
|
let fl = browser.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader;
|
||||||
|
browser.focus();
|
||||||
try {
|
try {
|
||||||
fl.activateRemoteFrame();
|
fl.activateRemoteFrame();
|
||||||
} catch (e) {}
|
} catch (e) {
|
||||||
this._dispatchMouseEvent("Browser:MouseDown", aX, aY); */
|
}
|
||||||
|
this._dispatchMouseEvent("Browser:MouseDown", aX, aY);
|
||||||
},
|
},
|
||||||
|
|
||||||
mouseUp: function mouseUp(aX, aY) {
|
mouseUp: function mouseUp(aX, aY) {
|
||||||
},
|
},
|
||||||
|
|
||||||
panBegin: function panBegin() {
|
panBegin: function panBegin() {
|
||||||
// XXX
|
TapHighlightHelper.hide();
|
||||||
/* TapHighlightHelper.hide();
|
|
||||||
|
|
||||||
this._dispatchMouseEvent("Browser:MouseCancel"); */
|
this._dispatchMouseEvent("Browser:MouseCancel");
|
||||||
},
|
},
|
||||||
|
|
||||||
singleClick: function singleClick(aX, aY, aModifiers) {
|
singleClick: function singleClick(aX, aY, aModifiers) {
|
||||||
// XXX
|
TapHighlightHelper.hide();
|
||||||
/* TapHighlightHelper.hide();
|
|
||||||
|
|
||||||
// Cancel the mouse click if we are showing a context menu
|
// Cancel the mouse click if we are showing a context menu
|
||||||
if (!ContextHelper.popupState)
|
if (!ContextHelper.popupState)
|
||||||
this._dispatchMouseEvent("Browser:MouseUp", aX, aY, aModifiers);
|
this._dispatchMouseEvent("Browser:MouseUp", aX, aY, aModifiers);
|
||||||
this._dispatchMouseEvent("Browser:MouseCancel"); */
|
this._dispatchMouseEvent("Browser:MouseCancel");
|
||||||
},
|
},
|
||||||
|
|
||||||
doubleClick: function doubleClick(aX1, aY1, aX2, aY2) {
|
doubleClick: function doubleClick(aX1, aY1, aX2, aY2) {
|
||||||
/* TapHighlightHelper.hide();
|
TapHighlightHelper.hide();
|
||||||
|
|
||||||
this._dispatchMouseEvent("Browser:MouseCancel");
|
this._dispatchMouseEvent("Browser:MouseCancel");
|
||||||
|
|
||||||
const kDoubleClickRadius = 32;
|
/* const kDoubleClickRadius = 32;
|
||||||
|
|
||||||
let maxRadius = kDoubleClickRadius * Browser._browserView.getZoomLevel();
|
let maxRadius = kDoubleClickRadius * Browser._browserView.getZoomLevel();
|
||||||
let isClickInRadius = (Math.abs(aX1 - aX2) < maxRadius && Math.abs(aY1 - aY2) < maxRadius);
|
let isClickInRadius = (Math.abs(aX1 - aX2) < maxRadius && Math.abs(aY1 - aY2) < maxRadius);
|
||||||
|
|
|
@ -431,12 +431,12 @@ Content.prototype = {
|
||||||
|
|
||||||
case "Browser:MouseDown":
|
case "Browser:MouseDown":
|
||||||
this._overlayTimeout.clear();
|
this._overlayTimeout.clear();
|
||||||
this._overlayTimeout.clear();
|
|
||||||
|
|
||||||
let element = elementFromPoint(x, y);
|
let element = elementFromPoint(x, y);
|
||||||
if (!element)
|
if (!element)
|
||||||
return;
|
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")) {
|
/* if (element.mozMatchesSelector("*:link,*:visited,*:link *,*:visited *,*[role=button],button,input,option,select,textarea,label")) {
|
||||||
this._overlayTimeout.once(kTapOverlayTimeout, function() {
|
this._overlayTimeout.once(kTapOverlayTimeout, function() {
|
||||||
let rects = getContentClientRects(element);
|
let rects = getContentClientRects(element);
|
||||||
|
|
|
@ -35,11 +35,6 @@
|
||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
/* browser area -------------------------------------------------- */
|
|
||||||
#tile-container {
|
|
||||||
background-image: url("chrome://browser/content/checkerboard.png");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* main toolbar (URL bar) -------------------------------------------------- */
|
/* main toolbar (URL bar) -------------------------------------------------- */
|
||||||
#toolbar-main {
|
#toolbar-main {
|
||||||
-moz-appearance: none;
|
-moz-appearance: none;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче