[mq]: checkerboard
Bug 593310 - show checkerboard for waiting-to-be-filled regions with browser elements as browsing surface [r=mfinkle]
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -108,17 +108,17 @@ function onDebugKeyPress(ev) {
const y = 89;
const z = 90;
function doSwipe(aDirection) {
let e = document.createEvent("SimpleGestureEvent");
e.initSimpleGestureEvent("MozSwipeGesture", true, true, window, null,
0, 0, 0, 0, false, false, false, false, 0, null,
aDirection, 0);
- document.getElementById("inputhandler-overlay").dispatchEvent(e);
+ Browser.selectedTab.inputHandler.dispatchEvent(e);
}
switch (ev.charCode) {
case w:
doSwipe(Ci.nsIDOMSimpleGestureEvent.DIRECTION_UP);
break;
case s:
doSwipe(Ci.nsIDOMSimpleGestureEvent.DIRECTION_DOWN);
break;
@@ -202,22 +202,30 @@ var Browser = {
ContentTouchHandler.init();
// 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 = Elements.browsers;
this.contentScrollboxScroller = {
- scrollBy: function(x, y) {
- getBrowser().scrollBy(x, y);
+ scrollBy: function(dx, dy) {
+ getBrowser().scrollBy(dx, dy);
+
+ let scrollX = {}, scrollY = {};
+ getBrowser().getPosition(scrollX, scrollY);
+
+ let x = scrollX.value + dx;
+ let y = scrollY.value + dy;
+ document.getElementById("browsers").style.backgroundPosition = (-x % 128) + "px " + (-y % 128) + "px";
},
scrollTo: function(x, y) {
getBrowser().scrollTo(x, y);
+ document.getElementById("browsers").style.backgroundPosition = (-x % 128) + "px " + (-y % 128) + "px";
},
getPosition: function(scrollX, scrollY) {
let { x: x, y: y } = getBrowser().getPosition();
scrollX.value = x;
scrollY.value = y;
}
};