changeset 3703:dc06a023c841

Automated merge with ssh://jfxsrc.us.oracle.com//javafx/8.0/MASTER/jfx/rt
author jgodinez
date Tue, 28 May 2013 09:38:44 -0700
parents 86aa4f87fd8a 8031daf54912
children 9fadd09bc7b2 4aa29e84eb5e
files javafx-beans/src/com/sun/javafx/beans/annotations/DuplicateInBuilderProperties.java javafx-beans/src/com/sun/javafx/beans/annotations/NoBuilder.java javafx-beans/src/com/sun/javafx/beans/annotations/NoInit.java javafx-ui-quantum/test/com/sun/javafx/tk/quantum/RT17588Test.java prism-common/src/com/sun/prism/RenderingContext.java prism-common/src/com/sun/prism/impl/BaseRenderingContext.java prism-es2/src/com/sun/prism/es2/ES2RenderingContext.java webview/src/com/sun/webkit/event/WCTouchEvent.java webview/src/com/sun/webkit/event/WCTouchPoint.java
diffstat 201 files changed, 2387 insertions(+), 2337 deletions(-) [+]
line wrap: on
line diff
--- a/.classpath	Thu May 23 17:10:40 2013 -0700
+++ b/.classpath	Tue May 28 09:38:44 2013 -0700
@@ -1,10 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
+    <classpathentry kind="src" path="apps/experiments/3DViewer/src/main/java"/>
+    <classpathentry kind="src" path="apps/experiments/3DViewer/src/test/java"/>
+    <classpathentry kind="src" path="apps/experiments/3DViewer/src/test/resources"/>
     <!--
     <classpathentry kind="src" path="apps/experiments/ConferenceScheduleApp/src"/>
     <classpathentry kind="src" path="apps/experiments/ModenaTest/test"/>
+    <classpathentry kind="src" path="apps/experiments/Modena/src"/>
     -->
-    <classpathentry kind="src" path="apps/experiments/Modena/src"/>
     <classpathentry kind="src" path="apps/samples/Ensemble8/src/app"/>
     <classpathentry kind="src" path="apps/samples/Ensemble8/src/compiletime"/>
     <classpathentry kind="src" path="apps/samples/Ensemble8/src/generated"/>
@@ -38,18 +41,28 @@
     <classpathentry kind="src" path="glass/glass/src"/>
 
     <classpathentry kind="src" path="javafx-anim/src"/>
-    <classpathentry kind="src" path="javafx-anim/build/builders"/>
     <classpathentry kind="src" path="javafx-anim/test/unit"/>
+    <!--
     <classpathentry kind="src" path="javafx-annotation-processor/src"/>
+    -->
     <classpathentry kind="src" path="javafx-beans/src"/>
     <classpathentry kind="src" path="javafx-beans/test"/>
     <classpathentry kind="src" path="javafx-beans-dt/src"/>
     <classpathentry kind="src" path="javafx-beans-dt/test"/>
+
+    <!--
+    <classpathentry kind="src" path="javafx-builders/test/unit"/>
+    <classpathentry kind="src" path="javafx-builders/src"/>
+    -->
+    <classpathentry kind="lib" exported="true" path="javafx-builders/dist/javafx-builders.jar">
+        <attributes>
+            <attribute name="optional" value="true"/>
+        </attributes>
+    </classpathentry>
+    
     <classpathentry kind="src" path="javafx-concurrent/src"/>
     <classpathentry kind="src" path="javafx-concurrent/test"/>
-    <classpathentry kind="src" path="javafx-concurrent/build/builders"/>
     <classpathentry kind="src" path="javafx-common/test/unit"/>
-    <classpathentry kind="src" path="javafx-common/build/builders"/>
     <classpathentry kind="src" path="javafx-common/build/gensrc/classes"/>
     <classpathentry kind="src" path="javafx-common/src"/>
     <classpathentry kind="src" path="javafx-designtime/src"/>
@@ -57,7 +70,10 @@
     <classpathentry kind="src" path="javafx-designtime/test"/>
     -->
     <!-- Temporarily excluding SwingNode as it requires Java 8 -->
+    <!--
     <classpathentry kind="src" excluding="javafx/embed/swing/SwingNode.java" path="javafx-embed-swing/src"/>
+    -->
+    <classpathentry kind="src" path="javafx-embed-swing/src"/>
     <classpathentry kind="src" path="javafx-embed-swt/src"/>
     <classpathentry kind="src" path="javafx-fxml/src"/>
     <classpathentry kind="src" path="javafx-fxml/test"/>
@@ -72,13 +88,12 @@
     <classpathentry kind="src" path="javafx-sg-prism/test"/>
     <classpathentry kind="src" path="javafx-ui-charts/src"/>
     <classpathentry kind="src" path="javafx-ui-charts/test"/>
-    <classpathentry kind="src" path="javafx-ui-charts/build/builders"/>
     <classpathentry kind="src" path="javafx-ui-common/src"/>
+    <!--
     <classpathentry kind="src" path="javafx-ui-common/test/unit"/>
-    <classpathentry kind="src" path="javafx-ui-common/build/builders"/>
+    -->
     <classpathentry kind="src" path="javafx-ui-controls/src"/>
     <classpathentry kind="src" path="javafx-ui-controls/test"/>
-    <classpathentry kind="src" path="javafx-ui-controls/build/builders"/>
     <classpathentry kind="src" path="javafx-ui-quantum/src"/>
     <classpathentry kind="src" path="javafx-util-converter/src"/>
     <classpathentry kind="src" path="javafx-util-converter/test"/>
@@ -119,14 +134,32 @@
     <classpathentry kind="src" path="prism-util/src"/>
 
     <classpathentry kind="src" path="test-stub-toolkit/src"/>
-    
+	<classpathentry kind="src" path="tests/app-lifecycle/ClassLoaderApp/src"/>
+	<classpathentry kind="src" path="tests/app-lifecycle/ClassLoaderTest/test"/>
+	<classpathentry kind="src" path="tests/app-lifecycle/LauncherTests/test"/>
+	<classpathentry kind="src" path="tests/app-lifecycle/LifeCycleTests/test"/>
+	<classpathentry kind="src" path="tests/glass/ExceptionHandler/test"/>
+	<classpathentry kind="src" path="tests/graphics/MaterialTests/test"/>
+	<classpathentry kind="src" path="tests/graphics/SnapshotTests/test"/>
+	<classpathentry kind="src" path="tests/graphics/SwingInterop/test"/>
+	<classpathentry kind="src" path="tests/manual/printing"/>
+	<classpathentry kind="src" path="tests/quantum/CloseWindow/test"/>
+	<classpathentry kind="src" path="tests/quantum/WindowSceneInitDispose/test"/>
+
 	<classpathentry kind="src" path="webview/src"/>
-	<classpathentry kind="src" path="webview/build/builders"/>
-
-    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-    <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
-    <classpathentry kind="lib" path="../import/antlr-3.1.3/antlr-3.1.3/lib/antlr-3.1.3.jar"/>
-    <classpathentry kind="lib" path="../import/findbugs-2.0.1/findbugs-2.0.1/lib/ant.jar"/>
+	<!--
+	<classpathentry kind="src" path="webview/test"/>
+	-->
+	<classpathentry combineaccessrules="false" kind="src" path="webview/native/WebKitBuild/Release/WebCore/generated/java">
+        <attributes>
+            <attribute name="optional" value="true"/>
+        </attributes>
+    </classpathentry>
+    <classpathentry kind="lib" path="../caches/sdk/build/lib/desktop/webview.jar">
+        <attributes>
+            <attribute name="optional" value="true"/>
+        </attributes>
+    </classpathentry>
 
     <classpathentry kind="src" path="/rt-closed"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/media">
@@ -139,17 +172,7 @@
 			<attribute name="optional" value="true"/>
 		</attributes>
 	</classpathentry>
-    <classpathentry combineaccessrules="false" kind="src" path="/webnode">
-        <attributes>
-        <attribute name="optional" value="true"/>
-        </attributes>
-    </classpathentry>
-    <classpathentry kind="lib" path="../caches/sdk/build/lib/desktop/jfxwebkit.jar">
-        <attributes>
-            <attribute name="optional" value="true"/>
-        </attributes>
-    </classpathentry>
-    
+
     <classpathentry kind="src" path="/org.eclipse.swt">
         <attributes>
             <attribute name="optional" value="true"/>
@@ -157,4 +180,9 @@
     </classpathentry>
     <classpathentry kind="lib" path="../import/swt-3.7.1/swt-debug.jar"/>
     <classpathentry kind="output" path="bin"/>
+    
+    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+    <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+    <classpathentry kind="lib" path="../import/antlr-3.1.3/antlr-3.1.3/lib/antlr-3.1.3.jar"/>
+    <classpathentry kind="lib" path="../import/findbugs-2.0.1/findbugs-2.0.1/lib/ant.jar"/>
 </classpath>
--- a/.hgignore	Thu May 23 17:10:40 2013 -0700
+++ b/.hgignore	Tue May 28 09:38:44 2013 -0700
@@ -19,5 +19,6 @@
 */Release/*
 */Debug/*
 *~
+webview/native/LayoutTests
 webview/native/WebKitBuild
 webview/native/WebKitLibraries/import
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/experiments/3DViewer/src/main/java/META-INF/MANIFEST.MF	Tue May 28 09:38:44 2013 -0700
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: com.javafx.experiments.jfx3dviewer.Jfx3dViewerApp
+
--- a/apps/experiments/3DViewer/src/main/java/com/javafx/experiments/importers/Importer3D.java	Thu May 23 17:10:40 2013 -0700
+++ b/apps/experiments/3DViewer/src/main/java/com/javafx/experiments/importers/Importer3D.java	Tue May 28 09:38:44 2013 -0700
@@ -13,6 +13,7 @@
 import com.javafx.experiments.importers.maya.MayaGroup;
 import com.javafx.experiments.importers.maya.MayaImporter;
 import com.javafx.experiments.importers.obj.ObjImporter;
+import com.javafx.experiments.importers.obj.PolyObjImporter;
 
 /**
  * Base Importer for all supported 3D file formats
@@ -78,10 +79,11 @@
     }
 
     private static Node loadObjFile(String fileUrl) throws IOException {
-        ObjImporter reader = new ObjImporter(fileUrl);
+//        ObjImporter reader = new ObjImporter(fileUrl);
+        PolyObjImporter reader = new PolyObjImporter(fileUrl);
         Group res = new Group();
         for (String key : reader.getMeshes()) {
-            res.getChildren().add(reader.buildMeshView(key));
+            res.getChildren().add(reader.buildPolygonMeshView(key));
         }
         return res;
     }
--- a/apps/experiments/3DViewer/src/main/java/com/javafx/experiments/importers/obj/PolyObjImporter.java	Thu May 23 17:10:40 2013 -0700
+++ b/apps/experiments/3DViewer/src/main/java/com/javafx/experiments/importers/obj/PolyObjImporter.java	Tue May 28 09:38:44 2013 -0700
@@ -39,6 +39,7 @@
 import com.javafx.experiments.shape3d.PolygonMeshView;
 
 import java.io.*;
+import java.net.URL;
 import java.util.*;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -65,7 +66,7 @@
         }
     }
 
-    private static boolean debug = true;
+    private static boolean debug = false;
     private static float scale = 1;
     private static boolean flatXZ = false;
 
@@ -86,8 +87,8 @@
 
     public PolyObjImporter(String filename) throws FileNotFoundException, IOException {
         this.objFilename = filename;
-        log("Reading filename = " + filename);
-        read(new FileInputStream(filename));
+        log("Reading filename = " + filename);;
+        read(new URL(filename).openStream());
     }
 
     public PolyObjImporter(InputStream inputStream) throws IOException {
@@ -282,11 +283,13 @@
                 newUVs.toFloatArray(),
                 faceArrays
         );
-        System.out.println("mesh.points = " + Arrays.toString(mesh.points));
-        System.out.println("mesh.texCoords = " + Arrays.toString(mesh.texCoords));
-        System.out.println("mesh.faces: ");
-        for (int[] face: mesh.faces) {
-            System.out.println("    face:: "+Arrays.toString(face));
+        if (debug) {
+            System.out.println("mesh.points = " + Arrays.toString(mesh.points));
+            System.out.println("mesh.texCoords = " + Arrays.toString(mesh.texCoords));
+            System.out.println("mesh.faces: ");
+            for (int[] face: mesh.faces) {
+                System.out.println("    face:: "+Arrays.toString(face));
+            }
         }
 
         int keyIndex = 2;
--- a/apps/experiments/3DViewer/src/main/java/com/javafx/experiments/jfx3dviewer/ContentModel.java	Thu May 23 17:10:40 2013 -0700
+++ b/apps/experiments/3DViewer/src/main/java/com/javafx/experiments/jfx3dviewer/ContentModel.java	Tue May 28 09:38:44 2013 -0700
@@ -136,7 +136,7 @@
     private boolean wireframe = false;
     private int subdivision = 0;
 
-    public ContentModel() {
+    public ContentModel(String fileToLoad) {
         subScene = new SubScene(root3D,400,400,true,false);
         subScene.setFill(Color.ALICEBLUE);
 
@@ -169,7 +169,11 @@
 
         // LOAD DROP HERE MODEL
         try {
-            content = Importer3D.load(ContentModel.class.getResource("drop-here.obj").toExternalForm());
+            if (fileToLoad != null) {
+                content = Importer3D.load(new File(fileToLoad).toURI().toURL().toExternalForm());
+            } else {
+                content = Importer3D.load(ContentModel.class.getResource("drop-here.obj").toExternalForm());
+            }
             autoScalingGroup.getChildren().add(content);
         } catch (IOException e) {
             e.printStackTrace();
--- a/apps/experiments/3DViewer/src/main/java/com/javafx/experiments/jfx3dviewer/Jfx3dViewerApp.java	Thu May 23 17:10:40 2013 -0700
+++ b/apps/experiments/3DViewer/src/main/java/com/javafx/experiments/jfx3dviewer/Jfx3dViewerApp.java	Tue May 28 09:38:44 2013 -0700
@@ -31,6 +31,7 @@
  */
 package com.javafx.experiments.jfx3dviewer;
 
+import java.util.List;
 import javafx.application.Application;
 import javafx.fxml.FXMLLoader;
 import javafx.scene.Parent;
@@ -48,7 +49,8 @@
     }
 
     @Override public void start(Stage stage) throws Exception {
-        contentModel = new ContentModel();
+        List<String> args = getParameters().getRaw();
+        contentModel = new ContentModel(args.isEmpty() ? null : args.get(0));
         Scene scene = new Scene(
                 FXMLLoader.<Parent>load(Jfx3dViewerApp.class.getResource("main.fxml")),
                 1024,600);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/experiments/3DViewer/src/main/java/com/javafx/experiments/jfx3dviewer/SimpleViewerApp.java	Tue May 28 09:38:44 2013 -0700
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2010, 2013 Oracle and/or its affiliates.
+ * All rights reserved. Use is subject to license terms.
+ *
+ * This file is available and licensed under the following license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *  - Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  - Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the distribution.
+ *  - Neither the name of Oracle Corporation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.javafx.experiments.jfx3dviewer;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import javafx.animation.KeyFrame;
+import javafx.animation.KeyValue;
+import javafx.animation.Timeline;
+import javafx.application.Application;
+import javafx.event.ActionEvent;
+import javafx.event.EventHandler;
+import javafx.scene.Group;
+import javafx.scene.Node;
+import javafx.scene.PerspectiveCamera;
+import javafx.scene.Scene;
+import javafx.scene.paint.Color;
+import javafx.scene.transform.Rotate;
+import javafx.scene.transform.Translate;
+import javafx.stage.Stage;
+import javafx.util.Duration;
+import com.javafx.experiments.importers.Importer3D;
+import com.sun.javafx.perf.PerformanceTracker;
+
+/**
+ * JavaFX 3D Viewer Application
+ */
+public class SimpleViewerApp extends Application {
+    private final Group root3D = new Group();
+    private final PerspectiveCamera camera = new PerspectiveCamera(true);
+    private final Rotate cameraXRotate = new Rotate(-20,0,0,0,Rotate.X_AXIS);
+    private final Rotate cameraYRotate = new Rotate(-20,0,0,0,Rotate.Y_AXIS);
+    private final Rotate cameraLookXRotate = new Rotate(0,0,0,0,Rotate.X_AXIS);
+    private final Rotate cameraLookZRotate = new Rotate(0,0,0,0,Rotate.Z_AXIS);
+    private final Translate cameraPosition = new Translate(0,0,-7);
+    private AutoScalingGroup autoScalingGroup = new AutoScalingGroup(2);
+
+    @Override public void start(Stage stage) throws Exception {
+        List<String> args = getParameters().getRaw();
+        Scene scene = new Scene(root3D,1920,1080,true,false);
+        scene.setFill(Color.ALICEBLUE);
+
+        // CAMERA
+        camera.getTransforms().addAll(
+                cameraXRotate,
+                cameraYRotate,
+                cameraPosition,
+                cameraLookXRotate,
+                cameraLookZRotate);
+        camera.setNearClip(0.1);
+        camera.setFarClip(100);
+        scene.setCamera(camera);
+        root3D.getChildren().addAll(camera, autoScalingGroup);
+
+        // LOAD DROP HERE MODEL
+        try {
+            Node content;
+            if (args.isEmpty()) {
+                content = Importer3D.load(ContentModel.class.getResource("drop-here.obj").toExternalForm());
+            } else {
+                content = Importer3D.load(new File(args.get(0)).toURI().toURL().toExternalForm());
+            }
+            autoScalingGroup.getChildren().add(content);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+        Timeline timeline = new Timeline(
+                new KeyFrame(Duration.ZERO, new KeyValue(cameraYRotate.angleProperty(),0)),
+                new KeyFrame(Duration.seconds(4), new KeyValue(cameraYRotate.angleProperty(),360))
+        );
+        timeline.setCycleCount(Timeline.INDEFINITE);
+        timeline.play();
+
+        stage.setScene(scene);
+        stage.show();
+
+        // MEASURE FPS
+        Timeline fpsTimeline = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler<ActionEvent>() {
+            @Override public void handle(ActionEvent t) {
+                System.out.println("fps = " + PerformanceTracker.getSceneTracker(scene).getInstantFPS());
+            }
+        }));
+        fpsTimeline.setCycleCount(Timeline.INDEFINITE);
+        fpsTimeline.play();
+    }
+
+    public static void main(String[] args) {
+        launch(args);
+    }
+}
--- a/apps/experiments/3DViewer/src/main/java/com/javafx/experiments/shape3d/PolygonMeshView.java	Thu May 23 17:10:40 2013 -0700
+++ b/apps/experiments/3DViewer/src/main/java/com/javafx/experiments/shape3d/PolygonMeshView.java	Tue May 28 09:38:44 2013 -0700
@@ -126,7 +126,7 @@
         } else {
             subdividedMesh = getMesh();
             for (int i=0; i<iterations; i++) {
-                subdividedMesh = Subdivision.subdivide(subdividedMesh);
+                subdividedMesh = SubDivision.subdivide(subdividedMesh);
             }
         }
         updateMesh();
--- a/apps/experiments/3DViewer/src/main/java/com/javafx/experiments/shape3d/SubDivision.java	Thu May 23 17:10:40 2013 -0700
+++ b/apps/experiments/3DViewer/src/main/java/com/javafx/experiments/shape3d/SubDivision.java	Tue May 28 09:38:44 2013 -0700
@@ -13,7 +13,7 @@
  * 
  * @author akouznet
  */
-public class Subdivision {
+public class SubDivision {
     
     private PolygonMesh oldMesh;
     private Map<Edge, EdgeInfo> edgeInfos;
@@ -23,7 +23,7 @@
     private int[] reindex;
     private int newPointIndex;
 
-    public Subdivision(PolygonMesh oldMesh) {
+    public SubDivision(PolygonMesh oldMesh) {
         this.oldMesh = oldMesh;
     }
     
@@ -57,7 +57,7 @@
     }
     
     public static PolygonMesh subdivide(PolygonMesh oldMesh) {
-        return new Subdivision(oldMesh).subdivide();
+        return new SubDivision(oldMesh).subdivide();
     }
 
     private void addEdge(Edge edge, FaceInfo faceInfo, Point3D midPoint) {
--- a/apps/samples/Ensemble8/src/app/ensemble/control/SearchBox.java	Thu May 23 17:10:40 2013 -0700
+++ b/apps/samples/Ensemble8/src/app/ensemble/control/SearchBox.java	Tue May 28 09:38:44 2013 -0700
@@ -63,6 +63,9 @@
             }
         });
         clearButton.setVisible(false);
+        clearButton.setManaged(false);
+        innerBackground.setManaged(false);
+        icon.setManaged(false);
     }
 
     @Override protected void layoutChildren() {
--- a/build.gradle	Thu May 23 17:10:40 2013 -0700
+++ b/build.gradle	Tue May 28 09:38:44 2013 -0700
@@ -330,7 +330,8 @@
 // Check whether the COMPILE_TARGETS property has been specified (if so, it was done by
 // the user and not by this script). If it has not been defined then default
 // to building the normal desktop build for this machine
-defineProperty("COMPILE_TARGETS", IS_MAC ? "mac" : IS_WINDOWS ? "win" : IS_LINUX ? "linux" : "")
+project.ext.set("defaultHostTarget", IS_MAC ? "mac" : IS_WINDOWS ? "win" : IS_LINUX ? "linux" : "");
+defineProperty("COMPILE_TARGETS", "$defaultHostTarget")
 
 // Now we need to define the native compilation tasks. The set of parameters to
 // native compiliation depends on the target platform (and also to some extent what platform
--- a/decora-runtime/src/com/sun/scenario/effect/Identity.java	Thu May 23 17:10:40 2013 -0700
+++ b/decora-runtime/src/com/sun/scenario/effect/Identity.java	Tue May 28 09:38:44 2013 -0700
@@ -132,6 +132,12 @@
         // TODO: cache needs to be cleared on display changes
         // TODO: cache based on transform?
         ImageData id = datacache.get(fctx);
+        if (id != null && !id.addref()) {
+            id.setReusable(false);
+            datacache.remove(fctx);
+            id.unref();
+            id = null;
+        }
         if (id == null) {
             Renderer r = Renderer.getRenderer(fctx);
             Filterable f = src;
@@ -144,9 +150,9 @@
             if (id == null) {
                 return new ImageData(fctx, null, null);
             }
+            id.setReusable(true);
             datacache.put(fctx, id);
         }
-        id.addref();
 
         transform = Offset.getOffsetTransform(transform, loc.x, loc.y);
         id = id.transform(transform);
--- a/decora-runtime/src/com/sun/scenario/effect/ImageData.java	Thu May 23 17:10:40 2013 -0700
+++ b/decora-runtime/src/com/sun/scenario/effect/ImageData.java	Tue May 28 09:38:44 2013 -0700
@@ -76,6 +76,7 @@
     private final Rectangle bounds;
     private BaseTransform transform;
     private Throwable fromwhere;
+    private boolean reusable;
 
     public ImageData(FilterContext fctx, Filterable image, Rectangle bounds) {
         this(fctx, image, bounds, BaseTransform.IDENTITY_TRANSFORM);
@@ -115,6 +116,10 @@
         this.sharedOwner = original;
     }
 
+    public void setReusable(boolean reusable) {
+        this.reusable = reusable;
+    }
+
     public FilterContext getFilterContext() {
         return fctx;
     }
@@ -166,8 +171,14 @@
         return refcount;
     }
 
-    public void addref() {
+    public boolean addref() {
+        if (reusable && refcount == 0) {
+            if (image != null) {
+                image.lock();
+            }
+        }
         ++refcount;
+        return image != null && !image.isLost();
     }
 
     public void unref() {
@@ -176,6 +187,10 @@
                 sharedOwner.unref();
                 sharedOwner = null;
             } else if (fctx != null && image != null) {
+                if (reusable) {
+                    image.unlock();
+                    return;
+                }
                 Effect.releaseCompatibleImage(fctx, image);
             }
             // Just in case - to prevent releasing it twice
--- a/glass/build-closed.xml	Thu May 23 17:10:40 2013 -0700
+++ b/glass/build-closed.xml	Tue May 28 09:38:44 2013 -0700
@@ -27,7 +27,7 @@
     <target name="copy-sdk-binaries-ios" if="isIOS">
       <copy todir="${jfx.sdk.desktop.dir}" flatten="true">
         <fileset dir="${basedir}">
-          <include name="glass-lib-ios/dist/*"/>
+          <include name="glass-lib-ios/dist/libglass.a"/>
         </fileset>
       </copy>
     </target>
--- a/glass/glass-lib-gtk/src/GlassCursor.cpp	Thu May 23 17:10:40 2013 -0700
+++ b/glass/glass-lib-gtk/src/GlassCursor.cpp	Tue May 28 09:38:44 2013 -0700
@@ -156,13 +156,10 @@
             if (cursor == NULL)
                 cursor = gdk_cursor_new(GDK_SIZING);
             break;
-        case com_sun_glass_ui_Cursor_CURSOR_DISAPPEAR:
-            // Not implemented, using CURSOR_DEFAULT instead
-            cursor = gdk_cursor_new(GDK_LEFT_PTR);
-            break;
         case com_sun_glass_ui_Cursor_CURSOR_WAIT:
             cursor = gdk_cursor_new(GDK_WATCH);
             break;
+        case com_sun_glass_ui_Cursor_CURSOR_DISAPPEAR:
         case com_sun_glass_ui_Cursor_CURSOR_NONE:
             cursor = gdk_cursor_new(GDK_BLANK_CURSOR);
             break;
--- a/glass/glass-lib-macosx/src/GlassPasteboard.m	Thu May 23 17:10:40 2013 -0700
+++ b/glass/glass-lib-macosx/src/GlassPasteboard.m	Tue May 28 09:38:44 2013 -0700
@@ -562,89 +562,6 @@
 
 /*
  * Class:     com_sun_glass_ui_mac_MacPasteboard
- * Method:    _getItemAsString
- * Signature: (JI)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_com_sun_glass_ui_mac_MacPasteboard__1getItemAsString
-(JNIEnv *env, jobject jPasteboard, jlong jPtr, jint jIndex)
-{
-    LOG("Java_com_sun_glass_ui_mac_MacPasteboard__1getItemAsString");
-    
-    jstring string = NULL;
-    
-    GLASS_ASSERT_MAIN_JAVA_THREAD(env);
-    GLASS_POOL_ENTER;
-    {
-        if (jIndex >= 0)
-        {
-            NSPasteboard *pasteboard = (NSPasteboard*)jlong_to_ptr(jPtr);
-            NSArray *items = [pasteboard pasteboardItems];
-            NSPasteboardItem *item = [items objectAtIndex:(NSUInteger)jIndex];
-            if (item != nil)
-            {
-                // since this is a convenience method we'll try to do our best to return a string for this item
-                // by trying all the following types if needed
-                NSArray *utfs = [NSArray arrayWithObjects:
-                                 NSPasteboardTypeString,
-                                 NSPasteboardTypeRTF,
-                                 NSPasteboardTypeMultipleTextSelection,
-                                 NSPasteboardTypeTabularText,
-                                 NSPasteboardTypeHTML,
-                                 NSPasteboardTypePDF,
-                                 NSPasteboardTypeRTFD,
-                                 nil];
-                
-                NSString *str = nil;
-                for (NSUInteger i=0; i<[utfs count]; i++)
-                {
-                    str = [item stringForType:[utfs objectAtIndex:i]];
-                    if (str != nil)
-                    {
-                        string = (jobject)(*env)->NewStringUTF(env, [str UTF8String]);
-                        break;
-                    }
-                }
-                
-                if (string == nil)
-                {
-                    // if no string yet, try by referencing the item's url (if it exists)
-                    NSString *file = [item stringForType:(NSString*)kUTTypeURL];
-                    if (file != nil)
-                    {
-                        NSURL *url = [NSURL URLWithString:file]; 
-                        str = [NSString stringWithContentsOfURL:url encoding:NSUnicodeStringEncoding error:nil];
-                        if (str != nil)
-                        {
-                            string = (jobject)(*env)->NewStringUTF(env, [str UTF8String]);
-                        }
-                    }
-                }
-                
-                if (string == nil)
-                {
-                    // if no string yet, try by referencing the item's url (if it exists)
-                    NSString *file = [item stringForType:(NSString*)kUTTypeFileURL];
-                    if (file != nil)
-                    {
-                        NSURL *url = [NSURL URLWithString:file]; 
-                        str = [NSString stringWithContentsOfURL:url encoding:NSUnicodeStringEncoding error:nil];
-                        if (str != nil)
-                        {
-                            string = (jobject)(*env)->NewStringUTF(env, [str UTF8String]);
-                        }
-                    }
-                }
-            }
-        }
-    }
-    GLASS_POOL_EXIT;
-    GLASS_CHECK_EXCEPTION(env);
-    
-    return string;
-}
-
-/*
- * Class:     com_sun_glass_ui_mac_MacPasteboard
  * Method:    _getItemStringForUTF
  * Signature: (JILjava/lang/String;)Ljava/lang/String;
  */
@@ -738,50 +655,6 @@
 
 /*
  * Class:     com_sun_glass_ui_mac_MacPasteboard
- * Method:    _getItemForUTF
- * Signature: (JILjava/lang/String;)J
- */
-JNIEXPORT jlong JNICALL Java_com_sun_glass_ui_mac_MacPasteboard__1getItemForUTF
-(JNIEnv *env, jobject jPasteboard, jlong jPtr, jint jIndex, jstring jUtf)
-{
-    LOG("Java_com_sun_glass_ui_mac_MacPasteboard__1getItemForUTF");
-    
-    jlong ptr = 0L;
-    
-    GLASS_ASSERT_MAIN_JAVA_THREAD(env);
-    GLASS_POOL_ENTER;
-    {
-        if (jIndex >= 0)
-        {
-            NSString *utf = nil;
-            {
-                const jchar *chars = (*env)->GetStringChars(env, jUtf, NULL);
-                jsize length = (*env)->GetStringLength(env, jUtf);
-                if (length > 0)
-                {
-                    utf = [NSString stringWithCharacters:(UniChar *)chars length:(NSUInteger)length];
-                }
-                (*env)->ReleaseStringChars(env, jUtf, chars);
-            }
-            if (utf != nil)
-            {
-                NSPasteboard *pasteboard = (NSPasteboard*)jlong_to_ptr(jPtr);
-                NSArray *items = [pasteboard pasteboardItems];
-                NSPasteboardItem *item = [items objectAtIndex:(NSUInteger)jIndex];
-                
-                id property = [[item propertyListForType:utf] retain]; // notice we retain
-                ptr = ptr_to_jlong(property);
-            }
-        }
-    }
-    GLASS_POOL_EXIT;
-    GLASS_CHECK_EXCEPTION(env);
-    
-    return ptr;
-}
-
-/*
- * Class:     com_sun_glass_ui_mac_MacPasteboard
  * Method:    _putItemsFromArray
  * Signature: (J[Ljava/lang/Object;I)J
  */
--- a/glass/glass/src/com/sun/glass/ui/ios/IosApplication.java	Thu May 23 17:10:40 2013 -0700
+++ b/glass/glass/src/com/sun/glass/ui/ios/IosApplication.java	Tue May 28 09:38:44 2013 -0700
@@ -280,4 +280,14 @@
      * See iOS developers documentation.
      */
     public native static int _getStatusBarOrientation();
+
+    @Override
+    public boolean hasTouch() {
+        return true;
+    }
+
+    @Override
+    public boolean hasMultiTouch() {
+        return true;
+    }   
 }
--- a/glass/glass/src/com/sun/glass/ui/mac/MacDnDClipboard.java	Thu May 23 17:10:40 2013 -0700
+++ b/glass/glass/src/com/sun/glass/ui/mac/MacDnDClipboard.java	Tue May 28 09:38:44 2013 -0700
@@ -24,38 +24,13 @@
  */
 package com.sun.glass.ui.mac;
 
-import com.sun.glass.events.MouseEvent;
-
 final class MacDnDClipboard extends MacSystemClipboard {
 
     public MacDnDClipboard(String name) {
         super(name);
     }
 
-    /*
-     * called from native
-     */
-    static MacDnDClipboard getInstance() {
-        return (MacDnDClipboard)get(DND);
-    }
-
     @Override public String toString() {
         return "Mac DnD Clipboard";
     }
-
-    /*
-     * The MouseEvent.BUTTON_XXXX const if Java is DnD source.
-     */
-    protected int dragButton = 0;
-
-    public int getDragButton() {
-        return dragButton;
-    }
-
-    /*
-     * Called from native code
-     */
-    private void setDragButton(int dragButton) {
-        this.dragButton = dragButton;
-    }
 }
--- a/glass/glass/src/com/sun/glass/ui/mac/MacPasteboard.java	Thu May 23 17:10:40 2013 -0700
+++ b/glass/glass/src/com/sun/glass/ui/mac/MacPasteboard.java	Tue May 28 09:38:44 2013 -0700
@@ -24,10 +24,6 @@
  */
 package com.sun.glass.ui.mac;
 
-import com.sun.glass.ui.Application;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
 import java.util.HashMap;
 
 final class MacPasteboard {
@@ -113,14 +109,6 @@
         return _getItemAsRawImage(this.ptr, index);
     }
     
-    // get the item representation for the given index as String
-    // the platform will try to find the best representation
-    private native String _getItemAsString(long ptr, int index);
-    public String getItemAsString(int index) {
-        assertValid();
-        return _getItemAsString(this.ptr, index);
-    }
-    
     // get the item representation for the given utf type as String
     private native String _getItemStringForUTF(long ptr, int index, String utf);
     public String getItemStringForUTF(int index, String utf) {
@@ -135,15 +123,6 @@
         return _getItemBytesForUTF(this.ptr, index, utf);
     }
     
-    // get the item representation for the given utf type as native Objective-C object id
-    // the item retain count will increase by 1
-    // requires client to drop into Obj-C to do anything useful with the item
-    private native long _getItemForUTF(long ptr, int index, String utf);
-    public long getItemForUTF(int index, String utf) {
-        assertValid();
-        return _getItemForUTF(this.ptr, index, utf);
-    }
-    
     // paste the items with their corresponding representations
     // returns seed
     // 
@@ -163,16 +142,13 @@
     public long putItemsFromArray(Object[] items, int supportedActions) {
         return _putItemsFromArray(this.ptr, items, supportedActions);
     }
-    private Object[] hashMapToArray(HashMap hashmap) {
+    private Object[] hashMapToArray(HashMap<String, Object> hashmap) {
         Object[] array = null;
         if ((hashmap != null) && (hashmap.size() > 0)) {
             array = new Object[hashmap.size()];
-            java.util.Set keys = hashmap.keySet();
-            java.util.Iterator iterator = keys.iterator();
             int index = 0;
-            while (iterator.hasNext() == true) {
+            for (String utf : hashmap.keySet()) {
                 Object item[] = new Object[2];
-                String utf = (String)iterator.next();
                 item[MacPasteboard.UtfIndex] = utf;
                 item[MacPasteboard.ObjectIndex] = hashmap.get(utf);
                 array[index++] = item;
@@ -217,7 +193,7 @@
     private native void _release(long ptr);
     public void release() {
         assertValid();
-        if ((this.ptr != 0L) && (this.user == true)) {
+        if ((this.ptr != 0L) && (this.user)) {
             _release(ptr);
         }
         this.ptr = 0L;
--- a/glass/glass/src/com/sun/glass/ui/mac/MacSystemClipboard.java	Thu May 23 17:10:40 2013 -0700
+++ b/glass/glass/src/com/sun/glass/ui/mac/MacSystemClipboard.java	Tue May 28 09:38:44 2013 -0700
@@ -24,19 +24,21 @@
  */
 package com.sun.glass.ui.mac;
 
-import com.sun.glass.ui.Application;
-import com.sun.glass.ui.Clipboard;
-import com.sun.glass.ui.SystemClipboard;
-import com.sun.glass.ui.Pixels;
-
-import java.nio.IntBuffer;
-import java.util.HashMap;
-import java.net.URL;
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.net.URL;
 import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
+import java.util.Set;
+import com.sun.glass.ui.Application;
+import com.sun.glass.ui.Clipboard;
+import com.sun.glass.ui.Pixels;
+import com.sun.glass.ui.SystemClipboard;
 
 class MacSystemClipboard extends SystemClipboard {
 
@@ -60,12 +62,16 @@
     final MacPasteboard pasteboard;
     public MacSystemClipboard(String name) {
         super(name);
-        if (name.equals(Clipboard.DND) == true) {
-            this.pasteboard = new MacPasteboard(MacPasteboard.DragAndDrop);
-        } else if (name.equals(Clipboard.SYSTEM) == true) {
-            this.pasteboard = new MacPasteboard(MacPasteboard.General);
-        } else {
-            this.pasteboard = new MacPasteboard(name);
+        switch (name) {
+            case Clipboard.DND:
+                this.pasteboard = new MacPasteboard(MacPasteboard.DragAndDrop);
+                break;
+            case Clipboard.SYSTEM:
+                this.pasteboard = new MacPasteboard(MacPasteboard.General);
+                break;
+            default:
+                this.pasteboard = new MacPasteboard(name);
+                break;
         }
     }
     
@@ -86,211 +92,164 @@
     
     @Override
     protected void pushToSystem(HashMap<String, Object> data, int supportedActions) {
-        //System.out.println("MacSystemClipboard pushToSystem, supportedActions: "+supportedActions);
         HashMap<String,Object> itemFirst = null; // used to handle paste as one item if we can
         HashMap<String,Object> itemList[] = null; // special case: multiple items for handling urls 10.6 style
-        
-        java.util.Set keys = data.keySet();
-        //System.out.println("keys:"+keys);
-        //System.out.println("values:"+data.values());
-        java.util.Iterator iterator = keys.iterator();
-        while (iterator.hasNext() == true) {
-            String mime = (String)iterator.next();
+
+        for (String mime  : data.keySet()) {
             Object object = data.get(mime);
-            //System.out.println("    ["+mime+"] : ["+object+"]");
             if (object != null) {
-                if (mime.equals(URI_TYPE) == true) {
-                    // synthesize list of urls as seperate pasteboard items (Mac OS 10.6 style)
-                    String list = (String)object;
-                    String split[] = list.split("\n");
-                    int count = 0;
-                    for (int i=0; i<split.length; i++) {
-                        String string = split[i];
-                        if (string.startsWith("#") == false) {
-                            // exclude comments: http://www.ietf.org/rfc/rfc2483.txt
-                            count++;
+                switch (mime) {
+                    case URI_TYPE:
+                    {
+                        // synthesize list of urls as seperate pasteboard items (Mac OS 10.6 style)
+                        String split[] = ((String) object).split("\n");
+                        int count = 0;
+                        for (String string : split) {
+                            if (!string.startsWith("#")) {
+                                // exclude comments: http://www.ietf.org/rfc/rfc2483.txt
+                                count++;
+                            }
                         }
+                        if (count > 0) {
+                            itemList = new HashMap[count];
+                            count = 0;
+                            for (String file : split) {
+                                if (!file.startsWith("#")) {
+                                    // exclude comments: http://www.ietf.org/rfc/rfc2483.txt
+                                    URI uri = createUri(file, MacSystemClipboard.BAD_URI_MSG);
+                                    String utf = MacPasteboard.UtfUrl;
+                                    if (uri.getScheme() == null) {
+                                        utf = MacPasteboard.UtfFileUrl;
+                                        uri = createUri(MacSystemClipboard.FILE_SCHEME, uri.getPath(), MacSystemClipboard.BAD_URI_MSG);
+                                    }
+                                    itemList[count] = new HashMap<>();
+                                    itemList[count].put(utf, uri.toASCIIString());
+                                    count++;
+                                }
+                            }
+                        }
+                        break;
                     }
-                    //System.out.println("        count:"+count);
-                    if (count > 0) {
-                        itemList = new HashMap[count];
-                        count = 0;
-                        for (int i=0; i<split.length; i++) {
-                            String file = split[i];
-                            if (file.startsWith("#") == false) {
-                                // exclude comments: http://www.ietf.org/rfc/rfc2483.txt
-                                //System.out.println("            utf:"+MacPasteboard.UtfFileUrl);
-                                //System.out.println("            string:"+string);
+                    case RAW_IMAGE_TYPE:
+                    case DRAG_IMAGE:
+                    {
+                        Pixels pixels = null;
+                        if (object instanceof Pixels) {
+                            pixels = (Pixels) object;
+                        } else if (object instanceof ByteBuffer) {
+                            try {
+                                ByteBuffer bb = (ByteBuffer) object;
+                                bb.rewind();
+                                pixels = Application.GetApplication().createPixels(bb.getInt(), bb.getInt(), bb.slice());
+                            } catch (Exception ex) {
+                                //Ignore all ill-sized arrays. Not a client problem.
+                            }
+                        } else if (object instanceof IntBuffer) {
+                            try {
+                                IntBuffer ib = (IntBuffer) object;
+                                ib.rewind();
+                                pixels = Application.GetApplication().createPixels(ib.get(), ib.get(), ib.slice());
+                            } catch (Exception ex) {
+                                //Ignore all ill-sized arrays. Not a client problem.
+                            }
+                        } else {
+                            throw new RuntimeException(object.getClass().getName() + " cannot be converted to Pixels");
+                        }
+                        if (pixels != null) {
+                            if (itemFirst == null) {
+                                itemFirst = new HashMap<>();
+                            }
+                            itemFirst.put(FormatEncoder.mimeToUtf(mime), pixels);
+                        }
+                        break;
+                    }
+                    case TEXT_TYPE:
+                    case HTML_TYPE:
+                    case RTF_TYPE:
+                    {
+                        if (object instanceof String) {
+                            String string = (String)object;
+                            if (itemFirst == null) {
+                                itemFirst = new HashMap<>();
+                            }
+                            itemFirst.put(FormatEncoder.mimeToUtf(mime), string);
+                        } else {
+                            // http://javafx-jira.kenai.com/browse/RT-14593
+                            // temporary code, DelayedCallback trips over this
+                            // by reusing (incorrectly) text mime type
+                            System.err.println("DelayedCallback not implemented yet: RT-14593");
+                            Thread.dumpStack();
+                        }
+                        break;
+                    }
+                    case FILE_LIST_TYPE:
+                    {
+                        // handle FILE_LIST_TYPE last to know whether to handle it as urls (10.6) or file list (10.5)
+                        // depending on whether urls have been already explicitly set or not
+                        String files[] = (String[]) object;
+                        if (data.get(URI_TYPE) == null) {
+                            // special case no explicit urls found - synthesize urls (Mac OS 10.6 style)
+                            itemList = new HashMap[files.length];
+                            for (int i = 0; i < files.length; i++) {
+                                String file = files[i];
                                 URI uri = createUri(file, MacSystemClipboard.BAD_URI_MSG);
                                 String utf = MacPasteboard.UtfUrl;
-                                if (uri.getScheme() == null)
-                                {
+                                if (uri.getScheme() == null) {
                                     utf = MacPasteboard.UtfFileUrl;
                                     uri = createUri(MacSystemClipboard.FILE_SCHEME, uri.getPath(), MacSystemClipboard.BAD_URI_MSG);
                                 }
-                                itemList[count] = new HashMap();
-                                itemList[count].put(utf, uri.toASCIIString());
-                                count++;
+                                itemList[i] = new HashMap<>();
+                                itemList[i].put(utf, uri.toASCIIString());
+                            }
+                        } else if (MacSystemClipboard.SUPPORT_10_5_API) {
+                            // special case urls already exist - synthesize file list (Mac OS 10.5 API compatible)
+                            if (itemFirst == null) {
+                                itemFirst = new HashMap<>();
+                            }
+                            StringBuilder string = null;
+                            for (int i = 0; i < files.length; i++) {
+                                String file = files[i];
+                                URI uri = createUri(file, MacSystemClipboard.BAD_URI_MSG);
+                                if (string == null) {
+                                    string = new StringBuilder();
+                                }
+                                string.append(uri.getPath());
+                                if (i < (files.length - 1)) {
+                                    string.append("\n");
+                                }
+                            }
+                            if (string != null) {
+                                if ((itemFirst.get(MacPasteboard.UtfString) == null) || MacSystemClipboard.SUPPORT_10_5_API_FORCE) {
+                                    itemFirst.remove(MacPasteboard.UtfString);
+                                    itemFirst.put(MacPasteboard.UtfString, string.toString());
+                                }
                             }
                         }
+                        break;
                     }
-                } else if ((mime.equals(RAW_IMAGE_TYPE) == true) ||
-                                (mime.equals(DRAG_IMAGE) == true)) {
-                    Pixels pixels = null;
-                    if (object instanceof Pixels) {
-                        pixels = (Pixels) object;
-                    } else if (object instanceof ByteBuffer) {
-                        try {
-                            ByteBuffer bb = (ByteBuffer) object;
-                            bb.rewind();
-                            pixels = Application.GetApplication().createPixels(bb.getInt(), bb.getInt(), bb.slice());
-                        } catch (Exception ex) {
-                            //Ignore all ill-sized arrays. Not a client problem.
+                    default:
+                    {
+                        // http://javafx-jira.kenai.com/browse/RT-14592
+                        // custom client mime type - pass through
+                        if (itemFirst == null) {
+                            itemFirst = new HashMap<>();
                         }
-                    } else if (object instanceof IntBuffer) {
-                        try {
-                            IntBuffer ib = (IntBuffer) object;
-                            ib.rewind();
-                            pixels = Application.GetApplication().createPixels(ib.get(), ib.get(), ib.slice());
-                        } catch (Exception ex) {
-                            //Ignore all ill-sized arrays. Not a client problem.
-                        }
-                    } else {
-                        throw new RuntimeException(object.getClass().getName() + " cannot be converted to Pixels");
+                        itemFirst.put(FormatEncoder.mimeToUtf(mime), serialize(object));
+                        break;
                     }
-                    if (pixels != null) {
-                        if (itemFirst == null) {
-                            itemFirst = new HashMap();
-                        }
-                        itemFirst.put(FormatEncoder.mimeToUtf(mime), pixels);
-                    }
-                } else if ((mime.equals(TEXT_TYPE) == true) ||
-                                (mime.equals(HTML_TYPE) == true) ||
-                                    (mime.equals(RTF_TYPE) == true)) {
-                    if (object instanceof String) {
-                        String string = (String)object;
-                        if (itemFirst == null) {
-                            itemFirst = new HashMap();
-                        }
-                        itemFirst.put(FormatEncoder.mimeToUtf(mime), string);
-                    } else {
-                        // http://javafx-jira.kenai.com/browse/RT-14593
-                        // temporary code, DelayedCallback trips over this
-                        // by reusing (incorrectly) text mime type
-                        System.err.println("DelayedCallback not implemented yet: RT-14593");
-                        Thread.dumpStack();
-                    }
-                } else if (mime.equals(FILE_LIST_TYPE)) {
-                    // handle FILE_LIST_TYPE last to know whether to handle it as urls (10.6) or file list (10.5)
-                    // depending on whether urls have been already explicitly set or not
-                    String files[] = (String[])object;
-                    if (data.get(URI_TYPE) == null) {
-                        // special case no explicit urls found - synthesize urls (Mac OS 10.6 style)
-                        itemList = new HashMap[files.length];
-                        for (int i=0; i<files.length; i++) {
-                            String file = files[i];
-                            URI uri = createUri(file, MacSystemClipboard.BAD_URI_MSG);
-                            String utf = MacPasteboard.UtfUrl;
-                            if (uri.getScheme() == null)
-                            {
-                                utf = MacPasteboard.UtfFileUrl;
-                                uri = createUri(MacSystemClipboard.FILE_SCHEME, uri.getPath(), MacSystemClipboard.BAD_URI_MSG);
-                            }
-                            itemList[i] = new HashMap();
-                            itemList[i].put(utf, uri.toASCIIString());
-                        }
-                    } else if (MacSystemClipboard.SUPPORT_10_5_API == true) {
-                        // special case urls already exist - synthesize file list (Mac OS 10.5 API compatible)
-                        if (itemFirst == null) {
-                            itemFirst = new HashMap();
-                        }
-                        StringBuilder string = null;
-                        for (int i=0; i<files.length; i++) {
-                            String file = files[i];
-                            URI uri = createUri(file, MacSystemClipboard.BAD_URI_MSG);
-                            if (string == null) {
-                                string = new StringBuilder();
-                            }
-                            string.append(uri.getPath());
-                            if (i < (files.length-1)) {
-                                string.append("\n");
-                            }
-                        }
-                        if (string != null) {
-                            if ((itemFirst.get(MacPasteboard.UtfString) == null) || (MacSystemClipboard.SUPPORT_10_5_API_FORCE == true)) {
-                                itemFirst.remove(MacPasteboard.UtfString);
-                                itemFirst.put(MacPasteboard.UtfString, string.toString());
-                            }
-                        }
-                    }
-                } else {
-                    // http://javafx-jira.kenai.com/browse/RT-14592
-                    // custom client mime type - pass through
-                    if (itemFirst == null) {
-                        itemFirst = new HashMap();
-                    }
-                    itemFirst.put(FormatEncoder.mimeToUtf(mime), serialize(object));
                 }
             }
         }
         
-//        System.out.println("    itemFirst:"+itemFirst);
-//        if (itemFirst != null) {
-//            iterator = itemFirst.keySet().iterator();
-//            while (iterator.hasNext() == true) {
-//                String utf = (String)iterator.next();
-//                Object object = itemFirst.get(utf);
-//                System.out.println("        "+utf+" : "+object);
-//                itemList[0].put(utf, object);
-//            }
-//        }
-            
-//        System.out.println("    itemList:"+itemList);
-//        if (itemList != null) {
-//            for (int i=0; i<itemList.length; i++) {
-//                System.out.println("        item["+i+"]");
-//                HashMap item = itemList[i];
-//                iterator = item.keySet().iterator();
-//                while (iterator.hasNext() == true) {
-//                    String utf = (String)iterator.next();
-//                    Object object = item.get(utf);
-//                    System.out.println("            "+utf+" : "+object);
-//                    itemList[0].put(utf, object);
-//                }
-//            }
-//        }
-        
         if (itemFirst != null) {
             if (itemList == null) {
                 itemList = new HashMap[1];
                 itemList[0] = itemFirst;
             } else {
-                HashMap temp = itemList[0];
-                itemList[0] = itemFirst;
-                iterator = temp.keySet().iterator();
-                while (iterator.hasNext() == true) {
-                    String utf = (String)iterator.next();
-                    Object object = temp.get(utf);
-                    itemList[0].put(utf, object);
-                }
+                itemList[0].putAll(itemFirst);
             }
         }
         
-//        System.out.println("pushToSystem final items:"+itemList);
-//        if (itemList != null) {
-//            for (int i=0; i<itemList.length; i++) {
-//                System.out.println("        item["+i+"]");
-//                HashMap item = itemList[i];
-//                iterator = item.keySet().iterator();
-//                while (iterator.hasNext() == true) {
-//                    String utf = (String)iterator.next();
-//                    Object object = item.get(utf);
-//                    System.out.println("            "+utf+" : "+object);
-//                    itemList[0].put(utf, object);
-//                }
-//            }
-//        }
-        
         if (itemList != null) {
             this.seed = this.pasteboard.putItems(itemList, supportedActions);
         }
@@ -298,58 +257,34 @@
     
     @Override
     protected Object popFromSystem(String mime) {
-        //System.err.println("popFromSystem: ["+mime+"]");
-        Object object = null;
+        String[][] utfs = this.pasteboard.getUTFs();
 
-        String[][] utfs = this.pasteboard.getUTFs();
-        if (mime.equals(URI_TYPE) == true) {
-            if (utfs != null) {
-                java.util.ArrayList<String> list = new java.util.ArrayList<String>();
-                for (int i=0; i<utfs.length; i++) {
-                    String url = this.pasteboard.getItemStringForUTF(i, FormatEncoder.mimeToUtf(URI_TYPE));
-                    //System.out.println("    url: "+url);
-                    if (url != null) {
-                        list.add(url);
-                        if (SUPPORT_10_6_API == false) {
-                            break;
-                        }
-                    }
-                }
-                if (list.size() > 0) {
-                    if (SUPPORT_10_6_API == false) {
-                        object = list.get(0);
-                    } else {
-                        object = list;
-                    }
-                }
-            }
-        } else if (mime.equals(RAW_IMAGE_TYPE) == true) {
-            if (utfs != null) {
-                java.util.ArrayList<Pixels> list = new java.util.ArrayList<Pixels>();
-                for (int i=0; i<utfs.length; i++) {
+        if (utfs == null) {
+            return null;
+        }
+        switch (mime) {
+            case RAW_IMAGE_TYPE:
+            {
+                List<Pixels> list = new ArrayList<>();
+                for (int i = 0; i < utfs.length; i++) {
                     Object data = this.pasteboard.getItemAsRawImage(i);
                     if (data != null) {
-                        Pixels pixels = getPixelsForRawImage((byte[])data);
+                        Pixels pixels = getPixelsForRawImage((byte[]) data);
                         list.add(pixels);
                         if (SUPPORT_10_6_API == false) {
                             break;
                         }
                     }
                 }
-                if (list.size() > 0) {
-                    if (SUPPORT_10_6_API == false) {
-                        object = list.get(0);
-                    } else {
-                        object = list;
-                    }
-                }
+                return getObjectFromList(list);
             }
-        } else if ((mime.equals(TEXT_TYPE) == true) ||
-                        (mime.equals(HTML_TYPE) == true) ||
-                            (mime.equals(RTF_TYPE) == true)) {
-            if (utfs != null) {
-                java.util.ArrayList<String> list = new java.util.ArrayList<String>();
-                for (int i=0; i<utfs.length; i++) {
+            case TEXT_TYPE:
+            case HTML_TYPE:
+            case RTF_TYPE:
+            case URI_TYPE:
+            {
+                List<String> list = new ArrayList<>();
+                for (int i = 0; i < utfs.length; i++) {
                     String item = this.pasteboard.getItemStringForUTF(i, FormatEncoder.mimeToUtf(mime));
                     if (item != null) {
                         list.add(item);
@@ -358,35 +293,30 @@
                         }
                     }
                 }
-                if (list.size() > 0) {
-                    if (SUPPORT_10_6_API == false) {
-                        object = list.get(0);
-                    } else {
-                        object = list;
-                    }
-                }
+                return getObjectFromList(list);
             }
-        } else if (mime.equals(FILE_LIST_TYPE) == true) {
-            // synthesize the list from individual URLs
-            if (utfs != null) {
-                java.util.ArrayList<String> list = new java.util.ArrayList<String>();
-                for (int i=0; i<utfs.length; i++) {
+            case FILE_LIST_TYPE:
+            {
+                // synthesize the list from individual URLs
+                List<String> list = new ArrayList<>();
+                for (int i = 0; i < utfs.length; i++) {
                     String file = this.pasteboard.getItemStringForUTF(i, MacPasteboard.UtfFileUrl); // explicitly ask for urls
                     if (file != null) {
                         URL url = createUrl(file, MacSystemClipboard.BAD_URL_MSG);
                         list.add(url.getPath());
-                        //System.out.println("    url: "+url.getPath());
                     }
                 }
+                String[] object = null;
                 if (list.size() > 0) {
                     object = new String[list.size()];
-                    list.toArray((String[])object);
+                    list.toArray(object);
                 }
+                return object;
             }
-        } else {
-            if (utfs != null) {
-                java.util.ArrayList<ByteBuffer> list = new java.util.ArrayList<ByteBuffer>();
-                for (int i=0; i<utfs.length; i++) {
+            default:
+            {
+                List<ByteBuffer> list = new ArrayList<>();
+                for (int i = 0; i < utfs.length; i++) {
                     byte data[] = this.pasteboard.getItemBytesForUTF(i, FormatEncoder.mimeToUtf(mime));
                     if (data != null) {
                         // http://javafx-jira.kenai.com/browse/RT-14592
@@ -398,53 +328,41 @@
                         }
                     }
                 }
-                if (list.size() > 0) {
-                    if (SUPPORT_10_6_API == false) {
-                        object = list.get(0);
-                    } else {
-                        object = list;
-                    }
-                }
+                return getObjectFromList(list);
             }
         }
-        
-        //System.out.println("    object: "+object);
-        return object;
+    }
+
+    private Object getObjectFromList(List<?> list) {
+        if (list.size() > 0) {
+            if (SUPPORT_10_6_API == false) {
+                return list.get(0);
+            } else {
+                return list;
+            }
+        }
+        return null;
     }
     
     @Override
     protected String[] mimesFromSystem() {
         String[][] all = this.pasteboard.getUTFs();
+        List<String> mimes = new ArrayList<>();
 
-        java.util.ArrayList<String> mimes = new java.util.ArrayList<String>();
-
-        //System.out.println("mimesFromSystem");
-        //System.out.println("    utfs:");
         if (all != null) {
-            for (int i=0; i<all.length; i++) {
-                String[] utfs = all[i];
+            for (String[] utfs : all) {
                 if (utfs != null) {
-                    for (int j=0; j<utfs.length; j++) {
-                        String utf = utfs[j];
-                        //System.out.println("        utfs["+i+"]:["+j+"]:"+utf);
+                    for (String utf : utfs) {
                         String mime = FormatEncoder.utfToMime(utf);
-                        //System.out.println("        mime:"+mime);
-                        if ((mime != null) && (mimes.contains(mime) == false)) {
+                        if ((mime != null) && (!mimes.contains(mime))) {
                             mimes.add(mime);
                         }
                     }
                 }
             }
         }
-        
         String[] strings = new String[mimes.size()];
         mimes.toArray(strings);
-        
-        //System.err.println("MacSystemClipboard mimesFromSystem:");
-        //for (int i=0; i<strings.length; i++) {
-        //    System.err.println("    mime["+i+"]:"+strings[i]);
-        //}
-        
         return strings;
     }
     
@@ -515,7 +433,6 @@
         } catch (URISyntaxException ex) {
             System.err.println(message+path);
             Thread.dumpStack();
-            //throw new RuntimeException(ex);
         }
         return uri;
     }
@@ -527,7 +444,6 @@
         } catch (URISyntaxException ex) {
             System.err.println(message+path);
             Thread.dumpStack();
-            //throw new RuntimeException(ex);
         }
         return uri;
     }
@@ -539,7 +455,6 @@
         } catch (MalformedURLException ex) {
             System.err.println(message+path);
             Thread.dumpStack();
-            //throw new RuntimeException(ex);
         }
         return url;
     }
--- a/gradleBuildSrc/linux.gradle	Thu May 23 17:10:40 2013 -0700
+++ b/gradleBuildSrc/linux.gradle	Tue May 28 09:38:44 2013 -0700
@@ -74,7 +74,7 @@
 // Specify the compilation parameters and link parameters
 def ccFlags = [
         commonFlags, "-I$JDK_HOME/include", "-I$JDK_HOME/include/linux", "-c",
-        IS_DEBUG ? ["-ggdb", "-DVERBOSE"] : "-O2", "-DINLINE=inline"].flatten()
+        IS_DEBUG ? ["-ggdb", "-DVERBOSE"] : "-O2"].flatten()
 //ccFlags.addAll(["-Wnon-virtual-dtor", "-Woverloaded-virtual", "-std=c++0x"])
 def linkFlags = ["-shared", commonFlags].flatten()
 
@@ -128,7 +128,7 @@
 LINUX.prism.javahInclude = ["com/sun/prism/impl/**/*", "com/sun/prism/PresentableState*"]
 LINUX.prism.nativeSource = file("modules/graphics/src/main/native-prism")
 LINUX.prism.compiler = "cc"
-LINUX.prism.ccFlags = [ccFlags].flatten()
+LINUX.prism.ccFlags = [ccFlags, "-DINLINE=inline"].flatten()
 LINUX.prism.linker = linker
 LINUX.prism.linkFlags = [linkFlags].flatten()
 LINUX.prism.lib = "prism-common"
@@ -137,7 +137,7 @@
 LINUX.prismSW.javahInclude = ["com/sun/pisces/**/*"]
 LINUX.prismSW.nativeSource = file("modules/graphics/src/main/native-prism-sw")
 LINUX.prismSW.compiler = "cc"
-LINUX.prismSW.ccFlags = [ccFlags].flatten()
+LINUX.prismSW.ccFlags = [ccFlags, "-DINLINE=inline"].flatten()
 LINUX.prismSW.linker = linker
 LINUX.prismSW.linkFlags = [linkFlags].flatten()
 LINUX.prismSW.lib = "prism-sw"
--- a/javafx-anim/test/unit/javafx/animation/TimelineTest.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-anim/test/unit/javafx/animation/TimelineTest.java	Tue May 28 09:38:44 2013 -0700
@@ -155,6 +155,9 @@
         assertEquals(Duration.ZERO, timeline.getCycleDuration());
     }
 
+// The following test needs to be removed or else moved to javafx-builders
+// since we no longer want any other module to depend on builders
+/*
     @Test
     public void testBuilder() {
         Timeline t = TimelineBuilder.create().targetFramerate(23).delay(Duration.ONE)
@@ -163,4 +166,5 @@
         assertEquals(Duration.ONE, t.getDelay());
         assertEquals(Collections.singletonList(new KeyFrame(Duration.millis(1500))), t.getKeyFrames());
     }
+*/
 }
--- a/javafx-beans/src/com/sun/javafx/beans/annotations/DuplicateInBuilderProperties.java	Thu May 23 17:10:40 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.javafx.beans.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Specifies that the property from the superclass should be copied 
- * to subclasses of the builder.
- *
- * The class whose builder is missing the properties should be annotated, 
- * the "properties" list should contain names of properties to be generated.
- * e.g.
- * @DuplicateInBuilderProperties(properties = {"minHeight", "minWidth"})
- *  public abstract class Control extends Region implements Skinnable {...}
- * this means that the ControlBuilder will contain minHeight and minWidth
- * properties, even though they are inherited from Region (so they wouldn't be
- * generated without the annotation)
- *
- * This annotation was introduced to solve an issue with moving promptText
- * from TextField to TextInputControl which caused incompatibility in their 
- * builders (RT-21327).
- */
-@Retention(RetentionPolicy.SOURCE)
-@Target({ElementType.TYPE})
-public @interface DuplicateInBuilderProperties {
-    String[] properties();
-}
--- a/javafx-beans/src/com/sun/javafx/beans/annotations/NoBuilder.java	Thu May 23 17:10:40 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.javafx.beans.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Specifies that no builder should be generated for this class.
- * 
- */
-@Retention(RetentionPolicy.SOURCE)
-@Target(ElementType.TYPE)
-public @interface NoBuilder {
-}
--- a/javafx-beans/src/com/sun/javafx/beans/annotations/NoInit.java	Thu May 23 17:10:40 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.javafx.beans.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Specifies that a property can not or should not be initialized on object
- * creation. This means that it will not be included in any generated builder
- * class, for example.
- * 
- */
-@Retention(RetentionPolicy.SOURCE)
-@Target({ ElementType.FIELD, ElementType.METHOD })
-public @interface NoInit {
-}
--- a/javafx-beans/src/com/sun/javafx/collections/ObservableFloatArrayImpl.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-beans/src/com/sun/javafx/collections/ObservableFloatArrayImpl.java	Tue May 28 09:38:44 2013 -0700
@@ -264,4 +264,23 @@
         }
         if (length < 0) throw new ArrayIndexOutOfBoundsException(-1);
     }
+
+    @Override
+    public String toString() {
+        if (array == null)
+            return "null";
+
+        int iMax = size() - 1;
+        if (iMax == -1)
+            return "[]";
+
+        StringBuilder b = new StringBuilder();
+        b.append('[');
+        for (int i = 0; ; i++) {
+            b.append(array[i]);
+            if (i == iMax)
+                return b.append(']').toString();
+            b.append(", ");
+        }
+    }
 }
--- a/javafx-beans/src/com/sun/javafx/collections/ObservableIntegerArrayImpl.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-beans/src/com/sun/javafx/collections/ObservableIntegerArrayImpl.java	Tue May 28 09:38:44 2013 -0700
@@ -264,4 +264,23 @@
         }
         if (length < 0) throw new ArrayIndexOutOfBoundsException(-1);
     }
+
+    @Override
+    public String toString() {
+        if (array == null)
+            return "null";
+
+        int iMax = size() - 1;
+        if (iMax == -1)
+            return "[]";
+
+        StringBuilder b = new StringBuilder();
+        b.append('[');
+        for (int i = 0; ; i++) {
+            b.append(array[i]);
+            if (i == iMax)
+                return b.append(']').toString();
+            b.append(", ");
+        }
+    }
 }
--- a/javafx-beans/test/javafx/collections/ObservableArrayTest.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-beans/test/javafx/collections/ObservableArrayTest.java	Tue May 28 09:38:44 2013 -0700
@@ -83,6 +83,7 @@
         abstract int arrayLength(A array);
         abstract P get(A array, int index);
         abstract void assertElementsEqual(A actual, int from, int to, A expected, int expFrom);
+        abstract String primitiveArrayToString(A array);
     }
 
     private static class IntegerArrayWrapper extends ArrayWrapper<ObservableIntegerArray, int[], Integer> {
@@ -196,6 +197,11 @@
         @Override int[] clonePrimitiveArray(int[] array) {
             return Arrays.copyOf(array, array.length);
         }
+
+        @Override
+        String primitiveArrayToString(int[] array) {
+            return Arrays.toString(array);
+        }
     }
 
     private static class FloatArrayWrapper extends ArrayWrapper<ObservableFloatArray, float[], Float> {
@@ -312,6 +318,11 @@
         @Override void setT(int destIndex, ObservableFloatArray src, int srcIndex, int length) {
             array.set(destIndex, src, srcIndex, length);
         }
+
+        @Override
+        String primitiveArrayToString(float[] array) {
+            return Arrays.toString(array);
+        }
     }
 
     static final List<String> EMPTY = Collections.emptyList();
@@ -2594,4 +2605,31 @@
         mao.checkOnlySizeChanged(array);
         assertEquals(0, array.size());
     }
+
+    // ================= toString() tests ===================
+
+    @Test public void testToString() {
+        String actual = array.toString();
+        String expected = wrapper.primitiveArrayToString(wrapper.toArray(null));
+        assertEquals(expected, actual);
+        String regex = "\\[[0-9]+(\\.[0-9]+){0,1}(\\, [0-9]+(.[0-9]+){0,1}){" + (initialSize - 1) + "}\\]";
+        assertTrue("toString() output matches to regex '" + regex + "'. Actual = '" + actual + "'",
+                actual.matches(regex));
+    }
+
+    @Test public void testToStringAfterResize() {
+        array.resize(initialSize / 2);
+        String actual = array.toString();
+        String expected = wrapper.primitiveArrayToString(wrapper.toArray(null));
+        assertEquals(expected, actual);
+        String regex = "\\[[0-9]+(\\.[0-9]+){0,1}(\\, [0-9]+(.[0-9]+){0,1}){" + (array.size() - 1) + "}\\]";
+        assertTrue("toString() output matches to regex '" + regex + "'. Actual = '" + actual + "'",
+                actual.matches(regex));
+    }
+
+    @Test public void testToStringAfterClear() {
+        array.clear();
+        String actual = array.toString();
+        assertEquals("[]", actual);
+    }
 }
--- a/javafx-common/src/javafx/event/ActionEvent.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-common/src/javafx/event/ActionEvent.java	Tue May 28 09:38:44 2013 -0700
@@ -41,6 +41,11 @@
             new EventType<ActionEvent>(Event.ANY, "ACTION");
 
     /**
+     * Common supertype for all action event types.
+     */
+    public static final EventType<ActionEvent> ANY = ACTION;
+
+    /**
      * Creates a new {@code ActionEvent} with an event type of {@code ACTION}.
      * The source and target of the event is set to {@code NULL_SOURCE_TARGET}.
      */
--- a/javafx-embed-swt/src/javafx/embed/swt/FXCanvas.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-embed-swt/src/javafx/embed/swt/FXCanvas.java	Tue May 28 09:38:44 2013 -0700
@@ -89,6 +89,7 @@
 import org.eclipse.swt.graphics.ImageData;
 import org.eclipse.swt.graphics.PaletteData;
 import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
 
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ControlListener;
@@ -442,7 +443,8 @@
         if ((stagePeer == null) /*|| !isShowing()*/) {
             return;
         }
-        Point los = toDisplay(getLocation());
+        Rectangle rect = getClientArea();
+        Point los = toDisplay(rect.x, rect.y);
         stagePeer.setLocation(los.x, los.y);
     }
     
--- a/javafx-geom/src/com/sun/javafx/geom/PickRay.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-geom/src/com/sun/javafx/geom/PickRay.java	Tue May 28 09:38:44 2013 -0700
@@ -27,7 +27,6 @@
 
 import com.sun.javafx.geom.transform.Affine3D;
 import com.sun.javafx.geom.transform.BaseTransform;
-import com.sun.javafx.geom.transform.GeneralTransform3D;
 import com.sun.javafx.geom.transform.NoninvertibleTransformException;
 
 /**
@@ -36,25 +35,20 @@
 public class PickRay {
     private Vec3d origin = new Vec3d();
     private Vec3d direction = new Vec3d();
-    private boolean parallel = false;
+    private double nearClip = 0.0;
+    private double farClip = Double.POSITIVE_INFINITY;
 
 //    static final double EPS = 1.0e-13;
     static final double EPS = 1.0e-5f;
 
     public PickRay() { }
 
-    public PickRay(Vec3d origin, Vec3d direction) {
-        set(origin, direction);
+    public PickRay(Vec3d origin, Vec3d direction, double nearClip, double farClip) {
+        set(origin, direction, nearClip, farClip);
     }
 
-    public PickRay(double x, double y) {
-        set(x, y);
-    }
-
-    public PickRay(Vec3d origin, Vec3d direction, boolean parallel) {
-        setOrigin(origin);
-        setDirection(direction);
-        this.parallel = parallel;
+    public PickRay(double x, double y, double nearClip, double farClip) {
+        set(x, y, nearClip, farClip);
     }
 
     public static PickRay computePerspectivePickRay(
@@ -62,6 +56,7 @@
             double viewWidth, double viewHeight,
             double fieldOfView, boolean verticalFieldOfView,
             Affine3D cameraTransform,
+            double nearClip, double farClip,
             PickRay pickRay) {
 
         if (pickRay == null) {
@@ -84,13 +79,13 @@
         if (fixedEye) {
             eye.set(0.0, 0.0, 0.0);
         } else {
-            // Projection plane is at Z = 0, implies that eye must be located at:
+            // set eye at center of viewport and move back so that projection plane
+            // is at Z = 0
             eye.set(halfViewWidth, halfViewHeight, -distanceZ);
         }
 
-        // set eye at center of viewport and move back so that projection plane
-        // is at Z = 0
-        if (pickRay.isParallel()) { pickRay.set(eye, direction); }
+        pickRay.nearClip = nearClip * (direction.length() / distanceZ);
+        pickRay.farClip = farClip * (direction.length() / distanceZ);
 
         pickRay.transform(cameraTransform);
 
@@ -100,13 +95,14 @@
     public static PickRay computeParallelPickRay(
             double x, double y,
             Affine3D cameraTransform,
+            double nearClip, double farClip,
             PickRay pickRay) {
 
         if (pickRay == null) {
             pickRay = new PickRay();
         }
 
-        pickRay.set(x, y);
+        pickRay.set(x, y, nearClip, farClip);
 
         if (cameraTransform != null) {
             pickRay.transform(cameraTransform);
@@ -115,13 +111,14 @@
         return pickRay;
     }
 
-    public final void set(Vec3d origin, Vec3d direction) {
+    public final void set(Vec3d origin, Vec3d direction, double nearClip, double farClip) {
         setOrigin(origin);
         setDirection(direction);
-        parallel = false;
+        this.nearClip = nearClip;
+        this.farClip = farClip;
     }
 
-    public final void set(double x, double y) {
+    public final void set(double x, double y, double nearClip, double farClip) {
         // Right now the parallel camera picks nodes even on negative distances
         // (behind the camera). Therefore, it doesn't matter
         // what is the Z coordinate of the origin. Also the reported distance
@@ -132,18 +129,20 @@
         // when the projection plane is properly used for the intersection.
         setOrigin(x, y, -1);
         setDirection(0, 0, 1);
-        parallel = true;
+        this.nearClip = nearClip;
+        this.farClip = farClip;
     }
 
 
     public void setPickRay(PickRay other) {
         setOrigin(other.origin);
         setDirection(other.direction);
-        parallel = other.parallel;
+        nearClip = other.nearClip;
+        farClip = other.farClip;
     }
 
     public PickRay copy() {
-        return new PickRay(origin, direction, parallel);
+        return new PickRay(origin, direction, nearClip, farClip);
     }
 
     /**
@@ -211,8 +210,12 @@
         return direction;
     }
 
-    public boolean isParallel() {
-        return parallel;
+    public double getNearClip() {
+        return nearClip;
+    }
+
+    public double getFarClip() {
+        return farClip;
     }
 
     public double distance(Vec3d iPnt) {
@@ -222,12 +225,6 @@
         return Math.sqrt(x*x + y*y + z*z);
     }
 
-    public boolean intersect(Vec3f[] tri, double[] distance, Vec3d iPnt) {
-        return intersectRayOrSegment(tri,
-            origin, direction,
-            distance, iPnt, false);
-    }
-
     /**
      * Project the ray through the specified (inverted) transform and
      * onto the Z=0 plane of the resulting coordinate system.
@@ -287,276 +284,6 @@
         return ((a < EPSILON_ABSOLUTE) && (a > -EPSILON_ABSOLUTE));
     }
 
-    private final Vec3d tempV3d = new Vec3d();
-    private final Vec3d vec0 = new Vec3d();
-    private final Vec3d vec1 = new Vec3d();
-    private final Vec3d pNrm = new Vec3d();
-
-    /**
-     *  Return true if triangle intersects with ray. If true, the distance is
-     *  stored in dist, and the intersection point is stored in iPnt
-     */
-    boolean intersectRayOrSegment(Vec3f[] coordinates,
-            Vec3d origin, Vec3d direction,
-            double[] dist, Vec3d iPnt, boolean isSegment) {
-
-        double  absNrmX, absNrmY, absNrmZ, pD = 0.0;
-        double pNrmDotrDir = 0.0;
-
-        boolean isIntersect = false;
-        int i, j, k=0, l = 0;
-
-        // Compute plane normal.
-        for (i=0; i<coordinates.length; i++) {
-            if (i != coordinates.length-1) {
-                l = i+1;
-            } else {
-                l = 0;
-            }
-            vec0.sub(coordinates[l], coordinates[i]);
-            if (vec0.length() > 0.0) {
-                break;
-            }
-        }
-
-        for (j=l; j<coordinates.length; j++) {
-            if (j != coordinates.length-1) {
-                k = j+1;
-            } else {
-                k = 0;
-            }
-            vec1.sub(coordinates[k], coordinates[j]);
-            if (vec1.length() > 0.0) {
-                break;
-            }
-        }
-
-        pNrm.cross(vec0,vec1);
-
-        if ((vec1.length() == 0) || (pNrm.length() == 0)) {
-            return false;
-//          // degenerate to line if vec0.length() == 0
-//          // or vec0.length > 0 and vec0 parallel to vec1
-//          k = (l == 0 ? coordinates.length-1: l-1);
-//          isIntersect = intersectLineAndRay(coordinates[l],
-//                                            coordinates[k],
-//                                            origin,
-//                                            direction,
-//                                            dist,
-//                                            iPnt);
-//
-//          // put the Vectors on the freelist
-//          return isIntersect;
-        }
-
-        // It is possible that Quad is degenerate to Triangle
-        // at this point
-
-        pNrmDotrDir = pNrm.dot(direction);
-
-        // Ray is parallel to plane.
-        if (pNrmDotrDir == 0.0) {
-            return false;
-//          // Ray is parallel to plane
-//          // Check line/triangle intersection on plane.
-//          for (i=0; i < coordinates.length ;i++) {
-//              if (i != coordinates.length-1) {
-//                  k = i+1;
-//              } else {
-//                  k = 0;
-//              }
-//              if (intersectLineAndRay(coordinates[i],
-//                                      coordinates[k],
-//                                      origin,
-//                                      direction,
-//                                      dist,
-//                                      iPnt)) {
-//                  isIntersect = true;
-//                  break;
-//              }
-//          }
-//          return isIntersect;
-        }
-
-        // Plane equation: (p - p0)*pNrm = 0 or p*pNrm = pD;
-        tempV3d.set(coordinates[0]);
-        pD = pNrm.dot(tempV3d);
-        tempV3d.set(origin);
-
-        // Substitute Ray equation:
-        // p = origin + pi.distance*direction
-        // into the above Plane equation
-
-        dist[0] = (pD - pNrm.dot(tempV3d))/ pNrmDotrDir;
-
-        // Ray intersects the plane behind the ray's origin.
-        if ((dist[0] < -EPS ) ||
-            (isSegment && (dist[0] > 1.0+EPS))) {
-            // Ray intersects the plane behind the ray's origin
-            // or intersect point not fall in Segment
-            return false;
-        }
-
-        // Now, one thing for sure the ray intersect the plane.
-        // Find the intersection point.
-        if (iPnt == null) {
-            iPnt = new Vec3d();
-        }
-        iPnt.x = origin.x + direction.x * dist[0];
-        iPnt.y = origin.y + direction.y * dist[0];
-        iPnt.z = origin.z + direction.z * dist[0];
-
-        // Project 3d points onto 2d plane
-        // Find the axis so that area of projection is maximize.
-        absNrmX = Math.abs(pNrm.x);
-        absNrmY = Math.abs(pNrm.y);
-        absNrmZ = Math.abs(pNrm.z);
-
-        // All sign of (y - y0) (x1 - x0) - (x - x0) (y1 - y0)
-        // must agree.
-        double sign, t, lastSign = 0;
-        Vec3f p0 = coordinates[coordinates.length-1];
-        Vec3f p1 = coordinates[0];
-
-        isIntersect = true;
-
-        if (absNrmX > absNrmY) {
-            if (absNrmX < absNrmZ) {
-                for (i=0; i < coordinates.length; i++) {
-                    p0 = coordinates[i];
-                    p1 = (i != coordinates.length-1 ? coordinates[i+1]: coordinates[0]);
-                    sign = (iPnt.y - p0.y)*(p1.x - p0.x) -
-                           (iPnt.x - p0.x)*(p1.y - p0.y);
-                    if (isNonZero(sign)) {
-                        if (sign*lastSign < 0) {
-                            isIntersect = false;
-                            break;
-                        }
-                        lastSign = sign;
-                    } else { // point on line, check inside interval
-                        t = p1.y - p0.y;
-                        if (isNonZero(t)) {
-                            t = (iPnt.y - p0.y)/t;
-                            isIntersect = ((t > -EPS) && (t < 1+EPS));
-                            break;
-                        } else {
-                            t = p1.x - p0.x;
-                            if (isNonZero(t)) {
-                                t = (iPnt.x - p0.x)/t;
-                                isIntersect = ((t > -EPS) && (t < 1+EPS));
-                                break;
-                            } else {
-    // Ignore degenerate line=>point happen when Quad => Triangle.
-    // Note that by next round sign*lastSign = 0 so it will
-    // not pass the interest test. This should only happen once in the
-    // loop because we already check for degenerate geometry before.
-                            }
-                        }
-                    }
-                }
-            } else {
-                for (i=0; i<coordinates.length; i++) {
-                    p0 = coordinates[i];
-                    p1 = (i != coordinates.length-1 ? coordinates[i+1]: coordinates[0]);
-                    sign = (iPnt.y - p0.y)*(p1.z - p0.z) -
-                           (iPnt.z - p0.z)*(p1.y - p0.y);
-                    if (isNonZero(sign)) {
-                        if (sign*lastSign < 0) {
-                            isIntersect = false;
-                            break;
-                        }
-                        lastSign = sign;
-                    } else { // point on line, check inside interval
-                        t = p1.y - p0.y;
-
-                        if (isNonZero(t)) {
-                            t = (iPnt.y - p0.y)/t;
-                            isIntersect = ((t > -EPS) && (t < 1+EPS));
-                            break;
-
-                        } else {
-                            t = p1.z - p0.z;
-                            if (isNonZero(t)) {
-                                t = (iPnt.z - p0.z)/t;
-                                isIntersect = ((t > -EPS) && (t < 1+EPS));
-                                break;
-                            } else {
-                                //degenerate line=>point
-                            }
-                        }
-                    }
-                }
-            }
-        } else {
-            if (absNrmY < absNrmZ) {
-                for (i=0; i<coordinates.length; i++) {
-                    p0 = coordinates[i];
-                    p1 = (i != coordinates.length-1 ? coordinates[i+1]: coordinates[0]);
-                    sign = (iPnt.y - p0.y)*(p1.x - p0.x) -
-                           (iPnt.x - p0.x)*(p1.y - p0.y);
-                    if (isNonZero(sign)) {
-                        if (sign*lastSign < 0) {
-                            isIntersect = false;
-                            break;
-                        }
-                        lastSign = sign;
-                    } else { // point on line, check inside interval
-                        t = p1.y - p0.y;
-                        if (isNonZero(t)) {
-                            t = (iPnt.y - p0.y)/t;
-                            isIntersect = ((t > -EPS) && (t < 1+EPS));
-                            break;
-                        } else {
-                            t = p1.x - p0.x;
-                            if (isNonZero(t)) {
-                                t = (iPnt.x - p0.x)/t;
-                                isIntersect = ((t > -EPS) && (t < 1+EPS));
-                                break;
-                            } else {
-                                //degenerate line=>point
-                            }
-                        }
-                    }
-                }
-            } else {
-                for (i=0; i<coordinates.length; i++) {
-                    p0 = coordinates[i];
-                    p1 = (i != coordinates.length-1 ? coordinates[i+1]: coordinates[0]);
-                    sign = (iPnt.x - p0.x)*(p1.z - p0.z) -
-                           (iPnt.z - p0.z)*(p1.x - p0.x);
-                    if (isNonZero(sign)) {
-                        if (sign*lastSign < 0) {
-                            isIntersect = false;
-                            break;
-                        }
-                        lastSign = sign;
-                    } else { // point on line, check inside interval
-                        t = p1.x - p0.x;
-                        if (isNonZero(t)) {
-                            t = (iPnt.x - p0.x)/t;
-                            isIntersect = ((t > -EPS) && (t < 1+EPS));
-                            break;
-                        } else {
-                            t = p1.z - p0.z;
-                            if (isNonZero(t)) {
-                                t = (iPnt.z - p0.z)/t;
-                                isIntersect = ((t > -EPS) && (t < 1+EPS));
-                                break;
-                            } else {
-                                //degenerate line=>point
-                            }
-                        }
-                    }
-                }
-            }
-        }
-
-        if (isIntersect) {
-            dist[0] *= direction.length();
-        }
-        return isIntersect;
-    }
-
     private static boolean isNonZero(double v) {
         return ((v > EPS) || (v < -EPS));
 
--- a/javafx-iio/build-common.xml	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-iio/build-common.xml	Tue May 28 09:38:44 2013 -0700
@@ -26,10 +26,13 @@
   <target name="get-libname-android" if="isAndroid">
     <property name="native.lib.file" value="libjavafx-iio.so"/>
   </target>
+  <target name="get-libname-ios" if="isIOS">
+    <property name="native.lib.file" value="libjavafx-iio.a"/>
+  </target>
 
-  <target name="get-libname" depends="get-libname-macosx,get-libname-linux,get-libname-solaris,get-libname-windows, get-libname-android"/>
+  <target name="get-libname" depends="get-libname-macosx,get-libname-linux,get-libname-solaris,get-libname-windows, get-libname-android,get-libname-ios"/>
 
-  <target name="-pre-init" depends="get-libname"/>
+  <target name="-local-pre-init" depends="get-libname"/>
 
   <target name="check-native">
     <uptodate property="native.uptodate" targetfile="${native.dist.dir}/${native.lib.file}" >
@@ -50,7 +53,7 @@
          includes="${native.lib.file}"/>
   </target>
 
-  <target name="jar" depends="init">
+  <target name="jar" depends="-local-pre-init,init">
     <build-project/>
     <antcall target="compile-native"/>
     <available property="native.lib.file.exists" file="${native.dist.dir}/${native.lib.file}"/>
--- a/javafx-iio/build-ios.xml	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-iio/build-ios.xml	Tue May 28 09:38:44 2013 -0700
@@ -4,7 +4,7 @@
   <target name="compile-native">
     <exec executable="make" dir="../javafx-iio-native" failonerror="true">
       <arg value="DIST_DIR=${native.dist.dir}"/>
-      <arg value="BUILD_DIR=${native.build.dir}"/>
+      <arg value="BUILD_DIR=${native.build.dir}/armv7"/>
       <arg value="JFXIIO_CP=${jfxiio.classes.dir}"/>
       <arg value="JDK_HOME=${platform.home}"/>
       <arg value="IS_IOS=true"/>
@@ -17,7 +17,7 @@
 
     <exec executable="make" dir="../javafx-iio-native" failonerror="true">
       <arg value="DIST_DIR=${native.dist.dir}"/>
-      <arg value="BUILD_DIR=${native.build.dir}"/>
+      <arg value="BUILD_DIR=${native.build.dir}/i386"/>
       <arg value="JFXIIO_CP=${jfxiio.classes.dir}"/>
       <arg value="JDK_HOME=${platform.home}"/>
       <arg value="IS_IOS=true"/>
--- a/javafx-sg-common/src/com/sun/javafx/sg/BaseCacheFilter.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-sg-common/src/com/sun/javafx/sg/BaseCacheFilter.java	Tue May 28 09:38:44 2013 -0700
@@ -210,15 +210,21 @@
         lastYDelta = lastYDelta * xformInfo[1];
 
         if (cachedImageData != null) {
-            cachedImageData.getUntransformedImage().lock();
-            if (!cachedImageData.validate(fctx)) {
-                cachedImageData.getUntransformedImage().unlock();
-                invalidate();
+            Filterable implImage = cachedImageData.getUntransformedImage();
+            if (implImage != null) {
+                implImage.lock();
+                if (!cachedImageData.validate(fctx)) {
+                    implImage.unlock();
+                    invalidate();
+                }
             }
         }
         if (needToRenderCache(fctx, xform, xformInfo)) {
             if (cachedImageData != null) {
-                cachedImageData.getUntransformedImage().unlock();
+                Filterable implImage = cachedImageData.getUntransformedImage();
+                if (implImage != null) {
+                    implImage.unlock();
+                }
                 invalidate();
             }
             // Update the cachedXform to the current xform (ignoring translate).
@@ -426,7 +432,10 @@
             // While we hold on to this ImageData we leave the texture
             // unlocked so it can be reclaimed, but the default unref()
             // method assumes it was locked.
-            cachedImageData.getUntransformedImage().lock();
+            Filterable implImage = cachedImageData.getUntransformedImage();
+            if (implImage != null) {
+                implImage.lock();
+            }
             cachedImageData.unref();
             cachedImageData = null;
         }
--- a/javafx-sg-common/src/com/sun/javafx/sg/BaseNode.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-sg-common/src/com/sun/javafx/sg/BaseNode.java	Tue May 28 09:38:44 2013 -0700
@@ -1029,6 +1029,7 @@
         //and possibly save a few intersects() calls        
         
         DirtyRegionContainer originalDirtyRegion = null;
+        BaseTransform originalRenderTx = null;
         if (effectFilter != null) {
             try {
                 myClip = new RectBounds();
@@ -1040,7 +1041,8 @@
             } catch (NoninvertibleTransformException ex) {
                 return DirtyRegionContainer.DTR_OK;
             }
-
+            
+            originalRenderTx = renderTx;
             renderTx = BaseTransform.IDENTITY_TRANSFORM;
             originalDirtyRegion = dirtyRegionContainer;
             dirtyRegionContainer = regionPool.checkOut();
@@ -1097,7 +1099,8 @@
             }
 
             //apply transform on effect dirty regions
-            applyTransform(tx, dirtyRegionContainer);
+            applyTransform(originalRenderTx, dirtyRegionContainer);
+            renderTx = originalRenderTx;
             
             originalDirtyRegion.merge(dirtyRegionContainer);
             regionPool.checkIn(dirtyRegionContainer);
--- a/javafx-sg-prism/src/com/sun/javafx/sg/prism/NGExternalNode.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-sg-prism/src/com/sun/javafx/sg/prism/NGExternalNode.java	Tue May 28 09:38:44 2013 -0700
@@ -43,64 +43,86 @@
     private Texture dsttexture;
 
     private BufferData bufferData;
-    private final AtomicReference<RenderData> renderData = new AtomicReference<RenderData>(null);
+    private final AtomicReference<RenderData> renderData = new AtomicReference<RenderData>(null);    
+    private RenderData rd; // last rendered data
 
     private volatile ReentrantLock bufferLock;
 
     @Override
     protected void renderContent(Graphics g) {
         
-        RenderData rd = renderData.getAndSet(null);
+        RenderData curRenderData = renderData.getAndSet(null);
         
+        if (curRenderData != null) {
+            rd = curRenderData;
+        }
         if (rd == null) return;
-            
+        
         int x = rd.bdata.srcbounds.x;
         int y = rd.bdata.srcbounds.y;
         int w = rd.bdata.srcbounds.width;
         int h = rd.bdata.srcbounds.height;
 
-        if ((dsttexture == null) ||
-            (dsttexture.getContentWidth() != rd.bdata.dstwidth) ||
-            (dsttexture.getContentHeight() != rd.bdata.dstheight))
-        {
-            ResourceFactory factory = g.getResourceFactory();
-            if (!factory.isDeviceReady()) {
-                System.err.println("NGExternalNode: graphics device is not ready");
-                return;
+        if (dsttexture != null) {
+            
+            dsttexture.lock();
+            
+            if (dsttexture.isSurfaceLost() ||
+               (dsttexture.getContentWidth() != rd.bdata.dstwidth) ||
+               (dsttexture.getContentHeight() != rd.bdata.dstheight))
+            {
+                dsttexture.unlock();
+                dsttexture.dispose();
+                dsttexture = createTexture(g, rd);
             }
-            if (dsttexture != null) {
-                dsttexture.dispose();
+        } else {
+            dsttexture = createTexture(g, rd);
+        }
+        if (dsttexture == null) {
+            return;
+        }        
+        try {
+            if (curRenderData != null) {
+                bufferLock.lock();
+                try {
+                    dsttexture.update(rd.bdata.srcbuffer,
+                                      PixelFormat.INT_ARGB_PRE,
+                                      x + rd.dirtyRect.x, y + rd.dirtyRect.y, // dst
+                                      x + rd.dirtyRect.x, y + rd.dirtyRect.y,  // src
+                                      rd.dirtyRect.width, rd.dirtyRect.height, // src
+                                      rd.bdata.linestride * 4,
+                                      false);
+                } finally {
+                    bufferLock.unlock();
+                }
+                if (rd.clearTarget) {
+                    g.clear();
+                }
             }
-            dsttexture =
-                factory.createTexture(PixelFormat.INT_ARGB_PRE,
-                                      Texture.Usage.DYNAMIC,
-                                      Texture.WrapMode.CLAMP_NOT_NEEDED,
-                                      rd.bdata.dstwidth, rd.bdata.dstheight);
-            
-            if (dsttexture == null) {
-                System.err.println("NGExternalNode: failed to create a texture");
-                return;
-            }
+            g.drawTexture(dsttexture,
+                          x, y, x + w, y + h, // dst
+                          x, y, x + w, y + h); // src
+        } finally {        
+            dsttexture.unlock();
         }
-        
-        bufferLock.lock();
-        try {
-            dsttexture.update(rd.bdata.srcbuffer,
-                              PixelFormat.INT_ARGB_PRE,
-                              x + rd.dirtyRect.x, y + rd.dirtyRect.y, // dst
-                              x + rd.dirtyRect.x, y + rd.dirtyRect.y, rd.dirtyRect.width, rd.dirtyRect.height, // src
-                              rd.bdata.linestride * 4,
-                              false);
-        } finally {
-            bufferLock.unlock();
+    }
+    
+    private Texture createTexture(Graphics g, RenderData rd) {
+        ResourceFactory factory = g.getResourceFactory();
+        if (!factory.isDeviceReady()) {
+            System.err.println("NGExternalNode: graphics device is not ready");
+            return null;
+        }                
+        Texture txt = factory.createTexture(PixelFormat.INT_ARGB_PRE,
+                                            Texture.Usage.DYNAMIC,
+                                            Texture.WrapMode.CLAMP_NOT_NEEDED,
+                                            rd.bdata.dstwidth, rd.bdata.dstheight);            
+        if (txt != null) {
+            txt.contentsUseful();
+        } else {
+            System.err.println("NGExternalNode: failed to create a texture");            
         }
-
-        if (rd.clearTarget) {
-            g.clear();
-        }
-        g.drawTexture(dsttexture,
-                      x, y, x + w, y + h, // dst
-                      x, y, x + w, y + h); // src
+        return txt;
     }
 
     @Override
--- a/javafx-sg-prism/test/com/sun/javafx/sg/prism/TestGraphics.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-sg-prism/test/com/sun/javafx/sg/prism/TestGraphics.java	Tue May 28 09:38:44 2013 -0700
@@ -44,7 +44,6 @@
 import com.sun.prism.PresentableState;
 import com.sun.prism.RTTexture;
 import com.sun.prism.RenderTarget;
-import com.sun.prism.RenderingContext;
 import com.sun.prism.ResourceFactory;
 import com.sun.prism.ResourceFactoryListener;
 import com.sun.prism.Texture;
@@ -228,7 +227,6 @@
         @Override public ShapeRep createArcRep(boolean needs3D) { return null; }
         @Override public void addFactoryListener(ResourceFactoryListener l) { }
         @Override public void removeFactoryListener(ResourceFactoryListener l) { }
-        @Override public RenderingContext createRenderingContext(PresentableState pstate) { return null; }
         @Override public void dispose() { }
 
         @Override public PhongMaterial createPhongMaterial() { return null; }
--- a/javafx-ui-common/src/com/sun/javafx/application/PlatformImpl.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/com/sun/javafx/application/PlatformImpl.java	Tue May 28 09:38:44 2013 -0700
@@ -66,6 +66,7 @@
     private final static Object runLaterLock = new Object();
     private static Boolean isGraphicsSupported;
     private static Boolean isControlsSupported;
+    private static Boolean isMediaSupported;
     private static Boolean isWebSupported;
     private static Boolean isSWTSupported;
     private static Boolean isSwingSupported;
@@ -406,6 +407,12 @@
                             "javafx.scene.control.Control");
                 }
                 return isControlsSupported;
+            case MEDIA:
+                if (isMediaSupported == null) {
+                    isMediaSupported = checkForClass(
+                            "javafx.scene.media.MediaView");
+                }
+                return isMediaSupported;
             case WEB:
                 if (isWebSupported == null) {
                     isWebSupported = checkForClass("javafx.scene.web.WebView");
--- a/javafx-ui-common/src/com/sun/javafx/perf/PerformanceTracker.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/com/sun/javafx/perf/PerformanceTracker.java	Tue May 28 09:38:44 2013 -0700
@@ -212,7 +212,10 @@
     }
 
     public void frameRendered() {
-        calcFPS();
+        calcFPS();        
+        if (onRenderedFrameTask != null) {
+            onRenderedFrameTask.run();
+        }            
     }
 
     private void calcPulses() {
@@ -258,5 +261,9 @@
     private Runnable onFirstPulse;
     public void setOnFirstPulse(Runnable value) { onFirstPulse = value; }
     public Runnable getOnFirstPulse() { return onFirstPulse; }
+    
+    private Runnable onRenderedFrameTask;
+    public void setOnRenderedFrameTask(Runnable value) { onRenderedFrameTask = value; }
+    public Runnable getOnRenderedFrameTask() { return onRenderedFrameTask; }        
 }
 
--- a/javafx-ui-common/src/com/sun/javafx/stage/FocusUngrabEvent.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/com/sun/javafx/stage/FocusUngrabEvent.java	Tue May 28 09:38:44 2013 -0700
@@ -35,6 +35,8 @@
     public static final EventType<FocusUngrabEvent> FOCUS_UNGRAB =
             new EventType<FocusUngrabEvent>(Event.ANY, "FOCUS_UNGRAB");
 
+    public static final EventType<FocusUngrabEvent> ANY = FOCUS_UNGRAB;
+
     public FocusUngrabEvent() {
         super(FOCUS_UNGRAB);
     }
--- a/javafx-ui-common/src/javafx/application/ConditionalFeature.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/application/ConditionalFeature.java	Tue May 28 09:38:44 2013 -0700
@@ -50,6 +50,12 @@
     CONTROLS,
 
     /**
+     * Indicates that the javafx.scene.media package is available on this
+     * platform.
+     */
+    MEDIA,
+
+    /**
      * Indicates that the javafx.scene.web packages is available on this
      * platform.
      */
--- a/javafx-ui-common/src/javafx/css/CssMetaData.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/css/CssMetaData.java	Tue May 28 09:38:44 2013 -0700
@@ -105,7 +105,6 @@
  * @param <S> The type of Styleable
  * @param <V> The type into which the parsed value is converted. 
  */
-@com.sun.javafx.beans.annotations.NoBuilder
 public abstract class CssMetaData<S extends Styleable, V> {
     
     /**
--- a/javafx-ui-common/src/javafx/css/FontCssMetaData.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/css/FontCssMetaData.java	Tue May 28 09:38:44 2013 -0700
@@ -41,7 +41,6 @@
  * includes the font sub-properties: weight, style, family and size.
  * @param N The type of Node
  */
-@com.sun.javafx.beans.annotations.NoBuilder
 public abstract class FontCssMetaData<S extends Styleable> extends CssMetaData<S, Font> {
 
     /**
--- a/javafx-ui-common/src/javafx/css/ParsedValue.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/css/ParsedValue.java	Tue May 28 09:38:44 2013 -0700
@@ -38,7 +38,6 @@
  * parsed CSS values. Elsewhere the value returned by 
  * {@link #getValue()} is likely to be obscure, abstruse and perplexing. 
  */
-@com.sun.javafx.beans.annotations.NoBuilder
 public class ParsedValue<V, T> {
 
     /**
--- a/javafx-ui-common/src/javafx/css/SimpleStyleableBooleanProperty.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/css/SimpleStyleableBooleanProperty.java	Tue May 28 09:38:44 2013 -0700
@@ -40,7 +40,6 @@
  * @see StyleableProperty
  * @see StyleableBooleanProperty
  */
-@com.sun.javafx.beans.annotations.NoBuilder
 public class SimpleStyleableBooleanProperty extends StyleableBooleanProperty {
 
     private static final Object DEFAULT_BEAN = null;
--- a/javafx-ui-common/src/javafx/css/SimpleStyleableDoubleProperty.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/css/SimpleStyleableDoubleProperty.java	Tue May 28 09:38:44 2013 -0700
@@ -40,7 +40,6 @@
  * @see StyleableProperty
  * @see StyleableDoubleProperty
  */
-@com.sun.javafx.beans.annotations.NoBuilder
 public class SimpleStyleableDoubleProperty extends StyleableDoubleProperty {
 
     private static final Object DEFAULT_BEAN = null;
--- a/javafx-ui-common/src/javafx/css/SimpleStyleableFloatProperty.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/css/SimpleStyleableFloatProperty.java	Tue May 28 09:38:44 2013 -0700
@@ -40,7 +40,6 @@
  * @see StyleableProperty
  * @see StyleableFloatProperty
  */
-@com.sun.javafx.beans.annotations.NoBuilder
 public class SimpleStyleableFloatProperty extends StyleableFloatProperty {
 
     private static final Object DEFAULT_BEAN = null;
--- a/javafx-ui-common/src/javafx/css/SimpleStyleableIntegerProperty.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/css/SimpleStyleableIntegerProperty.java	Tue May 28 09:38:44 2013 -0700
@@ -40,7 +40,6 @@
  * @see StyleableProperty
  * @see StyleableIntegerProperty
  */
-@com.sun.javafx.beans.annotations.NoBuilder
 public class SimpleStyleableIntegerProperty extends StyleableIntegerProperty {
 
     private static final Object DEFAULT_BEAN = null;
--- a/javafx-ui-common/src/javafx/css/SimpleStyleableLongProperty.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/css/SimpleStyleableLongProperty.java	Tue May 28 09:38:44 2013 -0700
@@ -40,7 +40,6 @@
  * @see StyleableProperty
  * @see StyleableLongProperty
  */
-@com.sun.javafx.beans.annotations.NoBuilder
 public class SimpleStyleableLongProperty extends StyleableLongProperty {
 
     private static final Object DEFAULT_BEAN = null;
--- a/javafx-ui-common/src/javafx/css/SimpleStyleableObjectProperty.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/css/SimpleStyleableObjectProperty.java	Tue May 28 09:38:44 2013 -0700
@@ -40,7 +40,6 @@
  * @see StyleableProperty
  * @see StyleableObjectProperty
  */
-@com.sun.javafx.beans.annotations.NoBuilder
 public class SimpleStyleableObjectProperty<T> extends StyleableObjectProperty<T> {
 
     private static final Object DEFAULT_BEAN = null;
--- a/javafx-ui-common/src/javafx/css/SimpleStyleableStringProperty.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/css/SimpleStyleableStringProperty.java	Tue May 28 09:38:44 2013 -0700
@@ -40,7 +40,6 @@
  * @see StyleableProperty
  * @see StyleableStringProperty
  */
-@com.sun.javafx.beans.annotations.NoBuilder
 public class SimpleStyleableStringProperty extends StyleableStringProperty {
 
     private static final Object DEFAULT_BEAN = null;
--- a/javafx-ui-common/src/javafx/css/StyleableBooleanProperty.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/css/StyleableBooleanProperty.java	Tue May 28 09:38:44 2013 -0700
@@ -41,7 +41,6 @@
  * @see CssMetaData
  * @see StyleableProperty
  */
-@com.sun.javafx.beans.annotations.NoBuilder
 public abstract class StyleableBooleanProperty 
     extends BooleanPropertyBase implements StyleableProperty<Boolean> {
 
--- a/javafx-ui-common/src/javafx/css/StyleableDoubleProperty.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/css/StyleableDoubleProperty.java	Tue May 28 09:38:44 2013 -0700
@@ -41,7 +41,6 @@
  * @see CssMetaData
  * @see StyleableProperty
  */
-@com.sun.javafx.beans.annotations.NoBuilder
 public abstract class StyleableDoubleProperty 
     extends DoublePropertyBase implements StyleableProperty<Number> {
 
--- a/javafx-ui-common/src/javafx/css/StyleableFloatProperty.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/css/StyleableFloatProperty.java	Tue May 28 09:38:44 2013 -0700
@@ -41,7 +41,6 @@
  * @see CssMetaData
  * @see StyleableProperty
  */
-@com.sun.javafx.beans.annotations.NoBuilder
 public abstract class StyleableFloatProperty 
     extends FloatPropertyBase implements StyleableProperty<Number> {
 
--- a/javafx-ui-common/src/javafx/css/StyleableIntegerProperty.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/css/StyleableIntegerProperty.java	Tue May 28 09:38:44 2013 -0700
@@ -41,7 +41,6 @@
  * @see CssMetaData
  * @see StyleableProperty
  */
-@com.sun.javafx.beans.annotations.NoBuilder
 public abstract class StyleableIntegerProperty 
     extends IntegerPropertyBase implements StyleableProperty<Number> {
 
--- a/javafx-ui-common/src/javafx/css/StyleableLongProperty.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/css/StyleableLongProperty.java	Tue May 28 09:38:44 2013 -0700
@@ -41,7 +41,6 @@
  * @see CssMetaData
  * @see StyleableProperty
  */
-@com.sun.javafx.beans.annotations.NoBuilder
 public abstract class StyleableLongProperty 
     extends LongPropertyBase implements StyleableProperty<Number> {
 
--- a/javafx-ui-common/src/javafx/css/StyleableObjectProperty.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/css/StyleableObjectProperty.java	Tue May 28 09:38:44 2013 -0700
@@ -41,7 +41,6 @@
  * @see CssMetaData
  * @see StyleableProperty
  */
-@com.sun.javafx.beans.annotations.NoBuilder
 public abstract class StyleableObjectProperty<T> 
     extends ObjectPropertyBase<T> implements StyleableProperty<T> {
 
--- a/javafx-ui-common/src/javafx/css/StyleableStringProperty.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/css/StyleableStringProperty.java	Tue May 28 09:38:44 2013 -0700
@@ -41,7 +41,6 @@
  * @see CssMetaData
  * @see StyleableProperty
  */
-@com.sun.javafx.beans.annotations.NoBuilder
 public abstract class StyleableStringProperty 
     extends StringPropertyBase implements StyleableProperty<String> {
 
--- a/javafx-ui-common/src/javafx/print/PageRange.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/print/PageRange.java	Tue May 28 09:38:44 2013 -0700
@@ -30,7 +30,6 @@
 import javafx.beans.property.IntegerProperty;
 import javafx.beans.property.ReadOnlyIntegerProperty;
 import javafx.beans.property.ReadOnlyIntegerWrapper;
-import com.sun.javafx.beans.annotations.NoBuilder;
 
 /**
  * A {@code PageRange} is used to select or constrain the job print
@@ -43,8 +42,6 @@
  * during printing.
  * @since JavaFX 8
  */
-
-@NoBuilder
 public final class PageRange {
 
     private ReadOnlyIntegerWrapper startPage, endPage;
--- a/javafx-ui-common/src/javafx/scene/Camera.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/scene/Camera.java	Tue May 28 09:38:44 2013 -0700
@@ -132,8 +132,9 @@
     }
 
     /**
-     * Specifies the near clipping plane of this {@code Camera} in the local
-     * coordinate system of this node.
+     * Specifies the near clipping plane of this {@code Camera} in the eye
+     * coordinate system of this node. Objects closer to the eye than the 
+     * {@code nearClip} plane are not drawn.
      *
      * @defaultValue 0.1
      * @since JavaFX 8
@@ -162,8 +163,9 @@
     }
 
     /**
-     * Specifies the far clipping plane of this {@code Camera} in the local
-     * coordinate system of this node.
+     * Specifies the far clipping plane of this {@code Camera} in the eye
+     * coordinate system of this node. Objects farther away from the eye than
+     * the {@code farClip} plane are not drawn.
      * <p>
      *
      * @defaultValue 100.0
--- a/javafx-ui-common/src/javafx/scene/Node.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/scene/Node.java	Tue May 28 09:38:44 2013 -0700
@@ -4592,7 +4592,7 @@
             return false;
         }
         double t = -origZ / dirZ;
-        if (t < 0.0 && !pickRay.isParallel()) {
+        if (t < pickRay.getNearClip() || t > pickRay.getFarClip()) {
             return false;
         }
         double x = pickRay.getOriginNoClone().x + (pickRay.getDirectionNoClone().x * t);
@@ -4658,6 +4658,26 @@
             tmin = ((signZ ? maxZ : minZ) - originZ) * invDirZ;
             tmax = ((signZ ? minZ : maxZ) - originZ) * invDirZ;
 
+        } else if (tempBounds.getDepth() == 0.0) {
+            // fast path for 3D picking of 2D bounds
+
+            if (almostZero(dir.z)) {
+                return Double.NaN;
+            }
+
+            final double t = (tempBounds.getMinZ() - originZ) / dir.z;
+            final double x = originX + (dir.x * t);
+            final double y = originY + (dir.y * t);
+
+            if (x < tempBounds.getMinX() ||
+                    x > tempBounds.getMaxX() ||
+                    y < tempBounds.getMinY() ||
+                    y > tempBounds.getMaxY()) {
+                return Double.NaN;
+            }
+
+            tmin = tmax = t;
+
         } else {
 
             final double invDirX = dir.x == 0.0 ? Double.POSITIVE_INFINITY : (1.0 / dir.x);
@@ -4761,17 +4781,17 @@
             return Double.NaN;
         }
 
-        if (pickRay.isParallel()) {
-            return tmin;
-        }
-
-        if (tmin < 0.0) {
-            if (tmax >= 0.0) {
+        final double minDistance = pickRay.getNearClip();
+        final double maxDistance = pickRay.getFarClip();
+        if (tmin < minDistance) {
+            if (tmax >= minDistance && tmax <= maxDistance) {
                 // we are inside bounds
                 return 0.0;
             } else {
                 return Double.NaN;
             }
+        } else if (tmin > maxDistance) {
+            return Double.NaN;
         }
 
         return tmin;
--- a/javafx-ui-common/src/javafx/scene/ParallelCamera.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/scene/ParallelCamera.java	Tue May 28 09:38:44 2013 -0700
@@ -72,7 +72,9 @@
 
     @Override
     final PickRay computePickRay(double x, double y, PickRay pickRay) {
-        return PickRay.computeParallelPickRay(x, y, getCameraTransform(), pickRay);
+        return PickRay.computeParallelPickRay(x, y, getCameraTransform(),
+                //TODO: use actual clips after rendering uses them
+                Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, pickRay);
     }
 
     @Override
--- a/javafx-ui-common/src/javafx/scene/PerspectiveCamera.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/scene/PerspectiveCamera.java	Tue May 28 09:38:44 2013 -0700
@@ -212,7 +212,11 @@
         return PickRay.computePerspectivePickRay(x, y, fixedEyeAtCameraZero,
                 getViewWidth(), getViewHeight(),
                 getFieldOfView(), isVerticalFieldOfView(),
-                getCameraTransform(), pickRay);
+                getCameraTransform(),
+                //TODO: use actual clips always after rendering uses them
+                fixedEyeAtCameraZero ? getNearClip() : 0.0,
+                fixedEyeAtCameraZero ? getFarClip() : Double.POSITIVE_INFINITY,
+                pickRay);
     }
 
     @Override Camera copy() {
--- a/javafx-ui-common/src/javafx/scene/Scene.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/scene/Scene.java	Tue May 28 09:38:44 2013 -0700
@@ -1834,7 +1834,8 @@
      */
     Node test_pick(double x, double y) {
         inMousePick = true;
-        PickResult result = mouseHandler.pickNode(new PickRay(x, y));
+        PickResult result = mouseHandler.pickNode(new PickRay(x, y,
+                Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY));
         inMousePick = false;
         if (result != null) {
             return result.getIntersectedNode();
--- a/javafx-ui-common/src/javafx/scene/input/ContextMenuEvent.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/scene/input/ContextMenuEvent.java	Tue May 28 09:38:44 2013 -0700
@@ -53,7 +53,12 @@
      * This event occurs when a context menu is requested.
      */
     public static final EventType<ContextMenuEvent> CONTEXT_MENU_REQUESTED =
-            new EventType<ContextMenuEvent>(ContextMenuEvent.ANY, "CONTEXTMENUREQUESTED");
+            new EventType<ContextMenuEvent>(InputEvent.ANY, "CONTEXTMENUREQUESTED");
+
+    /**
+     * Common supertype for all context menu event types.
+     */
+    public static final EventType<ContextMenuEvent> ANY = CONTEXT_MENU_REQUESTED;
 
     /**
      * Constructs new ContextMenu event.
--- a/javafx-ui-common/src/javafx/scene/input/InputMethodEvent.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/scene/input/InputMethodEvent.java	Tue May 28 09:38:44 2013 -0700
@@ -63,6 +63,11 @@
             new EventType<InputMethodEvent>(InputEvent.ANY, "INPUT_METHOD_TEXT_CHANGED");
 
     /**
+     * Common supertype for all input method event types.
+     */
+    public static final EventType<InputMethodEvent> ANY = INPUT_METHOD_TEXT_CHANGED;
+
+    /**
      * Constructs new InputMethodEvent event.
      * @param source the source of the event. Can be null.
      * @param target the target of the event. Can be null.
--- a/javafx-ui-common/src/javafx/scene/layout/AnchorPane.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/scene/layout/AnchorPane.java	Tue May 28 09:38:44 2013 -0700
@@ -252,8 +252,9 @@
         return computeHeight(false, width);
     }
 
-    private double computeWidth(boolean minimum, double height) {
+    private double computeWidth(final boolean minimum, final double height) {
         double max = 0;
+        double contentHeight = height != -1 ? height - getInsets().getTop() - getInsets().getBottom() : -1;
         final List<Node> children = getChildren();
         for (int i=0, size=children.size(); i<size; i++) {
             Node child = children.get(i);
@@ -264,11 +265,13 @@
                 double left = leftAnchor != null? leftAnchor :
                     (rightAnchor != null? 0 : child.getLayoutBounds().getMinX() + child.getLayoutX());
                 double right = rightAnchor != null? rightAnchor : 0;
-                if (child.getContentBias() == Orientation.VERTICAL) {
+                double childHeight = -1;
+                if (child.getContentBias() == Orientation.VERTICAL && contentHeight != -1) {
                     // The width depends on the node's height!
-                    height = (minimum? child.minHeight(-1) : child.prefHeight(-1));
+                    childHeight = computeChildHeight(child, getTopAnchor(child), getBottomAnchor(child), contentHeight, -1);
                 }
-                max = Math.max(max, left + (minimum? child.minWidth(height) : child.prefWidth(height)) + right);
+                max = Math.max(max, left + (minimum && leftAnchor != null && rightAnchor != null?
+                        child.minWidth(childHeight) : child.prefWidth(childHeight)) + right);
             }
         }
 
@@ -276,8 +279,9 @@
         return insets.getLeft() + max + insets.getRight();
     }
 
-    private double computeHeight(boolean minimum, double width) {
+    private double computeHeight(final boolean minimum, final double width) {
         double max = 0;
+        double contentWidth = width != -1 ? width - getInsets().getLeft()- getInsets().getRight() : -1;
         final List<Node> children = getChildren();
         for (int i=0, size=children.size(); i<size; i++) {
             Node child = children.get(i);
@@ -288,10 +292,12 @@
                 double top = topAnchor != null? topAnchor :
                     (bottomAnchor != null? 0 : child.getLayoutBounds().getMinY() + child.getLayoutY());
                 double bottom = bottomAnchor != null? bottomAnchor : 0;
-                if (child.getContentBias() == Orientation.HORIZONTAL) {
-                    width = (minimum? child.minWidth(-1) : child.prefWidth(-1));
+                double childWidth = -1;
+                if (child.getContentBias() == Orientation.HORIZONTAL && contentWidth != -1) {
+                    childWidth = computeChildWidth(child, getLeftAnchor(child), getRightAnchor(child), contentWidth, -1);
                 }
-                max = Math.max(max, top + (minimum? child.minHeight(width) : child.prefHeight(width)) + bottom);
+                max = Math.max(max, top + (minimum && topAnchor != null && bottomAnchor != null?
+                        child.minHeight(childWidth) : child.prefHeight(childWidth)) + bottom);
             }
         }
 
@@ -299,18 +305,18 @@
         return insets.getTop() + max + insets.getBottom();
     }
 
-    private double computeChildWidth(Node child, Double leftAnchor, Double rightAnchor, double height) {
+    private double computeChildWidth(Node child, Double leftAnchor, Double rightAnchor, double areaWidth, double height) {
         if (leftAnchor != null && rightAnchor != null && child.isResizable()) {
             final Insets insets = getInsets();
-            return getWidth() - insets.getLeft() - insets.getRight() - leftAnchor - rightAnchor;
+            return areaWidth - insets.getLeft() - insets.getRight() - leftAnchor - rightAnchor;
         }
         return computeChildPrefAreaWidth(child, Insets.EMPTY, height);
     }
 
-    private double computeChildHeight(Node child, Double topAnchor, Double bottomAnchor, double width) {
+    private double computeChildHeight(Node child, Double topAnchor, Double bottomAnchor, double areaHeight, double width) {
         if (topAnchor != null && bottomAnchor != null && child.isResizable()) {
             final Insets insets = getInsets();
-            return getHeight() - insets.getTop() - insets.getBottom() - topAnchor - bottomAnchor;
+            return areaHeight - insets.getTop() - insets.getBottom() - topAnchor - bottomAnchor;
         }
         return computeChildPrefAreaHeight(child, Insets.EMPTY, width);
     }
@@ -330,22 +336,22 @@
 
                 double x = child.getLayoutX() + childLayoutBounds.getMinX();
                 double y = child.getLayoutY() + childLayoutBounds.getMinY();
-                double w = -1;
-                double h = -1;
+                double w;
+                double h;
 
                 if (bias == Orientation.VERTICAL) {
                     // width depends on height
                     // WARNING: The order of these calls is crucial, there is some
                     // hidden ordering dependency here!
-                    h = computeChildHeight(child, topAnchor, bottomAnchor, -1);
-                    w = computeChildWidth(child, leftAnchor, rightAnchor, h);
+                    h = computeChildHeight(child, topAnchor, bottomAnchor, getHeight(), -1);
+                    w = computeChildWidth(child, leftAnchor, rightAnchor, getWidth(), h);
                 } else if (bias == Orientation.HORIZONTAL) {
-                    w = computeChildWidth(child, leftAnchor, rightAnchor, -1);
-                    h = computeChildHeight(child, topAnchor, bottomAnchor, w);
+                    w = computeChildWidth(child, leftAnchor, rightAnchor, getWidth(), -1);
+                    h = computeChildHeight(child, topAnchor, bottomAnchor, getHeight(), w);
                 } else {
                     // bias may be null
-                    w = computeChildWidth(child, leftAnchor, rightAnchor, -1);
-                    h = computeChildHeight(child, topAnchor, bottomAnchor, -1);
+                    w = computeChildWidth(child, leftAnchor, rightAnchor, getWidth(), -1);
+                    h = computeChildHeight(child, topAnchor, bottomAnchor, getHeight(), -1);
                 }
 
                 if (leftAnchor != null) {
--- a/javafx-ui-common/src/javafx/scene/layout/BorderPane.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/scene/layout/BorderPane.java	Tue May 28 09:38:44 2013 -0700
@@ -473,8 +473,27 @@
 
     @Override protected void layoutChildren() {
         final Insets insets = getInsets();
-        final double width = getWidth();
-        final double height = getHeight();
+        double width = getWidth();
+        double height = getHeight();
+        final Orientation bias = getContentBias();
+
+        if (bias == null) {
+            final double minWidth = minWidth(-1);
+            final double minHeight = minHeight(-1);
+            width = width < minWidth ? minWidth : width;
+            height = height < minHeight ? minHeight : height;
+        } else if (bias == Orientation.HORIZONTAL) {
+            final double minWidth = minWidth(-1);
+            width = width < minWidth ? minWidth : width;
+            final double minHeight = minHeight(width);
+            height = height < minHeight ? minHeight : height;
+        } else {
+            final double minHeight = minHeight(-1);
+            height = height < minHeight ? minHeight : height;
+            final double minWidth = minWidth(height);
+            width = width < minWidth ? minWidth : width;
+        }
+
         final double insideX = insets.getLeft();
         final double insideY = insets.getTop();
         final double insideWidth = width - insideX - insets.getRight();
--- a/javafx-ui-common/src/javafx/scene/layout/GridPane.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/scene/layout/GridPane.java	Tue May 28 09:38:44 2013 -0700
@@ -1630,6 +1630,7 @@
             return;
         }
         metricsDirty = true;
+        bias = null;
         rowGrow = null;
         rowMinHeight = rowPrefHeight = rowMaxHeight = null;
         columnGrow = null;
--- a/javafx-ui-common/src/javafx/scene/layout/HBox.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/scene/layout/HBox.java	Tue May 28 09:38:44 2013 -0700
@@ -45,6 +45,7 @@
 import com.sun.javafx.css.converters.EnumConverter;
 import com.sun.javafx.css.converters.SizeConverter;
 import javafx.css.Styleable;
+import javafx.geometry.HPos;
 
 
 
@@ -145,6 +146,10 @@
  */
 public class HBox extends Pane {
 
+    private boolean biasDirty = true;
+    private boolean performingLayout = false;
+    private Orientation bias;
+
     /********************************************************************
      *  BEGIN static methods
      ********************************************************************/
@@ -366,14 +371,18 @@
      * @return null unless one of its children has a content bias.
      */
     @Override public Orientation getContentBias() {
-        final List<Node> children = getChildren();
-        for (int i=0, size=children.size(); i<size; i++) {
-            Node child = children.get(i);
-            if (child.isManaged() && child.getContentBias() != null) {
-                return child.getContentBias();
+        if (biasDirty) {
+            final List<Node> children = getChildren();
+            for (Node child : children) {
+                Orientation contentBias = child.getContentBias();
+                if (child.isManaged() && contentBias != null) {
+                    bias = contentBias;
+                    break;
+                }
             }
-        }
-        return null;
+            biasDirty = false;
+        }        
+        return bias;
     }
 
     @Override protected double computeMinWidth(double height) {
@@ -530,10 +539,22 @@
 
     private double[] actualAreaWidths;
 
+    @Override public void requestLayout() {
+        if (performingLayout) {
+            return;
+        }
+        biasDirty = true;
+        bias = null;
+        super.requestLayout();
+    }
+
     @Override protected void layoutChildren() {
+        performingLayout = true;
         List<Node> managed = getManagedChildren();
         Insets insets = getInsets();
         Pos align = getAlignmentInternal();
+        HPos alignHpos = align.getHpos();
+        VPos alignVpos = align.getVpos();
         double width = getWidth();
         double height = getHeight();
         double top = snapSpace(insets.getTop());
@@ -541,6 +562,7 @@
         double bottom = snapSpace(insets.getBottom());
         double right = snapSpace(insets.getRight());
         double space = snapSpace(getSpacing());
+        boolean shouldFillHeight = shouldFillHeight();
 
         actualAreaWidths = getAreaWidths(managed, height, false);
         double contentWidth = adjustAreaWidths(managed, actualAreaWidths, width, height);
@@ -548,17 +570,18 @@
 
         double x = snapSpace(insets.getLeft()) + computeXOffset(width - left - right, contentWidth, align.getHpos());
         double y = snapSpace(insets.getTop());
-        double baselineOffset = align.getVpos() == VPos.BASELINE ? getMaxBaselineOffset(managed)
+        double baselineOffset = alignVpos == VPos.BASELINE ? getMaxBaselineOffset(managed)
                                     : height/2;
 
         for (int i = 0, size = managed.size(); i < size; i++) {
             Node child = managed.get(i);
             Insets margin = getMargin(child);
             layoutInArea(child, x, y, actualAreaWidths[i], contentHeight,
-                    baselineOffset, margin, true, shouldFillHeight(),
-                    align.getHpos(), align.getVpos());
+                    baselineOffset, margin, true, shouldFillHeight,
+                    alignHpos, alignVpos);
             x += actualAreaWidths[i] + space;
         }
+        performingLayout = false;
     }
 
 
--- a/javafx-ui-common/src/javafx/scene/layout/StackPane.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/scene/layout/StackPane.java	Tue May 28 09:38:44 2013 -0700
@@ -39,6 +39,7 @@
 import javafx.scene.Node;
 import com.sun.javafx.css.converters.EnumConverter;
 import javafx.css.Styleable;
+import javafx.geometry.HPos;
 
 /**
  *
@@ -126,6 +127,10 @@
  */
 
 public class StackPane extends Pane {
+    
+    private boolean biasDirty = true;
+    private boolean performingLayout = false;
+    private Orientation bias;
 
     /********************************************************************
      *  BEGIN static methods
@@ -248,14 +253,18 @@
      * have a content bias.
      */
     @Override public Orientation getContentBias() {
-        final List<Node> children = getChildren();
-        for (int i = 0, size = children.size(); i < size; i++) {
-            Node child = children.get(i);
-            if (child.isManaged() && child.getContentBias() != null) {
-                return child.getContentBias();
+        if (biasDirty) {
+            final List<Node> children = getChildren();
+            for (Node child : children) {
+                Orientation contentBias = child.getContentBias();
+                if (child.isManaged() && contentBias != null) {
+                    bias = contentBias;
+                    break;
+                }
             }
-        }
-        return null;
+            biasDirty = false;
+        }        
+        return bias;
     }
 
     @Override protected double computeMinWidth(double height) {
@@ -326,26 +335,41 @@
         return margins;
     }
 
+    @Override public void requestLayout() {
+        if (performingLayout) {
+            return;
+        }
+        biasDirty = true;
+        bias = null;
+        super.requestLayout();
+    }
+
     @Override protected void layoutChildren() {
+        performingLayout = true;
         List<Node> managed = getManagedChildren();
         Pos align = getAlignmentInternal();
+        HPos alignHpos = align.getHpos();
+        VPos alignVpos = align.getVpos();
         double width = getWidth();
         double height = getHeight();
         double top = getInsets().getTop();
         double right = getInsets().getRight();
         double left = getInsets().getLeft();
         double bottom = getInsets().getBottom();
-        double baselineOffset = align.getVpos() == VPos.BASELINE ? getMaxBaselineOffset(managed)
+        double baselineOffset = alignVpos == VPos.BASELINE ? getMaxBaselineOffset(managed)
                                     : height/2;
+        double contentWidth = width - left - right;
+        double contentHeight = height - top - bottom;
         for (int i = 0, size = managed.size(); i < size; i++) {
             Node child = managed.get(i);
             Pos childAlignment = StackPane.getAlignment(child);
             layoutInArea(child, left, top,
-                           width - left - right, height - top - bottom,
+                           contentWidth, contentHeight,
                            baselineOffset, getMargin(child),
-                           childAlignment != null? childAlignment.getHpos() : align.getHpos(),
-                           childAlignment != null? childAlignment.getVpos() : align.getVpos());
+                           childAlignment != null? childAlignment.getHpos() : alignHpos,
+                           childAlignment != null? childAlignment.getVpos() : alignVpos);
         }
+        performingLayout = false;
     }
 
     /***************************************************************************
--- a/javafx-ui-common/src/javafx/scene/layout/VBox.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/scene/layout/VBox.java	Tue May 28 09:38:44 2013 -0700
@@ -135,6 +135,10 @@
  */
 public class VBox extends Pane {
 
+    private boolean biasDirty = true;
+    private boolean performingLayout = false;
+    private Orientation bias;
+
 /********************************************************************
      *  BEGIN static methods
      ********************************************************************/
@@ -348,14 +352,18 @@
      * @return null unless one of its children has a content bias.
      */
     @Override public Orientation getContentBias() {
-        final List<Node> children = getChildren();
-        for (int i=0, size=children.size(); i<size; i++) {
-            Node child = children.get(i);
-            if (child.isManaged() && child.getContentBias() != null) {
-                return child.getContentBias();
+        if (biasDirty) {
+            final List<Node> children = getChildren();
+            for (Node child : children) {
+                Orientation contentBias = child.getContentBias();
+                if (child.isManaged() && contentBias != null) {
+                    bias = contentBias;
+                    break;
+                }
             }
-        }
-        return null;
+            biasDirty = false;
+        }        
+        return bias;
     }
 
     @Override protected double computeMinWidth(double height) {
@@ -501,7 +509,17 @@
 
     private double[] actualAreaHeights;
 
+    @Override public void requestLayout() {
+        if (performingLayout) {
+            return;
+        }
+        biasDirty = true;
+        bias = null;
+        super.requestLayout();
+    }
+
     @Override protected void layoutChildren() {
+        performingLayout = true;
         List<Node> managed = getManagedChildren();
         Insets insets = getInsets();
         double width = getWidth();
@@ -513,6 +531,7 @@
         double space = snapSpace(getSpacing());
         HPos hpos = getAlignmentInternal().getHpos();
         VPos vpos = getAlignmentInternal().getVpos();
+        boolean isFillWidth = isFillWidth();
 
         actualAreaHeights = getAreaHeights(managed, width, false);
         double contentWidth = width - left - right;
@@ -525,10 +544,11 @@
             Node child = managed.get(i);
             layoutInArea(child, x, y, contentWidth, actualAreaHeights[i],
                        /* baseline shouldn't matter */actualAreaHeights[i],
-                       getMargin(child), isFillWidth(), true,
+                       getMargin(child), isFillWidth, true,
                        hpos, vpos);
             y += actualAreaHeights[i] + space;
         }
+        performingLayout = false;
     }
 
     /***************************************************************************
--- a/javafx-ui-common/src/javafx/scene/shape/Box.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/scene/shape/Box.java	Tue May 28 09:38:44 2013 -0700
@@ -322,11 +322,14 @@
         char side = side0;
         double t = t0;
         final CullFace cullFace = getCullFace();
-        final double minDistance = pickRay.isParallel()
-                ? Double.NEGATIVE_INFINITY : 0.0;
+        final double minDistance = pickRay.getNearClip();
+        final double maxDistance = pickRay.getFarClip();
 
+        if (t0 > maxDistance) {
+            return false;
+        }
         if (t0 < minDistance || cullFace == CullFace.FRONT) {
-            if (t1 >= minDistance && cullFace != CullFace.BACK) {
+            if (t1 >= minDistance && t1 <= maxDistance && cullFace != CullFace.BACK) {
                 side = side1;
                 t = t1;
             } else {
--- a/javafx-ui-common/src/javafx/scene/shape/Cylinder.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/scene/shape/Cylinder.java	Tue May 28 09:38:44 2013 -0700
@@ -262,8 +262,8 @@
         final double discriminant = b * b - 4 * a * c;
 
         double t0, t1, t = Double.POSITIVE_INFINITY;
-        final double minDistance = pickRay.isParallel()
-                ? Double.NEGATIVE_INFINITY : 0.0;
+        final double minDistance = pickRay.getNearClip();
+        final double maxDistance = pickRay.getFarClip();
 
         if (discriminant >= 0 && (dirX != 0.0 || dirZ != 0.0)) {
             // the line hits the infinite cylinder
@@ -280,11 +280,11 @@
                 t1 = temp;
             }
 
-            // let's see if the hit is in front of us and within the cylinder's height
+            // let's see if the hit is between clipping planes and within the cylinder's height
             final double y0 = originY + t0 * dirY;
             if (t0 < minDistance || y0 < -halfHeight || y0 > halfHeight || cullFace == CullFace.FRONT) {
                 final double y1 = originY + t1 * dirY;
-                if (t1 >= minDistance && y1 >= -halfHeight && y1 <= halfHeight) {
+                if (t1 >= minDistance && t1 <= maxDistance && y1 >= -halfHeight && y1 <= halfHeight) {
                     if (cullFace != CullFace.BACK || exactPicking) {
                         // t0 is outside or behind but t1 hits.
 
@@ -294,10 +294,10 @@
                         t = t1;
                     }
                 } // else no hit (but we need to check the caps)
-            } else {
-                // t0 hits the height in front of us
+            } else if (t0 <= maxDistance) {
+                // t0 hits the height between clipping planes
                 t = t0;
-            }
+            } // else no hit (but we need to check the caps)
         }
 
         // Now check the caps
@@ -320,7 +320,7 @@
                 t1 = tBottom;
             }
 
-            if (t0 > minDistance && t0 < t && cullFace != CullFace.FRONT) {
+            if (t0 >= minDistance && t0 <= maxDistance && t0 < t && cullFace != CullFace.FRONT) {
                 final double tX = originX + dirX * t0;
                 final double tZ = originZ + dirZ * t0;
                 if (tX * tX + tZ * tZ <= r * r) {
@@ -329,7 +329,7 @@
                 }
             }
 
-            if (t1 > minDistance && t1 < t && (cullFace != CullFace.BACK || exactPicking)) {
+            if (t1 >= minDistance && t1 <= maxDistance && t1 < t && (cullFace != CullFace.BACK || exactPicking)) {
                 final double tX = originX + dirX * t1;
                 final double tZ = originZ + dirZ * t1;
                 if (tX * tX + tZ * tZ <= r * r) {
--- a/javafx-ui-common/src/javafx/scene/shape/Sphere.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/scene/shape/Sphere.java	Tue May 28 09:38:44 2013 -0700
@@ -234,17 +234,18 @@
             t1 = temp;
         }
 
-        if (t1 < 0.0 && !pickRay.isParallel()) {
-            // the sphere is behind us
+        final double minDistance = pickRay.getNearClip();
+        final double maxDistance = pickRay.getFarClip();
+
+        if (t1 < minDistance || t0 > maxDistance) {
+            // the sphere is out of clipping planes
             return false;
         }
 
         double t = t0;
         final CullFace cullFace = getCullFace();
-        final double minDistance = pickRay.isParallel()
-                ? Double.NEGATIVE_INFINITY : 0.0;
         if (t0 < minDistance || cullFace == CullFace.FRONT) {
-            if (getCullFace() != CullFace.BACK) {
+            if (t1 <= maxDistance && getCullFace() != CullFace.BACK) {
                 // picking the back wall
                 t = t1;
             } else {
--- a/javafx-ui-common/src/javafx/scene/shape/TriangleMesh.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/scene/shape/TriangleMesh.java	Tue May 28 09:38:44 2013 -0700
@@ -76,6 +76,20 @@
  * where p0, p1, p2 and p3 are indices into the points array, and t0, t1, t2
  * and t3 are indices into the texCoords array.
  * 
+ * <p> The maximum number of vertices in the mesh can not exceed 65536.
+ * Therefore the maximum array lengths are 65536 * 3 (x, y, z per point) for points,
+ * and 65536 * 2 (u, v per texture coordinate) for texCoords. 
+ * The length of {@code points}, {@code texCoords}, and {@code faces} must be
+ * divisible by 3, 2, and 6 respectively.
+ * The values in the faces array must be within the range of the number of vertices
+ * in the points array (0 to points.length / 3 - 1) for the point indices and 
+ * within the range of the number of the vertices in 
+ * the texCoords array (0 to texCoords.length / 2 - 1) for the texture coordinate indices.
+ * 
+ * <p> A warning will be recorded to the logger and the mesh will not be rendered
+ * (and will have an empty bounds) if any of the array lengths are invalid
+ * or if any of the values in the faces array are out of range.
+ * 
  * @since JavaFX 8
  */
 public class TriangleMesh extends Mesh {
@@ -84,6 +98,12 @@
     public static final int NUM_COMPONENTS_PER_TEXCOORD = 2;
     public static final int NUM_COMPONENTS_PER_FACE = 6;
 
+    // TODO: 3D - Need to validate the size and range of these arrays.
+    // A warning will be recorded to the logger and the mesh will have an empty
+    // bounds if the validation failed. (RT-30451)
+    // The maximum length for points (65536 * 3), texCoords (65536 * 2)
+    // or faces (65536 * 6) arrays. The values in faces must be within range.
+    // The length of points, texCoords and faces must be divisible by 3, 2 and 6 respectively.
     private final ObservableFloatArray points = FXCollections.observableFloatArray();
     private final ObservableFloatArray texCoords = FXCollections.observableFloatArray();
     private final ObservableIntegerArray faces = FXCollections.observableIntegerArray();
@@ -133,7 +153,7 @@
      * 6 integers p0, t0, p1, t1, p3, t3, where p0, p1 and p2 are indices of 
      * points in points {@code ObservableFloatArray} and t0, t1 and t2 are 
      * indices of texture coordinates in texCoords {@code ObservableFloatArray}.
-     * Both indices are in terms of elements (points or textCoords), not individual
+     * Both indices are in terms of vertices (points or texCoords), not individual
      * floats.
      */    
     public ObservableIntegerArray getFaces() {
@@ -148,7 +168,7 @@
      * between adjacent faces.
      *
      * <p> The face smoothing group is represented by an array of bits and up to
-     * 32 unique groups is possible; (1 <<  0) to (1 << 31). The face smoothing
+     * 32 unique groups is possible; (1 << 0) to (1 << 31). The face smoothing
      * group value can range from 0 (no smoothing group) to all 32 groups. A face
      * can belong to zero or more smoothing groups. A face is a member of group
      * N if bit N is set, for example, groups |= (1 << N). A value of 0 implies
@@ -186,17 +206,10 @@
 
     synchronized void decRef() {
         this.refCount -= 1;
-        if (this.refCount == 0) {
-            release();
-        }
-    }
-
-    void release(){
-        // TODO: 3D - release native resoure
     }
 
     private PGTriangleMesh peer;
-    
+
     /**
      * @treatAsPrivate implementation detail
      * @deprecated This is an internal API that is not intended for use and will be removed in the next version
@@ -343,9 +356,7 @@
 
         final double t = f * e2.dotProduct(q);
 
-        final double minDistance = pickRay.isParallel()
-                ? Double.NEGATIVE_INFINITY : 0.0;
-        if (t >= minDistance) {
+        if (t >= pickRay.getNearClip() && t <= pickRay.getFarClip()) {
             if (cullFace != CullFace.NONE) {
                 final Point3D normal = e1.crossProduct(e2);
                 final double nangle = normal.angle(
--- a/javafx-ui-common/src/javafx/stage/PopupWindow.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/stage/PopupWindow.java	Tue May 28 09:38:44 2013 -0700
@@ -601,6 +601,11 @@
 
     }
 
+    @Override
+    Window getWindowOwner() {
+        return getOwnerWindow();
+    }
+
     private void startMonitorOwnerEvents(final Window ownerWindowValue) {
         final EventRedirector parentEventRedirector =
                 ownerWindowValue.getInternalEventDispatcher()
@@ -674,25 +679,13 @@
         }
     }
 
-    private static Window getOwnerWindow(final Window window) {
-       if (window instanceof PopupWindow) {
-           return ((PopupWindow) window).getOwnerWindow();
-       }
-
-       if (window instanceof Stage) {
-           return ((Stage) window).getOwner();
-       }
-
-       return null;
-    }
-
     private static boolean wouldCreateCycle(Window parent, final Window child) {
        while (parent != null) {
            if (parent == child) {
                return true;
            }
 
-           parent = getOwnerWindow(parent);
+           parent = parent.getWindowOwner();
        }
 
        return false;
--- a/javafx-ui-common/src/javafx/stage/Stage.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/stage/Stage.java	Tue May 28 09:38:44 2013 -0700
@@ -1113,4 +1113,9 @@
     public void close() {
         hide();
     }
+
+    @Override
+    Window getWindowOwner() {
+        return getOwner();
+    }
 }
--- a/javafx-ui-common/src/javafx/stage/Window.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/src/javafx/stage/Window.java	Tue May 28 09:38:44 2013 -0700
@@ -50,8 +50,8 @@
 import javafx.geometry.Rectangle2D;
 import javafx.scene.Scene;
 
+import com.sun.javafx.Utils;
 import com.sun.javafx.WeakReferenceQueue;
-import com.sun.javafx.beans.annotations.NoInit;
 import com.sun.javafx.css.StyleManager;
 import com.sun.javafx.stage.WindowEventDispatcher;
 import com.sun.javafx.stage.WindowHelper;
@@ -109,7 +109,6 @@
      * @deprecated This is an internal API that is not intended for use and will be removed in the next version
      */
     @Deprecated
-    @NoInit
     public static Iterator<Window> impl_getWindows() {
         final SecurityManager securityManager = System.getSecurityManager();
         if (securityManager != null) {
@@ -217,7 +216,7 @@
 
     private static final float CENTER_ON_SCREEN_X_FRACTION = 1.0f / 2;
     private static final float CENTER_ON_SCREEN_Y_FRACTION = 1.0f / 3;
-    
+
     /**
      * Sets x and y properties on this Window so that it is centered on the screen.
      */
@@ -225,8 +224,8 @@
         xExplicit = false;
         yExplicit = false;
         if (impl_peer != null) {
-            Rectangle2D bounds = Screen.getPrimary().getVisualBounds();
-            double centerX = 
+            Rectangle2D bounds = getWindowScreen().getVisualBounds();
+            double centerX =
                     bounds.getMinX() + (bounds.getWidth() - getWidth())
                                            * CENTER_ON_SCREEN_X_FRACTION;
             double centerY =
@@ -385,7 +384,7 @@
      */
     @Deprecated
     public final void setFocused(boolean value) { focused.set(value); }
-    
+
     /**
      * Requests that this {@code Window} get the input focus.
      */
@@ -451,9 +450,9 @@
                 // performed in Window.visibleChanging()
                 if (isShowing()) {
                     newScene.getRoot().impl_reapplyCSS();
-                    getScene().impl_preferredSize();
 
                     if (!widthExplicit || !heightExplicit) {
+                        getScene().impl_preferredSize();
                         adjustSize(true);
                     }
                 }
@@ -737,7 +736,7 @@
                         peerBoundsConfigurator.setSize(
                                 getWidth(), getHeight(), -1, -1);
                     }
-                    
+
                     if (!xExplicit && !yExplicit) {
                         centerOnScreen();
                     } else {
@@ -1037,7 +1036,31 @@
     final void applyBounds() {
         peerBoundsConfigurator.apply();
     }
-    
+
+    Window getWindowOwner() {
+        return null;
+    }
+
+    private Screen getWindowScreen() {
+        Window window = this;
+        do {
+            if (!Double.isNaN(window.getX())
+                    && !Double.isNaN(window.getY())
+                    && !Double.isNaN(window.getWidth())
+                    && !Double.isNaN(window.getHeight())) {
+                return Utils.getScreenForRectangle(
+                                     new Rectangle2D(window.getX(),
+                                                     window.getY(),
+                                                     window.getWidth(),
+                                                     window.getHeight()));
+            }
+
+            window = window.getWindowOwner();
+        } while (window != null);
+
+        return Screen.getPrimary();
+    }
+
     /**
      * Caches all requested bounds settings and applies them at once during
      * the next pulse.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/test/unit/javafx/scene/EventAnyTest.java	Tue May 28 09:38:44 2013 -0700
@@ -0,0 +1,213 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javafx.scene;
+
+import com.sun.javafx.stage.FocusUngrabEvent;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import javafx.event.ActionEvent;
+import javafx.event.Event;
+import javafx.event.EventHandler;
+import javafx.event.EventType;
+import javafx.scene.input.ContextMenuEvent;
+import javafx.scene.input.DragEvent;
+import javafx.scene.input.GestureEvent;
+import javafx.scene.input.InputEvent;
+import javafx.scene.input.InputMethodEvent;
+import javafx.scene.input.InputMethodTextRun;
+import javafx.scene.input.KeyCode;
+import javafx.scene.input.KeyEvent;
+import javafx.scene.input.MouseButton;
+import javafx.scene.input.MouseDragEvent;
+import javafx.scene.input.MouseEvent;
+import javafx.scene.input.RotateEvent;
+import javafx.scene.input.ScrollEvent;
+import javafx.scene.input.SwipeEvent;
+import javafx.scene.input.TouchEvent;
+import javafx.scene.input.TouchPoint;
+import javafx.scene.input.TransferMode;
+import javafx.scene.input.ZoomEvent;
+import javafx.scene.shape.Rectangle;
+import javafx.scene.transform.TransformChangedEvent;
+import javafx.stage.Stage;
+import javafx.stage.WindowEvent;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import static org.junit.Assert.assertTrue;
+import org.junit.Test;
+
+@RunWith(Parameterized.class)
+public class EventAnyTest {
+    @Parameters
+    public static Collection getParams() {
+        return Arrays.asList(new Object[][] {
+            { ActionEvent.ANY,           actionEvent(),           true},
+            { ActionEvent.ANY,           focusUngrabEvent(),      false},
+            { FocusUngrabEvent.ANY,      focusUngrabEvent(),      true},
+            { FocusUngrabEvent.ANY,      actionEvent(),           false},
+            { ContextMenuEvent.ANY,      contextMenuEvent(),      true},
+            { ContextMenuEvent.ANY,      actionEvent(),           false},
+            { DragEvent.ANY,             dragEvent(),             true },
+            { DragEvent.ANY,             keyEvent(),              false },
+            { InputMethodEvent.ANY,      inputMethodEvent(),      true },
+            { InputMethodEvent.ANY,      keyEvent(),              false },
+            { KeyEvent.ANY,              keyEvent(),              true },
+            { KeyEvent.ANY,              inputMethodEvent(),      false },
+            { MouseDragEvent.ANY,        mouseDragEvent(),        true },
+            { MouseDragEvent.ANY,        mouseEvent(),            false },
+            { MouseEvent.ANY,            mouseEvent(),            true },
+            { MouseEvent.ANY,            mouseDragEvent(),        true },
+            { MouseEvent.ANY,            keyEvent(),              false },
+            { RotateEvent.ANY,           rotateEvent(),           true },
+            { RotateEvent.ANY,           zoomEvent(),             false },
+            { ZoomEvent.ANY,             zoomEvent(),             true },
+            { ZoomEvent.ANY,             rotateEvent(),           false },
+            { ScrollEvent.ANY,           scrollEvent(),           true },
+            { ScrollEvent.ANY,           swipeEvent(),            false },
+            { SwipeEvent.ANY,            swipeEvent(),            true },
+            { SwipeEvent.ANY,            scrollEvent(),           false },
+            { TouchEvent.ANY,            touchEvent(),            true },
+            { TouchEvent.ANY,            rotateEvent(),           false },
+            { TransformChangedEvent.ANY, transformChangedEvent(), true },
+            { TransformChangedEvent.ANY, mouseEvent(),            false },
+            { WindowEvent.ANY,           windowEvent(),           true },
+            { WindowEvent.ANY,           actionEvent(),           false },
+            { GestureEvent.ANY,          rotateEvent(),           true },
+            { GestureEvent.ANY,          mouseEvent(),            false },
+            { InputEvent.ANY,            mouseEvent(),            true },
+            { InputEvent.ANY,            actionEvent(),           false },
+        });
+    }
+
+    private boolean delivered;
+    private EventType type;
+    private Event event;
+    private boolean matches;
+
+    public EventAnyTest(EventType type, Event event, boolean matches) {
+        this.type = type;
+        this.event = event;
+        this.matches = matches;
+    }
+
+    @Test
+    public void testEventDelivery() {
+        Node n = new Rectangle();
+        delivered = false;
+
+        n.addEventHandler(type, new EventHandler() {
+            @Override public void handle(Event event) {
+                delivered = true;
+            }
+        });
+
+        Event.fireEvent(n, event);
+        assertTrue(matches == delivered);
+    }
+
+    private static Event actionEvent() {
+        return new ActionEvent();
+    }
+
+    private static Event focusUngrabEvent() {
+        return new FocusUngrabEvent();
+    }
+
+    private static Event contextMenuEvent() {
+        return new ContextMenuEvent(
+                ContextMenuEvent.CONTEXT_MENU_REQUESTED, 10, 10, 10, 10, true,
+                null);
+    }
+
+    private static Event dragEvent() {
+        return new DragEvent(DragEvent.DRAG_DROPPED, null,
+                1, 1, 1, 1, TransferMode.MOVE, null, null, null);
+    }
+
+    private static Event keyEvent() {
+        return new KeyEvent(KeyEvent.KEY_PRESSED, null, null,
+                KeyCode.TAB, true, true, true, true);
+    }
+
+    private static Event inputMethodEvent() {
+        return new InputMethodEvent(
+                InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
+                new ArrayList<InputMethodTextRun>(), null, 1);
+    }
+
+    private static Event mouseDragEvent() {
+        return new MouseDragEvent(MouseDragEvent.MOUSE_DRAG_OVER,
+                1, 1, 1, 1, MouseButton.NONE, 1, true, true, true, true, true,
+                true, true, true, true, null, null);
+    }
+
+    private static Event mouseEvent() {
+        return new MouseEvent(MouseEvent.MOUSE_CLICKED,
+                1, 1, 1, 1, MouseButton.NONE, 1, true, true, true, true, true,
+                true, true, true, true, true, null);
+    }
+
+    private static Event rotateEvent() {
+        return new RotateEvent(RotateEvent.ROTATION_FINISHED,
+                1, 1, 1, 1, true, true, true, true, true, true, 1, 1, null);
+    }
+
+    private static Event zoomEvent() {
+        return new ZoomEvent(ZoomEvent.ZOOM_STARTED,
+                1, 1, 1, 1, true, true, true, true, true, true, 1, 1, null);
+    }
+
+    private static Event scrollEvent() {
+        return new ScrollEvent(ScrollEvent.SCROLL_STARTED,
+                1, 1, 1, 1, true, true, true, true, true, true, 1, 1, 1, 1,
+                ScrollEvent.HorizontalTextScrollUnits.NONE, 1,
+                ScrollEvent.VerticalTextScrollUnits.NONE, 1, 1, null);
+    }
+
+    private static Event swipeEvent() {
+        return new SwipeEvent(SwipeEvent.SWIPE_DOWN, 1, 1, 1, 1,
+                true, true, true, true, true, 1, null);
+    }
+
+    private static Event transformChangedEvent() {
+        return new TransformChangedEvent();
+    }
+
+    private static Event windowEvent() {
+        return new WindowEvent(new Stage(), WindowEvent.WINDOW_SHOWN);
+    }
+
+    private static Event touchEvent() {
+        TouchPoint tp = new TouchPoint(
+                1, TouchPoint.State.MOVED, 1, 1, 1, 1, null, null);
+
+        return new TouchEvent(TouchEvent.TOUCH_MOVED, tp,
+                new ArrayList<>(Arrays.asList(new TouchPoint[] { tp })),
+                1, true, true, true, true);
+    }
+}
--- a/javafx-ui-common/test/unit/javafx/scene/Mouse3DTest.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/test/unit/javafx/scene/Mouse3DTest.java	Tue May 28 09:38:44 2013 -0700
@@ -90,6 +90,48 @@
     }
 
     @Test
+    public void shouldComputeCorrectParallelClipDistances() {
+        Camera cam = new ParallelCamera();
+        cam.setNearClip(100.0);
+        cam.setFarClip(200.0);
+        scene(group(), cam, true);
+        cam.impl_updatePG();
+        PickRay pickRay = cam.computePickRay(100, 200, null);
+        assertTrue(Double.isInfinite(pickRay.getNearClip()));
+        assertTrue(Double.isInfinite(pickRay.getFarClip()));
+        //TODO: replace the conditions by the following:
+//        assertEquals(100.0, pickRay.getNearClip(), 0.01);
+//        assertEquals(200.0, pickRay.getFarClip(), 0.01);
+    }
+
+    @Test
+    public void shouldComputeCorrectPerspectiveClipDistances() {
+        Camera cam = new PerspectiveCamera();
+        cam.setNearClip(100.0);
+        cam.setFarClip(200.0);
+        scene(group(), cam, true);
+        cam.impl_updatePG();
+        PickRay pickRay = cam.computePickRay(100, 200, null);
+        assertEquals(0.0, pickRay.getNearClip(), 0.01);
+        assertTrue(Double.isInfinite(pickRay.getFarClip()));
+        //TODO: replace the conditions by the following:
+//        assertEquals(104.39, pickRay.getNearClip(), 0.01);
+//        assertEquals(208.78, pickRay.getFarClip(), 0.01);
+    }
+
+    @Test
+    public void shouldComputeCorrectClipDistancesWithFixedEye() {
+        Camera cam = new PerspectiveCamera(true);
+        cam.setNearClip(100.0);
+        cam.setFarClip(200.0);
+        scene(group(), cam, true);
+        cam.impl_updatePG();
+        PickRay pickRay = cam.computePickRay(100, 200, null);
+        assertEquals(104.39, pickRay.getNearClip(), 0.01);
+        assertEquals(208.78, pickRay.getFarClip(), 0.01);
+    }
+
+    @Test
     public void shouldComputeCorrectMovedPerspectivePickRay() {
         Camera cam = new PerspectiveCamera();
         scene(group(cam), cam, true);
@@ -445,6 +487,72 @@
                 b, point(10, 40, -200), -3199, NOFACE, point(0.6, 0.7));
     }
 
+    @Test
+    public void shouldPickBoxByFixedEye() {
+        Box b = box().handleMove(me);
+        b.setTranslateZ(250);
+        b.setCullFace(CullFace.NONE);
+        Scene s = scene(group(b), perspective(true), true);
+
+        s.impl_processMouseEvent(MouseEventGenerator.generateMouseEvent(MouseEvent.MOUSE_MOVED, 500, 400));
+
+        MouseEvent e = me.event;
+        assertNotNull(e);
+        assertEquals(-200, e.getPickResult().getIntersectedPoint().getZ(), 0.0001);
+    }
+
+    @Test
+    public void shouldNotPickBoxCloserThanNearClip() {
+        Box b = box().handleMove(me);
+        b.setTranslateZ(250);
+        b.setCullFace(CullFace.NONE);
+        Camera cam = perspective(true);
+        cam.setNearClip(800);
+        cam.setFarClip(1800);
+
+        Scene s = scene(group(b), cam, true);
+
+        s.impl_processMouseEvent(MouseEventGenerator.generateMouseEvent(MouseEvent.MOUSE_MOVED, 500, 400));
+
+        MouseEvent e = me.event;
+        assertNull(e);
+    }
+
+    @Test
+    public void shouldNotPickBoxFartherThanFarClip() {
+        Box b = box().handleMove(me);
+        b.setTranslateZ(250);
+        b.setCullFace(CullFace.NONE);
+        Camera cam = perspective(true);
+        cam.setNearClip(10);
+        cam.setFarClip(40);
+
+        Scene s = scene(group(b), cam, true);
+
+        s.impl_processMouseEvent(MouseEventGenerator.generateMouseEvent(MouseEvent.MOUSE_MOVED, 500, 400));
+
+        MouseEvent e = me.event;
+        assertNull(e);
+    }
+
+    @Test
+    public void shouldPickBoxInteriorBetweenClips() {
+        Box b = box().handleMove(me);
+        b.setTranslateZ(250);
+        b.setCullFace(CullFace.NONE);
+        Camera cam = perspective(true);
+        cam.setNearClip(250);
+        cam.setFarClip(1800);
+
+        Scene s = scene(group(b), cam, true);
+
+        s.impl_processMouseEvent(MouseEventGenerator.generateMouseEvent(MouseEvent.MOUSE_MOVED, 500, 400));
+
+        MouseEvent e = me.event;
+        assertNotNull(e);
+        assertEquals(200, e.getPickResult().getIntersectedPoint().getZ(), 0.0001);
+    }
+
     /*****************  SPHERE picking ********************/
 
 
@@ -688,6 +796,71 @@
                 sph, point(10, 20, -97.46794), -1194.46794, NOFACE, point(0.516273, 0.6));
     }
 
+    @Test
+    public void shouldPickSphereByFixedEye() {
+        Sphere sp = sphere().handleMove(me);
+        sp.setTranslateZ(150);
+        sp.setCullFace(CullFace.NONE);
+        Scene s = scene(group(sp), perspective(true), true);
+
+        s.impl_processMouseEvent(MouseEventGenerator.generateMouseEvent(MouseEvent.MOUSE_MOVED, 500, 400));
+
+        MouseEvent e = me.event;
+        assertNotNull(e);
+        assertEquals(-100, e.getPickResult().getIntersectedPoint().getZ(), 0.0001);
+    }
+
+    @Test
+    public void shouldNotPickSphereCloserThanNearClip() {
+        Sphere sp = sphere().handleMove(me);
+        sp.setTranslateZ(150);
+        sp.setCullFace(CullFace.NONE);
+        Camera cam = perspective(true);
+        cam.setNearClip(800);
+        cam.setFarClip(1800);
+
+        Scene s = scene(group(sp), cam, true);
+
+        s.impl_processMouseEvent(MouseEventGenerator.generateMouseEvent(MouseEvent.MOUSE_MOVED, 500, 400));
+
+        MouseEvent e = me.event;
+        assertNull(e);
+    }
+
+    @Test
+    public void shouldNotPickSphereFartherThanFarClip() {
+        Sphere sp = sphere().handleMove(me);
+        sp.setTranslateZ(150);
+        sp.setCullFace(CullFace.NONE);
+        Camera cam = perspective(true);
+        cam.setNearClip(10);
+        cam.setFarClip(40);
+
+        Scene s = scene(group(sp), cam, true);
+
+        s.impl_processMouseEvent(MouseEventGenerator.generateMouseEvent(MouseEvent.MOUSE_MOVED, 500, 400));
+
+        MouseEvent e = me.event;
+        assertNull(e);
+    }
+
+    @Test
+    public void shouldPickSphereInteriorBetweenClips() {
+        Sphere sp = sphere().handleMove(me);
+        sp.setTranslateZ(150);
+        sp.setCullFace(CullFace.NONE);
+        Camera cam = perspective(true);
+        cam.setNearClip(150);
+        cam.setFarClip(1800);
+
+        Scene s = scene(group(sp), cam, true);
+
+        s.impl_processMouseEvent(MouseEventGenerator.generateMouseEvent(MouseEvent.MOUSE_MOVED, 500, 400));
+
+        MouseEvent e = me.event;
+        assertNotNull(e);
+        assertEquals(100, e.getPickResult().getIntersectedPoint().getZ(), 0.0001);
+    }
 
     /*****************  CYLINDER picking ********************/
 
@@ -1028,6 +1201,138 @@
                 c, point(10, 20, -48.98979), -1096.98979, NOFACE, point(0.532048, 0.6));
     }
 
+    @Test
+    public void shouldPickCylinderByFixedEye() {
+        Cylinder c = cylinder().handleMove(me);
+        c.setTranslateZ(100);
+        c.setCullFace(CullFace.NONE);
+        Scene s = scene(group(c), perspective(true), true);
+
+        s.impl_processMouseEvent(MouseEventGenerator.generateMouseEvent(MouseEvent.MOUSE_MOVED, 500, 400));
+
+        MouseEvent e = me.event;
+        assertNotNull(e);
+        assertEquals(-50, e.getPickResult().getIntersectedPoint().getZ(), 0.0001);
+    }
+
+    @Test
+    public void shouldPickCylinderCapByFixedEye() {
+        Cylinder c = cylinder().rotate('x', 90).handleMove(me);
+        c.setTranslateZ(150);
+        c.setCullFace(CullFace.NONE);
+        Scene s = scene(group(c), perspective(true), true);
+
+        s.impl_processMouseEvent(MouseEventGenerator.generateMouseEvent(MouseEvent.MOUSE_MOVED, 500, 400));
+
+        MouseEvent e = me.event;
+        assertNotNull(e);
+        assertEquals(-100, e.getPickResult().getIntersectedPoint().getY(), 0.0001);
+    }
+
+    @Test
+    public void shouldNotPickCylinderCloserThanNearClip() {
+        Cylinder c = cylinder().handleMove(me);
+        c.setTranslateZ(100);
+        c.setCullFace(CullFace.NONE);
+        Camera cam = perspective(true);
+        cam.setNearClip(800);
+        cam.setFarClip(1800);
+
+        Scene s = scene(group(c), cam, true);
+
+        s.impl_processMouseEvent(MouseEventGenerator.generateMouseEvent(MouseEvent.MOUSE_MOVED, 500, 400));
+
+        MouseEvent e = me.event;
+        assertNull(e);
+    }
+
+    @Test
+    public void shouldNotPickCylinderCapCloserThanNearClip() {
+        Cylinder c = cylinder().rotate('x', 90).handleMove(me);
+        c.setTranslateZ(150);
+        c.setCullFace(CullFace.NONE);
+        Camera cam = perspective(true);
+        cam.setNearClip(800);
+        cam.setFarClip(1800);
+
+        Scene s = scene(group(c), cam, true);
+
+        s.impl_processMouseEvent(MouseEventGenerator.generateMouseEvent(MouseEvent.MOUSE_MOVED, 500, 400));
+
+        MouseEvent e = me.event;
+        assertNull(e);
+    }
+
+    @Test
+    public void shouldNotPickCylinderFartherThanFarClip() {
+        Cylinder c = cylinder().handleMove(me);
+        c.setTranslateZ(100);
+        c.setCullFace(CullFace.NONE);
+        Camera cam = perspective(true);
+        cam.setNearClip(10);
+        cam.setFarClip(40);
+
+        Scene s = scene(group(c), cam, true);
+
+        s.impl_processMouseEvent(MouseEventGenerator.generateMouseEvent(MouseEvent.MOUSE_MOVED, 500, 400));
+
+        MouseEvent e = me.event;
+        assertNull(e);
+    }
+
+    @Test
+    public void shouldNotPickCylinderCapFartherThanFarClip() {
+        Cylinder c = cylinder().rotate('x', 90).handleMove(me);
+        c.setTranslateZ(150);
+        c.setCullFace(CullFace.NONE);
+        Camera cam = perspective(true);
+        cam.setNearClip(10);
+        cam.setFarClip(40);
+
+        Scene s = scene(group(c), cam, true);
+
+        s.impl_processMouseEvent(MouseEventGenerator.generateMouseEvent(MouseEvent.MOUSE_MOVED, 500, 400));
+
+        MouseEvent e = me.event;
+        assertNull(e);
+    }
+
+    @Test
+    public void shouldPickCylinderInteriorBetweenClips() {
+        Cylinder c = cylinder().handleMove(me);
+        c.setTranslateZ(100);
+        c.setCullFace(CullFace.NONE);
+        Camera cam = perspective(true);
+        cam.setNearClip(100);
+        cam.setFarClip(1800);
+
+        Scene s = scene(group(c), cam, true);
+
+        s.impl_processMouseEvent(MouseEventGenerator.generateMouseEvent(MouseEvent.MOUSE_MOVED, 500, 400));
+
+        MouseEvent e = me.event;
+        assertNotNull(e);
+        assertEquals(50, e.getPickResult().getIntersectedPoint().getZ(), 0.0001);
+    }
+
+    @Test
+    public void shouldPickCylinderCapInteriorBetweenClips() {
+        Cylinder c = cylinder().rotate('x', 90).handleMove(me);
+        c.setTranslateZ(150);
+        c.setCullFace(CullFace.NONE);
+        Camera cam = perspective(true);
+        cam.setNearClip(150);
+        cam.setFarClip(1800);
+
+        Scene s = scene(group(c), cam, true);
+
+        s.impl_processMouseEvent(MouseEventGenerator.generateMouseEvent(MouseEvent.MOUSE_MOVED, 500, 400));
+
+        MouseEvent e = me.event;
+        assertNotNull(e);
+        assertEquals(100, e.getPickResult().getIntersectedPoint().getY(), 0.0001);
+    }
+
 
     /*****************  MESH picking ********************/
 
@@ -1254,6 +1559,69 @@
                 m, point(10, 20, 10), -1000, 0, point(0.1, 0.2));
     }
 
+    @Test
+    public void shouldPickMeshByFixedEye() {
+        Node m = meshesXY().handleMove(me);
+        m.setTranslateZ(50);
+        Scene s = scene(group(m), perspective(true), true);
+
+        s.impl_processMouseEvent(MouseEventGenerator.generateMouseEvent(MouseEvent.MOUSE_MOVED, 500, 400));
+
+        MouseEvent e = me.event;
+        assertNotNull(e);
+        assertEquals(-7, e.getPickResult().getIntersectedPoint().getZ(), 0.0001);
+        assertEquals(1, e.getPickResult().getIntersectedFace());
+    }
+
+    @Test
+    public void shouldNotPickMeshCloserThanNearClip() {
+        Node m = meshesXY().handleMove(me);
+        m.setTranslateZ(50);
+        Camera cam = perspective(true);
+        cam.setNearClip(800);
+        cam.setFarClip(1800);
+
+        Scene s = scene(group(m), cam, true);
+
+        s.impl_processMouseEvent(MouseEventGenerator.generateMouseEvent(MouseEvent.MOUSE_MOVED, 500, 400));
+
+        MouseEvent e = me.event;
+        assertNull(e);
+    }
+
+    @Test
+    public void shouldNotPickMeshFartherThanFarClip() {
+        Node m = meshesXY().handleMove(me);
+        m.setTranslateZ(50);
+        Camera cam = perspective(true);
+        cam.setNearClip(10);
+        cam.setFarClip(40);
+
+        Scene s = scene(group(m), cam, true);
+
+        s.impl_processMouseEvent(MouseEventGenerator.generateMouseEvent(MouseEvent.MOUSE_MOVED, 500, 400));
+
+        MouseEvent e = me.event;
+        assertNull(e);
+    }
+
+    @Test
+    public void shouldPickMeshInteriorBetweenClips() {
+        Node m = meshesXY().handleMove(me);
+        m.setTranslateZ(50);
+        Camera cam = perspective(true);
+        cam.setNearClip(47);
+        cam.setFarClip(1800);
+
+        Scene s = scene(group(m), cam, true);
+
+        s.impl_processMouseEvent(MouseEventGenerator.generateMouseEvent(MouseEvent.MOUSE_MOVED, 500, 400));
+
+        MouseEvent e = me.event;
+        assertNotNull(e);
+        assertEquals(0, e.getPickResult().getIntersectedPoint().getZ(), 0.0001);
+        assertEquals(0, e.getPickResult().getIntersectedFace());
+    }
 
     /*****************  DEPTH BUFFER ********************/
 
@@ -1942,7 +2310,11 @@
     }
 
     private Camera perspective() {
-        PerspectiveCamera cam = new PerspectiveCamera();
+        return perspective(false);
+    }
+
+    private Camera perspective(boolean fixedEye) {
+        PerspectiveCamera cam = new PerspectiveCamera(fixedEye);
         // this field of view makes camera Z position to be -1000
         cam.setFieldOfView(43.60281897);
         return cam;
--- a/javafx-ui-common/test/unit/javafx/scene/NodeTest.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/test/unit/javafx/scene/NodeTest.java	Tue May 28 09:38:44 2013 -0700
@@ -251,10 +251,10 @@
         scene.getRoot().getChildren().add(rect);
 
         PickResultChooser res = new PickResultChooser();
-        rect.impl_pickNode(new PickRay(50, 50), res);
+        rect.impl_pickNode(new PickRay(50, 50, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY), res);
         assertSame(rect, res.getIntersectedNode());
         res = new PickResultChooser();
-        rect.impl_pickNode(new PickRay(0, 0), res);
+        rect.impl_pickNode(new PickRay(0, 0, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY), res);
         assertNull(res.getIntersectedNode());
     }
 
@@ -270,10 +270,10 @@
         scene.getRoot().getChildren().add(rect);
 
         PickResultChooser res = new PickResultChooser();
-        rect.impl_pickNode(new PickRay(50, 50), res);
+        rect.impl_pickNode(new PickRay(50, 50, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY), res);
         assertSame(rect, res.getIntersectedNode());
         res = new PickResultChooser();
-        rect.impl_pickNode(new PickRay(0, 0), res);
+        rect.impl_pickNode(new PickRay(0, 0, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY), res);
         assertNull(res.getIntersectedNode());
     }
 
--- a/javafx-ui-common/test/unit/javafx/scene/SceneTest.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/test/unit/javafx/scene/SceneTest.java	Tue May 28 09:38:44 2013 -0700
@@ -619,10 +619,10 @@
     @Test(expected = IllegalArgumentException.class)
     public void testSetIllegalCameraFromOtherScene() {
         Camera camera = new PerspectiveCamera();
-        
+
         Scene scene1 = new Scene(new Group(camera));
         Scene scene2 = new Scene(new Group());
-        
+
         scene1.setCamera(camera);
         scene2.setCamera(camera);
     }
--- a/javafx-ui-common/test/unit/javafx/scene/layout/AnchorPaneTest.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/test/unit/javafx/scene/layout/AnchorPaneTest.java	Tue May 28 09:38:44 2013 -0700
@@ -41,8 +41,8 @@
         child.relocate(10, 20); // should honor position if no anchors set
         anchorpane.getChildren().add(child);
 
-        assertEquals(110, anchorpane.minWidth(-1), 1e-100);
-        assertEquals(220, anchorpane.minHeight(-1), 1e-100);
+        assertEquals(310, anchorpane.minWidth(-1), 1e-100); // Not restricted, at pref. width
+        assertEquals(420, anchorpane.minHeight(-1), 1e-100); // Not restricted, at pref. height
         assertEquals(310, anchorpane.prefWidth(-1), 1e-100);
         assertEquals(420, anchorpane.prefHeight(-1), 1e-100);
 
@@ -67,11 +67,11 @@
         anchorpane.setTopAnchor(child, 10.0);
         anchorpane.getChildren().add(child);
 
-        assertEquals(100, anchorpane.minWidth(-1), 1e-100);
-        assertEquals(210, anchorpane.minHeight(-1), 1e-100);
+        assertEquals(300, anchorpane.minWidth(-1), 1e-100); // Not restricted, at pref. width
+        assertEquals(410, anchorpane.minHeight(-1), 1e-100); // Not restricted, at pref. height
         assertEquals(300, anchorpane.prefWidth(-1), 1e-100);
         assertEquals(410, anchorpane.prefHeight(-1), 1e-100);
-        
+
         anchorpane.autosize();
         anchorpane.layout();
         assertEquals(0, child.getLayoutX(), 1e-100);
@@ -93,8 +93,8 @@
         anchorpane.setLeftAnchor(child, 10.0);
         anchorpane.getChildren().add(child);
 
-        assertEquals(110, anchorpane.minWidth(-1), 1e-100);
-        assertEquals(200, anchorpane.minHeight(-1), 1e-100);
+        assertEquals(310, anchorpane.minWidth(-1), 1e-100); // Not restricted, at pref. width
+        assertEquals(400, anchorpane.minHeight(-1), 1e-100); // Not restricted, at pref. height
         assertEquals(310, anchorpane.prefWidth(-1), 1e-100);
         assertEquals(400, anchorpane.prefHeight(-1), 1e-100);
 
@@ -119,8 +119,8 @@
         anchorpane.setBottomAnchor(child, 10.0);
         anchorpane.getChildren().add(child);
 
-        assertEquals(100, anchorpane.minWidth(-1), 1e-100);
-        assertEquals(210, anchorpane.minHeight(-1), 1e-100);
+        assertEquals(300, anchorpane.minWidth(-1), 1e-100); // Not restricted, at pref. width
+        assertEquals(410, anchorpane.minHeight(-1), 1e-100); // Not restricted, at pref. height
         assertEquals(300, anchorpane.prefWidth(-1), 1e-100);
         assertEquals(410, anchorpane.prefHeight(-1), 1e-100);
 
@@ -145,8 +145,8 @@
         anchorpane.setRightAnchor(child, 10.0);
         anchorpane.getChildren().add(child);
 
-        assertEquals(110, anchorpane.minWidth(-1), 1e-100);
-        assertEquals(200, anchorpane.minHeight(-1), 1e-100);
+        assertEquals(310, anchorpane.minWidth(-1), 1e-100); // Not restricted, at pref. width
+        assertEquals(400, anchorpane.minHeight(-1), 1e-100); // Not restricted, at pref. height
         assertEquals(310, anchorpane.prefWidth(-1), 1e-100);
         assertEquals(400, anchorpane.prefHeight(-1), 1e-100);
 
@@ -172,8 +172,8 @@
         anchorpane.setLeftAnchor(child, 10.0);
         anchorpane.getChildren().add(child);
 
-        assertEquals(110, anchorpane.minWidth(-1), 1e-100);
-        assertEquals(220, anchorpane.minHeight(-1), 1e-100);
+        assertEquals(310, anchorpane.minWidth(-1), 1e-100); // Not restricted, at pref. width
+        assertEquals(420, anchorpane.minHeight(-1), 1e-100); // Not restricted, at pref. height
         assertEquals(310, anchorpane.prefWidth(-1), 1e-100);
         assertEquals(420, anchorpane.prefHeight(-1), 1e-100);
 
@@ -199,7 +199,7 @@
         anchorpane.setBottomAnchor(child, 10.0);
         anchorpane.getChildren().add(child);
 
-        assertEquals(100, anchorpane.minWidth(-1), 1e-100);
+        assertEquals(300, anchorpane.minWidth(-1), 1e-100); // Not restricted, at pref. width
         assertEquals(230, anchorpane.minHeight(-1), 1e-100);
         assertEquals(300, anchorpane.prefWidth(-1), 1e-100);
         assertEquals(430, anchorpane.prefHeight(-1), 1e-100);
@@ -226,8 +226,8 @@
         anchorpane.setRightAnchor(child, 10.0);
         anchorpane.getChildren().add(child);
 
-        assertEquals(110, anchorpane.minWidth(-1), 1e-100);
-        assertEquals(220, anchorpane.minHeight(-1), 1e-100);
+        assertEquals(310, anchorpane.minWidth(-1), 1e-100); // Not restricted, at pref. width
+        assertEquals(420, anchorpane.minHeight(-1), 1e-100); // Not restricted, at pref. height
         assertEquals(310, anchorpane.prefWidth(-1), 1e-100);
         assertEquals(420, anchorpane.prefHeight(-1), 1e-100);
 
@@ -253,8 +253,8 @@
         anchorpane.setLeftAnchor(child, 10.0);
         anchorpane.getChildren().add(child);
 
-        assertEquals(110, anchorpane.minWidth(-1), 1e-100);
-        assertEquals(220, anchorpane.minHeight(-1), 1e-100);
+        assertEquals(310, anchorpane.minWidth(-1), 1e-100); // Not restricted, at pref. width
+        assertEquals(420, anchorpane.minHeight(-1), 1e-100); // Not restricted, at pref. height
         assertEquals(310, anchorpane.prefWidth(-1), 1e-100);
         assertEquals(420, anchorpane.prefHeight(-1), 1e-100);
 
@@ -281,7 +281,7 @@
         anchorpane.getChildren().add(child);
 
         assertEquals(130, anchorpane.minWidth(-1), 1e-100);
-        assertEquals(200, anchorpane.minHeight(-1), 1e-100);
+        assertEquals(400, anchorpane.minHeight(-1), 1e-100); // Not restricted, will be always at pref. size
         assertEquals(330, anchorpane.prefWidth(-1), 1e-100);
         assertEquals(400, anchorpane.prefHeight(-1), 1e-100);
 
@@ -309,7 +309,7 @@
         anchorpane.getChildren().add(child);
 
         assertEquals(130, anchorpane.minWidth(-1), 1e-100);
-        assertEquals(230, anchorpane.minHeight(-1), 1e-100);
+        assertEquals(430, anchorpane.minHeight(-1), 1e-100); // Not restricted, at pref. height
         assertEquals(330, anchorpane.prefWidth(-1), 1e-100);
         assertEquals(430, anchorpane.prefHeight(-1), 1e-100);
 
@@ -337,7 +337,7 @@
         anchorpane.getChildren().add(child);
 
         assertEquals(130, anchorpane.minWidth(-1), 1e-100);
-        assertEquals(230, anchorpane.minHeight(-1), 1e-100);
+        assertEquals(430, anchorpane.minHeight(-1), 1e-100); // Not restricted, at pref. height
         assertEquals(330, anchorpane.prefWidth(-1), 1e-100);
         assertEquals(430, anchorpane.prefHeight(-1), 1e-100);
 
@@ -364,7 +364,7 @@
         anchorpane.setLeftAnchor(child, 30.0);
         anchorpane.getChildren().add(child);
 
-        assertEquals(130, anchorpane.minWidth(-1), 1e-100);
+        assertEquals(330, anchorpane.minWidth(-1), 1e-100); // Not restricted, at pref. width
         assertEquals(230, anchorpane.minHeight(-1), 1e-100);
         assertEquals(330, anchorpane.prefWidth(-1), 1e-100);
         assertEquals(430, anchorpane.prefHeight(-1), 1e-100);
@@ -392,7 +392,7 @@
         anchorpane.setRightAnchor(child, 30.0);
         anchorpane.getChildren().add(child);
 
-        assertEquals(130, anchorpane.minWidth(-1), 1e-100);
+        assertEquals(330, anchorpane.minWidth(-1), 1e-100); // Not restricted, at pref. width
         assertEquals(230, anchorpane.minHeight(-1), 1e-100);
         assertEquals(330, anchorpane.prefWidth(-1), 1e-100);
         assertEquals(430, anchorpane.prefHeight(-1), 1e-100);
@@ -593,34 +593,34 @@
 
     @Test public void testAnchorPaneWithChildPrefSizeLessThanMinSize() {
         AnchorPane anchorpane = new AnchorPane();
-        MockResizable resizable = new MockResizable(30, 30, 20, 20, Double.MAX_VALUE, Double.MAX_VALUE);        
+        MockResizable resizable = new MockResizable(30, 30, 20, 20, Double.MAX_VALUE, Double.MAX_VALUE);
         anchorpane.getChildren().add(resizable);
 
         anchorpane.autosize();
         anchorpane.layout();
-        
+
         assertEquals(0, resizable.getLayoutX(), 1e-100);
         assertEquals(0, resizable.getLayoutY(), 1e-100);
         assertEquals(30, resizable.getLayoutBounds().getWidth(), 1e-100);
         assertEquals(30, resizable.getLayoutBounds().getHeight(), 1e-100);
     }
-    
+
     @Test public void testAnchorPanePrefHeightWithHorizontalBiasedChild_RT21745() {
         AnchorPane anchorpane = new AnchorPane();
-        
-        AnchorPane internalAnchorpane = new AnchorPane();        
+
+        AnchorPane internalAnchorpane = new AnchorPane();
 
         MockBiased biased = new MockBiased(Orientation.HORIZONTAL, 30, 256);
-                        
+
         internalAnchorpane.getChildren().add(biased);
         anchorpane.getChildren().add(internalAnchorpane);
-      
+
         anchorpane.resize(500, 500);
-        anchorpane.layout();        
-        
+        anchorpane.layout();
+
         assertEquals(30, anchorpane.prefWidth(-1), 1e-100);
         assertEquals(256, anchorpane.prefHeight(-1), 1e-100);
         assertEquals(30, internalAnchorpane.prefWidth(-1), 1e-100);
-        assertEquals(256, internalAnchorpane.prefHeight(-1), 1e-100);        
-    }    
+        assertEquals(256, internalAnchorpane.prefHeight(-1), 1e-100);
+    }
 }
--- a/javafx-ui-common/test/unit/javafx/scene/layout/BorderPaneTest.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/test/unit/javafx/scene/layout/BorderPaneTest.java	Tue May 28 09:38:44 2013 -0700
@@ -314,7 +314,7 @@
     }
 
     @Test public void testWithBiasedChildren() {
-        MockBiased top = new MockBiased(Orientation.HORIZONTAL, 100, 20); // 280 x 7.1428
+        MockBiased top = new MockBiased(Orientation.HORIZONTAL, 100, 20); // 300 x 6.666
         borderpane.setTop(top);
 
         MockBiased left = new MockBiased(Orientation.VERTICAL, 40, 100); // 20 x 200
@@ -326,7 +326,7 @@
         MockBiased right = new MockBiased(Orientation.VERTICAL, 60, 200); // 60 x 200
         borderpane.setRight(right);
 
-        MockBiased bottom = new MockBiased(Orientation.HORIZONTAL, 200, 20); // 280 x 14.284
+        MockBiased bottom = new MockBiased(Orientation.HORIZONTAL, 200, 20); // 300 x 13.333
         borderpane.setBottom(bottom);
 
         assertEquals(40/*l*/ + 60/*r*/ + 200/*c*/, borderpane.prefWidth(-1), 1e-100);
@@ -336,38 +336,41 @@
         assertEquals(90, borderpane.minWidth(240), 1e-100);
         assertEquals(221, borderpane.minHeight(300), 1e-10);
 
-        borderpane.resize(280, 240);
+        borderpane.resize(300, 240);
         borderpane.layout();
 
         assertEquals(0, top.getLayoutX(), 1e-100);
         assertEquals(0, top.getLayoutY(), 1e-100);
-        assertEquals(280, top.getWidth(), 1e-100);
-        assertEquals(8, top.getHeight(), 1e-100);
+        assertEquals(300, top.getWidth(), 1e-100);
+        assertEquals(7, top.getHeight(), 1e-100);
+
+        assertEquals(0, bottom.getLayoutX(), 1e-100);
+        assertEquals(226, bottom.getLayoutY(), 1e-100);
+        assertEquals(300, bottom.getWidth(), 1e-100);
+        assertEquals(14, bottom.getHeight(), 1e-100);
 
         assertEquals(0, left.getLayoutX(), 1e-100);
-        assertEquals(8, left.getLayoutY(), 1e-100);
-        assertEquals(19, left.getWidth(), 1e-100);
-        assertEquals(217, left.getHeight(), 1e-100);
+        assertEquals(7, left.getLayoutY(), 1e-100);
+        assertEquals(240 - 14 - 7, left.getHeight(), 1e-100);
+        final double leftWidth = Math.ceil(40*100.0/(240 - 14 - 7));
+        assertEquals(leftWidth, left.getWidth(), 1e-100);
+
+        assertEquals(7, right.getLayoutY(), 1e-100);
+        assertEquals(240 - 14 - 7, right.getHeight(), 1e-100);
+        final double rightWidth = Math.ceil(60*200.0/(240 - 14 - 7));
+        assertEquals(rightWidth, right.getWidth(), 1e-100);
+        assertEquals(300 - rightWidth, right.getLayoutX(), 1e-100);
 
         // Center is HORIZONTALLY biased, so when width is stretched, height is lower
-        double centerWidth = 280 - 19 - 56;
+        double centerWidth = 300 - leftWidth - rightWidth;
         double centerHeight = Math.ceil(200 * 200 / centerWidth);
 
         assertEquals(19, center.getLayoutX(), 1e-100);
         // center alignment, Math.round == snapPosition
-        assertEquals(Math.round(8 + (240 - 8 - 15 - centerHeight) / 2), center.getLayoutY(), 1e-100);
+        assertEquals(Math.round(7 + (240 - 7 - 14 - centerHeight) / 2), center.getLayoutY(), 1e-100);
         assertEquals(centerWidth, center.getWidth(), 1e-100);
         assertEquals(centerHeight, center.getHeight(), 1e-100);
 
-        assertEquals(224, right.getLayoutX(), 1e-100);
-        assertEquals(8, right.getLayoutY(), 1e-100);
-        assertEquals(56, right.getWidth(), 1e-100);
-        assertEquals(217, right.getHeight(), 1e-100);
-
-        assertEquals(0, bottom.getLayoutX(), 1e-100);
-        assertEquals(225, bottom.getLayoutY(), 1e-100);
-        assertEquals(280, bottom.getWidth(), 1e-100);
-        assertEquals(15, bottom.getHeight(), 1e-100);
     }
 
     @Test public void testWithHorizontalBiasedChildrenAtPrefSize() {
@@ -700,7 +703,7 @@
         borderpane.layout();
 
         assertEquals(50, child.getWidth(), 1e-100);
-        assertEquals(50, child.getHeight(), 1e-100);
+        assertEquals(200, child.getHeight(), 1e-100); //Top always at it's pref height
     }
 
     @Test public void testFitsBottomChildWithinBounds() {
@@ -711,7 +714,7 @@
         borderpane.layout();
 
         assertEquals(50, child.getWidth(), 1e-100);
-        assertEquals(50, child.getHeight(), 1e-100);
+        assertEquals(200, child.getHeight(), 1e-100); //Bottom always at it's pref height
     }
 
     @Test public void testFitsLeftChildWithinBounds() {
@@ -721,7 +724,7 @@
         borderpane.resize(50,50);
         borderpane.layout();
 
-        assertEquals(50, child.getWidth(), 1e-100);
+        assertEquals(100, child.getWidth(), 1e-100); //Left always at it's pref width
         assertEquals(50, child.getHeight(), 1e-100);
     }
 
@@ -732,7 +735,7 @@
         borderpane.resize(50,50);
         borderpane.layout();
 
-        assertEquals(50, child.getWidth(), 1e-100);
+        assertEquals(100, child.getWidth(), 1e-100); //Right always at it's pref width
         assertEquals(50, child.getHeight(), 1e-100);
     }
 
@@ -910,4 +913,26 @@
         assertEquals(20, center.getLayoutX(), 1e-100);
         assertEquals(5, center.getLayoutY(), 1e-100);
     }
+
+    @Test
+    public void testResizeBelowMinimum() {
+        MockResizable left = new MockResizable(10,10,100,100,150,150);
+        MockResizable center = new MockResizable(30,30,100,100,200,200);
+
+        borderpane.setCenter(center);
+        borderpane.setLeft(left);
+
+        borderpane.resize(30, 30);
+
+        borderpane.layout();
+
+        assertEquals(100, left.getWidth(), 1e-100); // Always at pref.
+        assertEquals(30, left.getHeight(), 1e-100);
+
+        assertEquals(100, center.getLayoutX(), 1e-100);
+        assertEquals(0, center.getLayoutY(), 1e-100);
+        assertEquals(30, center.getWidth(), 1e-100);
+        assertEquals(30, center.getHeight(), 1e-100);
+    }
+
 }
--- a/javafx-ui-common/test/unit/javafx/stage/StageTest.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-common/test/unit/javafx/stage/StageTest.java	Tue May 28 09:38:44 2013 -0700
@@ -26,7 +26,6 @@
 package javafx.stage;
 
 import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertTrue;
 import static junit.framework.Assert.assertFalse;
 import static junit.framework.Assert.assertTrue;
 import static junit.framework.Assert.assertSame;
@@ -40,16 +39,17 @@
 
 import com.sun.javafx.pgstub.StubStage;
 import com.sun.javafx.pgstub.StubToolkit;
+import com.sun.javafx.pgstub.StubToolkit.ScreenConfiguration;
 import com.sun.javafx.tk.Toolkit;
 
 public class StageTest {
-    
+
     private StubToolkit toolkit;
     private Stage s;
     private StubStage peer;
 
     private int initialNumTimesSetSizeAndLocation;
-    
+
     @Before
     public void setUp() {
         toolkit = (StubToolkit) Toolkit.getToolkit();
@@ -63,11 +63,11 @@
     public void tearDown() {
         s.hide();
     }
-    
+
     private void pulse() {
         toolkit.fireTestPulse();
     }
-    
+
     /**
      * Simple test which checks whether changing the x/y position of the Stage
      * ends up invoking the appropriate methods on the TKStage interface.
@@ -238,6 +238,82 @@
     }
 
     @Test
+    public void testCenterOnScreenForWindowOnSecondScreen() {
+        toolkit.setScreens(
+                new ScreenConfiguration(0, 0, 1920, 1200, 0, 0, 1920, 1172, 96),
+                new ScreenConfiguration(1920, 160, 1440, 900,
+                                        1920, 160, 1440, 900, 96));
+
+        try {
+            s.setX(1920);
+            s.setY(160);
+            s.setWidth(300);
+            s.setHeight(200);
+
+            s.centerOnScreen();
+            pulse();
+
+            assertTrue(peer.x > 1930);
+            assertTrue(peer.y > 170);
+        } finally {
+            toolkit.resetScreens();
+        }
+    }
+
+    @Test
+    public void testCenterOnScreenForOwnerOnSecondScreen() {
+        toolkit.setScreens(
+                new ScreenConfiguration(0, 0, 1920, 1200, 0, 0, 1920, 1172, 96),
+                new ScreenConfiguration(1920, 160, 1440, 900,
+                                        1920, 160, 1440, 900, 96));
+
+        try {
+            s.setX(1920);
+            s.setY(160);
+            s.setWidth(300);
+            s.setHeight(200);
+
+            final Stage childStage = new Stage();
+            childStage.setWidth(100);
+            childStage.setHeight(100);
+            childStage.initOwner(s);
+            childStage.show();
+
+            childStage.centerOnScreen();
+
+            assertTrue(childStage.getX() > 1930);
+            assertTrue(childStage.getY() > 170);
+        } finally {
+            toolkit.resetScreens();
+        }
+    }
+
+    @Test
+    public void testSwitchSceneWithFixedSize() {
+        Scene scene = new Scene(new Group(), 200, 100);
+        s.setScene(scene);
+
+        s.setWidth(400);
+        s.setHeight(300);
+
+        pulse();
+
+        assertEquals(400, peer.width, 0.0001);
+        assertEquals(300, peer.height, 0.0001);
+        assertEquals(400, scene.getWidth(), 0.0001);
+        assertEquals(300, scene.getHeight(), 0.0001);
+
+        s.setScene(scene = new Scene(new Group(), 220, 110));
+
+        pulse();
+
+        assertEquals(400, peer.width, 0.0001);
+        assertEquals(300, peer.height, 0.0001);
+        assertEquals(400, scene.getWidth(), 0.0001);
+        assertEquals(300, scene.getHeight(), 0.0001);
+    }
+
+    @Test
     public void testSetBoundsNotLostForAsyncNotifications() {
         s.setX(20);
         s.setY(50);
@@ -270,12 +346,12 @@
 
         s.setFullScreen(false);
         assertFalse(s.isFullScreen());
-        
+
         peer.releaseSingleNotification();
         assertTrue(s.isFullScreen());
 
         peer.releaseNotifications();
-        
+
         assertFalse(s.isFullScreen());
     }
 
@@ -312,7 +388,7 @@
         peer.setResizable(true);
         assertTrue(s.isResizable());
     }
-    
+
     @Test
     public void testIconifiedNotLostForAsyncNotifications() {
         peer.holdNotifications();
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/FXVKSkin.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/FXVKSkin.java	Tue May 28 09:38:44 2013 -0700
@@ -208,9 +208,6 @@
             @Override public void invalidated(Observable valueModel) {
                 if (vkPopup != null) {
                     vkPopup.setY(winY.get());
-                    //workaround for RT-28648: popup window is not repainted after a move
-                    vkPopup.getScene().getRoot().setVisible(false);
-                    vkPopup.getScene().getRoot().setVisible(true);
                 }
             }
         });
--- a/javafx-ui-controls/src/javafx/scene/control/CheckBoxTreeItem.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-controls/src/javafx/scene/control/CheckBoxTreeItem.java	Tue May 28 09:38:44 2013 -0700
@@ -107,7 +107,7 @@
         return (EventType<TreeModificationEvent<T>>) CHECK_BOX_SELECTION_CHANGED_EVENT;
     }
     private static final EventType<? extends Event> CHECK_BOX_SELECTION_CHANGED_EVENT
-            = new EventType<Event>(Event.ANY, "checkBoxSelectionChangedEvent"); 
+            = new EventType<Event>(TreeModificationEvent.ANY, "checkBoxSelectionChangedEvent");
 
     /***************************************************************************
      *                                                                         *
@@ -334,6 +334,12 @@
         private final boolean selectionChanged;
 
         /**
+         * Common supertype for all tree modification event types.
+         */
+        public static final EventType<Event> ANY =
+                new EventType<Event> (Event.ANY, "TREE_MODIFICATION");
+
+        /**
          * Creates a default TreeModificationEvent instance to represent the 
          * change in selection/indeterminate states for the given CheckBoxTreeItem
          * instance.
--- a/javafx-ui-controls/src/javafx/scene/control/Control.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-controls/src/javafx/scene/control/Control.java	Tue May 28 09:38:44 2013 -0700
@@ -43,7 +43,6 @@
 import javafx.scene.layout.Region;
 import com.sun.javafx.accessible.providers.AccessibleProvider;
 import com.sun.javafx.application.PlatformImpl;
-import com.sun.javafx.beans.annotations.DuplicateInBuilderProperties;
 import com.sun.javafx.css.CssError;
 import javafx.css.CssMetaData;
 import com.sun.javafx.css.StyleManager;
@@ -73,7 +72,6 @@
  * controls that are containers {@link ScrollPane} and {@link ToolBar} do not.
  * Consult individual control documentation for details.
  */
-@DuplicateInBuilderProperties(properties = {"minHeight", "minWidth", "maxHeight", "maxWidth", "prefHeight", "prefWidth"})
 public abstract class Control extends Region implements Skinnable {
 
     static {
--- a/javafx-ui-controls/src/javafx/scene/control/ListView.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-controls/src/javafx/scene/control/ListView.java	Tue May 28 09:38:44 2013 -0700
@@ -912,6 +912,11 @@
         private final int editIndex;
 
         /**
+         * Common supertype for all edit event types.
+         */
+        public static final EventType<?> ANY = EDIT_ANY_EVENT;
+
+        /**
          * Creates a new EditEvent instance to represent an edit event. This 
          * event is used for {@link #EDIT_START_EVENT}, 
          * {@link #EDIT_COMMIT_EVENT} and {@link #EDIT_CANCEL_EVENT} types.
--- a/javafx-ui-controls/src/javafx/scene/control/PasswordField.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-controls/src/javafx/scene/control/PasswordField.java	Tue May 28 09:38:44 2013 -0700
@@ -25,13 +25,11 @@
 
 package javafx.scene.control;
 
-import com.sun.javafx.beans.annotations.DuplicateInBuilderProperties;
 import com.sun.javafx.scene.control.skin.PasswordFieldSkin;
 
 /**
  * Text field that masks entered characters.
  */
-@DuplicateInBuilderProperties(properties = {"promptText"})
 public class PasswordField extends TextField {
     public PasswordField() {
         getStyleClass().add("password-field");
--- a/javafx-ui-controls/src/javafx/scene/control/ScrollToEvent.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-controls/src/javafx/scene/control/ScrollToEvent.java	Tue May 28 09:38:44 2013 -0700
@@ -43,8 +43,14 @@
 //        return SCROLL_TO_NODE;
 //    }
 //    private static final EventType<ScrollToEvent<Node>> SCROLL_TO_NODE = 
-//            new EventType<ScrollToEvent<Node>>(Event.ANY, "SCROLL_TO_NODE");
-    
+//            new EventType<ScrollToEvent<Node>>(ScrollToEvent.ANY, "SCROLL_TO_NODE");
+
+    /**
+     * Common supertype for all scroll-to event types.
+     */
+    public static final EventType<ScrollToEvent> ANY =
+            new EventType<ScrollToEvent> (Event.ANY, "SCROLL_TO");
+
     /**
      * This event occurs if the user requests scrolling a given index into view.
      */
@@ -53,7 +59,7 @@
         return SCROLL_TO_TOP_INDEX;
     }
     private static final EventType<ScrollToEvent<Integer>> SCROLL_TO_TOP_INDEX = 
-            new EventType<ScrollToEvent<Integer>>(Event.ANY, "SCROLL_TO_TOP_INDEX");
+            new EventType<ScrollToEvent<Integer>>(ScrollToEvent.ANY, "SCROLL_TO_TOP_INDEX");
     
 
     /**
@@ -65,7 +71,7 @@
         return (EventType<ScrollToEvent<T>>) SCROLL_TO_COLUMN;
     }
     private static final EventType<?> SCROLL_TO_COLUMN = 
-            new EventType(Event.ANY, "SCROLL_TO_COLUMN");
+            new EventType(ScrollToEvent.ANY, "SCROLL_TO_COLUMN");
     
     private static final long serialVersionUID = -8557345736849482516L;
     
--- a/javafx-ui-controls/src/javafx/scene/control/SortEvent.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-controls/src/javafx/scene/control/SortEvent.java	Tue May 28 09:38:44 2013 -0700
@@ -9,13 +9,19 @@
  */
 public class SortEvent<C> extends Event {
 
+    /**
+     * Common supertype for all sort event types.
+     */
+    public static final EventType<SortEvent> ANY =
+            new EventType<SortEvent> (Event.ANY, "SORT");
+
     @SuppressWarnings("unchecked")
     public static <C> EventType<SortEvent<C>> sortEvent() {
         return (EventType<SortEvent<C>>) SORT_EVENT;
     }
     
     @SuppressWarnings("unchecked")
-    private static final EventType<?> SORT_EVENT = new EventType(Event.ANY, "SORT_EVENT");
+    private static final EventType<?> SORT_EVENT = new EventType(SortEvent.ANY, "SORT_EVENT");
     
 //    /**
 //     * Construct a new {@code Event} with the specified event source, target
--- a/javafx-ui-controls/src/javafx/scene/control/TableColumn.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-controls/src/javafx/scene/control/TableColumn.java	Tue May 28 09:38:44 2013 -0700
@@ -25,7 +25,6 @@
 
 package javafx.scene.control;
 
-import com.sun.javafx.beans.annotations.DuplicateInBuilderProperties;
 import com.sun.javafx.scene.control.skin.NestedTableColumnHeader;
 import com.sun.javafx.scene.control.skin.TableColumnHeader;
 import com.sun.javafx.scene.control.skin.TableHeaderRow;
@@ -134,10 +133,6 @@
  * @see TableCell
  * @see TablePosition
  */
-@DuplicateInBuilderProperties(properties =
-        {"comparator", "contextMenu", "editable", "graphic", "id", "maxWidth",
-         "minWidth", "prefWidth", "resizable", "sortable", "sortNode",
-         "sortType", "style", "styleClass", "userdata", "text", "visible"})
 public class TableColumn<S,T> extends TableColumnBase<S,T> implements EventTarget {
     
     /***************************************************************************
@@ -731,6 +726,11 @@
     public static class CellEditEvent<S,T> extends Event {
         private static final long serialVersionUID = -609964441682677579L;
 
+        /**
+         * Common supertype for all cell edit event types.
+         */
+        public static final EventType<?> ANY = EDIT_ANY_EVENT;
+
         // represents the new value input by the end user. This is NOT the value
         // to go back into the TableView.items list - this new value represents
         // just the input for a single cell, so it is likely that it needs to go
--- a/javafx-ui-controls/src/javafx/scene/control/TablePosition.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-controls/src/javafx/scene/control/TablePosition.java	Tue May 28 09:38:44 2013 -0700
@@ -25,7 +25,6 @@
 
 package javafx.scene.control;
 
-import com.sun.javafx.beans.annotations.NoBuilder;
 import java.lang.ref.WeakReference;
 
 /**
@@ -45,7 +44,6 @@
  * @see TableView
  * @see TableColumn
  */
-@NoBuilder
 public class TablePosition<S,T> extends TablePositionBase<TableColumn<S,T>> {
     
     /***************************************************************************
--- a/javafx-ui-controls/src/javafx/scene/control/TablePositionBase.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-controls/src/javafx/scene/control/TablePositionBase.java	Tue May 28 09:38:44 2013 -0700
@@ -25,7 +25,6 @@
 
 package javafx.scene.control;
 
-import com.sun.javafx.beans.annotations.NoBuilder;
 import java.lang.ref.WeakReference;
 
 /**
@@ -43,7 +42,6 @@
  * @see TablePosition
  * @see TreeTablePosition
  */
-@NoBuilder
 public abstract class TablePositionBase<TC extends TableColumnBase> {
     
     /***************************************************************************
--- a/javafx-ui-controls/src/javafx/scene/control/TextArea.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-controls/src/javafx/scene/control/TextArea.java	Tue May 28 09:38:44 2013 -0700
@@ -43,7 +43,6 @@
 import javafx.css.StyleableBooleanProperty;
 import javafx.css.StyleableIntegerProperty;
 import javafx.css.StyleableProperty;
-import com.sun.javafx.beans.annotations.DuplicateInBuilderProperties;
 import com.sun.javafx.binding.ExpressionHelper;
 import com.sun.javafx.collections.ListListenerHelper;
 import com.sun.javafx.collections.NonIterableChange;
@@ -67,7 +66,6 @@
  *
  * @see TextField
  */
-@DuplicateInBuilderProperties(properties = {"promptText"})
 public class TextArea extends TextInputControl {
     // Text area content model
     private static final class TextAreaContent implements Content {
--- a/javafx-ui-controls/src/javafx/scene/control/TextField.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-controls/src/javafx/scene/control/TextField.java	Tue May 28 09:38:44 2013 -0700
@@ -40,7 +40,6 @@
 import javafx.event.ActionEvent;
 import javafx.event.EventHandler;
 import javafx.geometry.Pos;
-import com.sun.javafx.beans.annotations.DuplicateInBuilderProperties;
 import com.sun.javafx.binding.ExpressionHelper;
 import com.sun.javafx.css.converters.EnumConverter;
 import com.sun.javafx.css.converters.SizeConverter;
@@ -64,7 +63,6 @@
  * 
  * @see TextArea
  */
-@DuplicateInBuilderProperties(properties = {"promptText"})
 public class TextField extends TextInputControl {
     // Text field content
     private static final class TextFieldContent implements Content {
--- a/javafx-ui-controls/src/javafx/scene/control/TreeItem.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-controls/src/javafx/scene/control/TreeItem.java	Tue May 28 09:38:44 2013 -0700
@@ -938,7 +938,12 @@
      */
     public static class TreeModificationEvent<T> extends Event {
         private static final long serialVersionUID = 4741889985221719579L;
-        
+
+        /**
+         * Common supertype for all tree modification event types.
+         */
+        public static final EventType<?> ANY = TREE_NOTIFICATION_EVENT;
+
         private transient final TreeItem<T> treeItem;
         private final T newValue;
 
--- a/javafx-ui-controls/src/javafx/scene/control/TreeTableColumn.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-controls/src/javafx/scene/control/TreeTableColumn.java	Tue May 28 09:38:44 2013 -0700
@@ -720,6 +720,11 @@
     public static class CellEditEvent<S,T> extends Event {
         private static final long serialVersionUID = -609964441682677579L;
 
+        /**
+         * Common supertype for all cell edit event types.
+         */
+        public static final EventType<?> ANY = EDIT_ANY_EVENT;
+
         // represents the new value input by the end user. This is NOT the value
         // to go back into the TableView.items list - this new value represents
         // just the input for a single cell, so it is likely that it needs to go
--- a/javafx-ui-controls/src/javafx/scene/control/TreeTablePosition.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-controls/src/javafx/scene/control/TreeTablePosition.java	Tue May 28 09:38:44 2013 -0700
@@ -25,7 +25,6 @@
 
 package javafx.scene.control;
 
-import com.sun.javafx.beans.annotations.NoBuilder;
 import java.lang.ref.WeakReference;
 
 /**
@@ -45,7 +44,6 @@
  * @see TreeTableView
  * @see TreeTableColumn
  */
-@NoBuilder
 public class TreeTablePosition<S,T> extends TablePositionBase<TreeTableColumn<S,T>> {
     
     /***************************************************************************
--- a/javafx-ui-controls/src/javafx/scene/control/TreeTableView.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-controls/src/javafx/scene/control/TreeTableView.java	Tue May 28 09:38:44 2013 -0700
@@ -1837,7 +1837,12 @@
      */
     public static class EditEvent<S> extends Event {
         private static final long serialVersionUID = -4437033058917528976L;
-        
+
+        /**
+         * Common supertype for all edit event types.
+         */
+        public static final EventType<?> ANY = EDIT_ANY_EVENT;
+
         private final S oldValue;
         private final S newValue;
         private transient final TreeItem<S> treeItem;
--- a/javafx-ui-controls/src/javafx/scene/control/TreeView.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-controls/src/javafx/scene/control/TreeView.java	Tue May 28 09:38:44 2013 -0700
@@ -852,7 +852,12 @@
      */
     public static class EditEvent<T> extends Event {
         private static final long serialVersionUID = -4437033058917528976L;
-        
+
+        /**
+         * Common supertype for all edit event types.
+         */
+        public static final EventType<?> ANY = EDIT_ANY_EVENT;
+
         private final T oldValue;
         private final T newValue;
         private transient final TreeItem<T> treeItem;
--- a/javafx-ui-controls/src/javafx/scene/control/cell/ProgressBarTableCell.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-controls/src/javafx/scene/control/cell/ProgressBarTableCell.java	Tue May 28 09:38:44 2013 -0700
@@ -25,7 +25,6 @@
 
 package javafx.scene.control.cell;
 
-import com.sun.javafx.beans.annotations.NoBuilder;
 import javafx.beans.value.ObservableValue;
 import javafx.scene.control.ProgressBar;
 import javafx.scene.control.TableCell;
@@ -39,7 +38,6 @@
  * @param <S> The type of the elements contained within the TableView.
  * @since 2.2
  */
-@NoBuilder // @NoBuilder because if the builder is generated, it does not compile
 public class ProgressBarTableCell<S> extends TableCell<S, Double> {
     
     /***************************************************************************
--- a/javafx-ui-controls/src/javafx/scene/control/cell/ProgressBarTreeTableCell.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-controls/src/javafx/scene/control/cell/ProgressBarTreeTableCell.java	Tue May 28 09:38:44 2013 -0700
@@ -25,7 +25,6 @@
 
 package javafx.scene.control.cell;
 
-import com.sun.javafx.beans.annotations.NoBuilder;
 import javafx.beans.value.ObservableValue;
 import javafx.scene.control.ProgressBar;
 import javafx.scene.control.TreeTableCell;
@@ -39,7 +38,6 @@
  * @param <S> The type of the elements contained within the TableView.
  * @since 8.0
  */
-@NoBuilder // @NoBuilder because if the builder is generated, it does not compile
 public class ProgressBarTreeTableCell<S> extends TreeTableCell<S, Double> {
     
     /***************************************************************************
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/test/javafx/scene/control/EventAnyTest.java	Tue May 28 09:38:44 2013 -0700
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javafx.scene.control;
+
+import java.util.Arrays;
+import java.util.Collection;
+import javafx.event.Event;
+import javafx.event.EventHandler;
+import javafx.event.EventType;
+import javafx.scene.Node;
+import javafx.scene.shape.Rectangle;
+import static org.junit.Assert.assertTrue;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import org.junit.Test;
+
+@RunWith(Parameterized.class)
+public class EventAnyTest {
+    @Parameters
+    public static Collection getParams() {
+        return Arrays.asList(new Object[][] {
+            { CheckBoxTreeItem.TreeModificationEvent.ANY, checkBoxTreeEvent(), Rectangle.class, true},
+            { CheckBoxTreeItem.TreeModificationEvent.ANY, listViewEditEvent(), Rectangle.class, false},
+            { ListView.EditEvent.ANY, listViewEditEvent(), ListView.class, true},
+            { ListView.EditEvent.ANY, checkBoxTreeEvent(), ListView.class, false},
+            { ScrollToEvent.ANY, scrollToEvent(), Rectangle.class, true},
+            { ScrollToEvent.ANY, listViewEditEvent(), Rectangle.class, false},
+            { SortEvent.ANY, sortEvent(), Rectangle.class, true},
+            { SortEvent.ANY, scrollToEvent(), Rectangle.class, false},
+            { TableColumn.CellEditEvent.ANY, tableColumnCellEditEvent(), Rectangle.class, true },
+            { TableColumn.CellEditEvent.ANY, listViewEditEvent(), Rectangle.class, false },
+            { TreeItem.TreeModificationEvent.ANY, treeItemModificationEvent(), Rectangle.class, true},
+            { TreeItem.TreeModificationEvent.ANY, checkBoxTreeEvent(), Rectangle.class, false},
+            { TreeTableColumn.CellEditEvent.ANY, treeTableColumnCellEditEvent(), Rectangle.class, true },
+            { TreeTableColumn.CellEditEvent.ANY, tableColumnCellEditEvent(), Rectangle.class, false },
+            { TreeTableView.EditEvent.ANY, treeTableViewEditEvent(), TreeTableView.class, true },
+            { TreeTableView.EditEvent.ANY, treeTableColumnCellEditEvent(), TreeTableView.class, false },
+            { TreeView.EditEvent.ANY, treeViewEditEvent(), TreeView.class, true },
+            { TreeView.EditEvent.ANY, treeTableViewEditEvent(), TreeView.class, false },
+        });
+    }
+
+    private boolean delivered;
+    private EventType type;
+    private Event event;
+    private Class target;
+    private boolean matches;
+
+    public EventAnyTest(EventType type, Event event, Class target, boolean matches) {
+        this.type = type;
+        this.event = event;
+        this.matches = matches;
+        this.target = target;
+    }
+
+    @Test
+    public void testEventDelivery() throws Exception {
+        Node n = (Node) target.newInstance();
+        delivered = false;
+
+        n.addEventHandler(type, new EventHandler() {
+            @Override public void handle(Event event) {
+                delivered = true;
+            }
+        });
+
+        Event.fireEvent(n, event);
+        assertTrue(matches == delivered);
+    }
+
+    private static Event checkBoxTreeEvent() {
+        return new CheckBoxTreeItem.TreeModificationEvent<>(
+                CheckBoxTreeItem.checkBoxSelectionChangedEvent(), null, true);
+
+    }
+
+    private static Event listViewEditEvent() {
+        return new ListView.EditEvent<String>(new ListView<String>(),
+                ListView.<String>editCommitEvent(), "", 1);
+    }
+
+    private static Event scrollToEvent() {
+        return new ScrollToEvent(null, null, ScrollToEvent.scrollToColumn(),
+                new ScrollPane());
+    }
+
+    private static Event sortEvent() {
+        return new SortEvent(null, null);
+    }
+
+    private static Event tableColumnCellEditEvent() {
+        TableView<String> tw = new TableView<String>();
+        return new TableColumn.CellEditEvent<String, String>(
+                tw, new TablePosition<String, String>(tw, 1, null),
+                TableColumn.<String, String>editCommitEvent(), "");
+
+    }
+
+    private static Event treeItemModificationEvent() {
+        return new TreeItem.TreeModificationEvent<>(
+                TreeItem.graphicChangedEvent(), null, true);
+
+    }
+
+    private static Event treeTableColumnCellEditEvent() {
+        TreeTableView<String> tw = new TreeTableView<String>();
+        return new TreeTableColumn.CellEditEvent<String, String>(
+                tw, new TreeTablePosition<String, String>(tw, 1, null),
+                TreeTableColumn.<String, String>editCommitEvent(), "");
+
+    }
+
+    private static Event treeTableViewEditEvent() {
+        TreeTableView<String> tw = new TreeTableView<String>();
+        return new TreeTableView.EditEvent<String>(
+                tw, TreeTableView.editCommitEvent(), null, "", "");
+    }
+
+    private static Event treeViewEditEvent() {
+        TreeView<String> tw = new TreeView<String>();
+        return new TreeView.EditEvent<String>(
+                tw, TreeView.editCommitEvent(), null, "", "");
+    }
+}
--- a/javafx-ui-quantum/src/com/sun/javafx/tk/quantum/AbstractPainter.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-quantum/src/com/sun/javafx/tk/quantum/AbstractPainter.java	Tue May 28 09:38:44 2013 -0700
@@ -43,7 +43,6 @@
 import com.sun.prism.Graphics;
 import com.sun.prism.GraphicsResource;
 import com.sun.prism.Presentable;
-import com.sun.prism.RenderingContext;
 import com.sun.prism.ResourceFactory;
 import com.sun.prism.camera.PrismPerspectiveCameraImpl;
 import com.sun.prism.impl.PrismSettings;
@@ -68,7 +67,6 @@
     protected SceneState sceneState;
 
     protected Presentable       presentable;
-    protected RenderingContext  context = null;
     protected ResourceFactory   factory;
 
     protected int               width;
--- a/javafx-ui-quantum/src/com/sun/javafx/tk/quantum/EmbeddedPainter.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-quantum/src/com/sun/javafx/tk/quantum/EmbeddedPainter.java	Tue May 28 09:38:44 2013 -0700
@@ -84,12 +84,9 @@
             return;
         }
 
-        context = factory.createRenderingContext(null);
         escene.sizeLock.lock();
         
         try {
-            context.begin();
-            
             if ((texture == null) || (escene.textureBits == null) || escene.needsReset) {
                 texture = factory.createRTTexture(escene.width, escene.height,
                                                   WrapMode.CLAMP_NOT_NEEDED);
@@ -116,7 +113,6 @@
             th.printStackTrace(System.err);
         } finally {
             Disposer.cleanUp();
-            context.end();
             escene.sizeLock.unlock();
         }
     }
--- a/javafx-ui-quantum/src/com/sun/javafx/tk/quantum/GlassWindowEventHandler.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-quantum/src/com/sun/javafx/tk/quantum/GlassWindowEventHandler.java	Tue May 28 09:38:44 2013 -0700
@@ -26,6 +26,7 @@
 package com.sun.javafx.tk.quantum;
 
 import com.sun.glass.events.WindowEvent;
+import com.sun.glass.ui.Application;
 import com.sun.glass.ui.Window;
 
 import com.sun.javafx.tk.FocusCause;
@@ -63,6 +64,18 @@
                 break;
             case WindowEvent.MOVE:
                 stage.stageListener.changedLocation(window.getX(), window.getY());
+                //We need to sync the new x,y for painting
+                if (!Application.GetApplication().hasWindowManager()) {
+                    AbstractPainter.renderLock.lock();
+                    try { 
+                        GlassScene scene = stage.getScene();
+                        if (scene != null) {
+                            scene.updateSceneState();
+                        }
+                    } finally { 
+                        AbstractPainter.renderLock.unlock(); 
+                    }
+                }
                 break;
             case WindowEvent.RESIZE:
                 stage.stageListener.changedSize(window.getWidth(), window.getHeight());
--- a/javafx-ui-quantum/src/com/sun/javafx/tk/quantum/PresentingPainter.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-quantum/src/com/sun/javafx/tk/quantum/PresentingPainter.java	Tue May 28 09:38:44 2013 -0700
@@ -47,7 +47,6 @@
 
         try {
             valid = validateStageGraphics();
-
             if (!valid) {
                 if (QuantumToolkit.verbose) {
                     System.err.println("PresentingPainter: validateStageGraphics failed");
@@ -62,20 +61,13 @@
             sceneState.lock();
             locked = true;
 
-            boolean needsReset = (presentable == null) || (penWidth != viewWidth) || (penHeight != viewHeight);
-            if (!needsReset && presentable.lockResources()) {
-                needsReset=true;
+            boolean needsReset = (presentable == null) ||
+                                 (penWidth != viewWidth) || (penHeight != viewHeight);
+            if (presentable != null) {
+                needsReset = presentable.lockResources() || needsReset;
             }
             if (needsReset) {
                 if (presentable == null || presentable.recreateOnResize()) {
-                    context = factory.createRenderingContext(sceneState);
-                }
-            }
-            
-            context.begin();
-            
-            if (needsReset) {
-                if (presentable == null || presentable.recreateOnResize()) {
                     disposePresentable();
                     presentable = factory.createPresentable(sceneState);
                     needsReset = false;
@@ -112,9 +104,8 @@
         } catch (Throwable th) {
             th.printStackTrace(System.err);
         } finally {
-            if (valid && context != null) {
+            if (valid) {
                 Disposer.cleanUp();
-                context.end();
             }
             if (locked) {
                 sceneState.unlock();
--- a/javafx-ui-quantum/src/com/sun/javafx/tk/quantum/QuantumToolkit.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-quantum/src/com/sun/javafx/tk/quantum/QuantumToolkit.java	Tue May 28 09:38:44 2013 -0700
@@ -144,7 +144,6 @@
 import com.sun.prism.GraphicsPipeline;
 import com.sun.prism.PixelFormat;
 import com.sun.prism.RTTexture;
-import com.sun.prism.RenderingContext;
 import com.sun.prism.ResourceFactory;
 import com.sun.prism.ResourceFactoryListener;
 import com.sun.prism.Texture.WrapMode;
@@ -1557,11 +1556,7 @@
                     return;
                 }
 
-                RenderingContext context = rf.createRenderingContext(null);
                 try {
-
-                    context.begin();
-
                     QuantumImage pImage = (params.platformImage instanceof QuantumImage) ?
                             (QuantumImage)params.platformImage : new QuantumImage(null);
 
@@ -1599,7 +1594,6 @@
                     t.printStackTrace(System.err);
                 } finally {
                     Disposer.cleanUp();
-                    context.end();
                 }
             }
         });
--- a/javafx-ui-quantum/src/com/sun/javafx/tk/quantum/UploadingPainter.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-quantum/src/com/sun/javafx/tk/quantum/UploadingPainter.java	Tue May 28 09:38:44 2013 -0700
@@ -96,16 +96,9 @@
             }
 
             if (needsReset) {
-                context = factory.createRenderingContext(null);
-            }
-            
-            context.begin();
-            
-            if (needsReset) {
                 disposeRTTexture();
                 rttexture = factory.createRTTexture(viewWidth, viewHeight, WrapMode.CLAMP_NOT_NEEDED);
                 if (rttexture == null) {
-                    context.end();
                     return;
                 }
                 penWidth    = viewWidth;
@@ -170,9 +163,8 @@
         } catch (Throwable th) {
             th.printStackTrace(System.err);
         } finally {
-            if (valid && context != null) {
+            if (valid) {
                 Disposer.cleanUp();
-                context.end();            
             }
             if (locked) {
                 sceneState.unlock();
--- a/javafx-ui-quantum/src/com/sun/javafx/tk/quantum/WindowStage.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-ui-quantum/src/com/sun/javafx/tk/quantum/WindowStage.java	Tue May 28 09:38:44 2013 -0700
@@ -375,14 +375,15 @@
         if (!visible) {
             removeActiveWindow(this);
             if (modality == Modality.WINDOW_MODAL) {
-                assert (owner != null);
-                ((WindowStage) owner).setEnabled(true);
+                if (owner != null && owner instanceof WindowStage) {
+                    ((WindowStage) owner).setEnabled(true);
+                }
             } else if (modality == Modality.APPLICATION_MODAL) {
                 windowsSetEnabled(true);
             } else {
                 // Note: This method is required to workaround a glass issue
                 // mentioned in RT-12607
-                if (owner != null) {
+                if (owner != null && owner instanceof WindowStage) {
                     WindowStage ownerStage = (WindowStage)owner;
                     ownerStage.requestToFront();
                 }
@@ -403,8 +404,9 @@
         // other windows.
         if (visible) {
             if (modality == Modality.WINDOW_MODAL) {
-                assert (owner != null);
-                ((WindowStage) owner).setEnabled(false);
+                if (owner != null && owner instanceof WindowStage) {
+                    ((WindowStage) owner).setEnabled(false);
+                }
             } else if (modality == Modality.APPLICATION_MODAL) {
                 windowsSetEnabled(false);
             }
--- a/javafx-ui-quantum/test/com/sun/javafx/tk/quantum/RT17588Test.java	Thu May 23 17:10:40 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.javafx.tk.quantum;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import javafx.application.Application;
-import javafx.application.Platform;
-import javafx.stage.FileChooser;
-import javafx.stage.Modality;
-import javafx.stage.Stage;
-
-import com.sun.javafx.PlatformUtil;
-
-import org.junit.Assume;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import static org.junit.Assert.*;
-
-public class RT17588Test extends Application {
-
-    /**
-     * @param args the command line arguments
-     */
-    @BeforeClass public static void prepare() {
-        String[] args = null;
-        
-        /* 
-         * This test hangs on Mac
-         */
-        Assume.assumeTrue(PlatformUtil.isWindows());
-
-        launch(args);
-    }
-    
-    private Stage stage, newStage;
-    
-    @Test public void testModalFileChooser() {
-        try {
-            stage.show();
-            final Stage newStage = new Stage();
-            newStage.initModality(Modality.NONE);
-            newStage.initOwner(stage);
-            newStage.show();
-            
-            final FileChooser fc = new FileChooser();        
-            
-            Thread t = new Thread(new Runnable() {
-                public void run(){
-                    try {
-                        Thread.sleep(1000);
-                    } catch (InterruptedException ex) {
-                        Logger.getLogger(RT17588Test.class.getName()).log(Level.SEVERE, null, ex);
-                    }
-                    Platform.runLater(new Runnable() {
-                        public void run() {
-                            try {
-                                Thread.sleep(2000);
-                            } catch (InterruptedException ex) {
-                                Logger.getLogger(RT17588Test.class.getName()).log(Level.SEVERE, null, ex);
-                            }
-                            stage.hide();
-                            newStage.hide();
-                        }
-                    });
-                }
-            });
-            t.start();
-            
-            fc.showOpenDialog(newStage);
-            
-        } catch (Throwable th) {
-            th.printStackTrace();
-            fail(th.getMessage());
-        }
-    }
-                 
-    @Override
-    public void start(final Stage st) throws Exception {
-        stage = st;
-        testModalFileChooser();
-    }
-    
-}
--- a/javafx-util-converter/src/javafx/util/converter/BigDecimalStringConverter.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-util-converter/src/javafx/util/converter/BigDecimalStringConverter.java	Tue May 28 09:38:44 2013 -0700
@@ -25,14 +25,12 @@
 
 package javafx.util.converter;
 
-import com.sun.javafx.beans.annotations.NoBuilder;
 import java.math.BigDecimal;
 import javafx.util.StringConverter;
 
 /**
  * <p>{@link StringConverter} implementation for {@link BigDecimal} values.</p>
  */
-@NoBuilder
 public class BigDecimalStringConverter extends StringConverter<BigDecimal> {
     
     /** {@inheritDoc} */
--- a/javafx-util-converter/src/javafx/util/converter/BigIntegerStringConverter.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-util-converter/src/javafx/util/converter/BigIntegerStringConverter.java	Tue May 28 09:38:44 2013 -0700
@@ -25,14 +25,12 @@
 
 package javafx.util.converter;
 
-import com.sun.javafx.beans.annotations.NoBuilder;
 import java.math.BigInteger;
 import javafx.util.StringConverter;
 
 /**
  * <p>{@link StringConverter} implementation for {@link BigInteger} values.</p>
  */
-@NoBuilder
 public class BigIntegerStringConverter extends StringConverter<BigInteger> {
     /** {@inheritDoc} */
     @Override public BigInteger fromString(String value) {
--- a/javafx-util-converter/src/javafx/util/converter/BooleanStringConverter.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-util-converter/src/javafx/util/converter/BooleanStringConverter.java	Tue May 28 09:38:44 2013 -0700
@@ -25,14 +25,12 @@
 
 package javafx.util.converter;
 
-import com.sun.javafx.beans.annotations.NoBuilder;
 import javafx.util.StringConverter;
 
 /**
  * <p>{@link StringConverter} implementation for {@link Boolean}
  * (and boolean primitive) values.</p>
  */
-@NoBuilder
 public class BooleanStringConverter extends StringConverter<Boolean> {
     /** {@inheritDoc} */
     @Override public Boolean fromString(String value) {
--- a/javafx-util-converter/src/javafx/util/converter/ByteStringConverter.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-util-converter/src/javafx/util/converter/ByteStringConverter.java	Tue May 28 09:38:44 2013 -0700
@@ -25,14 +25,12 @@
 
 package javafx.util.converter;
 
-import com.sun.javafx.beans.annotations.NoBuilder;
 import javafx.util.StringConverter;
 
 /**
  * <p>{@link StringConverter} implementation for {@link Byte}
  * (and byte primitive) values.</p>
  */
-@NoBuilder
 public class ByteStringConverter extends StringConverter<Byte> {
     /** {@inheritDoc} */
     @Override public Byte fromString(String value) {
--- a/javafx-util-converter/src/javafx/util/converter/CharacterStringConverter.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-util-converter/src/javafx/util/converter/CharacterStringConverter.java	Tue May 28 09:38:44 2013 -0700
@@ -25,14 +25,12 @@
 
 package javafx.util.converter;
 
-import com.sun.javafx.beans.annotations.NoBuilder;
 import javafx.util.StringConverter;
 
 /**
  * <p>{@link StringConverter} implementation for {@link Character}
  * (and char primitive) values.</p>
  */
-@NoBuilder
 public class CharacterStringConverter extends StringConverter<Character> {
     /** {@inheritDoc} */
     @Override public Character fromString(String value) {
--- a/javafx-util-converter/src/javafx/util/converter/CurrencyStringConverter.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-util-converter/src/javafx/util/converter/CurrencyStringConverter.java	Tue May 28 09:38:44 2013 -0700
@@ -25,7 +25,6 @@
 
 package javafx.util.converter;
 
-import com.sun.javafx.beans.annotations.NoBuilder;
 import java.text.DecimalFormat;
 import java.text.DecimalFormatSymbols;
 import java.text.NumberFormat;
@@ -40,7 +39,6 @@
  * @see NumberStringConverter
  * @see StringConverter
  */
-@NoBuilder
 public class CurrencyStringConverter extends NumberStringConverter {
     
     // ------------------------------------------------------------ Constructors
--- a/javafx-util-converter/src/javafx/util/converter/DateStringConverter.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-util-converter/src/javafx/util/converter/DateStringConverter.java	Tue May 28 09:38:44 2013 -0700
@@ -25,7 +25,6 @@
 
 package javafx.util.converter;
 
-import com.sun.javafx.beans.annotations.NoBuilder;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
@@ -38,7 +37,6 @@
  * @see TimeStringConverter
  * @see DateTimeStringConverter
  */
-@NoBuilder
 public class DateStringConverter extends DateTimeStringConverter {
     
     // ------------------------------------------------------------ Constructors
--- a/javafx-util-converter/src/javafx/util/converter/DateTimeStringConverter.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-util-converter/src/javafx/util/converter/DateTimeStringConverter.java	Tue May 28 09:38:44 2013 -0700
@@ -25,7 +25,6 @@
 
 package javafx.util.converter;
 
-import com.sun.javafx.beans.annotations.NoBuilder;
 import java.text.DateFormat;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
@@ -40,7 +39,6 @@
  * @see DateStringConverter
  * @see TimeStringConverter
  */
-@NoBuilder
 public class DateTimeStringConverter extends StringConverter<Date> {
     
     // ------------------------------------------------------ Private properties
--- a/javafx-util-converter/src/javafx/util/converter/DefaultStringConverter.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-util-converter/src/javafx/util/converter/DefaultStringConverter.java	Tue May 28 09:38:44 2013 -0700
@@ -25,13 +25,11 @@
 
 package javafx.util.converter;
 
-import com.sun.javafx.beans.annotations.NoBuilder;
 import javafx.util.StringConverter;
 
 /**
  * <p>{@link StringConverter} implementation for {@link String} values.</p>
  */
-@NoBuilder
 public class DefaultStringConverter extends StringConverter<String> {
     /** {@inheritDoc} */
     @Override public String toString(String value) {
--- a/javafx-util-converter/src/javafx/util/converter/DoubleStringConverter.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-util-converter/src/javafx/util/converter/DoubleStringConverter.java	Tue May 28 09:38:44 2013 -0700
@@ -25,14 +25,12 @@
 
 package javafx.util.converter;
 
-import com.sun.javafx.beans.annotations.NoBuilder;
 import javafx.util.StringConverter;
 
 /**
  * <p>{@link StringConverter} implementation for {@link Double}
  * (and double primitive) values.</p>
  */
-@NoBuilder
 public class DoubleStringConverter extends StringConverter<Double> {
     /** {@inheritDoc} */
     @Override public Double fromString(String value) {
--- a/javafx-util-converter/src/javafx/util/converter/FloatStringConverter.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-util-converter/src/javafx/util/converter/FloatStringConverter.java	Tue May 28 09:38:44 2013 -0700
@@ -25,14 +25,12 @@
 
 package javafx.util.converter;
 
-import com.sun.javafx.beans.annotations.NoBuilder;
 import javafx.util.StringConverter;
 
 /**
  * <p>{@link StringConverter} implementation for {@link Float}
  * (and float primitive) values.</p>
  */
-@NoBuilder
 public class FloatStringConverter extends StringConverter<Float> {
     /** {@inheritDoc} */
     @Override public Float fromString(String value) {
--- a/javafx-util-converter/src/javafx/util/converter/FormatStringConverter.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-util-converter/src/javafx/util/converter/FormatStringConverter.java	Tue May 28 09:38:44 2013 -0700
@@ -25,7 +25,6 @@
 
 package javafx.util.converter;
 
-import com.sun.javafx.beans.annotations.NoBuilder;
 import java.text.*;
 import javafx.util.StringConverter;
 
@@ -35,7 +34,6 @@
  *
  * @since 2.2
  */
-@NoBuilder
 public class FormatStringConverter<T> extends StringConverter<T> {
     
     // ------------------------------------------------------ Private properties
--- a/javafx-util-converter/src/javafx/util/converter/IntegerStringConverter.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-util-converter/src/javafx/util/converter/IntegerStringConverter.java	Tue May 28 09:38:44 2013 -0700
@@ -25,14 +25,12 @@
 
 package javafx.util.converter;
 
-import com.sun.javafx.beans.annotations.NoBuilder;
 import javafx.util.StringConverter;
 
 /**
  * <p>{@link StringConverter} implementation for {@link Integer}
  * (and int primitive) values.</p>
  */
-@NoBuilder
 public class IntegerStringConverter extends StringConverter<Integer> {
     /** {@inheritDoc} */
     @Override public Integer fromString(String value) {
--- a/javafx-util-converter/src/javafx/util/converter/LongStringConverter.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-util-converter/src/javafx/util/converter/LongStringConverter.java	Tue May 28 09:38:44 2013 -0700
@@ -25,14 +25,12 @@
 
 package javafx.util.converter;
 
-import com.sun.javafx.beans.annotations.NoBuilder;
 import javafx.util.StringConverter;
 
 /**
  * <p>{@link StringConverter} implementation for {@link Long}
  * (and long primitive) values.</p>
  */
-@NoBuilder
 public class LongStringConverter extends StringConverter<Long> {
     /** {@inheritDoc} */
     @Override public Long fromString(String value) {
--- a/javafx-util-converter/src/javafx/util/converter/NumberStringConverter.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-util-converter/src/javafx/util/converter/NumberStringConverter.java	Tue May 28 09:38:44 2013 -0700
@@ -25,7 +25,6 @@
 
 package javafx.util.converter;
 
-import com.sun.javafx.beans.annotations.NoBuilder;
 import java.text.DecimalFormat;
 import java.text.DecimalFormatSymbols;
 import java.text.NumberFormat;
@@ -36,7 +35,6 @@
 /**
  * <p>{@link StringConverter} implementation for {@link Number} values.</p>
  */
-@NoBuilder
 public class NumberStringConverter extends StringConverter<Number> {
     
     // ------------------------------------------------------ Private properties
--- a/javafx-util-converter/src/javafx/util/converter/PercentageStringConverter.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-util-converter/src/javafx/util/converter/PercentageStringConverter.java	Tue May 28 09:38:44 2013 -0700
@@ -25,7 +25,6 @@
 
 package javafx.util.converter;
 
-import com.sun.javafx.beans.annotations.NoBuilder;
 import java.text.NumberFormat;
 import java.util.Locale;
 import javafx.util.StringConverter;
@@ -38,7 +37,6 @@
  * @see NumberStringConverter
  * @see StringConverter
  */
-@NoBuilder
 public class PercentageStringConverter extends NumberStringConverter {
     
     
--- a/javafx-util-converter/src/javafx/util/converter/ShortStringConverter.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-util-converter/src/javafx/util/converter/ShortStringConverter.java	Tue May 28 09:38:44 2013 -0700
@@ -25,13 +25,11 @@
 
 package javafx.util.converter;
 
-import com.sun.javafx.beans.annotations.NoBuilder;
 import javafx.util.StringConverter;
 
 /**
  * <p>{@link StringConverter} implementation for {@link Short} values.</p>
  */
-@NoBuilder
 public class ShortStringConverter extends StringConverter<Short> {
     /** {@inheritDoc} */
     @Override public Short fromString(String text) {
--- a/javafx-util-converter/src/javafx/util/converter/TimeStringConverter.java	Thu May 23 17:10:40 2013 -0700
+++ b/javafx-util-converter/src/javafx/util/converter/TimeStringConverter.java	Tue May 28 09:38:44 2013 -0700
@@ -25,7 +25,6 @@
 
 package javafx.util.converter;
 
-import com.sun.javafx.beans.annotations.NoBuilder;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
@@ -39,7 +38,6 @@
  * @see DateStringConverter
  * @see DateTimeStringConverter
  */
-@NoBuilder
 public class TimeStringConverter extends DateTimeStringConverter {
     
     // ------------------------------------------------------------ Constructors
--- a/prism-common/build-common.xml	Thu May 23 17:10:40 2013 -0700
+++ b/prism-common/build-common.xml	Tue May 28 09:38:44 2013 -0700
@@ -26,7 +26,10 @@
   <target name="get-libname-windows" if="isWindows">
     <property name="native.lib.file" value="prism-common.dll"/>
   </target>
-  <target name="get-libname" depends="get-libname-macosx,get-libname-android,get-libname-linux,get-libname-solaris,get-libname-windows"/>
+  <target name="get-libname-ios" if="isIOS">
+    <property name="native.lib.file" value="prism-common.a"/>
+  </target>
+  <target name="get-libname" depends="get-libname-macosx,get-libname-android,get-libname-linux,get-libname-solaris,get-libname-windows,get-libname-ios"/>
 
   <target name="-local-pre-init" depends="get-libname"/>
 
--- a/prism-common/build-ios.xml	Thu May 23 17:10:40 2013 -0700
+++ b/prism-common/build-ios.xml	Tue May 28 09:38:44 2013 -0700
@@ -2,11 +2,9 @@
 <project name="prism-common" default="all" basedir=".">
 
   <target name="compile-native">
-    <delete dir="${native.build.dir}"/>
-    
     <exec executable="make" dir="../prism-common-native" failonerror="true">
       <arg value="DIST_DIR=${native.dist.dir}"/>
-      <arg value="BUILD_DIR=${native.build.dir}"/>
+      <arg value="BUILD_DIR=${native.build.dir}/armv7"/>
       <arg value="PRISM_COM_CP=${prismcom.classes.dir}"/>
       <arg value="JDK_HOME=${platform.home}"/>
       <arg value="IS_IOS=true"/>
@@ -16,12 +14,10 @@
       <arg value="CONF=${build.conf}"/>
       <arg value="all"/>
     </exec>
-    
-    <delete dir="${native.build.dir}"/>
-    
+
     <exec executable="make" dir="../prism-common-native" failonerror="true">
       <arg value="DIST_DIR=${native.dist.dir}"/>
-      <arg value="BUILD_DIR=${native.build.dir}"/>
+      <arg value="BUILD_DIR=${native.build.dir}/i386"/>
       <arg value="PRISM_COM_CP=${prismcom.classes.dir}"/>
       <arg value="JDK_HOME=${platform.home}"/>
       <arg value="IS_IOS=true"/>
--- a/prism-common/src/com/sun/prism/MultiTexture.java	Thu May 23 17:10:40 2013 -0700
+++ b/prism-common/src/com/sun/prism/MultiTexture.java	Tue May 28 09:38:44 2013 -0700
@@ -77,6 +77,7 @@
                 if (wrapMode != WrapMode.REPEAT) {
                     return null;
                 }
+                break;
             default:
                 return null;
         }
--- a/prism-common/src/com/sun/prism/RenderingContext.java	Thu May 23 17:10:40 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.prism;
-
-public interface RenderingContext {
-
-    public void begin();
-
-    public void end();
-}
--- a/prism-common/src/com/sun/prism/ResourceFactory.java	Thu May 23 17:10:40 2013 -0700
+++ b/prism-common/src/com/sun/prism/ResourceFactory.java	Tue May 28 09:38:44 2013 -0700
@@ -166,15 +166,6 @@
     public void addFactoryListener(ResourceFactoryListener l);
     public void removeFactoryListener(ResourceFactoryListener l);
 
-    /**
-     * Returns a rendering context associated with the specified PresentableState.
-     * If view is null, then this method returns an offscreen rendering context.
-     *
-     * @param view the view to construct rendering context. if view is null,
-     *             then the rendering context is in offscreen mode.
-     */
-    public RenderingContext createRenderingContext(PresentableState pState);
-
     public void dispose();
     
     /*
--- a/prism-common/src/com/sun/prism/camera/PrismCameraImpl.java	Thu May 23 17:10:40 2013 -0700
+++ b/prism-common/src/com/sun/prism/camera/PrismCameraImpl.java	Tue May 28 09:38:44 2013 -0700
@@ -45,8 +45,8 @@
     protected double viewWidth = 1.0;
     protected double viewHeight = 1.0;
     
-    private double zNear = 0.1;
-    private double zFar = 100.0;
+    protected double zNear = 0.1;
+    protected double zFar = 100.0;
 
     // Camera position in world coord.
     private Vec3d worldPosition = new Vec3d();
--- a/prism-common/src/com/sun/prism/camera/PrismParallelCameraImpl.java	Thu May 23 17:10:40 2013 -0700
+++ b/prism-common/src/com/sun/prism/camera/PrismParallelCameraImpl.java	Tue May 28 09:38:44 2013 -0700
@@ -36,6 +36,7 @@
 
     @Override
     public PickRay computePickRay(float x, float y, PickRay pickRay) {
-        return PickRay.computeParallelPickRay(x, y, worldTransform, pickRay);
+        return PickRay.computeParallelPickRay(x, y, worldTransform, zNear, zFar,
+                pickRay);
     }
 }
--- a/prism-common/src/com/sun/prism/camera/PrismPerspectiveCameraImpl.java	Thu May 23 17:10:40 2013 -0700
+++ b/prism-common/src/com/sun/prism/camera/PrismPerspectiveCameraImpl.java	Tue May 28 09:38:44 2013 -0700
@@ -58,6 +58,7 @@
     public PickRay computePickRay(float x, float y, PickRay pickRay) {
         return PickRay.computePerspectivePickRay(x, y, fixedEyeAtCameraZero, 
                 viewWidth, viewHeight, fov, verticalFieldOfView, worldTransform,
+                zNear, zFar,
                 pickRay);
     }
 
--- a/prism-common/src/com/sun/prism/impl/BaseMesh.java	Thu May 23 17:10:40 2013 -0700
+++ b/prism-common/src/com/sun/prism/impl/BaseMesh.java	Tue May 28 09:38:44 2013 -0700
@@ -115,15 +115,15 @@
         }
     }
 
-    void copyIndices(int pi[]) {
+    void copyIndices(short pi[]) {
         int nf = meshNormal.getNumFaces();
         int face[] = new int[3];
         int index = 0;
         for (int i = 0; i != nf; ++i) {
             face = meshNormal.getFace(i, face);
-            pi[index++] = face[0];
-            pi[index++] = face[1];
-            pi[index++] = face[2];
+            pi[index++] = (short) face[0];
+            pi[index++] = (short) face[1];
+            pi[index++] = (short) face[2];
         }
     }
 
@@ -142,9 +142,9 @@
         return vertexBuffer;
     }
 
-    final protected int[] getIndexGM() {
+    final protected short[] getIndexGM() {
         int numIndices = getNIndicesGM();
-        int indexBuffer[] = new int[numIndices];
+        short indexBuffer[] = new short[numIndices];
         copyIndices(indexBuffer);
         return indexBuffer;
     }
--- a/prism-common/src/com/sun/prism/impl/BaseRenderingContext.java	Thu May 23 17:10:40 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.prism.impl;
-
-import com.sun.prism.RenderingContext;
-
-public class BaseRenderingContext implements RenderingContext {
-
-    public void begin() {
-    }
-
-    public void end() {
-    }
-}
--- a/prism-common/src/com/sun/prism/impl/BaseResourceFactory.java	Thu May 23 17:10:40 2013 -0700
+++ b/prism-common/src/com/sun/prism/impl/BaseResourceFactory.java	Tue May 28 09:38:44 2013 -0700
@@ -152,7 +152,7 @@
                         // the contents are useful, but for completeness we
                         // will register both references as "useful"
                         tex.contentsUseful();
-                        texCache.put(image, othertex);
+                        texCache.put(image, tex);
                     }
                 }
                 othertex.unlock();
--- a/prism-common/src/com/sun/prism/impl/BaseTexture.java	Thu May 23 17:10:40 2013 -0700
+++ b/prism-common/src/com/sun/prism/impl/BaseTexture.java	Tue May 28 09:38:44 2013 -0700
@@ -140,6 +140,7 @@
                 if (wrapMode != WrapMode.REPEAT) {
                     return null;
                 }
+                break;
             default:
                 return null;
         }
--- a/prism-common/src/com/sun/prism/impl/PrismTrace.java	Thu May 23 17:10:40 2013 -0700
+++ b/prism-common/src/com/sun/prism/impl/PrismTrace.java	Tue May 28 09:38:44 2013 -0700
@@ -25,8 +25,6 @@
 
 package com.sun.prism.impl;
 
-import com.sun.prism.RenderingContext;
-
 import java.util.HashMap;
 import java.util.Map;
 
@@ -132,16 +130,6 @@
             summary(SummaryType.TYPE_ALL));
     }
 
-    public static void checkRenderingContext(RenderingContext targetRenderingContext,
-            RenderingContext currentRenderingContext) {
-        if (!enabled) return;
-
-        if (targetRenderingContext == null || targetRenderingContext != currentRenderingContext) {
-            System.out.println("RT accessed from the wrong context");
-            Thread.dumpStack();
-        }
-    }
-
     private PrismTrace() {
     }
 }
--- a/prism-d3d-native/src/D3DContext.cc	Thu May 23 17:10:40 2013 -0700
+++ b/prism-d3d-native/src/D3DContext.cc	Tue May 28 09:38:44 2013 -0700
@@ -209,15 +209,15 @@
  * Signature: (JJ[F[I)Z
  */
 JNIEXPORT jboolean JNICALL Java_com_sun_prism_d3d_D3DContext_nBuildNativeGeometry
-  (JNIEnv *env, jclass, jlong ctx, jlong nativeMesh, jfloatArray vb, jintArray ib)
+  (JNIEnv *env, jclass, jlong ctx, jlong nativeMesh, jfloatArray vb, jshortArray ib)
 {
     TraceLn(NWT_TRACE_INFO, "D3DContext_nBuildNativeGeometry");
     D3DMesh *mesh = (D3DMesh *) jlong_to_ptr(nativeMesh);
 
     UINT vertexBufferSize = env->GetArrayLength(vb);
-    float *vertexBuffer = (jfloat*) (env->GetPrimitiveArrayCritical(vb, NULL));
+    float *vertexBuffer = (float *) (env->GetPrimitiveArrayCritical(vb, NULL));
     UINT indexBufferSize = env->GetArrayLength(ib);
-    UINT *indexBuffer = (UINT*) (env->GetPrimitiveArrayCritical(ib, NULL));
+    USHORT *indexBuffer = (USHORT *) (env->GetPrimitiveArrayCritical(ib, NULL));
 
     boolean result = mesh->buildBuffers(vertexBuffer, vertexBufferSize,
             indexBuffer, indexBufferSize);
--- a/prism-d3d-native/src/D3DMesh.cc	Thu May 23 17:10:40 2013 -0700
+++ b/prism-d3d-native/src/D3DMesh.cc	Tue May 28 09:38:44 2013 -0700
@@ -32,21 +32,9 @@
 // Destructor definition
 
 D3DMesh::~D3DMesh() {
-    //    cout << "@@@ D3DMesh Destructor called." << endl;
-    if (indexBuffer) {
-        ULONG status = indexBuffer->Release();
-        //        cout << " - Release indexBuffer: status = " << status << endl;
-        if (status == 0L) {
-            indexBuffer = NULL;
-        }
-    }
-    if (vertexBuffer) {
-        ULONG status = vertexBuffer->Release();
-        //        cout << " - Release vertexBuffer: status = " << status << endl;
-        if (status == 0L) {
-            vertexBuffer = NULL;
-        }
-    }
+//    cout << "@@@ D3DMesh Destructor called." << endl;
+    releaseIndexBuffer();
+    releaseVertexBuffer();
     context = NULL;
 }
 
@@ -90,17 +78,44 @@
 
 }
 
-boolean D3DMesh::buildBuffers(float *vb, UINT vbSize, UINT *ib, UINT ibSize) {
+void D3DMesh::releaseIndexBuffer() {
+    if (indexBuffer) {
+        ULONG status = indexBuffer->Release();
+//        cout << " - Release indexBuffer: status = " << status << endl;
+        if (status == 0L) {
+            indexBuffer = NULL;
+        }
+    }
+    numIndices = 0;
+}
+
+void D3DMesh::releaseVertexBuffer() {
+    if (vertexBuffer) {
+        ULONG status = vertexBuffer->Release();
+//        cout << " - Release vertexBuffer: status = " << status << endl;
+        if (status == 0L) {
+            vertexBuffer = NULL;
+        }
+    }
+    numVertices = 0;
+}
+
+boolean D3DMesh::buildBuffers(float *vb, UINT vbSize, USHORT *ib, UINT ibSize) {
 //    cout << "D3DMesh::buildBuffers: vertexBufferSize = " << vbSize
 //            << ", indexBufferSize = " << ibSize << endl;
 
     IDirect3DDevice9 *device = context->Get3DDevice();
     UINT size = vbSize * sizeof (float);
+    HRESULT result = D3D_OK;
 
-    HRESULT result = device->CreateVertexBuffer(size, D3DUSAGE_WRITEONLY, fvf,
-            D3DPOOL_DEFAULT, &vertexBuffer, NULL);
+    if (numVertices != vbSize) {
+        releaseVertexBuffer();
+        result = device->CreateVertexBuffer(size, D3DUSAGE_WRITEONLY, fvf,
+                D3DPOOL_DEFAULT, &vertexBuffer, NULL);
+        numVertices = vbSize;
+    }
 
-    if (SUCCEEDED(result)) {
+    if (SUCCEEDED(result) && (vertexBuffer != NULL)) {
         float *data;
         result = vertexBuffer->Lock(0, size, (void **) &data, 0);
         if (SUCCEEDED(result)) {
@@ -109,24 +124,24 @@
         }
     }
 //    printResult("D3DMesh.buildBuffers: VertexBuffer's result = ", result);
+    size = ibSize * sizeof (USHORT);
 
-    if (SUCCEEDED(result)) {
-        size = ibSize * sizeof (UINT);
+    if (SUCCEEDED(result) && (numIndices != ibSize)) {
+        releaseIndexBuffer();
         result = device->CreateIndexBuffer(size, D3DUSAGE_WRITEONLY,
-                sizeof (UINT) == 2 ? D3DFMT_INDEX16 : sizeof (UINT) == 4 ? D3DFMT_INDEX32 : D3DFMT_UNKNOWN,
-                D3DPOOL_DEFAULT, &indexBuffer, NULL);
+                D3DFMT_INDEX16, D3DPOOL_DEFAULT, &indexBuffer, NULL);
+        numIndices = ibSize;
+    }
+
+    if (SUCCEEDED(result) && (indexBuffer != NULL)) {
+        USHORT *data;
+                result = indexBuffer->Lock(0, size, (void **) &data, 0);
         if (SUCCEEDED(result)) {
-            int *data;
-            result = indexBuffer->Lock(0, size, (void **) &data, 0);
-            if (SUCCEEDED(result)) {
-                memcpy_s(data, size, ib, size);
-                result = indexBuffer->Unlock();
-            }
+            memcpy_s(data, size, ib, size);
+            result = indexBuffer->Unlock();
         }
     }
 //    printResult("D3DMesh.buildBuffers: IndexBuffer's result = ", result);
-    numVertices = vbSize;
-    numIndices = ibSize;
     return SUCCEEDED(result);
 
 }
--- a/prism-d3d-native/src/D3DMesh.h	Thu May 23 17:10:40 2013 -0700
+++ b/prism-d3d-native/src/D3DMesh.h	Tue May 28 09:38:44 2013 -0700
@@ -40,7 +40,7 @@
     D3DMesh(D3DContext *pCtx);
     virtual ~D3DMesh();
     boolean buildBuffers(float *vertexBuffer, UINT vertexBufferSize,
-            UINT *indexBuffer, UINT indexBufferSize);
+            USHORT *indexBuffer, UINT indexBufferSize);
     DWORD getVertexFVF();
     IDirect3DIndexBuffer9 *getIndexBuffer();
     IDirect3DVertexBuffer9 *getVertexBuffer();
@@ -55,6 +55,8 @@
     UINT numVertices;
     UINT numIndices;
 
+    void releaseIndexBuffer();
+    void releaseVertexBuffer();
 };
 
 #endif  /* D3DMESH_H */
--- a/prism-d3d/src/com/sun/prism/d3d/D3DContext.java	Thu May 23 17:10:40 2013 -0700
+++ b/prism-d3d/src/com/sun/prism/d3d/D3DContext.java	Tue May 28 09:38:44 2013 -0700
@@ -358,7 +358,7 @@
     private static native long nCreateD3DMesh(long pContext);
     private static native void nReleaseD3DMesh(long pContext, long nativeHandle);
     private static native boolean nBuildNativeGeometry(long pContext, long nativeHandle,
-            float vertexBuffer[], int indexBuffer[]);
+            float vertexBuffer[], short indexBuffer[]);
     private static native long nCreateD3DPhongMaterial(long pContext);
     private static native void nReleaseD3DPhongMaterial(long pContext, long nativeHandle);
     private static native void nSetSolidColor(long pContext, long nativePhongMaterial,
@@ -424,7 +424,7 @@
     }
 
     boolean buildNativeGeometry(long nativeHandle, float vertexBuffer[],
-            int indexBuffer[]) {
+            short indexBuffer[]) {
         return nBuildNativeGeometry(pContext, nativeHandle, vertexBuffer, indexBuffer);
     }
 
--- a/prism-d3d/src/com/sun/prism/d3d/D3DMesh.java	Thu May 23 17:10:40 2013 -0700
+++ b/prism-d3d/src/com/sun/prism/d3d/D3DMesh.java	Tue May 28 09:38:44 2013 -0700
@@ -66,7 +66,7 @@
     @Override
     public boolean buildNativeGeometry() {
         float vertexBuffer[] = getVertsGM();
-        int indexBuffer[] = getIndexGM();
+        short indexBuffer[] = getIndexGM();
         return context.buildNativeGeometry(nativeHandle, vertexBuffer, indexBuffer);
 
     }
--- a/prism-d3d/src/com/sun/prism/d3d/D3DResourceFactory.java	Thu May 23 17:10:40 2013 -0700
+++ b/prism-d3d/src/com/sun/prism/d3d/D3DResourceFactory.java	Tue May 28 09:38:44 2013 -0700
@@ -49,14 +49,12 @@
 import com.sun.prism.Presentable;
 import com.sun.prism.PresentableState;
 import com.sun.prism.Texture;
-import com.sun.prism.RenderingContext;
 import com.sun.prism.Texture.Usage;
 import com.sun.prism.Texture.WrapMode;
 import com.sun.prism.d3d.D3DResource.D3DRecord;
 import com.sun.prism.impl.PrismSettings;
 import com.sun.prism.impl.VertexBuffer;
 import com.sun.prism.impl.ps.BaseShaderFactory;
-import com.sun.prism.impl.BaseRenderingContext;
 import com.sun.prism.impl.TextureResourcePool;
 import com.sun.prism.ps.Shader;
 import com.sun.prism.ps.ShaderFactory;
@@ -392,18 +390,6 @@
         }
     }
 
-    /**
-     * Returns dummy implementation of the RenderingContext interface.
-     *
-     * @param pState the PresentableState from which to construct a rendering
-     * context. if pState is null, then the rendering context is in offscreen
-     * mode.
-     */
-    @Override
-    public RenderingContext createRenderingContext(PresentableState pState) {
-        return new BaseRenderingContext();
-    }
-
     @Override
     public void dispose() {
         throw new UnsupportedOperationException("Not supported yet.");
--- a/prism-es2-native/src/GLContext.c	Thu May 23 17:10:40 2013 -0700
+++ b/prism-es2-native/src/GLContext.c	Tue May 28 09:38:44 2013 -0700
@@ -1643,7 +1643,7 @@
 {
     MeshInfo *meshInfo = NULL;
     ContextInfo *ctxInfo = (ContextInfo *) jlong_to_ptr(nativeCtxInfo);
-    if (ctxInfo == NULL) {
+    if ((ctxInfo == NULL) || (ctxInfo->glGenBuffers == NULL)) {
         return 0;
     }
 
@@ -1654,10 +1654,14 @@
         return 0;
     }
 
-    /* initialize the structure */
+    /* initialize the structure */    
     meshInfo->vboIDArray[MESH_VERTEXBUFFER] = 0;
     meshInfo->vboIDArray[MESH_INDEXBUFFER] = 0;
     meshInfo->indexBufferSize = 0;
+
+    /* create vbo ids */
+    ctxInfo->glGenBuffers(MESH_MAX_BUFFERS, (meshInfo->vboIDArray));
+
     return ptr_to_jlong(meshInfo);
 }
 
@@ -1689,11 +1693,11 @@
  */
 JNIEXPORT jboolean JNICALL Java_com_sun_prism_es2_GLContext_nBuildNativeGeometry
   (JNIEnv *env, jclass class, jlong nativeCtxInfo, jlong nativeMeshInfo,
-        jfloatArray vbArray, jintArray ibArray)
+        jfloatArray vbArray, jshortArray ibArray)
 {
     GLuint vertexBufferSize;
     GLuint indexBufferSize;
-    GLuint *indexBuffer;
+    GLushort *indexBuffer;
     GLfloat *vertexBuffer;
     jboolean status = JNI_TRUE;
 
@@ -1702,7 +1706,9 @@
     if ((ctxInfo == NULL) || (meshInfo == NULL) ||
             (vbArray == NULL) || (ibArray == NULL) ||
             (ctxInfo->glBindBuffer == NULL) ||
-            (ctxInfo->glBufferData == NULL) || (ctxInfo->glGenBuffers == NULL)) {
+            (ctxInfo->glBufferData == NULL) ||
+            (meshInfo->vboIDArray[MESH_VERTEXBUFFER] == 0)||
+            (meshInfo->vboIDArray[MESH_INDEXBUFFER] == 0)) {
         return JNI_FALSE;
     }
 
@@ -1710,7 +1716,7 @@
     vertexBuffer = (GLfloat *) ((*env)->GetPrimitiveArrayCritical(env, vbArray, NULL));
 
     indexBufferSize = (*env)->GetArrayLength(env, ibArray);
-    indexBuffer = (GLuint *) ((*env)->GetPrimitiveArrayCritical(env, ibArray, NULL));
+    indexBuffer = (GLushort *) ((*env)->GetPrimitiveArrayCritical(env, ibArray, NULL));
 
     if ((vertexBuffer == NULL ) || (vertexBufferSize == 0)
             || (indexBuffer == NULL) || (indexBufferSize == 0)) {
@@ -1718,25 +1724,20 @@
     }
 
     if (status) {
-        ctxInfo->glGenBuffers(MESH_MAX_BUFFERS, (meshInfo->vboIDArray));
+        // Initialize vertex buffer
+        ctxInfo->glBindBuffer(GL_ARRAY_BUFFER, meshInfo->vboIDArray[MESH_VERTEXBUFFER]);
+        ctxInfo->glBufferData(GL_ARRAY_BUFFER, vertexBufferSize * sizeof (GLfloat),
+                vertexBuffer, GL_STATIC_DRAW);
 
-        status = meshInfo->vboIDArray[MESH_VERTEXBUFFER] && meshInfo->vboIDArray[MESH_INDEXBUFFER];
-        if (status) {
-            // Initialize vertex buffer
-            ctxInfo->glBindBuffer(GL_ARRAY_BUFFER, meshInfo->vboIDArray[MESH_VERTEXBUFFER]);
-            ctxInfo->glBufferData(GL_ARRAY_BUFFER, vertexBufferSize * sizeof (GLfloat),
-                    vertexBuffer, GL_STATIC_DRAW);
+        // Initialize index buffer
+        ctxInfo->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, meshInfo->vboIDArray[MESH_INDEXBUFFER]);
+        ctxInfo->glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexBufferSize * sizeof (GLushort),
+                indexBuffer, GL_STATIC_DRAW);
+        meshInfo->indexBufferSize = indexBufferSize;
 
-            // Initialize index buffer
-            ctxInfo->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, meshInfo->vboIDArray[MESH_INDEXBUFFER]);
-            ctxInfo->glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexBufferSize * sizeof (GLuint),
-                    indexBuffer, GL_STATIC_DRAW);
-            meshInfo->indexBufferSize = indexBufferSize;
-
-            // Unbind VBOs
-            ctxInfo->glBindBuffer(GL_ARRAY_BUFFER, 0);
-            ctxInfo->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
-        }
+        // Unbind VBOs
+        ctxInfo->glBindBuffer(GL_ARRAY_BUFFER, 0);
+        ctxInfo->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
     }
 
     if (indexBuffer) {
@@ -2091,7 +2092,7 @@
             VERT_3D_STRIDE, (const void*) offset);
 
     glDrawElements(GL_TRIANGLES, mvInfo->meshInfo->indexBufferSize,
-            GL_UNSIGNED_INT, 0);
+            GL_UNSIGNED_SHORT, 0);
 
     // Reset states
     ctxInfo->glDisableVertexAttribArray(VC_3D_INDEX);
--- a/prism-es2/build-common.xml	Thu May 23 17:10:40 2013 -0700
+++ b/prism-es2/build-common.xml	Tue May 28 09:38:44 2013 -0700
@@ -29,7 +29,7 @@
   </target>
   <target name="get-libname" depends="get-libname-macosx,get-libname-android,get-libname-ios,get-libname-linux,get-libname-solaris,get-libname-windows"/>
 
-  <target name="-pre-init" depends="get-libname">
+  <target name="-local-pre-init" depends="get-libname">
     <mkdir dir="build/gensrc"/>
   </target>
 
@@ -64,7 +64,7 @@
         </build-project>
   </target>
 
-  <target name="build-native" depends="init">
+  <target name="build-native" depends="-local-pre-init,init">
         <antcall target="compile-native"/>
         <jar destfile="${dist.dir}/prism-es2-native.jar"
            basedir="${native.dist.dir}"
--- a/prism-es2/build-ios.xml	Thu May 23 17:10:40 2013 -0700
+++ b/prism-es2/build-ios.xml	Tue May 28 09:38:44 2013 -0700
@@ -1,16 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project name="prism-es2" default="all" basedir=".">
 
-  <condition property="ios.version" value="5.1">
-    <not>
-      <isset property="${ios.version}"/>
-    </not>
-  </condition>
-
   <target name="compile-native">
     <exec executable="make" dir="../prism-es2-native" failonerror="true">
       <arg value="DIST_DIR=${native.dist.dir}"/>
-      <arg value="BUILD_DIR=${native.build.dir}"/>
+      <arg value="BUILD_DIR=${native.build.dir}/armv7"/>
       <arg value="PRISM-ES2_CP=${prism-es2.classes.dir}"/>
       <arg value="JDK_HOME=${platform.home}"/>
       <arg value="IS_IOS=true"/>
@@ -23,7 +17,7 @@
 
     <exec executable="make" dir="../prism-es2-native" failonerror="true">
       <arg value="DIST_DIR=${native.dist.dir}"/>
-      <arg value="BUILD_DIR=${native.build.dir}"/>
+      <arg value="BUILD_DIR=${native.build.dir}/i386"/>
       <arg value="PRISM-ES2_CP=${prism-es2.classes.dir}"/>
       <arg value="JDK_HOME=${platform.home}"/>
       <arg value="IS_IOS=true"/>
--- a/prism-es2/src/com/sun/prism/es2/ES2Context.java	Thu May 23 17:10:40 2013 -0700
+++ b/prism-es2/src/com/sun/prism/es2/ES2Context.java	Tue May 28 09:38:44 2013 -0700
@@ -66,7 +66,6 @@
     private int quadIndices;
     // The drawable that is current to the glContext
     private GLDrawable currentDrawable = null;
-    private ES2RenderingContext currentRenderingContext = null;
     private int indexBuffer = 0;
     private int shaderProgram;
 
@@ -117,10 +116,6 @@
         return glContext;
     }
 
-    GLDrawable getDummyDrawable() {
-        return dummyGLDrawable;
-    }
-
     GLPixelFormat getPixelFormat() {
         return pixelFormat;
     }
@@ -129,24 +124,14 @@
         return ES2PhongShader.getShader(meshView, this);
     }
 
-    void setCurrentRenderingContext(ES2RenderingContext rc, GLDrawable drawable) {
-        if ((rc != null) && (drawable == null)) {
-            System.err.println("Warning: ES2Context.setCurrentRenderingContext: "
-                    + "rc = " + rc + ", drawable = " + drawable);
-        }
-        currentRenderingContext = rc;
-        makeCurrent(drawable);
-     }
-
-    ES2RenderingContext getCurrentRenderingContext() {
-        return currentRenderingContext;
-    }
-
     // JIRA: RT-21738
     // TODO: If we can't resolve this platform specific treatment code
     // by 3.0, we need to refactor it to platform specific project
     private int savedFBO = 0;
-    private void makeCurrent(GLDrawable drawable) {
+    void makeCurrent(GLDrawable drawable) {
+        if (drawable == null) {
+            drawable = dummyGLDrawable;
+        }
         if (PlatformUtil.isMac() || PlatformUtil.isIOS()) {
             if (drawable != currentDrawable) {
                 if (drawable == dummyGLDrawable) {
@@ -411,7 +396,7 @@
         glContext.releaseES2Mesh(nativeHandle);
     }
 
-    boolean buildNativeGeometry(long nativeHandle, float[] vertexBuffer, int[] indexBuffer) {
+    boolean buildNativeGeometry(long nativeHandle, float[] vertexBuffer, short[] indexBuffer) {
         return glContext.buildNativeGeometry(nativeHandle, vertexBuffer, indexBuffer);
     }
 
--- a/prism-es2/src/com/sun/prism/es2/ES2Mesh.java	Thu May 23 17:10:40 2013 -0700
+++ b/prism-es2/src/com/sun/prism/es2/ES2Mesh.java	Tue May 28 09:38:44 2013 -0700
@@ -66,7 +66,7 @@
     @Override
     public boolean buildNativeGeometry() {
         float vertexBuffer[] = getVertsGM();
-        int indexBuffer[] = getIndexGM();
+        short indexBuffer[] = getIndexGM();
         return context.buildNativeGeometry(nativeHandle, vertexBuffer, indexBuffer);
 
     }
--- a/prism-es2/src/com/sun/prism/es2/ES2PhongShader.java	Thu May 23 17:10:40 2013 -0700
+++ b/prism-es2/src/com/sun/prism/es2/ES2PhongShader.java	Tue May 28 09:38:44 2013 -0700
@@ -153,12 +153,13 @@
         ES2Shader shader = shaders[diffuseState.ordinal()][specularState.ordinal()]
                 [selfIllumState.ordinal()][bumpState.ordinal()][numLights];
         if (shader == null) {
+            String fragShader = lightingShaderParts[numLights].replace("vec4 apply_diffuse();", diffuseShaderParts[diffuseState.ordinal()]);
+            fragShader = fragShader.replace("vec4 apply_specular();", SpecularShaderParts[specularState.ordinal()]);
+            fragShader = fragShader.replace("vec3 apply_normal();", normalMapShaderParts[bumpState.ordinal()]);
+            fragShader = fragShader.replace("vec4 apply_selfIllum();", selfIllumShaderParts[selfIllumState.ordinal()]);
+                  
             String[] pixelShaders = new String[]{
-                diffuseShaderParts[diffuseState.ordinal()],
-                SpecularShaderParts[specularState.ordinal()],
-                selfIllumShaderParts[selfIllumState.ordinal()],
-                normalMapShaderParts[bumpState.ordinal()],
-                lightingShaderParts[numLights]
+                fragShader
             };
 
             //TODO: 3D - should be done in state checking?
@@ -190,10 +191,10 @@
                 material.diffuseColor.getGreen(), material.diffuseColor.getBlue(),
                 material.diffuseColor.getAlpha());
 
-        context.updateTexture(ES2PhongMaterial.DIFFUSE, material.maps[ES2PhongMaterial.DIFFUSE].getTexture());
-        context.updateTexture(ES2PhongMaterial.SPECULAR, material.maps[ES2PhongMaterial.SPECULAR].getTexture());
-        context.updateTexture(ES2PhongMaterial.BUMP, material.maps[ES2PhongMaterial.BUMP].getTexture());
-        context.updateTexture(ES2PhongMaterial.SELF_ILLUM, material.maps[ES2PhongMaterial.SELF_ILLUM].getTexture());
+        context.updateTexture(0, material.maps[ES2PhongMaterial.DIFFUSE].getTexture());
+        context.updateTexture(1, material.maps[ES2PhongMaterial.SPECULAR].getTexture());
+        context.updateTexture(2, material.maps[ES2PhongMaterial.BUMP].getTexture());
+        context.updateTexture(3, material.maps[ES2PhongMaterial.SELF_ILLUM].getTexture());
 
         shader.setConstant("ambientColor", meshView.getAmbientLightRed(),
                 meshView.getAmbientLightGreen(), meshView.getAmbientLightBlue());
--- a/prism-es2/src/com/sun/prism/es2/ES2RenderingContext.java	Thu May 23 17:10:40 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.prism.es2;
-
-import com.sun.prism.PresentableState;
-import com.sun.prism.impl.BaseRenderingContext;
-
-public class ES2RenderingContext extends BaseRenderingContext {
-
-    private final ES2Context context;
-    private final GLDrawable drawable;
-
-    ES2RenderingContext(ES2Context context, PresentableState pState) {
-        this.context = context;
-        if (pState != null) {
-            long nativeWindow = pState.getNativeWindow();
-            drawable = ES2Pipeline.glFactory.createGLDrawable(nativeWindow,
-                    context.getPixelFormat());
-        } else {
-            drawable = context.getDummyDrawable();
-        }
-    }
-
-    /**
-     * Makes the rendering context current.
-     */
-    @Override
-    public void begin() {
-        context.setCurrentRenderingContext(this, drawable);
-    }
-
-    /**
-     * Releases the rendering context and restores the previously
-     * current rendering context.
-     */
-    @Override
-    public void end() {
-        context.setCurrentRenderingContext(null, context.getDummyDrawable());
-    }
-
-    GLDrawable getDrawable() {
-        return drawable;
-    }
-    }
--- a/prism-es2/src/com/sun/prism/es2/ES2ResourceFactory.java	Thu May 23 17:10:40 2013 -0700
+++ b/prism-es2/src/com/sun/prism/es2/ES2ResourceFactory.java	Tue May 28 09:38:44 2013 -0700
@@ -25,7 +25,6 @@
 
 package com.sun.prism.es2;
 
-import com.sun.prism.RenderingContext;
 import java.io.InputStream;
 import java.util.Map;
 
@@ -269,19 +268,6 @@
         return new VertexBuffer(maxQuads);
     }
 
-    /**
-     * Returns a rendering context associated with the specified PresentableState.
-     * If PresentableState is null, then this method returns an offscreen
-     * rendering context.
-     *
-     * @param pState the PresentableState from which to construct a rendering
-     * context. if pState is null, then the rendering context is in offscreen
-     * mode.
-     */
-    public RenderingContext createRenderingContext(PresentableState pState) {
-        return new ES2RenderingContext(context, pState);
-    }
-
     public void dispose() {
         throw new UnsupportedOperationException("Not supported yet.");
     }
--- a/prism-es2/src/com/sun/prism/es2/ES2SwapChain.java	Thu May 23 17:10:40 2013 -0700
+++ b/prism-es2/src/com/sun/prism/es2/ES2SwapChain.java	Tue May 28 09:38:44 2013 -0700
@@ -102,6 +102,12 @@
         this.pixelScaleFactor = PrismSettings.allowHiDPIScaling
                                 ? pState.getScale() //TODO fix getScale
                                 : 1.0f;
+        drawable = null;
+        if (pState != null) {
+            long nativeWindow = pState.getNativeWindow();
+            drawable = ES2Pipeline.glFactory.createGLDrawable(
+                    nativeWindow, context.getPixelFormat());
+        }
     }
 
     public boolean lockResources() {
@@ -137,8 +143,7 @@
                 }
                 stableBackbuffer.unlock();
             }
-            drawable = context.getCurrentRenderingContext().getDrawable();
-            return (drawable != null);
+            return drawable != null;
         } catch (Throwable th) {
             if (PrismSettings.verbose) {
                 th.printStackTrace();
@@ -168,10 +173,14 @@
     }
 
     public boolean present() {
-        return drawable.swapBuffers(context.getGLContext());
+        boolean presented = drawable.swapBuffers(context.getGLContext());
+        context.makeCurrent(null);
+        return presented;
     }
 
     public ES2Graphics createGraphics() {
+        context.makeCurrent(drawable);
+
         GLContext glContext = context.getGLContext();
         nativeDestHandle = glContext.getBoundFBO();
 
--- a/prism-es2/src/com/sun/prism/es2/GLContext.java	Thu May 23 17:10:40 2013 -0700
+++ b/prism-es2/src/com/sun/prism/es2/GLContext.java	Tue May 28 09:38:44 2013 -0700
@@ -207,7 +207,7 @@
     private static native long nCreateES2Mesh(long nativeCtxInfo);
     private static native void nReleaseES2Mesh(long nativeCtxInfo, long nativeHandle);
     private static native boolean nBuildNativeGeometry(long nativeCtxInfo, long nativeHandle,
-            float vertexBuffer[], int indexBuffer[]);
+            float vertexBuffer[], short indexBuffer[]);
     private static native long nCreateES2PhongMaterial(long nativeCtxInfo);
     private static native void nReleaseES2PhongMaterial(long nativeCtxInfo, long nativeHandle);
     private static native void nSetSolidColor(long nativeCtxInfo, long nativePhongMaterial,
@@ -647,7 +647,7 @@
         nReleaseES2Mesh(nativeCtxInfo, nativeHandle);
     }
 
-    boolean buildNativeGeometry(long nativeHandle, float[] vertexBuffer, int[] indexBuffer) {
+    boolean buildNativeGeometry(long nativeHandle, float[] vertexBuffer, short[] indexBuffer) {
         // See MeshVbIb.h : ctor()
         return nBuildNativeGeometry(nativeCtxInfo, nativeHandle, vertexBuffer, indexBuffer);
     }
--- a/prism-es2/src/com/sun/prism/es2/glsl/diffuse_color.frag	Thu May 23 17:10:40 2013 -0700
+++ b/prism-es2/src/com/sun/prism/es2/glsl/diffuse_color.frag	Tue May 28 09:38:44 2013 -0700
@@ -24,10 +24,13 @@
  */
 
 // diffuse color fragment shader
-
+/*not used
 uniform vec4 diffuseColor;
 uniform sampler2D diffuseTexture;
 
+varying vec2 oTexCoords;
+
 vec4 apply_diffuse() {
     return diffuseColor;
 }
+*/
\ No newline at end of file
--- a/prism-es2/src/com/sun/prism/es2/glsl/diffuse_none.frag	Thu May 23 17:10:40 2013 -0700
+++ b/prism-es2/src/com/sun/prism/es2/glsl/diffuse_none.frag	Tue May 28 09:38:44 2013 -0700
@@ -24,11 +24,13 @@
  */
 
 // diffuse fragment shader
-#version 120
+//#version 120
 
 uniform vec4 diffuseColor;
 uniform sampler2D diffuseTexture;
 
+varying vec2 oTexCoords;
+
 vec4 apply_diffuse() {
     return vec4(0);
 }
--- a/prism-es2/src/com/sun/prism/es2/glsl/diffuse_texture.frag	Thu May 23 17:10:40 2013 -0700
+++ b/prism-es2/src/com/sun/prism/es2/glsl/diffuse_texture.frag	Tue May 28 09:38:44 2013 -0700
@@ -24,13 +24,14 @@
  */
 
 // main fragment shader
-#version 120
+//#version 120
 
 uniform vec4 diffuseColor;
 uniform sampler2D diffuseTexture;
 
+varying vec2 oTexCoords;
+
 vec4 apply_diffuse() {
-    vec4 dTexColor = texture2D(diffuseTexture, gl_TexCoord[0].xy);
+    vec4 dTexColor = texture2D(diffuseTexture, oTexCoords);
     return dTexColor * diffuseColor; 
-}
-
+}
\ No newline at end of file
--- a/prism-es2/src/com/sun/prism/es2/glsl/main.vert	Thu May 23 17:10:40 2013 -0700
+++ b/prism-es2/src/com/sun/prism/es2/glsl/main.vert	Tue May 28 09:38:44 2013 -0700
@@ -23,15 +23,14 @@
  * questions.
  */
 
-// main vertex shader
-//TODO: 3D - Don't calculate everything if we do not have to
-#version 120
-
 uniform mat4 viewProjectionMatrix;
 uniform mat4 worldMatrix;
 uniform vec3 camPos;
-uniform vec4 ambientColor;
-//float4      gAmbientData[10] : register (c20);
+uniform vec3 ambientColor;
+
+attribute vec3 pos;
+attribute vec2 texCoords;
+attribute vec4 tangent;
 
 struct Light {
     vec4 pos;
@@ -39,36 +38,11 @@
 };
 
 //3 lights used
-
 uniform Light lights[3];
 
-attribute vec3 pos;
-attribute vec2 texCoords;
-attribute vec4 tangent;
-
+varying vec4 lightTangentSpacePositions[3];
+varying vec2 oTexCoords;
 varying vec3 eyePos;
-varying vec3 localBump;
-varying vec4[3] lightTangentSpacePositions;
-
-vec3[3] quatToMatrix(vec4 q) {
-    vec3 t1 = q.xyz * q.yzx *2;
-    vec3 t2 = q.zxy * q.www *2;
-    vec3 t3 = q.xyz * q.xyz *2;
-    vec3 t4 = 1-(t3+t3.yzx);
-
-    vec3 r1 = t1 + t2;
-    vec3 r2 = t1 - t2;
-
-    vec3 tangentFrame[3];
-
-    tangentFrame[0] = vec3(t4.y, r1.x, r2.z);
-    tangentFrame[1] = vec3(r2.x, t4.z, r1.y);
-    tangentFrame[2] = vec3(r1.z, r2.y, t4.x);
-
-    tangentFrame[2] *= (q.w>=0) ? 1 : -1;   // ATI normal map generator compatibility???
-
-    return tangentFrame;
-}
 
 vec3 getLocalVector(vec3 global, vec3 tangentFrame[3]) {
     return vec3( dot(global,tangentFrame[1]), dot(global,tangentFrame[2]), dot(global,tangentFrame[0]) );
@@ -76,32 +50,48 @@
 
 void main()
 {
-    vec3 tangentFrame[3];
+    vec3 tangentFrame[3];    
 
     vec4 worldPos = worldMatrix * vec4(pos, 1.0);
 
-    //Generate the tangent frame matrix by treating the tangent
-    //normal as a quaternion and converting it.
-    tangentFrame = quatToMatrix(tangent);
+    vec3 t1 = tangent.xyz * tangent.yzx *2.0;
+    vec3 t2 = tangent.zxy * tangent.www *2.0;
+    vec3 t3 = tangent.xyz * tangent.xyz *2.0;
+    vec3 t4 = 1.0-(t3+t3.yzx);
 
+    vec3 r1 = t1 + t2;
+    vec3 r2 = t1 - t2;
+
+    tangentFrame[0] = vec3(t4.y, r1.x, r2.z);
+    tangentFrame[1] = vec3(r2.x, t4.z, r1.y);
+    tangentFrame[2] = vec3(r1.z, r2.y, t4.x);
+    tangentFrame[2] *= (tangent.w>=0.0) ? 1.0 : -1.0;
+    
+    mat3 sWorldMatrix = mat3(worldMatrix[0].xyz, 
+    	 	      	     worldMatrix[1].xyz, 
+			     worldMatrix[2].xyz);
+    
     //Translate the tangent frame to world space.
-    for (int i=0; i!=3; ++i) {
-        tangentFrame[i] = mat3x3(worldMatrix) * tangentFrame[i];
-    }
+    tangentFrame[0] = sWorldMatrix * tangentFrame[0];
+    tangentFrame[1] = sWorldMatrix * tangentFrame[1];
+    tangentFrame[2] = sWorldMatrix * tangentFrame[2];
+   
+    vec3 Eye = camPos - worldPos.xyz;
+    
+    eyePos = getLocalVector(Eye, tangentFrame);
+   
+    vec3 L = lights[0].pos.xyz - worldPos.xyz;
+    lightTangentSpacePositions[0] = vec4( getLocalVector(L,tangentFrame)*lights[0].pos.w, 1.0);
 
-    //Get the eye vector into world tangent space.
-    vec3 Eye = camPos - worldPos.xyz;
-    eyePos = getLocalVector(Eye, tangentFrame);
+    L = lights[1].pos.xyz - worldPos.xyz;
+    lightTangentSpacePositions[1] = vec4( getLocalVector(L,tangentFrame)*lights[1].pos.w, 1.0);
 
-    //For Each light, calculate its LightToVertex vector and translate it into tangent space
-    for (int k=0; k<3; ++k) {
-        vec3 L = lights[k].pos.xyz - worldPos.xyz;
-        lightTangentSpacePositions[k] = vec4( getLocalVector(L,tangentFrame)*lights[k].pos.w, 1);
-    }
+    L = lights[2].pos.xyz - worldPos.xyz;
+    lightTangentSpacePositions[2] = vec4( getLocalVector(L,tangentFrame)*lights[2].pos.w, 1.0);
 
     mat4 mvpMatrix = viewProjectionMatrix * worldMatrix;
 
     //Send texcoords to Pixel Shader and calculate vertex position.
-    gl_TexCoord[0].xy = texCoords;
+    oTexCoords = texCoords;
     gl_Position = mvpMatrix * vec4(pos,1.0);
 }
--- a/prism-es2/src/com/sun/prism/es2/glsl/main0Lights.frag	Thu May 23 17:10:40 2013 -0700
+++ b/prism-es2/src/com/sun/prism/es2/glsl/main0Lights.frag	Tue May 28 09:38:44 2013 -0700
@@ -24,26 +24,14 @@
  */
 
 // main fragment shader
-#version 120
+//#version 120
 
 vec4 apply_diffuse();
-vec4 apply_specular();
 vec4 apply_selfIllum();
 
-struct Light {
-    vec4 pos;
-    vec3 color;
-};
-
-uniform mat4 viewProjectionMatrix;
-uniform mat4 worldMatrix;
-uniform vec3 camPos;
 uniform vec3 ambientColor;
-uniform Light lights[3];
 
 varying vec3 eyePos;
-varying vec3 localBump;
-varying vec4[3] lightTangentSpacePositions;
 
 void main()
 {
@@ -54,4 +42,4 @@
     rez += apply_selfIllum().xyz;
 
     gl_FragColor = vec4(clamp(rez, 0.0, 1.0) , diffuse.a);
-}
+}
\ No newline at end of file
--- a/prism-es2/src/com/sun/prism/es2/glsl/main1Light.frag	Thu May 23 17:10:40 2013 -0700
+++ b/prism-es2/src/com/sun/prism/es2/glsl/main1Light.frag	Tue May 28 09:38:44 2013 -0700
@@ -24,7 +24,7 @@
  */
 
 // main fragment shader
-#version 120
+//#version 120
 
 vec4 apply_diffuse();
 vec4 apply_specular();
@@ -36,15 +36,11 @@
     vec3 color;
 };
 
-uniform mat4 viewProjectionMatrix;
-uniform mat4 worldMatrix;
-uniform vec3 camPos;
 uniform vec3 ambientColor;
 uniform Light lights[3];
 
 varying vec3 eyePos;
-varying vec3 localBump;
-varying vec4[3] lightTangentSpacePositions;
+varying vec4 lightTangentSpacePositions[3];
 
 void main()
 {
@@ -53,19 +49,19 @@
 
     vec3 n = apply_normal();
 
-    vec3 d = vec3(0);
-    vec3 s = vec3(0);
+    vec3 d = vec3(0.0);
+    vec3 s = vec3(0.0);
 
     vec3 refl = reflect(normalize(eyePos), n);
     vec4 specular = apply_specular();
-    float power = specular.a * 32 + 1;
+    float power = specular.a * 32.0 + 1.0;
 
     vec3 l = normalize(lightTangentSpacePositions[0].xyz);
-    d = clamp(dot(n,l), 0.0, 1.0) * lights[0].color.rgb;
-    s = pow(clamp(dot(-refl, l), 0.0, 1.0), power) * lights[0].color.rgb;
+    d = clamp(dot(n,l), 0.0, 1.0)*(lights[0].color).rgb;
+    s = pow(clamp(dot(-refl, l), 0.0, 1.0), power)*lights[0].color.rgb;
 
-    vec3 rez = (ambientColor+d)*diffuse.xyz + s*specular.rgb;
+    vec3 rez = (ambientColor+d) * diffuse.xyz + s*specular.rgb;
     rez += apply_selfIllum().xyz;
 
     gl_FragColor = vec4(clamp(rez, 0.0, 1.0) , diffuse.a);
-}
+}
\ No newline at end of file
--- a/prism-es2/src/com/sun/prism/es2/glsl/main2Lights.frag	Thu May 23 17:10:40 2013 -0700
+++ b/prism-es2/src/com/sun/prism/es2/glsl/main2Lights.frag	Tue May 28 09:38:44 2013 -0700
@@ -24,7 +24,6 @@
  */
 
 // main fragment shader
-#version 120
 
 vec4 apply_diffuse();
 vec4 apply_specular();
@@ -36,15 +35,11 @@
     vec3 color;
 };
 
-uniform mat4 viewProjectionMatrix;
-uniform mat4 worldMatrix;
-uniform vec3 camPos;
 uniform vec3 ambientColor;
 uniform Light lights[3];
 
 varying vec3 eyePos;
-varying vec3 localBump;
-varying vec4[3] lightTangentSpacePositions;
+varying vec4 lightTangentSpacePositions[3];
 
 void main()
 {
@@ -53,16 +48,16 @@
 
     vec3 n = apply_normal();
 
-    vec3 d = vec3(0);
-    vec3 s = vec3(0);
+    vec3 d = vec3(0.0);
+    vec3 s = vec3(0.0);
 
     vec3 refl = reflect(normalize(eyePos), n);
     vec4 specular = apply_specular();
-    float power = specular.a * 32 + 1;
+    float power = specular.a * 32.0 + 1.0;
 
     vec3 l = normalize(lightTangentSpacePositions[0].xyz);
-    d += clamp(dot(n,l), 0.0, 1.0)*(lights[0].color).rgb;
-    s += pow(clamp(dot(-refl, l), 0.0, 1.0), power)*lights[0].color.rgb;
+    d = clamp(dot(n,l), 0.0, 1.0)*(lights[0].color).rgb;
+    s = pow(clamp(dot(-refl, l), 0.0, 1.0), power)*lights[0].color.rgb;
 
     l = normalize(lightTangentSpacePositions[1].xyz);
     d += clamp(dot(n,l), 0.0, 1.0)*(lights[1].color).rgb;
--- a/prism-es2/src/com/sun/prism/es2/glsl/main3Lights.frag	Thu May 23 17:10:40 2013 -0700
+++ b/prism-es2/src/com/sun/prism/es2/glsl/main3Lights.frag	Tue May 28 09:38:44 2013 -0700
@@ -24,7 +24,7 @@
  */
 
 // main fragment shader
-#version 120
+//#version 120
 
 vec4 apply_diffuse();
 vec4 apply_specular();
@@ -36,15 +36,11 @@
     vec3 color;
 };
 
-uniform mat4 viewProjectionMatrix;
-uniform mat4 worldMatrix;
-uniform vec3 camPos;
 uniform vec3 ambientColor;
 uniform Light lights[3];
 
 varying vec3 eyePos;
-varying vec3 localBump;
-varying vec4[3] lightTangentSpacePositions;
+varying vec4 lightTangentSpacePositions[3];
 
 void main()
 {
@@ -53,16 +49,16 @@
 
     vec3 n = apply_normal();
 
-    vec3 d = vec3(0);
-    vec3 s = vec3(0);
+    vec3 d = vec3(0.0);
+    vec3 s = vec3(0.0);
 
     vec3 refl = reflect(normalize(eyePos), n);
     vec4 specular = apply_specular();
-    float power = specular.a * 32 + 1;
+    float power = specular.a * 32.0 + 1.0;
 
     vec3 l = normalize(lightTangentSpacePositions[0].xyz);
-    d += clamp(dot(n,l), 0.0, 1.0)*(lights[0].color).rgb;
-    s += pow(clamp(dot(-refl, l), 0.0, 1.0), power) * lights[0].color.rgb;
+    d = clamp(dot(n,l), 0.0, 1.0)*(lights[0].color).rgb;
+    s = pow(clamp(dot(-refl, l), 0.0, 1.0), power) * lights[0].color.rgb;
 
     l = normalize(lightTangentSpacePositions[1].xyz);
     d += clamp(dot(n,l), 0.0, 1.0)*(lights[1].color).rgb;
--- a/prism-es2/src/com/sun/prism/es2/glsl/normalMap_none.frag	Thu May 23 17:10:40 2013 -0700
+++ b/prism-es2/src/com/sun/prism/es2/glsl/normalMap_none.frag	Tue May 28 09:38:44 2013 -0700
@@ -24,10 +24,10 @@
  */
 
 // no texture normal map fragment shader
-#version 120
+//#version 120
 uniform sampler2D normalMap;
 
 vec3 apply_normal() {
-    return vec3(0,0,1);
+    return vec3(0.0,0.0,1.0);
 }
 
--- a/prism-es2/src/com/sun/prism/es2/glsl/normalMap_texture.frag	Thu May 23 17:10:40 2013 -0700
+++ b/prism-es2/src/com/sun/prism/es2/glsl/normalMap_texture.frag	Tue May 28 09:38:44 2013 -0700
@@ -24,13 +24,13 @@
  */
 
 // normal map fragment shader
-#version 120
+//#version 120
 
 uniform sampler2D normalMap;
 
 vec3 apply_normal() {
-    vec4 normal = texture2D(normalMap, gl_TexCoord[0].xy);
-    vec3 retVal = normalize(normal.xyz * 2 - 1);
+    vec4 normal = texture2D(normalMap, oTexCoords);
+    vec3 retVal = normalize(normal.xyz * 2.0 - 1.0);
     return retVal;
 }
 
--- a/prism-es2/src/com/sun/prism/es2/glsl/selfIllum_none.frag	Thu May 23 17:10:40 2013 -0700
+++ b/prism-es2/src/com/sun/prism/es2/glsl/selfIllum_none.frag	Tue May 28 09:38:44 2013 -0700
@@ -24,11 +24,11 @@
  */
 
 // no-op selfIllum fragment shader
-#version 120
+//#version 120
 
 uniform sampler2D selfIllumTexture;
 
 vec4 apply_selfIllum() {
-    return vec4(0);
+    return vec4(0.0);
 }
 
--- a/prism-es2/src/com/sun/prism/es2/glsl/selfIllum_texture.frag	Thu May 23 17:10:40 2013 -0700
+++ b/prism-es2/src/com/sun/prism/es2/glsl/selfIllum_texture.frag	Tue May 28 09:38:44 2013 -0700
@@ -24,11 +24,11 @@
  */
 
 // texture selfIllum fragment shader
-#version 120
+//#version 120
 
 uniform sampler2D selfIllumTexture;
 
 vec4 apply_selfIllum() {
-    return texture2D(selfIllumTexture, gl_TexCoord[0].xy);
+    return texture2D(selfIllumTexture, oTexCoords);
 }
 
--- a/prism-es2/src/com/sun/prism/es2/glsl/specular_color.frag	Thu May 23 17:10:40 2013 -0700
+++ b/prism-es2/src/com/sun/prism/es2/glsl/specular_color.frag	Tue May 28 09:38:44 2013 -0700
@@ -24,13 +24,13 @@
  */
 
 //specular auto fragment shader
-#version 120
+//#version 120
 
 uniform sampler2D specularMap;
 
 vec4 apply_specular()
 {
-    vec3 tSpec = texture2D(specularMap, gl_TexCoord[0].xy).rgb;
+    vec3 tSpec = texture2D(specularMap, oTexCoords).rgb;
     float sLevel = dot(tSpec, vec3(0.299, 0.587, 0.114));
     return vec4(tSpec, sLevel);
 }
--- a/prism-es2/src/com/sun/prism/es2/glsl/specular_none.frag	Thu May 23 17:10:40 2013 -0700
+++ b/prism-es2/src/com/sun/prism/es2/glsl/specular_none.frag	Tue May 28 09:38:44 2013 -0700
@@ -24,7 +24,7 @@
  */
 
 // no specular fragment shader
-#version 120
+//#version 120
 
 uniform sampler2D specularMap;
 
--- a/prism-es2/src/com/sun/prism/es2/glsl/specular_texture.frag	Thu May 23 17:10:40 2013 -0700
+++ b/prism-es2/src/com/sun/prism/es2/glsl/specular_texture.frag	Tue May 28 09:38:44 2013 -0700
@@ -24,12 +24,12 @@
  */
 
 // specular texture fragment shader
-#version 120
+//#version 120
 
 uniform sampler2D specularMap;
 
 vec4 apply_specular()
 {
-    vec4 tSpec = texture2D(specularMap, gl_TexCoord[0].xy);
+    vec4 tSpec = texture2D(specularMap, oTexCoords);
     return tSpec;
 }
--- a/prism-j2d/src/com/sun/prism/j2d/J2DResourceFactory.java	Thu May 23 17:10:40 2013 -0700
+++ b/prism-j2d/src/com/sun/prism/j2d/J2DResourceFactory.java	Tue May 28 09:38:44 2013 -0700
@@ -35,11 +35,9 @@
 import com.sun.prism.PresentableState;
 import com.sun.prism.RTTexture;
 import com.sun.prism.Texture;
-import com.sun.prism.RenderingContext;
 import com.sun.prism.Texture.Usage;
 import com.sun.prism.Texture.WrapMode;
 import com.sun.prism.impl.BaseResourceFactory;
-import com.sun.prism.impl.BaseRenderingContext;
 import com.sun.prism.impl.ManagedResource;
 import com.sun.prism.impl.TextureResourcePool;
 import com.sun.prism.impl.VertexBuffer;
@@ -155,17 +153,6 @@
         throw new UnsupportedOperationException("Not supported yet.");
     }
 
-    /**
-     * Returns dummy implementation of the RenderingContext interface.
-     *
-     * @param view the view to construct rendering context. if view is null,
-     *             then the rendering context is in offscreen mode.
-     */
-    @Override
-    public RenderingContext createRenderingContext(PresentableState pState) {
-        return new BaseRenderingContext();
-    }
-
     public void dispose() {
     }
 
--- a/prism-null/src/com/sun/prism/null3d/DummyResourceFactory.java	Thu May 23 17:10:40 2013 -0700
+++ b/prism-null/src/com/sun/prism/null3d/DummyResourceFactory.java	Tue May 28 09:38:44 2013 -0700
@@ -35,11 +35,9 @@
 import com.sun.prism.PresentableState;
 import com.sun.prism.RTTexture;
 import com.sun.prism.Texture;
-import com.sun.prism.RenderingContext;
 import com.sun.prism.Texture.Usage;
 import com.sun.prism.Texture.WrapMode;
 import com.sun.prism.impl.VertexBuffer;
-import com.sun.prism.impl.BaseRenderingContext;
 import com.sun.prism.impl.TextureResourcePool;
 import com.sun.prism.impl.ps.BaseShaderFactory;
 import com.sun.prism.ps.Shader;
@@ -109,18 +107,6 @@
         return new DummyShader(context, name);
     }
 
-    /**
-     * Returns dummy implementation of the RenderingContext interface.
-     *
-     * @param pState the PresentableState from which to construct a rendering
-     * context. if pState is null, then the rendering context is in offscreen
-     * mode.
-     */
-    @Override
-    public RenderingContext createRenderingContext(PresentableState pState) {
-        return new BaseRenderingContext();
-    }
-
     @Override
     public void dispose() {
     }
--- a/prism-sw-native/src/PiscesBlit.c	Thu May 23 17:10:40 2013 -0700
+++ b/prism-sw-native/src/PiscesBlit.c	Tue May 28 09:38:44 2013 -0700
@@ -45,17 +45,22 @@
 
 static INLINE void blendSrcOver8888(jint *intData, jint aval,
                              jint sred, jint sgreen, jint sblue);
-                             
-static INLINE void blendSrcOver8888_pre(jint *intData, jint aval, jint sred, 
+
+static INLINE void blendSrcOver8888_pre(jint *intData, jint aval, jint sred,
                                  jint sgreen, jint sblue);
+static INLINE void blendSrcOver8888_pre_pre(jint *intData, jint frac,
+                             jint aval,
+                             jint sred, jint sgreen, jint sblue);
 
 static INLINE void blendLCDSrcOver8888_pre(jint *intData,
     jint ared, jint agreen, jint ablue, jint sred, jint sgreen, jint sblue);
 
 static INLINE void blendSrc8888(jint *intData, jint aval, jint aaval,
                          jint sred, jint sgreen, jint sblue);
-                         
-static INLINE void blendSrc8888_pre(jint *intData, jint aval, jint raaval, jint sred, 
+
+static INLINE void blendSrc8888_pre(jint *intData, jint aval, jint raaval, jint sred,
+                             jint sgreen, jint sblue);
+static INLINE void blendSrc8888_pre_pre(jint *intData, jint aval, jint raaval, jint sred,
                              jint sgreen, jint sblue);
 
 static INLINE jint div255(jint x) {
@@ -431,13 +436,12 @@
             cred = (cval >> 16) & 0xFF;
             cgreen = (cval >> 8) & 0xFF;
             cblue = cval & 0xFF;
-            if (IS_TEXTURE_PAINT(paintMode) && calpha > 0) {
+            if (IS_TEXTURE_PAINT(paintMode)) {
                 // image is in premultiplied form
-                cred = (cred * 255)/calpha;
-                cgreen = (cgreen * 255)/calpha;
-                cblue = (cblue * 255)/calpha;
+                blendSrc8888_pre_pre(a, calpha, 255 - (lfrac >> 8), cred, cgreen, cblue);
+            } else {
+                blendSrc8888_pre(a, calpha, 255 - (lfrac >> 8), cred, cgreen, cblue);
             }
-            blendSrc8888_pre(a, calpha, 255 - (lfrac >> 8), cred, cgreen, cblue);
             a += imagePixelStride;
             aidx++;
         }
@@ -451,13 +455,12 @@
                 cred = (cval >> 16) & 0xFF;
                 cgreen = (cval >> 8) & 0xFF;
                 cblue = cval & 0xFF;
-                if (IS_TEXTURE_PAINT(paintMode) && calpha > 0) {
+                if (IS_TEXTURE_PAINT(paintMode)) {
                     // image is in premultiplied form
-                    cred = (cred * 255)/calpha;
-                    cgreen = (cgreen * 255)/calpha;
-                    cblue = (cblue * 255)/calpha;
+                    blendSrc8888_pre_pre(a, calpha, comp_frac, cred, cgreen, cblue);
+                } else {
+                    blendSrc8888_pre(a, calpha, comp_frac, cred, cgreen, cblue);
                 }
-                blendSrc8888_pre(a, calpha, comp_frac, cred, cgreen, cblue);
             }
             a += imagePixelStride;
             aidx++;
@@ -468,13 +471,12 @@
             cred = (cval >> 16) & 0xFF;
             cgreen = (cval >> 8) & 0xFF;
             cblue = cval & 0xFF;
-            if (IS_TEXTURE_PAINT(paintMode) && calpha > 0) {
+            if (IS_TEXTURE_PAINT(paintMode)) {
                 // image is in premultiplied form
-                cred = (cred * 255)/calpha;
-                cgreen = (cgreen * 255)/calpha;
-                cblue = (cblue * 255)/calpha;
+                blendSrc8888_pre_pre(a, calpha, 255 - (rfrac >> 8), cred, cgreen, cblue);
+            } else {
+                blendSrc8888_pre(a, calpha, 255 - (rfrac >> 8), cred, cgreen, cblue);
             }
-            blendSrc8888_pre(a, calpha, 255 - (rfrac >> 8), cred, cgreen, cblue);
         }
         imageOffset += imageScanlineStride;
         paint_offset += paint_stride;
@@ -586,14 +588,13 @@
             cred = (cval >> 16) & 0xFF;
             cgreen = (cval >> 8) & 0xFF;
             cblue = cval & 0xFF;
-            if (IS_TEXTURE_PAINT(paintMode) && calpha > 0) {
+            if (IS_TEXTURE_PAINT(paintMode)) {
                 // image is in premultiplied form
-                cred = (cred * 255)/calpha;
-                cgreen = (cgreen * 255)/calpha;
-                cblue = (cblue * 255)/calpha;
+                blendSrcOver8888_pre_pre(a, lfrac >> 8, calpha, cred, cgreen, cblue);
+            } else {
+                palpha = (lfrac * calpha) >> 16;
+                blendSrcOver8888_pre(a, palpha, cred, cgreen, cblue);
             }
-            palpha = (lfrac * calpha) >> 16;
-            blendSrcOver8888_pre(a, palpha, cred, cgreen, cblue);
             a += imagePixelStride;
             aidx++;
         }
@@ -608,13 +609,12 @@
                 cred = (cval >> 16) & 0xFF;
                 cgreen = (cval >> 8) & 0xFF;
                 cblue = cval & 0xFF;
-                if (IS_TEXTURE_PAINT(paintMode) && calpha > 0) {
+                if (IS_TEXTURE_PAINT(paintMode)) {
                     // image is in premultiplied form
-                    cred = (cred * 255)/calpha;
-                    cgreen = (cgreen * 255)/calpha;
-                    cblue = (cblue * 255)/calpha;
+                    blendSrcOver8888_pre_pre(a, frac >> 8, calpha, cred, cgreen, cblue);
+                } else {
+                    blendSrcOver8888_pre(a, palpha, cred, cgreen, cblue);
                 }
-                blendSrcOver8888_pre(a, palpha, cred, cgreen, cblue);
             }
             a += imagePixelStride;
             aidx++;
@@ -627,12 +627,11 @@
             cblue = cval & 0xFF;
             if (IS_TEXTURE_PAINT(paintMode) && calpha > 0) {
                 // image is in premultiplied form
-                cred = (cred * 255)/calpha;
-                cgreen = (cgreen * 255)/calpha;
-                cblue = (cblue * 255)/calpha;
+                blendSrcOver8888_pre_pre(a, rfrac >> 8, calpha, cred, cgreen, cblue);
+            } else {
+                palpha = (rfrac * calpha) >> 16;
+                blendSrcOver8888_pre(a, palpha, cred, cgreen, cblue);
             }
-            palpha = (rfrac * calpha) >> 16;
-            blendSrcOver8888_pre(a, palpha, cred, cgreen, cblue);
         }
         imageOffset += imageScanlineStride;
         paint_offset += paint_stride;
@@ -1481,6 +1480,30 @@
     *intData = (oalpha << 24) | (ored << 16) | (ogreen << 8) | oblue;
 }
 
+// *intData are premultiplied, sred, sgreen, sblue are premultiplied
+static void
+blendSrcOver8888_pre_pre(jint *intData, jint frac,
+                             jint aval,
+                             jint sred, jint sgreen, jint sblue) {
+    jint ival = *intData;
+    //destination alpha
+    jint dalpha = (ival >> 24) & 0xff;
+    //destination components premultiplied by dalpha
+    jint dred = (ival >> 16) & 0xff;
+    jint dgreen = (ival >> 8) & 0xff;
+    jint dblue = ival & 0xff;
+
+    jint aval2 = (aval * frac) >> 8;
+    jint oneminusaval = (255 - aval2);
+
+    jint oalpha  = aval2                  + div255(oneminusaval * dalpha);
+    jint ored    = ((sred * frac) >> 8)   + div255(oneminusaval * dred);
+    jint ogreen  = ((sgreen * frac) >> 8) + div255(oneminusaval * dgreen);
+    jint oblue   = ((sblue * frac) >> 8)  + div255(oneminusaval * dblue);
+
+    *intData = (oalpha << 24) | (ored << 16) | (ogreen << 8) | oblue;
+}
+
 // *intData are premultiplied, sred, sgreen, sblue are NOT premultiplied
 // it is required that final alpha must be fully opaque (0xFF)
 static void
@@ -1572,6 +1595,36 @@
     }
 }
 
+// sred, sgreen, sblue are all premultiplied
+static void
+blendSrc8888_pre_pre(jint *intData,
+                 jint aval, jint raaval,
+                 jint sred, jint sgreen, jint sblue) {
+    jint denom;
+
+    jint ival = *intData;
+    jint dalpha = (ival >> 24) & 0xff;
+    //premultiplied color components
+    jint dred =   (ival >> 16) & 0xff;
+    jint dgreen = (ival >>  8) & 0xff;
+    jint dblue =  (ival & 0xff);
+
+    denom = 255 * aval + dalpha * raaval;
+    if (denom == 0) {
+        // The output is transparent black
+        *intData = 0x00000000;
+    } else {
+        jint oalpha, ored, ogreen, oblue;
+        oalpha  = div255(denom);
+        ored    = sred   + div255(raaval * dred);
+        ogreen  = sgreen + div255(raaval * dgreen);
+        oblue   = sblue  + div255(raaval * dblue);
+
+        ival = (oalpha << 24) | (ored << 16) | (ogreen << 8) | oblue;
+        *intData = ival;
+    }
+}
+
 void initGammaArrays(jfloat gamma) {
     if (currentGamma != gamma) {
         int i;
--- a/prism-sw/src/com/sun/prism/sw/SWArgbPreTexture.java	Thu May 23 17:10:40 2013 -0700
+++ b/prism-sw/src/com/sun/prism/sw/SWArgbPreTexture.java	Tue May 28 09:38:44 2013 -0700
@@ -85,21 +85,26 @@
         this.allocate();
 
         final PixelGetter getter;
+        final int elementsPerPixel;
         switch (img.getPixelFormat()) {
             case BYTE_RGB:
                 getter = ByteRgb.getter;
+                elementsPerPixel = img.getBytesPerPixelUnit();
                 this.hasAlpha = false;
                 break;
             case INT_ARGB_PRE:
                 getter = IntArgbPre.getter;
+                elementsPerPixel = 1;
                 this.hasAlpha = true;
                 break;
             case BYTE_BGRA_PRE:
                 getter = ByteBgraPre.getter;
+                elementsPerPixel = img.getBytesPerPixelUnit();
                 this.hasAlpha = true;
                 break;
             case BYTE_GRAY:
                 getter = ByteGray.getter;
+                elementsPerPixel = img.getBytesPerPixelUnit();
                 this.hasAlpha = false;
                 break;
             default:
@@ -107,7 +112,7 @@
         }
 
         PixelConverter converter = PixelUtils.getConverter(getter, IntArgbPre.setter);
-        converter.convert(img.getPixelBuffer(), 0, srcw * img.getBytesPerPixelUnit(),
+        converter.convert(img.getPixelBuffer(), 0, srcw * elementsPerPixel,
                 IntBuffer.wrap(this.data), (dsty * width) + dstx, width, srcw, srch);
     }
 
--- a/prism-sw/src/com/sun/prism/sw/SWResourceFactory.java	Thu May 23 17:10:40 2013 -0700
+++ b/prism-sw/src/com/sun/prism/sw/SWResourceFactory.java	Tue May 28 09:38:44 2013 -0700
@@ -33,13 +33,11 @@
 import com.sun.prism.PixelFormat;
 import com.sun.prism.Presentable;
 import com.sun.prism.PresentableState;
-import com.sun.prism.RenderingContext;
 import com.sun.prism.ResourceFactory;
 import com.sun.prism.RTTexture;
 import com.sun.prism.Texture;
 import com.sun.prism.Texture.Usage;
 import com.sun.prism.Texture.WrapMode;
-import com.sun.prism.impl.BaseRenderingContext;
 import com.sun.prism.impl.BaseResourceFactory;
 import com.sun.prism.impl.PrismSettings;
 import com.sun.prism.impl.TextureResourcePool;
@@ -79,10 +77,6 @@
         context.dispose();
     }
 
-    @Override public RenderingContext createRenderingContext(PresentableState pstate) {
-        return new BaseRenderingContext();
-    }
-    
     @Override public ShapeRep createArcRep(boolean needs3D) {
         return theRep;
     }
--- a/prism-sw/src/com/sun/prism/sw/SWTexture.java	Thu May 23 17:10:40 2013 -0700
+++ b/prism-sw/src/com/sun/prism/sw/SWTexture.java	Tue May 28 09:38:44 2013 -0700
@@ -204,6 +204,7 @@
                 if (wrapMode != WrapMode.REPEAT) {
                     return null;
                 }
+                break;
             default:
                 return null;
         }
--- a/test-stub-toolkit/src/com/sun/javafx/pgstub/StubStage.java	Thu May 23 17:10:40 2013 -0700
+++ b/test-stub-toolkit/src/com/sun/javafx/pgstub/StubStage.java	Tue May 28 09:38:44 2013 -0700
@@ -59,6 +59,9 @@
         if (scene != null) {
             StubScene s = (StubScene) scene;
             s.stage = this;
+            notificationSender.setScene(s);
+            if (width != -1 && height != -1)
+                s.getListener().changedSize(width, height);
         }
     }
 
@@ -82,7 +85,7 @@
                           float xGravity, float yGravity)
     {
         numTimesSetSizeAndLocation++;
-        
+
         boolean locationChanged = false;
 
         if (xSet && (this.x != x)) {
@@ -124,7 +127,7 @@
                 sizeChanged = true;
             }
         }
-        
+
         if (sizeChanged) {
             notificationSender.changedSize(width, height);
         }
@@ -197,7 +200,7 @@
     public void requestFocus() {
         notificationSender.changedFocused(true, FocusCause.ACTIVATED);
     }
-    
+
     @Override
     public void requestFocus(FocusCause cause) {
         notificationSender.changedFocused(true, cause);
@@ -231,7 +234,7 @@
     @Override
     public void setMaximumSize(int maxWidth, int maxHeight) {
     }
-    
+
     public void holdNotifications() {
         notificationSender.holdNotifications();
     }
@@ -249,9 +252,9 @@
     }
 
     @Override
-    public void requestInput(String text, int type, double width, double height, 
+    public void requestInput(String text, int type, double width, double height,
                                 double Mxx, double Mxy, double Mxz, double Mxt,
-                                double Myx, double Myy, double Myz, double Myt, 
+                                double Myx, double Myy, double Myz, double Myt,
                                 double Mzx, double Mzy, double Mzz, double Mzt) {
         throw new UnsupportedOperationException("Not supported yet.");
     }
@@ -262,25 +265,25 @@
     }
 
     /**
-     * 
+     *
      * Accessibility glue for native
-     * 
+     *
      */
-    
+
     /**
      * Initialize Accessiblility
-     * 
+     *
      * @param ac    the Glass accessible root object.
      */
     @Override public void setAccessibilityInitIsComplete(Object ac) {
         // TODO: Add code later
-    } 
+    }
 
     /**
      * Create accessible Glass object corresponding to stage
-     * 
+     *
      * @param ac    the FX accessible root/stage node.
-     * 
+     *
      * @return the Glass AccessibleRoot object.
      */
     @Override
@@ -291,8 +294,8 @@
 
     /**
      * Create accessible native object corresponding to controls
-     * 
-     * @param ac 
+     *
+     * @param ac
      * returns native Object
      */
     @Override public Object accessibleCreateBasicProvider(AccessibleProvider ac) {
@@ -302,7 +305,7 @@
 
     /**
      * Delete accessible native object corresponding to controls
-     * 
+     *
      * @param nativeAcc
      * returns native Object
      */
@@ -312,15 +315,15 @@
 
     /**
      * Fire accessible event
-     * 
+     *
      * @param eventID   identifies the event.
      */
     @Override public void accessibleFireEvent(Object nativeAcc, int eventID) {
         // TODO: Add code later
     }
-    
+
     /** Fire accessible property change event
-     * 
+     *
      * @param propertyId    identifies the property
      * @param oldProperty   the old value of the property
      * @param newProperty   the new value of the property
@@ -329,12 +332,12 @@
                                              int newProperty ) {
         // TODO: Add code later
     }
-    
+
     @Override public void accessibleFirePropertyChange(Object nativeAcc, int propertyId, boolean oldProperty,
                                              boolean newProperty ) {
         // TODO: Add code later
-    }        
-    
+    }
+
     private interface Notification {
         void execute(TKStageListener listener);
     }
@@ -345,11 +348,16 @@
 
         private boolean hold;
         private TKStageListener listener;
+        private StubScene scene;
 
         public void setListener(final TKStageListener listener) {
             this.listener = listener;
         }
 
+        public void setScene(final StubScene scene) {
+            this.scene = scene;
+        }
+
         public void holdNotifications() {
             hold = true;
         }
@@ -379,6 +387,9 @@
                         @Override
                         public void execute(final TKStageListener listener) {
                             listener.changedSize(width, height);
+                            if (scene != null && width != -1 && height != -1) {
+                                scene.getListener().changedSize(width, height);
+                            }
                         }
                     });
         }
@@ -495,7 +506,7 @@
         public void initAccessibleTKStageListener() {
             // TODO: Add code later
         }
-                
+
     }
 
     public void setRTL(boolean b) {
--- a/webview/build.xml	Thu May 23 17:10:40 2013 -0700
+++ b/webview/build.xml	Tue May 28 09:38:44 2013 -0700
@@ -22,7 +22,6 @@
             <class name="com.sun.webkit.event.WCKeyEvent"/>
             <class name="com.sun.webkit.event.WCMouseEvent"/>
             <class name="com.sun.webkit.event.WCMouseWheelEvent"/>
-            <class name="com.sun.webkit.event.WCTouchEvent"/>
             <class name="com.sun.webkit.graphics.GraphicsDecoder"/>
             <class name="com.sun.webkit.graphics.RenderMediaControls"/>
             <class name="com.sun.webkit.graphics.RenderTheme"/>
--- a/webview/native/Source/WebCore/DerivedSourcesJava.pri	Thu May 23 17:10:40 2013 -0700
+++ b/webview/native/Source/WebCore/DerivedSourcesJava.pri	Tue May 28 09:38:44 2013 -0700
@@ -52,7 +52,7 @@
     ENABLE_SVG_FONTS=1 \
     ENABLE_SVG_FOREIGN_OBJECT=1 \
     ENABLE_SVG_USE=1 \
-    ENABLE_TOUCH_EVENTS=1 \
+    ENABLE_TOUCH_EVENTS=0 \
     ENABLE_VIDEO=1 \
     ENABLE_WCSS=0 \
     ENABLE_WEB_SOCKETS=1 \
@@ -182,9 +182,6 @@
     $$PWD/dom/ProcessingInstruction.idl \
     $$PWD/dom/Range.idl \
     $$PWD/dom/Text.idl \
-    $$PWD/dom/Touch.idl \
-    $$PWD/dom/TouchEvent.idl \
-    $$PWD/dom/TouchList.idl \
     $$PWD/dom/TreeWalker.idl \
     $$PWD/dom/UIEvent.idl \
     $$PWD/dom/WheelEvent.idl \
@@ -773,6 +770,13 @@
     $$PWD/svg/SVGZoomEvent.idl
 }
 
+contains(DEFINES, ENABLE_TOUCH_EVENTS=1) {
+  IDL_BINDINGS_JAVA += \
+    $$PWD/dom/Touch.idl \
+    $$PWD/dom/TouchEvent.idl \
+    $$PWD/dom/TouchList.idl
+}
+
 contains(DEFINES, ENABLE_VIDEO_TRACK=1) {
   IDL_BINDINGS += \
     $$PWD/html/track/TextTrack.idl \
--- a/webview/native/Source/WebCore/bindings/scripts/CodeGeneratorJava.pm	Thu May 23 17:10:40 2013 -0700
+++ b/webview/native/Source/WebCore/bindings/scripts/CodeGeneratorJava.pm	Tue May 28 09:38:44 2013 -0700
@@ -11,9 +11,6 @@
     KeyboardEvent => 1,
     WheelEvent => 1,
     DOMSelection => 1,
-    Touch => 1,
-    TouchList => 1,
-    TouchEvent => 1
 );
 
 my %class2pkg = (
@@ -272,7 +269,6 @@
             "WheelEvent",
             "MouseEvent",
             "KeyboardEvent",
-            "TouchEvent",
             "UIEvent",
             "MutationEvent"
         ],
@@ -281,7 +277,6 @@
                 "        case TYPE_MouseEvent: return new MouseEventImpl(peer);\n" .
                 "        case TYPE_KeyboardEvent: return new KeyboardEventImpl(peer);\n" .
                 "        case TYPE_WheelEvent: return new WheelEventImpl(peer);\n" .
-                "        case TYPE_TouchEvent: return new TouchEventImpl(peer);\n" .
                 "        case TYPE_UIEvent: return new UIEventImpl(peer);\n" .
                 "        case TYPE_MutationEvent: return new MutationEventImpl(peer);\n" .
                 "        }\n"
--- a/webview/native/Source/WebCore/mapfile-macosx	Thu May 23 17:10:40 2013 -0700
+++ b/webview/native/Source/WebCore/mapfile-macosx	Tue May 28 09:38:44 2013 -0700
@@ -286,10 +286,6 @@
                _Java_com_sun_webkit_dom_DOMWindowImpl_getOnsubmitImpl
                _Java_com_sun_webkit_dom_DOMWindowImpl_getOnsuspendImpl
                _Java_com_sun_webkit_dom_DOMWindowImpl_getOntimeupdateImpl
-               _Java_com_sun_webkit_dom_DOMWindowImpl_getOntouchcancelImpl
-               _Java_com_sun_webkit_dom_DOMWindowImpl_getOntouchendImpl
-               _Java_com_sun_webkit_dom_DOMWindowImpl_getOntouchmoveImpl
-               _Java_com_sun_webkit_dom_DOMWindowImpl_getOntouchstartImpl
                _Java_com_sun_webkit_dom_DOMWindowImpl_getOnunloadImpl
                _Java_com_sun_webkit_dom_DOMWindowImpl_getOnvolumechangeImpl
                _Java_com_sun_webkit_dom_DOMWindowImpl_getOnwaitingImpl
@@ -387,10 +383,6 @@
                _Java_com_sun_webkit_dom_DOMWindowImpl_setOnsubmitImpl
                _Java_com_sun_webkit_dom_DOMWindowImpl_setOnsuspendImpl
                _Java_com_sun_webkit_dom_DOMWindowImpl_setOntimeupdateImpl
-               _Java_com_sun_webkit_dom_DOMWindowImpl_setOntouchcancelImpl
-               _Java_com_sun_webkit_dom_DOMWindowImpl_setOntouchendImpl
-               _Java_com_sun_webkit_dom_DOMWindowImpl_setOntouchmoveImpl
-               _Java_com_sun_webkit_dom_DOMWindowImpl_setOntouchstartImpl
                _Java_com_sun_webkit_dom_DOMWindowImpl_setOnunloadImpl
                _Java_com_sun_webkit_dom_DOMWindowImpl_setOnvolumechangeImpl
                _Java_com_sun_webkit_dom_DOMWindowImpl_setOnwaitingImpl
@@ -420,7 +412,6 @@
                _Java_com_sun_webkit_dom_DocumentImpl_createProcessingInstructionImpl
                _Java_com_sun_webkit_dom_DocumentImpl_createRangeImpl
                _Java_com_sun_webkit_dom_DocumentImpl_createTextNodeImpl
-               _Java_com_sun_webkit_dom_DocumentImpl_createTouchImpl
                _Java_com_sun_webkit_dom_DocumentImpl_createTreeWalkerImpl
                _Java_com_sun_webkit_dom_DocumentImpl_elementFromPointImpl
                _Java_com_sun_webkit_dom_DocumentImpl_evaluateImpl
@@ -491,10 +482,6 @@
                _Java_com_sun_webkit_dom_DocumentImpl_getOnselectionchangeImpl
                _Java_com_sun_webkit_dom_DocumentImpl_getOnselectstartImpl
                _Java_com_sun_webkit_dom_DocumentImpl_getOnsubmitImpl
-               _Java_com_sun_webkit_dom_DocumentImpl_getOntouchcancelImpl
-               _Java_com_sun_webkit_dom_DocumentImpl_getOntouchendImpl
-               _Java_com_sun_webkit_dom_DocumentImpl_getOntouchmoveImpl
-               _Java_com_sun_webkit_dom_DocumentImpl_getOntouchstartImpl
                _Java_com_sun_webkit_dom_DocumentImpl_getOverrideStyleImpl
                _Java_com_sun_webkit_dom_DocumentImpl_getPreferredStylesheetSetImpl
                _Java_com_sun_webkit_dom_DocumentImpl_getReadyStateImpl
@@ -561,10 +548,6 @@
                _Java_com_sun_webkit_dom_DocumentImpl_setOnselectionchangeImpl
                _Java_com_sun_webkit_dom_DocumentImpl_setOnselectstartImpl
                _Java_com_sun_webkit_dom_DocumentImpl_setOnsubmitImpl
-               _Java_com_sun_webkit_dom_DocumentImpl_setOntouchcancelImpl
-               _Java_com_sun_webkit_dom_DocumentImpl_setOntouchendImpl
-               _Java_com_sun_webkit_dom_DocumentImpl_setOntouchmoveImpl
-               _Java_com_sun_webkit_dom_DocumentImpl_setOntouchstartImpl
                _Java_com_sun_webkit_dom_DocumentImpl_setSelectedStylesheetSetImpl
                _Java_com_sun_webkit_dom_DocumentImpl_setTitleImpl
                _Java_com_sun_webkit_dom_DocumentImpl_setXmlStandaloneImpl
@@ -636,10 +619,6 @@
                _Java_com_sun_webkit_dom_ElementImpl_getOnselectImpl
                _Java_com_sun_webkit_dom_ElementImpl_getOnselectstartImpl
                _Java_com_sun_webkit_dom_ElementImpl_getOnsubmitImpl
-               _Java_com_sun_webkit_dom_ElementImpl_getOntouchcancelImpl
-               _Java_com_sun_webkit_dom_ElementImpl_getOntouchendImpl
-               _Java_com_sun_webkit_dom_ElementImpl_getOntouchmoveImpl
-               _Java_com_sun_webkit_dom_ElementImpl_getOntouchstartImpl
                _Java_com_sun_webkit_dom_ElementImpl_getPreviousElementSiblingImpl
                _Java_com_sun_webkit_dom_ElementImpl_getScrollHeightImpl
                _Java_com_sun_webkit_dom_ElementImpl_getScrollLeftImpl
@@ -703,10 +682,6 @@
                _Java_com_sun_webkit_dom_ElementImpl_setOnselectImpl
                _Java_com_sun_webkit_dom_ElementImpl_setOnselectstartImpl
                _Java_com_sun_webkit_dom_ElementImpl_setOnsubmitImpl
-               _Java_com_sun_webkit_dom_ElementImpl_setOntouchcancelImpl
-               _Java_com_sun_webkit_dom_ElementImpl_setOntouchendImpl
-               _Java_com_sun_webkit_dom_ElementImpl_setOntouchmoveImpl
-               _Java_com_sun_webkit_dom_ElementImpl_setOntouchstartImpl
                _Java_com_sun_webkit_dom_ElementImpl_setScrollLeftImpl
                _Java_com_sun_webkit_dom_ElementImpl_setScrollTopImpl
                _Java_com_sun_webkit_dom_ElementImpl_webkitMatchesSelectorImpl
@@ -1725,30 +1700,6 @@
                _Java_com_sun_webkit_dom_TextImpl_getWholeTextImpl
                _Java_com_sun_webkit_dom_TextImpl_replaceWholeTextImpl
                _Java_com_sun_webkit_dom_TextImpl_splitTextImpl
-               _Java_com_sun_webkit_dom_TouchEventImpl_getAltKeyImpl
-               _Java_com_sun_webkit_dom_TouchEventImpl_getChangedTouchesImpl
-               _Java_com_sun_webkit_dom_TouchEventImpl_getCtrlKeyImpl
-               _Java_com_sun_webkit_dom_TouchEventImpl_getMetaKeyImpl
-               _Java_com_sun_webkit_dom_TouchEventImpl_getShiftKeyImpl
-               _Java_com_sun_webkit_dom_TouchEventImpl_getTargetTouchesImpl
-               _Java_com_sun_webkit_dom_TouchEventImpl_getTouchesImpl
-               _Java_com_sun_webkit_dom_TouchEventImpl_initTouchEventImpl
-               _Java_com_sun_webkit_dom_TouchImpl_dispose
-               _Java_com_sun_webkit_dom_TouchImpl_getClientXImpl
-               _Java_com_sun_webkit_dom_TouchImpl_getClientYImpl
-               _Java_com_sun_webkit_dom_TouchImpl_getIdentifierImpl
-               _Java_com_sun_webkit_dom_TouchImpl_getPageXImpl
-               _Java_com_sun_webkit_dom_TouchImpl_getPageYImpl
-               _Java_com_sun_webkit_dom_TouchImpl_getScreenXImpl
-               _Java_com_sun_webkit_dom_TouchImpl_getScreenYImpl
-               _Java_com_sun_webkit_dom_TouchImpl_getTargetImpl
-               _Java_com_sun_webkit_dom_TouchImpl_getWebkitForceImpl
-               _Java_com_sun_webkit_dom_TouchImpl_getWebkitRadiusXImpl
-               _Java_com_sun_webkit_dom_TouchImpl_getWebkitRadiusYImpl
-               _Java_com_sun_webkit_dom_TouchImpl_getWebkitRotationAngleImpl
-               _Java_com_sun_webkit_dom_TouchListImpl_dispose
-               _Java_com_sun_webkit_dom_TouchListImpl_getLengthImpl
-               _Java_com_sun_webkit_dom_TouchListImpl_itemImpl
                _Java_com_sun_webkit_dom_TreeWalkerImpl_dispose
                _Java_com_sun_webkit_dom_TreeWalkerImpl_firstChildImpl
                _Java_com_sun_webkit_dom_TreeWalkerImpl_getCurrentNodeImpl
@@ -1885,7 +1836,6 @@
                _Java_com_sun_webkit_WebPage_twkProcessKeyEvent
                _Java_com_sun_webkit_WebPage_twkProcessMouseEvent
                _Java_com_sun_webkit_WebPage_twkProcessMouseWheelEvent
-               _Java_com_sun_webkit_WebPage_twkProcessTouchEvent
                _Java_com_sun_webkit_WebPage_twkQueryCommandEnabled
                _Java_com_sun_webkit_WebPage_twkQueryCommandState
                _Java_com_sun_webkit_WebPage_twkQueryCommandValue
--- a/webview/native/Source/WebCore/mapfile-vers	Thu May 23 17:10:40 2013 -0700
+++ b/webview/native/Source/WebCore/mapfile-vers	Tue May 28 09:38:44 2013 -0700
@@ -286,10 +286,6 @@
                Java_com_sun_webkit_dom_DOMWindowImpl_getOnsubmitImpl;
                Java_com_sun_webkit_dom_DOMWindowImpl_getOnsuspendImpl;
                Java_com_sun_webkit_dom_DOMWindowImpl_getOntimeupdateImpl;
-               Java_com_sun_webkit_dom_DOMWindowImpl_getOntouchcancelImpl;
-               Java_com_sun_webkit_dom_DOMWindowImpl_getOntouchendImpl;
-               Java_com_sun_webkit_dom_DOMWindowImpl_getOntouchmoveImpl;
-               Java_com_sun_webkit_dom_DOMWindowImpl_getOntouchstartImpl;
                Java_com_sun_webkit_dom_DOMWindowImpl_getOnunloadImpl;
                Java_com_sun_webkit_dom_DOMWindowImpl_getOnvolumechangeImpl;
                Java_com_sun_webkit_dom_DOMWindowImpl_getOnwaitingImpl;
@@ -387,10 +383,6 @@
                Java_com_sun_webkit_dom_DOMWindowImpl_setOnsubmitImpl;
                Java_com_sun_webkit_dom_DOMWindowImpl_setOnsuspendImpl;
                Java_com_sun_webkit_dom_DOMWindowImpl_setOntimeupdateImpl;
-               Java_com_sun_webkit_dom_DOMWindowImpl_setOntouchcancelImpl;
-               Java_com_sun_webkit_dom_DOMWindowImpl_setOntouchendImpl;
-               Java_com_sun_webkit_dom_DOMWindowImpl_setOntouchmoveImpl;
-               Java_com_sun_webkit_dom_DOMWindowImpl_setOntouchstartImpl;
                Java_com_sun_webkit_dom_DOMWindowImpl_setOnunloadImpl;
                Java_com_sun_webkit_dom_DOMWindowImpl_setOnvolumechangeImpl;
                Java_com_sun_webkit_dom_DOMWindowImpl_setOnwaitingImpl;
@@ -420,7 +412,6 @@
                Java_com_sun_webkit_dom_DocumentImpl_createProcessingInstructionImpl;
                Java_com_sun_webkit_dom_DocumentImpl_createRangeImpl;
                Java_com_sun_webkit_dom_DocumentImpl_createTextNodeImpl;
-               Java_com_sun_webkit_dom_DocumentImpl_createTouchImpl;
                Java_com_sun_webkit_dom_DocumentImpl_createTreeWalkerImpl;
                Java_com_sun_webkit_dom_DocumentImpl_elementFromPointImpl;
                Java_com_sun_webkit_dom_DocumentImpl_evaluateImpl;
@@ -491,10 +482,6 @@
                Java_com_sun_webkit_dom_DocumentImpl_getOnselectionchangeImpl;
                Java_com_sun_webkit_dom_DocumentImpl_getOnselectstartImpl;
                Java_com_sun_webkit_dom_DocumentImpl_getOnsubmitImpl;
-               Java_com_sun_webkit_dom_DocumentImpl_getOntouchcancelImpl;
-               Java_com_sun_webkit_dom_DocumentImpl_getOntouchendImpl;
-               Java_com_sun_webkit_dom_DocumentImpl_getOntouchmoveImpl;
-               Java_com_sun_webkit_dom_DocumentImpl_getOntouchstartImpl;
                Java_com_sun_webkit_dom_DocumentImpl_getOverrideStyleImpl;
                Java_com_sun_webkit_dom_DocumentImpl_getPreferredStylesheetSetImpl;
                Java_com_sun_webkit_dom_DocumentImpl_getReadyStateImpl;
@@ -561,10 +548,6 @@
                Java_com_sun_webkit_dom_DocumentImpl_setOnselectionchangeImpl;
                Java_com_sun_webkit_dom_DocumentImpl_setOnselectstartImpl;
                Java_com_sun_webkit_dom_DocumentImpl_setOnsubmitImpl;
-               Java_com_sun_webkit_dom_DocumentImpl_setOntouchcancelImpl;
-               Java_com_sun_webkit_dom_DocumentImpl_setOntouchendImpl;
-               Java_com_sun_webkit_dom_DocumentImpl_setOntouchmoveImpl;
-               Java_com_sun_webkit_dom_DocumentImpl_setOntouchstartImpl;
                Java_com_sun_webkit_dom_DocumentImpl_setSelectedStylesheetSetImpl;
                Java_com_sun_webkit_dom_DocumentImpl_setTitleImpl;
                Java_com_sun_webkit_dom_DocumentImpl_setXmlStandaloneImpl;
@@ -636,10 +619,6 @@
                Java_com_sun_webkit_dom_ElementImpl_getOnselectImpl;
                Java_com_sun_webkit_dom_ElementImpl_getOnselectstartImpl;
                Java_com_sun_webkit_dom_ElementImpl_getOnsubmitImpl;
-               Java_com_sun_webkit_dom_ElementImpl_getOntouchcancelImpl;
-               Java_com_sun_webkit_dom_ElementImpl_getOntouchendImpl;
-               Java_com_sun_webkit_dom_ElementImpl_getOntouchmoveImpl;
-               Java_com_sun_webkit_dom_ElementImpl_getOntouchstartImpl;
                Java_com_sun_webkit_dom_ElementImpl_getPreviousElementSiblingImpl;
                Java_com_sun_webkit_dom_ElementImpl_getScrollHeightImpl;
                Java_com_sun_webkit_dom_ElementImpl_getScrollLeftImpl;
@@ -703,10 +682,6 @@
                Java_com_sun_webkit_dom_ElementImpl_setOnselectImpl;
                Java_com_sun_webkit_dom_ElementImpl_setOnselectstartImpl;
                Java_com_sun_webkit_dom_ElementImpl_setOnsubmitImpl;
-               Java_com_sun_webkit_dom_ElementImpl_setOntouchcancelImpl;
-               Java_com_sun_webkit_dom_ElementImpl_setOntouchendImpl;
-               Java_com_sun_webkit_dom_ElementImpl_setOntouchmoveImpl;
-               Java_com_sun_webkit_dom_ElementImpl_setOntouchstartImpl;
                Java_com_sun_webkit_dom_ElementImpl_setScrollLeftImpl;
                Java_com_sun_webkit_dom_ElementImpl_setScrollTopImpl;
                Java_com_sun_webkit_dom_ElementImpl_webkitMatchesSelectorImpl;
@@ -1725,30 +1700,6 @@
                Java_com_sun_webkit_dom_TextImpl_getWholeTextImpl;
                Java_com_sun_webkit_dom_TextImpl_replaceWholeTextImpl;
                Java_com_sun_webkit_dom_TextImpl_splitTextImpl;
-               Java_com_sun_webkit_dom_TouchEventImpl_getAltKeyImpl;
-               Java_com_sun_webkit_dom_TouchEventImpl_getChangedTouchesImpl;
-               Java_com_sun_webkit_dom_TouchEventImpl_getCtrlKeyImpl;
-               Java_com_sun_webkit_dom_TouchEventImpl_getMetaKeyImpl;
-               Java_com_sun_webkit_dom_TouchEventImpl_getShiftKeyImpl;
-               Java_com_sun_webkit_dom_TouchEventImpl_getTargetTouchesImpl;
-               Java_com_sun_webkit_dom_TouchEventImpl_getTouchesImpl;
-               Java_com_sun_webkit_dom_TouchEventImpl_initTouchEventImpl;
-               Java_com_sun_webkit_dom_TouchImpl_dispose;
-               Java_com_sun_webkit_dom_TouchImpl_getClientXImpl;
-               Java_com_sun_webkit_dom_TouchImpl_getClientYImpl;
-               Java_com_sun_webkit_dom_TouchImpl_getIdentifierImpl;
-               Java_com_sun_webkit_dom_TouchImpl_getPageXImpl;
-               Java_com_sun_webkit_dom_TouchImpl_getPageYImpl;
-               Java_com_sun_webkit_dom_TouchImpl_getScreenXImpl;
-               Java_com_sun_webkit_dom_TouchImpl_getScreenYImpl;
-               Java_com_sun_webkit_dom_TouchImpl_getTargetImpl;
-               Java_com_sun_webkit_dom_TouchImpl_getWebkitForceImpl;
-               Java_com_sun_webkit_dom_TouchImpl_getWebkitRadiusXImpl;
-               Java_com_sun_webkit_dom_TouchImpl_getWebkitRadiusYImpl;
-               Java_com_sun_webkit_dom_TouchImpl_getWebkitRotationAngleImpl;
-               Java_com_sun_webkit_dom_TouchListImpl_dispose;
-               Java_com_sun_webkit_dom_TouchListImpl_getLengthImpl;
-               Java_com_sun_webkit_dom_TouchListImpl_itemImpl;
                Java_com_sun_webkit_dom_TreeWalkerImpl_dispose;
                Java_com_sun_webkit_dom_TreeWalkerImpl_firstChildImpl;
                Java_com_sun_webkit_dom_TreeWalkerImpl_getCurrentNodeImpl;
@@ -1885,7 +1836,6 @@
                Java_com_sun_webkit_WebPage_twkProcessKeyEvent;
                Java_com_sun_webkit_WebPage_twkProcessMouseEvent;
                Java_com_sun_webkit_WebPage_twkProcessMouseWheelEvent;
-               Java_com_sun_webkit_WebPage_twkProcessTouchEvent;
                Java_com_sun_webkit_WebPage_twkQueryCommandEnabled;
                Java_com_sun_webkit_WebPage_twkQueryCommandState;
                Java_com_sun_webkit_WebPage_twkQueryCommandValue;
--- a/webview/native/Source/WebCore/page/java/ChromeClientJava.h	Thu May 23 17:10:40 2013 -0700
+++ b/webview/native/Source/WebCore/page/java/ChromeClientJava.h	Tue May 28 09:38:44 2013 -0700
@@ -129,8 +129,8 @@
 
 #if ENABLE(TOUCH_EVENTS)
         virtual void needTouchEvents(bool) { }
+#endif
         virtual void numTouchEventHandlersChanged(unsigned) OVERRIDE { }
-#endif
         virtual bool shouldRunModalDialogDuringPageDismissal(const DialogType&, const String& dialogMessage, FrameLoader::PageDismissalType) const;
 
         virtual bool shouldRubberBandInDirection(ScrollDirection) const;
--- a/webview/native/Source/WebCore/platform/java/FileSystemJava.cpp	Thu May 23 17:10:40 2013 -0700
+++ b/webview/native/Source/WebCore/platform/java/FileSystemJava.cpp	Tue May 28 09:38:44 2013 -0700
@@ -7,22 +7,11 @@
 #include "FileMetadata.h"
 #include "JavaEnv.h"
 
-static JGClass fileSystemClass;
-static jmethodID pathGetFileNameMID;
-
-static void initRefs(JNIEnv* env)
+static jclass GetFileSystemClass(JNIEnv* env)
 {
-    if (!fileSystemClass) {
-        fileSystemClass = JLClass(env->FindClass(
-                "com/sun/webkit/FileSystem"));
-        ASSERT(fileSystemClass);
-
-        pathGetFileNameMID = env->GetStaticMethodID(
-                fileSystemClass,
-                "fwkPathGetFileName",
-                "(Ljava/lang/String;)Ljava/lang/String;");
-        ASSERT(pathGetFileNameMID);
-    }
+    static JGClass clazz(env->FindClass("com/sun/webkit/FileSystem"));
+    ASSERT(clazz);
+    return clazz;
 }
 
 namespace WebCore {
@@ -45,10 +34,28 @@
     return false;
 }
 
-bool getFileSize(String const&, long long&)
+bool getFileSize(const String& path, long long& result)
 {
-    notImplemented();
-    return false;
+    JNIEnv* env = WebCore_GetJavaEnv();
+
+    static jmethodID mid = env->GetStaticMethodID(
+            GetFileSystemClass(env),
+            "fwkGetFileSize",
+            "(Ljava/lang/String;)J");
+    ASSERT(mid);
+
+    jlong size = env->CallStaticLongMethod(
+            GetFileSystemClass(env),
+            mid,
+            (jstring) path.toJavaString(env));
+    CheckAndClearException(env);
+
+    if (size >= 0) {
+        result = size;
+        return true;
+    } else {
+        return false;
+    }
 }
 
 bool getFileModificationTime(const String&, time_t& result)
@@ -127,15 +134,20 @@
 String pathGetFileName(const String& path)
 {
     JNIEnv* env = WebCore_GetJavaEnv();
-    initRefs(env);
-    
+
+    static jmethodID mid = env->GetStaticMethodID(
+            GetFileSystemClass(env),
+            "fwkPathGetFileName",
+            "(Ljava/lang/String;)Ljava/lang/String;");
+    ASSERT(mid);
+
     JLString result = static_cast<jstring>(env->CallStaticObjectMethod(
-            fileSystemClass,
-            pathGetFileNameMID,
-            (jstring)path.toJavaString(env)));
+            GetFileSystemClass(env),
+            mid,
+            (jstring) path.toJavaString(env)));
     CheckAndClearException(env);
 
-    return String(env, result);    
+    return String(env, result);
 }
 
 } // namespace WebCore
--- a/webview/native/Source/WebCore/platform/java/TouchEventJava.cpp	Thu May 23 17:10:40 2013 -0700
+++ b/webview/native/Source/WebCore/platform/java/TouchEventJava.cpp	Tue May 28 09:38:44 2013 -0700
@@ -20,11 +20,11 @@
  *
  */
 
+#if ENABLE(TOUCH_EVENTS)
+
 #include "com_sun_webkit_event_WCTouchEvent.h"
 #include "PlatformTouchEvent.h"
 
-#if ENABLE(TOUCH_EVENTS)
-
 namespace WebCore {
 
 PlatformTouchEvent::PlatformTouchEvent(JNIEnv* env, jint id, jobject touchData,
--- a/webview/native/Source/WebCore/platform/java/WebPage.cpp	Thu May 23 17:10:40 2013 -0700
+++ b/webview/native/Source/WebCore/platform/java/WebPage.cpp	Tue May 28 09:38:44 2013 -0700
@@ -1518,6 +1518,7 @@
     return bool_to_jbool(consumeEvent);
 }
 
+#if ENABLE(TOUCH_EVENTS)
 JNIEXPORT jboolean JNICALL Java_com_sun_webkit_WebPage_twkProcessTouchEvent
     (JNIEnv* env, jobject self, jlong pPage, jint id, jobject touchData,
      jboolean shift, jboolean ctrl, jboolean alt, jboolean meta, jfloat timestamp)
@@ -1534,6 +1535,7 @@
     bool consumeEvent = frame->eventHandler()->handleTouchEvent(ev);
     return bool_to_jbool(consumeEvent);
 }
+#endif
 
 JNIEXPORT jboolean JNICALL Java_com_sun_webkit_WebPage_twkProcessInputTextChange
     (JNIEnv* env, jobject self, jlong pPage,
--- a/webview/src/com/sun/javafx/webkit/drt/EventSender.java	Thu May 23 17:10:40 2013 -0700
+++ b/webview/src/com/sun/javafx/webkit/drt/EventSender.java	Tue May 28 09:38:44 2013 -0700
@@ -8,9 +8,6 @@
 import com.sun.webkit.event.WCKeyEvent;
 import com.sun.webkit.event.WCMouseEvent;
 import com.sun.webkit.event.WCMouseWheelEvent;
-import com.sun.webkit.event.WCTouchEvent;
-import com.sun.webkit.event.WCTouchPoint;
-
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -87,11 +84,6 @@
     private int modifiers;
 
     /**
-     * The current points for touch events.
-     */
-    private final List<WCTouchPoint> points = new ArrayList<WCTouchPoint>();
-
-    /**
      * Creates a new {@code EventSender}.
      */
     EventSender(WebPage webPage) {
@@ -203,7 +195,7 @@
      * method of the DRT event sender object.
      */
     private void touchStart() {
-        dispatchTouchEvent(WCTouchEvent.TOUCH_START);
+        throw new UnsupportedOperationException("touchStart");
     }
 
     /**
@@ -211,7 +203,7 @@
      * method of the DRT event sender object.
      */
     private void touchCancel() {
-        dispatchTouchEvent(WCTouchEvent.TOUCH_CANCEL);
+        throw new UnsupportedOperationException("touchCancel");
     }
 
     /**
@@ -219,7 +211,7 @@
      * method of the DRT event sender object.
      */
     private void touchMove() {
-        dispatchTouchEvent(WCTouchEvent.TOUCH_MOVE);
+        throw new UnsupportedOperationException("touchMove");
     }
 
     /**
@@ -227,7 +219,7 @@
      * method of the DRT event sender object.
      */
     private void touchEnd() {
-        dispatchTouchEvent(WCTouchEvent.TOUCH_END);
+        throw new UnsupportedOperationException("touchEnd");
     }
 
     /**
@@ -235,13 +227,7 @@
      * method of the DRT event sender object.
      */
     private void addTouchPoint(int x, int y) {
-        int id = 0;
-        for (WCTouchPoint point : points) {
-            if (id == point.getID())
-                id++;
-        }
-        points.add(new WCTouchPoint(id, WCTouchPoint.STATE_PRESSED, x, y, x, y));
-
+        throw new UnsupportedOperationException("addTouchPoint");
     }
 
     /**
@@ -249,7 +235,7 @@
      * method of the DRT event sender object.
      */
     private void updateTouchPoint(int i, int x, int y) {
-        points.get(i).update(x, y);
+        throw new UnsupportedOperationException("updateTouchPoint");
     }
 
     /**
@@ -257,7 +243,7 @@
      * method of the DRT event sender object.
      */
     private void cancelTouchPoint(int i) {
-        points.get(i).update(WCTouchPoint.STATE_CANCELLED);
+        throw new UnsupportedOperationException("cancelTouchPoint");
     }
 
     /**
@@ -265,7 +251,7 @@
      * method of the DRT event sender object.
      */
     private void releaseTouchPoint(int i) {
-        points.get(i).update(WCTouchPoint.STATE_RELEASED);
+        throw new UnsupportedOperationException("releaseTouchPoint");
     }
 
     /**
@@ -273,7 +259,7 @@
      * method of the DRT event sender object.
      */
     private void clearTouchPoints() {
-        points.clear();
+        throw new UnsupportedOperationException("clearTouchPoints");
     }
 
     /**
@@ -360,27 +346,6 @@
         ));
     }
 
-    private void dispatchTouchEvent(int type) {
-        webPage.dispatchTouchEvent(new WCTouchEvent(
-                type, points,
-                getEventTime(),
-                isSet(modifiers, SHIFT),
-                isSet(modifiers, CTRL),
-                isSet(modifiers, ALT),
-                isSet(modifiers, META)
-        ));
-        Iterator<WCTouchPoint> it = points.iterator();
-        while (it.hasNext()) {
-            WCTouchPoint point = it.next();
-            if (WCTouchPoint.STATE_RELEASED == point.getState()) {
-                it.remove();
-            }
-            else {
-                point.update(WCTouchPoint.STATE_STATIONARY);
-            }
-        }
-    }
-
     private static boolean isSet(int modifiers, int modifier) {
         return modifier == (modifier & modifiers);
     }
--- a/webview/src/com/sun/webkit/FileSystem.java	Thu May 23 17:10:40 2013 -0700
+++ b/webview/src/com/sun/webkit/FileSystem.java	Tue May 28 09:38:44 2013 -0700
@@ -4,23 +4,34 @@
 package com.sun.webkit;
 
 import java.io.File;
+import static java.lang.String.format;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
-/**
- * The implementation of the file system-related WebKit callbacks.
- */
 final class FileSystem {
-    
-    /**
-     * The private default constructor. Ensures non-instantiability.
-     */
+
+    private final static Logger logger =
+            Logger.getLogger(FileSystem.class.getName());
+
+
     private FileSystem() {
         throw new AssertionError();
     }
-    
 
-    /**
-     * Given a file path, returns the name of the file.
-     */
+
+    private static long fwkGetFileSize(String path) {
+        try {
+            File file = new File(path);
+            if (file.exists()) {
+                return file.length();
+            }
+        } catch (SecurityException ex) {
+            logger.log(Level.FINE, format("Error determining "
+                    + "size of file [%s]", path), ex);
+        }
+        return -1;
+    }
+
     private static String fwkPathGetFileName(String path) {
         return new File(path).getName();
     }
--- a/webview/src/com/sun/webkit/WebPage.java	Thu May 23 17:10:40 2013 -0700
+++ b/webview/src/com/sun/webkit/WebPage.java	Tue May 28 09:38:44 2013 -0700
@@ -9,7 +9,6 @@
 import com.sun.webkit.event.WCKeyEvent;
 import com.sun.webkit.event.WCMouseEvent;
 import com.sun.webkit.event.WCMouseWheelEvent;
-import com.sun.webkit.event.WCTouchEvent;
 import com.sun.webkit.graphics.*;
 import com.sun.webkit.network.CookieManager;
 import static com.sun.webkit.network.URLs.newURL;
@@ -833,22 +832,6 @@
         }
     }
 
-    public boolean dispatchTouchEvent(WCTouchEvent ev) {
-        lockPage();
-        try {
-            log.log(Level.FINEST, "dispatchTouchEvent");
-            if (isDisposed) {
-                log.log(Level.FINE, "Touch event for a disposed web page.");
-                return false;
-            }
-            return twkProcessTouchEvent(getPage(), ev.getID(), ev.getTouchData(),
-                    ev.isShiftDown(), ev.isControlDown(), ev.isAltDown(), ev.isMetaDown(),
-                    ev.getWhen() / 1000f);
-        } finally {
-            unlockPage();
-        }
-    }
-
     public boolean dispatchInputMethodEvent(WCInputMethodEvent ie) {
         lockPage();
         try {
@@ -2511,9 +2494,6 @@
                                                      float dx, float dy,
                                                      boolean shift, boolean control, boolean alt, boolean meta,
                                                      float when);
-    private native boolean twkProcessTouchEvent(long pPage, int id, ByteBuffer touchData,
-            boolean shift, boolean control, boolean alt, boolean meta, float when);
-
     private native boolean twkProcessInputTextChange(long pPage, String committed, String composed,
                                                      int[] attributes, int caretPosition);
     private native boolean twkProcessCaretPositionChange(long pPage, int caretPosition);
--- a/webview/src/com/sun/webkit/event/WCTouchEvent.java	Thu May 23 17:10:40 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- */
-package com.sun.webkit.event;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.util.List;
-
-public final class WCTouchEvent {
-
-    public final static int TOUCH_START = 0;
-    public final static int TOUCH_MOVE = 1;
-    public final static int TOUCH_END = 2;
-    public final static int TOUCH_CANCEL = 3;
-
-    private final int id;
-    private final long when;
-
-    private final boolean shift;
-    private final boolean control;
-    private final boolean alt;
-    private final boolean meta;
-
-    private final ByteBuffer data;
-
-    public WCTouchEvent(int id, List<WCTouchPoint> points,
-                        long when, boolean shift, boolean control, boolean alt, boolean meta) {
-        this.id = id;
-        this.when = when;
-        this.shift = shift;
-        this.control = control;
-        this.alt = alt;
-        this.meta = meta;
-        // each point holds 6 data items of type int which is 4 bytes
-        this.data = ByteBuffer.allocateDirect(6 * 4 * points.size());
-        this.data.order(ByteOrder.nativeOrder());
-        for (WCTouchPoint point : points) {
-            point.putTo(this.data);
-        }
-    }
-
-    public int getID() { return this.id; }
-    public long getWhen() { return this.when; }
-
-    public boolean isShiftDown() { return this.shift; }
-    public boolean isControlDown() { return this.control; }
-    public boolean isAltDown() { return this.alt; }
-    public boolean isMetaDown() { return this.meta; }
-
-    public ByteBuffer getTouchData() { return this.data; }
-}
--- a/webview/src/com/sun/webkit/event/WCTouchPoint.java	Thu May 23 17:10:40 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- */
-package com.sun.webkit.event;
-
-import java.nio.ByteBuffer;
-
-public final class WCTouchPoint {
-
-    // see WebCore/platform/PlatformTouchPoint::State
-    public final static int STATE_RELEASED = 0;
-    public final static int STATE_PRESSED = 1;
-    public final static int STATE_MOVED = 2;
-    public final static int STATE_STATIONARY = 3;
-    public final static int STATE_CANCELLED = 4;
-
-    private final int id;
-    private int state;
-    private double x;
-    private double y;
-    private double screenX;
-    private double screenY;
-
-    public WCTouchPoint(int id, int state, double x, double y, double screenX, double screenY) {
-        this.id = id;
-        this.state = state;
-        this.x = x;
-        this.y = y;
-        this.screenX = screenX;
-        this.screenY = screenY;
-    }
-
-    public int getID() { return this.id; }
-    public int getState() { return this.state; }
-
-    public double getX() { return this.x; }
-    public double getY() { return this.y; }
-
-    public double getScreenX() { return this.screenX; }
-    public double getScreenY() { return this.screenY; }
-
-    public void update(int state) {
-        this.state = state;
-    }
-
-    public void update(double x, double y) {
-        x -= this.x;
-        y -= this.y;
-        this.x += x;
-        this.y += y;
-        this.screenX += x;
-        this.screenY += y;
-        this.state = STATE_MOVED;
-    }
-
-    void putTo(ByteBuffer buffer) {
-        buffer.putInt(this.id);
-        buffer.putInt(this.state);
-        buffer.putInt(Math.round((float) this.x));
-        buffer.putInt(Math.round((float) this.y));
-        buffer.putInt(Math.round((float) this.screenX));
-        buffer.putInt(Math.round((float) this.screenY));
-    }
-}
--- a/webview/src/javafx/scene/web/WebEngine.java	Thu May 23 17:10:40 2013 -0700
+++ b/webview/src/javafx/scene/web/WebEngine.java	Tue May 28 09:38:44 2013 -0700
@@ -3,7 +3,6 @@
  */
 package javafx.scene.web;
 
-import com.sun.javafx.beans.annotations.NoBuilder;
 import com.sun.javafx.scene.web.Debugger;
 import com.sun.javafx.tk.TKPulseListener;
 import com.sun.javafx.tk.Toolkit;
@@ -269,7 +268,6 @@
  * JavaFX Application thread. This rule also applies to any DOM and JavaScript
  * objects obtained from the {@code WebEngine} object.
  */
-@NoBuilder
 final public class WebEngine {
     static {
         Accessor.setPageAccessor(new Accessor.PageAccessor() {
--- a/webview/src/javafx/scene/web/WebView.java	Thu May 23 17:10:40 2013 -0700
+++ b/webview/src/javafx/scene/web/WebView.java	Tue May 28 09:38:44 2013 -0700
@@ -3,7 +3,6 @@
  */
 package javafx.scene.web;
 
-import com.sun.javafx.beans.annotations.NoBuilder;
 import com.sun.javafx.css.converters.BooleanConverter;
 import com.sun.javafx.css.converters.EnumConverter;
 import com.sun.javafx.css.converters.SizeConverter;
@@ -25,8 +24,6 @@
 import com.sun.webkit.event.WCKeyEvent;
 import com.sun.webkit.event.WCMouseEvent;
 import com.sun.webkit.event.WCMouseWheelEvent;
-import com.sun.webkit.event.WCTouchEvent;
-import com.sun.webkit.event.WCTouchPoint;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -61,8 +58,6 @@
 import javafx.scene.input.MouseButton;
 import javafx.scene.input.MouseEvent;
 import javafx.scene.input.ScrollEvent;
-import javafx.scene.input.TouchEvent;
-import javafx.scene.input.TouchPoint;
 import javafx.scene.input.TransferMode;
 import javafx.scene.text.FontSmoothingType;
 
@@ -77,7 +72,6 @@
  * <p>{@code WebView} objects must be created and accessed solely from the
  * FX thread.
  */
-@NoBuilder
 final public class WebView extends Parent {
 
     private static final Map<Object, Integer> idMap = new HashMap<Object, Integer>();
@@ -1025,33 +1019,6 @@
         }
     }
 
-    private void processTouchEvent(TouchEvent event) {
-        if (page == null) return;
-
-        Integer id = idMap.get(event.getEventType());
-        if (id == null) return;
-
-        List<WCTouchPoint> points = new ArrayList<WCTouchPoint>(event.getTouchCount());
-        for (TouchPoint point : event.getTouchPoints()) {
-            points.add(new WCTouchPoint(
-                    point.getId(),
-                    idMap.get(point.getState()),
-                    point.getX(),
-                    point.getY(),
-                    point.getScreenX(),
-                    point.getScreenY()));
-        }
-        WCTouchEvent touchEvent = new WCTouchEvent(
-                id, points,
-                System.currentTimeMillis(),
-                event.isShiftDown(),
-                event.isControlDown(),
-                event.isAltDown(),
-                event.isMetaDown());
-        page.dispatchTouchEvent(touchEvent);
-        event.consume();
-    }
-
     private InputMethodClientImpl getInputMethodClient() {
          if (imClient == null) {
              synchronized (this) {
@@ -1147,12 +1114,6 @@
                     processScrollEvent(event);
                 }
             });
-        addEventHandler(TouchEvent.ANY,
-            new EventHandler<TouchEvent>() {
-                @Override public void handle(final TouchEvent event) {
-                    processTouchEvent(event);
-                }
-            });
         setOnInputMethodTextChanged(
             new EventHandler<InputMethodEvent>() {
                 @Override public void handle(final InputMethodEvent event) {
@@ -1305,14 +1266,5 @@
         idMap.put(KeyEvent.KEY_PRESSED, WCKeyEvent.KEY_PRESSED);
         idMap.put(KeyEvent.KEY_RELEASED, WCKeyEvent.KEY_RELEASED);
         idMap.put(KeyEvent.KEY_TYPED, WCKeyEvent.KEY_TYPED);
-
-        idMap.put(TouchEvent.TOUCH_PRESSED, WCTouchEvent.TOUCH_START);
-        idMap.put(TouchEvent.TOUCH_MOVED, WCTouchEvent.TOUCH_MOVE);
-        idMap.put(TouchEvent.TOUCH_RELEASED, WCTouchEvent.TOUCH_END);
-
-        idMap.put(TouchPoint.State.MOVED, WCTouchPoint.STATE_MOVED);
-        idMap.put(TouchPoint.State.PRESSED, WCTouchPoint.STATE_PRESSED);
-        idMap.put(TouchPoint.State.RELEASED, WCTouchPoint.STATE_RELEASED);
-        idMap.put(TouchPoint.State.STATIONARY, WCTouchPoint.STATE_STATIONARY);
     }
 }
--- a/webview/test/javafx/scene/web/DOMTest.java	Thu May 23 17:10:40 2013 -0700
+++ b/webview/test/javafx/scene/web/DOMTest.java	Tue May 28 09:38:44 2013 -0700
@@ -270,7 +270,6 @@
                     , false //boolean altGraphKey
             );
             WheelEventImpl evWheelUp = (WheelEventImpl)((DocumentEvent)htmlDoc).createEvent("WheelEvent");
-            TouchEventImpl evTouch = (TouchEventImpl)((DocumentEvent)htmlDoc).createEvent("TouchEvent");
 
             // dispatch test
             MouseEvent evClick = (MouseEvent)((DocumentEvent)htmlDoc).createEvent("MouseEvent");