how to calculate if a component goes outside the browser client area?

I need to know if my layout goes outside the client area reliably, so I can set layout.setSizeUndefined(); to it, which enables horizontal scrollbars.
I need to do the calculation because some layouts exit the screen and some not, and I only want to apply certain extra functionality to those that exit the screen.

It looks like in the picture below


As far as I know, it is not currently possible to find this out; all the sizing stuff is done in the browser, and very little of this is communicated back to the server.