private void ensureOffsetCalculated() {
if (anchorOffsetTop >= 0 && anchorOffsetLeft >= 0) {
return;
}
Element ancestor = getOffsetAnchestorForAnchor();
anchorOffsetTop = anchorOffsetLeft = 0;
for (Element e = anchor; e != ancestor; e = e.getOffsetParent()) {
Preconditions.checkNotNull(e, "Offset parent specified is not in ancestory chain");
anchorOffsetTop += e.getOffsetTop();
anchorOffsetLeft += e.getOffsetLeft();