private void internalSetReference(Widget reference) { // this.reference = reference; if (reference == null || reference == RootPanel.get()) { referenceAdjustLeft = 0; referenceAdjustTop = 0; } else { referenceAdjustLeft = reference.getAbsoluteLeft() + DOMUtil.getBorderLeft(reference.getElement()); referenceAdjustTop = reference.getAbsoluteTop() + DOMUtil.getBorderTop(reference.getElement()); } }
public WidgetArea(Widget widget, Widget reference) { setLeft(widget.getAbsoluteLeft()); setTop(widget.getAbsoluteTop()); if (reference != null) { setLeft( getLeft() - reference.getAbsoluteLeft() - DOMUtil.getBorderLeft(reference.getElement())); setTop(getTop() - reference.getAbsoluteTop() - DOMUtil.getBorderTop(reference.getElement())); } setRight(getLeft() + widget.getOffsetWidth()); setBottom(getTop() + widget.getOffsetHeight()); Element elem = widget.getElement().getOffsetParent(); Element p; while (elem != null && (p = elem.getOffsetParent()) != null) { int left = elem.getAbsoluteLeft(); if (getLeft() < left) { setLeft(left); } int top = elem.getAbsoluteTop(); if (getTop() < top) { setTop(top); } int bottom = top + elem.getOffsetHeight(); if (getBottom() > bottom) { setBottom(bottom); } int right = left + elem.getOffsetWidth(); if (getRight() > right) { setRight(right); } elem = p; } }