Reverting the previous fix to caption measurement, it caused a leak with the listeners. Change-Id: If1c06db692c0e829d91528eceb49a9a07f58ed4atags/7.4.0.alpha2
@@ -204,6 +204,13 @@ public abstract class AbstractOrderedLayoutConnector extends | |||
*/ | |||
private boolean hasChildrenWithRelativeHeight = false; | |||
/** | |||
* Keep track of whether any child has relative width. Used to determine | |||
* whether measurements are needed to make relative child widths work | |||
* together with undefined container width. | |||
*/ | |||
private boolean hasChildrenWithRelativeWidth = false; | |||
/** | |||
* Keep track of whether any child is middle aligned. Used to determine if | |||
* measurements are needed to make middle aligned children work. | |||
@@ -423,6 +430,8 @@ public abstract class AbstractOrderedLayoutConnector extends | |||
processedResponseId = lastResponseId; | |||
hasChildrenWithRelativeHeight = false; | |||
hasChildrenWithRelativeWidth = false; | |||
hasChildrenWithMiddleAlignment = false; | |||
needsExpand = getWidget().vertical ? !isUndefinedHeight() | |||
@@ -476,6 +485,9 @@ public abstract class AbstractOrderedLayoutConnector extends | |||
if (child.isRelativeHeight()) { | |||
hasChildrenWithRelativeHeight = true; | |||
} | |||
if (child.isRelativeWidth()) { | |||
hasChildrenWithRelativeWidth = true; | |||
} | |||
} | |||
if (needsFixedHeight()) { | |||
@@ -575,7 +587,7 @@ public abstract class AbstractOrderedLayoutConnector extends | |||
if (slot.hasCaption()) { | |||
slot.setCaptionResizeListener(slotCaptionResizeListener); | |||
} | |||
} else if ((child.isRelativeHeight() || child.isRelativeWidth()) | |||
} else if ((hasChildrenWithRelativeHeight || hasChildrenWithRelativeWidth) | |||
&& slot.hasCaption()) { | |||
/* | |||
* If the slot has caption, we need to listen for its size changes |
@@ -79,25 +79,6 @@ public final class Slot extends SimplePanel { | |||
} | |||
}; | |||
/* | |||
* This listener is only used to force the LayoutManager to measure the | |||
* caption size. #13741 | |||
*/ | |||
private static final ElementResizeListener CAPTION_DUMMY_LISTENER = new ElementResizeListener() { | |||
@Override | |||
public void onElementResize(ElementResizeEvent e) { | |||
// Do nothing | |||
// We must include a listener for the element so | |||
// that it gets measured during layout. | |||
// TODO Alter the way in which LayoutManager | |||
// determines which elements should be measured. | |||
// There should be an easier way to do add items | |||
// to LayoutManager.measuredNonConnectorElements | |||
// (#13792) | |||
} | |||
}; | |||
// Caption is placed after component unless there is some part which | |||
// moves it above. | |||
private CaptionPosition captionPosition = CaptionPosition.RIGHT; | |||
@@ -490,8 +471,6 @@ public final class Slot extends SimplePanel { | |||
if (captionText != null || icon != null || error != null || required) { | |||
if (caption == null) { | |||
caption = DOM.createDiv(); | |||
layout.getLayoutManager().addElementResizeListener(caption, | |||
CAPTION_DUMMY_LISTENER); | |||
captionWrap = DOM.createDiv(); | |||
captionWrap.addClassName(StyleConstants.UI_WIDGET); | |||
captionWrap.addClassName("v-has-caption"); | |||
@@ -510,8 +489,6 @@ public final class Slot extends SimplePanel { | |||
getElement().appendChild(widget.getElement()); | |||
adopt(widget); | |||
captionWrap.removeFromParent(); | |||
layout.getLayoutManager().removeElementResizeListener(caption, | |||
CAPTION_DUMMY_LISTENER); | |||
caption = null; | |||
captionWrap = null; | |||