changeset 57790:6500cac59d0f

Merge
author psadhukhan
date Wed, 22 Jan 2020 13:29:03 +0530
parents 7c606c26d02a 8ce5915e57d2
children 055d9be4dd30
files
diffstat 59 files changed, 1690 insertions(+), 497 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/macosx/classes/com/apple/laf/AquaSpinnerUI.java	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/macosx/classes/com/apple/laf/AquaSpinnerUI.java	Wed Jan 22 13:29:03 2020 +0530
@@ -556,6 +556,7 @@
             if (bottom != null) {
                 fBottomModel = bottom.getModel();
             }
+            setFocusable(false);
         }
 
         @Override
--- a/src/java.desktop/macosx/classes/sun/awt/CGraphicsConfig.java	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/macosx/classes/sun/awt/CGraphicsConfig.java	Wed Jan 22 13:29:03 2020 +0530
@@ -34,7 +34,6 @@
 import sun.java2d.SurfaceData;
 import sun.java2d.opengl.CGLLayer;
 import sun.lwawt.LWGraphicsConfig;
-import sun.lwawt.macosx.CPlatformView;
 
 public abstract class CGraphicsConfig extends GraphicsConfiguration
         implements LWGraphicsConfig {
@@ -79,12 +78,6 @@
 
     /**
      * Creates a new SurfaceData that will be associated with the given
-     * LWWindowPeer.
-     */
-    public abstract SurfaceData createSurfaceData(CPlatformView pView);
-
-    /**
-     * Creates a new SurfaceData that will be associated with the given
      * CGLLayer.
      */
     public abstract SurfaceData createSurfaceData(CGLLayer layer);
--- a/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java	Wed Jan 22 13:29:03 2020 +0530
@@ -55,7 +55,6 @@
 import sun.java2d.pipe.hw.AccelTypedVolatileImage;
 import sun.java2d.pipe.hw.ContextCapabilities;
 import sun.lwawt.LWComponentPeer;
-import sun.lwawt.macosx.CPlatformView;
 
 import static sun.java2d.opengl.OGLContext.OGLContextCaps.CAPS_DOUBLEBUFFERED;
 import static sun.java2d.opengl.OGLContext.OGLContextCaps.CAPS_EXT_FBOBJECT;
@@ -259,11 +258,6 @@
     }
 
     @Override
-    public SurfaceData createSurfaceData(CPlatformView pView) {
-        return CGLSurfaceData.createData(pView);
-    }
-
-    @Override
     public SurfaceData createSurfaceData(CGLLayer layer) {
         return CGLSurfaceData.createData(layer);
     }
--- a/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLSurfaceData.java	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLSurfaceData.java	Wed Jan 22 13:29:03 2020 +0530
@@ -26,69 +26,40 @@
 package sun.java2d.opengl;
 
 import java.awt.GraphicsConfiguration;
-import java.awt.GraphicsDevice;
-import java.awt.GraphicsEnvironment;
 import java.awt.Image;
 import java.awt.Rectangle;
 import java.awt.image.ColorModel;
 
 import sun.java2d.SurfaceData;
-import sun.lwawt.macosx.CPlatformView;
 
 public abstract class CGLSurfaceData extends OGLSurfaceData {
 
-    protected final int scale;
-    protected final int width;
-    protected final int height;
-    protected CPlatformView pView;
-    private CGLGraphicsConfig graphicsConfig;
-
-    native void validate(int xoff, int yoff, int width, int height, boolean isOpaque);
+    private final int scale;
+    final int width;
+    final int height;
+    private final CGLGraphicsConfig graphicsConfig;
 
     private native void initOps(OGLGraphicsConfig gc, long pConfigInfo,
                                 long pPeerData, long layerPtr, int xoff,
                                 int yoff, boolean isOpaque);
 
-    protected CGLSurfaceData(CGLGraphicsConfig gc, ColorModel cm, int type,
-                             int width, int height) {
+    private CGLSurfaceData(CGLLayer layer, CGLGraphicsConfig gc,
+                           ColorModel cm, int type, int width, int height) {
         super(gc, cm, type);
         // TEXTURE shouldn't be scaled, it is used for managed BufferedImages.
         scale = type == TEXTURE ? 1 : gc.getDevice().getScaleFactor();
         this.width = width * scale;
         this.height = height * scale;
-    }
-
-    protected CGLSurfaceData(CPlatformView pView, CGLGraphicsConfig gc,
-                             ColorModel cm, int type,int width, int height)
-    {
-        this(gc, cm, type, width, height);
-        this.pView = pView;
         this.graphicsConfig = gc;
 
-        long pConfigInfo = gc.getNativeConfigInfo();
-        long pPeerData = 0L;
-        boolean isOpaque = true;
-        if (pView != null) {
-            pPeerData = pView.getAWTView();
-            isOpaque = pView.isOpaque();
-        }
-        initOps(gc, pConfigInfo, pPeerData, 0, 0, 0, isOpaque);
-    }
-
-    protected CGLSurfaceData(CGLLayer layer, CGLGraphicsConfig gc,
-                             ColorModel cm, int type,int width, int height)
-    {
-        this(gc, cm, type, width, height);
-        this.graphicsConfig = gc;
-
-        long pConfigInfo = gc.getNativeConfigInfo();
         long layerPtr = 0L;
         boolean isOpaque = true;
         if (layer != null) {
             layerPtr = layer.getPointer();
             isOpaque = layer.isOpaque();
         }
-        initOps(gc, pConfigInfo, 0, layerPtr, 0, 0, isOpaque);
+        // TODO delete the native code: pPeerData, xoff, yoff are always zero
+        initOps(gc, gc.getNativeConfigInfo(), 0, layerPtr, 0, 0, isOpaque);
     }
 
     @Override //SurfaceData
@@ -97,20 +68,11 @@
     }
 
     /**
-     * Creates a SurfaceData object representing the primary (front) buffer of
-     * an on-screen Window.
-     */
-    public static CGLWindowSurfaceData createData(CPlatformView pView) {
-        CGLGraphicsConfig gc = getGC(pView);
-        return new CGLWindowSurfaceData(pView, gc);
-    }
-
-    /**
      * Creates a SurfaceData object representing the intermediate buffer
      * between the Java2D flusher thread and the AppKit thread.
      */
     public static CGLLayerSurfaceData createData(CGLLayer layer) {
-        CGLGraphicsConfig gc = getGC(layer);
+        CGLGraphicsConfig gc = (CGLGraphicsConfig) layer.getGraphicsConfiguration();
         Rectangle r = layer.getBounds();
         return new CGLLayerSurfaceData(layer, gc, r.width, r.height);
     }
@@ -121,29 +83,7 @@
      */
     public static CGLOffScreenSurfaceData createData(CGLGraphicsConfig gc,
             int width, int height, ColorModel cm, Image image, int type) {
-        return new CGLOffScreenSurfaceData(null, gc, width, height, image, cm,
-                type);
-    }
-
-    public static CGLGraphicsConfig getGC(CPlatformView pView) {
-        if (pView != null) {
-            return (CGLGraphicsConfig)pView.getGraphicsConfiguration();
-        } else {
-            // REMIND: this should rarely (never?) happen, but what if
-            // default config is not CGL?
-            GraphicsEnvironment env = GraphicsEnvironment
-                .getLocalGraphicsEnvironment();
-            GraphicsDevice gd = env.getDefaultScreenDevice();
-            return (CGLGraphicsConfig) gd.getDefaultConfiguration();
-        }
-    }
-
-    public static CGLGraphicsConfig getGC(CGLLayer layer) {
-        return (CGLGraphicsConfig)layer.getGraphicsConfiguration();
-    }
-
-    public void validate() {
-        // Overridden in CGLWindowSurfaceData below
+        return new CGLOffScreenSurfaceData(gc, width, height, image, cm, type);
     }
 
     @Override
@@ -156,55 +96,12 @@
         return scale;
     }
 
-    protected native void clearWindow();
-
-    public static class CGLWindowSurfaceData extends CGLSurfaceData {
-
-        public CGLWindowSurfaceData(CPlatformView pView,
-                CGLGraphicsConfig gc) {
-            super(pView, gc, gc.getColorModel(), WINDOW, 0, 0);
-        }
-
-        @Override
-        public SurfaceData getReplacement() {
-            return pView.getSurfaceData();
-        }
-
-        @Override
-        public Rectangle getBounds() {
-            Rectangle r = pView.getBounds();
-            return new Rectangle(0, 0, r.width, r.height);
-        }
+    @Override
+    public Rectangle getBounds() {
+        return new Rectangle(width, height);
+    }
 
-        /**
-         * Returns destination Component associated with this SurfaceData.
-         */
-        @Override
-        public Object getDestination() {
-            return pView.getDestination();
-        }
-
-        public void validate() {
-            OGLRenderQueue rq = OGLRenderQueue.getInstance();
-            rq.lock();
-            try {
-                rq.flushAndInvokeNow(new Runnable() {
-                    public void run() {
-                        Rectangle peerBounds = pView.getBounds();
-                        validate(0, 0, peerBounds.width, peerBounds.height, pView.isOpaque());
-                    }
-                });
-            } finally {
-                rq.unlock();
-            }
-        }
-
-        @Override
-        public void invalidate() {
-            super.invalidate();
-            clearWindow();
-        }
-    }
+    protected native void clearWindow();
 
     /**
      * A surface which implements an intermediate buffer between
@@ -215,10 +112,10 @@
      */
     public static class CGLLayerSurfaceData extends CGLSurfaceData {
 
-        private CGLLayer layer;
+        private final CGLLayer layer;
 
-        public CGLLayerSurfaceData(CGLLayer layer, CGLGraphicsConfig gc,
-                                   int width, int height) {
+        private CGLLayerSurfaceData(CGLLayer layer, CGLGraphicsConfig gc,
+                                    int width, int height) {
             super(layer, gc, gc.getColorModel(), FBOBJECT, width, height);
             this.layer = layer;
             initSurface(this.width, this.height);
@@ -235,11 +132,6 @@
         }
 
         @Override
-        public Rectangle getBounds() {
-            return new Rectangle(width, height);
-        }
-
-        @Override
         public Object getDestination() {
             return layer.getDestination();
         }
@@ -256,13 +148,18 @@
         }
     }
 
+    /**
+     * SurfaceData object representing an off-screen buffer (either a FBO or
+     * Texture).
+     */
     public static class CGLOffScreenSurfaceData extends CGLSurfaceData {
-        private Image offscreenImage;
 
-        public CGLOffScreenSurfaceData(CPlatformView pView,
-                                       CGLGraphicsConfig gc, int width, int height, Image image,
-                                       ColorModel cm, int type) {
-            super(pView, gc, cm, type, width, height);
+        private final Image offscreenImage;
+
+        private CGLOffScreenSurfaceData(CGLGraphicsConfig gc, int width,
+                                        int height, Image image,
+                                        ColorModel cm, int type) {
+            super(null, gc, cm, type, width, height);
             offscreenImage = image;
             initSurface(this.width, this.height);
         }
@@ -272,11 +169,6 @@
             return restoreContents(offscreenImage);
         }
 
-        @Override
-        public Rectangle getBounds() {
-            return new Rectangle(width, height);
-        }
-
         /**
          * Returns destination Image associated with this SurfaceData.
          */
--- a/src/java.desktop/macosx/classes/sun/lwawt/LWTextAreaPeer.java	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/macosx/classes/sun/lwawt/LWTextAreaPeer.java	Wed Jan 22 13:29:03 2020 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, 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
@@ -38,8 +38,11 @@
 import javax.swing.JScrollPane;
 import javax.swing.JTextArea;
 import javax.swing.ScrollPaneConstants;
+import javax.swing.TransferHandler;
 import javax.swing.text.Document;
 
+import sun.awt.AWTAccessor;
+
 /**
  * Lightweight implementation of {@link TextAreaPeer}. Delegates most of the
  * work to the {@link JTextArea} inside {@link JScrollPane}.
@@ -237,6 +240,17 @@
             public Point getLocationOnScreen() {
                 return LWTextAreaPeer.this.getLocationOnScreen();
             }
+
+            @Override
+            public void setTransferHandler(final TransferHandler newHandler) {
+                // override the default implementation to avoid loading
+                // SystemFlavorMap and associated classes
+                Object key = AWTAccessor.getClientPropertyKeyAccessor()
+                                        .getJComponent_TRANSFER_HANDLER();
+                Object oldHandler = getClientProperty(key);
+                putClientProperty(key, newHandler);
+                firePropertyChange("transferHandler", oldHandler, newHandler);
+            }
         }
     }
 }
--- a/src/java.desktop/macosx/classes/sun/lwawt/LWTextFieldPeer.java	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/macosx/classes/sun/lwawt/LWTextFieldPeer.java	Wed Jan 22 13:29:03 2020 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, 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
@@ -23,7 +23,6 @@
  * questions.
  */
 
-
 package sun.lwawt;
 
 import java.awt.Dimension;
@@ -37,6 +36,8 @@
 import javax.swing.*;
 import javax.swing.text.JTextComponent;
 
+import sun.awt.AWTAccessor;
+
 /**
  * Lightweight implementation of {@link TextFieldPeer}. Delegates most of the
  * work to the {@link JPasswordField}.
@@ -140,5 +141,16 @@
         public Point getLocationOnScreen() {
             return LWTextFieldPeer.this.getLocationOnScreen();
         }
+
+        @Override
+        public void setTransferHandler(final TransferHandler newHandler) {
+            // override the default implementation to avoid loading
+            // SystemFlavorMap and associated classes
+            Object key = AWTAccessor.getClientPropertyKeyAccessor()
+                                    .getJComponent_TRANSFER_HANDLER();
+            Object oldHandler = getClientProperty(key);
+            putClientProperty(key, newHandler);
+            firePropertyChange("transferHandler", oldHandler, newHandler);
+        }
     }
 }
--- a/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java	Wed Jan 22 13:29:03 2020 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, 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
@@ -324,7 +324,8 @@
     }
 
     protected final Graphics getOnscreenGraphics(Color fg, Color bg, Font f) {
-        if (getSurfaceData() == null) {
+        SurfaceData surfaceData = getSurfaceData();
+        if (surfaceData == null) {
             return null;
         }
         if (fg == null) {
@@ -336,7 +337,7 @@
         if (f == null) {
             f = DEFAULT_FONT;
         }
-        return new SunGraphics2D(getSurfaceData(), fg, bg, f);
+        return new SunGraphics2D(surfaceData, fg, bg, f);
     }
 
     @Override
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CMenu.java	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CMenu.java	Wed Jan 22 13:29:03 2020 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, 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
@@ -93,13 +93,6 @@
         super.setLabel(label);
     }
 
-    // Note that addSeparator is never called directly from java.awt.Menu,
-    // though it is required in the MenuPeer interface.
-    @Override
-    public final void addSeparator() {
-        execute(this::nativeAddSeparator);
-    }
-
     // Used by ScreenMenuBar to get to the native menu for event handling.
     public final long getNativeMenu() {
         return executeGet(this::nativeGetNSMenu);
@@ -110,7 +103,6 @@
                                          int insertionLocation);
     private native long nativeCreateSubMenu(long parentMenuPtr);
     private native void nativeSetMenuTitle(long menuPtr, String title);
-    private native void nativeAddSeparator(long menuPtr);
     private native void nativeDeleteItem(long menuPtr, int index);
 
     // Returns a retained NSMenu object! We have to explicitly
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformLWView.java	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformLWView.java	Wed Jan 22 13:29:03 2020 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, 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
@@ -25,8 +25,8 @@
 
 package sun.lwawt.macosx;
 
+import sun.java2d.SurfaceData;
 import sun.lwawt.LWWindowPeer;
-import sun.java2d.SurfaceData;
 
 public class CPlatformLWView extends CPlatformView {
 
@@ -45,11 +45,6 @@
     }
 
     @Override
-    public boolean isOpaque() {
-        return true;
-    }
-
-    @Override
     public void setBounds(int x, int y, int width, int height) {
     }
 
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java	Wed Jan 22 13:29:03 2020 +0530
@@ -184,8 +184,11 @@
             // It is necessary to use testCharIgnoringModifiers instead of testChar for event
             // generation in such case to avoid uppercase letters in text components.
             LWCToolkit lwcToolkit = (LWCToolkit)Toolkit.getDefaultToolkit();
-            if (lwcToolkit.getLockingKeyState(KeyEvent.VK_CAPS_LOCK) &&
-                    Locale.SIMPLIFIED_CHINESE.equals(lwcToolkit.getDefaultKeyboardLocale())) {
+            if ((lwcToolkit.getLockingKeyState(KeyEvent.VK_CAPS_LOCK) &&
+                    Locale.SIMPLIFIED_CHINESE.equals(lwcToolkit.getDefaultKeyboardLocale())) ||
+                (LWCToolkit.isLocaleUSInternationalPC(lwcToolkit.getDefaultKeyboardLocale()) &&
+                    LWCToolkit.isCharModifierKeyInUSInternationalPC(testChar) &&
+                    (testChar != testCharIgnoringModifiers))) {
                 testChar = testCharIgnoringModifiers;
             }
 
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformView.java	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformView.java	Wed Jan 22 13:29:03 2020 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, 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
@@ -25,19 +25,19 @@
 
 package sun.lwawt.macosx;
 
-import java.awt.*;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.awt.Point;
+import java.awt.Rectangle;
 import java.awt.geom.Rectangle2D;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicReference;
 
-import sun.awt.CGraphicsConfig;
 import sun.awt.CGraphicsEnvironment;
-import sun.lwawt.LWWindowPeer;
-
 import sun.java2d.SurfaceData;
 import sun.java2d.opengl.CGLLayer;
-import sun.java2d.opengl.CGLSurfaceData;
+import sun.lwawt.LWWindowPeer;
 
 public class CPlatformView extends CFRetainedResource {
     private native long nativeCreateView(int x, int y, int width, int height, long windowLayerPtr);
@@ -58,9 +58,7 @@
     public void initialize(LWWindowPeer peer, CPlatformResponder responder) {
         initializeBase(peer, responder);
 
-        if (!LWCToolkit.getSunAwtDisableCALayers()) {
-            this.windowLayer = createCGLayer();
-        }
+        this.windowLayer = createCGLayer();
         setPtr(nativeCreateView(0, 0, 0, 0, getWindowLayerPtr()));
     }
 
@@ -77,10 +75,6 @@
         return ptr;
     }
 
-    public boolean isOpaque() {
-        return !peer.isTranslucent();
-    }
-
     /*
      * All coordinates passed to the method should be based on the origin being in the bottom-left corner (standard
      * Cocoa coordinates).
@@ -94,10 +88,6 @@
         return peer.getBounds();
     }
 
-    public Object getDestination() {
-        return peer;
-    }
-
     public void setToolTip(String msg) {
         execute(ptr -> CWrapper.NSView.setToolTip(ptr, msg));
     }
@@ -106,47 +96,22 @@
     // PAINTING METHODS
     // ----------------------------------------------------------------------
     public SurfaceData replaceSurfaceData() {
-        if (!LWCToolkit.getSunAwtDisableCALayers()) {
-            surfaceData = windowLayer.replaceSurfaceData();
-        } else {
-            if (surfaceData == null) {
-                CGraphicsConfig graphicsConfig = (CGraphicsConfig)getGraphicsConfiguration();
-                surfaceData = graphicsConfig.createSurfaceData(this);
-            } else {
-                validateSurface();
-            }
-        }
+        surfaceData = windowLayer.replaceSurfaceData();
         return surfaceData;
     }
 
-    private void validateSurface() {
-        if (surfaceData != null) {
-            ((CGLSurfaceData)surfaceData).validate();
-        }
-    }
-
-    public GraphicsConfiguration getGraphicsConfiguration() {
-        return peer.getGraphicsConfiguration();
-    }
-
     public SurfaceData getSurfaceData() {
         return surfaceData;
     }
 
     @Override
     public void dispose() {
-        if (!LWCToolkit.getSunAwtDisableCALayers()) {
-            windowLayer.dispose();
-        }
+        windowLayer.dispose();
         super.dispose();
     }
 
     public long getWindowLayerPtr() {
-        if (!LWCToolkit.getSunAwtDisableCALayers()) {
-            return windowLayer.getPointer();
-        } else {
-            return 0;
-        }
+        return windowLayer.getPointer();
     }
 
     public void setAutoResizable(boolean toResize) {
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Wed Jan 22 13:29:03 2020 +0530
@@ -62,7 +62,6 @@
 import sun.awt.AWTAccessor.ComponentAccessor;
 import sun.awt.AWTAccessor.WindowAccessor;
 import sun.java2d.SurfaceData;
-import sun.java2d.opengl.CGLSurfaceData;
 import sun.lwawt.LWLightweightFramePeer;
 import sun.lwawt.LWToolkit;
 import sun.lwawt.LWWindowPeer;
@@ -354,8 +353,6 @@
                 }
             });
         }
-
-        validateSurface();
     }
 
     void initializeBase(Window target, LWWindowPeer peer, PlatformWindow owner) {
@@ -1051,13 +1048,6 @@
         return contentView.getWindowLayerPtr();
     }
 
-    private void validateSurface() {
-        SurfaceData surfaceData = getSurfaceData();
-        if (surfaceData instanceof CGLSurfaceData) {
-            ((CGLSurfaceData)surfaceData).validate();
-        }
-    }
-
     void flushBuffers() {
         if (isVisible() && !nativeBounds.isEmpty() && !isFullScreenMode) {
             try {
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Wed Jan 22 13:29:03 2020 +0530
@@ -119,7 +119,6 @@
 import sun.lwawt.PlatformDropTarget;
 import sun.lwawt.PlatformWindow;
 import sun.lwawt.SecurityWarningWindow;
-import sun.security.action.GetBooleanAction;
 
 @SuppressWarnings("serial") // JDK implementation class
 final class NamedCursor extends Cursor {
@@ -803,6 +802,23 @@
         return locale;
     }
 
+    public static boolean isLocaleUSInternationalPC(Locale locale) {
+        return (locale != null ?
+            locale.toString().equals("_US_UserDefined_15000") : false);
+    }
+
+    public static boolean isCharModifierKeyInUSInternationalPC(char ch) {
+        // 5 characters: APOSTROPHE, QUOTATION MARK, ACCENT GRAVE, SMALL TILDE,
+        // CIRCUMFLEX ACCENT
+        final char[] modifierKeys = {'\'', '"', '`', '\u02DC', '\u02C6'};
+        for (char modKey : modifierKeys) {
+            if (modKey == ch) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     @Override
     public InputMethodDescriptor getInputMethodAdapterDescriptor() {
         if (sInputMethodDescriptor == null)
@@ -853,20 +869,6 @@
         return false;
     }
 
-    private static Boolean sunAwtDisableCALayers = null;
-
-    /**
-     * Returns the value of "sun.awt.disableCALayers" property. Default
-     * value is {@code false}.
-     */
-    public static synchronized boolean getSunAwtDisableCALayers() {
-        if (sunAwtDisableCALayers == null) {
-            sunAwtDisableCALayers = AccessController.doPrivileged(
-                new GetBooleanAction("sun.awt.disableCALayers"));
-        }
-        return sunAwtDisableCALayers;
-    }
-
     /*
      * Returns true if the application (one of its windows) owns keyboard focus.
      */
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenu.h	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenu.h	Wed Jan 22 13:29:03 2020 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, 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
@@ -45,7 +45,6 @@
 - (void)setJavaMenuTitle:(NSString *)title;
 - (void)deleteJavaItem:(jint)index;
 - (void)addNSMenuItemToMenu:(NSMenu *)inMenu;
-- (void)addSeparator;
 
 // Accessors
 - (NSMenu *)menu;
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenu.m	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenu.m	Wed Jan 22 13:29:03 2020 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, 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
@@ -86,10 +86,6 @@
     }
 }
 
-- (void)addSeparator {
-    // Nothing calls this, which is good because we need a CMenuItem here.
-}
-
 - (void)deleteJavaItem:(jint)index {
 
     [ThreadUtilities performOnMainThread:@selector(deleteNativeJavaItem_OnAppKitThread:) on:self withObject:[NSNumber numberWithInt:index] waitUntilDone:YES];
@@ -225,21 +221,6 @@
 
 /*
  * Class:     sun_lwawt_macosx_CMenu
- * Method:    nativeAddSeparator
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL
-Java_sun_lwawt_macosx_CMenu_nativeAddSeparator
-(JNIEnv *env, jobject peer, jlong menuObject)
-{
-JNF_COCOA_ENTER(env);
-    // Add a separator item.
-    [((CMenu *)jlong_to_ptr(menuObject))addSeparator];
-JNF_COCOA_EXIT(env);
-}
-
-/*
- * Class:     sun_lwawt_macosx_CMenu
  * Method:    nativeDeleteItem
  * Signature: (JI)V
  */
--- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLSurfaceData.m	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLSurfaceData.m	Wed Jan 22 13:29:03 2020 +0530
@@ -400,38 +400,3 @@
     cglsdo->peerData = NULL;
     cglsdo->layer = NULL;
 }
-
-#pragma mark -
-#pragma mark "--- CGLSurfaceData methods - Mac OS X specific ---"
-
-// Must be called on the QFT...
-JNIEXPORT void JNICALL
-Java_sun_java2d_opengl_CGLSurfaceData_validate
-    (JNIEnv *env, jobject jsurfacedata,
-     jint xoff, jint yoff, jint width, jint height, jboolean isOpaque)
-{
-    J2dTraceLn2(J2D_TRACE_INFO, "CGLSurfaceData_validate: w=%d h=%d", width, height);
-
-    OGLSDOps *oglsdo = (OGLSDOps*)SurfaceData_GetOps(env, jsurfacedata);
-    oglsdo->needsInit = JNI_TRUE;
-    oglsdo->xOffset = xoff;
-    oglsdo->yOffset = yoff;
-
-    oglsdo->width = width;
-    oglsdo->height = height;
-    oglsdo->isOpaque = isOpaque;
-
-    if (oglsdo->drawableType == OGLSD_WINDOW) {
-        OGLContext_SetSurfaces(env, ptr_to_jlong(oglsdo), ptr_to_jlong(oglsdo));
-
-        // we have to explicitly tell the NSOpenGLContext that its target
-        // drawable has changed size
-        CGLSDOps *cglsdo = (CGLSDOps *)oglsdo->privOps;
-        OGLContext *oglc = cglsdo->configInfo->context;
-        CGLCtxInfo *ctxinfo = (CGLCtxInfo *)oglc->ctxInfo;
-
-JNF_COCOA_ENTER(env);
-        [ctxinfo->context update];
-JNF_COCOA_EXIT(env);
-    }
-}
--- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java	Wed Jan 22 13:29:03 2020 +0530
@@ -312,7 +312,7 @@
             "com.sun.java.swing.plaf.gtk.GTKPainter$ListTableFocusBorder",
             "getNoFocusCellBorder");
 
-        GTKStyleFactory factory = (GTKStyleFactory)getStyleFactory();
+        SynthStyleFactory factory = getStyleFactory();
         GTKStyle tableStyle = (GTKStyle)factory.getStyle(null, Region.TREE);
         Color tableBg = tableStyle.getGTKColor(SynthConstants.ENABLED,
                 GTKColorType.TEXT_BACKGROUND);
@@ -505,7 +505,7 @@
                 this.region = region;
             }
             public Object createValue(UIDefaults table) {
-                GTKStyleFactory factory = (GTKStyleFactory)getStyleFactory();
+                SynthStyleFactory factory = getStyleFactory();
                 GTKStyle style = (GTKStyle)factory.getStyle(null, region);
                 return style.getDefaultFont();
             }
@@ -1305,7 +1305,7 @@
     }
 
     protected void initSystemColorDefaults(UIDefaults table) {
-        GTKStyleFactory factory = (GTKStyleFactory)getStyleFactory();
+        SynthStyleFactory factory = getStyleFactory();
         GTKStyle windowStyle =
                 (GTKStyle)factory.getStyle(null, Region.INTERNAL_FRAME);
         table.put("window", windowStyle.getGTKColor(SynthConstants.ENABLED,
--- a/src/java.desktop/share/classes/java/awt/Robot.java	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/share/classes/java/awt/Robot.java	Wed Jan 22 13:29:03 2020 +0530
@@ -642,20 +642,25 @@
 
     /**
      * Sleeps for the specified time.
-     * To catch any {@code InterruptedException}s that occur,
-     * {@code Thread.sleep()} may be used instead.
+     * <p>
+     * If the invoking thread is interrupted while waiting, then it will return
+     * immediately with the interrupt status set. If the interrupted status is
+     * already set, this method returns immediately with the interrupt status
+     * set.
      *
      * @param  ms time to sleep in milliseconds
-     * @throws IllegalArgumentException if {@code ms}
-     *         is not between 0 and 60,000 milliseconds inclusive
-     * @see java.lang.Thread#sleep
+     * @throws IllegalArgumentException if {@code ms} is not between {@code 0}
+     *         and {@code 60,000} milliseconds inclusive
      */
-    public synchronized void delay(int ms) {
+    public void delay(int ms) {
         checkDelayArgument(ms);
-        try {
-            Thread.sleep(ms);
-        } catch(InterruptedException ite) {
-            ite.printStackTrace();
+        Thread thread = Thread.currentThread();
+        if (!thread.isInterrupted()) {
+            try {
+                Thread.sleep(ms);
+            } catch (final InterruptedException ignored) {
+                thread.interrupt(); // Preserve interrupt status
+            }
         }
     }
 
--- a/src/java.desktop/share/classes/java/awt/peer/MenuPeer.java	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/share/classes/java/awt/peer/MenuPeer.java	Wed Jan 22 13:29:03 2020 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2019, 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
@@ -39,13 +39,6 @@
 public interface MenuPeer extends MenuItemPeer {
 
     /**
-     * Adds a separator (e.g. a horizontal line or similar) to the menu.
-     *
-     * @see Menu#addSeparator()
-     */
-    void addSeparator();
-
-    /**
      * Adds the specified menu item to the menu.
      *
      * @param item the menu item to add
--- a/src/java.desktop/share/classes/javax/swing/Timer.java	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/share/classes/javax/swing/Timer.java	Wed Jan 22 13:29:03 2020 +0530
@@ -124,13 +124,6 @@
  * <a href="https://docs.oracle.com/javase/tutorial/uiswing/misc/timer.html"
  * target = "_top">How to Use Timers</a>,
  * a section in <em>The Java Tutorial.</em>
- * For more examples and help in choosing between
- * this <code>Timer</code> class and
- * <code>java.util.Timer</code>,
- * see
- * <a href="http://java.sun.com/products/jfc/tsc/articles/timer/"
- * target="_top">Using Timers in Swing Applications</a>,
- * an article in <em>The Swing Connection.</em>
  * <p>
  * <strong>Warning:</strong>
  * Serialized objects of this class will not be compatible with
--- a/src/java.desktop/share/classes/javax/swing/text/Document.java	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/share/classes/javax/swing/text/Document.java	Wed Jan 22 13:29:03 2020 +0530
@@ -165,11 +165,182 @@
  * <li>{@link #putProperty(java.lang.Object, java.lang.Object)}
  * </ul>
  *
- * <p>For more information on the <code>Document</code> class, see
- * <a href="http://www.oracle.com/technetwork/java/javase/tech/articles-jsp-139072.html">The Swing Connection</a>
- * and most particularly the article,
- * <a href="http://java.sun.com/products/jfc/tsc/articles/text/element_interface">
- * The Element Interface</a>.
+ * <p><b>Overview and Programming Tips</b>
+ * <p><u>{@link javax.swing.text.Element}</u> is an important interface used in constructing a Document.
+ * It has the power to describe various structural parts of a document,
+ * such as paragraphs, lines of text, or even (in HTML documents) items in lists.
+ * Conceptually, the Element interface captures some of the spirit of an SGML document.
+ * So if you know SGML, you may already have some understanding of Swing's Element interface.
+ * <p>In the Swing text API's document model, the interface Element defines a structural piece of a Document,
+ * like a paragraph, a line of text, or a list item in an HTML document.
+ * <p>Every Element is either a <i>branch</i> or a <i>leaf</i>. If an element is a branch,
+ * the <code>isLeaf()</code> method returns false. If an element is a a leaf, <code>isLeaf()</code> returns true.
+ * <p>Branches can have any number of children. Leaves do not have children.
+ * To determine how many children a branch has, you can call <code>getElementCount()</code>.
+ * To determine the parent of an Element, you can call <code>getParentElement()</code>.
+ * Root elements don't have parents, so calling <code>getParentElement()</code> on a root returns null.
+ * <p>An Element represents a specific region in a Document that begins with startOffset
+ * and ends just before endOffset.
+ * The start offset of a branch Element is usually the start offset of its first child.
+ * Similarly, the end offset of a branch Element is usually the end offset of its last child.
+ * <p>Every Element is associated with an AttributeSet that you can access by calling <code>getAttributes()</code>.
+ * In an Element, and AttributeSet is essentially a set of key/value pairs.
+ * These pairs are generally used for markup -- such as determining the Element's
+ * foreground color, font size, and so on. But it is up to the model, and the developer,
+ * to determine what is stored in the AttributeSet.
+ * <p>You can obtain the root Element (or Elements) of a Document by calling the
+ * methods <code>getDefaultRootElement()</code> and <code>getRootElements()</code>, which are defined in the Document interface.
+ * <p>The Document interface is responsible for translating a linear view of the
+ * characters into Element operations. It is up to each Document implementation
+ * to define what the Element structure is.
+ *
+ * <p><b>The PlainDocument class</b>
+ * <p>The <u>{@link javax.swing.text.PlainDocument}</u> class defines an Element
+ * structure in which the root node has a child node for each line of text in the model.
+ * <u>Figure 1</u> shows how two lines of text would be modeled by a PlainDocument
+ * <p style="text-align:center"><img src="doc-files/plain1.gif"
+ * alt="The preceding text describes this graphic.">
+ * <p><u>Figure 2</u> shows how how those same two lines of text might map to actual content:
+ * <p style="text-align:center"><img src="doc-files/plain2.gif"
+ * alt="The preceding text describes this graphic.">
+ *
+ * <p><b>Inserting text into a PlainDocument</b>
+ * <p>As just mentioned, a PlainDocument contains a root Element, which in turn
+ * contains an Element for each line of text.
+ * When text is inserted into a PlainDocument, it creates the Elements that
+ * are needed for an Element to exist for each newline.
+ * To illustrate, let's say you wanted to insert a newline at offset 2 in <u>Figure 2</u>, above.
+ * To accomplish this objective, you could use the Document method <code>insertString()</code>,
+ * using this syntax:
+ * <pre><code>document.insertString(2, "\n", null);</code></pre>
+ * <p>After invoking the <code>insertString()</code> method, the Element structure would look
+ * like the one shown in <u>Figure 3</u>.
+ * <p style="text-align:center"><img src="doc-files/plain3.gif"
+ * alt="The preceding text describes this graphic.">
+ * <p>As another example, let's say you wanted to insert the pattern "new\ntext\n"
+ * at offset 2 as shown previously in <u>Figure 2</u>. This operation would have the
+ * result shown in <u>Figure 4</u>.
+ * <p style="text-align:center"><img src="doc-files/plain4.gif"
+ * alt="The preceding text describes this graphic.">
+ * <p>In the preceding illustrations, the name of the line Elements is changed
+ * after the insertion to match the line numbers.
+ * But notice that when this is done, the AttributeSets remain the same.
+ * For example, in <u>Figure 2</u>, the AttributeSet of Line 2 matches that of the
+ * AttributeSet of Line 4 in <u>Figure 4</u>.
+ *
+ * <p><b>Removing text from a PlainDocument</b>
+ * <p>Removal of text results in a structure change if the deletion spans more than one line.
+ * Consider a deletion of seven characters starting at Offset 1 shown previously in <u>Figure 3</u>.
+ * In this case, the Element representing Line 2 is completely removed, as the
+ * region it represents is contained in the deleted region.
+ * The Elements representing Lines 1 and 3 are joined, as they are partially
+ * contained in the deleted region. Thus, we have the result:
+ * <p style="text-align:center"><img src="doc-files/plain5.gif"
+ * alt="The preceding text describes this graphic.">
+ *
+ * <p><b>The Default StyledDocument Class</b>
+ * <p>The <u>{@link javax.swing.text.DefaultStyledDocument}</u> class, used for styled text,
+ * contains another level of Elements.
+ * This extra level is needed so that each paragraph can contain different styles of text.
+ * In the two paragraphs shown in <u>Figure 6</u>, the first paragraph contains
+ * two styles and the second paragraph contains three styles.
+ * <p style="text-align:center"><img src="doc-files/plain6.gif"
+ * alt="The preceding text describes this graphic.">
+ * <p><u>Figure 7</u> shows how those same Elements might map to content.
+ * <p style="text-align:center"><img src="doc-files/plain7.gif"
+ * alt="The preceding text describes this graphic.">
+ *
+ * <p><b>Inserting text into a DefaultStyledDocument</b>
+ * <p>As previously mentioned, DefaultStyledDocument maintains an Element structure
+ * such that the root Element
+ * contains a child Element for each paragraph. In turn, each of these
+ * paragraph Elements contains an Element for each style of text in the paragraph.
+ * As an example, let's say you had a document containing one paragraph,
+ * and that this paragraph contained two styles, as shown in <u>Figure 8</u>.
+ * <p style="text-align:center"><img src="doc-files/plain8.gif"
+ * alt="The preceding text describes this graphic.">
+ * <p>If you then wanted to insert a newline at offset 2, you would again use the
+ * method <code>insertString()</code>, as follows:
+ *
+ *  <pre><code> styledDocument.insertString(2, "\n",
+                styledDocument.getCharacterElement(0).getAttributes());</code></pre>
+
+ * <p>This operation would have the result shown in <u>Figure 9</u>.
+ * <p style="text-align:center"><img src="doc-files/plain9.gif"
+ * alt="The preceding text describes this graphic.">
+ * <p>It's important to note that the AttributeSet passed to <code>insertString()</code> matches
+ * that of the attributes of Style 1. If the AttributeSet passed to <code>insertString()</code>
+ *  did not match, the result would be the situation shown in <u>Figure 10</u>.
+ * <p style="text-align:center"><img src="doc-files/plain10.gif"
+ * alt="The preceding text describes this graphic.">
+ * <p><b>Removing text from a DefaultStyledDocument</b>
+ * <p>Removing text from a DefaultStyledDocument is similar to removing text from
+ * a PlainDocument. The only difference is the extra level of Elements.
+ * Consider what would happen if you deleted two characters at Offset 1
+ * from Figure 10, above. Since the the second Element of Paragraph 1 is
+ * completely contained in the deleted region, it would be removed.
+ * Assuming the attributes of Paragraph 1's first child matched those of
+ * Paragraph2's first child, the results would be those shown in <u>Figure 11</u>.
+ * <p style="text-align:center"><img src="doc-files/plain11.gif"
+ * alt="The preceding text describes this graphic.">
+ * <p>If the attributes did not match, we would get the results shown in <u>Figure 12</u>.
+ * <p style="text-align:center"><img src="doc-files/plain12.gif"
+ * alt="The preceding text describes this graphic.">
+ *
+ * <p><b>The StyledDocument Class</b>
+ * <p>The <u>{@link javax.swing.text.StyledDocument}</u> class provides a method
+ * named <code>setCharacterAttributes()</code>, which allows you to set the attributes
+ * on the character Elements in a given range:
+
+ *   <pre><code> public void setCharacterAttributes
+ *          (int offset, int length, AttributeSet s, boolean replace);</code></pre>
+ *
+ * <p>Recall that in the diagrams shown in the previous section, all leaf Elements
+ * shown in the drawings were also character Elements.
+ * That means that the <code>setCharacterAttributes()</code> method could be used to set their attributes.
+ * <p>The <code>setCharacterAttributes()</code> method takes four arguments .
+ * The first and second arguments identify a region in the Document that is
+ * to be changed. The third argument specifies the new attributes
+ * (as an AttributeSet), and the fourth argument determines if the new attributes
+ * should be added to the existing attributes (a value of false) or
+ * if the character Element should replace its existing attributes
+ * with the new attributes (a value of true).
+ * <p>As an example, let's say you wanted to change the attributes of the
+ * first three characters in <u>Figure 9</u>, shown previously.
+ * The first two arguments passed to <code>setCharacterAttributes()</code> would be 0 and 3.
+ * The third argument would be the AttributeSet containing the new attributes.
+ * In the example we are considering, it doesn't matter what the fourth argument is.
+ * <p>As the start and end offsets of the changed region (0 and 3) fall on
+ * character Element boundaries, no structure change is needed.
+ * That is, only the attributes of the character Element style 1 will change.
+ * <p>Now let's look at an example that requires a structure change.
+ * Instead of changing the first three characters shown in <u>Figure 9</u>,
+ * let's change the first two characters.
+ * Because the end change offset (2) does not fall on a character Element boundary,
+ * the Element at offset 2 must be split in such a way
+ * that offset 2 is the boundary of two Elements.
+ * Invoking <code>setCharacterAttributes()</code> with a start offset of 0
+ * and length of 2 has the result shown earlier in <u>Figure 10</u>.
+ * <p><b>Changing Paragraph Attributes in a StyledDocument</b>
+ * <p>The StyledDocument class provides a method named <code>setParagraphAttributes()</code>,
+ * which can be used to change the attributes of a paragraph Element:
+
+ *   <pre><code> public void setParagraphAttributes
+ *         (int offset, int length, AttributeSet s, boolean replace);</code></pre>
+ *
+ *  <p>This method is similar to <code>setCharacterAttributes()</code>,
+ *  but it allows you to change the attributes of paragraph Elements.
+ *  It is up to the implementation of a StyledDocument to define which Elements
+ *  are paragraphs. DefaultStyledDocument interprets paragraph Elements
+ *  to be the parent Element of the character Element.
+ *  Invoking this method does not result in a structure change;
+ *  only the attributes of the paragraph Element change.
+ *
+ * <p>It is recommended to look into {@link javax.swing.text.EditorKit} and
+ * {@link javax.swing.text.View}.
+ * View is responsible for rendering a particular Element, and
+ * EditorKit is responsible for a ViewFactory that is able to decide what
+ * View should be created based on an Element.
  *
  * @author  Timothy Prinzing
  *
Binary file src/java.desktop/share/classes/javax/swing/text/doc-files/plain1.gif has changed
Binary file src/java.desktop/share/classes/javax/swing/text/doc-files/plain10.gif has changed
Binary file src/java.desktop/share/classes/javax/swing/text/doc-files/plain11.gif has changed
Binary file src/java.desktop/share/classes/javax/swing/text/doc-files/plain12.gif has changed
Binary file src/java.desktop/share/classes/javax/swing/text/doc-files/plain2.gif has changed
Binary file src/java.desktop/share/classes/javax/swing/text/doc-files/plain3.gif has changed
Binary file src/java.desktop/share/classes/javax/swing/text/doc-files/plain4.gif has changed
Binary file src/java.desktop/share/classes/javax/swing/text/doc-files/plain5.gif has changed
Binary file src/java.desktop/share/classes/javax/swing/text/doc-files/plain6.gif has changed
Binary file src/java.desktop/share/classes/javax/swing/text/doc-files/plain7.gif has changed
Binary file src/java.desktop/share/classes/javax/swing/text/doc-files/plain8.gif has changed
Binary file src/java.desktop/share/classes/javax/swing/text/doc-files/plain9.gif has changed
--- a/src/java.desktop/share/classes/javax/swing/text/html/CSS.java	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/share/classes/javax/swing/text/html/CSS.java	Wed Jan 22 13:29:03 2020 +0530
@@ -2521,7 +2521,7 @@
             } catch (NumberFormatException nfe) {
                 // Not pixels, use LengthUnit
                 LengthUnit lu = new LengthUnit(value,
-                                               LengthUnit.UNINITALIZED_LENGTH,
+                                               LengthUnit.UNINITIALIZED_LENGTH,
                                                0);
 
                 // PENDING: currently, we only support absolute values and
@@ -2855,25 +2855,25 @@
         static Hashtable<String, Float> lengthMapping = new Hashtable<String, Float>(6);
         static Hashtable<String, Float> w3cLengthMapping = new Hashtable<String, Float>(6);
         static {
-            lengthMapping.put("pt", Float.valueOf(1f));
-            // Not sure about 1.3, determined by experiementation.
-            lengthMapping.put("px", Float.valueOf(1.3f));
-            lengthMapping.put("mm", Float.valueOf(2.83464f));
-            lengthMapping.put("cm", Float.valueOf(28.3464f));
-            lengthMapping.put("pc", Float.valueOf(12f));
-            lengthMapping.put("in", Float.valueOf(72f));
+            lengthMapping.put("pt", 1f);
+            // Not sure about 1.3, determined by experimentation.
+            lengthMapping.put("px", 1.3f);
+            lengthMapping.put("mm", 2.83464f);
+            lengthMapping.put("cm", 28.3464f);
+            lengthMapping.put("pc", 12f);
+            lengthMapping.put("in", 72f);
             int res = 72;
             try {
                 res = Toolkit.getDefaultToolkit().getScreenResolution();
             } catch (HeadlessException e) {
             }
             // mapping according to the CSS2 spec
-            w3cLengthMapping.put("pt", Float.valueOf(res/72f));
-            w3cLengthMapping.put("px", Float.valueOf(1f));
-            w3cLengthMapping.put("mm", Float.valueOf(res/25.4f));
-            w3cLengthMapping.put("cm", Float.valueOf(res/2.54f));
-            w3cLengthMapping.put("pc", Float.valueOf(res/6f));
-            w3cLengthMapping.put("in", Float.valueOf((float)res));
+            w3cLengthMapping.put("pt", res / 72f);
+            w3cLengthMapping.put("px", 1f);
+            w3cLengthMapping.put("mm", res / 25.4f);
+            w3cLengthMapping.put("cm", res / 2.54f);
+            w3cLengthMapping.put("pc", res / 6f);
+            w3cLengthMapping.put("in", (float) res);
         }
 
         LengthUnit(String value, short defaultType, float defaultValue) {
@@ -2885,21 +2885,22 @@
             this.value = defaultValue;
 
             int length = value.length();
-            if (length > 0 && value.charAt(length - 1) == '%') {
+            if (length < 1) {
+                return;
+            }
+            if (value.charAt(length - 1) == '%') {
                 try {
-                    this.value = Float.valueOf(value.substring(0, length - 1)).
-                                               floatValue() / 100.0f;
+                    this.value = Float.parseFloat(value.substring(0, length - 1)) / 100.0f;
                     type = 1;
                 }
                 catch (NumberFormatException nfe) { }
             }
-            if (length >= 2) {
+            else if (length >= 2) {
                 units = value.substring(length - 2, length);
                 Float scale = lengthMapping.get(units);
                 if (scale != null) {
                     try {
-                        this.value = Float.valueOf(value.substring(0,
-                               length - 2)).floatValue();
+                        this.value = Float.parseFloat(value.substring(0, length - 2));
                         type = 0;
                     }
                     catch (NumberFormatException nfe) { }
@@ -2907,32 +2908,31 @@
                 else if (units.equals("em") ||
                          units.equals("ex")) {
                     try {
-                        this.value = Float.valueOf(value.substring(0,
-                                      length - 2)).floatValue();
+                        this.value = Float.parseFloat(value.substring(0, length - 2));
                         type = 3;
                     }
                     catch (NumberFormatException nfe) { }
                 }
                 else if (value.equals("larger")) {
-                    this.value = 2f;
+                    this.value = 2.f;
                     type = 2;
                 }
                 else if (value.equals("smaller")) {
-                    this.value = -2;
+                    this.value = -2.f;
                     type = 2;
                 }
                 else {
                     // treat like points.
                     try {
-                        this.value = Float.valueOf(value).floatValue();
+                        this.value = Float.parseFloat(value);
                         type = 0;
                     } catch (NumberFormatException nfe) {}
                 }
             }
-            else if (length > 0) {
+            else {
                 // treat like points.
                 try {
-                    this.value = Float.valueOf(value).floatValue();
+                    this.value = Float.parseFloat(value);
                     type = 0;
                 } catch (NumberFormatException nfe) {}
             }
@@ -2978,7 +2978,7 @@
         String units = null;
 
 
-        static final short UNINITALIZED_LENGTH = (short)10;
+        static final short UNINITIALIZED_LENGTH = (short)10;
     }
 
 
--- a/src/java.desktop/share/classes/javax/swing/text/html/ImageView.java	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/share/classes/javax/swing/text/html/ImageView.java	Wed Jan 22 13:29:03 2020 +0530
@@ -783,6 +783,22 @@
                 newState |= HEIGHT_FLAG;
             }
 
+            Image img;
+            synchronized(this) {
+                img = image;
+            }
+            if (newWidth <= 0) {
+                newWidth = img.getWidth(imageObserver);
+                if (newWidth <= 0) {
+                    newWidth = DEFAULT_WIDTH;
+                }
+            }
+            if (newHeight <= 0) {
+                newHeight = img.getHeight(imageObserver);
+                if (newHeight <= 0) {
+                    newHeight = DEFAULT_HEIGHT;
+                }
+            }
             /*
             If synchronous loading flag is set, then make sure that the image is
             scaled appropriately.
@@ -790,18 +806,10 @@
             appropriately.
             */
             if (getLoadsSynchronously()) {
-                Image img;
-                synchronized(this) {
-                    img = image;
-                }
-                int w = img.getWidth(imageObserver);
-                int h = img.getHeight(imageObserver);
-                if (w > 0 && h > 0) {
-                    Dimension d = adjustWidthHeight(w, h);
-                    newWidth = d.width;
-                    newHeight = d.height;
-                    newState |= (WIDTH_FLAG | HEIGHT_FLAG);
-                }
+                Dimension d = adjustWidthHeight(newWidth, newHeight);
+                newWidth = d.width;
+                newHeight = d.height;
+                newState |= (WIDTH_FLAG | HEIGHT_FLAG);
             }
 
             // Make sure the image starts loading:
--- a/src/java.desktop/share/classes/sun/font/PhysicalFont.java	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/share/classes/sun/font/PhysicalFont.java	Wed Jan 22 13:29:03 2020 +0530
@@ -41,12 +41,19 @@
     protected Object nativeNames;
 
     public boolean equals(Object o) {
-        return (o != null && o.getClass() == this.getClass() &&
-                ((Font2D)o).fullName.equals(this.fullName));
+        if (o == null || o.getClass() != this.getClass()) {
+            return false;
+        }
+        PhysicalFont other = (PhysicalFont)o;
+        return
+           (this.fullName.equals(other.fullName)) &&
+            ((this.platName == null && other.platName == null) ||
+             (this.platName != null && this.platName.equals(other.platName)));
     }
 
     public int hashCode() {
-        return fullName.hashCode();
+        return fullName.hashCode() +
+               (platName != null ? platName.hashCode() : 0);
     }
 
     /**
--- a/src/java.desktop/share/native/libfontmanager/freetypeScaler.c	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/share/native/libfontmanager/freetypeScaler.c	Wed Jan 22 13:29:03 2020 +0530
@@ -958,11 +958,11 @@
     }
 
     if (context->fmType == TEXT_FM_ON) {
-        double advh = FTFixedToFloat(ftglyph->linearHoriAdvance);
+        float advh = FTFixedToFloat(ftglyph->linearHoriAdvance);
         glyphInfo->advanceX =
             (float) (advh * FTFixedToFloat(context->transform.xx));
         glyphInfo->advanceY =
-            (float) (advh * FTFixedToFloat(context->transform.xy));
+            (float) - (advh * FTFixedToFloat(context->transform.yx));
     } else {
         if (!ftglyph->advance.y) {
             glyphInfo->advanceX =
--- a/src/java.desktop/unix/classes/sun/awt/X11/XMenuPeer.java	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XMenuPeer.java	Wed Jan 22 13:29:03 2020 +0530
@@ -59,6 +59,7 @@
      * to its container window. Creates submenu window
      * that fills its items vector while construction
      */
+    @Override
     void setContainer(XBaseMenuWindow container) {
         super.setContainer(container);
         menuWindow = new XMenuWindow(this);
@@ -78,6 +79,7 @@
     /**
      * Disposes menu window if needed
      */
+    @Override
     public void dispose() {
         if (menuWindow != null) {
             menuWindow.dispose();
@@ -89,6 +91,7 @@
      * Resets text metrics for this item, for its menu window
      * and for all descendant menu windows
      */
+    @Override
     public void setFont(Font font) {
         //TODO:We can decrease count of repaints here
         //and get rid of recursion
@@ -105,17 +108,7 @@
     /*
      * From MenuPeer
      */
-    /**
-     * addSeparator routines are not used
-     * in peers. Shared code invokes addItem("-")
-     * for adding separators
-     */
-    public void addSeparator() {
-        if (log.isLoggable(PlatformLogger.Level.FINER)) {
-            log.finer("addSeparator is not implemented");
-        }
-    }
-
+    @Override
     public void addItem(MenuItem item) {
         XMenuWindow menuWindow = getMenuWindow();
         if (menuWindow != null) {
@@ -127,6 +120,7 @@
         }
     }
 
+    @Override
     public void delItem(int index) {
         XMenuWindow menuWindow = getMenuWindow();
         if (menuWindow != null) {
@@ -152,12 +146,14 @@
      * Overriden behaviour
      *
      ************************************************/
+    @Override
     boolean isSeparator() {
         return false;
     }
 
     //Fix for 6180416: Shortcut keys are displayed against Menus on XToolkit
     //Menu should always return null as shortcutText
+    @Override
     String getShortcutText() {
         return null;
     }
--- a/src/java.desktop/unix/classes/sun/awt/X11/XPopupMenuPeer.java	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XPopupMenuPeer.java	Wed Jan 22 13:29:03 2020 +0530
@@ -79,6 +79,7 @@
     /*
      * From MenuComponentPeer
      */
+    @Override
     public void setFont(Font f) {
         resetMapping();
         setItemsFont(f);
@@ -88,33 +89,22 @@
     /*
      * From MenuItemPeer
      */
+    @Override
     public void setLabel(String label) {
         resetMapping();
         postPaintEvent();
     }
 
 
+    @Override
     public void setEnabled(boolean enabled) {
         postPaintEvent();
     }
 
     /*
-     * From MenuPeer
-     */
-    /**
-     * addSeparator routines are not used
-     * in peers. Shared code invokes addItem("-")
-     * for adding separators
-     */
-    public void addSeparator() {
-        if (log.isLoggable(PlatformLogger.Level.FINER)) {
-            log.finer("addSeparator is not implemented");
-        }
-    }
-
-    /*
      * From PopupMenuPeer
      */
+    @Override
     @SuppressWarnings("deprecation")
     public void show(Event e) {
         target = (Component)e.target;
@@ -173,6 +163,7 @@
         return AWTAccessor.getMenuItemAccessor().isEnabled(popupMenuTarget);
     }
 
+    @Override
     Vector<MenuItem> getMenuTargetItems() {
         if (popupMenuTarget == null) {
             return null;
@@ -231,6 +222,7 @@
      * Returns height of menu window's caption.
      * Can be overriden for popup menus and tear-off menus
      */
+    @Override
     protected Dimension getCaptionSize() {
         String s = getTargetLabel();
         if (s.isEmpty()) {
@@ -258,6 +250,7 @@
      * Can be overriden for popup menus and tear-off menus.
      * Default implementation does nothing
      */
+    @Override
     protected void paintCaption(Graphics g, Rectangle rect) {
         String s = getTargetLabel();
         if (s.isEmpty()) {
@@ -280,11 +273,13 @@
      * Overriden XBaseMenuWindow functions
      *
      ************************************************/
+    @Override
     protected void doDispose() {
         super.doDispose();
         XToolkit.targetDisposedPeer(popupMenuTarget, this);
     }
 
+    @Override
     protected void handleEvent(AWTEvent event) {
         switch(event.getID()) {
         case MouseEvent.MOUSE_PRESSED:
@@ -311,6 +306,7 @@
      * Overriden XWindow general-purpose functions
      *
      ************************************************/
+    @Override
     void ungrabInputImpl() {
         hide();
     }
@@ -326,6 +322,7 @@
      * Now we override this function do disable F10 explicit
      * processing. All processing is done using KeyEvent.
      */
+    @Override
     public void handleKeyPress(XEvent xev) {
         XKeyEvent xkey = xev.get_xkey();
         if (log.isLoggable(PlatformLogger.Level.FINE)) {
--- a/src/java.desktop/unix/classes/sun/awt/X11/XTextAreaPeer.java	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XTextAreaPeer.java	Wed Jan 22 13:29:03 2020 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, 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
@@ -971,17 +971,14 @@
             setUI(ui);
         }
 
-        // Fix for 4915454 - override the default implementation to avoid
-        // loading SystemFlavorMap and associated classes.
         @Override
-        public void setTransferHandler(TransferHandler newHandler) {
-            TransferHandler oldHandler = (TransferHandler)
-                getClientProperty(AWTAccessor.getClientPropertyKeyAccessor()
-                                      .getJComponent_TRANSFER_HANDLER());
-            putClientProperty(AWTAccessor.getClientPropertyKeyAccessor()
-                                  .getJComponent_TRANSFER_HANDLER(),
-                              newHandler);
-
+        public void setTransferHandler(final TransferHandler newHandler) {
+            // override the default implementation to avoid loading
+            // SystemFlavorMap and associated classes
+            Object key = AWTAccessor.getClientPropertyKeyAccessor()
+                                    .getJComponent_TRANSFER_HANDLER();
+            Object oldHandler = getClientProperty(key);
+            putClientProperty(key, newHandler);
             firePropertyChange("transferHandler", oldHandler, newHandler);
         }
     }
--- a/src/java.desktop/unix/classes/sun/awt/X11/XTextFieldPeer.java	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XTextFieldPeer.java	Wed Jan 22 13:29:03 2020 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, 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
@@ -642,17 +642,14 @@
             processMouseMotionEvent(e);
         }
 
-        // Fix for 4915454 - override the default implementation to avoid
-        // loading SystemFlavorMap and associated classes.
         @Override
-        public void setTransferHandler(TransferHandler newHandler) {
-            TransferHandler oldHandler = (TransferHandler)
-                getClientProperty(AWTAccessor.getClientPropertyKeyAccessor()
-                                      .getJComponent_TRANSFER_HANDLER());
-            putClientProperty(AWTAccessor.getClientPropertyKeyAccessor()
-                                  .getJComponent_TRANSFER_HANDLER(),
-                              newHandler);
-
+        public void setTransferHandler(final TransferHandler newHandler) {
+            // override the default implementation to avoid loading
+            // SystemFlavorMap and associated classes
+            Object key = AWTAccessor.getClientPropertyKeyAccessor()
+                                    .getJComponent_TRANSFER_HANDLER();
+            Object oldHandler = getClientProperty(key);
+            putClientProperty(key, newHandler);
             firePropertyChange("transferHandler", oldHandler, newHandler);
         }
 
--- a/src/java.desktop/unix/classes/sun/java2d/xr/XRDrawLine.java	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRDrawLine.java	Wed Jan 22 13:29:03 2020 +0530
@@ -222,7 +222,7 @@
         outcode2 = outcode(x2, y2, cxmin, cymin, cxmax, cymax);
 
         while ((outcode1 | outcode2) != 0) {
-            int xsteps = 0, ysteps = 0;
+            long xsteps = 0, ysteps = 0;
 
             if ((outcode1 & outcode2) != 0) {
                 return false;
@@ -247,7 +247,7 @@
                     if (dx < 0) {
                         xsteps = -xsteps;
                     }
-                    x1 = ucX1 + xsteps;
+                    x1 = ucX1 + (int) xsteps;
                 } else if ((outcode1 & (OUTCODE_LEFT | OUTCODE_RIGHT)) != 0) {
                     if ((outcode1 & OUTCODE_LEFT) != 0) {
                         x1 = cxmin;
@@ -266,7 +266,7 @@
                     if (dy < 0) {
                         ysteps = -ysteps;
                     }
-                    y1 = ucY1 + ysteps;
+                    y1 = ucY1 + (int) ysteps;
                 }
                 outcode1 = outcode(x1, y1, cxmin, cymin, cxmax, cymax);
             } else {
@@ -290,7 +290,7 @@
                     if (dx > 0) {
                         xsteps = -xsteps;
                     }
-                    x2 = ucX2 + xsteps;
+                    x2 = ucX2 + (int) xsteps;
                 } else if ((outcode2 & (OUTCODE_LEFT | OUTCODE_RIGHT)) != 0) {
                     if ((outcode2 & OUTCODE_LEFT) != 0) {
                         x2 = cxmin;
@@ -311,7 +311,7 @@
                     if (dy > 0) {
                         ysteps = -ysteps;
                     }
-                    y2 = ucY2 + ysteps;
+                    y2 = ucY2 + (int) ysteps;
                 }
                 outcode2 = outcode(x2, y2, cxmin, cymin, cxmax, cymax);
             }
--- a/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c	Wed Jan 22 13:29:03 2020 +0530
@@ -1439,6 +1439,10 @@
                 path = createWidgetPath (fp_gtk_style_context_get_path (widget_context));
                 append_element(path, "paned");
                 append_element(path, "separator");
+            } else if (strcmp(detail, "spinbutton_down") == 0 || strcmp(detail, "spinbutton_up") == 0) {
+                path = createWidgetPath (fp_gtk_style_context_get_path (widget_context));
+                append_element(path, "spinbutton");
+                append_element(path, "button");
             } else {
                 path = createWidgetPath (fp_gtk_style_context_get_path (widget_context));
                 append_element(path, detail);
--- a/src/java.desktop/windows/classes/sun/awt/windows/WComponentPeer.java	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/windows/classes/sun/awt/windows/WComponentPeer.java	Wed Jan 22 13:29:03 2020 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, 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
@@ -579,23 +579,25 @@
         if (window != null) {
             final WWindowPeer wpeer = AWTAccessor.getComponentAccessor()
                                                  .getPeer(window);
-            Graphics g = wpeer.getTranslucentGraphics();
-            // getTranslucentGraphics() returns non-null value for non-opaque windows only
-            if (g != null) {
-                // Non-opaque windows do not support heavyweight children.
-                // Redirect all painting to the Window's Graphics instead.
-                // The caller is responsible for calling the
-                // WindowPeer.updateWindow() after painting has finished.
-                int x = 0, y = 0;
-                for (Component c = target; c != window; c = c.getParent()) {
-                    x += c.getX();
-                    y += c.getY();
+            if (wpeer != null) {
+                Graphics g = wpeer.getTranslucentGraphics();
+                // getTranslucentGraphics() returns non-null value for non-opaque windows only
+                if (g != null) {
+                    // Non-opaque windows do not support heavyweight children.
+                    // Redirect all painting to the Window's Graphics instead.
+                    // The caller is responsible for calling the
+                    // WindowPeer.updateWindow() after painting has finished.
+                    int x = 0, y = 0;
+                    for (Component c = target; c != window; c = c.getParent()) {
+                        x += c.getX();
+                        y += c.getY();
+                    }
+
+                    g.translate(x, y);
+                    g.clipRect(0, 0, target.getWidth(), target.getHeight());
+
+                    return g;
                 }
-
-                g.translate(x, y);
-                g.clipRect(0, 0, target.getWidth(), target.getHeight());
-
-                return g;
             }
         }
 
--- a/src/java.desktop/windows/classes/sun/awt/windows/WMenuPeer.java	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/windows/classes/sun/awt/windows/WMenuPeer.java	Wed Jan 22 13:29:03 2020 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, 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
@@ -30,12 +30,8 @@
 class WMenuPeer extends WMenuItemPeer implements MenuPeer {
 
     // MenuPeer implementation
-
-    @Override
-    public native void addSeparator();
     @Override
     public void addItem(MenuItem item) {
-        WMenuItemPeer itemPeer = (WMenuItemPeer) WToolkit.targetToPeer(item);
     }
     @Override
     public native void delItem(int index);
--- a/src/java.desktop/windows/native/libawt/windows/awt_Menu.cpp	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Menu.cpp	Wed Jan 22 13:29:03 2020 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, 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
@@ -128,24 +128,6 @@
     return menu;
 }
 
-void AwtMenu::_AddSeparator(void *param)
-{
-    if (AwtToolkit::IsMainThread()) {
-        JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
-
-        jobject self = (jobject)param;
-        AwtMenu *m = NULL;
-        PDATA pData;
-        JNI_CHECK_PEER_GOTO(self, ret);
-        m = (AwtMenu *)pData;
-        m->AddSeparator();
-ret:
-        env->DeleteGlobalRef(self);
-    } else {
-        AwtToolkit::GetInstance().InvokeFunction(AwtMenu::_AddSeparator, param);
-    }
-}
-
 void AwtMenu::_DelItem(void *param)
 {
     if (AwtToolkit::IsMainThread()) {
@@ -211,10 +193,6 @@
     return (GetMenuContainer() == NULL) ? NULL : GetMenuContainer()->GetOwnerHWnd();
 }
 
-void AwtMenu::AddSeparator() {
-    VERIFY(::AppendMenu(GetHMenu(), MF_SEPARATOR, 0, 0));
-}
-
 void AwtMenu::AddItem(AwtMenuItem* item)
 {
     JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
@@ -223,7 +201,7 @@
     }
 
     if (item->IsSeparator()) {
-        AddSeparator();
+        VERIFY(::AppendMenu(GetHMenu(), MF_SEPARATOR, 0, 0));
     } else {
         /* jitem is a java.awt.MenuItem */
         jobject jitem = item->GetTarget(env);
@@ -405,24 +383,6 @@
 
 /*
  * Class:     sun_awt_windows_WMenuPeer
- * Method:    addSeparator
- * Signature: ()V
- */
-JNIEXPORT void JNICALL
-Java_sun_awt_windows_WMenuPeer_addSeparator(JNIEnv *env, jobject self)
-{
-    TRY;
-
-    jobject selfGlobalRef = env->NewGlobalRef(self);
-
-    AwtToolkit::GetInstance().SyncCall(AwtMenu::_AddSeparator, selfGlobalRef);
-    // selfGlobalRef is deleted in _AddSeparator
-
-    CATCH_BAD_ALLOC;
-}
-
-/*
- * Class:     sun_awt_windows_WMenuPeer
  * Method:    delItem
  * Signature: (I)V
  */
--- a/src/java.desktop/windows/native/libawt/windows/awt_Menu.h	Tue Jan 21 20:58:48 2020 +0100
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Menu.h	Wed Jan 22 13:29:03 2020 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, 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
@@ -64,7 +64,6 @@
 
     virtual AwtMenuBar* GetMenuBar();
 
-    void AddSeparator();
     virtual void UpdateContainerLayout();
     void UpdateLayout();
     virtual void AddItem(AwtMenuItem *item);
@@ -88,7 +87,6 @@
     void MeasureItems(HDC hDC, MEASUREITEMSTRUCT& measureInfo);
 
     // invoked on Toolkit thread
-    static void _AddSeparator(void *param);
     static void _DelItem(void *param);
     static void _CreateMenu(void *param);
     static void _CreateSubMenu(void *param);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/awt/EventQueue/NonComponentSourcePost.java	Wed Jan 22 13:29:03 2020 +0530
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 1999, 2019, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.AWTEvent;
+import java.awt.ActiveEvent;
+import java.awt.EventQueue;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @test
+ * @bug 4137796
+ * @summary Checks that the posting of events whose sources are not Components
+ *          does not corrupt the EventQueue.
+ */
+public class NonComponentSourcePost {
+
+    public static final int COUNT = 100;
+    public static CountDownLatch go = new CountDownLatch(COUNT);
+
+    public static void main(String[] args) throws Throwable {
+        EventQueue q = new EventQueue();
+        for (int i = 0; i < COUNT; i++) {
+            q.postEvent(new NewActionEvent());
+        }
+        if (!go.await(30, TimeUnit.SECONDS)) {
+            throw new RuntimeException("Timeout");
+        }
+        AWTEvent event = q.peekEvent();
+        if (event != null) {
+            throw new Exception("Non null event: " + event);
+        }
+
+        if (NewActionEvent.result != NewActionEvent.sum) {
+            throw new Exception("result: " + NewActionEvent.result +
+                                "  sum: " + NewActionEvent.sum);
+        }
+        // Simple way to shutdown the AWT machinery
+        Toolkit.getDefaultToolkit().getSystemEventQueue().push(q);
+    }
+
+    static class NewActionEvent extends ActionEvent implements ActiveEvent {
+        static int counter = 1;
+        static int sum = 0;
+        static int result = 0;
+
+        int myval;
+
+        public NewActionEvent() {
+            super("", ACTION_PERFORMED, "" + counter);
+            myval = counter++;
+            sum += myval;
+        }
+
+        public synchronized void dispatch() {
+            result += myval;
+            try {
+                wait(100);
+            } catch (InterruptedException e) {
+            }
+            go.countDown();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/awt/Frame/GetGraphicsStressTest/GetGraphicsStressTest.java	Wed Jan 22 13:29:03 2020 +0530
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2019, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @test
+ * @bug 8235638 8235739
+ * @key headful
+ */
+public final class GetGraphicsStressTest {
+
+    static volatile Throwable failed;
+    static volatile long endtime;
+
+    public static void main(final String[] args) throws Exception {
+        // Catch all uncaught exceptions and treat them as test failure
+        Thread.setDefaultUncaughtExceptionHandler((t, e) -> failed = e);
+
+        // Will run the test no more than 20 seconds
+        for (int i = 0; i < 4; i++) {
+            endtime = System.nanoTime() + TimeUnit.SECONDS.toNanos(5);
+            test();
+        }
+    }
+
+    private static void test() throws Exception {
+        Frame f = new Frame();
+        f.setSize(100, 100);
+        f.setLocationRelativeTo(null);
+        f.setVisible(true);
+
+        Thread thread1 = new Thread(() -> {
+            while (!isComplete()) {
+                f.removeNotify();
+                f.addNotify();
+            }
+        });
+        Thread thread2 = new Thread(() -> {
+            while (!isComplete()) {
+                Graphics g = f.getGraphics();
+                if (g != null) {
+                    g.dispose();
+                }
+            }
+        });
+        Thread thread3 = new Thread(() -> {
+            while (!isComplete()) {
+                Graphics g = f.getGraphics();
+                if (g != null) {
+                    g.dispose();
+                }
+            }
+        });
+        Thread thread4 = new Thread(() -> {
+            while (!isComplete()) {
+                Graphics g = f.getGraphics();
+                if (g != null) {
+                    g.drawLine(0, 0, 4, 4); // just in case...
+                    g.dispose();
+                }
+            }
+        });
+        thread1.start();
+        thread2.start();
+        thread3.start();
+        thread4.start();
+        thread1.join();
+        thread2.join();
+        thread3.join();
+        thread4.join();
+
+        f.dispose();
+        if (failed != null) {
+            System.err.println("Test failed");
+            failed.printStackTrace();
+            throw new RuntimeException(failed);
+        }
+    }
+
+    private static boolean isComplete() {
+        return endtime - System.nanoTime() < 0 || failed != null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/awt/Graphics/DrawLineTest.java	Wed Jan 22 13:29:03 2020 +0530
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2020, 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.
+ *
+ * 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.
+ */
+
+/*
+  @test
+  @key headful
+  @bug 8235904
+  @run main/othervm/timeout=60 DrawLineTest
+*/
+
+import java.awt.EventQueue;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Image;
+
+public class DrawLineTest extends Frame {
+
+    volatile static boolean done = false;
+
+    public static void main(String[] args) throws Exception {
+
+        EventQueue.invokeLater(() -> {
+           DrawLineTest frame = new DrawLineTest();
+           frame.setVisible(true);
+           Image img = frame.createVolatileImage(1000, 1000);
+           img.getGraphics().drawLine(0, 0, 34005, 34005);
+           done = true;
+           frame.setVisible(false);
+           frame.dispose();
+           return;
+        });
+
+        int cnt=0;
+        while (!done && (cnt++ < 60)) {
+            try {
+               Thread.sleep(1000);
+            } catch (InterruptedException e) {
+            }
+        }
+
+        if (!done) {
+           // jtreg will shutdown the test properly
+           if ((System.getProperty("test.src") != null)) {
+               throw new RuntimeException("Test Failed");
+           } else {
+               // Not to be used in jtreg
+               System.out.println("Test failed.");
+               Runtime.getRuntime().halt(-1);
+           }
+        }
+        return;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/awt/Robot/Delay/InterruptOfDelay.java	Wed Jan 22 13:29:03 2020 +0530
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2019, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Robot;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+
+/**
+ * @test
+ * @key headful
+ * @bug 8210231
+ */
+public final class InterruptOfDelay {
+
+    static final class DormantThread extends Thread {
+
+        public void run() {
+            final PrintStream old = System.err;
+            final ByteArrayOutputStream err = new ByteArrayOutputStream();
+            System.setErr(new PrintStream(err));
+            try {
+                new Robot().delay(10000);
+            } catch (final Exception e) {
+                throw new RuntimeException(e);
+            } finally {
+                System.setErr(old);
+            }
+            if (!err.toString().isBlank()) {
+                throw new RuntimeException("Error stream is not empty: " + err);
+            }
+            if (!Thread.currentThread().isInterrupted()) {
+                throw new RuntimeException("Thread was not interrupted");
+            }
+        }
+    }
+
+    public static void main(final String args[]) throws Exception {
+        final Thread t = new DormantThread();
+        t.start();
+        Thread.sleep(1000);
+        t.interrupt();
+        t.join();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/awt/Robot/Delay/MultiThreadedDelay.java	Wed Jan 22 13:29:03 2020 +0530
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2019, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Robot;
+import java.util.concurrent.CountDownLatch;
+
+/**
+ * @test
+ * @key headful
+ * @bug 8210231
+ */
+public final class MultiThreadedDelay {
+
+    private static volatile boolean complete;
+
+    public static void main(final String[] args) throws Exception {
+        CountDownLatch go = new CountDownLatch(1);
+        Robot robot = new Robot();
+        Thread bigDelay = new Thread(() -> {
+            go.countDown();
+            robot.delay(20000);
+            complete = true;
+        });
+        bigDelay.start();
+        go.await();
+        robot.delay(1000);
+        if (complete) {
+            throw new RuntimeException("Delay is too slow");
+        }
+        bigDelay.interrupt();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/awt/font/Rotate/RotatedFontTest.java	Wed Jan 22 13:29:03 2020 +0530
@@ -0,0 +1,279 @@
+/*
+ * Copyright (c) 2020, 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.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8224109
+ * @summary test for consistent text rotation.
+ */
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import static java.awt.RenderingHints.*;
+import java.awt.font.FontRenderContext;
+import java.awt.font.GlyphVector;
+import java.awt.font.TextLayout;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Rectangle2D;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.text.AttributedString;
+import java.util.Collections;
+
+import javax.imageio.ImageIO;
+
+public class RotatedFontTest {
+
+    static final String TEXT = "MMMM"; // Use a short homogenous string.
+    static final RenderingHints.Key AA_KEY = KEY_TEXT_ANTIALIASING;
+    static final Object AA_OFF = VALUE_TEXT_ANTIALIAS_OFF;
+    static final RenderingHints.Key FM_KEY = KEY_FRACTIONALMETRICS;
+    static final Object FM_ON = VALUE_FRACTIONALMETRICS_ON;
+    static final Object FM_OFF = VALUE_FRACTIONALMETRICS_OFF;
+
+    static final int DRAWSTRING = 0;
+    static final int TEXTLAYOUT = 1;
+    static final int GLYPHVECTOR = 2;
+    static final int LAYEDOUT_GLYPHVECTOR = 3;
+
+    public static void main(String... args) throws Exception {
+
+        /*
+         * First verify we have rotation by checking for text colored pixels
+         * several lines below the baseline of the text.
+         * Then for subsequent images, check that they are identical to the
+         * the previous image.
+         * Do this for both FM on and off.
+         */
+        int x = 100;
+        int y =  10;
+        AffineTransform gtx = new AffineTransform();
+
+        /* Use monospaced because otherwise an API like TextLayout which
+         * lays out in a horizontal direction with hints applied might
+         * sometimes result in a pixel or so difference and cause a
+         * failure but an effect is not actually a failure of rotation.
+         * Monospaced needs to be monospaced for this to work, and there
+         * is also still some risk of this but we can try it.
+         * This - and fractional metrics is why we use a short string
+         * and count errors. A long string might have a small difference
+         * early on that causes a lot of subsequent pixels to be off-by-one.
+         * This isn't just theoretical. Despite best efforts the test can
+         * fail like this.
+         */
+        Font font = new Font(Font.MONOSPACED, Font.PLAIN, 20);
+        String os = System.getProperty("os.name").toLowerCase();
+        if (os.startsWith("mac")) {
+            // Avoid a bug with AAT fonts on macos.
+            font = new Font("Courier New", Font.PLAIN, 20);
+        }
+        System.out.println(font);
+        AffineTransform at = AffineTransform.getRotateInstance(Math.PI / 2);
+        at.scale(2.0, 1.5);
+        Font rotFont = font.deriveFont(at);
+
+        test(FM_OFF, x, y, rotFont, gtx, "font-rotation-fm-off.png");
+        test(FM_ON, x, y, rotFont, gtx, "font-rotation-fm-on.png");
+
+        // Repeat with rotated graphics, unrotated font
+        gtx = at;
+        x = 10;
+        y = -100;
+        test(FM_OFF, x, y, font, gtx, "gx-rotation-fm-off.png");
+        test(FM_ON, x, y, font, gtx, "gx-rotation-fm-on.png");
+
+        // Repeat with rotated graphics, rotated font
+        gtx = AffineTransform.getRotateInstance(Math.PI / 4);
+        at = AffineTransform.getRotateInstance(Math.PI / 4);
+        at.scale(2.0, 1.5);
+        rotFont = font.deriveFont(at);
+        x = 140;
+        y = -100;
+        test(FM_OFF, x, y, rotFont, gtx, "gx-and-font-rotation-fm-off.png");
+        test(FM_ON, x, y, rotFont, gtx, "gx-and-font-rotation-fm-on.png");
+    }
+
+    static void test(Object fm, int x, int y, Font font,
+                     AffineTransform gtx, String fileName) throws Exception {
+
+        BufferedImage img = createNewImage();
+        draw(img, DRAWSTRING, TEXT, x, y, font, gtx, fm);
+        ImageIO.write(img, "png", new File(fileName));
+        checkImageForRotation(img);
+        BufferedImage imageCopy = copyImage(img);
+
+        draw(img, TEXTLAYOUT, TEXT, x, y, font, gtx, fm);
+        compareImages(imageCopy, img);
+
+        draw(img, GLYPHVECTOR, TEXT, x, y, font, gtx, fm);
+        compareImages(imageCopy, img);
+/*
+        This case needs to be fixed before the test can be enabled.
+        See bug 8236451.
+        draw(img, LAYEDOUT_GLYPHVECTOR, TEXT, x, y, font, gtx, fm);
+        compareImages(imageCopy, img);
+*/
+    }
+
+    private static BufferedImage createNewImage() {
+        BufferedImage img = new BufferedImage(500, 500,
+                                              BufferedImage.TYPE_INT_RGB);
+        Graphics2D g2d = img.createGraphics();
+        g2d.setColor(Color.WHITE);
+        g2d.fillRect(0, 0, img.getWidth(), img.getHeight());
+        g2d.setColor(Color.BLACK);
+        g2d.dispose();
+        return img;
+    }
+
+    private static void checkImageForRotation(BufferedImage img)
+                       throws Exception {
+     /*
+      * Some expectations are hardwired here.
+      */
+        int firstRowWithBlackPixel = -1;
+        int lastRowWithBlackPixel = -1;
+        int width = img.getWidth(null);
+        int height = img.getHeight(null);
+        for (int x=0; x<width; x++) {
+            for (int y=0; y<height; y++) {
+                int rgb = img.getRGB(x, y);
+                if ((rgb & 0xffffff) == 0) {
+                    lastRowWithBlackPixel = y;
+                    if (firstRowWithBlackPixel == -1) {
+                        firstRowWithBlackPixel = y;
+                    }
+                }
+            }
+        }
+        if ((firstRowWithBlackPixel == -1) ||
+            (lastRowWithBlackPixel - firstRowWithBlackPixel < 40)) {
+            ImageIO.write(img, "png", new File("font-rotation-failed.png"));
+                 throw new RuntimeException("no rotation " +
+                    "first = " + firstRowWithBlackPixel +
+                    " last = " + lastRowWithBlackPixel);
+        }
+    }
+
+    private static BufferedImage copyImage(BufferedImage origImg) {
+        int w = origImg.getWidth(null);
+        int h = origImg.getHeight(null);
+        BufferedImage newImg = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
+        Graphics2D g2d = newImg.createGraphics();
+        g2d.drawImage(origImg, 0, 0, null);
+        g2d.dispose();
+        return newImg;
+    }
+
+    private static void compareImages(BufferedImage i1, BufferedImage i2)
+            throws Exception {
+        final int MAXDIFFS = 40;
+        int maxDiffs = MAXDIFFS;
+        int diffCnt = 0;
+        boolean failed = false;
+        int width = i1.getWidth(null);
+        int height = i1.getHeight(null);
+        for (int x=0; x<width; x++) {
+            for (int y=0; y<height; y++) {
+               if (maxDiffs == MAXDIFFS) {
+                   int b1 = i1.getRGB(x, y) & 0x0ff;
+                   int b2 = i2.getRGB(x, y) & 0x0ff;
+                   /* If request to use AA_OFF is ignored,
+                    * too hard, give up.
+                    */
+                   if ((b1 > 0 && b1 < 255) || (b2 > 0 && b2 < 255)) {
+                       System.out.println("AA text, skip.");
+                       return;
+                   }
+               }
+               if (i1.getRGB(x, y) != i2.getRGB(x, y)) {
+                   /* This is an attempt to mitigate against small
+                    * differences, especially in the fractional metrics case.
+                    */
+                   diffCnt++;
+                   if (diffCnt > maxDiffs) {
+                       failed = true;
+                   }
+               }
+            }
+        }
+        if (failed) {
+            ImageIO.write(i2, "png", new File("font-rotation-failed.png"));
+                 throw new RuntimeException("images differ, diffCnt="+diffCnt);
+        }
+    }
+
+    private static void draw(BufferedImage img, int api, String s, int x, int y,
+                             Font font, AffineTransform gtx, Object fm) {
+
+        System.out.print("Font:" + font + " GTX:"+ gtx + " FM:" + fm + " using ");
+        Graphics2D g2d = img.createGraphics();
+        g2d.setColor(Color.black);
+        g2d.transform(gtx);
+        g2d.setRenderingHint(AA_KEY, AA_OFF);
+        g2d.setRenderingHint(FM_KEY, fm);
+        g2d.setFont(font);
+        FontRenderContext frc = g2d.getFontRenderContext();
+        GlyphVector gv;
+        Rectangle2D bds = null;
+        char[] chs;
+        switch (api) {
+            case DRAWSTRING:
+                 System.out.println("drawString");
+                 g2d.drawString(s, x, y);
+                 chs = s.toCharArray();
+                 bds = font.getStringBounds(chs, 0, chs.length, frc);
+                 System.out.println("drawString Bounds="+bds);
+                 break;
+            case TEXTLAYOUT:
+                 System.out.println("TextLayout");
+                 TextLayout tl = new TextLayout(s, font, frc);
+                 tl.draw(g2d, (float)x, (float)y);
+                 System.out.println("TextLayout Bounds="+tl.getBounds());
+                 System.out.println("TextLayout Pixel Bounds="+tl.getPixelBounds(frc, (float)x, (float)y));
+                 break;
+            case GLYPHVECTOR:
+                 System.out.println("GlyphVector");
+                 gv = font.createGlyphVector(frc, s);
+                 g2d.drawGlyphVector(gv, (float)x, (float)y);
+                 System.out.println("Default GlyphVector Logical Bounds="+gv.getLogicalBounds());
+                 System.out.println("Default GlyphVector Visual Bounds="+gv.getVisualBounds());
+                 System.out.println("Default GlyphVector Pixel Bounds="+gv.getPixelBounds(frc, (float)x, (float)y));
+                 break;
+            case LAYEDOUT_GLYPHVECTOR:
+                 System.out.println("Layed out GlyphVector");
+                 chs = s.toCharArray();
+                 gv = font.layoutGlyphVector(frc, chs, 0, chs.length, 0);
+                 g2d.drawGlyphVector(gv, (float)x, (float)y);
+                 System.out.println("Layed out GlyphVector Logical Bounds="+gv.getLogicalBounds());
+                 System.out.println("Layed out GlyphVector Visual Bounds="+gv.getVisualBounds());
+                 System.out.println("Layed out GlyphVector Pixel Bounds="+gv.getPixelBounds(frc, (float)x, (float)y));
+                 break;
+            default: /* do nothing */
+        }
+        g2d.dispose();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/swing/JSpinner/8223788/JSpinnerButtonFocusTest.java	Wed Jan 22 13:29:03 2020 +0530
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2020, 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.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @key headful
+ * @bug 8223788
+ * @summary JSpinner buttons in JColorChooser dialog may capture focus
+ *          using TAB Key
+ * @run main JSpinnerButtonFocusTest
+ */
+
+import java.awt.Robot;
+import java.awt.BorderLayout;
+import java.awt.ContainerOrderFocusTraversalPolicy;
+import java.awt.event.KeyEvent;
+import javax.swing.JFrame;
+import javax.swing.JSpinner;
+import javax.swing.JSpinner.DefaultEditor;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+
+public class JSpinnerButtonFocusTest {
+    static JFrame frame;
+    static Robot robot;
+    static JSpinner spinner1, spinner2;
+    static DefaultEditor editor2;
+    static boolean jTextFieldFocusStatus;
+
+    public static void main(String args[]) throws Exception {
+
+        for (UIManager.LookAndFeelInfo LF : UIManager.getInstalledLookAndFeels()) {
+            try {
+                UIManager.setLookAndFeel(LF.getClassName());
+                robot = new Robot();
+                robot.setAutoDelay(50);
+                robot.setAutoWaitForIdle(true);
+
+                SwingUtilities.invokeAndWait(() -> {
+                    frame = new JFrame();
+                    spinner1 = new JSpinner();
+                    spinner2 = new JSpinner();
+
+                    frame.setLayout(new BorderLayout());
+                    frame.getContentPane().add(spinner1, BorderLayout.NORTH);
+                    frame.getContentPane().add(spinner2, BorderLayout.SOUTH);
+
+                    ((DefaultEditor)spinner1.getEditor()).setFocusable(false);
+                    spinner1.setFocusable(false);
+
+                    editor2 = (DefaultEditor) spinner2.getEditor();
+                    editor2.setFocusable(false);
+                    spinner2.setFocusable(false);
+
+                    frame.setFocusTraversalPolicy(
+                            new ContainerOrderFocusTraversalPolicy());
+                    frame.setFocusTraversalPolicyProvider(true);
+
+                    frame.pack();
+                    frame.setVisible(true);
+                });
+
+                robot.waitForIdle();
+                pressTab(5);
+                robot.waitForIdle();
+
+                SwingUtilities.invokeAndWait(() -> {
+                    jTextFieldFocusStatus = editor2.getTextField().isFocusOwner();
+                });
+
+                if (!jTextFieldFocusStatus) {
+                    throw new RuntimeException(
+                            "Spinner's Text Field doesn't have focus ");
+                }
+            } finally {
+                if(frame != null){
+                    SwingUtilities.invokeAndWait(frame::dispose);
+                }
+            }
+        }
+    }
+
+    public static void pressTab(int n) {
+        for (int i = 0; i < n; i++) {
+            robot.keyPress(KeyEvent.VK_TAB);
+            robot.keyRelease(KeyEvent.VK_TAB);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/swing/JSpinner/TestJSpinnerPressUnpress.java	Wed Jan 22 13:29:03 2020 +0530
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2019, 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.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8234733
+ * @summary Verify that JSpinner up/down button rendering is changed
+ *           according to pressed state in GTKLookAndFeel
+ * @run main/manual TestJSpinnerPressUnpress
+ */
+
+import java.awt.Color;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import javax.swing.JButton;
+import javax.swing.JSpinner;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.UIManager;
+import javax.swing.SwingUtilities;
+import javax.swing.UnsupportedLookAndFeelException;
+
+public class TestJSpinnerPressUnpress {
+    private static JFrame mainFrame = new JFrame();
+    private static volatile boolean testResult = false;
+    private static volatile CountDownLatch countDownLatch;
+    private static final String GTK_LAF_CLASS = "GTKLookAndFeel";
+    private static final String INSTRUCTIONS = "INSTRUCTIONS:\n\n" +
+            "Verify that when spinner up/down button is pressed to change\n" +
+            "the spinner value, the button's rendering is changed to show\n" +
+            "the pressed state. If yes, Press Pass, Otherwise, Press Fail.";
+
+    public static void main(String args[]) throws Exception {
+        if (!System.getProperty("os.name").startsWith("Linux")) {
+            System.out.println("This test is meant for Linux platform only");
+            return;
+        }
+        countDownLatch = new CountDownLatch(1);
+
+        for (UIManager.LookAndFeelInfo lookAndFeelInfo :
+                UIManager.getInstalledLookAndFeels()) {
+            if (lookAndFeelInfo.getClassName().contains(GTK_LAF_CLASS)) {
+                try {
+                    UIManager.setLookAndFeel(lookAndFeelInfo.getClassName());
+                } catch (final UnsupportedLookAndFeelException ignored) {
+                    System.out.println("GTK L&F could not be set, so this " +
+                            "test can not be run in this scenario ");
+                    return;
+                }
+            }
+        }
+        SwingUtilities.invokeLater(TestJSpinnerPressUnpress::createUI);
+        countDownLatch.await(15, TimeUnit.MINUTES);
+        SwingUtilities.invokeLater(mainFrame::dispose);
+
+        if (!testResult) {
+            throw new RuntimeException("Test failed!");
+        }
+    }
+
+    private static void createUI() {
+        GridBagLayout layout = new GridBagLayout();
+        JPanel mainControlPanel = new JPanel(layout);
+        JPanel resultButtonPanel = new JPanel(layout);
+
+        GridBagConstraints gbc = new GridBagConstraints();
+
+        gbc.gridx = 0;
+        gbc.gridy = 0;
+        gbc.insets = new Insets(5, 15, 5, 15);
+        gbc.fill = GridBagConstraints.HORIZONTAL;
+        mainControlPanel.add(new JSpinner(), gbc);
+
+        JTextArea instructionTextArea = new JTextArea();
+        instructionTextArea.setText(INSTRUCTIONS);
+        instructionTextArea.setEditable(false);
+        instructionTextArea.setBackground(Color.white);
+
+        gbc.gridx = 0;
+        gbc.gridy = 1;
+        gbc.fill = GridBagConstraints.HORIZONTAL;
+        mainControlPanel.add(instructionTextArea, gbc);
+
+        JButton passButton = new JButton("Pass");
+        passButton.setActionCommand("Pass");
+        passButton.addActionListener((ActionEvent e) -> {
+            testResult = true;
+            countDownLatch.countDown();
+
+        });
+
+        JButton failButton = new JButton("Fail");
+        failButton.setActionCommand("Fail");
+        failButton.addActionListener(e -> {
+            countDownLatch.countDown();
+        });
+
+        gbc.gridx = 0;
+        gbc.gridy = 0;
+
+        resultButtonPanel.add(passButton, gbc);
+
+        gbc.gridx = 1;
+        gbc.gridy = 0;
+        resultButtonPanel.add(failButton, gbc);
+
+        gbc.gridx = 0;
+        gbc.gridy = 2;
+        mainControlPanel.add(resultButtonPanel, gbc);
+
+        mainFrame.add(mainControlPanel);
+        mainFrame.pack();
+
+        mainFrame.addWindowListener(new WindowAdapter() {
+            @Override
+            public void windowClosing(WindowEvent e) {
+                mainFrame.dispose();
+                countDownLatch.countDown();
+            }
+        });
+        mainFrame.setVisible(true);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/swing/JTextPane/TestJTextPaneHTMLRendering.java	Wed Jan 22 13:29:03 2020 +0530
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 2019, 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.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8224475
+ * @summary Verify that JTextPane renders images properly for HTML text
+ * @run main/manual TestJTextPaneHTMLRendering
+ */
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.Image;
+import java.net.URL;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import javax.swing.JButton;
+import javax.swing.JTextArea;
+import javax.swing.ImageIcon;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JTextPane;
+import javax.swing.text.EditorKit;
+import javax.swing.SwingUtilities;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+
+public class TestJTextPaneHTMLRendering {
+    private static JFrame mainFrame = new JFrame();
+    private static Dictionary<URL, Image> cache;
+    private static JTextPane textPane;
+    private static URL urlArrow;
+
+    private static volatile boolean testResult = false;
+    private static volatile CountDownLatch countDownLatch;
+    private static final String INSTRUCTIONS = "INSTRUCTIONS:\n\n" +
+            "Verify that the JTextPane is filled with green arrow images.\n" +
+            "There should be 200 images (10 rows of 20 images each).\n" +
+            "This test will run for 10 iterations and the current iteration\n" +
+            "is being displayed at top of JTextPane. JTextpane will be\n" +
+            "repainted each time  and should have same output\n"+
+            "If yes, Press Pass, Otherwise, Press Fail.\n";
+
+    public static void main(String args[]) throws Exception {
+        urlArrow = new URL("http:\\arrow.png");
+        countDownLatch = new CountDownLatch(1);
+
+        SwingUtilities.invokeLater(TestJTextPaneHTMLRendering::createUI);
+        countDownLatch.await(15, TimeUnit.MINUTES);
+        SwingUtilities.invokeLater(mainFrame::dispose);
+
+        if (!testResult) {
+            throw new RuntimeException("Test failed!");
+        }
+    }
+
+    private static void createUI() {
+        JPanel mainControlPanel = new JPanel(new BorderLayout(20, 20));
+        JPanel resultButtonPanel = new JPanel(new GridBagLayout());
+
+        createTestUI(mainControlPanel);
+
+        JTextArea instructionTextArea = new JTextArea();
+        instructionTextArea.setText(INSTRUCTIONS);
+        instructionTextArea.setEditable(false);
+        instructionTextArea.setBackground(Color.white);
+        mainControlPanel.add(instructionTextArea, BorderLayout.NORTH);
+
+        JButton passButton = new JButton("Pass");
+        passButton.setActionCommand("Pass");
+        passButton.addActionListener((ActionEvent e) -> {
+            testResult = true;
+            countDownLatch.countDown();
+
+        });
+
+        JButton failButton = new JButton("Fail");
+        failButton.setActionCommand("Fail");
+        failButton.addActionListener(e -> {
+            countDownLatch.countDown();
+        });
+
+        GridBagConstraints gbc = new GridBagConstraints();
+        gbc.gridx = 0;
+        gbc.gridy = 0;
+
+        resultButtonPanel.add(passButton, gbc);
+
+        gbc.gridx = 1;
+        gbc.gridy = 0;
+        resultButtonPanel.add(failButton, gbc);
+
+        mainControlPanel.add(resultButtonPanel, BorderLayout.SOUTH);
+
+        mainFrame.add(mainControlPanel);
+        mainFrame.pack();
+
+        mainFrame.addWindowListener(new WindowAdapter() {
+            @Override
+            public void windowClosing(WindowEvent e) {
+                mainFrame.dispose();
+                countDownLatch.countDown();
+            }
+        });
+        mainFrame.setVisible(true);
+    }
+
+    static void createTestUI(JPanel panel) {
+        textPane = new JTextPane();
+        panel.add(textPane, BorderLayout.CENTER);
+
+        final EditorKit l_kit = textPane.getEditorKitForContentType("text/html");
+        textPane.setEditable(false);
+        textPane.setEditorKit(l_kit);
+        cache = (Dictionary<URL, Image>)textPane.getDocument().getProperty("imageCache");
+        if (cache==null) {
+            cache=new Hashtable<URL, Image>();
+            textPane.getDocument().putProperty("imageCache",cache);
+        }
+
+        URL arrowLocationUrl = TestJTextPaneHTMLRendering.class.getResource("arrow.png");
+        ImageIcon imageIcon = new ImageIcon(arrowLocationUrl);
+        Image image = imageIcon.getImage();
+        Image scaledImage = image.getScaledInstance(24, 24, java.awt.Image.SCALE_SMOOTH);
+        cache.put(urlArrow, scaledImage);
+        new Thread(TestJTextPaneHTMLRendering::runTest).start();
+    }
+
+    static void runTest() {
+        for (int i=0; i < 10; i++)
+        {
+            StringBuffer sb = new StringBuffer();
+            sb.append("<html><body bgcolor=\"#BBBBBB\"><center>Iteration " + (i+1) + " -> " + "<br>");
+            for (int j=1;j<201;j++)
+            {
+                sb.append("<img src=\"" + urlArrow + "\">");
+                if (j%20 == 0) sb.append("<br>");
+            }
+            textPane.setText(sb.toString());
+            textPane.validate();
+            textPane.repaint();
+            try {
+                Thread.currentThread().sleep(1000);
+            } catch (InterruptedException e) { System.err.println(e); }
+        }
+    }
+}
Binary file test/jdk/javax/swing/JTextPane/arrow.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/swing/plaf/gtk/TestCustomStyleFactory.java	Wed Jan 22 13:29:03 2020 +0530
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2019, 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.
+ *
+ * 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.
+ */
+
+/**
+ * @test
+ * @key headful
+ * @bug 8222759
+ * @requires (os.family == "linux")
+ * @summary Tests if a custom style factory can be used in GTKL&F after
+ *  removing unnecessary casts
+ * @run main TestCustomStyleFactory
+ */
+
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+import javax.swing.plaf.synth.Region;
+import javax.swing.plaf.synth.SynthLookAndFeel;
+import javax.swing.plaf.synth.SynthStyleFactory;
+import javax.swing.plaf.synth.SynthStyle;
+
+public class TestCustomStyleFactory {
+    private static final String GTK_LAF_CLASS = "GTKLookAndFeel";
+
+    public static void main(String args[]) throws Exception {
+        if (!System.getProperty("os.name").startsWith("Linux")) {
+            System.out.println("This test is meant for Linux platform only");
+            return;
+        }
+
+        for (UIManager.LookAndFeelInfo lookAndFeelInfo :
+                UIManager.getInstalledLookAndFeels()) {
+            if (lookAndFeelInfo.getClassName().contains(GTK_LAF_CLASS)) {
+                try {
+                    UIManager.setLookAndFeel(lookAndFeelInfo.getClassName());
+                } catch (final UnsupportedLookAndFeelException ignored) {
+                    System.out.println("GTK L&F could not be set, so this " +
+                            "test can not be run in this scenario ");
+                    return;
+                }
+            }
+        }
+        final SynthStyleFactory original = SynthLookAndFeel.getStyleFactory();
+        SynthLookAndFeel.setStyleFactory(new SynthStyleFactory() {
+            @Override
+            public SynthStyle getStyle(JComponent c, Region id) {
+                return original.getStyle(c, id);
+            }
+        });
+        new JLabel("test");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/swing/text/html/CSS/bug8234913.java	Wed Jan 22 13:29:03 2020 +0530
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019 SAP SE. 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+
+import javax.swing.text.MutableAttributeSet;
+import javax.swing.text.SimpleAttributeSet;
+import javax.swing.text.html.CSS;
+import javax.swing.text.html.StyleSheet;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/*
+ * @test
+ * @bug 8234913
+ * @library /test/lib
+ * @summary The test project is launched with the option -verbose:class. If the exception is thrown, its class will be loaded.
+ *          Since the exception is thrown, but then caught, it is not possible to catch it in the test case with try-catch.
+ *          The class loader logs have to be monitored.
+ * @run driver bug8234913
+ */
+public class bug8234913 {
+    // Output analysis taken from test/hotspot/jtreg/runtime/logging/ClassLoadUnloadTest.java
+    private static ProcessBuilder pb;
+
+    static ProcessBuilder exec(String... args) throws Exception {
+        List<String> argsList = new ArrayList<>();
+        Collections.addAll(argsList, args);
+        Collections.addAll(argsList, "-Xmn8m");
+        Collections.addAll(argsList, "-Dtest.class.path=" + System.getProperty("test.class.path", "."));
+        Collections.addAll(argsList, FontSizePercentTest.class.getName());
+        return ProcessTools.createJavaProcessBuilder(argsList.toArray(new String[argsList.size()]));
+    }
+
+    static void checkFor(String... outputStrings) throws Exception {
+        OutputAnalyzer out = new OutputAnalyzer(pb.start());
+        for (String s : outputStrings) {
+            out.shouldContain(s);
+        }
+        out.shouldHaveExitValue(0);
+    }
+
+    static void checkAbsent(String... outputStrings) throws Exception {
+        OutputAnalyzer out = new OutputAnalyzer(pb.start());
+        for (String s : outputStrings) {
+            out.shouldNotContain(s);
+        }
+        out.shouldHaveExitValue(0);
+    }
+
+    public static void main(String[] args) throws Exception {
+        pb = exec("-verbose:class");
+        checkFor("[class,load] javax.swing.text.html.CSS$LengthUnit"); // the class that parses %
+        checkAbsent("[class,load] java.lang.NumberFormatException");
+    }
+
+    static class FontSizePercentTest {
+        public static void main(String... args) throws Exception {
+            StyleSheet ss = new StyleSheet();
+            MutableAttributeSet attr = new SimpleAttributeSet();
+            ss.addCSSAttribute(attr, CSS.Attribute.FONT_SIZE, "100%");
+
+            attr.removeAttribute(CSS.Attribute.FONT_SIZE);
+            ss.addCSSAttribute(attr, CSS.Attribute.FONT_SIZE, "10pt");
+
+            attr.removeAttribute(CSS.Attribute.FONT_SIZE);
+            ss.addCSSAttribute(attr, CSS.Attribute.FONT_SIZE, "10px");
+
+            attr.removeAttribute(CSS.Attribute.FONT_SIZE);
+            ss.addCSSAttribute(attr, CSS.Attribute.FONT_SIZE, "10mm");
+
+            attr.removeAttribute(CSS.Attribute.FONT_SIZE);
+            ss.addCSSAttribute(attr, CSS.Attribute.FONT_SIZE, "10cm");
+
+            attr.removeAttribute(CSS.Attribute.FONT_SIZE);
+            ss.addCSSAttribute(attr, CSS.Attribute.FONT_SIZE, "10pc");
+
+            attr.removeAttribute(CSS.Attribute.FONT_SIZE);
+            ss.addCSSAttribute(attr, CSS.Attribute.FONT_SIZE, "10in");
+        }
+    }
+}