changeset 6943:5e0c832019c3

Automated merge with ssh://jfxsrc.us.oracle.com//javafx/8u/master/jfx/rt
author kcr
date Wed, 30 Apr 2014 08:30:58 -0700
parents 66289f859d06 9ec54207d0ad
children b6812eeecbc9
files modules/base/src/main/java/com/sun/javafx/logging/JFRInputEvent.java modules/base/src/main/java/com/sun/javafx/logging/JFRLogger.java modules/base/src/main/java/com/sun/javafx/logging/JFRPulseEvent.java
diffstat 74 files changed, 1289 insertions(+), 777 deletions(-) [+]
line wrap: on
line diff
--- a/.idea/base.iml	Wed Apr 30 07:48:01 2014 -0700
+++ b/.idea/base.iml	Wed Apr 30 08:30:58 2014 -0700
@@ -9,6 +9,7 @@
       <sourceFolder url="file://$MODULE_DIR$/modules/base/src/main/resources" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/modules/base/src/test/java" isTestSource="true" />
       <sourceFolder url="file://$MODULE_DIR$/modules/base/src/test/resources" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/modules/base/src/main/java-jfr" isTestSource="false" />
       <excludeFolder url="file://$MODULE_DIR$/modules/base/build/classes" />
       <excludeFolder url="file://$MODULE_DIR$/modules/base/build/dependency-cache" />
       <excludeFolder url="file://$MODULE_DIR$/modules/base/build/libs" />
--- a/.idea/deploy.iml	Wed Apr 30 07:48:01 2014 -0700
+++ b/.idea/deploy.iml	Wed Apr 30 08:30:58 2014 -0700
@@ -11,7 +11,6 @@
     </src_description>
   </component>
   <component name="NewModuleRootManager" inherit-compiler-output="true">
-    <output url="file://$MODULE_DIR$/../deploy/bin" />
     <exclude-output />
     <content url="file://$MODULE_DIR$/../deploy">
       <sourceFolder url="file://$MODULE_DIR$/../deploy/lib" isTestSource="false" />
@@ -22,7 +21,6 @@
     </content>
     <orderEntry type="sourceFolder" forTests="false" />
     <orderEntry type="module" module-name="rt" />
-    <orderEntry type="module" module-name="rt-closed" />
     <orderEntry type="module-library">
       <library name="plugin.jar">
         <CLASSES>
--- a/.idea/rt-closed.iml	Wed Apr 30 07:48:01 2014 -0700
+++ b/.idea/rt-closed.iml	Wed Apr 30 08:30:58 2014 -0700
@@ -1,81 +1,140 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <module type="JAVA_MODULE" version="4">
   <component name="EclipseModuleManager">
-    <libelement value="jar://$MODULE_DIR$/../caches/sdk/build/lib/desktop/jfxmedia.jar!/" />
-    <libelement value="file://../caches/sdk/build/lib/desktop/deploy.jar" />
-    <libelement value="jar://$MODULE_DIR$/../import/swt-3.7.1/swt-debug.jar!/" />
+    <libelement value="jar://$MODULE_DIR$/../import/benchmarks-2.1.1/benchmarks-2.1.1.jar!/" />
     <src_description expected_position="0">
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/benchmark/VMPerformance/src" expected_position="0" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/glass/glass-test/test" expected_position="1" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/glass/UseCases/src" expected_position="2" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/javafx-android/webnode/src" expected_position="3" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/javafx-font-t2k/src" expected_position="4" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/javafx-ios/src" expected_position="5" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/javafx-mx-common/src" expected_position="6" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/javafx-mx-impl/src" expected_position="7" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/javafx-mx-impl/test/unit" expected_position="8" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/javafx-ui-desktop/src" expected_position="9" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/porting/src" expected_position="10" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/prism-bench/src" expected_position="11" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/tests/security/ES2NativeTest/test" expected_position="12" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/tests/security/GetWindowsTest/test" expected_position="13" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/tests/security/LoaderDisposeTest/test" expected_position="14" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/tests/security/MediaFuzzing/src" expected_position="15" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/tests/security/MediaFuzzing/test" expected_position="16" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/BlendTest/src" expected_position="17" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/CameraTests/src" expected_position="18" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/CanvasTest/src" expected_position="19" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/ColorCube/src" expected_position="20" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/CursorFXTest/src" expected_position="21" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/DirectoryBrowser/src" expected_position="22" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/DragDropColor/src" expected_position="23" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/DragDropText/src" expected_position="24" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/DragDropWithControls/src" expected_position="25" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/EarthCubeFX2/src" expected_position="26" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/EmbeddedSwing/src" expected_position="27" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/FX8-3DAPI/src" expected_position="28" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/GlassRobotTest/src" expected_position="29" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/Gradients/src" expected_position="30" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/GridExamples/src" expected_position="31" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/HelloFXCanvas/src" expected_position="32" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/HelloWorld/src" expected_position="33" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/LinuxInputTest/src" expected_position="34" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/LinuxInputTest/test" expected_position="35" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/NodeBlendTests/src" expected_position="36" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/PickTest3D/src" expected_position="37" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/SceneLeak/src" expected_position="38" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/ShapeT3DTest/src" expected_position="39" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/SwingBalls/src" expected_position="40" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/SwingBalls/css" expected_position="41" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/SwingNodeMark/src" expected_position="42" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/TextTest/src" expected_position="43" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/TouchSuite/src" expected_position="44" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/VideoCube/src" expected_position="45" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/Visual3DTest/src" expected_position="46" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/WebLauncher/src" expected_position="47" />
-      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/ZBufferTest/src" expected_position="48" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/glass/glass-test/test" expected_position="0" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/glass/UseCases/src" expected_position="1" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/javafx-font-t2k/src" expected_position="2" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/performance/BenchShapes/src" expected_position="3" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/performance/Charts/src" expected_position="4" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/performance/ColorfulShapes/src" expected_position="5" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/performance/Controls/src" expected_position="6" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/performance/DirtyArea/src" expected_position="7" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/performance/embedded/ui-performance/src" expected_position="8" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/performance/Fire/src" expected_position="9" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/performance/FXBenchmark/src" expected_position="10" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/performance/FXTester/src" expected_position="11" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/performance/GUIMark2/src" expected_position="12" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/performance/GUIMark2-SE/src" expected_position="13" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/performance/GUIMark3/src" expected_position="14" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/performance/LayoutTest/src" expected_position="15" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/performance/ListView/src" expected_position="16" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/performance/MediaSystemTest/src" expected_position="17" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/performance/MouseResponseTest/src" expected_position="18" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/performance/NodeMemory/src" expected_position="19" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/performance/SDKSizeAnalyzer/src" expected_position="20" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/performance/SpiralText/src" expected_position="21" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/performance/Surface/src" expected_position="22" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/performance/WebNodeTestSuite/src" expected_position="23" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/porting/src" expected_position="24" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/prism-bench/src" expected_position="25" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/prism-bench/options" expected_position="26" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/tests/security/DragOverTest/src" expected_position="27" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/tests/security/ES2NativeTest/test" expected_position="28" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/tests/security/EvilFXApplet/src" expected_position="29" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/tests/security/FullScreen/FullScreenHelper/src" expected_position="30" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/tests/security/FullScreen/FullScreenRunner/src" expected_position="31" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/tests/security/FullScreen/FullScreenTest/src" expected_position="32" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/tests/security/FXMLDefaultClassLoader/test" expected_position="33" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/tests/security/GetWindowsTest/test" expected_position="34" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/tests/security/LoaderDisposeTest/test" expected_position="35" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/tests/security/MediaFuzzing/src" expected_position="36" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/tests/security/MediaFuzzing/test" expected_position="37" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/tests/security/MediaFuzzing/mediafiles" expected_position="38" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/tests/security/NativeHandleTest/test" expected_position="39" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/tests/security/PulseCallbackHelper/src" expected_position="40" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/tests/security/PulseCallbackTest/test" expected_position="41" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/tests/security/SandboxedClipboardTest/test" expected_position="42" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/tests/security/ServiceHelper/src" expected_position="43" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/tests/security/ServiceTest/test" expected_position="44" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/tests/security/TestUtils/src" expected_position="45" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/tests/security/TransparentWindowsTest/test" expected_position="46" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/a11y/src" expected_position="47" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/BlendTest/src" expected_position="48" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/CameraTests/src" expected_position="49" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/CanvasTest/src" expected_position="50" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/ColorCube/src" expected_position="51" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/CursorFXTest/src" expected_position="52" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/DirectoryBrowser/src" expected_position="53" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/DragDropColor/src" expected_position="54" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/DragDropText/src" expected_position="55" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/DragDropWithControls/src" expected_position="56" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/EarthCubeFX2/src" expected_position="57" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/EmbeddedSwing/src" expected_position="58" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/FX8-3DAPI/src" expected_position="59" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/GlassRobotTest/src" expected_position="60" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/Gradients/src" expected_position="61" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/GridExamples/src" expected_position="62" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/HelloBenchmark/perf" expected_position="63" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/HelloFXCanvas/src" expected_position="64" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/HelloWorld/src" expected_position="65" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/NodeBlendTests/src" expected_position="66" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/PickTest3D/src" expected_position="67" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/SceneLeak/src" expected_position="68" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/ShapeT3DTest/src" expected_position="69" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/SwingBalls/src" expected_position="70" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/SwingBalls/css" expected_position="71" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/SwingNodeMark/src" expected_position="72" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/TextTest/src" expected_position="73" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/TouchSuite/src" expected_position="74" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/VideoCube/src" expected_position="75" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/Visual3DTest/src" expected_position="76" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/WebLauncher/src" expected_position="77" />
+      <src_folder value="file://$MODULE_DIR$/../rt-closed/toys/ZBufferTest/src" expected_position="78" />
     </src_description>
   </component>
   <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <output url="file://$MODULE_DIR$/../rt-closed/bin" />
     <exclude-output />
     <content url="file://$MODULE_DIR$/../rt-closed">
-      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/benchmark/VMPerformance/src" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/glass/glass-test/test" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/../rt-closed/glass/UseCases/src" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/javafx-android/webnode/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/../rt-closed/javafx-font-t2k/src" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/javafx-ios/src" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/javafx-mx-common/src" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/javafx-mx-impl/src" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/javafx-mx-impl/test/unit" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/javafx-ui-desktop/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/performance/BenchShapes/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/performance/Charts/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/performance/ColorfulShapes/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/performance/Controls/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/performance/DirtyArea/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/performance/embedded/ui-performance/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/performance/Fire/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/performance/FXBenchmark/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/performance/FXTester/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/performance/GUIMark2/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/performance/GUIMark2-SE/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/performance/GUIMark3/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/performance/LayoutTest/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/performance/ListView/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/performance/MediaSystemTest/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/performance/MouseResponseTest/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/performance/NodeMemory/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/performance/SDKSizeAnalyzer/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/performance/SpiralText/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/performance/Surface/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/performance/WebNodeTestSuite/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/../rt-closed/porting/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/../rt-closed/prism-bench/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/prism-bench/options" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/tests/security/DragOverTest/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/../rt-closed/tests/security/ES2NativeTest/test" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/tests/security/EvilFXApplet/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/tests/security/FullScreen/FullScreenHelper/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/tests/security/FullScreen/FullScreenRunner/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/tests/security/FullScreen/FullScreenTest/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/tests/security/FXMLDefaultClassLoader/test" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/../rt-closed/tests/security/GetWindowsTest/test" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/../rt-closed/tests/security/LoaderDisposeTest/test" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/../rt-closed/tests/security/MediaFuzzing/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/../rt-closed/tests/security/MediaFuzzing/test" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/tests/security/MediaFuzzing/mediafiles" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/tests/security/NativeHandleTest/test" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/tests/security/PulseCallbackHelper/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/tests/security/PulseCallbackTest/test" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/tests/security/SandboxedClipboardTest/test" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/tests/security/ServiceHelper/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/tests/security/ServiceTest/test" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/tests/security/TestUtils/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/tests/security/TransparentWindowsTest/test" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/toys/a11y/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/../rt-closed/toys/BlendTest/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/../rt-closed/toys/CameraTests/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/../rt-closed/toys/CanvasTest/src" isTestSource="false" />
@@ -91,10 +150,9 @@
       <sourceFolder url="file://$MODULE_DIR$/../rt-closed/toys/GlassRobotTest/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/../rt-closed/toys/Gradients/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/../rt-closed/toys/GridExamples/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/toys/HelloBenchmark/perf" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/../rt-closed/toys/HelloFXCanvas/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/../rt-closed/toys/HelloWorld/src" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/toys/LinuxInputTest/src" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/toys/LinuxInputTest/test" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/../rt-closed/toys/NodeBlendTests/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/../rt-closed/toys/PickTest3D/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/../rt-closed/toys/SceneLeak/src" isTestSource="false" />
@@ -108,11 +166,29 @@
       <sourceFolder url="file://$MODULE_DIR$/../rt-closed/toys/Visual3DTest/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/../rt-closed/toys/WebLauncher/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/../rt-closed/toys/ZBufferTest/src" isTestSource="false" />
-      <excludeFolder url="file://$MODULE_DIR$/../rt-closed/javafx-android" />
+      <sourceFolder url="file://$MODULE_DIR$/../rt-closed/glass/glass-test/test" isTestSource="false" />
     </content>
     <orderEntry type="sourceFolder" forTests="false" />
     <orderEntry type="module" module-name="rt" exported="" />
+    <orderEntry type="module-library">
+      <library name="benchmarks-2.1.1.jar">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../import/benchmarks-2.1.1/benchmarks-2.1.1.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
     <orderEntry type="inheritedJdk" />
+    <orderEntry type="module-library">
+      <library name="junit4">
+        <CLASSES>
+          <root url="jar://$APPLICATION_HOME_DIR$/lib/junit-4.11.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
   </component>
 </module>
 
--- a/build.gradle	Wed Apr 30 07:48:01 2014 -0700
+++ b/build.gradle	Wed Apr 30 08:30:58 2014 -0700
@@ -1136,6 +1136,9 @@
             systemProperty 'glass.platform', 'Monocle'
             systemProperty 'monocle.platform', 'Headless'
             systemProperty 'prism.order', 'sw'
+            systemProperty 'com.sun.javafx.gestures.zoom', 'true'
+            systemProperty 'com.sun.javafx.gestures.rotate', 'true'
+            systemProperty 'com.sun.javafx.gestures.scroll', 'true'
         }
     }
 
@@ -1206,11 +1209,18 @@
 
     // Make sure to include $buildDir/generated-src/version-info that we previously created.
     // We DO NOT want to include src/main/version-info
-    if (System.getProperty("jfx.build.jdk.defenders", "true").equals("true")) { 
-        sourceSets.main.java.srcDirs = ["src/main/java", "src/main/java8", "$buildDir/generated-src/version-info"] 
-    } else { 
-        sourceSets.main.java.srcDirs = ["src/main/java", "src/main/java7", "$buildDir/generated-src/version-info"] 
-    } 
+    if (System.getProperty("jfx.build.jdk.defenders", "true").equals("true")) {
+        sourceSets.main.java.srcDirs += "src/main/java8"
+    } else {
+        sourceSets.main.java.srcDirs += "src/main/java7"
+    }
+
+    if (file("$JDK_HOME/jre/lib/jfr.jar").exists()) {
+        sourceSets.main.java.srcDirs += "src/main/java-jfr"
+    }
+
+    sourceSets.main.java.srcDirs += "$buildDir/generated-src/version-info"
+
     compileJava.dependsOn processVersionInfo
 }
 
--- a/buildSrc/x86egl.gradle	Wed Apr 30 07:48:01 2014 -0700
+++ b/buildSrc/x86egl.gradle	Wed Apr 30 08:30:58 2014 -0700
@@ -298,6 +298,7 @@
     "com/sun/glass/events/**",
     "com/sun/glass/ui/*",
     "com/sun/glass/ui/lens/*",
+    "com/sun/glass/ui/monocle/*",
     "com/sun/glass/ui/monocle/linux/*",
     "com/sun/glass/ui/monocle/util/*",
     "com/sun/glass/ui/monocle/x11/*",
@@ -306,6 +307,7 @@
 
 X86EGL.glass.monocle = [:]
 X86EGL.glass.monocle.nativeSource = [
+        file("modules/graphics/src/main/native-glass/monocle"),
         file("modules/graphics/src/main/native-glass/monocle/linux"),
         file("modules/graphics/src/main/native-glass/monocle/util") ]
 X86EGL.glass.monocle.compiler = compiler
@@ -444,7 +446,7 @@
 X86EGL.iio.lib = "javafx_iio"
 
 X86EGL.prismES2 = [:]
-X86EGL.prismES2.variants = ["eglfb"]
+X86EGL.prismES2.variants = ["eglfb", "monocle"]
 X86EGL.prismES2.javahInclude = ["com/sun/prism/es2/**/*"]
 
 X86EGL.prismES2.eglfb = [:]
@@ -471,6 +473,18 @@
 X86EGL.prismES2.eglx11.linkFlags = es2X11LFlags
 X86EGL.prismES2.eglx11.lib = "prism_es2_eglx11"
 
+X86EGL.prismES2.monocle= [:]
+X86EGL.prismES2.monocle.nativeSource = [
+        file("modules/graphics/src/main/native-prism-es2"),
+        file("modules/graphics/src/main/native-prism-es2/GL"),
+        file("modules/graphics/src/main/native-prism-es2/monocle")
+]
+X86EGL.prismES2.monocle.compiler = compiler
+X86EGL.prismES2.monocle.ccFlags = [ es2EglfbCFlags, "-I", X86EGL.glass.lensport.nativeSource ].flatten()
+X86EGL.prismES2.monocle.linker = linker
+X86EGL.prismES2.monocle.linkFlags = es2EglfbLFlags
+X86EGL.prismES2.monocle.lib = "prism_es2_monocle"
+
 def closedDir = file("$projectDir/../rt-closed")
 X86EGL.font = [:]
 X86EGL.font.javahInclude = [
--- a/modules/base/.classpath	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/base/.classpath	Wed Apr 30 08:30:58 2014 -0700
@@ -4,6 +4,7 @@
   <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
   <classpathentry kind="src" exported="true" path="src/main/java"/>
   <classpathentry kind="src" exported="true" path="src/main/java8"/>
+  <classpathentry kind="src" exported="true" path="src/main/java-jfr"/>
   <classpathentry kind="src" exported="true" path="src/test/java">
   <attributes>
       <attribute name="optional" value="true"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/base/src/main/java-jfr/com/sun/javafx/logging/JFRInputEvent.java	Wed Apr 30 08:30:58 2014 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2014, 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.logging;
+
+import com.oracle.jrockit.jfr.ContentType;
+import com.oracle.jrockit.jfr.EventDefinition;
+import com.oracle.jrockit.jfr.EventToken;
+import com.oracle.jrockit.jfr.TimedEvent;
+import com.oracle.jrockit.jfr.ValueDefinition;
+
+@EventDefinition(path="javafx/input", name = "JavaFX Input", description="JavaFX input event", stacktrace=false, thread=true)
+public class JFRInputEvent extends TimedEvent {
+
+    @ValueDefinition(name="inputType", description="Input event type", contentType=ContentType.None)
+    private String input;
+    
+    public JFRInputEvent(EventToken eventToken) {
+        super(eventToken);
+    }
+
+    public String getInput() {
+        return input;
+    }
+    
+    public void setInput(String s) {
+        input = s;
+    }    
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/base/src/main/java-jfr/com/sun/javafx/logging/JFRLogger.java	Wed Apr 30 08:30:58 2014 -0700
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 2014, 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.logging;
+
+import com.oracle.jrockit.jfr.EventToken;
+import com.oracle.jrockit.jfr.Producer;
+
+/**
+ * Logs pulse related information with Java Flight Recorder.
+ */
+class JFRLogger extends Logger {
+    
+    private static final String PRODUCER_URI = "http://www.oracle.com/technetwork/java/javafx/index.html";
+    private static JFRLogger jfrLogger;
+    
+    private final Producer producer;
+    private final EventToken pulseEventToken;
+    private final EventToken inputEventToken;
+    private final ThreadLocal<JFRPulseEvent> curPhaseEvent;
+    private final ThreadLocal<JFRInputEvent> curInputEvent;
+        
+    private JFRLogger() throws Exception {
+        producer = new Producer("JavaFX producer", "JavaFX producer.", PRODUCER_URI);
+        pulseEventToken = producer.addEvent(JFRPulseEvent.class);
+        inputEventToken = producer.addEvent(JFRInputEvent.class);
+        producer.register();
+        curPhaseEvent = new ThreadLocal() {
+            @Override
+            public JFRPulseEvent initialValue() {
+                return new JFRPulseEvent(pulseEventToken);
+            }
+        };
+        curInputEvent = new ThreadLocal(){
+            @Override
+            public JFRInputEvent initialValue() {
+                return new JFRInputEvent(inputEventToken);
+            }
+        };
+    }
+    
+    public static JFRLogger getInstance() {
+        if (jfrLogger == null) {
+            /* Guards against exceptions in the constructor and the absence of jfr.jar at run time */
+            try {
+                Class klass = Class.forName("com.oracle.jrockit.jfr.FlightRecorder");
+                if (klass != null && com.oracle.jrockit.jfr.FlightRecorder.isActive()) {
+                    jfrLogger = new JFRLogger();
+                }
+            }
+            catch (Exception e) {
+                jfrLogger = null;
+            }
+        }
+        return jfrLogger;
+    }
+    
+    /**
+     *  Pulse number reconstruction for the render thread relies on the current synchronization 
+     *  between the FX and render threads: renderStart() is called on the FX thread after all
+     *  previous RenderJobs have finished and before any new RenderJob is pushed.
+     */
+    private int pulseNumber;
+    private int fxPulseNumber;
+    private int renderPulseNumber;
+    private Thread fxThread;
+    
+    @Override
+    public void pulseStart() {
+        ++pulseNumber;
+        fxPulseNumber = pulseNumber;
+        if (fxThread == null) {
+            fxThread = Thread.currentThread();
+        }
+        newPhase("Pulse start");
+    }
+    
+    @Override
+    public void pulseEnd() {
+        newPhase(null);
+        fxPulseNumber = 0;
+    }
+    
+    @Override
+    public void renderStart() {
+        renderPulseNumber = fxPulseNumber;
+    }
+
+    @Override
+    public void renderEnd() {
+        newPhase(null);
+        renderPulseNumber = 0;
+    }
+    
+    /**
+     * Finishes the current phase and starts a new one if phaseName is not null.
+     * @param phaseName The name for the new phase.
+     */
+    @Override
+    public void newPhase(String phaseName) {
+        if (pulseEventToken == null) {
+            return;
+        }
+        
+        JFRPulseEvent event = curPhaseEvent.get();
+
+        /* Cleanup if recording has finished */
+        if (!pulseEventToken.isEnabled()) {
+            event.setPhase(null);
+            return;
+        }
+        
+        /* Finish the previous phase if any */
+        if (event.getPhase() != null) {
+            event.end();
+            event.commit();
+        }
+
+        /* Done if the new phase name is null */
+        if (phaseName == null) {
+            event.setPhase(null);
+            return;
+        }
+                
+        event.reset();
+        event.begin();
+        event.setPhase(phaseName);
+        event.setPulseNumber(Thread.currentThread() == fxThread ? fxPulseNumber : renderPulseNumber);
+    }
+
+    @Override
+    public void newInput(String input) {
+        if (inputEventToken == null) {
+            return;
+        }
+
+        JFRInputEvent event = curInputEvent.get();
+
+        /* Cleanup if recording has finished */
+        if (!inputEventToken.isEnabled()) {
+            event.setInput(null);
+            return;
+        }
+        
+        /* Finish the previous input event if any */
+        if (event.getInput() != null) {
+            event.end();
+            event.commit();
+        }
+
+        /* Done if the new input is null */
+        if (input == null) {
+            event.setInput(null);
+            return;
+        }
+        
+        event.reset();
+        event.begin();
+        event.setInput(input);
+    }    
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/base/src/main/java-jfr/com/sun/javafx/logging/JFRPulseEvent.java	Wed Apr 30 08:30:58 2014 -0700
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2014, 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.logging;
+
+import com.oracle.jrockit.jfr.ContentType;
+import com.oracle.jrockit.jfr.EventDefinition;
+import com.oracle.jrockit.jfr.EventToken;
+import com.oracle.jrockit.jfr.TimedEvent;
+import com.oracle.jrockit.jfr.ValueDefinition;
+
+@EventDefinition(path="javafx/pulse", name = "JavaFX Pulse Phase", description="Describes a phase in JavaFX pulse processing", stacktrace=false, thread=true)
+public class JFRPulseEvent extends TimedEvent {
+
+    @ValueDefinition(name="pulseID", description="Pulse number", contentType=ContentType.None, relationKey="http://www.oracle.com/javafx/pulse/id")
+    private int pulseNumber;
+
+    @ValueDefinition(name="phaseName", description="Pulse phase name", contentType=ContentType.None)
+    private String phase;
+    
+    public JFRPulseEvent(EventToken eventToken) {
+        super(eventToken);
+    }
+
+    public int getPulseNumber() {
+        return pulseNumber;
+    }
+     
+    public void setPulseNumber(int n) {
+        pulseNumber = n;
+    } 
+    
+    public String getPhase() {
+        return phase;
+    }
+    
+    public void setPhase(String s) {
+        phase = s;
+    }
+}
--- a/modules/base/src/main/java/com/sun/javafx/logging/JFRInputEvent.java	Wed Apr 30 07:48:01 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2014, 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.logging;
-
-import com.oracle.jrockit.jfr.ContentType;
-import com.oracle.jrockit.jfr.EventDefinition;
-import com.oracle.jrockit.jfr.EventToken;
-import com.oracle.jrockit.jfr.TimedEvent;
-import com.oracle.jrockit.jfr.ValueDefinition;
-
-@EventDefinition(path="javafx/input", name = "JavaFX Input", description="JavaFX input event", stacktrace=false, thread=true)
-public class JFRInputEvent extends TimedEvent {
-
-    @ValueDefinition(name="inputType", description="Input event type", contentType=ContentType.None)
-    private String input;
-    
-    public JFRInputEvent(EventToken eventToken) {
-        super(eventToken);
-    }
-
-    public String getInput() {
-        return input;
-    }
-    
-    public void setInput(String s) {
-        input = s;
-    }    
-}
--- a/modules/base/src/main/java/com/sun/javafx/logging/JFRLogger.java	Wed Apr 30 07:48:01 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,183 +0,0 @@
-/*
- * Copyright (c) 2014, 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.logging;
-
-import com.oracle.jrockit.jfr.EventToken;
-import com.oracle.jrockit.jfr.Producer;
-
-/**
- * Logs pulse related information with Java Flight Recorder.
- */
-class JFRLogger extends Logger {
-    
-    private static final String PRODUCER_URI = "http://www.oracle.com/technetwork/java/javafx/index.html";
-    private static JFRLogger jfrLogger;
-    
-    private final Producer producer;
-    private final EventToken pulseEventToken;
-    private final EventToken inputEventToken;
-    private final ThreadLocal<JFRPulseEvent> curPhaseEvent;
-    private final ThreadLocal<JFRInputEvent> curInputEvent;
-        
-    private JFRLogger() throws Exception {
-        producer = new Producer("JavaFX producer", "JavaFX producer.", PRODUCER_URI);
-        pulseEventToken = producer.addEvent(JFRPulseEvent.class);
-        inputEventToken = producer.addEvent(JFRInputEvent.class);
-        producer.register();
-        curPhaseEvent = new ThreadLocal() {
-            @Override
-            public JFRPulseEvent initialValue() {
-                return new JFRPulseEvent(pulseEventToken);
-            }
-        };
-        curInputEvent = new ThreadLocal(){
-            @Override
-            public JFRInputEvent initialValue() {
-                return new JFRInputEvent(inputEventToken);
-            }
-        };
-    }
-    
-    public static JFRLogger getInstance() {
-        if (jfrLogger == null) {
-            /* Guards against exceptions in the constructor and the absence of jfr.jar at run time */
-            try {
-                Class klass = Class.forName("com.oracle.jrockit.jfr.FlightRecorder");
-                if (klass != null && com.oracle.jrockit.jfr.FlightRecorder.isActive()) {
-                    jfrLogger = new JFRLogger();
-                }
-            }
-            catch (Exception e) {
-                jfrLogger = null;
-            }
-        }
-        return jfrLogger;
-    }
-    
-    /**
-     *  Pulse number reconstruction for the render thread relies on the current synchronization 
-     *  between the FX and render threads: renderStart() is called on the FX thread after all
-     *  previous RenderJobs have finished and before any new RenderJob is pushed.
-     */
-    private int pulseNumber;
-    private int fxPulseNumber;
-    private int renderPulseNumber;
-    private Thread fxThread;
-    
-    @Override
-    public void pulseStart() {
-        ++pulseNumber;
-        fxPulseNumber = pulseNumber;
-        if (fxThread == null) {
-            fxThread = Thread.currentThread();
-        }
-        newPhase("Pulse start");
-    }
-    
-    @Override
-    public void pulseEnd() {
-        newPhase(null);
-        fxPulseNumber = 0;
-    }
-    
-    @Override
-    public void renderStart() {
-        renderPulseNumber = fxPulseNumber;
-    }
-
-    @Override
-    public void renderEnd() {
-        newPhase(null);
-        renderPulseNumber = 0;
-    }
-    
-    /**
-     * Finishes the current phase and starts a new one if phaseName is not null.
-     * @param phaseName The name for the new phase.
-     */
-    @Override
-    public void newPhase(String phaseName) {
-        if (pulseEventToken == null) {
-            return;
-        }
-        
-        JFRPulseEvent event = curPhaseEvent.get();
-
-        /* Cleanup if recording has finished */
-        if (!pulseEventToken.isEnabled()) {
-            event.setPhase(null);
-            return;
-        }
-        
-        /* Finish the previous phase if any */
-        if (event.getPhase() != null) {
-            event.end();
-            event.commit();
-        }
-
-        /* Done if the new phase name is null */
-        if (phaseName == null) {
-            event.setPhase(null);
-            return;
-        }
-                
-        event.reset();
-        event.begin();
-        event.setPhase(phaseName);
-        event.setPulseNumber(Thread.currentThread() == fxThread ? fxPulseNumber : renderPulseNumber);
-    }
-
-    @Override
-    public void newInput(String input) {
-        if (inputEventToken == null) {
-            return;
-        }
-
-        JFRInputEvent event = curInputEvent.get();
-
-        /* Cleanup if recording has finished */
-        if (!inputEventToken.isEnabled()) {
-            event.setInput(null);
-            return;
-        }
-        
-        /* Finish the previous input event if any */
-        if (event.getInput() != null) {
-            event.end();
-            event.commit();
-        }
-
-        /* Done if the new input is null */
-        if (input == null) {
-            event.setInput(null);
-            return;
-        }
-        
-        event.reset();
-        event.begin();
-        event.setInput(input);
-    }    
-}
--- a/modules/base/src/main/java/com/sun/javafx/logging/JFRPulseEvent.java	Wed Apr 30 07:48:01 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2014, 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.logging;
-
-import com.oracle.jrockit.jfr.ContentType;
-import com.oracle.jrockit.jfr.EventDefinition;
-import com.oracle.jrockit.jfr.EventToken;
-import com.oracle.jrockit.jfr.TimedEvent;
-import com.oracle.jrockit.jfr.ValueDefinition;
-
-@EventDefinition(path="javafx/pulse", name = "JavaFX Pulse Phase", description="Describes a phase in JavaFX pulse processing", stacktrace=false, thread=true)
-public class JFRPulseEvent extends TimedEvent {
-
-    @ValueDefinition(name="pulseID", description="Pulse number", contentType=ContentType.None, relationKey="http://www.oracle.com/javafx/pulse/id")
-    private int pulseNumber;
-
-    @ValueDefinition(name="phaseName", description="Pulse phase name", contentType=ContentType.None)
-    private String phase;
-    
-    public JFRPulseEvent(EventToken eventToken) {
-        super(eventToken);
-    }
-
-    public int getPulseNumber() {
-        return pulseNumber;
-    }
-     
-    public void setPulseNumber(int n) {
-        pulseNumber = n;
-    } 
-    
-    public String getPhase() {
-        return phase;
-    }
-    
-    public void setPhase(String s) {
-        phase = s;
-    }
-}
--- a/modules/base/src/main/java/com/sun/javafx/logging/PulseLogger.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/base/src/main/java/com/sun/javafx/logging/PulseLogger.java	Wed Apr 30 08:30:58 2014 -0700
@@ -25,6 +25,8 @@
 
 package com.sun.javafx.logging;
 
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -40,10 +42,20 @@
         if (logger != null) {
             list.add(logger);
         }
-        logger = JFRLogger.getInstance();
-        if (logger != null) {
-            list.add(logger);
+        try {
+            Class klass = Class.forName("com.sun.javafx.logging.JFRLogger");
+            if (klass != null) {
+                Method method = klass.getDeclaredMethod("getInstance");
+                logger = (Logger) method.invoke(null);
+                if (logger != null) {
+                    list.add(logger);
+                }
+            }
         }
+        catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
+            // Ignore
+        }
+
         loggers = list.toArray(new Logger[list.size()]);
         PULSE_LOGGING_ENABLED = loggers.length > 0;
     }
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/ComboBoxBaseBehavior.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/ComboBoxBaseBehavior.java	Wed Apr 30 08:30:58 2014 -0700
@@ -238,6 +238,7 @@
     
     public void show() {
         if (! getControl().isShowing()) {
+            getControl().requestFocus();
             getControl().show();
         }
     }
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java	Wed Apr 30 08:30:58 2014 -0700
@@ -605,13 +605,6 @@
             @Override protected double computePrefHeight(double width) {
                 return getListViewPrefHeight();
             }
-
-            @Override public Object accGetAttribute(Attribute attribute, Object... parameters) {
-                switch (attribute) {
-                    case PARENT: return comboBox;
-                    default: return super.accGetAttribute(attribute, parameters);
-                }
-            }
         };
 
         _listView.setId("list-view");
@@ -725,13 +718,17 @@
 
     @Override public Object accGetAttribute(Attribute attribute, Object... parameters) {
         switch (attribute) {
-            case CHILDREN: {
-                ObservableList<Node> children = comboBox.getChildrenUnmodifiable();
-                ObservableList<Node> list =  FXCollections.observableArrayList();
-                list.addAll(children);
-                if (!list.contains(listView)) list.add(listView);
-                return list;
-            }
+            case FOCUS_ITEM: {
+              if (comboBox.isShowing()) {
+                  /* On Mac, for some reason, changing the selection on the list is not 
+                   * reported by VoiceOver the first time it shows.
+                   * Note that this fix returns a child of the PopupWindow back to the main
+                   * Stage, which doesn't seem to cause problems.
+                   */
+                  return listView.accGetAttribute(attribute, parameters);
+              }
+              return null;
+          }
             case TITLE: {
                 String title = comboBox.isEditable() ? textField.getText() : buttonCell.getText();
                 if (title == null || title.isEmpty()) {
@@ -739,17 +736,9 @@
                 }
                 return title;
             }
-            case FOCUS_ITEM: if (!comboBox.isShowing()) return super.accGetAttribute(attribute, parameters);
-            //fall through
-            case ROW_COUNT:
-            case MULTIPLE_SELECTION:
-            case ROW_AT_INDEX:
-            case LEAF:
-            case SELECTED_ROWS: {
-                Object o = listView.accGetAttribute(attribute, parameters);
-                //if (o != null) return o;
-                return o;
-            }
+            case SELECTION_START: return textField.getSelection().getStart();
+            case SELECTION_END: return textField.getSelection().getEnd();
+
             //fall through
             default: return super.accGetAttribute(attribute, parameters);
         }
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ListViewSkin.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ListViewSkin.java	Wed Apr 30 08:30:58 2014 -0700
@@ -153,8 +153,13 @@
             while (c.next()) {
                 if (c.wasReplaced()) {
                     // RT-28397: Support for when an item is replaced with itself (but
-                    // updated internal values that should be shown visually)
-                    itemCount = 0;
+                    // updated internal values that should be shown visually).
+                    // This code was updated for RT-36714 to not update all cells,
+                    // just those affected by the change
+                    for (int i = c.getFrom(); i < c.getTo(); i++) {
+                        flow.setCellDirty(i);
+                    }
+
                     break;
                 } else if (c.getRemovedSize() == itemCount) {
                     // RT-22463: If the user clears out an items list then we
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/NestedTableColumnHeader.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/NestedTableColumnHeader.java	Wed Apr 30 08:30:58 2014 -0700
@@ -145,9 +145,7 @@
             if (me.getClickCount() == 2 && me.isPrimaryButtonDown()) {
                 // the user wants to resize the column such that its
                 // width is equal to the widest element in the column
-                if (column.isResizable()) {
-                    header.getTableViewSkin().resizeColumnToFitContent(column, -1);
-                }
+                header.getTableViewSkin().resizeColumnToFitContent(column, -1);
             } else {
                 // rather than refer to the rect variable, we just grab
                 // it from the source to prevent a small memory leak.
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TabPaneSkin.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TabPaneSkin.java	Wed Apr 30 08:30:58 2014 -0700
@@ -70,6 +70,7 @@
 import javafx.scene.input.ContextMenuEvent;
 import javafx.scene.input.MouseButton;
 import javafx.scene.input.MouseEvent;
+import javafx.scene.input.ScrollEvent;
 import javafx.scene.input.SwipeEvent;
 import javafx.scene.layout.Pane;
 import javafx.scene.layout.Region;
@@ -160,7 +161,7 @@
         }
         return null;
     }
-    private static final double ANIMATION_SPEED = 300;
+    private static final double ANIMATION_SPEED = 150;
     private static final int SPACER = 10;
 
     private TabHeaderArea tabHeaderArea;
@@ -244,6 +245,7 @@
             // Animate the tab removal
             final TabHeaderSkin tabRegion = tabHeaderArea.getTabHeaderSkin(tab);
             if (tabRegion != null) {
+                tabRegion.isClosing = true;
                 if (closeTabAnimation.get() == TabAnimation.GROW) {
                     tabRegion.animating = true;
                     Timeline closedTabTimeline = createTimeline(tabRegion, Duration.millis(ANIMATION_SPEED), 0.0F, event -> {
@@ -387,12 +389,14 @@
         // remove the menu item from the popup menu
         ContextMenu popupMenu = tabHeaderArea.controlButtons.popup;
         TabMenuItem tabItem = null;
-        for (MenuItem item : popupMenu.getItems()) {
-            tabItem = (TabMenuItem) item;
-            if (tab == tabItem.getTab()) {
-                break;
+        if (popupMenu != null) {
+            for (MenuItem item : popupMenu.getItems()) {
+                tabItem = (TabMenuItem) item;
+                if (tab == tabItem.getTab()) {
+                    break;
+                }
+                tabItem = null;
             }
-            tabItem = null;
         }
         if (tabItem != null) {
             tabItem.dispose();
@@ -654,14 +658,9 @@
         private StackPane headerBackground;
         private TabControlButtons controlButtons;
 
+        private boolean measureClosingTabs = false;
+
         private double scrollOffset;
-        public double getScrollOffset() {
-            return scrollOffset;
-        }
-        public void setScrollOffset(double value) {
-            scrollOffset = value;
-            headersRegion.requestLayout();
-        }
 
         public TabHeaderArea() {
             getStyleClass().setAll("tab-header-area");
@@ -675,7 +674,7 @@
                     double width = 0.0F;
                     for (Node child : getChildren()) {
                         TabHeaderSkin tabHeaderSkin = (TabHeaderSkin)child;
-                        if (tabHeaderSkin.isVisible()) {
+                        if (tabHeaderSkin.isVisible() && (measureClosingTabs || ! tabHeaderSkin.isClosing)) {
                             width += tabHeaderSkin.prefWidth(height);
                         }
                     }
@@ -714,14 +713,16 @@
                                 }
                                 offset += tabHeaderPrefWidth;                                
                             }
-                        } else {
-                            isSelectingTab = true;
+//                        } else {
+//                            isSelectingTab = true;
                         }
                     }
 
                     if (isSelectingTab) {
                         ensureSelectedTabIsVisible();
                         isSelectingTab = false;
+                    } else {
+                        validateScrollOffset();
                     }
 
                     Side tabPosition = getSkinnable().getSide();
@@ -773,6 +774,24 @@
             }
             getChildren().addAll(headerBackground, headersRegion, controlButtons);
 
+            // support for mouse scroll of header area (for when the tabs exceed
+            // the available space)
+            addEventHandler(ScrollEvent.SCROLL, (ScrollEvent e) -> {
+                Side side = getSkinnable().getSide();
+                side = side == null ? Side.TOP : side;
+                switch (side) {
+                    default:
+                    case TOP:
+                    case BOTTOM:
+                        setScrollOffset(scrollOffset - e.getDeltaY());
+                        break;
+                    case LEFT:
+                    case RIGHT:
+                        setScrollOffset(scrollOffset + e.getDeltaY());
+                        break;
+                }
+
+            });
         }
 
         private void updateHeaderClip() {
@@ -786,7 +805,11 @@
             double shadowRadius = 0;
             double clipOffset = firstTabIndent();
             double controlButtonPrefWidth = snapSize(controlButtons.prefWidth(-1));
+
+            measureClosingTabs = true;
             double headersPrefWidth = snapSize(headersRegion.prefWidth(-1));
+            measureClosingTabs = false;
+
             double headersPrefHeight = snapSize(headersRegion.prefHeight(-1));
 
             // Add the spacer if isShowTabsMenu is true.
@@ -892,13 +915,49 @@
             } else if (selectedTabEndX > (visibleAreaEndX - scrollOffset)) {
                 setScrollOffset(visibleAreaEndX - selectedTabEndX);
             }
+        }
 
-            // need to make sure the right-most tab is attached to the
-            // right-hand side of the tab header (e.g. if the tab header area width
-            // is expanded), and if it isn't modify the scroll offset to bring
-            // it into line. See RT-35194 for a test case.
-            if ((visibleWidth - scrollOffset) > offset && scrollOffset < 0) {
-                setScrollOffset(visibleWidth - offset);
+        public double getScrollOffset() {
+            return scrollOffset;
+        }
+
+        private void validateScrollOffset() {
+            setScrollOffset(getScrollOffset());
+        }
+
+        private void setScrollOffset(double newScrollOffset) {
+            // work out the visible width of the tab header
+            double tabPaneWidth = snapSize(getSkinnable().getWidth());
+            double controlTabWidth = snapSize(controlButtons.getWidth());
+            double visibleWidth = tabPaneWidth - controlTabWidth - firstTabIndent() - SPACER;
+
+            // measure the width of all tabs
+            double offset = 0.0;
+            for (Node node : headersRegion.getChildren()) {
+                TabHeaderSkin tabHeader = (TabHeaderSkin)node;
+                double tabHeaderPrefWidth = snapSize(tabHeader.prefWidth(-1));
+                offset += tabHeaderPrefWidth;
+            }
+
+            double actualNewScrollOffset;
+
+            if ((visibleWidth - newScrollOffset) > offset && newScrollOffset < 0) {
+                // need to make sure the right-most tab is attached to the
+                // right-hand side of the tab header (e.g. if the tab header area width
+                // is expanded), and if it isn't modify the scroll offset to bring
+                // it into line. See RT-35194 for a test case.
+                actualNewScrollOffset = visibleWidth - offset;
+            } else if (newScrollOffset > 0) {
+                // need to prevent the left-most tab from becoming detached
+                // from the left-hand side of the tab header.
+                actualNewScrollOffset = 0;
+            } else {
+                actualNewScrollOffset = newScrollOffset;
+            }
+
+            if (actualNewScrollOffset != scrollOffset) {
+                scrollOffset = actualNewScrollOffset;
+                headersRegion.requestLayout();
             }
         }
 
@@ -949,19 +1008,16 @@
             double tabBackgroundHeight = snapSize(prefHeight(-1));
             double headersPrefWidth = snapSize(headersRegion.prefWidth(-1));
             double headersPrefHeight = snapSize(headersRegion.prefHeight(-1));
-            
-            if (tabsFit()) {
-                controlButtons.showTabsMenu(false);
-            } else {
-                controlButtons.showTabsMenu(true);
-            }
-            
+
+            controlButtons.showTabsMenu(! tabsFit());
+
             updateHeaderClip();
             headersRegion.requestLayout();
 
             // RESIZE CONTROL BUTTONS
             double btnWidth = snapSize(controlButtons.prefWidth(-1));
-            controlButtons.resize(btnWidth, controlButtons.getControlTabHeight());
+            final double btnHeight = controlButtons.prefHeight(btnWidth);
+            controlButtons.resize(btnWidth, btnHeight);
 
             // POSITION TABS
             headersRegion.resize(headersPrefWidth, headersPrefHeight);
@@ -983,29 +1039,29 @@
                 startX = leftInset;
                 startY = tabBackgroundHeight - headersPrefHeight - bottomInset;
                 controlStartX = w - btnWidth + leftInset;
-                controlStartY = snapSize(getHeight()) - controlButtons.getControlTabHeight() - bottomInset;
+                controlStartY = snapSize(getHeight()) - btnHeight - bottomInset;
             } else if (tabPosition.equals(Side.RIGHT)) {
                 startX = topInset;
                 startY = tabBackgroundHeight - headersPrefHeight - leftInset;
                 controlStartX = w - btnWidth + topInset;
-                controlStartY = snapSize(getHeight()) - controlButtons.getControlTabHeight() - leftInset;
+                controlStartY = snapSize(getHeight()) - btnHeight - leftInset;
             } else if (tabPosition.equals(Side.BOTTOM)) {
                 startX = snapSize(getWidth()) - headersPrefWidth - leftInset;
                 startY = tabBackgroundHeight - headersPrefHeight - topInset;
                 controlStartX = rightInset;
-                controlStartY = snapSize(getHeight()) - controlButtons.getControlTabHeight() - topInset;
+                controlStartY = snapSize(getHeight()) - btnHeight - topInset;
             } else if (tabPosition.equals(Side.LEFT)) {
                 startX = snapSize(getWidth()) - headersPrefWidth - topInset;
                 startY = tabBackgroundHeight - headersPrefHeight - rightInset;
                 controlStartX = leftInset;
-                controlStartY = snapSize(getHeight()) - controlButtons.getControlTabHeight() - rightInset;
+                controlStartY = snapSize(getHeight()) - btnHeight - rightInset;
             }
             if (headerBackground.isVisible()) {
                 positionInArea(headerBackground, 0, 0,
                         snapSize(getWidth()), snapSize(getHeight()), /*baseline ignored*/0, HPos.CENTER, VPos.CENTER);
             }
             positionInArea(headersRegion, startX, startY, w, h, /*baseline ignored*/0, HPos.LEFT, VPos.CENTER);
-            positionInArea(controlButtons, controlStartX, controlStartY, btnWidth, controlButtons.getControlTabHeight(),
+            positionInArea(controlButtons, controlStartX, controlStartY, btnWidth, btnHeight,
                         /*baseline ignored*/0, HPos.CENTER, VPos.CENTER);
         }
     } /* End TabHeaderArea */
@@ -1029,8 +1085,10 @@
         private Tooltip oldTooltip;
         private Tooltip tooltip;
         private Rectangle clip;
-        
-        private MultiplePropertyChangeListenerHandler listener = 
+
+        private boolean isClosing = false;
+
+        private MultiplePropertyChangeListenerHandler listener =
                 new MultiplePropertyChangeListenerHandler(param -> {
                     handlePropertyChanged(param);
                     return null;
@@ -1211,7 +1269,7 @@
             getProperties().put(Tab.class, tab);
             getProperties().put(ContextMenu.class, tab.getContextMenu());
 
-            setOnContextMenuRequested(me -> {
+            setOnContextMenuRequested((ContextMenuEvent me) -> {
                if (getTab().getContextMenu() != null) {
                     getTab().getContextMenu().show(inner, me.getScreenX(), me.getScreenY());
                     me.consume();
@@ -1516,23 +1574,9 @@
             setupPopupMenu();
 
             inner = new StackPane() {
-                private double getArrowBtnWidth() {
-                    if (animationLock) return maxArrowWidth;
-                    if (isShowTabsMenu()) {
-                        maxArrowWidth = Math.max(maxArrowWidth, snapSize(downArrow.prefWidth(getHeight())) + snapSize(downArrowBtn.prefWidth(getHeight())));
-                    }
-                    return maxArrowWidth;
-                }
-
                 @Override protected double computePrefWidth(double height) {
-                    if (animationLock) return innerPrefWidth;
-                    innerPrefWidth = getActualPrefWidth();
-                    return innerPrefWidth;
-                }
-
-                public double getActualPrefWidth() {
                     double pw;
-                    double maxArrowWidth = getArrowBtnWidth();
+                    double maxArrowWidth = ! isShowTabsMenu() ? 0 : snapSize(downArrow.prefWidth(getHeight())) + snapSize(downArrowBtn.prefWidth(getHeight()));
                     pw = 0.0F;
                     if (isShowTabsMenu()) {
                         pw += maxArrowWidth;
@@ -1555,30 +1599,15 @@
                 }
 
                 @Override protected void layoutChildren() {
-                    Side tabPosition = getSkinnable().getSide();
-                    double x = 0.0F;
-                    //padding.left;
-                    double y = snappedTopInset();
-                    double h = snapSize(getHeight()) - y + snappedBottomInset();
-                    // when on the left or bottom, we need to position the tabs controls
-                    // button such that it is the furtherest button away from the tabs.
-                    if (tabPosition.equals(Side.BOTTOM) || tabPosition.equals(Side.LEFT)) {
-                        x += positionTabsMenu(x, y, h, true);
-                    } else {
-                        x += positionTabsMenu(x, y, h, false);
+                    if (isShowTabsMenu()) {
+                        double x = 0;
+                        double y = snappedTopInset();
+                        double w = snapSize(getWidth()) - x + snappedLeftInset();
+                        double h = snapSize(getHeight()) - y + snappedBottomInset();
+                        positionArrow(downArrowBtn, downArrow, x, y, w, h);
                     }
                 }
 
-                private double positionTabsMenu(double x, double y, double h, boolean showSep) {
-                    double newX = x;
-                    if (isShowTabsMenu()) {
-                        // DOWN ARROW BUTTON
-                        positionArrow(downArrowBtn, downArrow, newX, y, maxArrowWidth, h);
-                        newX += maxArrowWidth;
-                    }
-                    return newX;
-                }
-
                 private void positionArrow(Pane btn, StackPane arrow, double x, double y, double width, double height) {
                     btn.resize(width, height);
                     positionInArea(btn, x, y, width, height, /*baseline ignored*/0,
@@ -1602,9 +1631,7 @@
                 Side tabPosition = getSkinnable().getSide();
                 downArrow.setRotate(tabPosition.equals(Side.BOTTOM)? 180.0F : 0.0F);
             });
-            tabPane.getTabs().addListener((ListChangeListener<Tab>) c -> {
-                setupPopupMenu();
-            });
+            tabPane.getTabs().addListener((ListChangeListener<Tab>) c -> setupPopupMenu());
             showControlButtons = false;
             if (isShowTabsMenu()) {
                 showControlButtons = true;
@@ -1616,61 +1643,24 @@
         private boolean showTabsMenu = false;
 
         private void showTabsMenu(boolean value) {
-            if (value && !showTabsMenu) {
+            final boolean wasTabsMenuShowing = isShowTabsMenu();
+            this.showTabsMenu = value;
+
+            if (showTabsMenu && !wasTabsMenuShowing) {
                 downArrowBtn.setVisible(true);
                 showControlButtons = true;
                 inner.requestLayout();
                 tabHeaderArea.requestLayout();
-            } else if (!value && showTabsMenu) {
+            } else if (!showTabsMenu && wasTabsMenuShowing) {
                 hideControlButtons();
             }
-            this.showTabsMenu = value;
         }
 
         private boolean isShowTabsMenu() {
             return showTabsMenu;
         }
 
-        private final DoubleProperty controlTabHeight = new SimpleDoubleProperty(this, "controlTabHeight");
-        {
-            controlTabHeight.addListener(valueModel -> {
-                requestLayout();
-            });
-        }
-        // TODO: Maybe the getter and setter can be dropped completely after
-        // turning controlTabHeight into a DoubleVariable?
-        public double getControlTabHeight() {
-            return controlTabHeight.get();
-        }
-        public void setControlTabHeight(double value) {
-            controlTabHeight.set(value);
-        }
-
-        private boolean animationLock = false;
-        private void setAnimationLock(boolean value) {
-            animationLock = value;
-            tabHeaderArea.requestLayout();
-        }
-
-//        FIXME this should be allowed, but the method is final on Node
-//        @Override
-//        public boolean isVisible() {
-//            return getSkinnable().isShowScrollArrows() || getSkinnable().isShowTabsMenu();
-//        }
-
-        double maxArrowWidth;
-        double innerPrefWidth;
-
-        private double prefWidth;
         @Override protected double computePrefWidth(double height) {
-            if (animationLock) {
-                return prefWidth;
-            }
-            prefWidth = getActualPrefWidth(height);
-            return prefWidth;
-        }
-
-        private double getActualPrefWidth(double height) {
             double pw = snapSize(inner.prefWidth(height));
             if (pw > 0) {
                 pw += snappedLeftInset() + snappedRightInset();
@@ -1699,53 +1689,29 @@
         }
 
         private void showControlButtons() {
-            double prefHeight = snapSize(prefHeight(-1));
-            Timeline timeline = new Timeline();
-            KeyValue keyValue = new KeyValue(controlTabHeight, prefHeight, Interpolator.EASE_OUT);
-
             setVisible(true);
-            timeline.getKeyFrames().clear();
-            timeline.getKeyFrames().add(new KeyFrame(Duration.millis(ANIMATION_SPEED), event -> {
-                if (popup == null) {
-                    setupPopupMenu();
-                }
-                requestLayout();
-            }, keyValue));
-            timeline.play();
         }
 
         private void hideControlButtons() {
-            setAnimationLock(true);
-            Timeline timeline = new Timeline();
-            KeyValue keyValue = new KeyValue(controlTabHeight, 0.0, Interpolator.EASE_IN);
+            // If the scroll arrows or tab menu is still visible we don't want
+            // to hide it animate it back it.
+            if (isShowTabsMenu()) {
+                showControlButtons = true;
+            } else {
+                setVisible(false);
+                popup.getItems().clear();
+                popup = null;
+            }
 
-            timeline.getKeyFrames().clear();
-            timeline.getKeyFrames().add(new KeyFrame(Duration.millis(ANIMATION_SPEED), event -> {
-                if (!isShowTabsMenu()) {
-                    downArrowBtn.setVisible(false);
-                }
-                // If the scroll arrows or tab menu is still visible we don't want
-                // to hide it animate it back it.
-                if (isShowTabsMenu()) {
-                    showControlButtons = true;
-                } else {
-                    setVisible(false);
-                    popup.getItems().clear();
-                    popup = null;
-                }
-                setAnimationLock(false);
-                // This needs to be called when we are in the left tabPosition
-                // to allow for the clip offset to move properly (otherwise
-                // it jumps too early - before the animation is done).
-                requestLayout();
-            }, keyValue));
-            timeline.play();
+            // This needs to be called when we are in the left tabPosition
+            // to allow for the clip offset to move properly (otherwise
+            // it jumps too early - before the animation is done).
+            requestLayout();
         }
 
         private void setupPopupMenu() {
             if (popup == null) {
                 popup = new ContextMenu();
-//                popup.setManaged(false);
             }
             popup.getItems().clear();
             ToggleGroup group = new ToggleGroup();
@@ -1753,9 +1719,7 @@
             for (final Tab tab : getSkinnable().getTabs()) {
                 TabMenuItem item = new TabMenuItem(tab);                
                 item.setToggleGroup(group);
-                item.setOnAction(t -> {
-                    getSkinnable().getSelectionModel().select(tab);
-                });
+                item.setOnAction(t -> getSkinnable().getSelectionModel().select(tab));
                 menuitems.add(item);
             }
             popup.getItems().addAll(menuitems);
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TableColumnHeader.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TableColumnHeader.java	Wed Apr 30 08:30:58 2014 -0700
@@ -99,7 +99,7 @@
     private NestedTableColumnHeader parentHeader;
 
     // work out where this column currently is within its parent
-    private Label label;
+    Label label;
 
     // sort order
     int sortPos = -1;
@@ -509,6 +509,13 @@
         label.setGraphic(column.getGraphic());
         label.setVisible(column.isVisible());
 
+        label.fontProperty().addListener((o, old, newValue) -> {
+            // The font has changed (probably due to CSS being applied), so we
+            // need to re-run the column resizing algorithm to ensure columns
+            // fit nicely based on their content and their header
+            getTableViewSkin().resizeColumnToFitContent(column, 30);
+        });
+
         // ---- container for the sort arrow (which is not supported on embedded
         // platforms)
         if (isSortingEnabled()) {
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TableViewSkin.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TableViewSkin.java	Wed Apr 30 08:30:58 2014 -0700
@@ -48,6 +48,7 @@
 import javafx.scene.control.TableView.TableViewSelectionModel;
 import javafx.scene.input.MouseEvent;
 import javafx.scene.layout.Region;
+import javafx.scene.text.Font;
 import javafx.util.Callback;
 
 import com.sun.javafx.scene.control.behavior.TableViewBehavior;
@@ -204,14 +205,16 @@
      * rows is large.
      */
     @Override protected void resizeColumnToFitContent(TableColumn<T, ?> tc, int maxRows) {
-        final TableColumn<T, ?> col = tc;
+        if (!tc.isResizable()) return;
+
+//        final TableColumn<T, ?> col = tc;
         List<?> items = itemsProperty().get();
         if (items == null || items.isEmpty()) return;
     
-        Callback/*<TableColumn<T, ?>, TableCell<T,?>>*/ cellFactory = col.getCellFactory();
+        Callback/*<TableColumn<T, ?>, TableCell<T,?>>*/ cellFactory = tc.getCellFactory();
         if (cellFactory == null) return;
     
-        TableCell<T,?> cell = (TableCell<T, ?>) cellFactory.call(col);
+        TableCell<T,?> cell = (TableCell<T, ?>) cellFactory.call(tc);
         if (cell == null) return;
         
         // set this property to tell the TableCell we want to know its actual
@@ -229,7 +232,7 @@
         int rows = maxRows == -1 ? items.size() : Math.min(items.size(), maxRows);
         double maxWidth = 0;
         for (int row = 0; row < rows; row++) {
-            cell.updateTableColumn(col);
+            cell.updateTableColumn(tc);
             cell.updateTableView(tableView);
             cell.updateIndex(row);
             
@@ -243,14 +246,23 @@
 
         // dispose of the cell to prevent it retaining listeners (see RT-31015)
         cell.updateIndex(-1);
+
+        // RT-36855 - take into account the column header text / graphic widths.
+        // Magic 10 is to allow for sort arrow to appear without text truncation.
+        TableColumnHeader header = getTableHeaderRow().getColumnHeaderFor(tc);
+        double headerTextWidth = Utils.computeTextWidth(header.label.getFont(), tc.getText(), -1);
+        Node graphic = header.label.getGraphic();
+        double headerGraphicWidth = graphic == null ? 0 : graphic.prefWidth(-1) + header.label.getGraphicTextGap();
+        double headerWidth = headerTextWidth + headerGraphicWidth + 10 + header.snappedLeftInset() + header.snappedRightInset();
+        maxWidth = Math.max(maxWidth, headerWidth);
         
         // RT-23486
-        double widthMax = maxWidth + padding;
+        maxWidth += padding;
         if(tableView.getColumnResizePolicy() == TableView.CONSTRAINED_RESIZE_POLICY) {
-             widthMax = Math.max(widthMax, col.getWidth());
+            maxWidth = Math.max(maxWidth, tc.getWidth());
         }
 
-        col.impl_setWidth(widthMax); 
+        tc.impl_setWidth(maxWidth);
     }
     
     /** {@inheritDoc} */
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TableViewSkinBase.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TableViewSkinBase.java	Wed Apr 30 08:30:58 2014 -0700
@@ -244,7 +244,17 @@
         while (c.next()) {
             if (c.wasReplaced()) {
                 // RT-28397: Support for when an item is replaced with itself (but
-                // updated internal values that should be shown visually)
+                // updated internal values that should be shown visually).
+
+                // The ListViewSkin equivalent code here was updated to use the
+                // flow.setDirtyCell(int) API, but it was left alone here, otherwise
+                // our unit test for RT-36220 fails as we do not handle the case
+                // where the TableCell gets updated (only the TableRow does).
+                // Ideally we would use the dirtyCell API:
+                //
+                // for (int i = c.getFrom(); i < c.getTo(); i++) {
+                //     flow.setCellDirty(i);
+                // }
                 itemCount = 0;
                 break;
             } else if (c.getRemovedSize() == itemCount) {
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TreeTableViewSkin.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TreeTableViewSkin.java	Wed Apr 30 08:30:58 2014 -0700
@@ -327,14 +327,23 @@
 
         // dispose of the cell to prevent it retaining listeners (see RT-31015)
         cell.updateIndex(-1);
+
+        // RT-36855 - take into account the column header text / graphic widths.
+        // Magic 10 is to allow for sort arrow to appear without text truncation.
+        TableColumnHeader header = getTableHeaderRow().getColumnHeaderFor(tc);
+        double headerTextWidth = Utils.computeTextWidth(header.label.getFont(), tc.getText(), -1);
+        Node graphic = header.label.getGraphic();
+        double headerGraphicWidth = graphic == null ? 0 : graphic.prefWidth(-1) + header.label.getGraphicTextGap();
+        double headerWidth = headerTextWidth + headerGraphicWidth + 10 + header.snappedLeftInset() + header.snappedRightInset();
+        maxWidth = Math.max(maxWidth, headerWidth);
         
         // RT-23486
-        double widthMax = maxWidth + padding;
+        maxWidth += padding;
         if(treeTableView.getColumnResizePolicy() == TreeTableView.CONSTRAINED_RESIZE_POLICY) {
-             widthMax = Math.max(widthMax, col.getWidth());
+            maxWidth = Math.max(maxWidth, col.getWidth());
         }
 
-        col.impl_setWidth(widthMax); 
+        col.impl_setWidth(maxWidth);
     }
     
     /** {@inheritDoc} */
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualFlow.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualFlow.java	Wed Apr 30 08:30:58 2014 -0700
@@ -57,6 +57,7 @@
 import sun.util.logging.PlatformLogger;
 import java.util.AbstractList;
 import java.util.ArrayList;
+import java.util.BitSet;
 import java.util.List;
 
 /**
@@ -942,6 +943,22 @@
             lastHeight = -1;
         }
 
+        if (! dirtyCells.isEmpty()) {
+            int index;
+            while ((index = dirtyCells.nextSetBit(0)) != -1) {
+                T cell = cells.get(index);
+                // updateIndex(-1) works for TableView, but breaks ListView.
+                // For now, the TableView just does not use the dirtyCells API
+//                cell.updateIndex(-1);
+                cell.requestLayout();
+                dirtyCells.clear(index);
+            }
+
+            setMaxPrefBreadth(-1);
+            lastWidth = -1;
+            lastHeight = -1;
+        }
+
         final boolean hasSizeChange = sizeChanged;
         boolean recreatedOrRebuilt = needsRebuildCells || needsRecreateCells || sizeChanged;
 
@@ -2364,6 +2381,7 @@
     private boolean needsRebuildCells = false; // when cell contents have changed
     private boolean needsCellsLayout = false;
     private boolean sizeChanged = false;
+    private final BitSet dirtyCells = new BitSet();
     
     public void reconfigureCells() {
         needsReconfigureCells = true;
@@ -2385,6 +2403,11 @@
         requestLayout();
     }
 
+    public void setCellDirty(int index) {
+        dirtyCells.set(index);
+        requestLayout();
+    }
+
     private static final double GOLDEN_RATIO_MULTIPLIER = 0.618033987;
 
     private double getPrefBreadth(double oppDimension) {
--- a/modules/controls/src/main/java/javafx/scene/chart/AreaChart.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/chart/AreaChart.java	Wed Apr 30 08:30:58 2014 -0700
@@ -48,6 +48,7 @@
 import javafx.scene.shape.LineTo;
 import javafx.scene.shape.MoveTo;
 import javafx.scene.shape.Path;
+import javafx.scene.shape.PathElement;
 import javafx.scene.shape.StrokeLineJoin;
 import javafx.util.Duration;
 
@@ -452,27 +453,26 @@
 
     /** @inheritDoc */
     @Override protected void layoutPlotChildren() {
+        List<LineTo> constructedPath = new ArrayList<>(getDataSize());
         for (int seriesIndex=0; seriesIndex < getDataSize(); seriesIndex++) {
             Series<X, Y> series = getData().get(seriesIndex);
             DoubleProperty seriesYAnimMultiplier = seriesYMultiplierMap.get(series);
-            boolean isFirst = true;
             double lastX = 0;
-            Path seriesLine = (Path)((Group)series.getNode()).getChildren().get(1);
-            Path fillPath = (Path)((Group)series.getNode()).getChildren().get(0);
-            seriesLine.getElements().clear();
-            fillPath.getElements().clear();
+            final ObservableList<Node> children = ((Group) series.getNode()).getChildren();
+            ObservableList<PathElement> seriesLine = ((Path) children.get(1)).getElements();
+            ObservableList<PathElement> fillPath = ((Path) children.get(0)).getElements();
+            seriesLine.clear();
+            fillPath.clear();
+            constructedPath.clear();
             for (Data<X, Y> item = series.begin; item != null; item = item.next) {
-                double x = lastX = getXAxis().getDisplayPosition(item.getCurrentX());
+                double x = getXAxis().getDisplayPosition(item.getCurrentX());
                 double y = getYAxis().getDisplayPosition(
                         getYAxis().toRealValue(getYAxis().toNumericValue(item.getCurrentY()) * seriesYAnimMultiplier.getValue()));
-                if (isFirst) {
-                    isFirst = false;
-                    fillPath.getElements().add(new MoveTo(x, getYAxis().getHeight()));
-                    seriesLine.getElements().add(new MoveTo(x, y));
-                } else {
-                    seriesLine.getElements().add(new LineTo(x, y));
+                constructedPath.add(new LineTo(x, y));
+                if (Double.isNaN(x) || Double.isNaN(y)) {
+                    continue;
                 }
-                fillPath.getElements().add(new LineTo(x, y));
+                lastX = x;
                 Node symbol = item.getNode();
                 if (symbol != null) {
                     final double w = symbol.prefWidth(-1);
@@ -480,12 +480,19 @@
                     symbol.resizeRelocate(x-(w/2), y-(h/2),w,h);
                 }
             }
-            if (fillPath.getElements().size() >= 1) {
-                fillPath.getElements().add(new LineTo(lastX, getYAxis().getHeight()));
-            } else {
-                fillPath.getElements().add(new MoveTo(lastX, getYAxis().getHeight()));
+
+            if (!constructedPath.isEmpty()) {
+                Collections.sort(constructedPath, (e1, e2) -> Double.compare(e1.getX(), e2.getX()));
+                LineTo first = constructedPath.get(0);
+
+                seriesLine.add(new MoveTo(first.getX(), first.getY()));
+                fillPath.add(new MoveTo(first.getX(), getYAxis().getHeight()));
+
+                seriesLine.addAll(constructedPath);
+                fillPath.addAll(constructedPath);
+                fillPath.add(new LineTo(lastX, getYAxis().getHeight()));
+                fillPath.add(new ClosePath());
             }
-            fillPath.getElements().add(new ClosePath());
         }
     }
 
--- a/modules/controls/src/main/java/javafx/scene/chart/BarChart.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/chart/BarChart.java	Wed Apr 30 08:30:58 2014 -0700
@@ -356,6 +356,9 @@
                         categoryPos = getYAxis().getDisplayPosition(item.getCurrentY());
                         valPos = getXAxis().getDisplayPosition(item.getCurrentX());
                     }
+                    if (Double.isNaN(categoryPos) || Double.isNaN(valPos)) {
+                        continue;
+                    }
                     final double bottom = Math.min(valPos,zeroPos);
                     final double top = Math.max(valPos,zeroPos);
                     bottomPos = bottom;
--- a/modules/controls/src/main/java/javafx/scene/chart/BubbleChart.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/chart/BubbleChart.java	Wed Apr 30 08:30:58 2014 -0700
@@ -107,6 +107,9 @@
                 Data<X,Y> item = iter.next();
                 double x = getXAxis().getDisplayPosition(item.getCurrentX());
                 double y = getYAxis().getDisplayPosition(item.getCurrentY());
+                if (Double.isNaN(x) || Double.isNaN(y)) {
+                    continue;
+                }
                 Node bubble = item.getNode();
                 Ellipse ellipse;
                 if (bubble != null) {
--- a/modules/controls/src/main/java/javafx/scene/chart/CategoryAxis.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/chart/CategoryAxis.java	Wed Apr 30 08:30:58 2014 -0700
@@ -458,10 +458,14 @@
      */
     @Override public double getDisplayPosition(String value) {
         // find index of value
+        final ObservableList<String> cat = getCategories();
+        if (!cat.contains(value)) {
+            return Double.NaN;
+        }
         if (getEffectiveSide().isHorizontal()) {
-            return firstCategoryPos.get() + getCategories().indexOf("" + value) * categorySpacing.get();
+            return firstCategoryPos.get() + cat.indexOf(value) * categorySpacing.get();
         } else {
-            return firstCategoryPos.get() + getCategories().indexOf("" + value) * categorySpacing.get() * -1;
+            return firstCategoryPos.get() + cat.indexOf(value) * categorySpacing.get() * -1;
         }
     }
 
--- a/modules/controls/src/main/java/javafx/scene/chart/LineChart.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/chart/LineChart.java	Wed Apr 30 08:30:58 2014 -0700
@@ -48,6 +48,7 @@
 import javafx.scene.shape.LineTo;
 import javafx.scene.shape.MoveTo;
 import javafx.scene.shape.Path;
+import javafx.scene.shape.PathElement;
 import javafx.scene.shape.StrokeLineJoin;
 import javafx.util.Duration;
 
@@ -439,23 +440,23 @@
 
     /** @inheritDoc */
     @Override protected void layoutPlotChildren() {
+        List<LineTo> constructedPath = new ArrayList<>(getDataSize());
         for (int seriesIndex=0; seriesIndex < getDataSize(); seriesIndex++) {
             Series<X,Y> series = getData().get(seriesIndex);
             final DoubleProperty seriesYAnimMultiplier = seriesYMultiplierMap.get(series);
-            boolean isFirst = true;
             if(series.getNode() instanceof  Path) {
-                Path seriesLine = (Path)series.getNode();
-                seriesLine.getElements().clear();
+                final ObservableList<PathElement> seriesLine = ((Path)series.getNode()).getElements();
+                seriesLine.clear();
+                constructedPath.clear();
                 for (Data<X,Y> item = series.begin; item != null; item = item.next) {
                     double x = getXAxis().getDisplayPosition(item.getCurrentX());
                     double y = getYAxis().getDisplayPosition(
                             getYAxis().toRealValue(getYAxis().toNumericValue(item.getCurrentY()) * seriesYAnimMultiplier.getValue()));
-                    if (isFirst) {
-                        isFirst = false;
-                        seriesLine.getElements().add(new MoveTo(x, y));
-                    } else {
-                        seriesLine.getElements().add(new LineTo(x, y));
+                    if (Double.isNaN(x) || Double.isNaN(y)) {
+                        continue;
                     }
+                    constructedPath.add(new LineTo(x, y));
+
                     Node symbol = item.getNode();
                     if (symbol != null) {
                         final double w = symbol.prefWidth(-1);
@@ -463,6 +464,13 @@
                         symbol.resizeRelocate(x-(w/2), y-(h/2),w,h);
                     }
                 }
+                Collections.sort(constructedPath, (e1, e2) -> Double.compare(e1.getX(), e2.getX()));
+
+                if (!constructedPath.isEmpty()) {
+                    LineTo first = constructedPath.get(0);
+                    seriesLine.add(new MoveTo(first.getX(), first.getY()));
+                    seriesLine.addAll(constructedPath);
+                }
             }
         }
     }
--- a/modules/controls/src/main/java/javafx/scene/chart/PieChart.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/chart/PieChart.java	Wed Apr 30 08:30:58 2014 -0700
@@ -512,10 +512,8 @@
         boolean shouldShowLabels = getLabelsVisible();
         if(getLabelsVisible()) {
 
-            double minX = begin != null ? Double.MAX_VALUE : 0d;
-            double minY = begin != null ? Double.MAX_VALUE : 0d;
-            double maxX = begin != null ? Double.MIN_VALUE : 0d;
-            double maxY = begin != null ? Double.MIN_VALUE : 0d;
+            double xPad = 0d;
+            double yPad = 0d;
 
             labelsX = new double[getDataSize()];
             labelsY = new double[getDataSize()];
@@ -533,22 +531,15 @@
                 final double sproutY = calcY(labelAngles[index], getLabelLineLength(), 0);
                 labelsX[index] = sproutX;
                 labelsY[index] = sproutY;
-                if (sproutX < 0) { // on left
-                    minX = Math.min(minX, sproutX-item.textNode.getLayoutBounds().getWidth()-LABEL_TICK_GAP);
-                } else { // on right
-                    maxX = Math.max(maxX, sproutX+item.textNode.getLayoutBounds().getWidth()+LABEL_TICK_GAP);
-
-                }
+                xPad = Math.max(xPad, 2 * (item.textNode.getLayoutBounds().getWidth() + LABEL_TICK_GAP + Math.abs(sproutX)));
                 if (sproutY > 0) { // on bottom
-                    maxY = Math.max(maxY, sproutY+item.textNode.getLayoutBounds().getMaxY());
+                    yPad = Math.max(yPad, 2 * Math.abs(sproutY+item.textNode.getLayoutBounds().getMaxY()));
                 } else { // on top
-                    minY = Math.min(minY, sproutY + item.textNode.getLayoutBounds().getMinY());
+                    yPad = Math.max(yPad, 2 * Math.abs(sproutY + item.textNode.getLayoutBounds().getMinY()));
                 }
                 start+= size;
                 index++;
             }
-            double xPad = (Math.max(Math.abs(minX), Math.abs(maxX))) * 2;
-            double yPad = (Math.max(Math.abs(minY), Math.abs(maxY))) * 2;
             pieRadius = Math.min(contentWidth - xPad, contentHeight - yPad) / 2;
             // check if this makes the pie too small
             if (pieRadius < MIN_PIE_RADIUS ) {
--- a/modules/controls/src/main/java/javafx/scene/chart/ScatterChart.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/chart/ScatterChart.java	Wed Apr 30 08:30:58 2014 -0700
@@ -165,6 +165,9 @@
             for (Data<X,Y> item = series.begin; item != null; item = item.next) {
                 double x = getXAxis().getDisplayPosition(item.getCurrentX());
                 double y = getYAxis().getDisplayPosition(item.getCurrentY());
+                if (Double.isNaN(x) || Double.isNaN(y)) {
+                    continue;
+                }
                 Node symbol = item.getNode();
                 if (symbol != null) {
                     final double w = symbol.prefWidth(-1);
--- a/modules/controls/src/main/java/javafx/scene/chart/XYChart.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/chart/XYChart.java	Wed Apr 30 08:30:58 2014 -0700
@@ -678,9 +678,9 @@
         double yAxisWidth = 0;
         double yAxisHeight = 0;
         for (int count=0; count<5; count ++) {
-            yAxisHeight = height-xAxisHeight;
+            yAxisHeight = snapSize(height-xAxisHeight);
             yAxisWidth = ya.prefWidth(yAxisHeight);
-            xAxisWidth = width - yAxisWidth;
+            xAxisWidth = snapSize(width - yAxisWidth);
             double newXAxisHeight = xa.prefHeight(xAxisWidth);
             if (newXAxisHeight == xAxisHeight) break;
             xAxisHeight = newXAxisHeight;
@@ -765,11 +765,10 @@
         if(getVerticalGridLinesVisible()) {
             for(int i=0; i < xaTickMarks.size(); i++) {
                 Axis.TickMark<X> tick = xaTickMarks.get(i);
-                double pixelOffset = (i==(xaTickMarks.size()-1)) ? -0.5 : 0.5;
                 final double x = xa.getDisplayPosition(tick.getValue());
                 if ((x!=xAxisZero || !isVerticalZeroLineVisible()) && x > 0 && x <= xAxisWidth) {
-                    verticalGridLines.getElements().add(new MoveTo(left+x+pixelOffset,top));
-                    verticalGridLines.getElements().add(new LineTo(left+x+pixelOffset,top+yAxisHeight));
+                    verticalGridLines.getElements().add(new MoveTo(left+x+0.5,top));
+                    verticalGridLines.getElements().add(new LineTo(left+x+0.5,top+yAxisHeight));
                 }
             }
         }
@@ -778,11 +777,10 @@
         if(isHorizontalGridLinesVisible()) {
             for(int i=0; i < yaTickMarks.size(); i++) {
                 Axis.TickMark<Y> tick = yaTickMarks.get(i);
-                double pixelOffset = (i==(yaTickMarks.size()-1)) ? -0.5 : 0.5;
                 final double y = ya.getDisplayPosition(tick.getValue());
                 if ((y!=yAxisZero || !isHorizontalZeroLineVisible()) && y >= 0 && y < yAxisHeight) {
-                    horizontalGridLines.getElements().add(new MoveTo(left,top+y+pixelOffset));
-                    horizontalGridLines.getElements().add(new LineTo(left+xAxisWidth,top+y+pixelOffset));
+                    horizontalGridLines.getElements().add(new MoveTo(left,top+y+0.5));
+                    horizontalGridLines.getElements().add(new LineTo(left+xAxisWidth,top+y+0.5));
                 }
             }
         }
--- a/modules/controls/src/main/java/javafx/scene/control/Accordion.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/control/Accordion.java	Wed Apr 30 08:30:58 2014 -0700
@@ -33,8 +33,6 @@
 import com.sun.javafx.scene.control.skin.AccordionSkin;
 import javafx.beans.property.ObjectPropertyBase;
 import javafx.css.StyleableProperty;
-import javafx.scene.accessibility.Attribute;
-import javafx.scene.accessibility.Role;
 
 /**
  * <p>An accordion is a group of {@link TitledPane TitlePanes}.  Only one TitledPane can be opened at
--- a/modules/controls/src/main/java/javafx/scene/control/ComboBox.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/control/ComboBox.java	Wed Apr 30 08:30:58 2014 -0700
@@ -35,6 +35,8 @@
 import javafx.collections.ListChangeListener;
 import javafx.collections.ObservableList;
 import javafx.scene.Node;
+import javafx.scene.accessibility.Attribute;
+import javafx.scene.accessibility.Role;
 import javafx.util.Callback;
 import javafx.util.StringConverter;
 
@@ -560,4 +562,29 @@
             return items == null ? 0 : items.size();
         }
     }
+
+    /***************************************************************************
+     *                                                                         *
+     * Accessibility handling                                                  *
+     *                                                                         *
+     **************************************************************************/
+
+    /** @treatAsPrivate */
+    @Override
+    public Object accGetAttribute(Attribute attribute, Object... parameters) {
+        switch(attribute) {
+            case ROLE: return Role.COMBOBOX;
+            case TITLE:
+                //let the skin first.
+                Object title = super.accGetAttribute(attribute, parameters);
+                if (title != null) return title;
+                StringConverter<T> converter = getConverter();
+                if (converter == null) {
+                    return getValue() != null ? getValue().toString() : "";
+                }
+                return converter.toString(getValue());
+            default: return super.accGetAttribute(attribute, parameters);
+        }
+    }
+
 }
--- a/modules/controls/src/main/java/javafx/scene/control/ComboBoxBase.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/control/ComboBoxBase.java	Wed Apr 30 08:30:58 2014 -0700
@@ -34,7 +34,6 @@
 import javafx.event.EventType;
 import javafx.scene.accessibility.Action;
 import javafx.scene.accessibility.Attribute;
-import javafx.scene.accessibility.Role;
 
 /**
  * Abstract base class for ComboBox-like controls. A ComboBox typically has
@@ -472,9 +471,10 @@
     /** @treatAsPrivate */
     @Override public Object accGetAttribute(Attribute attribute, Object... parameters) {
         switch (attribute) {
-            case ROLE: return Role.COMBOBOX;
             case EXPANDED: return isShowing();
-            /* list attributes handled by the skin */
+            case EDITABLE: return isEditable();
+            case SELECTION_START: //skin
+            case SELECTION_END: //skin
             default: return super.accGetAttribute(attribute, parameters);
         }
     }
--- a/modules/controls/src/main/java/javafx/scene/control/Labeled.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/control/Labeled.java	Wed Apr 30 08:30:58 2014 -0700
@@ -587,7 +587,7 @@
             lineSpacing = new StyleableDoubleProperty(0) {
 
                 @Override
-                public CssMetaData getCssMetaData() {
+                public CssMetaData<Labeled,Number> getCssMetaData() {
                     return StyleableProperties.LINE_SPACING;
                 }
 
@@ -693,7 +693,7 @@
             graphicTextGap = new StyleableDoubleProperty(4) {
                 
                 @Override
-                public CssMetaData getCssMetaData() {
+                public CssMetaData<Labeled,Number> getCssMetaData() {
                     return StyleableProperties.GRAPHIC_TEXT_GAP;
                 }
 
--- a/modules/controls/src/main/java/javafx/scene/control/TabPane.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/control/TabPane.java	Wed Apr 30 08:30:58 2014 -0700
@@ -643,42 +643,10 @@
                             if (tab.isSelected()) {
                                 tab.setSelected(false);
                                 final int tabIndex = c.getFrom();
-                                final int tabCount = tabPane.getTabs().size();
 
                                 // we always try to select the nearest, non-disabled
                                 // tab from the position of the closed tab.
-                                int i = 1;
-                                while (true) {
-                                    // look leftwards
-                                    int downPos = tabIndex - i;
-                                    if (downPos >= 0) {
-                                        Tab _tab = getModelItem(downPos);
-                                        System.out.println(_tab.getText() + " disabled: " + _tab.isDisabled() + ", disable: " + _tab.isDisable());
-                                        if (_tab != null && ! _tab.isDisable()) {
-                                            select(_tab);
-                                            break;
-                                        }
-                                    }
-
-                                    // look rightwards. We subtract one as we need
-                                    // to take into account that a tab has been removed
-                                    // and if we don't do this we'll miss the tab
-                                    // to the right of the tab (as it has moved into
-                                    // the removed tabs position).
-                                    int upPos = tabIndex + i - 1;
-                                    if (upPos < tabCount) {
-                                        Tab _tab = getModelItem(upPos);
-                                        if (_tab != null && ! _tab.isDisable()) {
-                                            select(_tab);
-                                            break;
-                                        }
-                                    }
-
-                                    if (downPos < 0 && upPos >= tabCount) {
-                                        break;
-                                    }
-                                    i++;
-                                }
+                                findNearestAvailableTab(tabIndex, true);
                             }
                         }
                     }
@@ -691,7 +659,9 @@
                     }
                 }
                 if (getSelectedIndex() == -1 && getSelectedItem() == null && tabPane.getTabs().size() > 0) {
-                    selectFirst();
+                    // we go looking for the first non-disabled tab, as opposed to
+                    // just selecting the first tab (fix for RT-36908)
+                    findNearestAvailableTab(0, true);
                 } else if (tabPane.getTabs().isEmpty()) {
                     clearSelection();
                 }
@@ -755,6 +725,50 @@
             final ObservableList<Tab> items = tabPane.getTabs();
             return items == null ? 0 : items.size();
         }
+
+        private Tab findNearestAvailableTab(int tabIndex, boolean doSelect) {
+            // we always try to select the nearest, non-disabled
+            // tab from the position of the closed tab.
+            final int tabCount = getItemCount();
+            int i = 1;
+            Tab bestTab = null;
+            while (true) {
+                // look leftwards
+                int downPos = tabIndex - i;
+                if (downPos >= 0) {
+                    Tab _tab = getModelItem(downPos);
+                    if (_tab != null && ! _tab.isDisable()) {
+                        bestTab = _tab;
+                        break;
+                    }
+                }
+
+                // look rightwards. We subtract one as we need
+                // to take into account that a tab has been removed
+                // and if we don't do this we'll miss the tab
+                // to the right of the tab (as it has moved into
+                // the removed tabs position).
+                int upPos = tabIndex + i - 1;
+                if (upPos < tabCount) {
+                    Tab _tab = getModelItem(upPos);
+                    if (_tab != null && ! _tab.isDisable()) {
+                        bestTab = _tab;
+                        break;
+                    }
+                }
+
+                if (downPos < 0 && upPos >= tabCount) {
+                    break;
+                }
+                i++;
+            }
+
+            if (doSelect && bestTab != null) {
+                select(bestTab);
+            }
+
+            return bestTab;
+        }
     }
 
     /**
--- a/modules/controls/src/main/java/javafx/scene/control/TableColumnBase.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/control/TableColumnBase.java	Wed Apr 30 08:30:58 2014 -0700
@@ -810,7 +810,7 @@
             double _prefWidth = 0.0f;
             double _maxWidth = 0.0f;
 
-            for (TableColumnBase col : getColumns()) {
+            for (TableColumnBase<S, ?> col : getColumns()) {
                 col.setParentColumn(this);
 
                 _minWidth += col.getMinWidth();
--- a/modules/controls/src/main/java/javafx/scene/control/TableView.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/control/TableView.java	Wed Apr 30 08:30:58 2014 -0700
@@ -1631,7 +1631,7 @@
                 return row != null ? row.accGetAttribute(attribute, parameters) : null;
             }
             case MULTIPLE_SELECTION: {
-                MultipleSelectionModel sm = getSelectionModel();
+                MultipleSelectionModel<S> sm = getSelectionModel();
                 return sm != null && sm.getSelectionMode() == SelectionMode.MULTIPLE;
             }
             case COLUMN_AT_INDEX: //Skin
--- a/modules/controls/src/main/java/javafx/scene/control/TextArea.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/control/TextArea.java	Wed Apr 30 08:30:58 2014 -0700
@@ -49,7 +49,6 @@
 import com.sun.javafx.css.converters.SizeConverter;
 import com.sun.javafx.scene.control.skin.TextAreaSkin;
 import javafx.css.Styleable;
-import javafx.scene.accessibility.Action;
 import javafx.scene.accessibility.Attribute;
 import javafx.scene.accessibility.Role;
 
--- a/modules/controls/src/main/java/javafx/scene/control/TextField.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/control/TextField.java	Wed Apr 30 08:30:58 2014 -0700
@@ -40,7 +40,6 @@
 import javafx.event.ActionEvent;
 import javafx.event.EventHandler;
 import javafx.geometry.Pos;
-import javafx.scene.accessibility.Action;
 import javafx.scene.accessibility.Attribute;
 import javafx.scene.accessibility.Role;
 import com.sun.javafx.binding.ExpressionHelper;
--- a/modules/controls/src/main/java/javafx/scene/control/TreeTableView.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/control/TreeTableView.java	Wed Apr 30 08:30:58 2014 -0700
@@ -3104,13 +3104,18 @@
                         shift = - e.getTreeItem().previousExpandedDescendentCount + 1;
                     }
                 } else if (e.wasAdded()) {
-                    for (int i = 0; i < e.getAddedChildren().size(); i++) {
-                        TreeItem<S> item = e.getAddedChildren().get(i);
-                        row = treeTableView.getRow(item);
-                        
-                        if (item != null && row <= getFocusedIndex()) {
-//                            shift = e.getTreeItem().isExpanded() ? e.getAddedSize() : 0;
-                            shift += item.getExpandedDescendentCount(false);
+                    // get the TreeItem the event occurred on - we only need to
+                    // shift if the tree item is expanded
+                    TreeItem<S> eventTreeItem = e.getTreeItem();
+                    if (eventTreeItem.isExpanded()) {
+                        for (int i = 0; i < e.getAddedChildren().size(); i++) {
+                            // get the added item and determine the row it is in
+                            TreeItem<S> item = e.getAddedChildren().get(i);
+                            row = treeTableView.getRow(item);
+
+                            if (item != null && row <= getFocusedIndex()) {
+                                shift += item.getExpandedDescendentCount(false);
+                            }
                         }
                     }
                 } else if (e.wasRemoved()) {
--- a/modules/controls/src/main/java/javafx/scene/control/TreeView.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/control/TreeView.java	Wed Apr 30 08:30:58 2014 -0700
@@ -1521,13 +1521,18 @@
                         shift = - e.getTreeItem().previousExpandedDescendentCount + 1;
                     }
                 } else if (e.wasAdded()) {
-                    for (int i = 0; i < e.getAddedChildren().size(); i++) {
-                        TreeItem<T> item = e.getAddedChildren().get(i);
-                        row = treeView.getRow(item);
-                        
-                        if (item != null && row <= getFocusedIndex()) {
-//                            shift = e.getTreeItem().isExpanded() ? e.getAddedSize() : 0;
-                            shift += item.getExpandedDescendentCount(false);
+                    // get the TreeItem the event occurred on - we only need to
+                    // shift if the tree item is expanded
+                    TreeItem<T> eventTreeItem = e.getTreeItem();
+                    if (eventTreeItem.isExpanded()) {
+                        for (int i = 0; i < e.getAddedChildren().size(); i++) {
+                            // get the added item and determine the row it is in
+                            TreeItem<T> item = e.getAddedChildren().get(i);
+                            row = treeView.getRow(item);
+
+                            if (item != null && row <= getFocusedIndex()) {
+                                shift += item.getExpandedDescendentCount(false);
+                            }
                         }
                     }
                 } else if (e.wasRemoved()) {
--- a/modules/controls/src/test/java/javafx/scene/control/ComboBoxTest.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/test/java/javafx/scene/control/ComboBoxTest.java	Wed Apr 30 08:30:58 2014 -0700
@@ -26,6 +26,7 @@
 package javafx.scene.control;
 
 import com.sun.javafx.scene.control.infrastructure.KeyModifier;
+import com.sun.javafx.scene.control.infrastructure.MouseEventFirer;
 import com.sun.javafx.tk.Toolkit;
 import javafx.css.PseudoClass;
 
@@ -1587,4 +1588,28 @@
 
         sl.dispose();
     }
+
+    @Test public void test_rt36827() {
+        final Button btn = new Button("focus owner");
+        final ComboBox<String> cb = new ComboBox<>(FXCollections.observableArrayList("a", "b", "c"));
+        VBox vbox = new VBox(btn, cb);
+
+        StageLoader sl = new StageLoader(vbox);
+        sl.getStage().requestFocus();
+        btn.requestFocus();
+        Toolkit.getToolkit().firePulse();
+        Scene scene = sl.getStage().getScene();
+
+        assertTrue(btn.isFocused());
+        assertEquals(btn, scene.getFocusOwner());
+
+        MouseEventFirer mouse = new MouseEventFirer(cb);
+        mouse.fireMousePressAndRelease();
+
+        assertTrue(cb.isShowing());
+        assertTrue(cb.isFocused());
+        assertEquals(cb, scene.getFocusOwner());
+
+        sl.dispose();
+    }
 }
--- a/modules/controls/src/test/java/javafx/scene/control/TabPaneTest.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/test/java/javafx/scene/control/TabPaneTest.java	Wed Apr 30 08:30:58 2014 -0700
@@ -951,4 +951,17 @@
 
         sl.dispose();
     }
+
+    @Test public void test_rt_36908() {
+        TabPane pane = new TabPane();
+        final Tab disabled = new Tab("Disabled");
+        disabled.setDisable(true);
+
+        Tab tab1 = new Tab("Tab 1");
+        Tab tab2 = new Tab("Tab 2");
+        pane.getTabs().addAll(disabled, tab1, tab2);
+
+        assertEquals(1, pane.getSelectionModel().getSelectedIndex());
+        assertEquals(tab1, pane.getSelectionModel().getSelectedItem());
+    }
 }
--- a/modules/controls/src/test/java/javafx/scene/control/TableViewTest.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/test/java/javafx/scene/control/TableViewTest.java	Wed Apr 30 08:30:58 2014 -0700
@@ -1908,6 +1908,7 @@
         sl.dispose();
     }
 
+    @Ignore("Test started intermittently failing, most probably due to RT-36855 changeset")
     @Test public void test_rt_34493() {
         TableView<Person> table = new TableView<>();
         table.setItems(FXCollections.observableArrayList(
--- a/modules/controls/src/test/java/javafx/scene/control/TreeTableViewTest.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/test/java/javafx/scene/control/TreeTableViewTest.java	Wed Apr 30 08:30:58 2014 -0700
@@ -2653,6 +2653,7 @@
         assertEquals(3, treeTableView.getFocusModel().getFocusedIndex());
     }
 
+    @Ignore("Test started intermittently failing, most probably due to RT-36855 changeset")
     @Test public void test_rt_34493() {
         ObservableList<TreeItem<Person>> persons = FXCollections.observableArrayList(
             new TreeItem<Person>(new Person("Jacob", "Smith", "jacob.smith@example.com"))
@@ -3346,4 +3347,56 @@
 
         sl.dispose();
     }
+
+    @Test public void test_rt36885() {
+        test_rt36885(false);
+    }
+
+    @Test public void test_rt36885_addChildAfterSelection() {
+        test_rt36885(true);
+    }
+
+    private void test_rt36885(boolean addChildToAAfterSelection) {
+        TreeItem<String> root = new TreeItem<>("Root");         // 0
+                TreeItem<String> a = new TreeItem<>("a");       // 1
+                    TreeItem<String> a1 = new TreeItem<>("a1"); // a expanded = 2, a collapsed = -1
+            TreeItem<String> b = new TreeItem<>("b");           // a expanded = 3, a collapsed = 2
+                TreeItem<String> b1 = new TreeItem<>("b1");     // a expanded = 4, a collapsed = 3
+                TreeItem<String> b2 = new TreeItem<>("b2");     // a expanded = 5, a collapsed = 4
+
+        root.setExpanded(true);
+        root.getChildren().setAll(a, b);
+
+        a.setExpanded(false);
+        if (!addChildToAAfterSelection) {
+            a.getChildren().add(a1);
+        }
+
+        b.setExpanded(true);
+        b.getChildren().addAll(b1, b2);
+
+        final TreeTableView<String> treeView = new TreeTableView<>(root);
+        TreeTableColumn<String, String> tableColumn = new TreeTableColumn<>();
+        tableColumn.setCellValueFactory(rowValue -> new SimpleStringProperty(rowValue.getValue().getValue()));
+        treeView.getColumns().add(tableColumn);
+
+        TreeTableView.TreeTableViewSelectionModel<String> sm = treeView.getSelectionModel();
+        FocusModel<TreeItem<String>> fm = treeView.getFocusModel();
+
+        sm.select(b1);
+        assertEquals(3, sm.getSelectedIndex());
+        assertEquals(b1, sm.getSelectedItem());
+        assertEquals(3, fm.getFocusedIndex());
+        assertEquals(b1, fm.getFocusedItem());
+
+        if (addChildToAAfterSelection) {
+            a.getChildren().add(a1);
+        }
+
+        a.setExpanded(true);
+        assertEquals(4, sm.getSelectedIndex());
+        assertEquals(b1, sm.getSelectedItem());
+        assertEquals(4, fm.getFocusedIndex());
+        assertEquals(b1, fm.getFocusedItem());
+    }
 }
--- a/modules/controls/src/test/java/javafx/scene/control/TreeViewTest.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/controls/src/test/java/javafx/scene/control/TreeViewTest.java	Wed Apr 30 08:30:58 2014 -0700
@@ -1749,4 +1749,57 @@
 
         sl.dispose();
     }
+
+    @Test public void test_rt36885_addChildBeforeSelection() {
+        test_rt36885(false);
+    }
+
+    @Test public void test_rt36885_addChildAfterSelection() {
+        test_rt36885(true);
+    }
+
+    private void test_rt36885(boolean addChildToAAfterSelection) {
+        TreeItem<String> root = new TreeItem<>("Root");     // 0
+            TreeItem<String> a = new TreeItem<>("a");       // 1
+                TreeItem<String> a1 = new TreeItem<>("a1"); // a expanded = 2, a collapsed = -1
+            TreeItem<String> b = new TreeItem<>("b");       // a expanded = 3, a collapsed = 2
+                TreeItem<String> b1 = new TreeItem<>("b1"); // a expanded = 4, a collapsed = 3
+                TreeItem<String> b2 = new TreeItem<>("b2"); // a expanded = 5, a collapsed = 4
+
+        root.setExpanded(true);
+        root.getChildren().setAll(a, b);
+
+        a.setExpanded(false);
+        if (!addChildToAAfterSelection) {
+            a.getChildren().add(a1);
+        }
+
+        b.setExpanded(true);
+        b.getChildren().addAll(b1, b2);
+
+        final TreeView<String> treeView = new TreeView<String>(root);
+
+        treeView.getFocusModel().focusedIndexProperty().addListener((observable, oldValue, newValue) -> {
+            System.out.println("focusedIndex: " + oldValue + " to " + newValue);
+        });
+
+        MultipleSelectionModel<TreeItem<String>> sm = treeView.getSelectionModel();
+        FocusModel<TreeItem<String>> fm = treeView.getFocusModel();
+
+        sm.select(b1);
+        assertEquals(3, sm.getSelectedIndex());
+        assertEquals(b1, sm.getSelectedItem());
+        assertEquals(3, fm.getFocusedIndex());
+        assertEquals(b1, fm.getFocusedItem());
+
+        if (addChildToAAfterSelection) {
+            a.getChildren().add(a1);
+        }
+
+        a.setExpanded(true);
+        assertEquals(4, sm.getSelectedIndex());
+        assertEquals(b1, sm.getSelectedItem());
+        assertEquals(4, fm.getFocusedIndex());
+        assertEquals(b1, fm.getFocusedItem());
+    }
 }
--- a/modules/graphics/src/main/java/com/sun/glass/ui/mac/MacAccessible.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/mac/MacAccessible.java	Wed Apr 30 08:30:58 2014 -0700
@@ -1288,9 +1288,10 @@
                  * the value again in AXTitle will cause voice over to read the text twice. 
                  */
                 switch (role) {
+                    case COMBOBOX:
                     case TEXT:
                     case TEXT_FIELD:
-                    case TEXT_AREA: return null;
+                    case TEXT_AREA:
                     case TREE_TABLE_ITEM: return null;
                     case TREE_TABLE_CELL: {
                         /*
--- a/modules/graphics/src/main/java/com/sun/glass/ui/monocle/omapx11/OMAPX11Platform.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/monocle/omapx11/OMAPX11Platform.java	Wed Apr 30 08:30:58 2014 -0700
@@ -23,8 +23,10 @@
  * questions.
  */
 
+import com.sun.glass.ui.monocle.AcceleratedScreen;
 import com.sun.glass.ui.monocle.NativeScreen;
 import com.sun.glass.ui.monocle.omap.OMAPPlatform;
+import com.sun.glass.ui.monocle.x11.X11AcceleratedScreen;
 import com.sun.glass.ui.monocle.x11.X11Screen;
 
 public class OMAPX11Platform extends OMAPPlatform {
@@ -34,4 +36,13 @@
         return new X11Screen(false);
     }
 
+    @Override
+    public synchronized AcceleratedScreen getAcceleratedScreen(
+            int[] attributes) {
+        if (accScreen == null) {
+            accScreen = new X11AcceleratedScreen(attributes);
+        }
+        return accScreen;
+    }
+
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/monocle/x11/X11AcceleratedScreen.java	Wed Apr 30 08:30:58 2014 -0700
@@ -0,0 +1,41 @@
+package com.sun.glass.ui.monocle.x11;/*
+ * Copyright (c) 2014, 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.
+ */
+
+import com.sun.glass.ui.monocle.AcceleratedScreen;
+import com.sun.glass.ui.monocle.NativePlatformFactory;
+
+public class X11AcceleratedScreen extends AcceleratedScreen {
+
+    public X11AcceleratedScreen(int[] attributes) {
+        super(attributes);
+    }
+
+    @Override
+    protected long platformGetNativeWindow() {
+        return NativePlatformFactory.getNativePlatform()
+                .getScreen().getNativeHandle();
+    }
+
+}
--- a/modules/graphics/src/main/java/com/sun/glass/ui/monocle/x11/X11Platform.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/monocle/x11/X11Platform.java	Wed Apr 30 08:30:58 2014 -0700
@@ -23,17 +23,36 @@
  * questions.
  */
 
+import com.sun.glass.ui.monocle.AcceleratedScreen;
 import com.sun.glass.ui.monocle.NativeCursor;
 import com.sun.glass.ui.monocle.NativePlatform;
 import com.sun.glass.ui.monocle.NativeScreen;
 import com.sun.glass.ui.monocle.NullCursor;
 import com.sun.glass.ui.monocle.input.InputDeviceRegistry;
+import com.sun.glass.ui.monocle.linux.LinuxInputDeviceRegistry;
+import com.sun.glass.ui.monocle.linux.LinuxSystem;
+import com.sun.glass.ui.monocle.mx6.MX6AcceleratedScreen;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 
 public class X11Platform extends NativePlatform {
 
+    private final boolean x11InputAndCursor;
+
+    public X11Platform() {
+        LinuxSystem.getLinuxSystem().loadLibrary();
+        x11InputAndCursor = AccessController.doPrivileged((PrivilegedAction<Boolean>)
+                () -> Boolean.getBoolean("x11.input"));
+    }
+
     @Override
     protected InputDeviceRegistry createInputDeviceRegistry() {
-        return new X11InputDeviceRegistry();
+        if (x11InputAndCursor) {
+            return new X11InputDeviceRegistry();
+        } else {
+            return new LinuxInputDeviceRegistry(false);
+        }
     }
 
     @Override
@@ -43,7 +62,15 @@
 
     @Override
     protected NativeScreen createScreen() {
-        return new X11Screen(true);
+        return new X11Screen(x11InputAndCursor);
     }
 
+    @Override
+    public synchronized AcceleratedScreen getAcceleratedScreen(
+            int[] attributes) {
+        if (accScreen == null) {
+            accScreen = new X11AcceleratedScreen(attributes);
+        }
+        return accScreen;
+    }
 }
--- a/modules/graphics/src/main/java/com/sun/glass/ui/monocle/x11/X11Screen.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/monocle/x11/X11Screen.java	Wed Apr 30 08:30:58 2014 -0700
@@ -104,7 +104,7 @@
                 cwMask,
                 attrs.p);
         X.XMapWindow(display, window);
-        X.XStoreName(display, window, "JavaFX EGL/framebuffer container");
+        X.XStoreName(display, window, "JavaFX framebuffer container");
         X.XSync(display, false);
         int[] widthA = new int[1];
         int[] heightA = new int[1];
--- a/modules/graphics/src/main/java/com/sun/glass/ui/win/WinAccessible.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/win/WinAccessible.java	Wed Apr 30 08:30:58 2014 -0700
@@ -621,7 +621,6 @@
                 break;
             case COMBOBOX:
                 impl = patternId == UIA_ExpandCollapsePatternId ||
-                       patternId == UIA_SelectionPatternId ||
                        patternId == UIA_ValuePatternId;
                 break;
             case SCROLL_BAR:
@@ -1012,7 +1011,6 @@
                 break;
             }
             case TREE_VIEW:
-            case COMBOBOX:
             case LIST_VIEW: {
                 ObservableList<Node> selection = (ObservableList<Node>)getAttribute(SELECTED_ROWS);
                 if (selection != null) {
@@ -1121,6 +1119,7 @@
                 case SCROLL_BAR:
                 case TEXT_FIELD:
                 case TEXT_AREA: return false;
+                case COMBOBOX: return Boolean.FALSE.equals(getAttribute(EDITABLE));
                 default:
             }
         }
--- a/modules/graphics/src/main/java/com/sun/glass/ui/win/WinTextRangeProvider.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/win/WinTextRangeProvider.java	Wed Apr 30 08:30:58 2014 -0700
@@ -458,7 +458,7 @@
                     while (next != BreakIterator.DONE && requestedCount != actualCount) {
                         /* Always keep start offset at a word start, and end offset at a word end */
                         if (endpoint == TextPatternRangeEndpoint_Start) {
-                            while (isWordStart(bi, text, next)) next = bi.next();
+                            while (next == BreakIterator.DONE && isWordStart(bi, text, next)) next = bi.next();
                         } else {
                             while (!isWordStart(bi, text, next)) next = bi.next();
                         }
@@ -471,7 +471,7 @@
                     while (prev != BreakIterator.DONE && requestedCount != actualCount) {
                         /* Always keep start offset at a word start, and end offset at a word end */
                         if (endpoint == TextPatternRangeEndpoint_Start) {
-                            while (isWordStart(bi, text, prev)) prev = bi.previous();
+                            while (prev == BreakIterator.DONE && isWordStart(bi, text, prev)) prev = bi.previous();
                         } else {
                             while (!isWordStart(bi, text, prev)) prev = bi.previous();
                         }
--- a/modules/graphics/src/main/java/com/sun/javafx/tk/quantum/PresentingPainter.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/javafx/tk/quantum/PresentingPainter.java	Wed Apr 30 08:30:58 2014 -0700
@@ -81,6 +81,7 @@
                 presentable = factory.createPresentable(sceneState);
                 penWidth  = viewWidth;
                 penHeight = viewHeight;
+                freshBackBuffer = true;
             }
             
             if (presentable != null) {
@@ -89,6 +90,7 @@
                 ViewScene vs = (ViewScene) sceneState.getScene();
                 if (g != null) {
                     paintImpl(g);
+                    freshBackBuffer = false;
                 }
 
                 if (PULSE_LOGGING_ENABLED) {
--- a/modules/graphics/src/main/java/com/sun/javafx/tk/quantum/UploadingPainter.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/javafx/tk/quantum/UploadingPainter.java	Wed Apr 30 08:30:58 2014 -0700
@@ -123,6 +123,7 @@
                 penHeight   = viewHeight;
                 textureBits = null;
                 pixBits = null;
+                freshBackBuffer = true;
             }
             Graphics g = rttexture.createGraphics();
             if (g == null) {
@@ -132,6 +133,7 @@
             }
             g.scale(scale, scale);
             paintImpl(g);
+            freshBackBuffer = false;
 
             int rawbits[] = rttexture.getPixels();
             
--- a/modules/graphics/src/main/java/com/sun/javafx/tk/quantum/ViewPainter.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/javafx/tk/quantum/ViewPainter.java	Wed Apr 30 08:30:58 2014 -0700
@@ -84,6 +84,7 @@
 
     protected Presentable presentable;
     protected ResourceFactory factory;
+    protected boolean freshBackBuffer;
 
     private int width;
     private int height;
@@ -177,6 +178,7 @@
         // Initialize renderEverything based on various conditions that will cause us to render
         // the entire scene every time.
         boolean renderEverything = overlayRoot != null ||
+                freshBackBuffer ||
                 sceneState.getScene().isEntireSceneDirty() ||
                 sceneState.getScene().getDepthBuffer() ||
                 !PrismSettings.dirtyOptsEnabled;
--- a/modules/graphics/src/main/java/com/sun/prism/d3d/D3DResourceFactory.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/prism/d3d/D3DResourceFactory.java	Wed Apr 30 08:30:58 2014 -0700
@@ -320,6 +320,9 @@
             int width = D3DResourceFactory.nGetTextureWidth(pResource);
             int height = D3DResourceFactory.nGetTextureHeight(pResource);
             D3DRTTexture rtt = createRTTexture(width, height, WrapMode.CLAMP_NOT_NEEDED, pState.isAntiAliasing());
+            if (PrismSettings.dirtyOptsEnabled) {
+                rtt.contentsUseful();
+            }
 
             if (rtt != null) {
                 return new D3DSwapChain(context, pResource, rtt);
--- a/modules/graphics/src/main/java/com/sun/prism/es2/ES2SwapChain.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/prism/es2/ES2SwapChain.java	Wed Apr 30 08:30:58 2014 -0700
@@ -110,6 +110,12 @@
             stableBackbuffer.lock();
             if (stableBackbuffer.isSurfaceLost()) {
                 stableBackbuffer = null;
+                // For resizes we can keep the back buffer, but if we lose
+                // the back buffer then we need the caller to know that a
+                // new buffer is coming so that the entire scene can be
+                // redrawn.  To force this, we return true and the Presentable
+                // is recreated and repainted in its entirety.
+                return true;
             }
         }
         return false;
@@ -139,7 +145,7 @@
                 if (isAntiAliasing()) {
                     context.flushVertexBuffer();
                     // Note must flip the z axis during blit
-                    context.blit(stableBackbuffer, null, x0, y0, x1, y1,
+                    g.blit(stableBackbuffer, null, x0, y0, x1, y1,
                             x0, y1, x1, y0);
                 } else {
                     drawTexture(g, stableBackbuffer, x0, y0, x1, y1,
@@ -211,6 +217,9 @@
             stableBackbuffer = factory.createRTTexture(w, h,
                                                        WrapMode.CLAMP_NOT_NEEDED,
                                                        antiAliasing);
+            if (PrismSettings.dirtyOptsEnabled) {
+                stableBackbuffer.contentsUseful();
+            }
             copyFullBuffer = true;
         }
         ES2Graphics g = ES2Graphics.create(context, stableBackbuffer);
--- a/modules/graphics/src/main/java/javafx/scene/text/TextFlow.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/graphics/src/main/java/javafx/scene/text/TextFlow.java	Wed Apr 30 08:30:58 2014 -0700
@@ -29,8 +29,6 @@
 import java.util.Collections;
 import java.util.List;
 
-import javafx.beans.InvalidationListener;
-import javafx.beans.Observable;
 import javafx.beans.property.DoubleProperty;
 import javafx.beans.property.ObjectProperty;
 import javafx.geometry.HPos;
--- a/modules/graphics/src/main/native-glass/mac/GlassScreen.m	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/graphics/src/main/native-glass/mac/GlassScreen.m	Wed Apr 30 08:30:58 2014 -0700
@@ -59,8 +59,15 @@
                                                    "(JIIIIIIIIIIIF)V");
         GLASS_CHECK_EXCEPTION(env);
 
-        NSValue *resolutionValue = [[screen deviceDescription] valueForKey:NSDeviceResolution];
-        NSSize resolution = [resolutionValue sizeValue];
+        // Note that NSDeviceResolution always reports 72 DPI, so we use Core Graphics API instead
+        const CGDirectDisplayID displayID = [[[screen deviceDescription] objectForKey:@"NSScreenNumber"] intValue];
+        CGSize size = CGDisplayScreenSize(displayID);
+        CGRect rect = CGDisplayBounds(displayID);
+        const CGFloat MM_PER_INCH = 25.4f; // 1 inch == 25.4 mm
+        // Avoid division by zero, default to 72 DPI
+        if (size.width == 0) size.width = rect.size.width * MM_PER_INCH / 72.f;
+        if (size.height == 0) size.height = rect.size.height * MM_PER_INCH / 72.f;
+        NSSize resolution = {rect.size.width / (size.width / MM_PER_INCH), rect.size.height / (size.height / MM_PER_INCH)};
 
         jscreen = (jobject)(*env)->NewObject(env, jScreenClass, screenInit,
                                              ptr_to_jlong(screen),
--- a/modules/graphics/src/main/native-glass/mac/GlassWindow.m	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/graphics/src/main/native-glass/mac/GlassWindow.m	Wed Apr 30 08:30:58 2014 -0700
@@ -210,6 +210,20 @@
     return ignored;
 }
 
+- (id)accessibilityAttributeValue:(NSString *)attribute
+{
+    /* 
+    * The default value of AXRoleDescription for a NSPanel is 'system dialog'.
+    * While this is correct for an average cocoa application it is not appropriate
+    * for JFX, where all NSPanels are decoration-less windows used to implement 
+    * tooltip, context menus, combo boxes, etc.
+    */
+    if ([NSAccessibilityRoleDescriptionAttribute isEqualToString: attribute]) {
+        return @"";
+    }
+    return [super accessibilityAttributeValue: attribute];
+}
+
 @end
 // --------------------------------------------------------------------------------------
 
--- a/modules/graphics/src/main/native-glass/monocle/EGL.c	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/graphics/src/main/native-glass/monocle/EGL.c	Wed Apr 30 08:30:58 2014 -0700
@@ -71,14 +71,14 @@
 }
 
 JNIEXPORT jlong JNICALL Java_com_sun_glass_ui_monocle_EGL_eglGetDisplay
-    (JNIEnv *env, jclass clazz, jlong display) {
+    (JNIEnv *UNUSED(env), jclass UNUSED(clazz), jlong display) {
     // EGLNativeDisplayType is defined differently on different systems; can be an int or a ptr so cast with care
     EGLDisplay dpy = eglGetDisplay(((EGLNativeDisplayType) (unsigned long)(display)));
     return asJLong(dpy);
 }
 
 JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_monocle_EGL_eglInitialize
-    (JNIEnv *env, jclass clazz, jlong eglDisplay, jintArray majorArray,
+    (JNIEnv *env, jclass UNUSED(clazz), jlong eglDisplay, jintArray majorArray,
      jintArray minorArray){
 
     EGLint major, minor;
@@ -92,7 +92,7 @@
 }
 
 JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_monocle_EGL_eglBindAPI
-    (JNIEnv *env, jclass clazz, jint api) {
+    (JNIEnv *UNUSED(env), jclass UNUSED(clazz), jint api) {
 
     if (eglBindAPI(api)) {
         return JNI_TRUE;
@@ -102,7 +102,7 @@
 }
 
 JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_monocle_EGL_eglChooseConfig
-    (JNIEnv *env, jclass clazz, jlong eglDisplay, jintArray attribs,
+    (JNIEnv *env, jclass UNUSED(clazz), jlong eglDisplay, jintArray attribs,
      jlongArray configs, jint configSize, jintArray numConfigs) {
 
     int i=0;
@@ -139,7 +139,7 @@
 }
 
 JNIEXPORT jlong JNICALL Java_com_sun_glass_ui_monocle_EGL__1eglCreateWindowSurface
-    (JNIEnv *env, jclass clazz, jlong eglDisplay, jlong config,
+    (JNIEnv *UNUSED(env), jclass UNUSED(clazz), jlong eglDisplay, jlong config,
      jlong nativeWindow, jintArray attribs) {
 
     EGLSurface eglSurface;
@@ -149,8 +149,8 @@
         attrArray = (*env)->GetIntArrayElements(env, attribs, JNI_FALSE);
 
     eglSurface =  eglCreateWindowSurface(asPtr(eglDisplay), asPtr(config),
-                                               asPtr(nativeWindow),
-                                               NULL);
+                                         (EGLNativeWindowType) asPtr(nativeWindow),
+                                         (EGLint *) NULL);
     if (attrArray != NULL) {
         (*env)->ReleaseIntArrayElements(env, attribs, attrArray, JNI_ABORT);
     }
@@ -158,8 +158,8 @@
 }
 
 JNIEXPORT jlong JNICALL Java_com_sun_glass_ui_monocle_EGL_eglCreateContext
-    (JNIEnv *env, jclass clazz, jlong eglDisplay, jlong config,
-      jlong shareContext, jintArray attribs){
+    (JNIEnv *UNUSED(env), jclass UNUSED(clazz), jlong eglDisplay, jlong config,
+      jlong UNUSED(shareContext), jintArray UNUSED(attribs)){
 
     // we don't support any passed-in context attributes presently
     // we don't support any share context presently
@@ -176,7 +176,7 @@
 }
 
 JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_monocle_EGL_eglMakeCurrent
-   (JNIEnv *env, jclass clazz, jlong eglDisplay, jlong drawSurface,
+   (JNIEnv *UNUSED(env), jclass UNUSED(clazz), jlong eglDisplay, jlong drawSurface,
     jlong readSurface, jlong eglContext) {
 
     if (eglMakeCurrent(asPtr(eglDisplay), asPtr(drawSurface), asPtr(readSurface),
@@ -188,7 +188,7 @@
 }
 
 JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_monocle_EGL_eglSwapBuffers
-    (JNIEnv *env, jclass clazz, jlong eglDisplay, jlong eglSurface) {
+    (JNIEnv *UNUSED(env), jclass UNUSED(clazz), jlong eglDisplay, jlong eglSurface) {
     if (eglSwapBuffers(asPtr(eglDisplay), asPtr(eglSurface))) {
         return JNI_TRUE;
     } else {
--- a/modules/graphics/src/main/native-prism-d3d/D3DContext.cc	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/graphics/src/main/native-prism-d3d/D3DContext.cc	Wed Apr 30 08:30:58 2014 -0700
@@ -103,6 +103,7 @@
 
     ZeroMemory(&devCaps, sizeof(D3DCAPS9));
     ZeroMemory(&curParams, sizeof(curParams));
+    ZeroMemory(textureCache, sizeof(textureCache));
 }
 
 /**
@@ -157,6 +158,10 @@
                 "~D3DContext: pd3dDevice=0x%x, pd3dObject =0x%x",
                 pd3dDevice, pd3dObject);
     ReleaseContextResources(RELEASE_ALL);
+    for (int i = 0; i < NUM_TEXTURE_CACHE; i++) {
+        SAFE_RELEASE(textureCache[i].surface);
+        SAFE_RELEASE(textureCache[i].texture);
+    }
     SAFE_RELEASE(pd3dDevice);
     SAFE_RELEASE(pd3dDeviceEx);
 
@@ -1247,3 +1252,53 @@
     }
     return S_OK;
 }
+
+IDirect3DTexture9 *createTexture(D3DFORMAT format, int w, int h, IDirect3DSurface9 **pSurface, IDirect3DDevice9 *dev) {
+    IDirect3DTexture9 *texture;
+    HRESULT hr = dev->CreateTexture(w, h, 1, D3DUSAGE_DYNAMIC, format, D3DPOOL_SYSTEMMEM, &texture, 0);
+    if (FAILED(hr)) {
+        RlsTraceLn1(NWT_TRACE_ERROR, "Failed to create system memory texture for update operation: %08X", hr);
+        return NULL;
+    }
+    TraceLn3(NWT_TRACE_VERBOSE, "Created system memory texture for update operation: %dx%d, format = %d", w, h, format);
+    if (pSurface) {
+        hr = texture->GetSurfaceLevel(0, pSurface);
+        if (FAILED(hr)) {
+            RlsTraceLn1(NWT_TRACE_ERROR, "Failed to get surface for update operation: %08X", hr);
+            SAFE_RELEASE(texture);
+            return NULL;
+        }
+    }
+    return texture;
+}
+
+IDirect3DTexture9 *D3DContext::TextureUpdateCache::getTexture(
+    D3DFORMAT format, int w, int h, IDirect3DSurface9 **pSurface, IDirect3DDevice9 *dev)
+{
+    if (w <= width && h <= height && texture != NULL) {
+        if (pSurface) *pSurface = surface;
+        return texture;
+    }
+    // grow the cache texture so that the new texture is
+    // at least as large as the previous one
+    if (w < width)  w = width;
+    if (h < height) h = height;
+    SAFE_RELEASE(surface);
+    SAFE_RELEASE(texture);
+    texture = createTexture(format, w, h, &surface, dev);
+    if (texture == NULL) {
+        return NULL;
+    }
+    width = w;
+    height = h;
+    if (pSurface) *pSurface = surface;
+    return texture;
+}
+
+IDirect3DTexture9 *D3DContext::getTextureCache(int formatIndex, D3DFORMAT format, int width, int height, IDirect3DSurface9 **pSurface) {
+    if (formatIndex < 0 || formatIndex >= NUM_TEXTURE_CACHE) {
+        return createTexture(format, width, height, pSurface, pd3dDevice);
+    }
+    TextureUpdateCache &cache = textureCache[formatIndex];
+    return cache.getTexture(format, width, height, pSurface, pd3dDevice);
+}
--- a/modules/graphics/src/main/native-prism-d3d/D3DContext.h	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/graphics/src/main/native-prism-d3d/D3DContext.h	Wed Apr 30 08:30:58 2014 -0700
@@ -33,6 +33,9 @@
     #define PERF_COUNTERS
 #endif
 
+//see com.sun.prism.PixelFormat enum
+#define NUM_TEXTURE_CACHE 8
+
 // allow for 256 quads to match the size of the D3DVertexBuffer's nio buffer
 
 #define MAX_BATCH_QUADS 256
@@ -83,7 +86,7 @@
 public:
 
     HRESULT drawIndexedQuads(struct PrismSourceVertex const *pSrcFloats, BYTE const *pSrcColors, int numVerts);
-    void D3DContext::stretchRect(IDirect3DSurface9* pSrcSurface,
+    void stretchRect(IDirect3DSurface9* pSrcSurface,
                                 int srcX0, int srcY0, int srcX1, int srcY1,
                                 IDirect3DSurface9* pDstSurface,
                                 int dstX0, int dstY0, int dstX1, int dstY1);
@@ -239,7 +242,7 @@
     } state;
 
 private:
-     ~D3DContext();
+    ~D3DContext();
 
 
     IDirect3DVertexShader9 *pPassThroughVS;
@@ -291,6 +294,16 @@
      * 3D implementation
      */
     D3DPhongShader *phongShader;
+
+    struct TextureUpdateCache {
+        IDirect3DTexture9 *texture;
+        IDirect3DSurface9 *surface;
+        int width, height;
+        IDirect3DTexture9 *getTexture(D3DFORMAT format, int width, int height, IDirect3DSurface9 **pSurface, IDirect3DDevice9 *dev);
+    } textureCache[NUM_TEXTURE_CACHE];
+
+public:
+    IDirect3DTexture9 *getTextureCache(int formatIndex, D3DFORMAT format, int width, int height, IDirect3DSurface9 **pSurface);
 };
 
 #define DEVICE_RESET           0
--- a/modules/graphics/src/main/native-prism-d3d/D3DResourceFactory.cc	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/graphics/src/main/native-prism-d3d/D3DResourceFactory.cc	Wed Apr 30 08:30:58 2014 -0700
@@ -248,13 +248,14 @@
 
     RETURN_STATUS_IF_NULL(paramsOK, E_INVALIDARG);
 
+    TraceLn7(NWT_TRACE_VERBOSE, "updateTexture src = [%d, %d]-[%dx%d], pixels = %p, dst = [%dx%d]", srcx, srcy, srcw, srch, pixels, dstx, dsty);
+
     TextureUpdater updater;
-    updater.setTarget(pTexResource->GetTexture(), desc, dstx, dsty);
+    updater.setTarget(pTexResource->GetTexture(), pTexResource->GetSurface(), desc, dstx, dsty);
     updater.setSource(pixels, size, PFormat(format), srcx, srcy, srcw, srch, srcscan);
 
-    IDirect3DDevice9Ex *pDev = pCtx->Get3DExDevice();
-    int nBytes = pDev
-        ? updater.updateD3D9ExTexture(pDev)
+    int nBytes = pCtx->Get3DExDevice()
+        ? updater.updateD3D9ExTexture(pCtx)
         : updater.updateLockableTexture();
 
 #if defined PERF_COUNTERS
--- a/modules/graphics/src/main/native-prism-d3d/TextureUploader.cc	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/graphics/src/main/native-prism-d3d/TextureUploader.cc	Wed Apr 30 08:30:58 2014 -0700
@@ -58,19 +58,6 @@
     }
 }
 
-bool TextureUpdater::isConversionNeeded() const {
-    switch (format) {
-    case PFORMAT_INT_ARGB_PRE:
-    case PFORMAT_BYTE_RGBA_PRE:
-        return srcStride != 4*srcW ||
-            (pDesc->Format != D3DFMT_A8R8G8B8 && pDesc->Format != D3DFMT_X8R8G8B8);
-    case PFORMAT_FLOAT_XYZW:
-        return srcStride != 16*srcW || pDesc->Format != D3DFMT_A32B32G32R32F;
-    default:
-        return true;
-    }
-}
-
 void TextureUpdater::unimplementedError() {
     RlsTrace(NWT_TRACE_ERROR, "Texture transfer is not implemented\n");
 }
@@ -162,53 +149,28 @@
     return numTransferBytes;
 }
 
-int TextureUpdater::updateD3D9ExTexture(IDirect3DDevice9 *pDev) {
-    IDirect3DTexture9 * temp = 0;
-    HANDLE pData = isConversionNeeded() ? 0 : data;
-    HRESULT hr = pDev->CreateTexture(srcW, srcH, 1, 0, pDesc->Format, D3DPOOL_SYSTEMMEM, &temp, pData ? &pData : 0);
+int TextureUpdater::updateD3D9ExTexture(D3DContext *pCtx) {
+    IDirect3DSurface9 *tempSurface = NULL;
+    IDirect3DTexture9 *tempTexture = pCtx->getTextureCache(format, pDesc->Format, srcW, srcH, &tempSurface);
     int size = 0;
 
-    if (SUCCEEDED(hr)) {
+    if (tempTexture && tempSurface && pSurface) {
         // need to upload data into the system texture
-        if (pData == 0) {
-            TextureUpdater updater;
-            updater.setTarget(temp, pDesc, 0, 0);
-            updater.setSource(data, srcSize, format, 0, 0, srcW, srcH, srcStride);
-            size = updater.updateLockableTexture();
-        } else {
-            size = getPixelSize(format) * srcW * srcH;
+
+        TextureUpdater updater;
+        updater.setTarget(tempTexture, tempSurface, pDesc, 0, 0);
+        updater.setSource(data, srcSize, format, 0, 0, srcW, srcH, srcStride);
+        size = updater.updateLockableTexture();
+
+        RECT sRect = { 0, 0, srcW, srcH };
+        POINT dPos = { dstX, dstY };
+        HRESULT hr = pCtx->Get3DExDevice()->UpdateSurface(tempSurface, &sRect, pSurface, &dPos);
+        if (FAILED(hr)) {
+            RlsTraceLn1(NWT_TRACE_ERROR, "Failed to update surface: %08X", hr);
+            size = 0;
         }
-
-        if (srcW == pDesc->Width && srcH == pDesc->Height && dstX==0 && dstY==0) {
-            hr = pDev->UpdateTexture(temp, pTexture);
-            if (FAILED(hr)) {
-                RlsTraceLn1(NWT_TRACE_ERROR, "Failed to update texture: %08X", hr);
-                size = 0;
-            }
-        } else {
-            IDirect3DSurface9 *src = 0, *dst = 0;
-            HRESULT hr1 = temp->GetSurfaceLevel(0, &src);
-            HRESULT hr2 = pTexture->GetSurfaceLevel(0, &dst);
-            if (SUCCEEDED(hr1) && SUCCEEDED(hr2)) {
-                RECT sRect = { 0, 0, srcW, srcH };
-                POINT dPos = { dstX, dstY };
-                hr = pDev->UpdateSurface( src, &sRect, dst, &dPos);
-                if (FAILED(hr)) {
-                    RlsTraceLn1(NWT_TRACE_ERROR, "Failed to update surface: %08X", hr);
-                    size = 0;
-                }
-            } else {
-                RlsTraceLn1(NWT_TRACE_ERROR, "Failed to get surfaceLevel 0x%08X", (hr1 | hr2));
-            }
-            SafeRelease(src); SafeRelease(dst);
-        }
-    } else {
-        RlsTraceLn1(NWT_TRACE_ERROR, "Failed to create system memory texture for update operation: %08X", hr);
-        return 0;
     }
 
-    SafeRelease(temp);
-
     return size;
 }
 
--- a/modules/graphics/src/main/native-prism-d3d/TextureUploader.h	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/graphics/src/main/native-prism-d3d/TextureUploader.h	Wed Apr 30 08:30:58 2014 -0700
@@ -63,12 +63,13 @@
     PFormat format;
     UINT srcW, srcH, srcStride, srcSize;
 
-    // destinition
+    // destination
     IDirect3DTexture9 *pTexture;
+    IDirect3DSurface9 *pSurface;
     D3DSURFACE_DESC *pDesc;
     UINT dstX, dstY;
 
-    TextureUpdater() : pTexture(0), data(0), pDesc(0) {}
+    TextureUpdater() : pTexture(0), pSurface(0), data(0), pDesc(0) {}
 
     // return false if paramenters are incorrect
     // dstW and dstH are real texture size from its D3DSURFACE_DESC
@@ -88,8 +89,9 @@
         return dstOk && srcOk;
     }
 
-    void setTarget(IDirect3DTexture9 *t, D3DSURFACE_DESC *desc, UINT x, UINT y) {
-        pTexture = t;
+    void setTarget(IDirect3DTexture9 *tex, IDirect3DSurface9 *surface, D3DSURFACE_DESC *desc, UINT x, UINT y) {
+        pTexture = tex;
+        pSurface = surface;
         pDesc = desc;
         dstX = x; dstY = y;
     }
@@ -109,7 +111,7 @@
       returns number of bytes transferred
     */
     int updateLockableTexture();
-    int updateD3D9ExTexture(IDirect3DDevice9 *pDev);
+    int updateD3D9ExTexture(D3DContext *pCtx);
 
 private:
 
@@ -119,7 +121,5 @@
 
     static void transferRGBtoA8R8G8B8( BYTE const *pSrcPixels, int srcStride, DWORD *pDstPixels, int dstStride, int w, int h);
 
-    bool isConversionNeeded() const;
-
     void unimplementedError();
 };
--- a/modules/graphics/src/main/native-prism-es2/GLContext.c	Wed Apr 30 07:48:01 2014 -0700
+++ b/modules/graphics/src/main/native-prism-es2/GLContext.c	Wed Apr 30 08:30:58 2014 -0700
@@ -374,6 +374,12 @@
         return;
     }
 
+    // Temporarily disable scissor to avoid a problem with some GL drivers
+    // that honor the scissor test if enabled
+    if (ctxInfo->state.scissorEnabled) {
+        glDisable(GL_SCISSOR_TEST);
+    }
+
     if (dstFBO == 0) {
         dstFBO = ctxInfo->state.fbo;
     }
@@ -393,6 +399,11 @@
 
     // Restore previous FBO
     ctxInfo->glBindFramebuffer(GL_FRAMEBUFFER, ctxInfo->state.fbo);
+
+    // Restore previous scissor
+    if (ctxInfo->state.scissorEnabled) {
+        glEnable(GL_SCISSOR_TEST);
+    }
 }
 
 GLuint attachRenderbuffer(ContextInfo *ctxInfo, GLuint rbID, GLenum attachment) {
--- a/netbeans/base/nbproject/build-impl.xml	Wed Apr 30 07:48:01 2014 -0700
+++ b/netbeans/base/nbproject/build-impl.xml	Wed Apr 30 08:30:58 2014 -0700
@@ -166,6 +166,7 @@
                 <available file="${src.dir}"/>
                 <available file="${src.version-info.dir}"/>
                 <available file="${src.java8.dir}"/>
+                <available file="${src.java-jfr.dir}"/>
             </or>
         </condition>
         <condition property="netbeans.home+have.tests">
@@ -255,6 +256,7 @@
         <fail unless="src.dir">Must set src.dir</fail>
         <fail unless="src.version-info.dir">Must set src.version-info.dir</fail>
         <fail unless="src.java8.dir">Must set src.java8.dir</fail>
+        <fail unless="src.java-jfr.dir">Must set src.java-jfr.dir</fail>
         <fail unless="test.src.dir">Must set test.src.dir</fail>
         <fail unless="build.dir">Must set build.dir</fail>
         <fail unless="dist.dir">Must set dist.dir</fail>
@@ -276,7 +278,7 @@
     </target>
     <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
         <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
-            <attribute default="${src.dir}:${src.version-info.dir}:${src.java8.dir}" name="srcdir"/>
+            <attribute default="${src.dir}:${src.version-info.dir}:${src.java8.dir}:${src.java-jfr.dir}" name="srcdir"/>
             <attribute default="${build.classes.dir}" name="destdir"/>
             <attribute default="${javac.classpath}" name="classpath"/>
             <attribute default="${javac.processorpath}" name="processorpath"/>
@@ -317,7 +319,7 @@
     </target>
     <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
         <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
-            <attribute default="${src.dir}:${src.version-info.dir}:${src.java8.dir}" name="srcdir"/>
+            <attribute default="${src.dir}:${src.version-info.dir}:${src.java8.dir}:${src.java-jfr.dir}" name="srcdir"/>
             <attribute default="${build.classes.dir}" name="destdir"/>
             <attribute default="${javac.classpath}" name="classpath"/>
             <attribute default="${javac.processorpath}" name="processorpath"/>
@@ -350,7 +352,7 @@
     </target>
     <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
         <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
-            <attribute default="${src.dir}:${src.version-info.dir}:${src.java8.dir}" name="srcdir"/>
+            <attribute default="${src.dir}:${src.version-info.dir}:${src.java8.dir}:${src.java-jfr.dir}" name="srcdir"/>
             <attribute default="${build.classes.dir}" name="destdir"/>
             <attribute default="${javac.classpath}" name="classpath"/>
             <sequential>
@@ -961,7 +963,7 @@
                 <include name="*"/>
             </dirset>
         </pathconvert>
-        <j2seproject3:depend srcdir="${src.dir}:${src.version-info.dir}:${src.java8.dir}:${build.generated.subdirs}"/>
+        <j2seproject3:depend srcdir="${src.dir}:${src.version-info.dir}:${src.java8.dir}:${src.java-jfr.dir}:${build.generated.subdirs}"/>
     </target>
     <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile">
         <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
@@ -969,6 +971,7 @@
             <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
             <fileset dir="${src.version-info.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
             <fileset dir="${src.java8.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+            <fileset dir="${src.java-jfr.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
         </copy>
     </target>
     <target if="has.persistence.xml" name="-copy-persistence-xml">
@@ -989,7 +992,7 @@
     <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
         <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
         <j2seproject3:force-recompile/>
-        <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}:${src.version-info.dir}:${src.java8.dir}"/>
+        <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}:${src.version-info.dir}:${src.java8.dir}:${src.java-jfr.dir}"/>
     </target>
     <target name="-post-compile-single">
         <!-- Empty placeholder for easier customization. -->
@@ -1267,6 +1270,9 @@
             <fileset dir="${src.java8.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
                 <filename name="**/*.java"/>
             </fileset>
+            <fileset dir="${src.java-jfr.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
+                <filename name="**/*.java"/>
+            </fileset>
             <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
                 <include name="**/*.java"/>
                 <exclude name="*.java"/>
@@ -1283,6 +1289,9 @@
             <fileset dir="${src.java8.dir}" excludes="${excludes}" includes="${includes}">
                 <filename name="**/doc-files/**"/>
             </fileset>
+            <fileset dir="${src.java-jfr.dir}" excludes="${excludes}" includes="${includes}">
+                <filename name="**/doc-files/**"/>
+            </fileset>
             <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
                 <include name="**/doc-files/**"/>
             </fileset>
--- a/netbeans/base/nbproject/genfiles.properties	Wed Apr 30 07:48:01 2014 -0700
+++ b/netbeans/base/nbproject/genfiles.properties	Wed Apr 30 08:30:58 2014 -0700
@@ -1,4 +1,4 @@
-build.xml.data.CRC32=e7f2fddb
+build.xml.data.CRC32=ea398440
 build.xml.script.CRC32=1943b7b2
 build.xml.stylesheet.CRC32=8064a381@1.68.1.46
 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
--- a/netbeans/base/nbproject/project.properties	Wed Apr 30 07:48:01 2014 -0700
+++ b/netbeans/base/nbproject/project.properties	Wed Apr 30 08:30:58 2014 -0700
@@ -29,6 +29,7 @@
 excludes=
 file.reference.main-java=../../modules/base/src/main/java
 file.reference.main-java8=../../modules/base/src/main/java8
+file.reference.main-java-jfr=../../modules/base/src/main/java-jfr
 file.reference.main-version-info=../../modules/base/src/main/version-info
 file.reference.test-java=../../modules/base/src/test/java
 includes=**
@@ -80,5 +81,6 @@
 source.encoding=UTF-8
 src.dir=${file.reference.main-java}
 src.java8.dir=${file.reference.main-java8}
+src.java-jfr.dir=${file.reference.main-java-jfr}
 src.version-info.dir=${file.reference.main-version-info}
 test.src.dir=${file.reference.test-java}
--- a/netbeans/base/nbproject/project.xml	Wed Apr 30 07:48:01 2014 -0700
+++ b/netbeans/base/nbproject/project.xml	Wed Apr 30 08:30:58 2014 -0700
@@ -9,6 +9,7 @@
                 <root id="src.dir"/>
                 <root id="src.version-info.dir"/>
                 <root id="src.java8.dir"/>
+                <root id="src.java-jfr.dir"/>
             </source-roots>
             <test-roots>
                 <root id="test.src.dir"/>
--- a/tests/system/src/test/java/com/sun/glass/ui/monocle/input/UInput.java	Wed Apr 30 07:48:01 2014 -0700
+++ b/tests/system/src/test/java/com/sun/glass/ui/monocle/input/UInput.java	Wed Apr 30 08:30:58 2014 -0700
@@ -41,6 +41,9 @@
             System.setProperty("glass.platform", "Monocle");
             System.setProperty("monocle.platform", "Headless");
             System.setProperty("prism.order", "sw");
+            System.setProperty("com.sun.javafx.gestures.zoom", "true");
+            System.setProperty("com.sun.javafx.gestures.rotate", "true");
+            System.setProperty("com.sun.javafx.gestures.scroll", "true");
         }
         isMonocle = "Monocle".equals(System.getProperty("glass.platform"));
         setup();