I ran into this problem too, and I found a better solution:
For an element called an "element":
boolean visible = UIObject.isVisible(element) && (element.getAbsoluteLeft() > 0) && (element.getAbsoluteTop() > 0);
The static "isVisible" method in a UIObject will check for a none display and such things, while the AbsoluteLeft and AbsoluteTop checks should handle the gap. The reason I found that the last checks were necessary was because if the element is disconnected from the DOM (and therefore does not appear on the page), the GWT will still tell you that its visibility is true if its visibility is not explicitly set To false.
Note. You can replace the AbsoluteTop and AbsoluteLeft checks with a check for the width and height of the offset, as suggested by Simon, but you should also enable the isVisible check, in my opinion.
source share