changeset 540:e2c1cd779d25

Follow-on fix from Rich Bair for unit test failures.
author kcr
date Tue, 28 Feb 2012 19:39:11 -0800
parents 52f883e9a2c5
children fc8a4ecd18db
files javafx-ui-common/src/javafx/scene/Parent.java javafx-ui-controls/src/com/sun/javafx/scene/control/skin/LabeledSkinBase.java javafx-ui-controls/test/com/sun/javafx/scene/control/skin/LabelSkinTest.java javafx-ui-controls/test/javafx/scene/control/PopupControlTest.java
diffstat 4 files changed, 24 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-common/src/javafx/scene/Parent.java	Tue Feb 28 16:31:37 2012 -0800
+++ b/javafx-ui-common/src/javafx/scene/Parent.java	Tue Feb 28 19:39:11 2012 -0800
@@ -810,12 +810,11 @@
      * will be invoked on its parent.
      */
     public void requestLayout() {
-        prefWidthCache = -1;
-        prefHeightCache = -1;
-        minWidthCache = -1;
-        minHeightCache = -1;
-
         if (!isNeedsLayout()) {
+            prefWidthCache = -1;
+            prefHeightCache = -1;
+            minWidthCache = -1;
+            minHeightCache = -1;
             PlatformLogger logger = Logging.getLayoutLogger();
             if (logger.isLoggable(PlatformLogger.FINER)) {
                 logger.finer(this.toString());
@@ -832,6 +831,20 @@
             } else if (getParent() != null) {
                 getParent().requestLayout();
             }
+        } else {
+            clearSizeCache();
+        }
+    }
+
+    void clearSizeCache() {
+        prefWidthCache = -1;
+        prefHeightCache = -1;
+        minWidthCache = -1;
+        minHeightCache = -1;
+        if (!isLayoutRoot()) {
+            if (getParent() != null) {
+                getParent().clearSizeCache();
+            }
         }
     }
 
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/LabeledSkinBase.java	Tue Feb 28 16:31:37 2012 -0800
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/LabeledSkinBase.java	Tue Feb 28 19:39:11 2012 -0800
@@ -531,7 +531,6 @@
      */
     protected void updateChildren() {
         final Labeled labeled = getSkinnable();
-        final ContentDisplay contentDisplay = labeled.getContentDisplay();
         // Only in some situations do we want to have the graphicPropertyChangedListener
         // installed. Since updateChildren() is not called much, we'll just remove it always
         // and reinstall it later if it is necessary to do so.
--- a/javafx-ui-controls/test/com/sun/javafx/scene/control/skin/LabelSkinTest.java	Tue Feb 28 16:31:37 2012 -0800
+++ b/javafx-ui-controls/test/com/sun/javafx/scene/control/skin/LabelSkinTest.java	Tue Feb 28 19:39:11 2012 -0800
@@ -1105,7 +1105,6 @@
         final double oldPrefHeight = label.prefHeight(-1);
         label.setText("This\nis a test\nof the emergency\nbroadcast system.\nThis is only a test");
         final double newPrefHeight = label.prefHeight(-1);
-        System.out.println("newPrefHeight="+newPrefHeight+" old="+oldPrefHeight);
         assertTrue(oldPrefHeight != newPrefHeight);
     }
     
--- a/javafx-ui-controls/test/javafx/scene/control/PopupControlTest.java	Tue Feb 28 16:31:37 2012 -0800
+++ b/javafx-ui-controls/test/javafx/scene/control/PopupControlTest.java	Tue Feb 28 19:39:11 2012 -0800
@@ -409,6 +409,7 @@
         Tooltip tooltip = new Tooltip("Hello");
         TooltipSkin skin = new TooltipSkin(tooltip);
         popup.setSkin(skin);
+        popup.getScene().getRoot().impl_processCSS(true);
 
         popup.setMinWidth(PopupControl.USE_COMPUTED_SIZE);
         assertEquals(popup.getSkin().getNode().minWidth(anyNum), popup.minWidth(anyNum), 0.0D);
@@ -447,6 +448,7 @@
         Tooltip tooltip = new Tooltip("Hello");
         TooltipSkin skin = new TooltipSkin(tooltip);
         popup.setSkin(skin);
+        popup.getScene().getRoot().impl_processCSS(true);
 
         popup.setMinHeight(PopupControl.USE_COMPUTED_SIZE);
         assertEquals(popup.getSkin().getNode().minHeight(anyNum), popup.minHeight(anyNum), 0.0D);
@@ -485,6 +487,7 @@
         Tooltip tooltip = new Tooltip("Hello");
         TooltipSkin skin = new TooltipSkin(tooltip);
         popup.setSkin(skin);
+        popup.getScene().getRoot().impl_processCSS(true);
 
         popup.setPrefWidth(PopupControl.USE_COMPUTED_SIZE);
         assertEquals(popup.getSkin().getNode().prefWidth(anyNum), popup.prefWidth(anyNum), 0.0D);
@@ -523,6 +526,7 @@
         Tooltip tooltip = new Tooltip("Hello");
         TooltipSkin skin = new TooltipSkin(tooltip);
         popup.setSkin(skin);
+        popup.getScene().getRoot().impl_processCSS(true);
 
         popup.setPrefHeight(PopupControl.USE_COMPUTED_SIZE);
         assertEquals(popup.getSkin().getNode().prefHeight(anyNum), popup.prefHeight(anyNum), 0.0D);
@@ -561,6 +565,7 @@
         Tooltip tooltip = new Tooltip("Hello");
         TooltipSkin skin = new TooltipSkin(tooltip);
         popup.setSkin(skin);
+        popup.getScene().getRoot().impl_processCSS(true);
 
         popup.setMaxWidth(PopupControl.USE_COMPUTED_SIZE);
         assertEquals(popup.getSkin().getNode().maxWidth(anyNum), popup.maxWidth(anyNum), 0.0D);
@@ -599,6 +604,7 @@
         Tooltip tooltip = new Tooltip("Hello");
         TooltipSkin skin = new TooltipSkin(tooltip);
         popup.setSkin(skin);
+        popup.getScene().getRoot().impl_processCSS(true);
 
         popup.setMaxHeight(PopupControl.USE_COMPUTED_SIZE);
         assertEquals(popup.getSkin().getNode().maxHeight(anyNum), popup.maxHeight(anyNum), 0.0D);