OpenJDK / amber / amber
changeset 4257:c447aed67cec
6885735: closed/java/awt/Component/DisablingLWDisabledHW/DisablingLWDisabledHW.html fails
Summary: Use isRecursivelyVisibleUpToHeavyweightContainer() instead of isRecursivelyVisible() to determine if the peer needs to be hidden.
Reviewed-by: art, dcherepanov
author | anthony |
---|---|
date | Wed, 14 Oct 2009 16:32:38 +0400 |
parents | 24d614d4764a |
children | 50b23b28d857 |
files | jdk/src/share/classes/java/awt/Component.java jdk/src/share/classes/java/awt/Container.java |
diffstat | 2 files changed, 23 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/jdk/src/share/classes/java/awt/Component.java Wed Oct 14 16:19:46 2009 +0400 +++ b/jdk/src/share/classes/java/awt/Component.java Wed Oct 14 16:32:38 2009 +0400 @@ -6720,12 +6720,13 @@ } } } else { - // It's native. If the parent is lightweight it - // will need some help. - Container parent = this.parent; - if (parent != null && parent.peer instanceof LightweightPeer) { + // It's native. If the parent is lightweight it will need some + // help. + Container parent = getContainer(); + if (parent != null && parent.isLightweight()) { relocateComponent(); - if (!isRecursivelyVisible()) { + if (!parent.isRecursivelyVisibleUpToHeavyweightContainer()) + { peer.setVisible(false); } }
--- a/jdk/src/share/classes/java/awt/Container.java Wed Oct 14 16:19:46 2009 +0400 +++ b/jdk/src/share/classes/java/awt/Container.java Wed Oct 14 16:32:38 2009 +0400 @@ -4092,16 +4092,29 @@ } } - /* + /** + * Checks if the container and its direct lightweight containers are + * visible. + * * Consider the heavyweight container hides or shows the HW descendants * 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()) { 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