6885735: closed/java/awt/Component/DisablingLWDisabledHW/DisablingLWDisabledHW.html fails

Use isRecursivelyVisibleUpToHeavyweightContainer() instead of isRecursivelyVisible() to determine if the peer needs to be hidden.

Reviewed-by: art, dcherepanov
This commit is contained in:
Anthony Petrov 2009-10-14 16:32:38 +04:00
parent 370b3a923b
commit b32d27a253
2 changed files with 23 additions and 9 deletions

View File

@ -6720,12 +6720,13 @@ public abstract class Component implements ImageObserver, MenuContainer,
} }
} }
} else { } else {
// It's native. If the parent is lightweight it // It's native. If the parent is lightweight it will need some
// will need some help. // help.
Container parent = this.parent; Container parent = getContainer();
if (parent != null && parent.peer instanceof LightweightPeer) { if (parent != null && parent.isLightweight()) {
relocateComponent(); relocateComponent();
if (!isRecursivelyVisible()) { if (!parent.isRecursivelyVisibleUpToHeavyweightContainer())
{
peer.setVisible(false); peer.setVisible(false);
} }
} }

View File

@ -4092,16 +4092,29 @@ public class Container extends Component {
} }
} }
/* /**
* Checks if the container and its direct lightweight containers are
* visible.
*
* Consider the heavyweight container hides or shows the HW descendants * Consider the heavyweight container hides or shows the HW descendants
* automatically. Therefore we care of LW containers' visibility only. * automatically. Therefore we care of LW containers' visibility only.
*
* This method MUST be invoked under the TreeLock.
*/ */
private boolean isRecursivelyVisibleUpToHeavyweightContainer() { final boolean isRecursivelyVisibleUpToHeavyweightContainer() {
if (!isLightweight()) { if (!isLightweight()) {
return true; return true;
} }
return isVisible() && (getContainer() == null ||
getContainer().isRecursivelyVisibleUpToHeavyweightContainer()); for (Container cont = getContainer();
cont != null && cont.isLightweight();
cont = cont.getContainer())
{
if (!cont.isVisible()) {
return false;
}
}
return true;
} }
@Override @Override