Bug 1097419 - Part 1: Handle nested mozbrowser iframe for selectionstatechanged, touchcarettap, and scrollviewchange. r=kchen

This commit is contained in:
Morris Tseng 2014-12-23 01:59:00 -05:00
parent b69cec92c3
commit 3f12ad614f

View File

@ -164,17 +164,17 @@ BrowserElementChild.prototype = {
addEventListener('mozselectionstatechanged',
this._selectionStateChangedHandler.bind(this),
/* useCapture = */ false,
/* useCapture = */ true,
/* wantsUntrusted = */ false);
addEventListener('scrollviewchange',
this._ScrollViewChangeHandler.bind(this),
/* useCapture = */ false,
/* useCapture = */ true,
/* wantsUntrusted = */ false);
addEventListener('touchcarettap',
this._touchCaretTapHandler.bind(this),
/* useCapture = */ false,
/* useCapture = */ true,
/* wantsUntrusted = */ false);
@ -662,13 +662,13 @@ BrowserElementChild.prototype = {
// Get correct geometry information if we have nested iframe.
let currentWindow = e.target.defaultView;
while (currentWindow.top != currentWindow) {
let currentRect = currentWindow.frameElement.getBoundingClientRect();
while (currentWindow.realFrameElement) {
let currentRect = currentWindow.realFrameElement.getBoundingClientRect();
detail.rect.top += currentRect.top;
detail.rect.bottom += currentRect.top;
detail.rect.left += currentRect.left;
detail.rect.right += currentRect.left;
currentWindow = currentWindow.parent;
currentWindow = currentWindow.realFrameElement.ownerDocument.defaultView;
}
sendAsyncMsg('selectionstatechanged', detail);