Bug 799094 - Move text selection handles when scrolling a subdocument with a text selection. r=margaret

This commit is contained in:
Kartikaya Gupta 2012-10-18 13:41:24 -04:00
parent 86ffca961d
commit 29cbb86dd5

View File

@ -2056,6 +2056,29 @@ var SelectionHandler = {
positions: positions
}
});
},
subdocumentScrolled: function sh_subdocumentScrolled(aElement) {
if (this._activeType == this.TYPE_NONE) {
return;
}
let scrollView = aElement.ownerDocument.defaultView;
let view = this._view;
while (true) {
if (view == scrollView) {
// The selection is in a view (or sub-view) of the view that scrolled.
// So we need to reposition the handles.
if (this._activeType == this.TYPE_SELECTION) {
this.updateCacheForSelection();
}
this.positionHandles();
break;
}
if (view == view.parent) {
break;
}
view = view.parent;
}
}
};
@ -3646,6 +3669,7 @@ var BrowserEventHandler = {
if (this._elementCanScroll(this._scrollableElement, data.x, data.y)) {
this._scrollElementBy(this._scrollableElement, data.x, data.y);
sendMessageToJava({ gecko: { type: "Gesture:ScrollAck", scrolled: true } });
SelectionHandler.subdocumentScrolled(this._scrollableElement);
} else {
sendMessageToJava({ gecko: { type: "Gesture:ScrollAck", scrolled: false } });
}