changeset 5187:6039c1e69ed7

Automated merge with ssh://jfxsrc.us.oracle.com//javafx/8.0/MASTER/jfx/rt
author David Grieve<david.grieve@oracle.com>
date Tue, 01 Oct 2013 10:00:06 -0400
parents a9d5fe2c0bb9 8319071566e7
children 0eb503d2b567
files
diffstat 27 files changed, 406 insertions(+), 200 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/ComboBoxBaseBehavior.java	Thu Sep 26 08:11:25 2013 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/ComboBoxBaseBehavior.java	Tue Oct 01 10:00:06 2013 -0400
@@ -191,9 +191,10 @@
     
     @Override public void mouseReleased(MouseEvent e) {
         super.mousePressed(e);
-        
+
+        boolean wasArmed = getControl().isArmed();
         disarm();
-        
+
         // The wasComboBoxButtonClickedForAutoHide boolean was added to resolve
         // RT-18151: namely, clicking on the comboBox button shouldn't hide, 
         // and then immediately show the popup, which was occuring because we 
@@ -203,7 +204,8 @@
             hide();
         } else if (! wasComboBoxButtonClickedForAutoHide 
                 && getControl().contains(e.getX(), e.getY())
-                && e.getButton() == MouseButton.PRIMARY) {
+                && e.getButton() == MouseButton.PRIMARY
+                && wasArmed) {
             show();
         } else {
             wasComboBoxButtonClickedForAutoHide = false;
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/ScrollPaneBehavior.java	Thu Sep 26 08:11:25 2013 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/ScrollPaneBehavior.java	Tue Oct 01 10:00:06 2013 -0400
@@ -43,6 +43,8 @@
 import static javafx.scene.input.KeyCode.RIGHT;
 import static javafx.scene.input.KeyCode.SPACE;
 import static javafx.scene.input.KeyCode.UP;
+import static javafx.scene.input.KeyCode.HOME;
+import static javafx.scene.input.KeyCode.END;
 
 
 /**
@@ -95,6 +97,15 @@
     void verticalPageDecrement() {
         ((ScrollPaneSkin)getControl().getSkin()).vsbPageDecrement();
     }
+    void verticalHome() {
+        ((ScrollPane)getControl()).setHvalue(((ScrollPane)getControl()).getHmin());
+        ((ScrollPane)getControl()).setVvalue(((ScrollPane)getControl()).getVmin());
+    }
+    void verticalEnd() {
+        ((ScrollPane)getControl()).setHvalue(((ScrollPane)getControl()).getHmax());
+        ((ScrollPane)getControl()).setVvalue(((ScrollPane)getControl()).getVmax());
+    }
+
 
     public void contentDragged(double deltaX, double deltaY) {
         // negative when dragged to the right/bottom
@@ -123,15 +134,18 @@
         // TODO XXX DEBUGGING ONLY
         SCROLL_PANE_BINDINGS.add(new KeyBinding(F4, "TraverseDebug").alt().ctrl().shift());
 
-        SCROLL_PANE_BINDINGS.add(new ScrollViewKeyBinding(LEFT, "HorizontalUnitDecrement"));
-        SCROLL_PANE_BINDINGS.add(new ScrollViewKeyBinding(RIGHT, "HorizontalUnitIncrement"));
+        SCROLL_PANE_BINDINGS.add(new KeyBinding(LEFT, "HorizontalUnitDecrement"));
+        SCROLL_PANE_BINDINGS.add(new KeyBinding(RIGHT, "HorizontalUnitIncrement"));
 
-        SCROLL_PANE_BINDINGS.add(new ScrollViewKeyBinding(UP, "VerticalUnitDecrement"));
-        SCROLL_PANE_BINDINGS.add(new ScrollViewKeyBinding(DOWN, "VerticalUnitIncrement"));
+        SCROLL_PANE_BINDINGS.add(new KeyBinding(UP, "VerticalUnitDecrement"));
+        SCROLL_PANE_BINDINGS.add(new KeyBinding(DOWN, "VerticalUnitIncrement"));
 
-        SCROLL_PANE_BINDINGS.add(new ScrollViewKeyBinding(PAGE_UP, "VerticalPageDecrement"));
-        SCROLL_PANE_BINDINGS.add(new ScrollViewKeyBinding(PAGE_DOWN, "VerticalPageIncrement"));
+        SCROLL_PANE_BINDINGS.add(new KeyBinding(PAGE_UP, "VerticalPageDecrement"));
+        SCROLL_PANE_BINDINGS.add(new KeyBinding(PAGE_DOWN, "VerticalPageIncrement"));
         SCROLL_PANE_BINDINGS.add(new KeyBinding(SPACE, "VerticalPageIncrement"));
+
+        SCROLL_PANE_BINDINGS.add(new KeyBinding(HOME, "VerticalHome"));
+        SCROLL_PANE_BINDINGS.add(new KeyBinding(END, "VerticalEnd"));
     }
 
     protected /*final*/ String matchActionForEvent(KeyEvent e) {
@@ -158,6 +172,8 @@
         else if ("VerticalUnitIncrement".equals(name)) verticalUnitIncrement();
         else if ("VerticalPageDecrement".equals(name)) verticalPageDecrement();
         else if ("VerticalPageIncrement".equals(name)) verticalPageIncrement();
+        else if ("VerticalHome".equals(name)) verticalHome();
+        else if ("VerticalEnd".equals(name)) verticalEnd();
         else super.callAction(name);
     }
 
@@ -175,20 +191,4 @@
         super.mousePressed(e);
         getControl().requestFocus();
     }
-
-    /**
-     * Class to handle key bindings based upon the orientation of the control.
-     */
-    public static class ScrollViewKeyBinding extends OrientedKeyBinding {
-        public ScrollViewKeyBinding(KeyCode code, String action) {
-            super(code, action);
-        }
-
-        public ScrollViewKeyBinding(KeyCode code, EventType<KeyEvent> type, String action) {
-            super(code, type, action);
-        }
-        public @Override boolean getVertical(Control control) {
-            return true;
-        }
-    }
 }
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TableCellBehaviorBase.java	Thu Sep 26 08:11:25 2013 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TableCellBehaviorBase.java	Tue Oct 01 10:00:06 2013 -0400
@@ -25,6 +25,7 @@
 
 package com.sun.javafx.scene.control.behavior;
 
+import javafx.scene.Node;
 import javafx.scene.control.*;
 import javafx.scene.input.MouseButton;
 import javafx.scene.input.MouseEvent;
@@ -114,7 +115,7 @@
     abstract TablePositionBase getFocusedCell();
     abstract boolean isTableRowSelected(); // tableCell.getTreeTableRow().isSelected()
     abstract TableColumnBase<S,T> getVisibleLeafColumn(int index);
-    
+
     /**
      * Returns the position of the given table column in the visible leaf columns
      * list of the underlying control.
@@ -202,6 +203,13 @@
         if (fm == null) return;
         
         TablePositionBase focusedCell = getFocusedCell();
+
+        // if the user has clicked on the disclosure node, we do nothing other
+        // than expand/collapse the tree item (if applicable). We do not do editing!
+        boolean disclosureClicked = checkDisclosureNodeClick(e);
+        if (disclosureClicked) {
+            return;
+        }
         
         // if shift is down, and we don't already have the initial focus index
         // recorded, we record the focus index now so that subsequent shift+clicks
@@ -328,6 +336,11 @@
         }
     }
 
+    protected boolean checkDisclosureNodeClick(MouseEvent e) {
+        // by default we don't care about disclosure nodes
+        return false;
+    }
+
     private int getColumn() {
         if (getSelectionModel().isCellSelectionEnabled()) {
             TableColumnBase<S,T> tc = getTableColumn();
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TableViewBehaviorBase.java	Thu Sep 26 08:11:25 2013 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TableViewBehaviorBase.java	Tue Oct 01 10:00:06 2013 -0400
@@ -643,6 +643,8 @@
                 getSelectionModel().selectLeftCell();
             }
         });
+
+        onSelectLeftCell.run();
     }
 
     protected void alsoSelectRightCell() {
@@ -651,6 +653,8 @@
                 getSelectionModel().selectRightCell();
             }
         });
+
+        onSelectRightCell.run();
     }
     
     protected void updateRowSelection(int delta) {
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TreeTableCellBehavior.java	Thu Sep 26 08:11:25 2013 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TreeTableCellBehavior.java	Tue Oct 01 10:00:06 2013 -0400
@@ -25,6 +25,7 @@
 
 package com.sun.javafx.scene.control.behavior;
 
+import javafx.scene.Node;
 import javafx.scene.control.TableColumnBase;
 import javafx.scene.control.TablePositionBase;
 import javafx.scene.control.TableSelectionModel;
@@ -111,6 +112,20 @@
     @Override void edit(int row, TableColumnBase tc) {
         getTableControl().edit(row, (TreeTableColumn)tc);
     }
+
+    @Override protected boolean checkDisclosureNodeClick(MouseEvent e) {
+        final TreeItem<S> treeItem = getControl().getTreeTableRow().getTreeItem();
+        final Node disclosureNode = getControl().getTreeTableRow().getDisclosureNode();
+        if (disclosureNode != null) {
+            if (disclosureNode.getBoundsInParent().contains(e.getX(), e.getY())) {
+                if (treeItem != null) {
+                    treeItem.setExpanded(! treeItem.isExpanded());
+                }
+                return true;
+            }
+        }
+        return false;
+    }
     
     @Override protected void simpleSelect(MouseEvent e) {
         TreeTableView<S> tv = getControl().getTreeTableView();
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TreeViewBehavior.java	Thu Sep 26 08:11:25 2013 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TreeViewBehavior.java	Tue Oct 01 10:00:06 2013 -0400
@@ -755,6 +755,8 @@
 
         sm.selectRange(newFocusIndex, startIndex + 1);
         fm.focus(newFocusIndex);
+
+        onSelectPreviousRow.run();
     }
     
     private void discontinuousSelectNextRow() {
@@ -773,6 +775,8 @@
 
         sm.selectRange(startIndex, newFocusIndex + 1);
         fm.focus(newFocusIndex);
+
+        onSelectNextRow.run();
     }
     
     private void discontinuousSelectPageUp() {
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ButtonSkin.java	Thu Sep 26 08:11:25 2013 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ButtonSkin.java	Tue Oct 01 10:00:06 2013 -0400
@@ -121,19 +121,24 @@
             KeyCode acceleratorCode = KeyCode.ENTER;
             defaultAcceleratorKeyCodeCombination = new KeyCodeCombination(acceleratorCode);
 
+            Runnable oldDefault = scene.getAccelerators().get(defaultAcceleratorKeyCodeCombination);
             if (!value) {
-                /*
-                ** first check of there's a default button already
-                */
-                Runnable oldDefault = scene.getAccelerators().get(defaultAcceleratorKeyCodeCombination);
-                if (!defaultButtonRunnable.equals(oldDefault)) {
-                    /*
-                    ** is it us?
-                    */
+                /**
+                 * first check of there's a default button already
+                 */
+                if (defaultButtonRunnable.equals(oldDefault)) {
+                    /**
+                     * is it us?
+                     */
                     scene.getAccelerators().remove(defaultAcceleratorKeyCodeCombination);
                 }
             }
-            scene.getAccelerators().put(defaultAcceleratorKeyCodeCombination, defaultButtonRunnable);
+            else {
+                if (!defaultButtonRunnable.equals(oldDefault)) {
+                    scene.getAccelerators().remove(defaultAcceleratorKeyCodeCombination);
+                    scene.getAccelerators().put(defaultAcceleratorKeyCodeCombination, defaultButtonRunnable);
+                }
+            }
         }
     }
 
@@ -145,19 +150,24 @@
             KeyCode acceleratorCode = KeyCode.ESCAPE;
             cancelAcceleratorKeyCodeCombination = new KeyCodeCombination(acceleratorCode);
         
+            Runnable oldCancel = scene.getAccelerators().get(cancelAcceleratorKeyCodeCombination);
             if (!value) {
-                /*
-                ** first check of there's a cancel button already
-                */
-                Runnable oldCancel = scene.getAccelerators().get(cancelAcceleratorKeyCodeCombination);
-                if (!cancelButtonRunnable.equals(oldCancel)) {
-                    /*
-                    ** is it us?
-                    */
+                /**
+                 * first check of there's a cancel button already
+                 */
+                if (cancelButtonRunnable.equals(oldCancel)) {
+                    /**
+                     * is it us?
+                     */
                     scene.getAccelerators().remove(cancelAcceleratorKeyCodeCombination);
                 }
-            }        
-            scene.getAccelerators().put(cancelAcceleratorKeyCodeCombination, cancelButtonRunnable);
+            }
+            else {
+                if (!cancelButtonRunnable.equals(oldCancel)) {
+                    scene.getAccelerators().remove(cancelAcceleratorKeyCodeCombination);
+                    scene.getAccelerators().put(cancelAcceleratorKeyCodeCombination, cancelButtonRunnable);
+                }
+            }
         }
     }
 }
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java	Thu Sep 26 08:11:25 2013 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java	Tue Oct 01 10:00:06 2013 -0400
@@ -334,7 +334,13 @@
         
         super.layoutChildren(x,y,w,h);
     }
-    
+
+    // Added to allow subclasses to prevent the popup from hiding when the
+    // ListView is clicked on (e.g when the list cells have checkboxes).
+    protected boolean isHideOnClickEnabled() {
+        return true;
+    }
+
     
     
     /***************************************************************************
@@ -609,7 +615,9 @@
                     }
                 }
                 
-                comboBox.hide();
+                if (isHideOnClickEnabled()) {
+                    comboBox.hide();
+                }
             }
         });
 
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ComboBoxPopupControl.java	Thu Sep 26 08:11:25 2013 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ComboBoxPopupControl.java	Tue Oct 01 10:00:06 2013 -0400
@@ -84,7 +84,7 @@
     
     private Point2D getPrefPopupPosition() {
         double dx = 0;
-        dx += (getSkinnable().getEffectiveNodeOrientation() == NodeOrientation.RIGHT_TO_LEFT) ? -1 : 1;
+        dx += (getSkinnable().getEffectiveNodeOrientation() == NodeOrientation.RIGHT_TO_LEFT) ? -3 : 0;
         return com.sun.javafx.Utils.pointRelativeTo(getSkinnable(), getPopupContent(), HPos.CENTER, VPos.BOTTOM, dx, 0, false);
     }
     
@@ -95,6 +95,7 @@
             comboBoxBase.getScene().getRoot().impl_processCSS(true);
         }
         
+        getPopupContent().autosize();
         Point2D p = getPrefPopupPosition();
         _popup.getScene().setNodeOrientation(getSkinnable().getEffectiveNodeOrientation());
         reconfigurePopup();
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/DatePickerSkin.java	Thu Sep 26 08:11:25 2013 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/DatePickerSkin.java	Tue Oct 01 10:00:06 2013 -0400
@@ -33,11 +33,14 @@
 import java.time.format.DateTimeParseException;
 
 import javafx.application.Platform;
+import javafx.beans.InvalidationListener;
+import javafx.beans.Observable;
 import javafx.beans.value.ChangeListener;
 import javafx.beans.value.ObservableValue;
 import javafx.css.PseudoClass;
 // import javafx.event.ActionEvent;
 import javafx.event.EventHandler;
+import javafx.geometry.Insets;
 import javafx.scene.Node;
 import javafx.scene.control.DatePicker;
 import javafx.scene.control.TextField;
@@ -75,6 +78,25 @@
             });
         }
 
+        // The "arrow" is actually a rectangular svg icon resembling a calendar.
+        // Round the size of the icon to whole integers to get sharp edges.
+        arrow.paddingProperty().addListener(new InvalidationListener() {
+            // This boolean protects against unwanted recursion.
+            private boolean rounding = false;
+            @Override public void invalidated(Observable observable) {
+                if (!rounding) {
+                    Insets padding = arrow.getPadding();
+                    Insets rounded = new Insets(Math.round(padding.getTop()), Math.round(padding.getRight()), 
+                                                Math.round(padding.getBottom()), Math.round(padding.getLeft()));
+                    if (!rounded.equals(padding)) {
+                        rounding = true;
+                        arrow.setPadding(rounded);
+                        rounding = false;
+                    }
+                }
+            }
+        });
+
         // Move fake focus in to the textfield.
         // Note: DatePicker uses TextField for both editable and non-editable modes
         datePicker.focusedProperty().addListener(new ChangeListener<Boolean>() {
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/LabeledSkinBase.java	Thu Sep 26 08:11:25 2013 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/LabeledSkinBase.java	Tue Oct 01 10:00:06 2013 -0400
@@ -45,6 +45,7 @@
 import javafx.scene.input.KeyCombination;
 import javafx.scene.input.Mnemonic;
 import javafx.scene.shape.Line;
+import javafx.scene.shape.Rectangle;
 import javafx.scene.text.Font;
 
 import com.sun.javafx.scene.control.behavior.BehaviorBase;
@@ -106,6 +107,7 @@
         }
     };
 
+    private Rectangle textClip;
     private double wrapWidth;
     private double wrapHeight;
 
@@ -1166,5 +1168,38 @@
             }
             graphic.relocate(snapPosition(graphicX), snapPosition(graphicY));
         }
-    }   
+
+        /**
+         * check if the label text overflows it's bounds.
+         * If there's an overflow, and no text clip then
+         * we'll clip it. 
+         * If there is no overflow, and the label text has a
+         * clip, then remove it.
+         */
+        if ((text != null) && 
+            ((text.getLayoutBounds().getHeight() > wrapHeight) ||
+             (text.getLayoutBounds().getWidth() > wrapWidth))) {
+
+            if (textClip == null) {
+                textClip = new Rectangle();
+            }
+
+            textClip.setX(text.getLayoutBounds().getMinX());
+            textClip.setY(text.getLayoutBounds().getMinY());
+            textClip.setWidth(wrapWidth);
+            textClip.setHeight(wrapHeight);
+            if (text.getClip() == null) {
+                text.setClip(textClip);
+            }
+        }
+        else {
+            /**
+             * content fits inside bounds, no need
+             * for a clip
+             */
+            if (text.getClip() != null) {
+                text.setClip(null);
+            }
+        }
+    }
 }
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ScrollPaneSkin.java	Thu Sep 26 08:11:25 2013 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ScrollPaneSkin.java	Tue Oct 01 10:00:06 2013 -0400
@@ -245,6 +245,7 @@
         // prevent requestLayout requests from within scrollNode from percolating up
         viewRect.setManaged(false);
         viewRect.setCache(true);
+        viewRect.getStyleClass().add("viewport");
 
         clipRect = new Rectangle();
         viewRect.setClip(clipRect);
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/SplitPaneSkin.java	Thu Sep 26 08:11:25 2013 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/SplitPaneSkin.java	Tue Oct 01 10:00:06 2013 -0400
@@ -97,13 +97,27 @@
         getSkinnable().getItems().addListener(new ListChangeListener<Node>() {
             @Override public void onChanged(Change<? extends Node> c) {
                 while (c.next()) {
-                    for (Node n : c.getRemoved()) {
-                        removeContent(n);
-                    }
+                    if (c.wasPermutated() || c.wasUpdated()) {
+                        /**
+                         * the contents were either moved, or updated.
+                         * rebuild the contents to re-sync
+                         */
+                        getChildren().clear();
+                        contentRegions.clear();
+                        int index = 0;
+                        for (Node n : c.getList()) {
+                            addContent(index++, n);
+                        }
 
-                    int index = c.getFrom();
-                    for (Node n : c.getAddedSubList()) {
-                        addContent(index++, n);
+                    } else {
+                        for (Node n : c.getRemoved()) {
+                            removeContent(n);
+                        }
+
+                        int index = c.getFrom();
+                        for (Node n : c.getAddedSubList()) {
+                            addContent(index++, n);
+                        }
                     }
                 }
                 // TODO there may be a more efficient way than rebuilding all the dividers
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TableHeaderRow.java	Thu Sep 26 08:11:25 2013 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TableHeaderRow.java	Tue Oct 01 10:00:06 2013 -0400
@@ -316,8 +316,9 @@
         header.resizeRelocate(x, snappedTopInset(), headerWidth, prefHeight);
         
         // position the filler region
-        double border = filler.getBoundsInLocal().getWidth() - filler.getLayoutBounds().getWidth();
-        double fillerWidth = tableWidth - headerWidth + border;
+        final Control control = tableSkin.getSkinnable();
+        final double controlInsets = control.snappedLeftInset() + control.snappedRightInset();
+        double fillerWidth = tableWidth - headerWidth + filler.getInsets().getLeft() - controlInsets;
         fillerWidth -= tableSkin.tableMenuButtonVisibleProperty().get() ? cornerWidth : 0;
         filler.setVisible(fillerWidth > 0);
         if (fillerWidth > 0) {
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TitledPaneSkin.java	Thu Sep 26 08:11:25 2013 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TitledPaneSkin.java	Tue Oct 01 10:00:06 2013 -0400
@@ -80,7 +80,6 @@
         super(titledPane, new TitledPaneBehavior(titledPane));
 
         clipRect = new Rectangle();
-        getSkinnable().setClip(clipRect);
 
         transitionStartValue = 0;
         titleRegion = new TitleRegion();
@@ -98,6 +97,7 @@
                 getChildren().setAll(contentRegion);
             }
         };
+        contentContainer.setClip(clipRect);
 
         if (titledPane.isExpanded()) {
             setTransition(1.0f);
@@ -148,7 +148,7 @@
         } else if ("WIDTH".equals(property)) {
             clipRect.setWidth(getSkinnable().getWidth());
         } else if ("HEIGHT".equals(property)) {
-            clipRect.setHeight(getSkinnable().getHeight());
+            clipRect.setHeight(contentContainer.getHeight());
         } else if ("GRAPHIC_TEXT_GAP".equals(property)) {
             titleRegion.requestLayout();            
         }
@@ -224,6 +224,7 @@
 
         y += snapSize(headerHeight);
         contentContainer.resize(w, contentHeight);
+        clipRect.setHeight(contentHeight);
         positionInArea(contentContainer, x, y,
             w, contentHeight, /*baseline ignored*/0, HPos.CENTER, VPos.CENTER);
     }
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TreeTableViewSkin.java	Thu Sep 26 08:11:25 2013 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TreeTableViewSkin.java	Tue Oct 01 10:00:06 2013 -0400
@@ -384,6 +384,7 @@
         if (cell.getDisclosureNode() == null) {
             final StackPane disclosureNode = new StackPane();
             disclosureNode.getStyleClass().setAll("tree-disclosure-node");
+            disclosureNode.setMouseTransparent(true);
 
             final StackPane disclosureNodeArrow = new StackPane();
             disclosureNodeArrow.getStyleClass().setAll("arrow");
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TreeViewSkin.java	Thu Sep 26 08:11:25 2013 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TreeViewSkin.java	Tue Oct 01 10:00:06 2013 -0400
@@ -383,8 +383,7 @@
     }
 
     /**
-     * Function used to scroll the container down by one 'page', although
-     * if this is a horizontal container, then the scrolling will be to the right.
+     * Function used to scroll the container down by one 'page'.
      */
     public int onScrollPageDown(int anchor) {
         TreeCell<T> lastVisibleCell = flow.getLastVisibleCellWithinViewPort();
@@ -415,8 +414,7 @@
     }
 
     /**
-     * Function used to scroll the container up by one 'page', although
-     * if this is a horizontal container, then the scrolling will be to the left.
+     * Function used to scroll the container up by one 'page'.
      */
     public int onScrollPageUp(int anchor) {
         TreeCell<T> firstVisibleCell = flow.getFirstVisibleCellWithinViewPort();
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualFlow.java	Thu Sep 26 08:11:25 2013 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualFlow.java	Tue Oct 01 10:00:06 2013 -0400
@@ -1890,15 +1890,19 @@
         return cell.isEmpty() ? null : cell;
     }
 
+    // Returns last visible cell whose bounds are entirely within the viewport
     public T getLastVisibleCellWithinViewPort() {
         if (cells.isEmpty() || getViewportLength() <= 0) return null;
 
         T cell;
+        final double max = isVertical() ? getHeight() : getWidth();
         for (int i = cells.size() - 1; i >= 0; i--) {
             cell = cells.get(i);
             if (cell.isEmpty()) continue;
 
-            if (cell.getLayoutY() < getHeight()) {
+            final double cellStart = getCellPosition(cell);
+            final double cellEnd = cellStart + getCellLength(cell);
+            if (cellEnd <= max) {
                 return cell;
             }
         }
@@ -1906,18 +1910,17 @@
         return null;
     }
 
+    // Returns first visible cell whose bounds are entirely within the viewport
     public T getFirstVisibleCellWithinViewPort() {
         if (cells.isEmpty() || getViewportLength() <= 0) return null;
 
-        final boolean isVertical = isVertical();
         T cell;
         for (int i = 0; i < cells.size(); i++) {
             cell = cells.get(i);
             if (cell.isEmpty()) continue;
 
-            if (isVertical && cell.getLayoutY() + cell.getHeight() > 0) {
-                return cell;
-            } else if (! isVertical && cell.getLayoutX() + cell.getWidth() > 0) {
+            final double cellStart = getCellPosition(cell);
+            if (cellStart >= 0) {
                 return cell;
             }
         }
@@ -2082,11 +2085,23 @@
                 positionCell(cell, getCellPosition(cell) - delta);
             }
 
-            // Now throw away any cells that don't fit
-            cull();
+            // Fix for RT-32908
+            T firstCell = cells.getFirst();
+            double layoutY = firstCell == null ? 0 : getCellPosition(firstCell);
+            for (int i = 0; i < cells.size(); i++) {
+                T cell = cells.get(i);
+                assert cell != null;
+                double actualLayoutY = getCellPosition(cell);
+                if (actualLayoutY != layoutY) {
+                    // we need to shift the cell to layoutY
+                    positionCell(cell, layoutY);
+                }
+
+                layoutY += getCellLength(cell);
+            }
+            // end of fix for RT-32908
 
             // Add any necessary leading cells
-            T firstCell = cells.getFirst();
             if (firstCell != null) {
                 int firstIndex = getCellIndex(firstCell);
                 double prevIndexSize = getCellLength(firstIndex - 1);
@@ -2130,6 +2145,9 @@
             }
         }
 
+        // Now throw away any cells that don't fit
+        cull();
+
         // Finally, update the scroll bars
         updateScrollBarsAndCells();
         lastPosition = getPosition();
--- a/modules/controls/src/main/java/javafx/scene/control/ChoiceBox.java	Thu Sep 26 08:11:25 2013 -0700
+++ b/modules/controls/src/main/java/javafx/scene/control/ChoiceBox.java	Tue Oct 01 10:00:06 2013 -0400
@@ -195,7 +195,8 @@
                 final SingleSelectionModel<T> sm = getSelectionModel();
                 if (sm != null) {
                     if (newItems != null && newItems.isEmpty()) {
-                        sm.setSelectedIndex(-1);
+                        // RT-29433 - clear selection.
+                        sm.clearSelection();
                     } else if (sm.getSelectedIndex() == -1 && sm.getSelectedItem() != null) {
                         int newIndex = getItems().indexOf(sm.getSelectedItem());
                         if (newIndex != -1) {
--- a/modules/controls/src/main/java/javafx/scene/control/TitledPane.java	Thu Sep 26 08:11:25 2013 -0700
+++ b/modules/controls/src/main/java/javafx/scene/control/TitledPane.java	Tue Oct 01 10:00:06 2013 -0400
@@ -57,7 +57,6 @@
  * <p>Example:</p>
  * <pre><code>
  *  TitledPane t1 = new TitledPane("T1", new Button("B1"));
- *  t1.setMode(TitledPaneMode.FADE);
  * </code></pre>
  *
  * @since JavaFX 2.0
--- a/modules/controls/src/main/resources/com/sun/javafx/scene/control/skin/caspian/caspian.css	Thu Sep 26 08:11:25 2013 -0700
+++ b/modules/controls/src/main/resources/com/sun/javafx/scene/control/skin/caspian/caspian.css	Tue Oct 01 10:00:06 2013 -0400
@@ -3129,13 +3129,15 @@
     /*-fx-padding: 0; *//* 6 8 6 8 */
 }
 
-.combo-box-base:hover > .arrow-button {
+.combo-box-base:hover > .arrow-button,
+.date-picker:hover > .arrow-button {
     -fx-background-color: -fx-outer-border, -fx-inner-border, -fx-body-color;
     -fx-background-insets: 0, 1, 2;
     -fx-background-radius: 0 5 5 0, 0 4 4 0, 0 3 3 0;
 }
 
-.combo-box-base:showing > .arrow-button {
+.combo-box-base:showing > .arrow-button,
+.date-picker:showing > .arrow-button {
     -fx-color: -fx-pressed-base;
 } 
 
@@ -3164,7 +3166,8 @@
 /*--- The editable ComboBox TextBox inherits its properties from the TextBox Control.
 Only the properties with values that are different from the TextBox are specified here. ---*/
 
-.combo-box-base:editable > .text-field {
+.combo-box-base:editable > .text-field,
+.date-picker > .text-field {
     -fx-padding: 0.166667em 0.416667em 0.25em 0.416667em; /* 2 5 3 5 */
     /*-fx-padding: 0px;*/
     /*-fx-background-color: yellow;*/
@@ -3172,7 +3175,8 @@
     -fx-background-insets: 0 0 -1 0, 0, 1 0 1 1;
 }
 
-.combo-box-base:editable:contains-focus {
+.combo-box-base:editable:contains-focus,
+.date-picker:contains-focus {
     -fx-background-color: -fx-focus-color, -fx-outer-border, -fx-control-inner-background;
     -fx-background-radius: 5.4, 3, 2;
     -fx-background-insets: -1.4, 0, 1;
@@ -3533,32 +3537,6 @@
  *                                                                             *
  ******************************************************************************/
 
-/* Merge the following rules with ComboBox rules whenever possible */
-/* Note that DatePicker uses same style for editable and non-editable text */
-/* This style is for non-editable ComboBox and does not apply to DatePicker
- * .date-picker > .date-picker-display-node {
- *    -fx-padding: 0.25em 0 0.166667em 0.583333em;
- * }
- * .date-picker > .arrow-button {
- *    -fx-background-color: -fx-outer-border, -fx-inner-border, -fx-body-color;
- *    -fx-background-insets: 0, 1, 2;
- *    -fx-background-radius: 0 5 5 0, 0 4 4 0, 0 3 3 0;
- *    -fx-padding: 0 0.583em 0 0.667em;
- * }
- */
-/** END **/
-
-/* Merge the following rules with Editable ComboBox rules */
-/* Note that DatePicker uses same style for editable and non-editable text */
-.date-picker:hover > .arrow-button {
-    -fx-background-color: -fx-outer-border, -fx-inner-border, -fx-body-color;
-    -fx-background-insets: 0, 1, 2;
-    -fx-background-radius: 0 5 5 0, 0 4 4 0, 0 3 3 0;
-}
-.date-picker:showing > .arrow-button {
-    -fx-color: -fx-pressed-base;
-}
-/* When the following rule is enabled and the CSS style is switched to Caspian, HelloDatePicker */
 .date-picker > .arrow-button > .arrow {
     -fx-shape: "M0,0v9h9V0H0z M2,8H1V7h1V8z M2,6H1V5h1V6z M2,4H1V3h1V4z M4,8H3V7h1V8z M4,6H3V5h1V6z M4,4H3V3h1V4z M6,8H5V7h1V8z M6,6H5 V5h1V6z M6,4H5V3h1V4z M8,8H7V7h1V8z M8,6H7V5h1V6z M8,4H7V3h1V4z";
     -fx-background-color: -fx-mark-highlight-color, -fx-mark-color;
@@ -3566,32 +3544,22 @@
     -fx-padding: 0.416667em 0.416667em 0.333333em 0.333333em; /*5 5 4 4 */
     -fx-scale-shape: true;
 }
-.date-picker > .text-field {
-    -fx-padding: 0.166667em 0.416667em 0.25em 0.416667em; /* 2 5 3 5 */
-    -fx-background-radius: 4 0 0 4, 3 0 0 3, 2 0 0 2;
-    -fx-background-insets: 0 0 -1 0, 0, 1 0 1 1;
-}
-.date-picker:contains-focus {
-    -fx-background-color: -fx-focus-color, -fx-outer-border, -fx-control-inner-background;
-    -fx-background-radius: 5.4, 3, 2;
-    -fx-background-insets: -1.4, 0, 1;
-}
-/** END **/
 
 .date-picker-popup {
     -fx-background-color: -fx-box-border, -fx-control-inner-background;
     -fx-background-insets: 0, 1;
-    -fx-background-radius: 0 6 6 6, 0 5 5 5;
-    -fx-padding: 0.083333em; /* 1 1 1 1 */
+    /*-fx-background-radius: 0 6 6 6, 0 5 5 5;*/
+    -fx-background-radius: 0;
+    -fx-padding: 0;
     -fx-alignment: CENTER; /* VBox */
-    -fx-spacing: 1; /* VBox */
+    -fx-spacing: 0; /* VBox */
     -fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 8, 0.0 , 0 , 0 );
 }
 .date-picker-popup > .month-year-pane {
     -fx-padding: 0.5em; /* 6 6 6 6 */
     -fx-background-color: -fx-outer-border, -fx-inner-border, -fx-body-color;
     -fx-background-insets: 0, 1, 2;
-    -fx-background-radius: 0 6 0 0, 0 5 0 0, 0 4 0 0;
+    -fx-background-radius: 0;
 }
 .date-picker-popup > * > .spinner {
     -fx-spacing: 0.25em;
@@ -3619,14 +3587,14 @@
 .date-picker-popup > * > .spinner > .button > .right-arrow {
     -fx-background-color: -fx-mark-highlight-color, -fx-mark-color;
     -fx-background-insets: 1 0 -1 0, 0;
-    -fx-padding: 0.5em 0.333333em 0.0em 0.0em; /* 6 4 0 0 */
+    -fx-padding: 0.5em 0.333333em 0 0; /* 6 4 0 0 */
     -fx-shape: "M 4 0 L 0 -3 L 0 3 z";
     -fx-scale-shape: true;
 }
 .date-picker-popup > * > .spinner > .button > .left-arrow {
     -fx-background-color: -fx-mark-highlight-color, -fx-mark-color;
     -fx-background-insets: 1 0 -1 0, 0;
-    -fx-padding: 0.5em 0.333333em 0.0em 0.0em; /* 6 4 0 0 */
+    -fx-padding: 0.5em 0.333333em 0 0; /* 6 4 0 0 */
     -fx-shape: "M 0 0 L 4 -3 L 4 3 z";
     -fx-scale-shape: true;
 }
@@ -3640,7 +3608,8 @@
 }
 .date-picker-popup > .calendar-grid {
     -fx-background-color: derive(-fx-base, 6.8%);
-    -fx-background-insets: 0;
+    -fx-background-insets: 1;
+    -fx-padding: 1;
 }
 .date-picker-popup > * > .date-cell {
     -fx-background-color: transparent;
@@ -3649,13 +3618,18 @@
     -fx-alignment: BASELINE_CENTER;
     -fx-opacity: 1.0;
 }
-.date-picker-popup > * > .cell:disabled > * {
-    /* This is set on the cell's children so the border is not affected. */
-    -fx-opacity: 0.4;
-}
+.date-cell:disabled > * {
+    -fx-opacity: -fx-disabled-opacity;
+}
+.date-picker-popup > * > .day-name-cell,
 .date-picker-popup > * > .week-number-cell {
-    -fx-padding: 0.333333em 0.583333em 0.333333em 0.583333em; /* 4 7 4 7 */
-    -fx-border-color: -fx-control-inner-background;
+    -fx-font-size: 0.916667em;
+}
+.date-picker-popup > * > .week-number-cell {
+    /* Add one pixel to the top padding to
+     * compensate for the smaller font size. */
+    -fx-padding: 0.416667em 0.583333em 0.333333em 0.583333em; /* 5 7 4 7 */
+    -fx-border-color: -fx-background;
     -fx-border-width: 1px;
     -fx-background: -fx-control-inner-background;
     -fx-background-color: -fx-background;
@@ -3720,7 +3694,7 @@
 }
 .date-picker-popup > * > .previous-month.today,
 .date-picker-popup > * > .next-month.today {
-    -fx-background: derive(-fx-control-inner-background,-5%), derive(-fx-base, -10%), derive(-fx-control-inner-background,-5%);
+    -fx-background-color: derive(-fx-control-inner-background,-5%), derive(-fx-base, -10%), derive(-fx-control-inner-background,-5%);
 }
 .date-picker-popup > * > .previous-month.today:hover,
 .date-picker-popup > * > .next-month.today:hover {
@@ -3960,7 +3934,7 @@
     -fx-padding: 0 0 -0.083333em 0;
 }
 /* Note: The Separator is constructed of a 1-pixel shape
-whose borders are styled.  Only the right border is specified
+whose borders are styled.  Only the right border is specified
 with a color; the other three borders are transparent.*/
 
 /* Note: This first section of CSS (below) specifies the Separator’s color.
--- a/modules/controls/src/main/resources/com/sun/javafx/scene/control/skin/modena/modena.css	Thu Sep 26 08:11:25 2013 -0700
+++ b/modules/controls/src/main/resources/com/sun/javafx/scene/control/skin/modena/modena.css	Tue Oct 01 10:00:06 2013 -0400
@@ -409,6 +409,9 @@
     -fx-alignment: CENTER;
     -fx-content-display: LEFT;
 }
+.menu-button > .label {
+    -fx-alignment: CENTER_LEFT;
+}
 .button:hover,
 .toggle-button:hover,
 .radio-button:hover > .radio,
@@ -1054,7 +1057,9 @@
  * ScrollPane                                                                  *
  *                                                                             *
  ******************************************************************************/
-
+.scroll-pane > .viewport {
+    -fx-background-color: -fx-background;
+}
 .scroll-pane > .scroll-bar:horizontal {
     -fx-background-insets: 0 1 1 1, 1;
     -fx-padding: 0 1 0 1;
@@ -1689,7 +1694,7 @@
     -fx-text-fill: -fx-text-base-color;
     -fx-padding: 0.333333em 0.666667em 0.333333em 0.666667em; /* 4 8 4 8 */
 }
-.combo-box-base > .arrow-button  {
+.combo-box-base > .arrow-button {
     -fx-background-radius: 0 3 3 0, 0 2 2 0, 0 1 1 0;
     -fx-padding: 0.5em 0.667em 0.5em 0.833333em; /* 6 8 6 10 */
     -fx-background-color: transparent;
@@ -1705,23 +1710,28 @@
  *                                                                             *
  ******************************************************************************/
 
-.combo-box-base:editable > .arrow-button  {
+.combo-box-base:editable > .arrow-button,
+.date-picker > .arrow-button {
     -fx-background-color: -fx-outer-border, -fx-inner-border, -fx-body-color;
     -fx-background-insets: 1 1 1 0, 1, 2;
     -fx-background-radius: 0 3 3 0, 0 2 2 0, 0 1 1 0;
 }
-.combo-box-base:editable > .text-field {
+.combo-box-base:editable > .text-field,
+.date-picker > .text-field {
     -fx-background-color: -fx-control-inner-background;
     -fx-background-insets: 1 0 1 1;
     -fx-background-radius: 2 0 0 2;
 }
-.combo-box-base:editable:contains-focus {
+.combo-box-base:editable:contains-focus,
+.date-picker:contains-focus {
     -fx-background-color: -fx-focus-color;
     -fx-background-insets: -0.2;
     -fx-background-radius: 3;
 }
 .combo-box-base:editable:focused > .text-field,
-.combo-box-base:editable > .text-field:focused  {
+.combo-box-base:editable > .text-field:focused,
+.date-picker:focused > .text-field,
+.date-picker > .text-field:focused {
     -fx-background-color: 
         -fx-control-inner-background,
         -fx-faint-focus-color,
@@ -1729,7 +1739,8 @@
     -fx-background-insets: 1 0 1 1, 1 0 1 1, 3 2 3 3;
     -fx-background-radius: 2 0 0 2, 1 0 0 1, 0;
 }
-.combo-box-base:editable:contains-focus > .arrow-button {
+.combo-box-base:editable:contains-focus > .arrow-button,
+.date-picker:contains-focus > .arrow-button {
     -fx-background-color: -fx-inner-border, -fx-body-color, -fx-faint-focus-color, -fx-body-color;
     -fx-background-insets: 1, 2, 1, 2.6;
     -fx-background-radius: 0 2 2 0, 0 1 1 0, 0 1 1 0, 0 1 1 0;
@@ -2929,32 +2940,12 @@
     -fx-padding: 0.8em;
 }
 
-
-
-
 /*******************************************************************************
  *                                                                             *
  * DatePicker                                                                  *
  *                                                                             *
  ******************************************************************************/
 
-/* Merge the following rules with ComboBox rules whenever possible */
-/* Note that DatePicker uses same style for editable and non-editable text */
-/* This style is for non-editable ComboBox and does not apply to DatePicker
- * .date-picker > .date-picker-display-node {
- *    -fx-background: transparent;
- *    -fx-background-color: transparent;
- *    -fx-text-fill: -fx-text-base-color;
- *    -fx-padding: 0.333333em 0.5em 0.333333em 0.75em;
- * }
- * .date-picker > .arrow-button  {
- *    -fx-background-radius: 0 3 3 0, 0 2 2 0, 0 1 1 0;
- *    -fx-padding: 0.5em 0.583333em 0.5em 0.666667em;
- *    -fx-background-color: transparent;
- * }
- */
-/* END */
-
 .date-picker > .arrow-button > .arrow {
     -fx-shape: "M0,0v9h9V0H0z M2,8H1V7h1V8z M2,6H1V5h1V6z M2,4H1V3h1V4z M4,8H3V7h1V8z M4,6H3V5h1V6z M4,4H3V3h1V4z M6,8H5V7h1V8z M6,6H5 V5h1V6z M6,4H5V3h1V4z M8,8H7V7h1V8z M8,6H7V5h1V6z M8,4H7V3h1V4z";
     -fx-background-color: -fx-mark-highlight-color, -fx-mark-color;
@@ -2963,39 +2954,6 @@
     -fx-scale-shape: true;
 }
 
-/* Merge the following rules with Editable ComboBox rules */
-/* Note that DatePicker uses same style for editable and non-editable text */
-.date-picker > .arrow-button  {
-    -fx-background-color: -fx-outer-border, -fx-inner-border, -fx-body-color;
-    -fx-background-insets: 1 1 1 0, 1, 2;
-    -fx-background-radius: 0 3 3 0, 0 2 2 0, 0 1 1 0;
-}
-.date-picker > .text-field {
-    -fx-background-color: -fx-control-inner-background;
-    -fx-background-insets: 1 0 1 1;
-    -fx-background-radius: 2 0 0 2;
-}
-.date-picker:contains-focus {
-    -fx-background-color: -fx-focus-color;
-    -fx-background-insets: -0.2;
-    -fx-background-radius: 3;
-}
-.date-picker:focused > .text-field,
-.date-picker > .text-field:focused  {
-    -fx-background-color:
-        -fx-control-inner-background,
-        -fx-faint-focus-color,
-        linear-gradient(from 0px 0px to 0px 5px, derive(-fx-control-inner-background, -9%), -fx-control-inner-background);
-    -fx-background-insets: 1 0 1 1, 1 0 1 1, 3 2 3 3;
-    -fx-background-radius: 2 0 0 2, 1 0 0 1, 0;
-}
-.date-picker:contains-focus > .arrow-button {
-    -fx-background-color: -fx-inner-border, -fx-body-color, -fx-faint-focus-color, -fx-body-color;
-    -fx-background-insets: 1, 2, 1, 2.6;
-    -fx-background-radius: 0 2 2 0, 0 1 1 0, 0 1 1 0, 0 1 1 0;
-}
-/* END */
-
 .date-picker-popup {
      -fx-background-color:
         linear-gradient(to bottom,
@@ -3079,9 +3037,10 @@
 
 .date-picker-popup > .calendar-grid {
     -fx-background-color: derive(-fx-selection-bar-non-focused, 60%);
-    -fx-background-insets: 1 0 0 0;
-}
-.date-picker-popup > * > .date-cell {
+    /*-fx-background-insets: 1 0 0 0;*/
+    -fx-padding: 0;
+}
+.date-picker-popup > * > .date-cell { 
     -fx-background-color: transparent;
     -fx-background-insets: 1, 2;
     -fx-padding: 0;
@@ -3090,7 +3049,7 @@
 }
 .date-picker-popup > * > .day-name-cell,
 .date-picker-popup > * > .week-number-cell {
-    -fx-font-size: 0.916667em;
+    -fx-font-size: 0.916667em; 
 }
 .date-picker-popup > * > .week-number-cell {
     -fx-padding: 0.333333em 0.583333em 0.333333em 0.583333em; /* 4 7 4 7 */
@@ -3104,6 +3063,7 @@
     -fx-padding: 0.333333em 0.583333em 0.333333em 0.583333em; /* 4 7 4 7 */
     -fx-border-color: derive(-fx-selection-bar-non-focused, 60%);
     -fx-border-width: 1px;
+    -fx-font-size: 1em;
     -fx-background: -fx-control-inner-background;
     -fx-background-color: -fx-background;
     -fx-text-fill: -fx-text-background-color;
@@ -3162,5 +3122,5 @@
 
 .date-picker-popup > * > .previous-month.today:hover,
 .date-picker-popup > * > .next-month.today:hover {
-    -fx-background-color: lightgrey, derive(-fx-base, -10%), lightgrey;
-}
+    -fx-background-color: -fx-selection-bar-non-focused, derive(-fx-selection-bar-non-focused, -20%), -fx-selection-bar-non-focused;
+}
--- a/modules/controls/src/test/java/javafx/scene/control/ChoiceBoxTest.java	Thu Sep 26 08:11:25 2013 -0700
+++ b/modules/controls/src/test/java/javafx/scene/control/ChoiceBoxTest.java	Tue Oct 01 10:00:06 2013 -0400
@@ -459,4 +459,15 @@
         assertEquals("Apple", ChoiceBoxSkinNodesRetriever.getChoiceBoxSelectedText(skin));
         
     }
+    
+    @Test public void checkSelectedItemAfterReplacingDataWithEmptyList() {
+        StackPane pane = new StackPane();
+        pane.getChildren().add(box);
+        box.getItems().addAll("Apple", "Orange", "Banana");
+        box.getSelectionModel().select("Orange");
+        startApp(pane);
+        box.getItems().clear();
+        // make sure the selected item is null
+        assertEquals(null, box.getSelectionModel().getSelectedItem());
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/controls/src/test/java/javafx/scene/control/MiscellaneousTests.java	Tue Oct 01 10:00:06 2013 -0400
@@ -0,0 +1,70 @@
+package javafx.scene.control;
+
+import com.sun.javafx.pgstub.StubToolkit;
+import com.sun.javafx.tk.TKPulseListener;
+import com.sun.javafx.tk.Toolkit;
+import javafx.scene.Group;
+import javafx.scene.Scene;
+import javafx.scene.shape.Rectangle;
+import javafx.stage.Stage;
+import org.junit.Test;
+
+import static junit.framework.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: dgrieve
+ * Date: 9/30/13
+ * Time: 2:22 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class MiscellaneousTests {
+
+    @Test
+    public void test_RT_31168() {
+        //
+        // Make sure that a control added and removed from the scene-graph before css is processed
+        // gets css processed when it is added back in.
+
+        Button button = new Button("RT-31168");
+        Rectangle rectangle = new Rectangle(50,50);
+
+        Group container = new Group();
+        container.getChildren().add(rectangle);
+
+        Scene scene = new Scene(new Group(container, new Button("button")));
+
+        //
+        // Gotta put this in a window for the pulse listener to get hooked up (see Scene#impl_initPeer().
+        // Need the pulse listener since we want to enter root via Scene#doCSSPass()
+        //
+        Stage stage = new Stage();
+        stage.setScene(scene);
+        stage.show();
+
+        //
+        // Has to be a pulse since we want to enter from Scene.doCSSPass()
+        //
+        ((StubToolkit)Toolkit.getToolkit()).fireTestPulse();
+
+        container.getChildren().set(0, button);
+        container.getChildren().set(0, rectangle);
+
+        //
+        // Has to be a pulse since we want to enter from Scene.doCSSPass()
+        //
+        ((StubToolkit)Toolkit.getToolkit()).fireTestPulse();
+
+        // Should be null since the button was added and removed before the pulse processed css
+        assertNull(button.getBackground());
+
+        container.getChildren().set(0, button);
+
+        ((StubToolkit)Toolkit.getToolkit()).fireTestPulse();
+
+        // Should no longer be null
+        assertNotNull(button.getBackground());
+
+    }
+}
--- a/modules/controls/src/test/java/javafx/scene/control/TreeTableViewMouseInputTest.java	Thu Sep 26 08:11:25 2013 -0700
+++ b/modules/controls/src/test/java/javafx/scene/control/TreeTableViewMouseInputTest.java	Tue Oct 01 10:00:06 2013 -0400
@@ -27,10 +27,7 @@
 
 import com.sun.javafx.Utils;
 import com.sun.javafx.scene.control.behavior.TreeTableViewAnchorRetriever;
-import com.sun.javafx.scene.control.infrastructure.KeyEventFirer;
-import com.sun.javafx.scene.control.infrastructure.KeyModifier;
-import com.sun.javafx.scene.control.infrastructure.StageLoader;
-import com.sun.javafx.scene.control.infrastructure.VirtualFlowTestUtils;
+import com.sun.javafx.scene.control.infrastructure.*;
 import com.sun.javafx.scene.control.skin.TreeTableViewSkin;
 import com.sun.javafx.scene.control.test.Person;
 
@@ -44,6 +41,7 @@
 import javafx.collections.FXCollections;
 import javafx.collections.ObservableList;
 import javafx.scene.Group;
+import javafx.scene.Node;
 import javafx.scene.Scene;
 import javafx.scene.control.cell.TreeItemPropertyValueFactory;
 import javafx.scene.input.KeyCode;
@@ -484,4 +482,42 @@
         assertTrue("Selected items: " + sm.getSelectedItems(), sm.getSelectedItems().contains(root));
         assertEquals(6, sm.getSelectedItems().size());
     }
+
+    @Ignore("Test doesn't work - mouse event not firing as expected")
+    @Test public void test_rt_33101() {
+        final int items = 8;
+        root.setValue("New Root");
+        root.getChildren().clear();
+        root.setExpanded(true);
+        for (int i = 0; i < items; i++) {
+            root.getChildren().add(new TreeItem<>("Row " + i));
+        }
+        tableView.setRoot(root);
+
+        new StageLoader(tableView);
+
+        tableView.setShowRoot(true);
+        final MultipleSelectionModel sm = tableView.getSelectionModel();
+        sm.setSelectionMode(SelectionMode.MULTIPLE);
+        sm.clearAndSelect(0);
+
+        TreeTableRow rootRow = (TreeTableRow) VirtualFlowTestUtils.getCell(tableView, 0);
+        Node disclosureNode = rootRow.getDisclosureNode();
+
+        assertTrue(root.isExpanded());
+        assertEquals("New Root", rootRow.getTreeItem().getValue());
+        assertNotNull(disclosureNode);
+        assertTrue(disclosureNode.isVisible());
+        assertTrue(disclosureNode.getScene() != null);
+        assertEquals(9, tableView.getExpandedItemCount());
+
+        MouseEventFirer mouse = new MouseEventFirer(disclosureNode);
+        mouse.fireMousePressAndRelease();
+        assertFalse(root.isExpanded());
+        assertEquals(1, tableView.getExpandedItemCount());
+
+        mouse.fireMousePressAndRelease();
+        assertTrue(root.isExpanded());
+        assertEquals(9, tableView.getExpandedItemCount());
+    }
 }
--- a/modules/graphics/src/main/java/javafx/scene/Node.java	Thu Sep 26 08:11:25 2013 -0700
+++ b/modules/graphics/src/main/java/javafx/scene/Node.java	Tue Oct 01 10:00:06 2013 -0400
@@ -721,6 +721,11 @@
                         // See the comments there, also.
                         //
                         impl_reapplyCSS();
+                    } else {
+                        // RT-31168: reset CssFlag to clean so css will be reapplied if the node is added back later.
+                        // If flag is REAPPLY, then impl_reapplyCSS() will just return and the call to
+                        // notifyParentsOfInvalidatedCSS() will be skipped thus leaving the node un-styled.
+                        cssFlag = CssFlags.CLEAN;
                     }
                     updateTreeVisible();
                     oldParent = newParent;
--- a/modules/web/src/main/java/com/sun/javafx/scene/web/skin/HTMLEditorSkin.java	Thu Sep 26 08:11:25 2013 -0700
+++ b/modules/web/src/main/java/com/sun/javafx/scene/web/skin/HTMLEditorSkin.java	Tue Oct 01 10:00:06 2013 -0400
@@ -696,7 +696,9 @@
                         super.updateItem(item, empty);
                         if (item != null) {
                             setText(item);
-                            setFont(new Font((String)fontFamilyComboBox.getValue(), Double.valueOf(item.substring(0, item.indexOf(" ")))));
+                            // Remove trailing non-digits to get the size (don't assume there's a space).
+                            String size = item.replaceFirst("[^0-9.]*$", "");
+                            setFont(new Font((String)fontFamilyComboBox.getValue(), Double.valueOf(size)));
                         }
                     }
                 };