Bug 618975 Mobile patch r=mfinkle a=blocking-fennec

This commit is contained in:
Benjamin Stover 2011-03-08 21:32:15 -08:00
parent 83e118e1b7
commit 04b3e2145d
3 changed files with 22 additions and 5 deletions

View File

@ -301,11 +301,18 @@ let ContentScroll = {
},
getScrollOffsetForElement: function(aElement) {
return this.getScrollOffset(aElement.ownerDocument.defaultView);
if (aElement.parentNode == aElement.ownerDocument)
return this.getScrollOffset(aElement.ownerDocument.defaultView);
return { x: aElement.scrollLeft, y: aElement.scrollTop };
},
setScrollOffsetForElement: function(aElement, aLeft, aTop) {
aElement.ownerDocument.defaultView.scrollTo(aLeft, aTop);
if (aElement.parentNode == aElement.ownerDocument) {
aElement.ownerDocument.defaultView.scrollTo(aLeft, aTop);
} else {
aElement.scrollLeft = aLeft;
aElement.scrollTop = aTop;
}
},
receiveMessage: function(aMessage) {
@ -347,7 +354,8 @@ let ContentScroll = {
let win = element.ownerDocument.defaultView;
let winCwu = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
winCwu.setDisplayPort(x, y, displayport.width, displayport.height);
let winCwu20 = winCwu.QueryInterface(Ci.nsIDOMWindowUtils_MOZILLA_2_0_BRANCH);
winCwu20.setDisplayPortForElement(x, y, displayport.width, displayport.height, element);
break;
}
@ -419,7 +427,8 @@ let ContentActive = {
case "Content:Deactivate":
docShell.isActive = false;
let cwu = content.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
cwu.setDisplayPort(0,0,0,0);
let cwu20 = cwu.QueryInterface(Ci.nsIDOMWindowUtils_MOZILLA_2_0_BRANCH);
cwu20.setDisplayPortForElement(0,0,0,0,content.document.documentElement);
break;
case "Content:Activate":

View File

@ -950,7 +950,13 @@
*/
_updateCacheViewport: function() {
// Do not update scroll values for content.
this._sendDisplayportUpdate(-1, -1);
if (this.isRoot())
this._sendDisplayportUpdate(-1, -1);
else {
let contentView = this._contentView;
this._sendDisplayportUpdate(contentView.scrollX,
contentView.scrollY);
}
},
_getContentSize: function() {

View File

@ -1161,6 +1161,8 @@ Browser.MainDragger.prototype = {
},
dragStop: function dragStop(dx, dy, scroller) {
if (this._contentView && this._contentView._updateCacheViewport)
this._contentView._updateCacheViewport();
this._contentView = null;
this.dragMove(Browser.snapSidebars(), 0, scroller);
Browser.tryUnfloatToolbar();