--- old/modules/javafx.graphics/src/main/java/javafx/scene/layout/Region.java 2016-09-27 21:00:15.000000000 -0700 +++ new/modules/javafx.graphics/src/main/java/javafx/scene/layout/Region.java 2016-09-27 21:00:15.000000000 -0700 @@ -1709,7 +1709,7 @@ * @return value rounded to nearest pixel * @since 9 */ - protected double snapSpaceX(double value) { + public double snapSpaceX(double value) { return snapSpaceX(value, isSnapToPixel()); } @@ -1721,7 +1721,7 @@ * @return value rounded to nearest pixel * @since 9 */ - protected double snapSpaceY(double value) { + public double snapSpaceY(double value) { return snapSpaceY(value, isSnapToPixel()); } @@ -1748,7 +1748,7 @@ * @return value ceiled to nearest pixel * @since 9 */ - protected double snapSizeX(double value) { + public double snapSizeX(double value) { return snapSizeX(value, isSnapToPixel()); } @@ -1760,7 +1760,7 @@ * @return value ceiled to nearest pixel * @since 9 */ - protected double snapSizeY(double value) { + public double snapSizeY(double value) { return snapSizeY(value, isSnapToPixel()); } @@ -1787,7 +1787,7 @@ * @return value rounded to nearest pixel * @since 9 */ - protected double snapPositionX(double value) { + public double snapPositionX(double value) { return snapPositionX(value, isSnapToPixel()); } @@ -1799,7 +1799,7 @@ * @return value rounded to nearest pixel * @since 9 */ - protected double snapPositionY(double value) { + public double snapPositionY(double value) { return snapPositionY(value, isSnapToPixel()); } --- old/modules/javafx.controls/src/main/java/javafx/scene/control/SkinBase.java 2016-09-27 21:00:16.000000000 -0700 +++ new/modules/javafx.controls/src/main/java/javafx/scene/control/SkinBase.java 2016-09-27 21:00:16.000000000 -0700 @@ -486,33 +486,118 @@ } /** - * If this region's snapToPixel property is true, returns a value rounded - * to the nearest pixel, else returns the same value. + * If this region's snapToPixel property is false, this method returns the + * same value, else it tries to return a value rounded to the nearest + * pixel, but since there is no indication if the value is a vertical + * or horizontal measurement then it may be snapped to the wrong pixel + * size metric on screens with different horizontal and vertical scales. * @param value the space value to be snapped * @return value rounded to nearest pixel + * @deprecated replaced by {@code snapSpaceX()} and {@code snapSpaceY()} */ protected double snapSpace(double value) { - return control.isSnapToPixel() ? Math.round(value) : value; + return control.snapSpaceX(value); } /** - * If this region's snapToPixel property is true, returns a value ceiled - * to the nearest pixel, else returns the same value. + * If this region's snapToPixel property is true, returns a value rounded + * to the nearest pixel in the horizontal direction, else returns the + * same value. + * @param value the space value to be snapped + * @return value rounded to nearest pixel + * @since 9 + */ + protected double snapSpaceX(double value) { + return control.snapSpaceX(value); + } + + /** + * If this region's snapToPixel property is true, returns a value rounded + * to the nearest pixel in the vertical direction, else returns the + * same value. + * @param value the space value to be snapped + * @return value rounded to nearest pixel + * @since 9 + */ + protected double snapSpaceY(double value) { + return control.snapSpaceY(value); + } + + /** + /** + * If this region's snapToPixel property is false, this method returns the + * same value, else it tries to return a value ceiled to the nearest + * pixel, but since there is no indication if the value is a vertical + * or horizontal measurement then it may be snapped to the wrong pixel + * size metric on screens with different horizontal and vertical scales. * @param value the size value to be snapped * @return value ceiled to nearest pixel + * @deprecated replaced by {@code snapSizeX()} and {@code snapSizeY()} */ protected double snapSize(double value) { - return control.isSnapToPixel() ? Math.ceil(value) : value; + return control.snapSizeX(value); } /** - * If this region's snapToPixel property is true, returns a value rounded - * to the nearest pixel, else returns the same value. + * If this region's snapToPixel property is true, returns a value ceiled + * to the nearest pixel in the horizontal direction, else returns the + * same value. + * @param value the size value to be snapped + * @return value ceiled to nearest pixel + * @since 9 + */ + protected double snapSizeX(double value) { + return control.snapSizeX(value); + } + + /** + * If this region's snapToPixel property is true, returns a value ceiled + * to the nearest pixel in the vertical direction, else returns the + * same value. + * @param value the size value to be snapped + * @return value ceiled to nearest pixel + * @since 9 + */ + protected double snapSizeY(double value) { + return control.snapSizeY(value); + } + + /** + * If this region's snapToPixel property is false, this method returns the + * same value, else it tries to return a value rounded to the nearest + * pixel, but since there is no indication if the value is a vertical + * or horizontal measurement then it may be snapped to the wrong pixel + * size metric on screens with different horizontal and vertical scales. * @param value the position value to be snapped * @return value rounded to nearest pixel + * @deprecated replaced by {@code snapPositionX()} and {@code snapPositionY()} */ protected double snapPosition(double value) { - return control.isSnapToPixel() ? Math.round(value) : value; + return control.snapPositionX(value); + } + + /** + * If this region's snapToPixel property is true, returns a value rounded + * to the nearest pixel in the horizontal direction, else returns the + * same value. + * @param value the position value to be snapped + * @return value rounded to nearest pixel + * @since 9 + */ + protected double snapPositionX(double value) { + return control.snapPositionX(value); + } + + /** + * If this region's snapToPixel property is true, returns a value rounded + * to the nearest pixel in the vertical direction, else returns the + * same value. + * @param value the position value to be snapped + * @return value rounded to nearest pixel + * @since 9 + */ + protected double snapPositionY(double value) { + return control.snapPositionY(value); } /** --- old/modules/javafx.controls/src/main/java/javafx/scene/control/skin/AccordionSkin.java 2016-09-27 21:00:17.000000000 -0700 +++ new/modules/javafx.controls/src/main/java/javafx/scene/control/skin/AccordionSkin.java 2016-09-27 21:00:16.000000000 -0700 @@ -221,7 +221,7 @@ for (TitledPane tp : getSkinnable().getPanes()) { if (!tp.equals(expandedPane)) { TitledPaneSkin childSkin = (TitledPaneSkin) ((TitledPane)tp).getSkin(); - collapsedPanesHeight += snapSize(childSkin.getTitleRegionSize(w)); + collapsedPanesHeight += snapSizeY(childSkin.getTitleRegionSize(w)); } } final double maxTitledPaneHeight = h - collapsedPanesHeight; @@ -231,7 +231,7 @@ double ph; if (skin instanceof TitledPaneSkin) { ((TitledPaneSkin)skin).setMaxTitledPaneHeightForAccordion(maxTitledPaneHeight); - ph = snapSize(((TitledPaneSkin)skin).getTitledPaneHeightForAccordion()); + ph = snapSizeY(((TitledPaneSkin)skin).getTitledPaneHeightForAccordion()); } else { ph = tp.prefHeight(w); } --- old/modules/javafx.controls/src/main/java/javafx/scene/control/skin/CheckBoxSkin.java 2016-09-27 21:00:17.000000000 -0700 +++ new/modules/javafx.controls/src/main/java/javafx/scene/control/skin/CheckBoxSkin.java 2016-09-27 21:00:17.000000000 -0700 @@ -111,7 +111,7 @@ /** {@inheritDoc} */ @Override protected double computeMinWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) { - return super.computeMinWidth(height, topInset, rightInset, bottomInset, leftInset) + snapSize(box.minWidth(-1)); + return super.computeMinWidth(height, topInset, rightInset, bottomInset, leftInset) + snapSizeX(box.minWidth(-1)); } /** {@inheritDoc} */ @@ -122,7 +122,7 @@ /** {@inheritDoc} */ @Override protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) { - return super.computePrefWidth(height, topInset, rightInset, bottomInset, leftInset) + snapSize(box.prefWidth(-1)); + return super.computePrefWidth(height, topInset, rightInset, bottomInset, leftInset) + snapSizeX(box.prefWidth(-1)); } /** {@inheritDoc} */ @@ -135,10 +135,10 @@ @Override protected void layoutChildren(final double x, final double y, final double w, final double h) { final CheckBox checkBox = getSkinnable(); - final double boxWidth = snapSize(box.prefWidth(-1)); - final double boxHeight = snapSize(box.prefHeight(-1)); + final double boxWidth = snapSizeX(box.prefWidth(-1)); + final double boxHeight = snapSizeY(box.prefHeight(-1)); final double computeWidth = Math.max(checkBox.prefWidth(-1), checkBox.minWidth(-1)); - final double labelWidth = Math.min( computeWidth - boxWidth, w - snapSize(boxWidth)); + final double labelWidth = Math.min( computeWidth - boxWidth, w - snapSizeX(boxWidth)); final double labelHeight = Math.min(checkBox.prefHeight(labelWidth), h); final double maxHeight = Math.max(boxHeight, labelHeight); final double xOffset = Utils.computeXOffset(w, labelWidth + boxWidth, checkBox.getAlignment().getHpos()) + x; --- old/modules/javafx.controls/src/main/java/javafx/scene/control/skin/ComboBoxBaseSkin.java 2016-09-27 21:00:18.000000000 -0700 +++ new/modules/javafx.controls/src/main/java/javafx/scene/control/skin/ComboBoxBaseSkin.java 2016-09-27 21:00:18.000000000 -0700 @@ -166,7 +166,7 @@ updateDisplayArea(); } - final double arrowWidth = snapSize(arrow.prefWidth(-1)); + final double arrowWidth = snapSizeX(arrow.prefWidth(-1)); final double arrowButtonWidth = (isButton()) ? 0 : arrowButton.snappedLeftInset() + arrowWidth + arrowButton.snappedRightInset(); @@ -189,7 +189,7 @@ updateDisplayArea(); } - final double arrowWidth = snapSize(arrow.prefWidth(-1)); + final double arrowWidth = snapSizeX(arrow.prefWidth(-1)); final double arrowButtonWidth = isButton() ? 0 : arrowButton.snappedLeftInset() + arrowWidth + --- old/modules/javafx.controls/src/main/java/javafx/scene/control/skin/ComboBoxPopupControl.java 2016-09-27 21:00:19.000000000 -0700 +++ new/modules/javafx.controls/src/main/java/javafx/scene/control/skin/ComboBoxPopupControl.java 2016-09-27 21:00:18.000000000 -0700 @@ -413,8 +413,8 @@ final ComboBoxBase comboBoxBase = getSkinnable(); _popup.show(comboBoxBase.getScene().getWindow(), - snapPosition(p.getX()), - snapPosition(p.getY())); + snapPositionX(p.getX()), + snapPositionY(p.getY())); popupContent.requestFocus(); @@ -431,15 +431,15 @@ final Region r = (Region) popupContent; // 0 is used here for the width due to RT-46097 - double prefHeight = snapSize(r.prefHeight(0)); - double minHeight = snapSize(r.minHeight(0)); - double maxHeight = snapSize(r.maxHeight(0)); - double h = snapSize(Math.min(Math.max(prefHeight, minHeight), Math.max(minHeight, maxHeight))); - - double prefWidth = snapSize(r.prefWidth(h)); - double minWidth = snapSize(r.minWidth(h)); - double maxWidth = snapSize(r.maxWidth(h)); - double w = snapSize(Math.min(Math.max(prefWidth, minWidth), Math.max(minWidth, maxWidth))); + double prefHeight = snapSizeY(r.prefHeight(0)); + double minHeight = snapSizeY(r.minHeight(0)); + double maxHeight = snapSizeY(r.maxHeight(0)); + double h = snapSizeY(Math.min(Math.max(prefHeight, minHeight), Math.max(minHeight, maxHeight))); + + double prefWidth = snapSizeX(r.prefWidth(h)); + double minWidth = snapSizeX(r.minWidth(h)); + double maxWidth = snapSizeX(r.maxWidth(h)); + double w = snapSizeX(Math.min(Math.max(prefWidth, minWidth), Math.max(minWidth, maxWidth))); popupContent.resize(w, h); } else { --- old/modules/javafx.controls/src/main/java/javafx/scene/control/skin/DateCellSkin.java 2016-09-27 21:00:19.000000000 -0700 +++ new/modules/javafx.controls/src/main/java/javafx/scene/control/skin/DateCellSkin.java 2016-09-27 21:00:19.000000000 -0700 @@ -116,7 +116,7 @@ // Place the secondary Text node at BOTTOM_RIGHT. double textX = x + w - rightLabelPadding() - secondaryText.getLayoutBounds().getWidth(); double textY = y + h - bottomLabelPadding() - secondaryText.getLayoutBounds().getHeight(); - secondaryText.relocate(snapPosition(textX), snapPosition(textY)); + secondaryText.relocate(snapPositionX(textX), snapPositionY(textY)); } } @@ -125,7 +125,7 @@ double topInset, double rightInset, double bottomInset, double leftInset) { double pref = super.computePrefWidth(height, topInset, rightInset, bottomInset, leftInset); - return snapSize(Math.max(pref, cellSize())); + return snapSizeX(Math.max(pref, cellSize())); } /** {@inheritDoc} */ @@ -133,7 +133,7 @@ double topInset, double rightInset, double bottomInset, double leftInset) { double pref = super.computePrefHeight(width, topInset, rightInset, bottomInset, leftInset); - return snapSize(Math.max(pref, cellSize())); + return snapSizeY(Math.max(pref, cellSize())); } --- old/modules/javafx.controls/src/main/java/javafx/scene/control/skin/LabeledSkinBase.java 2016-09-27 21:00:20.000000000 -0700 +++ new/modules/javafx.controls/src/main/java/javafx/scene/control/skin/LabeledSkinBase.java 2016-09-27 21:00:20.000000000 -0700 @@ -503,8 +503,8 @@ text.setText(""); } else { updateDisplayedText(w, h); // Have to do this just in case it needs to be recomputed - textWidth = snapSize(Math.min(text.getLayoutBounds().getWidth(), wrapWidth)); - textHeight = snapSize(Math.min(text.getLayoutBounds().getHeight(), wrapHeight)); + textWidth = snapSizeX(Math.min(text.getLayoutBounds().getWidth(), wrapWidth)); + textHeight = snapSizeY(Math.min(text.getLayoutBounds().getHeight(), wrapHeight)); } final double gap = (ignoreText || ignoreGraphic) ? 0 : labeled.getGraphicTextGap(); @@ -578,13 +578,13 @@ if (text.isManaged()) { text.setManaged(false); } - text.relocate(snapPosition(contentX), snapPosition(contentY)); + text.relocate(snapPositionX(contentX), snapPositionY(contentY)); } else if (ignoreGraphic) { // Since I only have to position the text, it goes at the // contentX/contentY location. Note that positionNode will // adjust the text based on the text's minX/minY so no need to // worry about that here - text.relocate(snapPosition(contentX), snapPosition(contentY)); + text.relocate(snapPositionX(contentX), snapPositionY(contentY)); if (containsMnemonic) { mnemonic_underscore.setEndX(mnemonicWidth-2.0); mnemonic_underscore.relocate(contentX+preMnemonicWidth, contentY+mnemonicHeight-1); @@ -594,8 +594,8 @@ // there isn't text to display, so we need to position it // such that it doesn't affect the content area (although when // there is a graphic, the text isn't even in the scene) - text.relocate(snapPosition(contentX), snapPosition(contentY)); - graphic.relocate(snapPosition(contentX), snapPosition(contentY)); + text.relocate(snapPositionX(contentX), snapPositionY(contentY)); + graphic.relocate(snapPositionX(contentX), snapPositionY(contentY)); if (containsMnemonic) { mnemonic_underscore.setEndX(mnemonicWidth); mnemonic_underscore.setStrokeWidth(mnemonicHeight/10.0); @@ -642,13 +642,13 @@ graphicY = contentY + ((contentHeight - graphicHeight) / 2.0); textY = contentY + ((contentHeight - textHeight) / 2.0); } - text.relocate(snapPosition(textX), snapPosition(textY)); + text.relocate(snapPositionX(textX), snapPositionY(textY)); if (containsMnemonic) { mnemonic_underscore.setEndX(mnemonicWidth); mnemonic_underscore.setStrokeWidth(mnemonicHeight/10.0); - mnemonic_underscore.relocate(snapPosition(textX+preMnemonicWidth), snapPosition(textY+mnemonicHeight-1)); + mnemonic_underscore.relocate(snapPositionX(textX+preMnemonicWidth), snapPositionY(textY+mnemonicHeight-1)); } - graphic.relocate(snapPosition(graphicX), snapPosition(graphicY)); + graphic.relocate(snapPositionX(graphicX), snapPositionY(graphicY)); } /** @@ -822,19 +822,19 @@ } double topLabelPadding() { - return snapSize(getSkinnable().getLabelPadding().getTop()); + return snapSizeY(getSkinnable().getLabelPadding().getTop()); } double bottomLabelPadding() { - return snapSize(getSkinnable().getLabelPadding().getBottom()); + return snapSizeY(getSkinnable().getLabelPadding().getBottom()); } double leftLabelPadding() { - return snapSize(getSkinnable().getLabelPadding().getLeft()); + return snapSizeX(getSkinnable().getLabelPadding().getLeft()); } double rightLabelPadding() { - return snapSize(getSkinnable().getLabelPadding().getRight()); + return snapSizeX(getSkinnable().getLabelPadding().getRight()); } --- old/modules/javafx.controls/src/main/java/javafx/scene/control/skin/MenuBarSkin.java 2016-09-27 21:00:21.000000000 -0700 +++ new/modules/javafx.controls/src/main/java/javafx/scene/control/skin/MenuBarSkin.java 2016-09-27 21:00:21.000000000 -0700 @@ -572,11 +572,11 @@ // --- spacing private DoubleProperty spacing; public final void setSpacing(double value) { - spacingProperty().set(snapSpace(value)); + spacingProperty().set(snapSpaceX(value)); } public final double getSpacing() { - return spacing == null ? 0.0 : snapSpace(spacing.get()); + return spacing == null ? 0.0 : snapSpaceX(spacing.get()); } public final DoubleProperty spacingProperty() { --- old/modules/javafx.controls/src/main/java/javafx/scene/control/skin/MenuButtonSkinBase.java 2016-09-27 21:00:21.000000000 -0700 +++ new/modules/javafx.controls/src/main/java/javafx/scene/control/skin/MenuButtonSkinBase.java 2016-09-27 21:00:21.000000000 -0700 @@ -216,14 +216,14 @@ @Override protected double computeMinWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) { return leftInset + label.minWidth(height) - + snapSize(arrowButton.minWidth(height)) + + snapSizeX(arrowButton.minWidth(height)) + rightInset; } /** {@inheritDoc} */ @Override protected double computeMinHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) { return topInset - + Math.max(label.minHeight(width), snapSize(arrowButton.minHeight(-1))) + + Math.max(label.minHeight(width), snapSizeY(arrowButton.minHeight(-1))) + bottomInset; } @@ -231,14 +231,14 @@ @Override protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) { return leftInset + label.prefWidth(height) - + snapSize(arrowButton.prefWidth(height)) + + snapSizeX(arrowButton.prefWidth(height)) + rightInset; } /** {@inheritDoc} */ @Override protected double computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) { return topInset - + Math.max(label.prefHeight(width), snapSize(arrowButton.prefHeight(-1))) + + Math.max(label.prefHeight(width), snapSizeY(arrowButton.prefHeight(-1))) + bottomInset; } @@ -255,7 +255,7 @@ /** {@inheritDoc} */ @Override protected void layoutChildren(final double x, final double y, final double w, final double h) { - final double arrowButtonWidth = snapSize(arrowButton.prefWidth(-1)); + final double arrowButtonWidth = snapSizeX(arrowButton.prefWidth(-1)); label.resizeRelocate(x, y, w - arrowButtonWidth, h); arrowButton.resizeRelocate(x + (w - arrowButtonWidth), y, arrowButtonWidth, h); } --- old/modules/javafx.controls/src/main/java/javafx/scene/control/skin/PaginationSkin.java 2016-09-27 21:00:22.000000000 -0700 +++ new/modules/javafx.controls/src/main/java/javafx/scene/control/skin/PaginationSkin.java 2016-09-27 21:00:22.000000000 -0700 @@ -392,33 +392,33 @@ /** {@inheritDoc} */ @Override protected double computeMinWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) { - double navigationWidth = navigation.isVisible() ? snapSize(navigation.minWidth(height)) : 0; + double navigationWidth = navigation.isVisible() ? snapSizeX(navigation.minWidth(height)) : 0; return leftInset + Math.max(currentStackPane.minWidth(height), navigationWidth) + rightInset; } /** {@inheritDoc} */ @Override protected double computeMinHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) { - double navigationHeight = navigation.isVisible() ? snapSize(navigation.minHeight(width)) : 0; + double navigationHeight = navigation.isVisible() ? snapSizeY(navigation.minHeight(width)) : 0; return topInset + currentStackPane.minHeight(width) + navigationHeight + bottomInset; } /** {@inheritDoc} */ @Override protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) { - double navigationWidth = navigation.isVisible() ? snapSize(navigation.prefWidth(height)) : 0; + double navigationWidth = navigation.isVisible() ? snapSizeX(navigation.prefWidth(height)) : 0; return leftInset + Math.max(currentStackPane.prefWidth(height), navigationWidth) + rightInset; } /** {@inheritDoc} */ @Override protected double computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) { - double navigationHeight = navigation.isVisible() ? snapSize(navigation.prefHeight(width)) : 0; + double navigationHeight = navigation.isVisible() ? snapSizeY(navigation.prefHeight(width)) : 0; return topInset + currentStackPane.prefHeight(width) + navigationHeight + bottomInset; } /** {@inheritDoc} */ @Override protected void layoutChildren(final double x, final double y, final double w, final double h) { - double navigationHeight = navigation.isVisible() ? snapSize(navigation.prefHeight(-1)) : 0; - double stackPaneHeight = snapSize(h - navigationHeight); + double navigationHeight = navigation.isVisible() ? snapSizeY(navigation.prefHeight(-1)) : 0; + double stackPaneHeight = snapSizeY(h - navigationHeight); layoutInArea(currentStackPane, x, y, w, stackPaneHeight, 0, HPos.CENTER, VPos.CENTER); layoutInArea(nextStackPane, x, y, w, stackPaneHeight, 0, HPos.CENTER, VPos.CENTER); --- old/modules/javafx.controls/src/main/java/javafx/scene/control/skin/RadioButtonSkin.java 2016-09-27 21:00:23.000000000 -0700 +++ new/modules/javafx.controls/src/main/java/javafx/scene/control/skin/RadioButtonSkin.java 2016-09-27 21:00:23.000000000 -0700 @@ -106,23 +106,23 @@ /** {@inheritDoc} */ @Override protected double computeMinWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) { - return super.computeMinWidth(height, topInset, rightInset, bottomInset, leftInset) + snapSize(radio.minWidth(-1)); + return super.computeMinWidth(height, topInset, rightInset, bottomInset, leftInset) + snapSizeX(radio.minWidth(-1)); } /** {@inheritDoc} */ @Override protected double computeMinHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) { - return Math.max(snapSize(super.computeMinHeight(width - radio.minWidth(-1), topInset, rightInset, bottomInset, leftInset)), + return Math.max(snapSizeY(super.computeMinHeight(width - radio.minWidth(-1), topInset, rightInset, bottomInset, leftInset)), topInset + radio.minHeight(-1) + bottomInset); } /** {@inheritDoc} */ @Override protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) { - return super.computePrefWidth(height, topInset, rightInset, bottomInset, leftInset) + snapSize(radio.prefWidth(-1)); + return super.computePrefWidth(height, topInset, rightInset, bottomInset, leftInset) + snapSizeX(radio.prefWidth(-1)); } /** {@inheritDoc} */ @Override protected double computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) { - return Math.max(snapSize(super.computePrefHeight(width - radio.prefWidth(-1), topInset, rightInset, bottomInset, leftInset)), + return Math.max(snapSizeY(super.computePrefHeight(width - radio.prefWidth(-1), topInset, rightInset, bottomInset, leftInset)), topInset + radio.prefHeight(-1) + bottomInset); } @@ -133,14 +133,14 @@ final double radioWidth = radio.prefWidth(-1); final double radioHeight = radio.prefHeight(-1); final double computeWidth = Math.max(radioButton.prefWidth(-1),radioButton.minWidth(-1)); - final double labelWidth = Math.min(computeWidth - radioWidth, w - snapSize(radioWidth)); + final double labelWidth = Math.min(computeWidth - radioWidth, w - snapSizeX(radioWidth)); final double labelHeight = Math.min(radioButton.prefHeight(labelWidth), h); final double maxHeight = Math.max(radioHeight, labelHeight); final double xOffset = Utils.computeXOffset(w, labelWidth + radioWidth, radioButton.getAlignment().getHpos()) + x; final double yOffset = Utils.computeYOffset(h, maxHeight, radioButton.getAlignment().getVpos()) + y; layoutLabelInArea(xOffset + radioWidth, yOffset, labelWidth, maxHeight, radioButton.getAlignment()); - radio.resize(snapSize(radioWidth), snapSize(radioHeight)); + radio.resize(snapSizeX(radioWidth), snapSizeY(radioHeight)); positionInArea(radio, xOffset, yOffset, radioWidth, maxHeight, 0, radioButton.getAlignment().getHpos(), radioButton.getAlignment().getVpos()); } --- old/modules/javafx.controls/src/main/java/javafx/scene/control/skin/ScrollBarSkin.java 2016-09-27 21:00:24.000000000 -0700 +++ new/modules/javafx.controls/src/main/java/javafx/scene/control/skin/ScrollBarSkin.java 2016-09-27 21:00:23.000000000 -0700 @@ -152,58 +152,58 @@ if (s.getOrientation() == Orientation.VERTICAL) { if (!Properties.IS_TOUCH_SUPPORTED) { - double decHeight = snapSize(decButton.prefHeight(-1)); - double incHeight = snapSize(incButton.prefHeight(-1)); + double decHeight = snapSizeY(decButton.prefHeight(-1)); + double incHeight = snapSizeY(incButton.prefHeight(-1)); decButton.resize(w, decHeight); incButton.resize(w, incHeight); - trackLength = snapSize(h - (decHeight + incHeight)); - thumbLength = snapSize(Utils.clamp(minThumbLength(), (trackLength * visiblePortion), trackLength)); + trackLength = snapSizeY(h - (decHeight + incHeight)); + thumbLength = snapSizeY(Utils.clamp(minThumbLength(), (trackLength * visiblePortion), trackLength)); - trackBackground.resizeRelocate(snapPosition(x), snapPosition(y), w, trackLength+decHeight+incHeight); - decButton.relocate(snapPosition(x), snapPosition(y)); - incButton.relocate(snapPosition(x), snapPosition(y + h - incHeight)); - track.resizeRelocate(snapPosition(x), snapPosition(y + decHeight), w, trackLength); - thumb.resize(snapSize(x >= 0 ? w : w + x), thumbLength); // Account for negative padding (see also RT-10719) + trackBackground.resizeRelocate(snapPositionX(x), snapPositionY(y), w, trackLength+decHeight+incHeight); + decButton.relocate(snapPositionX(x), snapPositionY(y)); + incButton.relocate(snapPositionX(x), snapPositionY(y + h - incHeight)); + track.resizeRelocate(snapPositionX(x), snapPositionY(y + decHeight), w, trackLength); + thumb.resize(snapSizeX(x >= 0 ? w : w + x), thumbLength); // Account for negative padding (see also RT-10719) positionThumb(); } else { - trackLength = snapSize(h); - thumbLength = snapSize(Utils.clamp(minThumbLength(), (trackLength * visiblePortion), trackLength)); + trackLength = snapSizeY(h); + thumbLength = snapSizeY(Utils.clamp(minThumbLength(), (trackLength * visiblePortion), trackLength)); - track.resizeRelocate(snapPosition(x), snapPosition(y), w, trackLength); - thumb.resize(snapSize(x >= 0 ? w : w + x), thumbLength); // Account for negative padding (see also RT-10719) + track.resizeRelocate(snapPositionX(x), snapPositionY(y), w, trackLength); + thumb.resize(snapSizeX(x >= 0 ? w : w + x), thumbLength); // Account for negative padding (see also RT-10719) positionThumb(); } } else { if (!Properties.IS_TOUCH_SUPPORTED) { - double decWidth = snapSize(decButton.prefWidth(-1)); - double incWidth = snapSize(incButton.prefWidth(-1)); + double decWidth = snapSizeX(decButton.prefWidth(-1)); + double incWidth = snapSizeX(incButton.prefWidth(-1)); decButton.resize(decWidth, h); incButton.resize(incWidth, h); - trackLength = snapSize(w - (decWidth + incWidth)); - thumbLength = snapSize(Utils.clamp(minThumbLength(), (trackLength * visiblePortion), trackLength)); + trackLength = snapSizeX(w - (decWidth + incWidth)); + thumbLength = snapSizeX(Utils.clamp(minThumbLength(), (trackLength * visiblePortion), trackLength)); - trackBackground.resizeRelocate(snapPosition(x), snapPosition(y), trackLength+decWidth+incWidth, h); - decButton.relocate(snapPosition(x), snapPosition(y)); - incButton.relocate(snapPosition(x + w - incWidth), snapPosition(y)); - track.resizeRelocate(snapPosition(x + decWidth), snapPosition(y), trackLength, h); - thumb.resize(thumbLength, snapSize(y >= 0 ? h : h + y)); // Account for negative padding (see also RT-10719) + trackBackground.resizeRelocate(snapPositionX(x), snapPositionY(y), trackLength+decWidth+incWidth, h); + decButton.relocate(snapPositionX(x), snapPositionY(y)); + incButton.relocate(snapPositionX(x + w - incWidth), snapPositionY(y)); + track.resizeRelocate(snapPositionX(x + decWidth), snapPositionY(y), trackLength, h); + thumb.resize(thumbLength, snapSizeY(y >= 0 ? h : h + y)); // Account for negative padding (see also RT-10719) positionThumb(); } else { - trackLength = snapSize(w); - thumbLength = snapSize(Utils.clamp(minThumbLength(), (trackLength * visiblePortion), trackLength)); + trackLength = snapSizeX(w); + thumbLength = snapSizeX(Utils.clamp(minThumbLength(), (trackLength * visiblePortion), trackLength)); - track.resizeRelocate(snapPosition(x), snapPosition(y), trackLength, h); - thumb.resize(thumbLength, snapSize(y >= 0 ? h : h + y)); // Account for negative padding (see also RT-10719) + track.resizeRelocate(snapPositionX(x), snapPositionY(y), trackLength, h); + thumb.resize(thumbLength, snapSizeY(y >= 0 ? h : h + y)); // Account for negative padding (see also RT-10719) positionThumb(); } - s.resize(snapSize(s.getWidth()), snapSize(s.getHeight())); + s.resize(snapSizeX(s.getWidth()), snapSizeY(s.getHeight())); } // things should be invisible only when well below minimum length @@ -616,8 +616,8 @@ } } - thumb.setTranslateX( snapPosition(s.getOrientation() == Orientation.VERTICAL ? snappedLeftInset() : trackPos + snappedLeftInset())); - thumb.setTranslateY( snapPosition(s.getOrientation() == Orientation.VERTICAL ? trackPos + snappedTopInset() : snappedTopInset())); + thumb.setTranslateX( snapPositionX(s.getOrientation() == Orientation.VERTICAL ? snappedLeftInset() : trackPos + snappedLeftInset())); + thumb.setTranslateY( snapPositionY(s.getOrientation() == Orientation.VERTICAL ? trackPos + snappedTopInset() : snappedTopInset())); } private Node getThumb() { --- old/modules/javafx.controls/src/main/java/javafx/scene/control/skin/ScrollPaneSkin.java 2016-09-27 21:00:24.000000000 -0700 +++ new/modules/javafx.controls/src/main/java/javafx/scene/control/skin/ScrollPaneSkin.java 2016-09-27 21:00:24.000000000 -0700 @@ -200,8 +200,8 @@ double oldHeight = oldBounds.getHeight(); double newHeight = newBounds.getHeight(); if (oldHeight > 0 && oldHeight != newHeight) { - double oldPositionY = (snapPosition(snappedTopInset() - posY / (vsb.getMax() - vsb.getMin()) * (oldHeight - contentHeight))); - double newPositionY = (snapPosition(snappedTopInset() - posY / (vsb.getMax() - vsb.getMin()) * (newHeight - contentHeight))); + double oldPositionY = (snapPositionY(snappedTopInset() - posY / (vsb.getMax() - vsb.getMin()) * (oldHeight - contentHeight))); + double newPositionY = (snapPositionY(snappedTopInset() - posY / (vsb.getMax() - vsb.getMin()) * (newHeight - contentHeight))); double newValueY = (oldPositionY/newPositionY)*vsb.getValue(); if (newValueY < 0.0) { @@ -224,8 +224,8 @@ double oldWidth = oldBounds.getWidth(); double newWidth = newBounds.getWidth(); if (oldWidth > 0 && oldWidth != newWidth) { - double oldPositionX = (snapPosition(snappedLeftInset() - posX / (hsb.getMax() - hsb.getMin()) * (oldWidth - contentWidth))); - double newPositionX = (snapPosition(snappedLeftInset() - posX / (hsb.getMax() - hsb.getMin()) * (newWidth - contentWidth))); + double oldPositionX = (snapPositionX(snappedLeftInset() - posX / (hsb.getMax() - hsb.getMin()) * (oldWidth - contentWidth))); + double newPositionX = (snapPositionX(snappedLeftInset() - posX / (hsb.getMax() - hsb.getMin()) * (newWidth - contentWidth))); double newValueX = (oldPositionX/newPositionX)*hsb.getValue(); if (newValueX < 0.0) { @@ -279,8 +279,8 @@ } scrollNode = getSkinnable().getContent(); if (scrollNode != null) { - nodeWidth = snapSize(scrollNode.getLayoutBounds().getWidth()); - nodeHeight = snapSize(scrollNode.getLayoutBounds().getHeight()); + nodeWidth = snapSizeX(scrollNode.getLayoutBounds().getWidth()); + nodeHeight = snapSizeY(scrollNode.getLayoutBounds().getHeight()); viewContent.getChildren().setAll(scrollNode); scrollNode.layoutBoundsProperty().addListener(nodeListener); scrollNode.layoutBoundsProperty().addListener(boundsChangeListener); @@ -478,10 +478,10 @@ final double w, final double h) { final ScrollPane control = getSkinnable(); final Insets padding = control.getPadding(); - final double rightPadding = snapSize(padding.getRight()); - final double leftPadding = snapSize(padding.getLeft()); - final double topPadding = snapSize(padding.getTop()); - final double bottomPadding = snapSize(padding.getBottom()); + final double rightPadding = snapSizeX(padding.getRight()); + final double leftPadding = snapSizeX(padding.getLeft()); + final double topPadding = snapSizeY(padding.getTop()); + final double bottomPadding = snapSizeY(padding.getBottom()); vsb.setMin(control.getVmin()); vsb.setMax(control.getVmax()); @@ -586,18 +586,18 @@ } updateHorizontalSB(); - viewRect.resizeRelocate(snappedLeftInset(), snappedTopInset(), snapSize(contentWidth), snapSize(contentHeight)); + viewRect.resizeRelocate(snappedLeftInset(), snappedTopInset(), snapSizeX(contentWidth), snapSizeY(contentHeight)); resetClip(); if (vsbvis && hsbvis) { corner.setVisible(true); double cornerWidth = vsbWidth; double cornerHeight = hsbHeight; - corner.resizeRelocate(snapPosition(vsb.getLayoutX()), snapPosition(hsb.getLayoutY()), snapSize(cornerWidth), snapSize(cornerHeight)); + corner.resizeRelocate(snapPositionX(vsb.getLayoutX()), snapPositionY(hsb.getLayoutY()), snapSizeX(cornerWidth), snapSizeY(cornerHeight)); } else { corner.setVisible(false); } - control.setViewportBounds(new BoundingBox(snapPosition(viewContent.getLayoutX()), snapPosition(viewContent.getLayoutY()), snapSize(contentWidth), snapSize(contentHeight))); + control.setViewportBounds(new BoundingBox(snapPositionX(viewContent.getLayoutX()), snapPositionY(viewContent.getLayoutY()), snapSizeX(contentWidth), snapSizeY(contentHeight))); } /** {@inheritDoc} */ @@ -1039,27 +1039,27 @@ ScrollPane control = getSkinnable(); Orientation bias = scrollNode.getContentBias(); if (bias == null) { - nodeWidth = snapSize(boundedSize(control.isFitToWidth()? contentWidth : scrollNode.prefWidth(-1), + nodeWidth = snapSizeX(boundedSize(control.isFitToWidth()? contentWidth : scrollNode.prefWidth(-1), scrollNode.minWidth(-1),scrollNode.maxWidth(-1))); - nodeHeight = snapSize(boundedSize(control.isFitToHeight()? contentHeight : scrollNode.prefHeight(-1), + nodeHeight = snapSizeY(boundedSize(control.isFitToHeight()? contentHeight : scrollNode.prefHeight(-1), scrollNode.minHeight(-1), scrollNode.maxHeight(-1))); } else if (bias == Orientation.HORIZONTAL) { - nodeWidth = snapSize(boundedSize(control.isFitToWidth()? contentWidth : scrollNode.prefWidth(-1), + nodeWidth = snapSizeX(boundedSize(control.isFitToWidth()? contentWidth : scrollNode.prefWidth(-1), scrollNode.minWidth(-1),scrollNode.maxWidth(-1))); - nodeHeight = snapSize(boundedSize(control.isFitToHeight()? contentHeight : scrollNode.prefHeight(nodeWidth), + nodeHeight = snapSizeY(boundedSize(control.isFitToHeight()? contentHeight : scrollNode.prefHeight(nodeWidth), scrollNode.minHeight(nodeWidth),scrollNode.maxHeight(nodeWidth))); } else { // bias == VERTICAL - nodeHeight = snapSize(boundedSize(control.isFitToHeight()? contentHeight : scrollNode.prefHeight(-1), + nodeHeight = snapSizeY(boundedSize(control.isFitToHeight()? contentHeight : scrollNode.prefHeight(-1), scrollNode.minHeight(-1), scrollNode.maxHeight(-1))); - nodeWidth = snapSize(boundedSize(control.isFitToWidth()? contentWidth : scrollNode.prefWidth(nodeHeight), + nodeWidth = snapSizeX(boundedSize(control.isFitToWidth()? contentWidth : scrollNode.prefWidth(nodeHeight), scrollNode.minWidth(nodeHeight),scrollNode.maxWidth(nodeHeight))); } } else { - nodeWidth = snapSize(scrollNode.getLayoutBounds().getWidth()); - nodeHeight = snapSize(scrollNode.getLayoutBounds().getHeight()); + nodeWidth = snapSizeX(scrollNode.getLayoutBounds().getWidth()); + nodeHeight = snapSizeY(scrollNode.getLayoutBounds().getHeight()); } nodeSizeInvalid = false; } @@ -1104,7 +1104,7 @@ } private void computeScrollBarSize() { - vsbWidth = snapSize(vsb.prefWidth(-1)); + vsbWidth = snapSizeX(vsb.prefWidth(-1)); if (vsbWidth == 0) { // println("*** WARNING ScrollPaneSkin: can't get scroll bar width, using {DEFAULT_SB_BREADTH}"); if (Properties.IS_TOUCH_SUPPORTED) { @@ -1114,7 +1114,7 @@ vsbWidth = DEFAULT_SB_BREADTH; } } - hsbHeight = snapSize(hsb.prefHeight(-1)); + hsbHeight = snapSizeY(hsb.prefHeight(-1)); if (hsbHeight == 0) { // println("*** WARNING ScrollPaneSkin: can't get scroll bar height, using {DEFAULT_SB_BREADTH}"); if (Properties.IS_TOUCH_SUPPORTED) { @@ -1178,7 +1178,7 @@ final ScrollPane sp = getSkinnable(); double x = isReverseNodeOrientation() ? (hsb.getMax() - (posX - hsb.getMin())) : posX; double minX = Math.min((- x / (hsb.getMax() - hsb.getMin()) * (nodeWidth - contentWidth)), 0); - viewContent.setLayoutX(snapPosition(minX)); + viewContent.setLayoutX(snapPositionX(minX)); if (!sp.hvalueProperty().isBound()) sp.setHvalue(Utils.clamp(sp.getHmin(), posX, sp.getHmax())); return posX; } @@ -1186,14 +1186,14 @@ private double updatePosY() { final ScrollPane sp = getSkinnable(); double minY = Math.min((- posY / (vsb.getMax() - vsb.getMin()) * (nodeHeight - contentHeight)), 0); - viewContent.setLayoutY(snapPosition(minY)); + viewContent.setLayoutY(snapPositionY(minY)); if (!sp.vvalueProperty().isBound()) sp.setVvalue(Utils.clamp(sp.getVmin(), posY, sp.getVmax())); return posY; } private void resetClip() { - clipRect.setWidth(snapSize(contentWidth)); - clipRect.setHeight(snapSize(contentHeight)); + clipRect.setWidth(snapSizeX(contentWidth)); + clipRect.setHeight(snapSizeY(contentHeight)); } private void startSBReleasedAnimation() { --- old/modules/javafx.controls/src/main/java/javafx/scene/control/skin/SliderSkin.java 2016-09-27 21:00:25.000000000 -0700 +++ new/modules/javafx.controls/src/main/java/javafx/scene/control/skin/SliderSkin.java 2016-09-27 21:00:25.000000000 -0700 @@ -188,8 +188,8 @@ final double w, final double h) { // calculate the available space // resize thumb to preferred size - thumbWidth = snapSize(thumb.prefWidth(-1)); - thumbHeight = snapSize(thumb.prefHeight(-1)); + thumbWidth = snapSizeX(thumb.prefWidth(-1)); + thumbHeight = snapSizeY(thumb.prefHeight(-1)); thumb.resize(thumbWidth, thumbHeight); // we are assuming the is common radius's for all corners on the track double trackRadius = track.getBackground() == null ? 0 : track.getBackground().getFills().size() > 0 ? @@ -197,12 +197,12 @@ if (getSkinnable().getOrientation() == Orientation.HORIZONTAL) { double tickLineHeight = (showTickMarks) ? tickLine.prefHeight(-1) : 0; - double trackHeight = snapSize(track.prefHeight(-1)); + double trackHeight = snapSizeY(track.prefHeight(-1)); double trackAreaHeight = Math.max(trackHeight,thumbHeight); double totalHeightNeeded = trackAreaHeight + ((showTickMarks) ? trackToTickGap+tickLineHeight : 0); double startY = y + ((h - totalHeightNeeded)/2); // center slider in available height vertically - trackLength = snapSize(w - thumbWidth); - trackStart = snapPosition(x + (thumbWidth/2)); + trackLength = snapSizeX(w - thumbWidth); + trackStart = snapPositionX(x + (thumbWidth/2)); double trackTop = (int)(startY + ((trackAreaHeight-trackHeight)/2)); thumbTop = (int)(startY + ((trackAreaHeight-thumbHeight)/2)); @@ -227,12 +227,12 @@ } } else { double tickLineWidth = (showTickMarks) ? tickLine.prefWidth(-1) : 0; - double trackWidth = snapSize(track.prefWidth(-1)); + double trackWidth = snapSizeX(track.prefWidth(-1)); double trackAreaWidth = Math.max(trackWidth,thumbWidth); double totalWidthNeeded = trackAreaWidth + ((showTickMarks) ? trackToTickGap+tickLineWidth : 0) ; double startX = x + ((w - totalWidthNeeded)/2); // center slider in available width horizontally - trackLength = snapSize(h - thumbHeight); - trackStart = snapPosition(y + (thumbHeight/2)); + trackLength = snapSizeY(h - thumbHeight); + trackStart = snapPositionY(y + (thumbHeight/2)); double trackLeft = (int)(startX + ((trackAreaWidth-trackWidth)/2)); thumbLeft = (int)(startX + ((trackAreaWidth-thumbWidth)/2)); --- old/modules/javafx.controls/src/main/java/javafx/scene/control/skin/SpinnerSkin.java 2016-09-27 21:00:26.000000000 -0700 +++ new/modules/javafx.controls/src/main/java/javafx/scene/control/skin/SpinnerSkin.java 2016-09-27 21:00:25.000000000 -0700 @@ -266,10 +266,10 @@ final double w, final double h) { final double incrementArrowButtonWidth = incrementArrowButton.snappedLeftInset() + - snapSize(incrementArrow.prefWidth(-1)) + incrementArrowButton.snappedRightInset(); + snapSizeX(incrementArrow.prefWidth(-1)) + incrementArrowButton.snappedRightInset(); final double decrementArrowButtonWidth = decrementArrowButton.snappedLeftInset() + - snapSize(decrementArrow.prefWidth(-1)) + decrementArrowButton.snappedRightInset(); + snapSizeX(decrementArrow.prefWidth(-1)) + decrementArrowButton.snappedRightInset(); final double widestArrowButton = Math.max(incrementArrowButtonWidth, decrementArrowButtonWidth); @@ -309,10 +309,10 @@ incrementArrowButtonWidth, h, 0, HPos.CENTER, VPos.CENTER); } else if (layoutMode == SPLIT_ARROWS_VERTICAL) { final double incrementArrowButtonHeight = incrementArrowButton.snappedTopInset() + - snapSize(incrementArrow.prefHeight(-1)) + incrementArrowButton.snappedBottomInset(); + snapSizeY(incrementArrow.prefHeight(-1)) + incrementArrowButton.snappedBottomInset(); final double decrementArrowButtonHeight = decrementArrowButton.snappedTopInset() + - snapSize(decrementArrow.prefHeight(-1)) + decrementArrowButton.snappedBottomInset(); + snapSizeY(decrementArrow.prefHeight(-1)) + decrementArrowButton.snappedBottomInset(); final double tallestArrowButton = Math.max(incrementArrowButtonHeight, decrementArrowButtonHeight); @@ -427,4 +427,4 @@ **************************************************************************/ private static PseudoClass CONTAINS_FOCUS_PSEUDOCLASS_STATE = PseudoClass.getPseudoClass("contains-focus"); -} \ No newline at end of file +} --- old/modules/javafx.controls/src/main/java/javafx/scene/control/skin/SplitPaneSkin.java 2016-09-27 21:00:26.000000000 -0700 +++ new/modules/javafx.controls/src/main/java/javafx/scene/control/skin/SplitPaneSkin.java 2016-09-27 21:00:26.000000000 -0700 @@ -227,7 +227,11 @@ Content c = contentRegions.get(i); double min = horizontal ? c.minWidth(-1) : c.minHeight(-1); percentage = min/minSize; - c.setArea(snapSpace(percentage * (horizontal ? w : h))); + if (horizontal) { + c.setArea(snapSpaceX(percentage * w)); + } else { + c.setArea(snapSpaceY(percentage * h)); + } c.setAvailable(0); } setupContentAndDividerForLayout(); @@ -758,7 +762,7 @@ return size; } - size = snapSize(size); + size = horizontal ? snapSizeX(size) : snapSizeY(size); int portion = (int)(size)/available.size(); int remainder; @@ -812,7 +816,7 @@ return size; } - size = snapSize(size); + size = horizontal ? snapSizeX(size) : snapSizeY(size); int portion = (int)(size)/available.size(); int remainder; --- old/modules/javafx.controls/src/main/java/javafx/scene/control/skin/TabPaneSkin.java 2016-09-27 21:00:27.000000000 -0700 +++ new/modules/javafx.controls/src/main/java/javafx/scene/control/skin/TabPaneSkin.java 2016-09-27 21:00:27.000000000 -0700 @@ -274,16 +274,17 @@ // The TabPane can only be as wide as it widest content width. double maxw = 0.0; for (TabContentRegion contentRegion: tabContentRegions) { - maxw = Math.max(maxw, snapSize(contentRegion.prefWidth(-1))); + maxw = Math.max(maxw, snapSizeX(contentRegion.prefWidth(-1))); } final boolean isHorizontal = isHorizontal(); - final double tabHeaderAreaSize = snapSize(isHorizontal ? - tabHeaderArea.prefWidth(-1) : tabHeaderArea.prefHeight(-1)); + final double tabHeaderAreaSize = isHorizontal + ? snapSizeX(tabHeaderArea.prefWidth(-1)) + : snapSizeY(tabHeaderArea.prefHeight(-1)); double prefWidth = isHorizontal ? Math.max(maxw, tabHeaderAreaSize) : maxw + tabHeaderAreaSize; - return snapSize(prefWidth) + rightInset + leftInset; + return snapSizeX(prefWidth) + rightInset + leftInset; } /** {@inheritDoc} */ @@ -291,16 +292,17 @@ // The TabPane can only be as high as it highest content height. double maxh = 0.0; for (TabContentRegion contentRegion: tabContentRegions) { - maxh = Math.max(maxh, snapSize(contentRegion.prefHeight(-1))); + maxh = Math.max(maxh, snapSizeY(contentRegion.prefHeight(-1))); } final boolean isHorizontal = isHorizontal(); - final double tabHeaderAreaSize = snapSize(isHorizontal ? - tabHeaderArea.prefHeight(-1) : tabHeaderArea.prefWidth(-1)); + final double tabHeaderAreaSize = isHorizontal + ? snapSizeY(tabHeaderArea.prefHeight(-1)) + : snapSizeX(tabHeaderArea.prefWidth(-1)); double prefHeight = isHorizontal ? - maxh + snapSize(tabHeaderAreaSize) : Math.max(maxh, tabHeaderAreaSize); - return snapSize(prefHeight) + topInset + bottomInset; + maxh + snapSizeY(tabHeaderAreaSize) : Math.max(maxh, tabHeaderAreaSize); + return snapSizeY(prefHeight) + topInset + bottomInset; } /** {@inheritDoc} */ @@ -318,7 +320,11 @@ TabPane tabPane = getSkinnable(); Side tabPosition = tabPane.getSide(); - double headerHeight = snapSize(tabHeaderArea.prefHeight(-1)); + // There seem to be conflicting ways in which this dimension will + // be used below. Most places use it exclusively as a "height", + // but the two lines that follow, use it as either a width or a + // height...? + double headerHeight = snapSizeY(tabHeaderArea.prefHeight(-1)); double tabsStartX = tabPosition.equals(Side.RIGHT)? x + w - headerHeight : x; double tabsStartY = tabPosition.equals(Side.BOTTOM)? y + h - headerHeight : y; --- old/modules/javafx.controls/src/main/java/javafx/scene/control/skin/TableRowSkinBase.java 2016-09-27 21:00:28.000000000 -0700 +++ new/modules/javafx.controls/src/main/java/javafx/scene/control/skin/TableRowSkinBase.java 2016-09-27 21:00:28.000000000 -0700 @@ -354,7 +354,7 @@ height = fixedCellSize; } else { height = Math.max(controlHeight, tableCell.prefHeight(-1)); - height = snapSize(height) - snapSize(verticalPadding); + height = snapSizeY(height) - snapSizeY(verticalPadding); } if (isVisible) { @@ -362,7 +362,7 @@ getChildren().add(tableCell); } - width = tableCell.prefWidth(height) - snapSize(horizontalPadding); + width = tableCell.prefWidth(height) - snapSizeX(horizontalPadding); // Added for RT-32700, and then updated for RT-34074. // We change the alignment from CENTER_LEFT to TOP_LEFT if the @@ -435,7 +435,7 @@ // This does not appear to impact performance... tableCell.requestLayout(); } else { - width = snapSize(tableCell.prefWidth(-1)) - snapSize(horizontalPadding); + width = snapSizeX(tableCell.prefWidth(-1)) - snapSizeX(horizontalPadding); if (fixedCellSizeEnabled) { // we only add/remove to the scenegraph if the fixed cell --- old/modules/javafx.controls/src/main/java/javafx/scene/control/skin/TitledPaneSkin.java 2016-09-27 21:00:28.000000000 -0700 +++ new/modules/javafx.controls/src/main/java/javafx/scene/control/skin/TitledPaneSkin.java 2016-09-27 21:00:28.000000000 -0700 @@ -232,7 +232,7 @@ final double w, final double h) { // header - double headerHeight = snapSize(titleRegion.prefHeight(-1)); + double headerHeight = snapSizeY(titleRegion.prefHeight(-1)); titleRegion.resize(w, headerHeight); positionInArea(titleRegion, x, y, @@ -246,9 +246,11 @@ contentHeight = (prefHeightFromAccordion - headerHeight) * getTransition(); } } - contentHeight = snapSize(contentHeight); + contentHeight = snapSizeY(contentHeight); - y += snapSize(headerHeight); + // Header height was already snapped above. Is this just in case + // mods are made to the intervening code? Or is it just redundant? + y += snapSizeY(headerHeight); contentContainer.resize(w, contentHeight); clipRect.setHeight(contentHeight); positionInArea(contentContainer, x, y, @@ -257,30 +259,30 @@ /** {@inheritDoc} */ @Override protected double computeMinWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) { - double titleWidth = snapSize(titleRegion.prefWidth(height)); - double contentWidth = snapSize(contentContainer.minWidth(height)); + double titleWidth = snapSizeX(titleRegion.prefWidth(height)); + double contentWidth = snapSizeX(contentContainer.minWidth(height)); return Math.max(titleWidth, contentWidth) + leftInset + rightInset; } /** {@inheritDoc} */ @Override protected double computeMinHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) { - double headerHeight = snapSize(titleRegion.prefHeight(width)); + double headerHeight = snapSizeY(titleRegion.prefHeight(width)); double contentHeight = contentContainer.minHeight(width) * getTransition(); - return headerHeight + snapSize(contentHeight) + topInset + bottomInset; + return headerHeight + snapSizeY(contentHeight) + topInset + bottomInset; } /** {@inheritDoc} */ @Override protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) { - double titleWidth = snapSize(titleRegion.prefWidth(height)); - double contentWidth = snapSize(contentContainer.prefWidth(height)); + double titleWidth = snapSizeX(titleRegion.prefWidth(height)); + double contentWidth = snapSizeX(contentContainer.prefWidth(height)); return Math.max(titleWidth, contentWidth) + leftInset + rightInset; } /** {@inheritDoc} */ @Override protected double computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) { - double headerHeight = snapSize(titleRegion.prefHeight(width)); + double headerHeight = snapSizeY(titleRegion.prefHeight(width)); double contentHeight = contentContainer.prefHeight(width) * getTransition(); - return headerHeight + snapSize(contentHeight) + topInset + bottomInset; + return headerHeight + snapSizeY(contentHeight) + topInset + bottomInset; } /** {@inheritDoc} */ @@ -329,7 +331,7 @@ } double getTitleRegionSize(double width) { - return snapSize(titleRegion.prefHeight(width)) + snappedTopInset() + snappedBottomInset(); + return snapSizeY(titleRegion.prefHeight(width)) + snappedTopInset() + snappedBottomInset(); } private double prefHeightFromAccordion = 0; @@ -338,9 +340,9 @@ } double getTitledPaneHeightForAccordion() { - double headerHeight = snapSize(titleRegion.prefHeight(-1)); + double headerHeight = snapSizeY(titleRegion.prefHeight(-1)); double contentHeight = (prefHeightFromAccordion - headerHeight) * getTransition(); - return headerHeight + snapSize(contentHeight) + snappedTopInset() + snappedBottomInset(); + return headerHeight + snapSizeY(contentHeight) + snappedTopInset() + snappedBottomInset(); } private void doAnimationTransition() { --- old/modules/javafx.controls/src/main/java/javafx/scene/control/skin/ToolBarSkin.java 2016-09-27 21:00:29.000000000 -0700 +++ new/modules/javafx.controls/src/main/java/javafx/scene/control/skin/ToolBarSkin.java 2016-09-27 21:00:29.000000000 -0700 @@ -258,14 +258,22 @@ * * **************************************************************************/ + private double snapSpacing(double value) { + if (getSkinnable().getOrientation() == Orientation.VERTICAL) { + return snapSpaceY(value); + } else { + return snapSpaceX(value); + } + } + // --- spacing private DoubleProperty spacing; private final void setSpacing(double value) { - spacingProperty().set(snapSpace(value)); + spacingProperty().set(snapSpacing(value)); } private final double getSpacing() { - return spacing == null ? 0.0 : snapSpace(spacing.get()); + return spacing == null ? 0.0 : snapSpacing(spacing.get()); } private final DoubleProperty spacingProperty() { @@ -366,14 +374,14 @@ final ToolBar toolbar = getSkinnable(); return toolbar.getOrientation() == Orientation.VERTICAL ? computePrefWidth(-1, topInset, rightInset, bottomInset, leftInset) : - snapSize(overflowMenu.prefWidth(-1)) + leftInset + rightInset; + snapSizeX(overflowMenu.prefWidth(-1)) + leftInset + rightInset; } /** {@inheritDoc} */ @Override protected double computeMinHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) { final ToolBar toolbar = getSkinnable(); return toolbar.getOrientation() == Orientation.VERTICAL? - snapSize(overflowMenu.prefHeight(-1)) + topInset + bottomInset : + snapSizeY(overflowMenu.prefHeight(-1)) + topInset + bottomInset : computePrefHeight(-1, topInset, rightInset, bottomInset, leftInset); } @@ -385,13 +393,13 @@ if (toolbar.getOrientation() == Orientation.HORIZONTAL) { for (Node node : toolbar.getItems()) { if (!node.isManaged()) continue; - prefWidth += snapSize(node.prefWidth(-1)) + getSpacing(); + prefWidth += snapSizeX(node.prefWidth(-1)) + getSpacing(); } prefWidth -= getSpacing(); } else { for (Node node : toolbar.getItems()) { if (!node.isManaged()) continue; - prefWidth = Math.max(prefWidth, snapSize(node.prefWidth(-1))); + prefWidth = Math.max(prefWidth, snapSizeX(node.prefWidth(-1))); } if (toolbar.getItems().size() > 0) { savedPrefWidth = prefWidth; @@ -410,13 +418,13 @@ if(toolbar.getOrientation() == Orientation.VERTICAL) { for (Node node: toolbar.getItems()) { if (!node.isManaged()) continue; - prefHeight += snapSize(node.prefHeight(-1)) + getSpacing(); + prefHeight += snapSizeY(node.prefHeight(-1)) + getSpacing(); } prefHeight -= getSpacing(); } else { for (Node node : toolbar.getItems()) { if (!node.isManaged()) continue; - prefHeight = Math.max(prefHeight, snapSize(node.prefHeight(-1))); + prefHeight = Math.max(prefHeight, snapSizeY(node.prefHeight(-1))); } if (toolbar.getItems().size() > 0) { savedPrefHeight = prefHeight; @@ -430,13 +438,13 @@ /** {@inheritDoc} */ @Override protected double computeMaxWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) { return getSkinnable().getOrientation() == Orientation.VERTICAL ? - snapSize(getSkinnable().prefWidth(-1)) : Double.MAX_VALUE; + snapSizeX(getSkinnable().prefWidth(-1)) : Double.MAX_VALUE; } /** {@inheritDoc} */ @Override protected double computeMaxHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) { return getSkinnable().getOrientation() == Orientation.VERTICAL ? - Double.MAX_VALUE : snapSize(getSkinnable().prefHeight(-1)); + Double.MAX_VALUE : snapSizeY(getSkinnable().prefHeight(-1)); } /** {@inheritDoc} */ @@ -446,17 +454,17 @@ final ToolBar toolbar = getSkinnable(); if (toolbar.getOrientation() == Orientation.VERTICAL) { - if (snapSize(toolbar.getHeight()) != previousHeight || needsUpdate) { + if (snapSizeY(toolbar.getHeight()) != previousHeight || needsUpdate) { ((VBox)box).setSpacing(getSpacing()); ((VBox)box).setAlignment(getBoxAlignment()); - previousHeight = snapSize(toolbar.getHeight()); + previousHeight = snapSizeY(toolbar.getHeight()); addNodesToToolBar(); } } else { - if (snapSize(toolbar.getWidth()) != previousWidth || needsUpdate) { + if (snapSizeX(toolbar.getWidth()) != previousWidth || needsUpdate) { ((HBox)box).setSpacing(getSpacing()); ((HBox)box).setAlignment(getBoxAlignment()); - previousWidth = snapSize(toolbar.getWidth()); + previousWidth = snapSizeX(toolbar.getWidth()); addNodesToToolBar(); } } @@ -466,9 +474,9 @@ double toolbarHeight = h; if (getSkinnable().getOrientation() == Orientation.VERTICAL) { - toolbarHeight -= (overflow ? snapSize(overflowMenu.prefHeight(-1)) : 0); + toolbarHeight -= (overflow ? snapSizeY(overflowMenu.prefHeight(-1)) : 0); } else { - toolbarWidth -= (overflow ? snapSize(overflowMenu.prefWidth(-1)) : 0); + toolbarWidth -= (overflow ? snapSizeX(overflowMenu.prefWidth(-1)) : 0); } box.resize(toolbarWidth, toolbarHeight); @@ -477,8 +485,8 @@ // If popup menu is not null show the overflowControl if (overflow) { - double overflowMenuWidth = snapSize(overflowMenu.prefWidth(-1)); - double overflowMenuHeight = snapSize(overflowMenu.prefHeight(-1)); + double overflowMenuWidth = snapSizeX(overflowMenu.prefWidth(-1)); + double overflowMenuHeight = snapSizeY(overflowMenu.prefHeight(-1)); double overflowX = x; double overflowY = x; if (getSkinnable().getOrientation() == Orientation.VERTICAL) { @@ -491,14 +499,14 @@ if (HPos.LEFT.equals(pos)) { overflowX = x + Math.abs((toolbarWidth - overflowMenuWidth)/2); } else if (HPos.RIGHT.equals(pos)) { - overflowX = (snapSize(toolbar.getWidth()) - snappedRightInset() - toolbarWidth) + + overflowX = (snapSizeX(toolbar.getWidth()) - snappedRightInset() - toolbarWidth) + Math.abs((toolbarWidth - overflowMenuWidth)/2); } else { overflowX = x + - Math.abs((snapSize(toolbar.getWidth()) - (x) + + Math.abs((snapSizeX(toolbar.getWidth()) - (x) + snappedRightInset() - overflowMenuWidth)/2); } - overflowY = snapSize(toolbar.getHeight()) - overflowMenuHeight - y; + overflowY = snapSizeY(toolbar.getHeight()) - overflowMenuHeight - y; } else { // This is to prevent the overflow menu from moving when there // are no items in the toolbar. @@ -510,12 +518,12 @@ overflowY = y + Math.abs((toolbarHeight - overflowMenuHeight)/2); } else if (VPos.BOTTOM.equals(pos)) { - overflowY = (snapSize(toolbar.getHeight()) - snappedBottomInset() - toolbarHeight) + + overflowY = (snapSizeY(toolbar.getHeight()) - snappedBottomInset() - toolbarHeight) + Math.abs((toolbarHeight - overflowMenuHeight)/2); } else { overflowY = y + Math.abs((toolbarHeight - overflowMenuHeight)/2); } - overflowX = snapSize(toolbar.getWidth()) - overflowMenuWidth - snappedRightInset(); + overflowX = snapSizeX(toolbar.getWidth()) - overflowMenuWidth - snappedRightInset(); } overflowMenu.resize(overflowMenuWidth, overflowMenuHeight); positionInArea(overflowMenu, overflowX, overflowY, overflowMenuWidth, overflowMenuHeight, /*baseline ignored*/0, @@ -559,9 +567,9 @@ final ToolBar toolbar = getSkinnable(); double length = 0; if (getSkinnable().getOrientation() == Orientation.VERTICAL) { - length = snapSize(toolbar.getHeight()) - snappedTopInset() - snappedBottomInset() + getSpacing(); + length = snapSizeY(toolbar.getHeight()) - snappedTopInset() - snappedBottomInset() + getSpacing(); } else { - length = snapSize(toolbar.getWidth()) - snappedLeftInset() - snappedRightInset() + getSpacing(); + length = snapSizeX(toolbar.getWidth()) - snappedLeftInset() - snappedRightInset() + getSpacing(); } // Is there overflow ? @@ -571,9 +579,9 @@ if (!node.isManaged()) continue; if (getSkinnable().getOrientation() == Orientation.VERTICAL) { - x += snapSize(node.prefHeight(-1)) + getSpacing(); + x += snapSizeY(node.prefHeight(-1)) + getSpacing(); } else { - x += snapSize(node.prefWidth(-1)) + getSpacing(); + x += snapSizeX(node.prefWidth(-1)) + getSpacing(); } if (x > length) { hasOverflow = true; @@ -583,9 +591,9 @@ if (hasOverflow) { if (getSkinnable().getOrientation() == Orientation.VERTICAL) { - length -= snapSize(overflowMenu.prefHeight(-1)); + length -= snapSizeY(overflowMenu.prefHeight(-1)); } else { - length -= snapSize(overflowMenu.prefWidth(-1)); + length -= snapSizeX(overflowMenu.prefWidth(-1)); } length -= getSpacing(); } @@ -600,9 +608,9 @@ if (node.isManaged()) { if (getSkinnable().getOrientation() == Orientation.VERTICAL) { - x += snapSize(node.prefHeight(-1)) + getSpacing(); + x += snapSizeY(node.prefHeight(-1)) + getSpacing(); } else { - x += snapSize(node.prefWidth(-1)) + getSpacing(); + x += snapSizeX(node.prefWidth(-1)) + getSpacing(); } } --- old/modules/javafx.controls/src/main/java/javafx/scene/control/skin/TreeCellSkin.java 2016-09-27 21:00:30.000000000 -0700 +++ new/modules/javafx.controls/src/main/java/javafx/scene/control/skin/TreeCellSkin.java 2016-09-27 21:00:30.000000000 -0700 @@ -300,7 +300,7 @@ // RT-30212: TreeCell does not honor minSize of cells. // snapSize for RT-36460 - return snapSize(Math.max(cell.getMinHeight(), prefHeight)); + return snapSizeY(Math.max(cell.getMinHeight(), prefHeight)); } /** {@inheritDoc} */