From c31f7ca36f4af8070e847a305fb038d6a5c123ad Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Fri, 14 Apr 2017 13:33:07 +0300 Subject: [PATCH] AbstractPopup: getSize and setSize must be consistent --- .../com/intellij/ui/popup/AbstractPopup.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java b/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java index 3932fd6638b9..cbf19409b6ea 100644 --- a/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java +++ b/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java @@ -1314,7 +1314,7 @@ public class AbstractPopup implements JBPopup { } } - size = computeWindowSize(size); + size.height += getAdComponentHeight(); final Window window = getContentWindow(myContent); if (window != null) { @@ -1590,27 +1590,27 @@ public class AbstractPopup implements JBPopup { } else { if (adjustByContent) { - toSet = computeWindowSize(toSet); + toSet.height += getAdComponentHeight(); } updateMaskAndAlpha(setSize(myContent, toSet)); } } - private Dimension computeWindowSize(Dimension size) { - if (myAdComponent != null && myAdComponent.isShowing()) { - size.height += myAdComponent.getPreferredSize().height + 1; - } - return size; + private int getAdComponentHeight() { + return myAdComponent != null && myAdComponent.isShowing() ? myAdComponent.getPreferredSize().height + 1 : 0; } @Override public Dimension getSize() { if (myPopup != null) { final Window popupWindow = getContentWindow(myContent); - return (popupWindow == null) ? myForcedSize : popupWindow.getSize(); - } else { - return myForcedSize; + if (popupWindow != null) { + Dimension size = popupWindow.getSize(); + size.height -= getAdComponentHeight(); + return size; + } } + return myForcedSize; } @Override