Bug 479862 - scrollTop and scrollLeft might contain wrong values for scripts on pages [r=vingtetun]

This commit is contained in:
Mark Finkle 2011-01-19 11:45:11 -05:00
parent 178d0d74b1
commit 58eed775e2
2 changed files with 21 additions and 1 deletions

View File

@ -269,6 +269,8 @@ let DOMEvents = {
DOMEvents.init();
let ContentScroll = {
ignoreScroll: false,
init: function() {
addMessageListener("Content:ScrollTo", this);
addMessageListener("Content:ScrollBy", this);
@ -282,11 +284,21 @@ let ContentScroll = {
receiveMessage: function(aMessage) {
let json = aMessage.json;
switch (aMessage.name) {
case "Content:ScrollTo":
case "Content:ScrollTo": {
let scrollOffset = Util.getScrollOffset(content);
if (scrollOffset.x == json.x && scrollOffset.y == json.y)
return;
this.ignoreScroll = true;
content.scrollTo(json.x, json.y);
break;
}
case "Content:ScrollBy":
if (!json.dx && !json.dy)
return;
this.ignoreScroll = true;
content.scrollBy(json.dx, json.dy);
break;
@ -341,6 +353,11 @@ let ContentScroll = {
handleEvent: function(aEvent) {
switch (aEvent.type) {
case "scroll": {
if (this.ignoreScroll) {
this.ignoreScroll = false;
return;
}
let doc = aEvent.target;
if (doc != content.document)
return;

View File

@ -1176,6 +1176,9 @@ Browser.MainDragger.prototype = {
this._contentView = null;
this.dragMove(Browser.snapSidebars(), 0, scroller);
Browser.tryUnfloatToolbar();
// Update the scroll position of the content
getBrowser()._updateCSSViewport();
},
dragMove: function dragMove(dx, dy, scroller) {