changeset 1744:fe2d63f8b003

Automated merge with file:///home/martin/work/javafx/jfx-30-sync/rt
author Martin Sladecek <martin.sladecek@oracle.com>
date Tue, 11 Sep 2012 09:36:06 +0200
parents 91b92cff2b88 e6c2c0128b43
children df3029cbea31
files javafx-ui-common/src/javafx/scene/Node.java
diffstat 4 files changed, 53 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-common/src/com/sun/javafx/scene/DirtyBits.java	Mon Sep 10 17:30:35 2012 -0700
+++ b/javafx-ui-common/src/com/sun/javafx/scene/DirtyBits.java	Tue Sep 11 09:36:06 2012 +0200
@@ -35,6 +35,7 @@
     NODE_OPACITY,
     NODE_TRANSFORM,
     NODE_BOUNDS,
+    NODE_TRANSFORMED_BOUNDS,
     NODE_VISIBLE,
     NODE_DEPTH_TEST,
     NODE_BLENDMODE,
--- a/javafx-ui-common/src/javafx/scene/Node.java	Mon Sep 10 17:30:35 2012 -0700
+++ b/javafx-ui-common/src/javafx/scene/Node.java	Tue Sep 11 09:36:06 2012 +0200
@@ -451,8 +451,10 @@
         if (!treeVisible && !impl_isDirty(DirtyBits.NODE_VISIBLE)) {
             return;
         }
-        if (impl_isDirty(DirtyBits.NODE_TRANSFORM)) {
-            updateLocalToParentTransform();
+        if (impl_isDirty(DirtyBits.NODE_TRANSFORM) || impl_isDirty(DirtyBits.NODE_TRANSFORMED_BOUNDS)) {
+            if (impl_isDirty(DirtyBits.NODE_TRANSFORM)) {
+                updateLocalToParentTransform();
+            }
             _txBounds = getTransformedBounds(_txBounds,
                                              BaseTransform.IDENTITY_TRANSFORM);
         }
@@ -460,10 +462,6 @@
         if (impl_isDirty(DirtyBits.NODE_BOUNDS)) {
             _geomBounds = getGeomBounds(_geomBounds,
                     BaseTransform.IDENTITY_TRANSFORM);
-            if (!impl_isDirty(DirtyBits.NODE_TRANSFORM)) {
-                _txBounds = getTransformedBounds(_txBounds,
-                                                 BaseTransform.IDENTITY_TRANSFORM);
-            }
         }
 
         Node n = getClip();
@@ -485,14 +483,14 @@
         final PGNode peer = impl_getPGNode();
         if (impl_isDirty(DirtyBits.NODE_TRANSFORM)) {
             peer.setTransformMatrix(localToParentTx);
-            peer.setTransformedBounds(_txBounds);
         }
 
         if (impl_isDirty(DirtyBits.NODE_BOUNDS)) {
             peer.setContentBounds(_geomBounds);
-            if (!impl_isDirty(DirtyBits.NODE_TRANSFORM)) {
-                peer.setTransformedBounds(_txBounds);
-            }
+        }
+        
+        if (impl_isDirty(DirtyBits.NODE_TRANSFORMED_BOUNDS)) {
+            peer.setTransformedBounds(_txBounds, !impl_isDirty(DirtyBits.NODE_BOUNDS));
         }
 
         if (impl_isDirty(DirtyBits.NODE_OPACITY)) {
@@ -3398,7 +3396,7 @@
         if (isVisible()) {
             notifyParentOfBoundsChange();
         }
-        impl_markDirty(DirtyBits.NODE_BOUNDS);
+        impl_markDirty(DirtyBits.NODE_TRANSFORMED_BOUNDS);
     }
 
     /**
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ScrollPaneSkin.java	Mon Sep 10 17:30:35 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ScrollPaneSkin.java	Tue Sep 11 09:36:06 2012 +0200
@@ -29,7 +29,6 @@
 import static com.sun.javafx.Utils.clamp;
 import static com.sun.javafx.scene.control.skin.Utils.boundedSize;
 import javafx.animation.Animation.Status;
-import javafx.animation.Interpolator;
 import javafx.animation.KeyFrame;
 import javafx.animation.KeyValue;
 import javafx.animation.Timeline;
@@ -37,7 +36,6 @@
 import javafx.beans.Observable;
 import javafx.beans.property.DoubleProperty;
 import javafx.beans.property.DoublePropertyBase;
-import javafx.beans.property.SimpleDoubleProperty;
 import javafx.beans.value.ChangeListener;
 import javafx.beans.value.ObservableValue;
 import javafx.event.ActionEvent;
@@ -48,7 +46,6 @@
 import javafx.geometry.BoundingBox;
 import javafx.geometry.Bounds;
 import javafx.geometry.Orientation;
-import javafx.geometry.Pos;
 import javafx.scene.Cursor;
 import javafx.scene.Node;
 import javafx.scene.control.ScrollBar;
@@ -66,6 +63,7 @@
 import com.sun.javafx.scene.traversal.TraversalEngine;
 import com.sun.javafx.scene.traversal.TraverseListener;
 import com.sun.javafx.Utils;
+import javafx.scene.Group;
 
 public class ScrollPaneSkin extends SkinBase<ScrollPane, ScrollPaneBehavior> implements TraverseListener {
     /***************************************************************************
@@ -102,6 +100,7 @@
     // substructure
 
     private StackPane viewRect;
+    private StackPane viewContent;
     private double contentWidth;
     private double contentHeight;
     private StackPane corner;
@@ -158,8 +157,8 @@
 
     /*
     ** The content of the ScrollPane has just changed bounds, check scrollBar positions.
-    */
-    private final ChangeListener<Bounds> boundsChangeListener = new ChangeListener<Bounds>() {
+    */ 
+   private final ChangeListener<Bounds> boundsChangeListener = new ChangeListener<Bounds>() {
         @Override public void changed(ObservableValue<? extends Bounds> observable, Bounds oldBounds, Bounds newBounds) {
             /*
             ** For a height change then we want to reduce
@@ -225,6 +224,29 @@
         }
 
         viewRect = new StackPane() {
+
+            @Override
+            protected void layoutChildren() {
+                viewContent.resize(getWidth(), getHeight());
+            }
+
+        };
+        // prevent requestLayout requests from within scrollNode from percolating up
+        viewRect.setManaged(false);
+        viewRect.setCache(true);
+
+        clipRect = new Rectangle();
+        viewRect.setClip(clipRect);
+
+        hsb = new ScrollBar();
+
+        vsb = new ScrollBar();
+        vsb.setOrientation(Orientation.VERTICAL);
+
+        corner = new StackPane();
+        corner.getStyleClass().setAll("corner");
+
+        viewContent = new StackPane() {
             @Override public void requestLayout() {
                 // if scrollNode requested layout, will want to recompute
                 nodeWidth = -1;
@@ -246,23 +268,10 @@
                 }
             }
         };
-        // prevent requestLayout requests from within scrollNode from percolating up
-        viewRect.setManaged(false);
-
-        clipRect = new Rectangle();
-        viewRect.setClip(clipRect);
-
-        hsb = new ScrollBar();
-
-        vsb = new ScrollBar();
-        vsb.setOrientation(Orientation.VERTICAL);
-
-        corner = new StackPane();
-        corner.getStyleClass().setAll("corner");
-
-        viewRect.getChildren().clear();
+        viewRect.getChildren().add(viewContent);
+        
         if (scrollNode != null) {
-            viewRect.getChildren().add(scrollNode);
+            viewContent.getChildren().add(scrollNode);
         }
 
         getChildren().clear();
@@ -303,8 +312,8 @@
                    startSBReleasedAnimation();
                }
                mouseDown = true;
-               pressX = e.getX() + viewRect.getLayoutX();
-               pressY = e.getY() + viewRect.getLayoutY();
+               pressX = e.getX();
+               pressY = e.getY();
                ohvalue = hsb.getValue();
                ovvalue = vsb.getValue();
            }
@@ -365,8 +374,8 @@
                ** for mobile-touch we allow drag, even if not pannagle
                */
                if (getSkinnable().isPannable() || PlatformUtil.isEmbedded()) {
-                   double deltaX = pressX - (e.getX() + viewRect.getLayoutX());
-                   double deltaY = pressY - (e.getY() + viewRect.getLayoutY());
+                   double deltaX = pressX - e.getX();
+                   double deltaY = pressY - e.getY();
                    /*
                    ** we only drag if not all of the content is visible.
                    */
@@ -573,13 +582,13 @@
                 if (scrollNode != null) {
                     scrollNode.layoutBoundsProperty().removeListener(nodeListener);
                     scrollNode.layoutBoundsProperty().removeListener(boundsChangeListener);
-                    viewRect.getChildren().remove(scrollNode);
+                    viewContent.getChildren().remove(scrollNode);
                 }
                 scrollNode = getSkinnable().getContent();
                 if (scrollNode != null) {
                     nodeWidth = snapSize(scrollNode.getLayoutBounds().getWidth());
                     nodeHeight = snapSize(scrollNode.getLayoutBounds().getHeight());
-                    viewRect.getChildren().setAll(scrollNode);
+                    viewContent.getChildren().setAll(scrollNode);
                     scrollNode.layoutBoundsProperty().addListener(nodeListener);
                     scrollNode.layoutBoundsProperty().addListener(boundsChangeListener);
                 }
@@ -852,7 +861,7 @@
         } else {
             corner.setVisible(false);
         }
-        control.setViewportBounds(new BoundingBox(snapPosition(viewRect.getLayoutX()), snapPosition(viewRect.getLayoutY()), snapSize(contentWidth), snapSize(contentHeight)));
+        control.setViewportBounds(new BoundingBox(snapPosition(viewContent.getLayoutX()), snapPosition(viewContent.getLayoutY()), snapSize(contentWidth), snapSize(contentHeight)));
     }
     
     private void computeScrollNodeSize(double contentWidth, double contentHeight) {
@@ -944,7 +953,7 @@
             if (nodeWidth > contentWidth) {
                 updatePosX();
             } else {
-                viewRect.setLayoutX(getInsets().getLeft());
+                viewContent.setLayoutX(getInsets().getLeft());
             }
         }
     }
@@ -968,29 +977,27 @@
             if (nodeHeight > contentHeight) {
                 updatePosY();
             } else {
-                viewRect.setLayoutY(getInsets().getTop());
+                viewContent.setLayoutY(getInsets().getTop());
             }
         }
     }
 
     private double updatePosX() {
-        viewRect.setLayoutX(snapPosition(getInsets().getLeft() - posX / (hsb.getMax() - hsb.getMin()) * (nodeWidth - contentWidth)));
+        viewContent.setLayoutX(snapPosition(getInsets().getLeft() - posX / (hsb.getMax() - hsb.getMin()) * (nodeWidth - contentWidth)));
         getSkinnable().setHvalue(Utils.clamp(getSkinnable().getHmin(), posX, getSkinnable().getHmax()));
-        resetClip();
         return posX;
     }
 
     private double updatePosY() {
-        viewRect.setLayoutY(snapPosition(getInsets().getTop() - posY / (vsb.getMax() - vsb.getMin()) * (nodeHeight - contentHeight)));
+        viewContent.setLayoutY(snapPosition(getInsets().getTop() - posY / (vsb.getMax() - vsb.getMin()) * (nodeHeight - contentHeight)));
         getSkinnable().setVvalue(Utils.clamp(getSkinnable().getVmin(), posY, getSkinnable().getVmax()));
-        resetClip();
         return posY;
     }
 
     private void resetClip() {
         clipRect.setWidth(snapSize(contentWidth));
         clipRect.setHeight(snapSize(contentHeight));
-        clipRect.relocate(snapPosition(getInsets().getLeft() - viewRect.getLayoutX()), snapPosition(getInsets().getTop() - viewRect.getLayoutY()));
+        clipRect.relocate(snapPosition(getInsets().getLeft()), snapPosition(getInsets().getTop()));
     }
 
     Timeline sbTouchTimeline;
--- a/test-stub-toolkit/src/com/sun/javafx/pgstub/StubNode.java	Mon Sep 10 17:30:35 2012 -0700
+++ b/test-stub-toolkit/src/com/sun/javafx/pgstub/StubNode.java	Tue Sep 11 09:36:06 2012 +0200
@@ -54,7 +54,7 @@
     }
 
     @Override
-    public void setTransformedBounds(BaseBounds bounds) {
+    public void setTransformedBounds(BaseBounds bounds, boolean byTransformChangeOnly) {
     }
 
     @Override public void setVisible(boolean visible) {