diff --git a/mobile/chrome/content/bindings/browser.js b/mobile/chrome/content/bindings/browser.js
index 8a20156b6595..97a810d3f035 100644
--- a/mobile/chrome/content/bindings/browser.js
+++ b/mobile/chrome/content/bindings/browser.js
@@ -403,18 +403,10 @@ let ContentScroll = {
if (content != doc.defaultView) // We are only interested in root scroll pane changes
return;
- // Adjust width and height from the incoming event properties so that we
- // ignore changes to width and height contributed by growth in page
- // quadrants other than x > 0 && y > 0.
- let scrollOffset = this.getScrollOffset(content);
- let x = aEvent.x + scrollOffset.x;
- let y = aEvent.y + scrollOffset.y;
- let width = aEvent.width + (x < 0 ? x : 0);
- let height = aEvent.height + (y < 0 ? y : 0);
-
sendAsyncMessage("MozScrolledAreaChanged", {
- width: width,
- height: height
+ width: aEvent.width,
+ height: aEvent.height,
+ left: aEvent.x
});
break;
diff --git a/mobile/chrome/content/bindings/browser.xml b/mobile/chrome/content/bindings/browser.xml
index a88db16c735b..f51d7d9bde8d 100644
--- a/mobile/chrome/content/bindings/browser.xml
+++ b/mobile/chrome/content/bindings/browser.xml
@@ -115,29 +115,29 @@
break;
case "DOMTitleChanged":
- self._contentTitle = aMessage.json.title;
+ self._contentTitle = json.title;
break;
case "DOMLinkAdded":
- let link = aMessage.json;
// ignore results from subdocuments
- if (link.windowId != self.contentWindowId)
+ if (json.windowId != self.contentWindowId)
return;
- let linkType = self._getLinkType(link);
+ let linkType = self._getLinkType(json);
switch(linkType) {
case "icon":
- self.loadFavicon(link.href, link.charset);
+ self.loadFavicon(json.href, json.charset);
break;
case "search":
- self._searchEngines.push({ title: link.title, href: link.href });
+ self._searchEngines.push({ title: json.title, href: json.href });
break;
}
break;
case "MozScrolledAreaChanged":
- self._contentDocumentWidth = aMessage.json.width;
- self._contentDocumentHeight = aMessage.json.height;
+ self._contentDocumentWidth = json.width;
+ self._contentDocumentHeight = json.height;
+ self._contentDocumentLeft = (json.left < 0) ? json.left : 0;
// Recalculate whether the visible area is actually in bounds
let view = self.getRootView();
@@ -386,6 +386,11 @@
onget="return this._contentDocumentHeight;"
readonly="true"/>
+
+ 0
+
0) {
+ if (this._contentView && Math.abs(this._pixelsPannedSinceRefresh) > 0)
this._updateCacheViewport();
- }
// We expect contentViews to contain our ID. If not, something bad
// happened.
@@ -925,12 +926,14 @@
let contentSize = this._getContentSize();
// Use our pixels efficiently and don't try to cache things outside of content
- // boundaries.
- let bounds = new Rect(0, 0, contentSize.width, contentSize.height);
+ // boundaries (The left bound can be negative because of RTL).
+
+ let rootScale = self.scale;
+ let leftBound = self._contentDocumentLeft * rootScale;
+ let bounds = new Rect(leftBound, 0, contentSize.width, contentSize.height);
let displayport = new Rect(cacheX, cacheY, cacheSize.width, cacheSize.height);
displayport.translateInside(bounds);
- let rootScale = self.scale;
self.messageManager.sendAsyncMessage("Content:SetCacheViewport", {
scrollX: Math.round(scrollX) / rootScale,
scrollY: Math.round(scrollY) / rootScale,
@@ -1013,6 +1016,8 @@
},
scrollBy: function(x, y) {
+ let self = this.self;
+
// Bounding content rectangle is in device pixels
let contentView = this._contentView;
let viewportSize = this._getViewportSize();
@@ -1021,7 +1026,8 @@
let scrollRangeX = contentSize.width - viewportSize.width;
let scrollRangeY = contentSize.height - viewportSize.height;
- x = Math.floor(Math.max(0, Math.min(scrollRangeX, contentView.scrollX + x))) - contentView.scrollX;
+ let leftOffset = self._contentDocumentLeft * this._scale;
+ x = Math.floor(Math.max(leftOffset, Math.min(scrollRangeX + leftOffset, contentView.scrollX + x))) - contentView.scrollX;
y = Math.floor(Math.max(0, Math.min(scrollRangeY, contentView.scrollY + y))) - contentView.scrollY;
if (x == 0 && y == 0)