changeset 7161:dd892a7f8463

Automated merge with ssh://jfxsrc.us.oracle.com//javafx/8u/master/jfx/rt
author kcr
date Thu, 29 May 2014 14:51:49 -0700
parents ce2ebc11d5c4 be2bf0af38c6
children 223c57a7a73d
files
diffstat 69 files changed, 893 insertions(+), 340 deletions(-) [+]
line wrap: on
line diff
--- a/apps/toys/Hello/src/main/java/a11y/HelloSimpleListView.java	Tue May 27 20:34:11 2014 -0700
+++ b/apps/toys/Hello/src/main/java/a11y/HelloSimpleListView.java	Thu May 29 14:51:49 2014 -0700
@@ -28,12 +28,15 @@
 import javafx.application.Application;
 import javafx.beans.InvalidationListener;
 import javafx.beans.Observable;
+import javafx.beans.binding.When;
 import javafx.collections.FXCollections;
 import javafx.collections.ObservableList;
 import javafx.scene.Scene;
-import javafx.scene.control.Button;
 import javafx.scene.control.ListView;
+import javafx.scene.control.SelectionMode;
+import javafx.scene.control.ToggleButton;
 import javafx.scene.layout.VBox;
+import javafx.scene.text.Text;
 import javafx.stage.Stage;
 
 public class HelloSimpleListView extends Application {
@@ -51,9 +54,20 @@
                 System.out.println("SelectedIndex: " + listView.getSelectionModel().getSelectedIndex());
             }
         });
-
-        Button button = new Button("okay");
-        VBox group = new VBox(listView, button);
+        listView.setPlaceholder(new Text("place holder for emptyness"));
+        ToggleButton button = new ToggleButton("empty");
+        button.setOnAction(t-> {
+            if (list.size() == 0) {
+                for (int i=0; i<128; i++) {
+                    list.add("JavaFX item " + i);
+                }
+            } else {
+                list.setAll();
+            }
+        });
+        ToggleButton multi = new ToggleButton("multi");
+        listView.getSelectionModel().selectionModeProperty().bind(new When(multi.selectedProperty()).then(SelectionMode.MULTIPLE).otherwise(SelectionMode.SINGLE));
+        VBox group = new VBox(listView, button, multi);
         stage.setScene(new Scene(group, 800, 600));
         stage.show();
     }
--- a/apps/toys/Hello/src/main/java/a11y/HelloSimpleTableView.java	Tue May 27 20:34:11 2014 -0700
+++ b/apps/toys/Hello/src/main/java/a11y/HelloSimpleTableView.java	Thu May 29 14:51:49 2014 -0700
@@ -82,7 +82,17 @@
         ToggleButton button2 = new ToggleButton("multi selection");
         tableView.getSelectionModel().selectionModeProperty().bind(new When(button2.selectedProperty()).then(SelectionMode.MULTIPLE).otherwise(SelectionMode.SINGLE));
         ToggleButton button3 = new ToggleButton("parented");
-        VBox group = new VBox(new HBox(button1, button2, button3), tableView);
+        ToggleButton button4 = new ToggleButton("empty");
+        button4.setOnAction(t-> {
+            if (list.size() == 0) {
+                for (int i=0; i<128; i++) {
+                    list.add(new Item("Item " + i));
+                }
+            } else {
+                list.setAll();
+            }
+        });
+        VBox group = new VBox(new HBox(button1, button2, button3, button4), tableView);
         button3.setOnAction(e -> {
             if (group.getChildren().contains(tableView)) {
                 group.getChildren().remove(tableView);
--- a/apps/toys/Hello/src/main/java/a11y/HelloSimpleTreeView.java	Tue May 27 20:34:11 2014 -0700
+++ b/apps/toys/Hello/src/main/java/a11y/HelloSimpleTreeView.java	Thu May 29 14:51:49 2014 -0700
@@ -25,10 +25,12 @@
 package a11y;
 
 
+import a11y.HelloSimpleTableView.Item;
 import javafx.application.Application;
 import javafx.scene.Scene;
 import javafx.scene.control.Button;
 import javafx.scene.control.Label;
+import javafx.scene.control.ToggleButton;
 import javafx.scene.control.TreeItem;
 import javafx.scene.control.TreeView;
 import javafx.scene.layout.VBox;
@@ -55,7 +57,15 @@
         Label label = new Label("JFX TreeView");
         label.setLabelFor(treeView);
         Button button = new Button("okay");
-        VBox group = new VBox(label, treeView, button);
+        ToggleButton button2 = new ToggleButton("empty");
+        button2.setOnAction(t-> {
+            if (treeView.getRoot()!=null) {
+                treeView.setRoot(null);
+            } else {
+                treeView.setRoot(root);
+            }
+        });
+        VBox group = new VBox(label, treeView, button, button2);
         stage.setScene(new Scene(group, 800, 600));
         stage.show();
     }
--- a/apps/toys/Hello/src/main/java/hello/HelloTitledPane.java	Tue May 27 20:34:11 2014 -0700
+++ b/apps/toys/Hello/src/main/java/hello/HelloTitledPane.java	Thu May 29 14:51:49 2014 -0700
@@ -31,8 +31,11 @@
 import javafx.scene.Scene;
 import javafx.scene.control.Button;
 import javafx.scene.control.Label;
+import javafx.scene.control.ScrollPane;
 import javafx.scene.control.TextField;
 import javafx.scene.control.TitledPane;
+import javafx.scene.image.Image;
+import javafx.scene.image.ImageView;
 import javafx.scene.layout.GridPane;
 import javafx.scene.layout.HBox;
 import javafx.scene.layout.StackPane;
@@ -95,9 +98,22 @@
         bf.setPrefSize(75, 50);
         uncollapsible.setContent(bf);
 
+        // -- Content is a ScrollPane
+        Image image = new Image("hello/duke.jpg", 200f, 200f, true, true, false);
+        ImageView imageView = new ImageView();
+        imageView.setImage(image);
+
+        ScrollPane scrollPane = new ScrollPane(imageView);
+        scrollPane.setPannable(true);
+
+        TitledPane scrollableImage = new TitledPane();
+        scrollableImage.setPrefHeight(100);
+        scrollableImage.setText("ScrollPane content");
+        scrollableImage.setContent(scrollPane);
+
         VBox hbox = new VBox(10);
         hbox.setPadding(new Insets(20, 0, 0, 20));
-        hbox.getChildren().setAll(normal, gridTitlePane, normalText, unanimated, uncollapsible);
+        hbox.getChildren().setAll(normal, gridTitlePane, normalText, unanimated, uncollapsible, scrollableImage);
 
         Scene scene = new Scene(hbox);
         scene.setFill(Color.GHOSTWHITE);
--- a/buildSrc/armv5sf.gradle	Tue May 27 20:34:11 2014 -0700
+++ b/buildSrc/armv5sf.gradle	Thu May 29 14:51:49 2014 -0700
@@ -85,7 +85,7 @@
 // Specify the compilation parameters and link parameters
 def ccFlags = [
         commonFlags, "-I$JDK_HOME/include", "-I$JDK_HOME/include/$jniPlatform", "-c",
-        IS_DEBUG_NATIVE ? ["-ggdb", "-DVERBOSE"] : "-O2"].flatten()
+        IS_DEBUG_NATIVE ? ["-ggdb", "-DVERBOSE"] : ["-O2", "-DNDEBUG"]].flatten()
 //ccFlags.addAll(["-Wnon-virtual-dtor", "-Woverloaded-virtual", "-std=c++0x"])
 def linkFlags = ["-shared", commonFlags].flatten()
 
--- a/buildSrc/armv6hf.gradle	Tue May 27 20:34:11 2014 -0700
+++ b/buildSrc/armv6hf.gradle	Thu May 29 14:51:49 2014 -0700
@@ -93,7 +93,7 @@
 // Specify the compilation parameters and link parameters
 def ccFlags = [
         commonFlags, "-I$JDK_HOME/include", "-I$JDK_HOME/include/$jniPlatform", "-c",
-        IS_DEBUG_NATIVE ? ["-ggdb", "-DVERBOSE"] : "-O2"].flatten()
+        IS_DEBUG_NATIVE ? ["-ggdb", "-DVERBOSE"] : ["-O2", "-DNDEBUG"]].flatten()
 //ccFlags.addAll(["-Wnon-virtual-dtor", "-Woverloaded-virtual", "-std=c++0x"])
 def linkFlags = ["-shared", commonFlags].flatten()
 
--- a/buildSrc/armv6sf.gradle	Tue May 27 20:34:11 2014 -0700
+++ b/buildSrc/armv6sf.gradle	Thu May 29 14:51:49 2014 -0700
@@ -84,7 +84,7 @@
 // Specify the compilation parameters and link parameters
 def ccFlags = [
         commonFlags, "-I$JDK_HOME/include", "-I$JDK_HOME/include/$jniPlatform", "-c",
-        IS_DEBUG_NATIVE ? ["-ggdb", "-DVERBOSE"] : "-O2"].flatten()
+        IS_DEBUG_NATIVE ? ["-ggdb", "-DVERBOSE"] : ["-O2", "-DNDEBUG"]].flatten()
 //ccFlags.addAll(["-Wnon-virtual-dtor", "-Woverloaded-virtual", "-std=c++0x"])
 def linkFlags = ["-shared", commonFlags].flatten()
 
--- a/buildSrc/armv7hf.gradle	Tue May 27 20:34:11 2014 -0700
+++ b/buildSrc/armv7hf.gradle	Thu May 29 14:51:49 2014 -0700
@@ -94,7 +94,7 @@
 // Specify the compilation parameters and link parameters
 def ccFlags = [
         commonFlags, "-I$JDK_HOME/include", "-I$JDK_HOME/include/$jniPlatform", "-c",
-        IS_DEBUG_NATIVE ? ["-ggdb", "-DVERBOSE"] : "-O2"].flatten()
+        IS_DEBUG_NATIVE ? ["-ggdb", "-DVERBOSE"] : ["-O2", "-DNDEBUG"]].flatten()
 //ccFlags.addAll(["-Wnon-virtual-dtor", "-Woverloaded-virtual", "-std=c++0x"])
 def linkFlags = ["-shared", commonFlags].flatten()
 
--- a/buildSrc/armv7sf.gradle	Tue May 27 20:34:11 2014 -0700
+++ b/buildSrc/armv7sf.gradle	Thu May 29 14:51:49 2014 -0700
@@ -84,7 +84,7 @@
 // Specify the compilation parameters and link parameters
 def ccFlags = [
         commonFlags, "-I$JDK_HOME/include", "-I$JDK_HOME/include/$jniPlatform", "-c",
-        IS_DEBUG_NATIVE ? ["-ggdb", "-DVERBOSE"] : "-O2"].flatten()
+        IS_DEBUG_NATIVE ? ["-ggdb", "-DVERBOSE"] : ["-O2", "-DNDEBUG"]].flatten()
 //ccFlags.addAll(["-Wnon-virtual-dtor", "-Woverloaded-virtual", "-std=c++0x"])
 def linkFlags = ["-shared", commonFlags].flatten()
 
--- a/buildSrc/dalvik.gradle	Tue May 27 20:34:11 2014 -0700
+++ b/buildSrc/dalvik.gradle	Thu May 29 14:51:49 2014 -0700
@@ -270,9 +270,9 @@
         }
 
 
-        addNative(project, "activity", ["dalvik"])
+        addNative(project, "activity")
         if (compileNativeText) {
-            addNative(project, "fontNativeFreetype", ["dalvik"])
+            addNative(project, "fontNativeFreetype")
         }
         tasks["javahDalvikGlass"].dependsOn(compileDalvikLibs)
         tasks["javahDalvikActivity"].dependsOn(compileDalvikLibs)
@@ -368,21 +368,9 @@
     "com/sun/glass/ui/accessible/win",    
     "com/sun/prism/j2d",
     "com/sun/prism/sw",
-    "com/sun/prism/d3d",
-    "com/sun/prism/es2/gl/win",
-    "com/sun/prism/null3d",
-    "com/sun/scenario/effect/impl/hw/d3d",
-    "com/sun/glass/events/mac",
-    "com/sun/glass/ui/mac",
     "com/sun/glass/ui/accessible/mac",
-    "com/sun/prism/es2/gl/mac",
-    "com/sun/glass/ui/gtk",
     "com/sun/glass/ui/ios",
-    "com/sun/prism/es2/gl/eglx11",
-    "com/sun/prism/es2/gl/x11",
     "com/sun/glass/ui/swt", // SWT glass
-    "javafx/embed/swing", // Swing Interop
-    "javafx/embed/swt", // SWT Interop
     "com/oracle/dalvik",
     "javafx/scene/media", //exclude all media for now
     "com/sun/media",
@@ -487,6 +475,7 @@
  "modules/graphics/build/classes/main")
 DALVIK.glass.javahClasspath = files("modules/graphics/build/classes/main",
  "modules/graphics/build/classes/dalvik",
+ "modules/base/build/classes/main",
  "$sdk/platforms/$sdk_target/android.jar")
 DALVIK.glass.javahInclude = [
     "javafxports/android/**",
--- a/buildSrc/linux.gradle	Tue May 27 20:34:11 2014 -0700
+++ b/buildSrc/linux.gradle	Thu May 29 14:51:49 2014 -0700
@@ -51,7 +51,7 @@
 // Specify the compilation parameters and link parameters
 def ccFlags = [
         commonFlags, "-I$JDK_HOME/include", "-I$JDK_HOME/include/linux", "-c",
-        IS_DEBUG_NATIVE ? ["-ggdb", "-DVERBOSE"] : "-O2"].flatten()
+        IS_DEBUG_NATIVE ? ["-ggdb", "-DVERBOSE"] : ["-O2", "-DNDEBUG"]].flatten()
 //ccFlags.addAll(["-Wnon-virtual-dtor", "-Woverloaded-virtual", "-std=c++0x"])
 def linkFlags = ["-shared", commonFlags].flatten()
 
--- a/buildSrc/win.gradle	Tue May 27 20:34:11 2014 -0700
+++ b/buildSrc/win.gradle	Thu May 29 14:51:49 2014 -0700
@@ -44,7 +44,7 @@
         "/D_STATIC_CPPLIB", "/D_DISABLE_DEPRECATE_STATIC_CPPLIB", "/DINLINE=__inline",
         "/DUNICODE", "/D_UNICODE", "/DWIN32", "/DIAL", "/D_LITTLE_ENDIAN", "/DWIN32_LEAN_AND_MEAN",
         "/I$JDK_HOME/include", "/I$JDK_HOME/include/win32",
-        IS_DEBUG_NATIVE ? ["/MDd", "/Od", "/Zi", "/DDEBUG"] : ["/O2", "/MD"]].flatten();
+        IS_DEBUG_NATIVE ? ["/MDd", "/Od", "/Zi", "/DDEBUG"] : ["/O2", "/MD", "/DNDEBUG"]].flatten();
 
 def linkFlags = ["/nologo", "/dll", "/manifest", "/opt:REF", "/incremental:no"];
 if (IS_DEBUG_NATIVE) linkFlags.add("/debug");
--- a/buildSrc/x86egl.gradle	Tue May 27 20:34:11 2014 -0700
+++ b/buildSrc/x86egl.gradle	Thu May 29 14:51:49 2014 -0700
@@ -95,6 +95,7 @@
         commonFlags,
         "-I$JDK_HOME/include", "-I$JDK_HOME/include/${jniPlatform}", "-c",
         IS_DEBUG_NATIVE ? ["-ggdb", "-DVERBOSE"] : "-O2"].flatten()
+        IS_DEBUG_NATIVE ? ["-ggdb", "-DVERBOSE"] : ["-O2", "-DNDEBUG"]].flatten()
 //ccFlags.addAll(["-Wnon-virtual-dtor", "-Woverloaded-virtual", "-std=c++0x"])
 def linkFlags = ["-shared", commonFlags].flatten()
 
--- a/modules/base/src/main/java/javafx/collections/transformation/SortedList.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/base/src/main/java/javafx/collections/transformation/SortedList.java	Thu May 29 14:51:49 2014 -0700
@@ -64,11 +64,10 @@
 
     /**
      * Creates a new SortedList wrapped around the source list.
-     * The source list will be sorted using the comparator provided. If null is provided, a natural
-     * ordering of the elements is used if possible. Otherwise, the SortedList tries to sort the elements
-     * by their toString().
+     * The source list will be sorted using the comparator provided. If null is provided, the list
+     * stays unordered and is equal to the source list.
      * @param source a list to wrap
-     * @param comparator a comparator to use or null for the unordered List
+     * @param comparator a comparator to use or null for unordered List
      */
     @SuppressWarnings("unchecked")
     public SortedList(@NamedArg("source") ObservableList<? extends E> source, @NamedArg("comparator") Comparator<? super E> comparator) {
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java	Thu May 29 14:51:49 2014 -0700
@@ -767,16 +767,16 @@
     @Override public Object accGetAttribute(Attribute attribute, Object... parameters) {
         switch (attribute) {
             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;
-          }
+                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()) {
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ListViewSkin.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ListViewSkin.java	Thu May 29 14:51:49 2014 -0700
@@ -489,6 +489,16 @@
             case FOCUS_ITEM: {
                 FocusModel<?> fm = getSkinnable().getFocusModel();
                 int focusedIndex = fm.getFocusedIndex();
+                if (focusedIndex == -1) {
+                    if (placeholderRegion != null && placeholderRegion.isVisible()) {
+                        return placeholderRegion.getChildren().get(0);
+                    }
+                    if (getItemCount() > 0) {
+                        focusedIndex = 0;
+                    } else {
+                        return null;
+                    }
+                }
                 return flow.getPrivateCell(focusedIndex);
             }
             case ROW_AT_INDEX: {
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/PaginationSkin.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/PaginationSkin.java	Thu May 29 14:51:49 2014 -0700
@@ -67,6 +67,8 @@
 import javafx.scene.shape.Rectangle;
 import javafx.util.Duration;
 
+import static com.sun.javafx.scene.control.skin.resources.ControlResources.getString;
+
 public class PaginationSkin extends BehaviorSkinBase<Pagination, PaginationBehavior>  {
 
     private static final Duration DURATION = new Duration(125.0);
@@ -736,7 +738,7 @@
                 @Override public Object accGetAttribute(Attribute attribute, Object... parameters) {
                     switch (attribute) {
                         case ROLE: return Role.BUTTON;
-                        case TITLE: return "Select previous page";
+                        case TITLE: return getString("Accessibility.title.Pagination.PreviousButton");
                         default: return super.accGetAttribute(attribute, parameters);
                     }
                 }
@@ -765,7 +767,7 @@
                 @Override public Object accGetAttribute(Attribute attribute, Object... parameters) {
                     switch (attribute) {
                         case ROLE: return Role.BUTTON;
-                        case TITLE: return "Select next page";
+                        case TITLE: return getString("Accessibility.title.Pagination.NextButton");
                         default: return super.accGetAttribute(attribute, parameters);
                     }
                 }
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ProgressBarSkin.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ProgressBarSkin.java	Thu May 29 14:51:49 2014 -0700
@@ -284,7 +284,7 @@
 
         if (!clipRegion.translateXProperty().isBound()) {
             clipRegion.translateXProperty().bind(new When(bar.scaleXProperty().isEqualTo(-1.0, 1e-100)).
-                    then(bar.translateXProperty().subtract(w).add(getIndeterminateBarLength())).
+                    then(bar.translateXProperty().subtract(w).add(indeterminateBarLengthProperty())).
                     otherwise(bar.translateXProperty().negate()));
         }
     }
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ScrollPaneSkin.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ScrollPaneSkin.java	Thu May 29 14:51:49 2014 -0700
@@ -37,6 +37,7 @@
 import javafx.beans.value.ChangeListener;
 import javafx.beans.value.ObservableValue;
 import javafx.event.EventDispatcher;
+import javafx.event.EventHandler;
 import javafx.geometry.BoundingBox;
 import javafx.geometry.Bounds;
 import javafx.geometry.Orientation;
@@ -262,6 +263,13 @@
         vsb = new ScrollBar();
         vsb.setOrientation(Orientation.VERTICAL);
 
+        EventHandler<MouseEvent> barHandler = ev -> {
+            getSkinnable().requestFocus();
+        };
+
+        hsb.addEventFilter(MouseEvent.MOUSE_PRESSED, barHandler);
+        vsb.addEventFilter(MouseEvent.MOUSE_PRESSED, barHandler);
+
         corner = new StackPane();
         corner.getStyleClass().setAll("corner");
 
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TabPaneSkin.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TabPaneSkin.java	Thu May 29 14:51:49 2014 -0700
@@ -91,6 +91,8 @@
 import com.sun.javafx.scene.traversal.Direction;
 import com.sun.javafx.scene.traversal.TraversalEngine;
 
+import static com.sun.javafx.scene.control.skin.resources.ControlResources.getString;
+
 public class TabPaneSkin extends BehaviorSkinBase<TabPane, TabPaneBehavior> {
     private static enum TabAnimation {
         NONE,
@@ -1131,7 +1133,7 @@
                 @Override public Object accGetAttribute(Attribute attribute, Object... parameters) {
                     switch (attribute) {
                         case ROLE: return Role.BUTTON;
-                        case TITLE: return "Close";
+                        case TITLE: return getString("Accessibility.title.TabPane.CloseButton");
                         default: return super.accGetAttribute(attribute, parameters);
                     }
                 }
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TableViewSkinBase.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TableViewSkinBase.java	Thu May 29 14:51:49 2014 -0700
@@ -955,6 +955,16 @@
             case FOCUS_ITEM: {
                 TableFocusModel<S,?> fm = getFocusModel();
                 int focusedIndex = fm.getFocusedIndex();
+                if (focusedIndex == -1) {
+                    if (placeholderRegion != null && placeholderRegion.isVisible()) {
+                        return placeholderRegion.getChildren().get(0);
+                    }
+                    if (getItemCount() > 0) {
+                        focusedIndex = 0;
+                    } else {
+                        return null;
+                    }
+                }
                 return flow.getPrivateCell(focusedIndex);
             }
             case CELL_AT_ROW_COLUMN: {
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TextFieldSkin.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TextFieldSkin.java	Thu May 29 14:51:49 2014 -0700
@@ -471,21 +471,41 @@
         return topInset + textNode.getBaselineOffset();
     }
 
+    /**
+     * Updates the textTranslateX value for the Text node position. This is
+     * done for general layout, but care is taken to avoid resetting the
+     * position when there's a need to scroll the text due to caret movement,
+     * or when editing text that overflows on either side.
+     */
     private void updateTextPos() {
+        double oldX = textTranslateX.get();
+        double newX;
+        double textNodeWidth = textNode.getLayoutBounds().getWidth();
+
         switch (getHAlignment()) {
           case CENTER:
             double midPoint = textRight.get() / 2;
             if (usePromptText.get()) {
-                promptNode.setLayoutX(midPoint - promptNode.getLayoutBounds().getWidth() / 2);
-                textTranslateX.set(promptNode.getLayoutX());
+                // If a prompt is shown (which implies that the text is
+                // empty), then we align the Text node so that the caret will
+                // appear at the left of the centered prompt.
+                newX = midPoint - promptNode.getLayoutBounds().getWidth() / 2;
+                promptNode.setLayoutX(newX);
             } else {
-                textTranslateX.set(midPoint - textNode.getLayoutBounds().getWidth() / 2);
+                newX = midPoint - textNodeWidth / 2;
+            }
+            // Update if there is space on the right
+            if (newX + textNodeWidth <= textRight.get()) {
+                textTranslateX.set(newX);
             }
             break;
 
           case RIGHT:
-            textTranslateX.set(textRight.get() - textNode.getLayoutBounds().getWidth() -
-                               caretWidth / 2);
+            newX = textRight.get() - textNodeWidth - caretWidth / 2;
+            // Update if there is space on the right
+            if (newX > oldX || newX > 0) {
+                textTranslateX.set(newX);
+            }
             if (usePromptText.get()) {
                 promptNode.setLayoutX(textRight.get() - promptNode.getLayoutBounds().getWidth() -
                                       caretWidth / 2);
@@ -494,9 +514,13 @@
 
           case LEFT:
           default:
-            textTranslateX.set(caretWidth / 2);
+            newX = caretWidth / 2;
+            // Update if there is space on either side.
+            if (newX < oldX || newX + textNodeWidth <= textRight.get()) {
+                textTranslateX.set(newX);
+            }
             if (usePromptText.get()) {
-                promptNode.layoutXProperty().set(caretWidth / 2);
+                promptNode.layoutXProperty().set(newX);
             }
         }
     }
@@ -579,10 +603,6 @@
         final Bounds caretBounds = caretPath.getLayoutBounds();
 
         switch (getHAlignment()) {
-          case CENTER:
-            updateTextPos();
-            break;
-
           case RIGHT:
             if (textBounds.getMaxX() > clipBounds.getMaxX()) {
                 double delta = caretMaxXOld - caretBounds.getMaxX() - textTranslateX.get();
@@ -600,6 +620,7 @@
             break;
 
           case LEFT:
+          case CENTER:
           default:
             if (textBounds.getMinX() < clipBounds.getMinX() + caretWidth / 2 &&
                 textBounds.getMaxX() <= clipBounds.getMaxX()) {
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ToolBarSkin.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ToolBarSkin.java	Thu May 29 14:51:49 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -73,6 +73,8 @@
 
 import javafx.css.Styleable;
 
+import static com.sun.javafx.scene.control.skin.resources.ControlResources.getString;
+
 public class ToolBarSkin extends BehaviorSkinBase<ToolBar, ToolBarBehavior> {
 
     private Pane box;
@@ -693,7 +695,7 @@
         @Override public Object accGetAttribute(Attribute attribute, Object... parameters) {
             switch (attribute) {
                 case ROLE: return Role.BUTTON;
-                case TITLE: return "Overflow button";
+                case TITLE: return getString("Accessibility.title.ToolBar.OverflowButton");
                 default: return super.accGetAttribute(attribute, parameters);
             }
         }
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TreeViewSkin.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TreeViewSkin.java	Thu May 29 14:51:49 2014 -0700
@@ -480,6 +480,13 @@
             case FOCUS_ITEM: {
                 FocusModel<?> fm = getSkinnable().getFocusModel();
                 int focusedIndex = fm.getFocusedIndex();
+                if (focusedIndex == -1) {
+                    if (getItemCount() > 0) {
+                        focusedIndex = 0;
+                    } else {
+                        return null;
+                    }
+                }
                 return flow.getPrivateCell(focusedIndex);
             }
             case ROW_AT_INDEX: {
--- a/modules/controls/src/main/java/javafx/scene/control/Separator.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/control/Separator.java	Thu May 29 14:51:49 2014 -0700
@@ -80,15 +80,7 @@
      * respective CENTER values.
      */
     public Separator() {
-        getStyleClass().setAll(DEFAULT_STYLE_CLASS);
-        // focusTraversable is styleable through css. Calling setFocusTraversable
-        // makes it look to css like the user set the value and css will not 
-        // override. Initializing focusTraversable by calling applyStyle with null
-        // StyleOrigin ensures that css will be able to override the value.
-        ((StyleableProperty<Boolean>)(WritableValue<Boolean>)focusTraversableProperty()).applyStyle(null, Boolean.FALSE);
-        
-        // initialize pseudo-class state
-        pseudoClassStateChanged(HORIZONTAL_PSEUDOCLASS_STATE, true);
+        this(Orientation.HORIZONTAL);
     }
 
     /**
@@ -99,8 +91,21 @@
      *      vertical or horizontal.
      */
     public Separator(Orientation orientation) {
-        this();
-        setOrientation(orientation);
+
+        getStyleClass().setAll(DEFAULT_STYLE_CLASS);
+
+        // focusTraversable is styleable through css. Calling setFocusTraversable
+        // makes it look to css like the user set the value and css will not
+        // override. Initializing focusTraversable by calling applyStyle with null
+        // StyleOrigin ensures that css will be able to override the value.
+        ((StyleableProperty<Boolean>)(WritableValue<Boolean>)focusTraversableProperty()).applyStyle(null, Boolean.FALSE);
+
+        // initialize pseudo-class state
+        pseudoClassStateChanged(HORIZONTAL_PSEUDOCLASS_STATE, orientation != Orientation.VERTICAL);
+        pseudoClassStateChanged(VERTICAL_PSEUDOCLASS_STATE, orientation == Orientation.VERTICAL);
+
+        ((StyleableProperty<Orientation>)(WritableValue<Orientation>)orientationProperty())
+                .applyStyle(null, orientation != null ? orientation : Orientation.HORIZONTAL);
     }
 
     /***************************************************************************
--- a/modules/controls/src/main/java/javafx/scene/control/TableView.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/control/TableView.java	Thu May 29 14:51:49 2014 -0700
@@ -1625,7 +1625,13 @@
                 }
                 return FXCollections.observableArrayList(selection);
             }
-            case FOCUS_ITEM:
+            case FOCUS_ITEM: {
+                Node row = (Node)super.accGetAttribute(attribute, parameters);
+                if (row == null) return null;
+                Node cell = (Node)row.accGetAttribute(attribute, parameters);
+                /* cell equals to null means the row is a placeholder node */
+                return cell != null ?  cell : row;
+            }
             case CELL_AT_ROW_COLUMN: {
                 TableRow<S> row = (TableRow<S>)super.accGetAttribute(attribute, parameters);
                 return row != null ? row.accGetAttribute(attribute, parameters) : null;
--- a/modules/controls/src/main/java/javafx/scene/control/TreeTableView.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/control/TreeTableView.java	Thu May 29 14:51:49 2014 -0700
@@ -1892,7 +1892,13 @@
                 }
                 return FXCollections.observableArrayList(selection);
             }
-            case FOCUS_ITEM:
+            case FOCUS_ITEM: {
+                Node row = (Node)super.accGetAttribute(attribute, parameters);
+                if (row == null) return null;
+                Node cell = (Node)row.accGetAttribute(attribute, parameters);
+                /* cell equals to null means the row is a placeholder node */
+                return cell != null ?  cell : row;
+            }
             case CELL_AT_ROW_COLUMN: {
                 TreeTableRow<S> row = (TreeTableRow<S>)super.accGetAttribute(attribute, parameters);
                 return row != null ? row.accGetAttribute(attribute, parameters) : null;
--- a/modules/controls/src/main/resources/com/sun/javafx/scene/control/skin/modena/modena.css	Tue May 27 20:34:11 2014 -0700
+++ b/modules/controls/src/main/resources/com/sun/javafx/scene/control/skin/modena/modena.css	Thu May 29 14:51:49 2014 -0700
@@ -1103,7 +1103,7 @@
 }
 .scroll-pane.edge-to-edge > .scroll-bar,
 .tab-pane > * > .scroll-pane > .scroll-bar,
-.titled-pane > * > * > .scroll-pane > .scroll-bar {
+.titled-pane > .content > .scroll-pane > .scroll-bar {
     -fx-background-insets: 0;
     -fx-padding: 0;
 }
@@ -1111,8 +1111,8 @@
 .scroll-pane.edge-to-edge > .scroll-bar > .decrement-button,
 .tab-pane > * > .scroll-pane > .scroll-bar > .increment-button, 
 .tab-pane > * > .scroll-pane > .scroll-bar > .decrement-button,
-.titled-pane > * > * > .scroll-pane > .scroll-bar > .increment-button,
-.titled-pane > * > * > .scroll-pane > .scroll-bar > .decrement-button {
+.titled-pane > .content > .scroll-pane > .scroll-bar > .increment-button,
+.titled-pane > .content > .scroll-pane > .scroll-bar > .decrement-button {
     -fx-padding: 0.25em; /* 3px */
 }
 
@@ -2938,27 +2938,28 @@
 .split-pane > * > .accordion > .first-titled-pane:collapsed > .title  {
     -fx-background-insets: 0,0 0 0 0, 1 1 1 1;
 }
-.titled-pane > * > * > .split-pane,
-.titled-pane > * > * > .text-area,
-.titled-pane > * > * > .html-editor,
-.titled-pane > * > * > .list-view,
-.titled-pane > * > * > .tree-view,
-.titled-pane > * > * > .table-view,
-.titled-pane > * > * > .tree-table-view,
-.titled-pane > * > * > .scroll-pane {
+.titled-pane > .content > .split-pane,
+.titled-pane > .content > .text-area,
+.titled-pane > .content > .html-editor,
+.titled-pane > .content > .list-view,
+.titled-pane > .content > .tree-view,
+.titled-pane > .content > .table-view,
+.titled-pane > .content > .tree-table-view,
+.titled-pane > .content > .scroll-pane {
     -fx-background-color: null;
     -fx-background-insets: 0, 0;
     -fx-padding: 0;
 }
-.titled-pane > * > * > AnchorPane,
-.titled-pane > * > * > BorderPane,
-.titled-pane > * > * > FlowPane,
-.titled-pane > * > * > GridPane,
-.titled-pane > * > * > HBox,
-.titled-pane > * > * > Pane,
-.titled-pane > * > * > StackPane,
-.titled-pane > * > * > TilePane,
-.titled-pane > * > * > VBox {
+
+.titled-pane > .content > AnchorPane,
+.titled-pane > .content > BorderPane,
+.titled-pane > .content > FlowPane,
+.titled-pane > .content > GridPane,
+.titled-pane > .content > HBox,
+.titled-pane > .content > Pane,
+.titled-pane > .content > StackPane,
+.titled-pane > .content > TilePane,
+.titled-pane > .content > VBox {
     -fx-padding: 0.8em;
 }
 
--- a/modules/controls/src/main/resources/com/sun/javafx/scene/control/skin/resources/controls.properties	Tue May 27 20:34:11 2014 -0700
+++ b/modules/controls/src/main/resources/com/sun/javafx/scene/control/skin/resources/controls.properties	Thu May 29 14:51:49 2014 -0700
@@ -76,3 +76,10 @@
 ColorPicker.colorName.red=Red
 ColorPicker.colorName.white=White
 ColorPicker.colorName.yellow=Yellow
+
+# Accessibility strings
+#
+Accessibility.title.Pagination.PreviousButton=Select previous page
+Accessibility.title.Pagination.NextButton=Select next page
+Accessibility.title.TabPane.CloseButton=Close
+Accessibility.title.ToolBar.OverflowButton=Overflow button
--- a/modules/fxpackager/src/main/java/com/oracle/tools/packager/mac/MacAppBundler.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/fxpackager/src/main/java/com/oracle/tools/packager/mac/MacAppBundler.java	Thu May 29 14:51:49 2014 -0700
@@ -565,9 +565,7 @@
                 //TODO parameters should provide set of values for IDEs
                 MAC_CATEGORY.validatedFetchFrom(params));
 
-        //TODO NOT THE WAY TODO THIS but good enough for first pass
-        data.put("DEPLOY_MAIN_JAR_NAME", new BundleParams(params).getMainApplicationJar());
-//        data.put("DEPLOY_MAIN_JAR_NAME", MAIN_JAR.fetchFrom(params).toString());
+        data.put("DEPLOY_MAIN_JAR_NAME", MAIN_JAR.fetchFrom(params).getIncludedFiles().iterator().next());
 
         data.put("DEPLOY_PREFERENCES_ID", PREFERENCES_ID.fetchFrom(params).toLowerCase());
 
--- a/modules/graphics/src/main/java/com/sun/glass/ui/monocle/AcceleratedScreen.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/monocle/AcceleratedScreen.java	Thu May 29 14:51:49 2014 -0700
@@ -43,26 +43,45 @@
         return 0L;
     }
 
-    public AcceleratedScreen(int[] attributes) {
+    public AcceleratedScreen(int[] attributes) throws GLException {
         initPlatformLibraries();
 
         int major[] = {0}, minor[]={0};
         eglDisplay =
                 EGL.eglGetDisplay(platformGetNativeDisplay());
-        EGL.eglInitialize(eglDisplay, major, minor);
-        EGL.eglBindAPI(EGL.EGL_OPENGL_ES_BIT);
+        if (eglDisplay == EGL.EGL_NO_DISPLAY) {
+            throw new GLException(EGL.eglGetError(), "Could not get EGL display");
+        }
+
+        if (!EGL.eglInitialize(eglDisplay, major, minor)) {
+            throw new GLException(EGL.eglGetError(), "Error initializing EGL");
+        }
+
+        if (!EGL.eglBindAPI(EGL.EGL_OPENGL_ES_API)) {
+            throw new GLException(EGL.eglGetError(), "Error binding OPENGL API");
+        }
 
         long eglConfigs[] = {0};
         int configCount[] = {0};
 
-        EGL.eglChooseConfig(eglDisplay, attributes, eglConfigs, 1, configCount);
+        if (!EGL.eglChooseConfig(eglDisplay, attributes, eglConfigs,
+                                 1, configCount)) {
+            throw new GLException(EGL.eglGetError(), "Error choosing EGL config");
+        }
+
         eglSurface =
                 EGL.eglCreateWindowSurface(eglDisplay, eglConfigs[0],
                         platformGetNativeWindow(), null);
+        if (eglSurface == EGL.EGL_NO_SURFACE) {
+            throw new GLException(EGL.eglGetError(), "Could not get EGL surface");
+        }
 
         int emptyAttrArray [] = {};
         eglContext = EGL.eglCreateContext(eglDisplay, eglConfigs[0],
                 0, emptyAttrArray);
+        if (eglContext == EGL.EGL_NO_CONTEXT) {
+            throw new GLException(EGL.eglGetError(), "Could not get EGL context");
+        }
     }
 
     public void enableRendering(boolean flag) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/monocle/GLException.java	Thu May 29 14:51:49 2014 -0700
@@ -0,0 +1,34 @@
+/*
+ * 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.glass.ui.monocle;
+
+public class GLException extends Exception {
+
+    public GLException(int errorCode, String message) {
+        super("0x" + Integer.toHexString(errorCode) + ": " + message);
+    }
+
+}
--- a/modules/graphics/src/main/java/com/sun/glass/ui/monocle/NativePlatform.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/monocle/NativePlatform.java	Thu May 29 14:51:49 2014 -0700
@@ -80,7 +80,8 @@
         return screen;
     }
 
-    public synchronized AcceleratedScreen getAcceleratedScreen(int[] attributes) {
+    public synchronized AcceleratedScreen getAcceleratedScreen(int[] attributes)
+            throws GLException {
         if (accScreen == null) {
             accScreen = new AcceleratedScreen(attributes);
         }
--- a/modules/graphics/src/main/java/com/sun/glass/ui/monocle/dispman/DispmanAcceleratedScreen.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/monocle/dispman/DispmanAcceleratedScreen.java	Thu May 29 14:51:49 2014 -0700
@@ -26,12 +26,11 @@
 package com.sun.glass.ui.monocle.dispman;
 
 import com.sun.glass.ui.monocle.AcceleratedScreen;
-import com.sun.glass.ui.monocle.EGL;
-import com.sun.glass.ui.monocle.linux.LinuxSystem;
+import com.sun.glass.ui.monocle.GLException;
 
 public class DispmanAcceleratedScreen extends AcceleratedScreen {
 
-    public DispmanAcceleratedScreen(int[] attributes) {
+    public DispmanAcceleratedScreen(int[] attributes) throws GLException {
         super(attributes);
     }
 
--- a/modules/graphics/src/main/java/com/sun/glass/ui/monocle/dispman/DispmanPlatform.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/monocle/dispman/DispmanPlatform.java	Thu May 29 14:51:49 2014 -0700
@@ -24,6 +24,7 @@
  */
 
 import com.sun.glass.ui.monocle.AcceleratedScreen;
+import com.sun.glass.ui.monocle.GLException;
 import com.sun.glass.ui.monocle.NativeCursor;
 import com.sun.glass.ui.monocle.NativeScreen;
 import com.sun.glass.ui.monocle.linux.LinuxPlatform;
@@ -40,7 +41,8 @@
         return new DispmanScreen();
     }
 
-    @Override    public synchronized AcceleratedScreen getAcceleratedScreen(int[] attributes) {
+    @Override public synchronized AcceleratedScreen getAcceleratedScreen(int[] attributes)
+            throws GLException{
         if (accScreen == null) {
             accScreen = new DispmanAcceleratedScreen(attributes);
         }
--- a/modules/graphics/src/main/java/com/sun/glass/ui/monocle/linux/LinuxSystem.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/monocle/linux/LinuxSystem.java	Thu May 29 14:51:49 2014 -0700
@@ -159,12 +159,17 @@
     // mman.h
     public static final long PROT_READ = 0x1l;
     public static final long PROT_WRITE = 0x2l;
+    public static final long MAP_PRIVATE = 0x02l;
+    public static final long MAP_ANONYMOUS = 0x20l;
     public static final long MAP_SHARED = 0x1l;
     public static final long MAP_FAILED = 0xffffffffl;
     public native long mmap(long addr, long length, long prot, long flags,
                             long fd, long offset);
     public native int munmap(long addr, long length);
 
+    // string.h
+    public native long memcpy(long destAddr, long srcAddr, long length);
+
     public String getErrorMessage() {
         return strerror(errno());
     }
--- a/modules/graphics/src/main/java/com/sun/glass/ui/monocle/mx6/MX6AcceleratedScreen.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/monocle/mx6/MX6AcceleratedScreen.java	Thu May 29 14:51:49 2014 -0700
@@ -26,7 +26,7 @@
 package com.sun.glass.ui.monocle.mx6;
 
 import com.sun.glass.ui.monocle.AcceleratedScreen;
-import com.sun.glass.ui.monocle.linux.LinuxSystem;
+import com.sun.glass.ui.monocle.GLException;
 
 public class MX6AcceleratedScreen extends AcceleratedScreen {
 
@@ -38,7 +38,7 @@
 
     private native long _platformGetNativeDisplay(long methodHandle);
 
-    public MX6AcceleratedScreen(int[] attributes) {
+    public MX6AcceleratedScreen(int[] attributes) throws GLException {
         super(attributes);
     }
 
--- a/modules/graphics/src/main/java/com/sun/glass/ui/monocle/mx6/MX6Platform.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/monocle/mx6/MX6Platform.java	Thu May 29 14:51:49 2014 -0700
@@ -26,6 +26,7 @@
 package com.sun.glass.ui.monocle.mx6;
 
 import com.sun.glass.ui.monocle.AcceleratedScreen;
+import com.sun.glass.ui.monocle.GLException;
 import com.sun.glass.ui.monocle.NativeCursor;
 import com.sun.glass.ui.monocle.linux.LinuxPlatform;
 
@@ -37,7 +38,8 @@
     }
 
     @Override
-    public synchronized AcceleratedScreen getAcceleratedScreen(int[] attributes) {
+    public synchronized AcceleratedScreen getAcceleratedScreen(int[] attributes)
+            throws GLException {
         if (accScreen == null) {
             accScreen = new MX6AcceleratedScreen(attributes);
         }
--- a/modules/graphics/src/main/java/com/sun/glass/ui/monocle/omapx11/OMAPX11Platform.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/monocle/omapx11/OMAPX11Platform.java	Thu May 29 14:51:49 2014 -0700
@@ -24,6 +24,7 @@
  */
 
 import com.sun.glass.ui.monocle.AcceleratedScreen;
+import com.sun.glass.ui.monocle.GLException;
 import com.sun.glass.ui.monocle.NativeScreen;
 import com.sun.glass.ui.monocle.omap.OMAPPlatform;
 import com.sun.glass.ui.monocle.x11.X11AcceleratedScreen;
@@ -38,7 +39,7 @@
 
     @Override
     public synchronized AcceleratedScreen getAcceleratedScreen(
-            int[] attributes) {
+            int[] attributes) throws GLException {
         if (accScreen == null) {
             accScreen = new X11AcceleratedScreen(attributes);
         }
--- a/modules/graphics/src/main/java/com/sun/glass/ui/monocle/x11/X.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/monocle/x11/X.java	Thu May 29 14:51:49 2014 -0700
@@ -113,6 +113,13 @@
         static native void setDataLong(long p, int index, long element);
     }
 
+    static class XDisplay extends C.Structure {
+        XDisplay(long p) {
+            super(p);
+        }
+        public native int sizeof();
+    }
+
     static native long XOpenDisplay(String displayName);
     static native long DefaultScreenOfDisplay(long display);
     static native long RootWindowOfScreen(long screen);
--- a/modules/graphics/src/main/java/com/sun/glass/ui/monocle/x11/X11AcceleratedScreen.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/monocle/x11/X11AcceleratedScreen.java	Thu May 29 14:51:49 2014 -0700
@@ -1,4 +1,4 @@
-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.
  *
@@ -23,16 +23,50 @@
  * questions.
  */
 
+package com.sun.glass.ui.monocle.x11;
+
 import com.sun.glass.ui.monocle.AcceleratedScreen;
+import com.sun.glass.ui.monocle.GLException;
 import com.sun.glass.ui.monocle.NativePlatformFactory;
+import com.sun.glass.ui.monocle.linux.LinuxSystem;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 
 public class X11AcceleratedScreen extends AcceleratedScreen {
+    private X.XDisplay nativeDisplay;
 
-    public X11AcceleratedScreen(int[] attributes) {
+    public X11AcceleratedScreen(int[] attributes) throws GLException {
         super(attributes);
     }
 
     @Override
+    protected long platformGetNativeDisplay() {
+        if (nativeDisplay == null) {
+            boolean doMaliWorkaround =
+                    AccessController.doPrivileged(
+                            (PrivilegedAction<Boolean>) () ->
+                                    Boolean.getBoolean(
+                                            "monocle.maliSignedStruct"));
+            X.XDisplay display = new X.XDisplay(X.XOpenDisplay(null));
+            if (doMaliWorkaround) {
+                long address = 0x7000000;
+                nativeDisplay = new X.XDisplay(
+                        ls.mmap(address, display.sizeof(),
+                                LinuxSystem.PROT_READ | LinuxSystem.PROT_WRITE,
+                                LinuxSystem.MAP_PRIVATE
+                                        | LinuxSystem.MAP_ANONYMOUS,
+                                -1, 0)
+                );
+                ls.memcpy(nativeDisplay.p, display.p, display.sizeof());
+            } else {
+                nativeDisplay = display;
+            }
+        }
+        return nativeDisplay.p;
+    }
+
+    @Override
     protected long platformGetNativeWindow() {
         return NativePlatformFactory.getNativePlatform()
                 .getScreen().getNativeHandle();
--- a/modules/graphics/src/main/java/com/sun/glass/ui/monocle/x11/X11Platform.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/monocle/x11/X11Platform.java	Thu May 29 14:51:49 2014 -0700
@@ -24,6 +24,7 @@
  */
 
 import com.sun.glass.ui.monocle.AcceleratedScreen;
+import com.sun.glass.ui.monocle.GLException;
 import com.sun.glass.ui.monocle.NativeCursor;
 import com.sun.glass.ui.monocle.NativePlatform;
 import com.sun.glass.ui.monocle.NativeScreen;
@@ -67,7 +68,7 @@
 
     @Override
     public synchronized AcceleratedScreen getAcceleratedScreen(
-            int[] attributes) {
+            int[] attributes) throws GLException {
         if (accScreen == null) {
             accScreen = new X11AcceleratedScreen(attributes);
         }
--- a/modules/graphics/src/main/java/com/sun/javafx/css/SimpleSelector.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/javafx/css/SimpleSelector.java	Thu May 29 14:51:49 2014 -0700
@@ -369,12 +369,19 @@
             os.writeShort(stringStore.addString(sc.getStyleClassName()));
         }
         os.writeShort(stringStore.addString(id));
-        os.writeShort(pseudoClassState.size());
+        int pclassSize = pseudoClassState.size()
+                + (nodeOrientation == RIGHT_TO_LEFT || nodeOrientation == LEFT_TO_RIGHT ? 1 : 0);
+        os.writeShort(pclassSize);
         Iterator<PseudoClass> iter2 = pseudoClassState.iterator();
         while(iter2.hasNext()) {
             final PseudoClass pc = iter2.next();
             os.writeShort(stringStore.addString(pc.getPseudoClassName()));
         }
+        if (nodeOrientation == RIGHT_TO_LEFT) {
+            os.writeShort(stringStore.addString("dir(rtl)"));
+        } else if (nodeOrientation == LEFT_TO_RIGHT) {
+            os.writeShort(stringStore.addString("dir(ltr)"));
+        }
     }
 
     static SimpleSelector readBinary(int bssVersion, final DataInputStream is, final String[] strings)
--- a/modules/graphics/src/main/java/com/sun/javafx/font/coretext/CTGlyphLayout.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/javafx/font/coretext/CTGlyphLayout.java	Thu May 29 14:51:49 2014 -0700
@@ -35,7 +35,7 @@
 
 class CTGlyphLayout extends GlyphLayout {
 
-    private long createCTLine(long fontRef, char[] chars,
+    private long createCTLine(long fontRef, char[] chars, boolean rtl,
                               int start, int length) {
         /* Use CoreText to analize the run */
         long alloc = OS.kCFAllocatorDefault();
@@ -47,6 +47,13 @@
                                   OS.kCFTypeDictionaryValueCallBacks());
             if (attributes != 0) {
                 OS.CFDictionaryAddValue(attributes, OS.kCTFontAttributeName(), fontRef);
+                if (rtl) {
+                    long paragraphStyleRef = OS.CTParagraphStyleCreate(OS.kCTWritingDirectionRightToLeft);
+                    if (paragraphStyleRef != 0) {
+                        OS.CFDictionaryAddValue(attributes, OS.kCTParagraphStyleAttributeName(), paragraphStyleRef);
+                        OS.CFRelease(paragraphStyleRef);
+                    }
+                }
                 /* Note that by default CoreText will apply kerning depending on the font*/
                 long attString = OS.CFAttributedStringCreate(alloc, textRef, attributes);
                 if (attString != 0) {
@@ -93,7 +100,8 @@
         String fontName = strike.getFontResource().getFullName();
         long fontRef = ((CTFontStrike)strike).getFontRef();
         if (fontRef == 0) return;
-        long lineRef = createCTLine(fontRef, text, run.getStart(), run.getLength());
+        boolean rtl = (run.getLevel() & 1) != 0;
+        long lineRef = createCTLine(fontRef, text, rtl, run.getStart(), run.getLength());
         if (lineRef == 0) return;
         long runs = OS.CTLineGetGlyphRuns(lineRef);
         if (runs != 0) {
--- a/modules/graphics/src/main/java/com/sun/javafx/font/coretext/OS.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/javafx/font/coretext/OS.java	Thu May 29 14:51:49 2014 -0700
@@ -48,6 +48,7 @@
     static final int kCGBitmapByteOrder32Host = ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN ? kCGBitmapByteOrder32Little : kCGBitmapByteOrder32Big;
     static final int kCGImageAlphaPremultipliedFirst = 2;
     static final int kCGImageAlphaNone = 0;
+    static final int kCTWritingDirectionRightToLeft = 1;
 
     static final long CFStringCreate(String string) {
         char[] buffer = string.toCharArray();
@@ -74,6 +75,7 @@
     static final native long kCFTypeDictionaryKeyCallBacks();
     static final native long kCFTypeDictionaryValueCallBacks();
     static final native long kCTFontAttributeName();
+    static final native long kCTParagraphStyleAttributeName();
     static final native long CFArrayGetCount(long theArray);
     static final native long CFArrayGetValueAtIndex(long theArray, long idx);
     static final native long CFAttributedStringCreate(long alloc, long str, long attributes);
@@ -105,5 +107,6 @@
     static final native double CTLineGetTypographicBounds(long line);
     static final native long CTRunGetGlyphCount(long run);
     static final native long CTRunGetAttributes(long run);
+    static final native long CTParagraphStyleCreate(int dir);
 
 }
--- a/modules/graphics/src/main/java/com/sun/javafx/font/freetype/OSPango.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/javafx/font/freetype/OSPango.java	Thu May 29 14:51:49 2014 -0700
@@ -54,7 +54,9 @@
     static final int PANGO_STYLE_OBLIQUE = 0x1;
     static final int PANGO_WEIGHT_BOLD = 0x2bc;
     static final int PANGO_WEIGHT_NORMAL = 0x190;
+    static final int PANGO_DIRECTION_RTL = 1;
 
+    static final native void pango_context_set_base_dir(long context, int direction);
     static final native long pango_ft2_font_map_new();
     static final native long pango_font_map_create_context(long fontmap);
     static final native long pango_font_describe(long font);
--- a/modules/graphics/src/main/java/com/sun/javafx/font/freetype/PangoGlyphLayout.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/javafx/font/freetype/PangoGlyphLayout.java	Thu May 29 14:51:49 2014 -0700
@@ -93,6 +93,10 @@
         if (check(context, "Failed allocating PangoContext.", fontmap, 0, 0, 0)) {
             return;
         }
+        boolean rtl = (run.getLevel() & 1) != 0;
+        if (rtl) {
+            OSPango.pango_context_set_base_dir(context, OSPango.PANGO_DIRECTION_RTL);
+        }
         float size = font.getSize();
         int style = fr.isItalic() ? OSPango.PANGO_STYLE_ITALIC : OSPango.PANGO_STYLE_NORMAL;
         int weight = fr.isBold() ? OSPango.PANGO_WEIGHT_BOLD : OSPango.PANGO_WEIGHT_NORMAL;
@@ -144,7 +148,6 @@
             }
             OSPango.g_list_free(runs);
 
-            boolean rtl = (run.getLevel() & 1) != 0;
             int glyphCount = 0;
             for (PangoGlyphString g : pangoGlyphs) {
                 if (g != null) {
--- a/modules/graphics/src/main/java/com/sun/javafx/sg/prism/NGCanvas.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/javafx/sg/prism/NGCanvas.java	Thu May 29 14:51:49 2014 -0700
@@ -1276,49 +1276,50 @@
                     case BASE_MIDDLE: yAlign = layoutHeight / 2; break;
                     case BASE_BOTTOM: yAlign = layoutHeight; break;
                 }
-                if (bounds != null) {
-                    TEMP_TX.setTransform(transform);
-                    if (maxWidth > 0.0 && layoutWidth > maxWidth) {
-                        float sx = maxWidth / layoutWidth;
-                        TEMP_TX.translate(x - xAlign * sx, y - yAlign);
-                        TEMP_TX.scale(sx, 1);
+                float scaleX = 1;
+                float layoutX = 0;
+                float layoutY = y - yAlign;
+                if (maxWidth > 0.0 && layoutWidth > maxWidth) {
+                    float sx = maxWidth / layoutWidth;
+                    if (rtl) {
+                        layoutX = -((x + maxWidth) / sx - xAlign);
+                        scaleX = -sx;
                     } else {
-                        TEMP_TX.translate(x - xAlign, y - yAlign);
+                        layoutX = x / sx - xAlign;
+                        scaleX = sx;
                     }
-                    textLayout.getBounds(null, bounds);
-                    TEMP_TX.transform(bounds, bounds);
-                    if (token == STROKE_TEXT) {
-                        int flag = PrismTextLayout.TYPE_TEXT;
-                        Shape textShape = textLayout.getShape(flag, null);
-                        RectBounds shapeBounds = new RectBounds();
-                        strokebounds(getStroke(), textShape, shapeBounds, TEMP_TX);
-                        bounds.unionWith(shapeBounds);
+                } else {
+                    if (rtl) {
+                        layoutX = -(x - xAlign + layoutWidth);
+                        scaleX = -1;
+                    } else {
+                        layoutX = x - xAlign;
                     }
                 }
+                if (bounds != null) {
+                    computeTextLayoutBounds(bounds, transform, scaleX, layoutX, layoutY, token);
+                }
                 if (gr != null) {
-                    if (maxWidth > 0.0 && layoutWidth > maxWidth) {
-                        float sx = maxWidth / layoutWidth;
-                        if (rtl) {
-                            x += maxWidth;
-                            gr.translate(x - xAlign * sx, y - yAlign);
-                            gr.scale(-sx, 1);
-                        } else {
-                            gr.translate(x - xAlign * sx, y - yAlign);
-                            gr.scale(sx, 1);
-                        }
-                        ngtext.setLayoutLocation(0, 0);
-                    } else {
-                        if (rtl) {
-                            x = -(x + layoutWidth);
-                            xAlign = -xAlign;
-                            gr.scale(-1, 1);
-                        }
-                        ngtext.setLayoutLocation(xAlign - x, yAlign - y);
+                    if (scaleX != 1) {
+                        gr.scale(scaleX, 1);
                     }
+                    ngtext.setLayoutLocation(-layoutX, -layoutY);
                     if (token == FILL_TEXT) {
                         ngtext.setMode(NGShape.Mode.FILL);
                         ngtext.setFillPaint(fillPaint);
+                        if (fillPaint.isProportional()) {
+                            RectBounds textBounds = new RectBounds();
+                            computeTextLayoutBounds(textBounds, BaseTransform.IDENTITY_TRANSFORM,
+                                                    1, layoutX, layoutY, token);
+                            ngtext.setContentBounds(textBounds);
+                        }
                     } else {
+                        if (strokePaint.isProportional()) {
+                            RectBounds textBounds = new RectBounds();
+                            computeTextLayoutBounds(textBounds, BaseTransform.IDENTITY_TRANSFORM,
+                                                    1, layoutX, layoutY, token);
+                            ngtext.setContentBounds(textBounds);
+                        }
                         ngtext.setMode(NGShape.Mode.STROKE);
                         ngtext.setDrawStroke(getStroke());
                         ngtext.setDrawPaint(strokePaint);
@@ -1349,6 +1350,24 @@
         }
     }
 
+    void computeTextLayoutBounds(RectBounds bounds, BaseTransform transform,
+                                 float scaleX, float layoutX, float layoutY,
+                                 int token)
+    {
+        textLayout.getBounds(null, bounds);
+        TEMP_TX.setTransform(transform);
+        TEMP_TX.scale(scaleX, 1);
+        TEMP_TX.translate(layoutX, layoutY);
+        TEMP_TX.transform(bounds, bounds);
+        if (token == STROKE_TEXT) {
+            int flag = PrismTextLayout.TYPE_TEXT;
+            Shape textShape = textLayout.getShape(flag, null);
+            RectBounds shapeBounds = new RectBounds();
+            strokebounds(getStroke(), textShape, shapeBounds, TEMP_TX);
+            bounds.unionWith(shapeBounds);
+        }
+    }
+
     static void txBounds(RectBounds bounds, BaseTransform transform) {
         switch (transform.getType()) {
             case BaseTransform.TYPE_IDENTITY:
--- a/modules/graphics/src/main/java/com/sun/javafx/sg/prism/NGRegion.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/javafx/sg/prism/NGRegion.java	Thu May 29 14:51:49 2014 -0700
@@ -1509,6 +1509,19 @@
         BasicStroke bs;
         if (sb == BorderStrokeStyle.NONE) {
             throw new AssertionError("Should never have been asked to draw a border with NONE");
+        } else if (strokeWidth <= 0) {
+            // The stroke essentially disappears in this case, but some of the
+            // dashing calculations below can produce degenerate dash arrays
+            // that are problematic when the strokeWidth is 0.
+
+            // Ideally the calling code would not even be trying to perform a
+            // stroke under these conditions, but there are so many unchecked
+            // calls to createStroke() in the code that pass the result directly
+            // to a Graphics and then use it, that we need to return something
+            // valid, even if it represents a NOP.
+
+            bs = new BasicStroke((float) strokeWidth, cap, join,
+                    (float) sb.getMiterLimit());
         } else if (sb.getDashArray().size() > 0) {
             List<Double> dashArray = sb.getDashArray();
             double[] array;
--- a/modules/graphics/src/main/java/com/sun/prism/es2/MonocleGLFactory.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/prism/es2/MonocleGLFactory.java	Thu May 29 14:51:49 2014 -0700
@@ -25,6 +25,7 @@
 
 package com.sun.prism.es2;
 
+import com.sun.glass.ui.monocle.GLException;
 import com.sun.glass.ui.monocle.NativePlatformFactory;
 import com.sun.prism.es2.GLPixelFormat.Attributes;
 import java.util.HashMap;
@@ -103,20 +104,27 @@
         attrArr[GLPixelFormat.Attributes.DOUBLEBUFFER] = attrs.isDoubleBuffer() ? 1 : 0;
         attrArr[GLPixelFormat.Attributes.ONSCREEN] = attrs.isOnScreen() ? 1 : 0;
 
-        accScreen = NativePlatformFactory.getNativePlatform().getAcceleratedScreen(attrArr);
+        try {
+            accScreen = NativePlatformFactory.getNativePlatform().getAcceleratedScreen(
 
-        accScreen.enableRendering(true);
+                    attrArr);
 
-        nativeCtxInfo = nPopulateNativeCtxInfo(accScreen.getGLHandle());
+            accScreen.enableRendering(true);
 
-        accScreen.enableRendering(false);
+            nativeCtxInfo = nPopulateNativeCtxInfo(accScreen.getGLHandle());
 
-        if (nativeCtxInfo == 0) {
-            // current pipe doesn't support this pixelFormat request
+            accScreen.enableRendering(false);
+
+            if (nativeCtxInfo == 0) {
+                // current pipe doesn't support this pixelFormat request
+                return false;
+            } else {
+                gl2 = nGetIsGL2(nativeCtxInfo);
+                return true;
+            }
+        } catch (GLException e) {
+            e.printStackTrace();
             return false;
-        } else {
-            gl2 = nGetIsGL2(nativeCtxInfo);
-            return true;
         }
     }
 
--- a/modules/graphics/src/main/java/javafx/scene/CssStyleHelper.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/main/java/javafx/scene/CssStyleHelper.java	Thu May 29 14:51:49 2014 -0700
@@ -129,6 +129,7 @@
                 node.styleHelper.cacheContainer.fontSizeCache.clear();
             }
             node.styleHelper.cacheContainer.forceSlowpath = true;
+            updateParentTriggerStates(node, depth, triggerStates);
             return node.styleHelper;
 
         }
@@ -168,9 +169,23 @@
         final CssStyleHelper helper = new CssStyleHelper();
         helper.triggerStates.addAll(triggerStates[0]);
 
+        updateParentTriggerStates(node, depth, triggerStates);
+
+        helper.cacheContainer = new CacheContainer(node, styleMap, depth);
+
+        // If this node had a style helper, then reset properties to their initial value
+        // since the style map might now be different
+        if (node.styleHelper != null) {
+            node.styleHelper.resetToInitialValues(node);
+        }
+
+        return helper;
+    }
+
+    private static void updateParentTriggerStates(Styleable styleable, int depth, PseudoClassState[] triggerStates) {
         // make sure parent's transition states include the pseudo-classes
         // found when matching selectors
-        parent = node.getStyleableParent();
+        Styleable parent = styleable.getStyleableParent();
         for(int n=1; n<depth; n++) {
 
             // TODO: this means that a style like .menu-item:hover won't work. Need to separate CssStyleHelper tree from scene-graph tree
@@ -197,17 +212,7 @@
             parent=parent.getStyleableParent();
         }
 
-        helper.cacheContainer = new CacheContainer(node, styleMap, depth);
-
-        // If this node had a style helper, then reset properties to their initial value
-        // since the style map might now be different
-        if (node.styleHelper != null) {
-            node.styleHelper.resetToInitialValues(node);
-        }
-
-        return helper;
     }
-
     //
     // return true if the fontStyleableProperty's origin is USER
     //
--- a/modules/graphics/src/main/java/javafx/scene/Node.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/main/java/javafx/scene/Node.java	Thu May 29 14:51:49 2014 -0700
@@ -8896,6 +8896,7 @@
      *    stage.show();
      * }
      * </code></pre>
+     * @since JavaFX 8.0
      */
     public final void applyCss() {
 
--- a/modules/graphics/src/main/java/javafx/scene/accessibility/Attribute.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/main/java/javafx/scene/accessibility/Attribute.java	Thu May 29 14:51:49 2014 -0700
@@ -403,6 +403,7 @@
     /**
      * The text of the Tooltip associated with a given node, although for now this
      * is only supported on Control subclasses.
+     * Type: String
      */
     TOOLTIP("Tooltip", String.class),
 
@@ -411,13 +412,16 @@
      * index, relative to the tree item that this is called on. If this is called
      * on a container (e.g. TreeView or TreeTableView), it will be called on the
      * root tree item.
+     * Parameter: Integer
+     * Type: Node
      */
     TREE_ITEM_AT_INDEX("TreeItemAtIndex", Node.class),
 
     /**
-     * Returns the number of tree items that are expanded descendents of the current
+     * Returns the number of tree items that are expanded descendants of the current
      * tree item. If requested on a container (e.g. TreeView or TreeTableView),
      * this will return the count from the root tree item.
+     * Type: Node
      */
     TREE_ITEM_COUNT("TreeItemCount", Integer.class),
 
@@ -425,6 +429,7 @@
      * Returns the parent of a Role.TREE_ITEM (as another Role.TREE_ITEM, or if
      * there is no parent (e.g. it is the root node)), then return the parent
      * node whatever it is (most probably Role.TREE_VIEW or Role.TREE_TABLE_VIEW)
+     * Type: Node
      */
     TREE_ITEM_PARENT("TreeItemParent", Node.class),
 
--- a/modules/graphics/src/main/java/javafx/scene/layout/GridPane.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/main/java/javafx/scene/layout/GridPane.java	Thu May 29 14:51:49 2014 -0700
@@ -1205,39 +1205,59 @@
 
     @Override protected double computeMinWidth(double height) {
         computeGridMetrics();
-        final double[] heights = height == -1 ? null : computeHeightsToFit(height).asArray();
+        performingLayout = true;
+        try {
+            final double[] heights = height == -1 ? null : computeHeightsToFit(height).asArray();
 
-        return snapSpace(getInsets().getLeft()) +
-               computeMinWidths(heights).computeTotalWithMultiSize() +
-               snapSpace(getInsets().getRight());
+            return snapSpace(getInsets().getLeft()) +
+                    computeMinWidths(heights).computeTotalWithMultiSize() +
+                    snapSpace(getInsets().getRight());
+        } finally {
+            performingLayout = false;
+        }
 
     }
 
     @Override protected double computeMinHeight(double width) {
         computeGridMetrics();
-        final double[] widths = width == -1 ? null : computeWidthsToFit(width).asArray();
+        performingLayout = true;
+        try {
+            final double[] widths = width == -1 ? null : computeWidthsToFit(width).asArray();
 
-        return snapSpace(getInsets().getTop()) +
-               computeMinHeights(widths).computeTotalWithMultiSize() +
-               snapSpace(getInsets().getBottom());
+            return snapSpace(getInsets().getTop()) +
+                    computeMinHeights(widths).computeTotalWithMultiSize() +
+                    snapSpace(getInsets().getBottom());
+        } finally {
+            performingLayout = false;
+        }
     }
 
     @Override protected double computePrefWidth(double height) {
         computeGridMetrics();
-        final double[] heights = height == -1 ? null : computeHeightsToFit(height).asArray();
+        performingLayout = true;
+        try {
+            final double[] heights = height == -1 ? null : computeHeightsToFit(height).asArray();
 
-        return snapSpace(getInsets().getLeft()) +
-               computePrefWidths(heights).computeTotalWithMultiSize() +
-               snapSpace(getInsets().getRight());
+            return snapSpace(getInsets().getLeft()) +
+                    computePrefWidths(heights).computeTotalWithMultiSize() +
+                    snapSpace(getInsets().getRight());
+        } finally {
+            performingLayout = false;
+        }
     }
 
     @Override protected double computePrefHeight(double width) {
         computeGridMetrics();
-        final double[] widths = width == -1 ? null : computeWidthsToFit(width).asArray();
+        performingLayout = true;
+        try {
+            final double[] widths = width == -1 ? null : computeWidthsToFit(width).asArray();
 
-        return snapSpace(getInsets().getTop()) +
-               computePrefHeights(widths).computeTotalWithMultiSize() +
-               snapSpace(getInsets().getBottom());
+            return snapSpace(getInsets().getTop()) +
+                    computePrefHeights(widths).computeTotalWithMultiSize() +
+                    snapSpace(getInsets().getBottom());
+        } finally {
+            performingLayout = false;
+        }
     }
 
     private VPos getRowValignment(int rowIndex) {
@@ -1647,135 +1667,139 @@
 
     @Override protected void layoutChildren() {
         performingLayout = true;
-        final double snaphgap = snapSpace(getHgap());
-        final double snapvgap = snapSpace(getVgap());
-        final double top = snapSpace(getInsets().getTop());
-        final double bottom = snapSpace(getInsets().getBottom());
-        final double left = snapSpace(getInsets().getLeft());
-        final double right = snapSpace(getInsets().getRight());
+        try {
+            final double snaphgap = snapSpace(getHgap());
+            final double snapvgap = snapSpace(getVgap());
+            final double top = snapSpace(getInsets().getTop());
+            final double bottom = snapSpace(getInsets().getBottom());
+            final double left = snapSpace(getInsets().getLeft());
+            final double right = snapSpace(getInsets().getRight());
 
-        final double width = getWidth();
-        final double height = getHeight();
-        final double contentHeight = height - top - bottom;
-        final double contentWidth = width - left - right;
-        double columnTotal;
-        double rowTotal;
-        computeGridMetrics();
+            final double width = getWidth();
+            final double height = getHeight();
+            final double contentHeight = height - top - bottom;
+            final double contentWidth = width - left - right;
+            double columnTotal;
+            double rowTotal;
+            computeGridMetrics();
 
-        Orientation contentBias = getContentBias();
-        CompositeSize heights;
-        final CompositeSize widths;
-        if (contentBias == null) {
-            heights = (CompositeSize) computePrefHeights(null).clone();
-            widths = (CompositeSize) computePrefWidths(null).clone();
-            rowTotal = adjustRowHeights(heights, height);
-            columnTotal = adjustColumnWidths(widths, width);
-        } else if (contentBias == Orientation.HORIZONTAL) {
-            widths = (CompositeSize) computePrefWidths(null).clone();
-            columnTotal = adjustColumnWidths(widths, width);
-            heights = computePrefHeights(widths.asArray());
-            rowTotal = adjustRowHeights(heights, height);
-        } else {
-            heights = (CompositeSize) computePrefHeights(null).clone();
-            rowTotal = adjustRowHeights(heights, height);
-            widths = computePrefWidths(heights.asArray());
-            columnTotal = adjustColumnWidths(widths, width);
-        }
-
-        final double x = left + computeXOffset(contentWidth, columnTotal, getAlignmentInternal().getHpos());
-        final double y = top + computeYOffset(contentHeight, rowTotal, getAlignmentInternal().getVpos());
-        final List<Node> managed = getManagedChildren();
-
-        double[] baselineOffsets = createDoubleArray(numRows, -1);
-
-        for (int i = 0, size = managed.size(); i < size; i++) {
-            final Node child = managed.get(i);
-            final int rowIndex = getNodeRowIndex(child);
-            int columnIndex = getNodeColumnIndex(child);
-            int colspan = getNodeColumnSpan(child);
-            if (colspan == REMAINING) {
-                colspan = widths.getLength() - columnIndex;
-            }
-            int rowspan = getNodeRowSpan(child);
-            if (rowspan == REMAINING) {
-                rowspan = heights.getLength() - rowIndex;
-            }
-            double areaX = x;
-            for (int j = 0; j < columnIndex; j++) {
-                areaX += widths.getSize(j) + snaphgap;
-            }
-            double areaY = y;
-            for (int j = 0; j < rowIndex; j++) {
-                areaY += heights.getSize(j) + snapvgap;
-            }
-            double areaW = widths.getSize(columnIndex);
-            for (int j = 2; j <= colspan; j++) {
-                areaW += widths.getSize(columnIndex+j-1) + snaphgap;
-            }
-            double areaH = heights.getSize(rowIndex);
-            for (int j = 2; j <= rowspan; j++) {
-                areaH += heights.getSize(rowIndex+j-1) + snapvgap;
+            Orientation contentBias = getContentBias();
+            CompositeSize heights;
+            final CompositeSize widths;
+            if (contentBias == null) {
+                heights = (CompositeSize) computePrefHeights(null).clone();
+                widths = (CompositeSize) computePrefWidths(null).clone();
+                rowTotal = adjustRowHeights(heights, height);
+                columnTotal = adjustColumnWidths(widths, width);
+            } else if (contentBias == Orientation.HORIZONTAL) {
+                widths = (CompositeSize) computePrefWidths(null).clone();
+                columnTotal = adjustColumnWidths(widths, width);
+                heights = computePrefHeights(widths.asArray());
+                rowTotal = adjustRowHeights(heights, height);
+            } else {
+                heights = (CompositeSize) computePrefHeights(null).clone();
+                rowTotal = adjustRowHeights(heights, height);
+                widths = computePrefWidths(heights.asArray());
+                columnTotal = adjustColumnWidths(widths, width);
             }
 
-            HPos halign = getHalignment(child);
-            VPos valign = getValignment(child);
-            Boolean fillWidth = isFillWidth(child);
-            Boolean fillHeight = isFillHeight(child);
+            final double x = left + computeXOffset(contentWidth, columnTotal, getAlignmentInternal().getHpos());
+            final double y = top + computeYOffset(contentHeight, rowTotal, getAlignmentInternal().getVpos());
+            final List<Node> managed = getManagedChildren();
 
-            if (halign == null) {
-                halign = getColumnHalignment(columnIndex);
+            double[] baselineOffsets = createDoubleArray(numRows, -1);
+
+            for (int i = 0, size = managed.size(); i < size; i++) {
+                final Node child = managed.get(i);
+                final int rowIndex = getNodeRowIndex(child);
+                int columnIndex = getNodeColumnIndex(child);
+                int colspan = getNodeColumnSpan(child);
+                if (colspan == REMAINING) {
+                    colspan = widths.getLength() - columnIndex;
+                }
+                int rowspan = getNodeRowSpan(child);
+                if (rowspan == REMAINING) {
+                    rowspan = heights.getLength() - rowIndex;
+                }
+                double areaX = x;
+                for (int j = 0; j < columnIndex; j++) {
+                    areaX += widths.getSize(j) + snaphgap;
+                }
+                double areaY = y;
+                for (int j = 0; j < rowIndex; j++) {
+                    areaY += heights.getSize(j) + snapvgap;
+                }
+                double areaW = widths.getSize(columnIndex);
+                for (int j = 2; j <= colspan; j++) {
+                    areaW += widths.getSize(columnIndex + j - 1) + snaphgap;
+                }
+                double areaH = heights.getSize(rowIndex);
+                for (int j = 2; j <= rowspan; j++) {
+                    areaH += heights.getSize(rowIndex + j - 1) + snapvgap;
+                }
+
+                HPos halign = getHalignment(child);
+                VPos valign = getValignment(child);
+                Boolean fillWidth = isFillWidth(child);
+                Boolean fillHeight = isFillHeight(child);
+
+                if (halign == null) {
+                    halign = getColumnHalignment(columnIndex);
+                }
+                if (valign == null) {
+                    valign = getRowValignment(rowIndex);
+                }
+                if (fillWidth == null) {
+                    fillWidth = shouldColumnFillWidth(columnIndex);
+                }
+                if (fillHeight == null) {
+                    fillHeight = shouldRowFillHeight(rowIndex);
+                }
+
+                double baselineOffset = 0;
+                if (valign == VPos.BASELINE) {
+                    if (baselineOffsets[rowIndex] == -1) {
+                        baselineOffsets[rowIndex] = getAreaBaselineOffset(rowBaseline[rowIndex],
+                                marginAccessor,
+                                t -> {
+                                    Node n = rowBaseline[rowIndex].get(t);
+                                    int c = getNodeColumnIndex(n);
+                                    int cs = getNodeColumnSpan(n);
+                                    if (cs == REMAINING) {
+                                        cs = widths.getLength() - c;
+                                    }
+                                    double w = widths.getSize(c);
+                                    for (int j = 2; j <= cs; j++) {
+                                        w += widths.getSize(c + j - 1) + snaphgap;
+                                    }
+                                    return w;
+                                },
+                                areaH,
+                                t -> {
+                                    Boolean b = isFillHeight(child);
+                                    if (b != null) {
+                                        return b;
+                                    }
+                                    return shouldRowFillHeight(getNodeRowIndex(child));
+                                }, rowMinBaselineComplement[rowIndex]
+                        );
+                    }
+                    baselineOffset = baselineOffsets[rowIndex];
+                }
+
+                Insets margin = getMargin(child);
+                layoutInArea(child, areaX, areaY, areaW, areaH,
+                        baselineOffset,
+                        margin,
+                        fillWidth, fillHeight,
+                        halign, valign);
             }
-            if (valign == null) {
-                valign = getRowValignment(rowIndex);
-            }
-            if (fillWidth == null) {
-                fillWidth = shouldColumnFillWidth(columnIndex);
-            }
-            if (fillHeight == null) {
-                fillHeight = shouldRowFillHeight(rowIndex);
-            }
-
-            double baselineOffset = 0;
-            if (valign == VPos.BASELINE) {
-                if (baselineOffsets[rowIndex] == -1) {
-                    baselineOffsets[rowIndex] = getAreaBaselineOffset(rowBaseline[rowIndex],
-                            marginAccessor,
-                            t -> {
-                                Node n = rowBaseline[rowIndex].get(t);
-                                int c = getNodeColumnIndex(n);
-                                int cs = getNodeColumnSpan(n);
-                                if (cs == REMAINING) {
-                                    cs = widths.getLength() - c;
-                                }
-                                double w = widths.getSize(c);
-                                for (int j = 2; j <= cs; j++) {
-                                    w += widths.getSize(c + j - 1) + snaphgap;
-                                }
-                                return w;
-                            },
-                            areaH,
-                            t -> {
-                                Boolean b = isFillHeight(child);
-                                if (b != null) {
-                                    return b;
-                                }
-                                return shouldRowFillHeight(getNodeRowIndex(child));
-                            }, rowMinBaselineComplement[rowIndex]);
-                }
-                baselineOffset = baselineOffsets[rowIndex];
-            }
-
-            Insets margin = getMargin(child);
-            layoutInArea(child, areaX, areaY, areaW, areaH,
-                    baselineOffset,
-                    margin,
-                    fillWidth, fillHeight,
-                    halign, valign);
+            layoutGridLines(widths, heights, x, y, rowTotal, columnTotal);
+            currentHeights = heights;
+            currentWidths = widths;
+        } finally {
+            performingLayout = false;
         }
-        layoutGridLines(widths, heights, x, y, rowTotal, columnTotal);
-        currentHeights = heights;
-        currentWidths = widths;
-        performingLayout = false;
     }
 
     private double adjustRowHeights(final CompositeSize heights, double height) {
--- a/modules/graphics/src/main/native-font/coretext.c	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/main/native-font/coretext.c	Thu May 29 14:51:49 2014 -0700
@@ -525,6 +525,12 @@
     return (jlong)kCTFontAttributeName;
 }
 
+JNIEXPORT jlong JNICALL OS_NATIVE(kCTParagraphStyleAttributeName)
+    (JNIEnv *env, jclass that)
+{
+    return (jlong)kCTParagraphStyleAttributeName;
+}
+
 JNIEXPORT jlong JNICALL OS_NATIVE(CFAttributedStringCreate)
     (JNIEnv *env, jclass that, jlong arg0, jlong arg1, jlong arg2)
 {
@@ -827,6 +833,16 @@
     return newCGRect(env, &result);
 }
 
+JNIEXPORT jlong JNICALL OS_NATIVE(CTParagraphStyleCreate)
+    (JNIEnv *env, jclass that, jint arg0)
+{
+    CTWritingDirection dir = (CTWritingDirection)arg0;
+    CTParagraphStyleSetting settings[] = {
+        {kCTParagraphStyleSpecifierBaseWritingDirection, sizeof(dir), &dir}
+    };
+    return (jlong)CTParagraphStyleCreate(settings, sizeof(settings) / sizeof(settings[0]));
+}
+
 /***********************************************/
 /*                Glyph Outline                */
 /***********************************************/
--- a/modules/graphics/src/main/native-font/pango.c	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/main/native-font/pango.c	Thu May 29 14:51:49 2014 -0700
@@ -240,6 +240,12 @@
     return (jlong)pango_itemize((PangoContext *)arg0, (const char *)arg1, arg2, arg3, (PangoAttrList *)arg4, (PangoAttrIterator *)arg5);
 }
 
+JNIEXPORT void JNICALL OS_NATIVE(pango_1context_1set_1base_1dir)
+    (JNIEnv *env, jclass that, jlong arg0, jint arg1)
+{
+    pango_context_set_base_dir((PangoContext *)arg0, (PangoDirection)arg1);
+}
+
 JNIEXPORT jlong JNICALL OS_NATIVE(pango_1font_1describe)
     (JNIEnv *env, jclass that, jlong arg0)
 {
--- a/modules/graphics/src/main/native-glass/mac/GlassView3D.m	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/main/native-glass/mac/GlassView3D.m	Thu May 29 14:51:49 2014 -0700
@@ -453,6 +453,8 @@
 - (BOOL)performKeyEquivalent:(NSEvent *)theEvent
 {
     KEYLOG("performKeyEquivalent");
+    [GlassApplication registerKeyEvent:theEvent];
+
     // Crash if the FS window is released while performing a key equivalent
     // Local copy of the id keeps the retain/release calls balanced.
     id fsWindow = [self->_delegate->fullscreenWindow retain];
--- a/modules/graphics/src/main/native-glass/monocle/EGL.c	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/main/native-glass/monocle/EGL.c	Thu May 29 14:51:49 2014 -0700
@@ -30,7 +30,6 @@
 
 #include <stdlib.h>
 
-
 void setEGLAttrs(jint *attrs, int *eglAttrs) {
     int index = 0;
 
@@ -82,12 +81,12 @@
      jintArray minorArray){
 
     EGLint major, minor;
-    if (!eglInitialize(asPtr(eglDisplay), &major, &minor)) {
+    if (eglInitialize(asPtr(eglDisplay), &major, &minor)) {
          (*env)->SetIntArrayRegion(env, majorArray, 0, 1, &major);
          (*env)->SetIntArrayRegion(env, minorArray, 0, 1, &minor);
+        return JNI_TRUE;
+    } else {
         return JNI_FALSE;
-    } else {
-        return JNI_TRUE;
     }
 }
 
@@ -115,7 +114,7 @@
     (*env)->ReleaseIntArrayElements(env, attribs, attrArray, JNI_ABORT);
     EGLConfig *configArray = malloc(sizeof(EGLConfig) * configSize);
     jlong *longConfigArray = malloc(sizeof(long) * configSize);
-    EGLint numConfigPtr=5;
+    EGLint numConfigPtr=0;
     jboolean retval;
 
     if (!eglChooseConfig(asPtr(eglDisplay), eglAttrs, configArray, configSize,
@@ -123,16 +122,13 @@
         retval = JNI_FALSE;
     } else {
         retval = JNI_TRUE;
+        (*env)->SetIntArrayRegion(env, numConfigs, 0, 1, &numConfigPtr);
+        for (i = 0; i < numConfigPtr; i++) {
+            longConfigArray[i] = asJLong(configArray[i]);
+        }
+
+        (*env)->SetLongArrayRegion(env, configs, 0, configSize, longConfigArray);
     }
-
-
-    (*env)->SetIntArrayRegion(env, numConfigs, 0, 1, &numConfigPtr);
-    for (i = 0; i < numConfigPtr; i++) {
-        longConfigArray[i] = asJLong(configArray[i]);
-        //printf("i is %d\n", i);
-    }
-
-    (*env)->SetLongArrayRegion(env, configs, 0, configSize, longConfigArray);
     free(configArray);
     free(longConfigArray);
     return retval;
@@ -166,13 +162,7 @@
     EGLint contextAttrs[] = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE};
     EGLContext context = eglCreateContext(asPtr(eglDisplay), asPtr(config),
                                           NULL, contextAttrs);
-
-    if (context == EGL_NO_CONTEXT) {
-        fprintf(stderr, "eglCreateContext() failed - %d\n", eglGetError());
-        return 0;
-    } else {
-        return asJLong(context);
-    }
+    return asJLong(context);
 }
 
 JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_monocle_EGL_eglMakeCurrent
@@ -196,6 +186,10 @@
     }
 }
 
+JNIEXPORT jint  JNICALL Java_com_sun_glass_ui_monocle_EGL_eglGetError
+    (JNIEnv *UNUSED(env), jclass UNUSED(clazz)) {
+    return (jint)eglGetError();
+}
 
 
 
@@ -208,3 +202,4 @@
 
 
 
+
--- a/modules/graphics/src/main/native-glass/monocle/linux/LinuxSystem.c	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/main/native-glass/monocle/linux/LinuxSystem.c	Thu May 29 14:51:49 2014 -0700
@@ -299,3 +299,9 @@
   (JNIEnv *UNUSED(env), jobject UNUSED(obj), jlong addr, jlong length) {
     return (jint) munmap(asPtr(addr), (size_t) length);
 }
+
+JNIEXPORT jlong JNICALL Java_com_sun_glass_ui_monocle_linux_LinuxSystem_memcpy
+  (JNIEnv *UNUSED(env), jobject UNUSED(obj), jlong destAddr, jlong srcAddr,
+   jlong length) {
+    return asJLong(memcpy(asPtr(destAddr), asPtr(srcAddr), (size_t)(length)));
+}
--- a/modules/graphics/src/main/native-glass/monocle/x11/X11.c	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/main/native-glass/monocle/x11/X11.c	Thu May 29 14:51:49 2014 -0700
@@ -25,6 +25,7 @@
 
 #include "com_sun_glass_ui_monocle_x11_X.h"
 #include <X11/Xlib.h>
+#include <X11/Xlibint.h>
 #include "Monocle.h"
 
 JNIEXPORT jlong JNICALL
@@ -276,3 +277,9 @@
     XClientMessageEvent *event = (XClientMessageEvent *) asPtr(eventL);
     event->data.l[index] = (long) element;
 }
+
+JNIEXPORT jint JNICALL
+ Java_com_sun_glass_ui_monocle_x11_X_00024XDisplay_sizeof
+ (JNIEnv *UNUSED(env), jclass UNUSED(clazz)) {
+    return (jint) sizeof(struct _XDisplay);
+}
--- a/modules/graphics/src/test/java/com/sun/javafx/css/StylesheetTest.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/graphics/src/test/java/com/sun/javafx/css/StylesheetTest.java	Thu May 29 14:51:49 2014 -0700
@@ -37,7 +37,9 @@
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.File;
+import java.io.FileWriter;
 import java.io.IOException;
+import java.io.OutputStreamWriter;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.Collections;
@@ -46,6 +48,7 @@
 import java.util.Map;
 
 import javafx.css.StyleableProperty;
+import javafx.geometry.NodeOrientation;
 import javafx.geometry.Orientation;
 import javafx.geometry.Pos;
 import javafx.geometry.VPos;
@@ -594,4 +597,36 @@
            fail(e.toString());
        }
    }
+
+    @Test
+    public void testRT_37301() {
+        try {
+            File source = File.createTempFile("RT_37301_", "css");
+            FileWriter writer = new FileWriter(source);
+            writer.write("A:dir(rtl) {} B:dir(ltr) {} C {}");
+            writer.flush();
+            writer.close();
+            File target = File.createTempFile("RT_37301_", "bss");
+            Stylesheet.convertToBinary(source, target);
+            Stylesheet stylesheet = Stylesheet.loadBinary(target.toURL());
+            int good = 0;
+            for (Rule rule : stylesheet.getRules()) {
+                for (Selector sel : rule.getSelectors()) {
+                    SimpleSelector simpleSelector = (SimpleSelector)sel;
+                    if ("A".equals(simpleSelector.getName())) {
+                        assertEquals(NodeOrientation.RIGHT_TO_LEFT, simpleSelector.getNodeOrientation());
+                    } else if ("B".equals(simpleSelector.getName())) {
+                        assertEquals(NodeOrientation.LEFT_TO_RIGHT, simpleSelector.getNodeOrientation());
+                    } else if ("C".equals(simpleSelector.getName())) {
+                        assertEquals(NodeOrientation.INHERIT, simpleSelector.getNodeOrientation());
+                    } else {
+                        fail(simpleSelector.toString());
+                    }
+                }
+            }
+        } catch (IOException e) {
+            fail(e.toString());
+        }
+    }
+
 }
--- a/modules/swing/src/main/java/javafx/embed/swing/InputMethodSupport.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/swing/src/main/java/javafx/embed/swing/InputMethodSupport.java	Thu May 29 14:51:49 2014 -0700
@@ -78,12 +78,11 @@
 
         @Override
         public AttributedCharacterIterator getCommittedText(int beginIndex, int endIndex, AttributedCharacterIterator.Attribute[] attributes) {
-            String result;
+            String result = null;
             if (fxRequests instanceof ExtendedInputMethodRequests) {
                 result = ((ExtendedInputMethodRequests)fxRequests).getCommittedText(beginIndex, endIndex);
-            } else {
-                result = "";
             }
+            if (result == null) result = "";
             return new AttributedString(result).getIterator();
         }
 
@@ -103,7 +102,9 @@
 
         @Override
         public AttributedCharacterIterator getSelectedText(AttributedCharacterIterator.Attribute[] attributes) {
-            return new AttributedString(fxRequests.getSelectedText()).getIterator();
+            String text = fxRequests.getSelectedText();
+            if (text == null) text = "";
+            return new AttributedString(text).getIterator();
         }
     }
 
--- a/modules/swing/src/main/java/javafx/embed/swing/JFXPanel.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/swing/src/main/java/javafx/embed/swing/JFXPanel.java	Thu May 29 14:51:49 2014 -0700
@@ -66,6 +66,7 @@
 import com.sun.javafx.embed.HostInterface;
 import com.sun.javafx.stage.EmbeddedWindow;
 import com.sun.javafx.tk.Toolkit;
+import com.sun.javafx.PlatformUtil;
 
 import java.util.concurrent.atomic.AtomicInteger;
 import sun.awt.CausedFocusEvent;
@@ -886,6 +887,10 @@
 
         @Override
         public boolean grabFocus() {
+            // On X11 grab is limited to a single XDisplay connection,
+            // so we can't delegate it to another GUI toolkit.
+            if (PlatformUtil.isLinux()) return true;
+
             SwingUtilities.invokeLater(() -> {
                 Window window = SwingUtilities.getWindowAncestor(JFXPanel.this);
                 if (window != null) {
@@ -900,6 +905,10 @@
 
         @Override
         public void ungrabFocus() {
+            // On X11 grab is limited to a single XDisplay connection,
+            // so we can't delegate it to another GUI toolkit.
+            if (PlatformUtil.isLinux()) return;
+
             SwingUtilities.invokeLater(() -> {
                 Window window = SwingUtilities.getWindowAncestor(JFXPanel.this);
                 if (window != null) {
--- a/modules/swing/src/main/java/javafx/embed/swing/SwingNode.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/swing/src/main/java/javafx/embed/swing/SwingNode.java	Thu May 29 14:51:49 2014 -0700
@@ -71,6 +71,7 @@
 import com.sun.javafx.stage.FocusUngrabEvent;
 import com.sun.javafx.stage.ScreenHelper;
 import com.sun.javafx.stage.WindowHelper;
+import com.sun.javafx.PlatformUtil;
 import sun.awt.UngrabEvent;
 import sun.awt.LightweightFrame;
 import sun.swing.JLightweightFrame;
@@ -670,6 +671,10 @@
         @Override
         public void focusGrabbed() {
             SwingFXUtils.runOnFxThread(() -> {
+                // On X11 grab is limited to a single XDisplay connection,
+                // so we can't delegate it to another GUI toolkit.
+                if (PlatformUtil.isLinux()) return;
+
                 if (getScene() != null &&
                         getScene().getWindow() != null &&
                         getScene().getWindow().impl_getPeer() != null) {
@@ -717,6 +722,10 @@
     }
 
     private void ungrabFocus(boolean postUngrabEvent) {
+        // On X11 grab is limited to a single XDisplay connection,
+        // so we can't delegate it to another GUI toolkit.
+        if (PlatformUtil.isLinux()) return;
+
         if (grabbed &&
             getScene() != null &&
             getScene().getWindow() != null &&
@@ -755,6 +764,10 @@
             if (swingID < 0) {
                 return;
             }
+
+            // Prevent ancestors of the SwingNode from stealing the focus
+            event.consume();
+
             final EventType<?> type = event.getEventType();
             if (type == MouseEvent.MOUSE_PRESSED) {
                 mouseClickedAllowed.add(event.getButton());
--- a/modules/web/src/main/java/com/sun/javafx/scene/web/skin/HTMLEditorSkin.java	Tue May 27 20:34:11 2014 -0700
+++ b/modules/web/src/main/java/com/sun/javafx/scene/web/skin/HTMLEditorSkin.java	Thu May 29 14:51:49 2014 -0700
@@ -32,6 +32,7 @@
 import com.sun.javafx.scene.traversal.Direction;
 import com.sun.javafx.scene.traversal.ParentTraversalEngine;
 import com.sun.javafx.scene.traversal.TraversalContext;
+import javafx.geometry.Orientation;
 import org.w3c.dom.html.HTMLDocument;
 import org.w3c.dom.html.HTMLElement;
 
@@ -492,7 +493,7 @@
         copyButton = addButton(toolbar1, resources.getString("copyIcon"), resources.getString("copy"), COPY_COMMAND, "html-editor-copy");
         pasteButton = addButton(toolbar1, resources.getString("pasteIcon"), resources.getString("paste"), PASTE_COMMAND, "html-editor-paste");
 
-        toolbar1.getItems().add(new Separator());
+        toolbar1.getItems().add(new Separator(Orientation.VERTICAL));
 
 //        undoButton = addButton(toolbar1, "undoIcon", resources.getString("undo"), UNDO_COMMAND);
 //        redoButton = addButton(toolbar1, "redoIcon", resources.getString("redo"), REDO_COMMAND);//
@@ -508,14 +509,14 @@
          alignJustifyButton = addToggleButton(toolbar1, alignmentToggleGroup,
             resources.getString("alignJustifyIcon"), resources.getString("alignJustify"), ALIGN_JUSTIFY_COMMAND, "html-editor-align-justify");
 
-        toolbar1.getItems().add(new Separator());
+        toolbar1.getItems().add(new Separator(Orientation.VERTICAL));
 
         outdentButton = addButton(toolbar1, resources.getString("outdentIcon"), resources.getString("outdent"), OUTDENT_COMMAND, "html-editor-outdent");
         if (outdentButton.getGraphic() != null) outdentButton.getGraphic().setNodeOrientation(NodeOrientation.INHERIT);
         indentButton = addButton(toolbar1, resources.getString("indentIcon"), resources.getString("indent"), INDENT_COMMAND, "html-editor-indent");
         if (indentButton.getGraphic() != null) indentButton.getGraphic().setNodeOrientation(NodeOrientation.INHERIT);
 
-        toolbar1.getItems().add(new Separator());
+        toolbar1.getItems().add(new Separator(Orientation.VERTICAL));
 
          ToggleGroup listStyleToggleGroup = new ToggleGroup();
          bulletsButton = addToggleButton(toolbar1, listStyleToggleGroup,
@@ -524,7 +525,7 @@
          numbersButton = addToggleButton(toolbar1, listStyleToggleGroup,
             resources.getString("numbersIcon"), resources.getString("numbers"), NUMBERS_COMMAND, "html-editor-numbers");
 
-        toolbar1.getItems().add(new Separator());
+        toolbar1.getItems().add(new Separator(Orientation.VERTICAL));
 
         //toolbar1.getItems().add(new Separator());
 
@@ -677,7 +678,7 @@
             }
         });
 
-        toolbar2.getItems().add(new Separator());
+        toolbar2.getItems().add(new Separator(Orientation.VERTICAL));
 
         boldButton = addToggleButton(toolbar2, null,
             resources.getString("boldIcon"), resources.getString("bold"), BOLD_COMMAND, "html-editor-bold");
@@ -696,7 +697,7 @@
         strikethroughButton = addToggleButton(toolbar2, null,
             resources.getString("strikethroughIcon"), resources.getString("strikethrough"), STRIKETHROUGH_COMMAND, "html-editor-strike");
 
-        toolbar2.getItems().add(new Separator());
+        toolbar2.getItems().add(new Separator(Orientation.VERTICAL));
 
         insertHorizontalRuleButton = addButton(toolbar2, resources.getString("insertHorizontalRuleIcon"),
             resources.getString("insertHorizontalRule"), INSERT_HORIZONTAL_RULE_COMMAND, "html-editor-hr");
--- a/tests/system/src/test/java/com/sun/glass/ui/monocle/input/MonocleUInput.java	Tue May 27 20:34:11 2014 -0700
+++ b/tests/system/src/test/java/com/sun/glass/ui/monocle/input/MonocleUInput.java	Thu May 29 14:51:49 2014 -0700
@@ -34,6 +34,7 @@
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.nio.channels.Pipe;
+import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.atomic.AtomicReference;
 
 class MonocleUInput extends NativeUInput {
@@ -91,7 +92,20 @@
         pipe = null;
         if (device != null) {
             final LinuxInputDevice d = device;
-            Platform.runLater(() -> registry.removeDevice(d));
+            if (Platform.isFxApplicationThread()) {
+                registry.removeDevice(d);
+            } else {
+                CountDownLatch latch = new CountDownLatch(1);
+                Platform.runLater(() -> {
+                    registry.removeDevice(d);
+                    latch.countDown();
+                });
+                try {
+                    latch.await();
+                } catch (InterruptedException e) {
+                    e.printStackTrace();
+                }
+            }
             device = null;
         }
     }
@@ -102,6 +116,8 @@
 
     @Override
     public void dispose() {
+        destroyDevice();
+        closeConnection();
     }
 
     @Override
--- a/tests/system/src/test/java/com/sun/glass/ui/monocle/input/SingleTouchTest.java	Tue May 27 20:34:11 2014 -0700
+++ b/tests/system/src/test/java/com/sun/glass/ui/monocle/input/SingleTouchTest.java	Thu May 29 14:51:49 2014 -0700
@@ -238,7 +238,7 @@
     /**
      * Touch down, change scene, release finger.
      */
-    @Ignore("RT-36008")
+    @Ignore("RT-37283")
     @Test
     public void testChangeSceneDuringTap() throws Exception {
         final int x1 = (int) Math.round(width * 0.3);
--- a/tests/system/src/test/java/com/sun/glass/ui/monocle/input/TestApplication.java	Tue May 27 20:34:11 2014 -0700
+++ b/tests/system/src/test/java/com/sun/glass/ui/monocle/input/TestApplication.java	Thu May 29 14:51:49 2014 -0700
@@ -408,6 +408,7 @@
             ui.processLine("CLOSE");
             ui.dispose();
         }
+        frameWait(1);
     }
 
     public static int getTapRadius() {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/system/src/test/java/com/sun/javafx/sg/prism/RT36296Test.java	Thu May 29 14:51:49 2014 -0700
@@ -0,0 +1,118 @@
+/*
+ * 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.sg.prism;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javafx.application.Application;
+import javafx.application.Platform;
+import javafx.geometry.Rectangle2D;
+import javafx.stage.Stage;
+import javafx.scene.Group;
+import javafx.scene.Scene;
+import javafx.scene.SnapshotParameters;
+import javafx.scene.control.Label;
+import javafx.scene.image.WritableImage;
+import junit.framework.AssertionFailedError;
+import org.junit.AfterClass;
+import static org.junit.Assert.assertEquals;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static util.Util.TIMEOUT;
+
+public class RT36296Test {
+    CountDownLatch latch = new CountDownLatch(1);
+
+    // Used to launch the application before running any test
+    private static final CountDownLatch launchLatch = new CountDownLatch(1);
+
+    // Singleton Application instance
+    static MyApp myApp;
+
+    // Application class. An instance is created and initialized before running
+    // the first test, and it lives through the execution of all tests.
+    public static class MyApp extends Application {
+        @Override public void init() {
+            RT36296Test.myApp = this;
+        }
+
+        @Override public void start(Stage primaryStage) throws Exception {
+            launchLatch.countDown();
+        }
+    }
+
+    @BeforeClass
+    public static void setupOnce() {
+        // Start the Application
+        new Thread(new Runnable() {
+            @Override public void run() {
+                Application.launch(MyApp.class, (String[])null);
+            }
+        }).start();
+
+        try {
+            if (!launchLatch.await(TIMEOUT, TimeUnit.MILLISECONDS)) {
+                throw new AssertionFailedError("Timeout waiting for Application to launch");
+            }
+        } catch (InterruptedException ex) {
+            AssertionFailedError err = new AssertionFailedError("Unexpected exception");
+            err.initCause(ex);
+            throw err;
+        }
+
+        assertEquals(0, launchLatch.getCount());
+    }
+
+    @AfterClass
+    public static void teardownOnce() {
+        Platform.exit();
+    }
+
+    @Test(timeout = 5000)
+    public void TestBug() {
+        Label label = new Label();
+        label.setStyle(" -fx-border-style:dashed; -fx-border-width:0; ");
+        label.setText("test");
+
+        SnapshotParameters params = new SnapshotParameters();
+        params.setViewport(new Rectangle2D(0, 0, 100, 100));
+        Platform.runLater(() -> {
+            Scene scene = new Scene(new Group(label));
+            label.snapshot(p -> done(), params, new WritableImage(100, 100));
+        });
+        try {
+            latch.await();
+        } catch (InterruptedException ex) {
+            Logger.getLogger(RT36296Test.class.getName()).log(Level.SEVERE, null, ex);
+        }
+    }
+
+    public Void done() {
+        latch.countDown();
+        return null;
+    }
+}