modules/graphics/src/main/java/javafx/scene/text/TextFlow.java

Print this page

        

@@ -232,12 +232,12 @@
 
     @Override protected void setWidth(double value) {
         if (value != getWidth()) {
             TextLayout layout = getTextLayout();
             Insets insets = getInsets();
-            double left = snapSpace(insets.getLeft());
-            double right = snapSpace(insets.getRight());
+            double left = snapSpaceX(insets.getLeft());
+            double right = snapSpaceX(insets.getRight());
             double width = Math.max(1, value - left - right);
             layout.setWrapWidth((float)width);
             super.setWidth(value);
         }
     }

@@ -245,33 +245,33 @@
     @Override protected double computePrefWidth(double height) {
         TextLayout layout = getTextLayout();
         layout.setWrapWidth(0);
         double width = layout.getBounds().getWidth();
         Insets insets = getInsets();
-        double left = snapSpace(insets.getLeft());
-        double right = snapSpace(insets.getRight());
+        double left = snapSpaceX(insets.getLeft());
+        double right = snapSpaceX(insets.getRight());
         double wrappingWidth = Math.max(1, getWidth() - left - right);
         layout.setWrapWidth((float)wrappingWidth);
         return left + width + right;
     }
 
     @Override protected double computePrefHeight(double width) {
         TextLayout layout = getTextLayout();
         Insets insets = getInsets();
-        double left = snapSpace(insets.getLeft());
-        double right = snapSpace(insets.getRight());
+        double left = snapSpaceX(insets.getLeft());
+        double right = snapSpaceX(insets.getRight());
         if (width == USE_COMPUTED_SIZE) {
             layout.setWrapWidth(0);
         } else {
             double wrappingWidth = Math.max(1, width - left - right);
             layout.setWrapWidth((float)wrappingWidth);
         }
         double height = layout.getBounds().getHeight();
         double wrappingWidth = Math.max(1, getWidth() - left - right);
         layout.setWrapWidth((float)wrappingWidth);
-        double top = snapSpace(insets.getTop());
-        double bottom = snapSpace(insets.getBottom());
+        double top = snapSpaceY(insets.getTop());
+        double bottom = snapSpaceY(insets.getBottom());
         return top + height + bottom;
     }
 
     @Override protected double computeMinHeight(double width) {
         return computePrefHeight(width);

@@ -311,12 +311,12 @@
     }
 
     @Override protected void layoutChildren() {
         inLayout = true;
         Insets insets = getInsets();
-        double top = snapSpace(insets.getTop());
-        double left = snapSpace(insets.getLeft());
+        double top = snapSpaceY(insets.getTop());
+        double left = snapSpaceX(insets.getLeft());
 
         GlyphList[] runs = getTextLayout().getRuns();
         for (int j = 0; j < runs.length; j++) {
             GlyphList run = runs[j];
             TextSpan span = run.getTextSpan();

@@ -481,11 +481,11 @@
         return lineSpacing;
     }
 
     @Override public final double getBaselineOffset() {
         Insets insets = getInsets();
-        double top = snapSpace(insets.getTop());
+        double top = snapSpaceY(insets.getTop());
         return top - getTextLayout().getBounds().getMinY();
     }
 
    /***************************************************************************
     *                                                                         *

@@ -572,15 +572,15 @@
         double bottom = margin != null? snapSpace(margin.getBottom(), snap) : 0;
         double left = margin != null? snapSpace(margin.getLeft(), snap) : 0;
         double right = margin != null? snapSpace(margin.getRight(), snap) : 0;
         double alt = -1;
         if (child.getContentBias() == Orientation.VERTICAL) { // width depends on height
-            alt = snapSize(boundedSize(
+            alt = snapSizeY(boundedSize(
                     child.minHeight(-1), height != -1? height - top - bottom :
                            child.prefHeight(-1), child.maxHeight(-1)));
         }
-        return left + snapSize(boundedSize(child.minWidth(alt), child.prefWidth(alt), child.maxWidth(alt))) + right;
+        return left + snapSizeX(boundedSize(child.minWidth(alt), child.prefWidth(alt), child.maxWidth(alt))) + right;
     }
 
     double computeChildPrefAreaHeight(Node child, Insets margin) {
         return computeChildPrefAreaHeight(child, margin, -1);
     }

@@ -591,15 +591,15 @@
         double bottom = margin != null? snapSpace(margin.getBottom(), snap) : 0;
         double left = margin != null? snapSpace(margin.getLeft(), snap) : 0;
         double right = margin != null? snapSpace(margin.getRight(), snap) : 0;
         double alt = -1;
         if (child.getContentBias() == Orientation.HORIZONTAL) { // height depends on width
-            alt = snapSize(boundedSize(
+            alt = snapSizeX(boundedSize(
                     child.minWidth(-1), width != -1? width - left - right :
                            child.prefWidth(-1), child.maxWidth(-1)));
         }
-        return top + snapSize(boundedSize(child.minHeight(alt), child.prefHeight(alt), child.maxHeight(alt))) + bottom;
+        return top + snapSizeY(boundedSize(child.minHeight(alt), child.prefHeight(alt), child.maxHeight(alt))) + bottom;
     }
     /* end of copied code */
 
     @Override
     public Object queryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters) {