mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 12:25:53 +00:00
Bug 634386 - [RTL] Arabic pages don't render correctly [r=stechz]
This commit is contained in:
parent
a501b6f20a
commit
0f7639f3dd
@ -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;
|
||||
|
@ -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"/>
|
||||
|
||||
<!-- If this attribute is negative this indicate the document is rtl and
|
||||
some operations like panning or calculating the cache area should
|
||||
take it into account. This is useless for non-remote browser -->
|
||||
<field name="_contentDocumentLeft">0</field>
|
||||
|
||||
<!-- The ratio of device pixels to CSS pixels -->
|
||||
<property name="scale"
|
||||
onget="return 1;"
|
||||
@ -492,9 +497,6 @@
|
||||
|
||||
scrollBy: function(x, y) {
|
||||
let self = this.self;
|
||||
let position = this.getPosition();
|
||||
x = Math.floor(Math.max(0, Math.min(self.contentDocumentWidth, position.x + x)) - position.x);
|
||||
y = Math.floor(Math.max(0, Math.min(self.contentDocumentHeight, position.y + y)) - position.y);
|
||||
self.contentWindow.scrollBy(x, y);
|
||||
},
|
||||
|
||||
@ -839,9 +841,8 @@
|
||||
this._timeout = null;
|
||||
}
|
||||
|
||||
if (this._contentView && this._pixelsPannedSinceRefresh > 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)
|
||||
|
Loading…
Reference in New Issue
Block a user