Firefox ContentWindow

In Firefox 4, the following code appears to return incorrect coordinates and places the cursor in the wrong position:


var point = Manager.Current.ActiveBrowser.ContentWindow.Location;


Firefox 4 does not follow the standards for how a Windows application should construct its windows. The window structure is radically changed. Note the difference in window structure between Firefox versions:


Firefox 3

Firefox 4


Note that FF4 eliminated most of the out wrapping windows. This is the only browser that uses a single window for painting everything: navigation, menu, search box, DOM content, etc.


When you ask for the ContentWindow, Test Studio simply passes back the screen coordinates of the "MozillaWindowClass" window. In Firefox 3 this represented the actual content window. In Firefox 4 it is the chrome of the browser.


Use the following code as a potential work-around:


window.mozInnerScreenX, window.mozInnerScreenY