harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r566010 - in /harmony/enhanced/classlib/branches/java6/modules: awt/src/main/java/common/java/awt/ awt/src/main/java/common/org/apache/harmony/awt/gl/ awt/src/main/java/common/org/apache/harmony/awt/gl/image/ awt/src/main/java/common/org/ap...
Date Wed, 15 Aug 2007 03:05:22 GMT
Author: pyang
Date: Tue Aug 14 20:05:21 2007
New Revision: 566010

URL: http://svn.apache.org/viewvc?view=rev&rev=566010
Log:
Merge updates from classlib trunk@565677 since r564086

Added:
    harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/gl/windows/LockingKeys.cpp
      - copied unchanged from r565677, harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/windows/LockingKeys.cpp
Modified:
    harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/Toolkit.java
    harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java
    harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/BufferedImageGraphics2D.java
    harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/wtk/WTK.java
    harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XGraphics2D.java
    harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/LinuxWTK.java
    harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WinWTK.java
    harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/gl/windows/GDIBlitter.cpp
    harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/gl/windows/GDIBlitter.h
    harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/gl/windows/makefile
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/HashMap.java
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/LinkedHashMap.java
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Random.java
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/HashMapTest.java
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/LinkedHashMapTest.java
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/RandomTest.java
    harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/JOptionPane.java
    harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/HTMLDocument.java
    harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/parser/Lexer.java
    harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/text/html/HTMLDocument_Reader_ActionsTest.java

Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/Toolkit.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/Toolkit.java?view=diff&rev=566010&r1=566009&r2=566010
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/Toolkit.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/Toolkit.java
Tue Aug 14 20:05:21 2007
@@ -28,6 +28,7 @@
 import java.awt.event.AWTEventListener;
 import java.awt.event.AWTEventListenerProxy;
 import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
 import java.awt.im.InputMethodHighlight;
 import java.awt.image.ColorModel;
 import java.awt.image.ImageObserver;
@@ -795,16 +796,16 @@
         }
     }
 
-    public boolean getLockingKeyState(int a0) throws UnsupportedOperationException, org.apache.harmony.luni.util.NotImplementedException
{
-        lockAWT();
-        try {
-        } finally {
-            unlockAWT();
-        }
-        if (true) {
-            throw new RuntimeException("Method is not implemented"); //TODO: implement //$NON-NLS-1$
+    public boolean getLockingKeyState(int keyCode) throws UnsupportedOperationException {
+
+        if (keyCode != KeyEvent.VK_CAPS_LOCK &&
+            keyCode != KeyEvent.VK_NUM_LOCK &&
+            keyCode != KeyEvent.VK_SCROLL_LOCK &&
+            keyCode != KeyEvent.VK_KANA_LOCK) {
+            throw new IllegalArgumentException();
         }
-        return true;
+
+        return wtk.getLockingState(keyCode);
     }
 
     public int getMaximumCursorColors() throws HeadlessException {
@@ -952,16 +953,16 @@
         }
     }
 
-    public void setLockingKeyState(int a0, boolean a1) throws UnsupportedOperationException,
org.apache.harmony.luni.util.NotImplementedException {
-        lockAWT();
-        try {
-        } finally {
-            unlockAWT();
-        }
-        if (true) {
-            throw new RuntimeException("Method is not implemented"); //TODO: implement //$NON-NLS-1$
+    public void setLockingKeyState(int keyCode, boolean on) throws UnsupportedOperationException
 {
+
+        if (keyCode != KeyEvent.VK_CAPS_LOCK &&
+            keyCode != KeyEvent.VK_NUM_LOCK &&
+            keyCode != KeyEvent.VK_SCROLL_LOCK &&
+            keyCode != KeyEvent.VK_KANA_LOCK) {
+            throw new IllegalArgumentException();
         }
-        return;
+
+        wtk.setLockingState(keyCode, on);
     }
 
     void onQueueEmpty() {

Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java?view=diff&rev=566010&r1=566009&r2=566010
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java
Tue Aug 14 20:05:21 2007
@@ -654,70 +654,6 @@
         drawString(str, (float)x, (float)y);
     }
 
-    @Override
-    public void drawString(String str, float x, float y) {
-        if (debugOutput) {
-            System.err.println("CommonGraphics2D.drawString("+str+", "+x+", "+y+")"); //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-        }
-
-        AffineTransform at = (AffineTransform)this.getTransform().clone();
-        AffineTransform fontTransform = font.getTransform();
-        at.concatenate(fontTransform);
-
-        if (!at.isIdentity()){
-            // TYPE_TRANSLATION
-            if (at.getType() == AffineTransform.TYPE_TRANSLATION){
-                jtr.drawString(this, str,
-                        (float)(x+fontTransform.getTranslateX()),
-                        (float)(y+fontTransform.getTranslateY()));
-                return;
-            }
-            // TODO: we use slow type of drawing strings when Font object
-            // in Graphics has transforms, we just fill outlines. New textrenderer
-            // is to be implemented.
-            Shape sh = font.createGlyphVector(this.getFontRenderContext(), str).getOutline(x,
y);
-            fill(sh);
-        } else {
-            jtr.drawString(this, str, x, y);
-        }
-
-    }
-
-    @Override
-    public void drawGlyphVector(GlyphVector gv, float x, float y) {
-
-        AffineTransform at = gv.getFont().getTransform();
-
-        double[] matrix = new double[6];
-        if ((at != null) && (!at.isIdentity())){
-
-            int atType = at.getType();
-            at.getMatrix(matrix);
-
-            // TYPE_TRANSLATION
-            if ((atType == AffineTransform.TYPE_TRANSLATION) &&
-                ((gv.getLayoutFlags() & GlyphVector.FLAG_HAS_TRANSFORMS) == 0)){
-                jtr.drawGlyphVector(this, gv, (int)(x+matrix[4]), (int)(y+matrix[5]));
-                return;
-            }
-        } else {
-            if (((gv.getLayoutFlags() & GlyphVector.FLAG_HAS_TRANSFORMS) == 0)){
-                jtr.drawGlyphVector(this, gv, x, y);
-                return;
-            }
-        }
-
-        // TODO: we use slow type of drawing strings when Font object
-        // in Graphics has transforms, we just fill outlines. New textrenderer
-        // is to be implemented.
-
-        Shape sh = gv.getOutline(x, y);
-        this.fill(sh);
-
-        }
-
-
-
 
     /***************************************************************************
      *

Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/BufferedImageGraphics2D.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/BufferedImageGraphics2D.java?view=diff&rev=566010&r1=566009&r2=566010
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/BufferedImageGraphics2D.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/BufferedImageGraphics2D.java
Tue Aug 14 20:05:21 2007
@@ -23,6 +23,8 @@
 import java.awt.Graphics;
 import java.awt.GraphicsConfiguration;
 import java.awt.Rectangle;
+import java.awt.Shape;
+import java.awt.font.GlyphVector;
 import java.awt.image.BufferedImage;
 import java.awt.image.ColorModel;
 import java.awt.image.WritableRaster;
@@ -75,5 +77,17 @@
 
     public WritableRaster getWritableRaster() {
         return bi.getRaster();
+    }
+    
+    @Override
+    public void drawString(String str, float x, float y) {
+        Shape sh = font.createGlyphVector(this.getFontRenderContext(), str).getOutline(x,
y);
+        fill(sh);
+    }
+
+    @Override
+    public void drawGlyphVector(GlyphVector gv, float x, float y) {
+        Shape sh = gv.getOutline(x, y);
+        this.fill(sh);
     }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/wtk/WTK.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/wtk/WTK.java?view=diff&rev=566010&r1=566009&r2=566010
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/wtk/WTK.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/wtk/WTK.java
Tue Aug 14 20:05:21 2007
@@ -58,4 +58,10 @@
      * @return implementation of NativeIM
      */
     public abstract NativeIM getNativeIM();
+
+    /**
+     * Perform platform specific operations with locking keys.
+     */
+    public abstract boolean getLockingState(int keyCode);
+    public abstract void setLockingState(int keyCode, boolean on);
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XGraphics2D.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XGraphics2D.java?view=diff&rev=566010&r1=566009&r2=566010
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XGraphics2D.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XGraphics2D.java
Tue Aug 14 20:05:21 2007
@@ -24,6 +24,7 @@
 package org.apache.harmony.awt.gl.linux;
 
 import java.awt.*;
+import java.awt.font.GlyphVector;
 import java.awt.image.IndexColorModel;
 import java.awt.geom.AffineTransform;
 import java.awt.geom.Point2D;
@@ -530,5 +531,62 @@
         } else {
             simpleComposite = false;
         }
+    }
+
+    @Override
+    public void drawString(String str, float x, float y) {
+        AffineTransform at = (AffineTransform)this.getTransform().clone();
+        AffineTransform fontTransform = font.getTransform();
+        at.concatenate(fontTransform);
+
+        if (!at.isIdentity()){
+            // TYPE_TRANSLATION
+            if (at.getType() == AffineTransform.TYPE_TRANSLATION){
+                jtr.drawString(this, str,
+                        (float)(x+fontTransform.getTranslateX()),
+                        (float)(y+fontTransform.getTranslateY()));
+                return;
+            }
+            // TODO: we use slow type of drawing strings when Font object
+            // in Graphics has transforms, we just fill outlines. New textrenderer
+            // is to be implemented.
+            Shape sh = font.createGlyphVector(this.getFontRenderContext(), str).getOutline(x,
y);
+            fill(sh);
+        } else {
+            jtr.drawString(this, str, x, y);
+        }
+    }
+
+    @Override
+    public void drawGlyphVector(GlyphVector gv, float x, float y) {
+
+        AffineTransform at = gv.getFont().getTransform();
+
+        double[] matrix = new double[6];
+        if ((at != null) && (!at.isIdentity())){
+
+            int atType = at.getType();
+            at.getMatrix(matrix);
+
+            // TYPE_TRANSLATION
+            if ((atType == AffineTransform.TYPE_TRANSLATION) &&
+                ((gv.getLayoutFlags() & GlyphVector.FLAG_HAS_TRANSFORMS) == 0)){
+                jtr.drawGlyphVector(this, gv, (int)(x+matrix[4]), (int)(y+matrix[5]));
+                return;
+            }
+        } else {
+            if (((gv.getLayoutFlags() & GlyphVector.FLAG_HAS_TRANSFORMS) == 0)){
+                jtr.drawGlyphVector(this, gv, x, y);
+                return;
+            }
+        }
+
+        // TODO: we use slow type of drawing strings when Font object
+        // in Graphics has transforms, we just fill outlines. New textrenderer
+        // is to be implemented.
+
+        Shape sh = gv.getOutline(x, y);
+        this.fill(sh);
+
     }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/LinuxWTK.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/LinuxWTK.java?view=diff&rev=566010&r1=566009&r2=566010
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/LinuxWTK.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/LinuxWTK.java
Tue Aug 14 20:05:21 2007
@@ -89,6 +89,15 @@
         return null;
     }
 
+    public boolean getLockingState(int keyCode) {
+        // TODO implement
+        return false;
+    }
+
+    public void setLockingState(int keyCode, boolean on) {
+        // TODO implement
+    }
+
     private final LinuxWindowFactory windowFactory = new LinuxWindowFactory();
     private final LinuxEventQueue eventQueue = new LinuxEventQueue(windowFactory);
     private final GraphicsFactory graphicsFactory = new org.apache.harmony.awt.gl.linux.LinuxGraphics2DFactory();

Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WinWTK.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WinWTK.java?view=diff&rev=566010&r1=566009&r2=566010
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WinWTK.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WinWTK.java
Tue Aug 14 20:05:21 2007
@@ -27,6 +27,10 @@
 
 public class WinWTK extends WTK {
 
+    static {
+        System.loadLibrary("gl"); //$NON-NLS-1$
+    }
+
     /**
      * @see org.apache.harmony.awt.wtk.WTK#getGraphicsFactory()
      */
@@ -97,6 +101,10 @@
         }
         return im;
     }
+
+    public native boolean getLockingState(int keyCode);
+
+    public native void setLockingState(int keyCode, boolean on);
 
     private final WinSystemProperties systemProperties = new WinSystemProperties();
     private final WinEventQueue eventQueue = new WinEventQueue(systemProperties);

Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/gl/windows/GDIBlitter.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/gl/windows/GDIBlitter.cpp?view=diff&rev=566010&r1=566009&r2=566010
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/gl/windows/GDIBlitter.cpp
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/gl/windows/GDIBlitter.cpp
Tue Aug 14 20:05:21 2007
@@ -21,6 +21,7 @@
  */
  
 #include "SurfaceDataStructure.h"
+#include "bitmapSurface.h"
 #include "org_apache_harmony_awt_gl_windows_GDISurface.h"
 #include "org_apache_harmony_awt_gl_windows_GDIBlitter.h"
 #include "blitter.h"
@@ -68,7 +69,6 @@
       HBRUSH brush = CreateSolidBrush(RGB(r, g, b));
       SelectObject(tmpDC, brush);
       PatBlt(tmpDC, 0, 0, w, h, PATCOPY);
-
       if(initBitmap(srcSurf, env, srcData, true)){
           BLENDFUNCTION bf;
           bf.AlphaFormat = AC_SRC_ALPHA;
@@ -214,24 +214,36 @@
           env->ReleasePrimitiveArrayCritical(matrix, old_mtrx, 0);
 
           SetGraphicsMode(dstSurf->gi->hdc, GM_ADVANCED);
-          GetWorldTransform(dstSurf->gi->hdc, &currentTransform);
-          SetWorldTransform(dstSurf->gi->hdc, &transform);
       }
 
       HRGN oldClip = setGdiClip(env, dstSurf->gi->hdc, clip, numVertex);
 
       switch(blitStruct.blitFunctintType){
           case ALPHA_BLEND:
+              GetWorldTransform(dstSurf->gi->hdc, &currentTransform);
+              SetWorldTransform(dstSurf->gi->hdc, &transform);
               AlphaBlend(dstSurf->gi->hdc, dstX, dstY, width, height, srcSurf->srcDC,
                       srcX, srcY, width, height, blitStruct.blendFunc);
               break;
 
           case TRANSPARENT_BLT:
+              GetWorldTransform(dstSurf->gi->hdc, &currentTransform);
+              SetWorldTransform(dstSurf->gi->hdc, &transform);
               TransparentBlt(dstSurf->gi->hdc, dstX, dstY, width, height, srcSurf->srcDC,
                   srcX, srcY, width, height, srcSurf->rtc);
               break;
 
+          case COMPOSITE_BLT:
+              {
+                  void *srcDataPtr = env->GetPrimitiveArrayCritical((jarray)srcData, 0);
+                  CompositeBlt(dstSurf->gi->hdc, dstX, dstY, width, height, srcSurf,
srcDataPtr,
+                      srcX, srcY, compType, srca, &currentTransform, &transform);
+                  env->ReleasePrimitiveArrayCritical((jarray)srcData, srcDataPtr, 0);
+              }
+              break;
           default:
+              GetWorldTransform(dstSurf->gi->hdc, &currentTransform);
+              SetWorldTransform(dstSurf->gi->hdc, &transform);
               BitBlt(dstSurf->gi->hdc, dstX, dstY, width, height, srcSurf->srcDC,
                   srcX, srcY, blitStruct.rastOp);
               break;
@@ -413,18 +425,18 @@
                 blitStruct->rastOp = BLACKNESS;
                 return true;
             }
-                       if(srcSurf->invalidated || srcSurf->isAlphaPre != false){
-                               if(!initBitmap(srcSurf, env, srcData, false)) return false;
-                       }
+            if(srcSurf->invalidated || srcSurf->isAlphaPre != false){
+                if(!initBitmap(srcSurf, env, srcData, false)) return false;
+            }
             blitStruct->blitFunctintType = BIT_BLT;
             blitStruct->rastOp = SRCCOPY;
             return true;
 
         case COMPOSITE_SRC_OVER:
         case COMPOSITE_SRC_ATOP:
-                       if(srcSurf->invalidated || srcSurf->isAlphaPre != true){
-                               if(!initBitmap(srcSurf, env, srcData, true)) return false;
-                       }
+            if(srcSurf->invalidated || srcSurf->isAlphaPre != true){
+                if(!initBitmap(srcSurf, env, srcData, true)) return false;
+            }
             if(srcSurf->transparency != GL_OPAQUE || srcConstAlpha != 255){
                 blitStruct->blitFunctintType = ALPHA_BLEND;
                 blitStruct->blendFunc.AlphaFormat = srcSurf->transparency != GL_OPAQUE
? AC_SRC_ALPHA : 0;
@@ -448,18 +460,19 @@
                 blitStruct->rastOp = BLACKNESS;
                 return true;
             }
-            // TODO Need to check src alpha
-            return false;
+            blitStruct->blitFunctintType = COMPOSITE_BLT;
+            return true;
 
         case COMPOSITE_DST_OUT:
         case COMPOSITE_XOR:
+            if(srcConstAlpha != 255) return false; 
             if(srcConstAlpha == 255 && srcSurf->transparency == GL_OPAQUE){
                 blitStruct->blitFunctintType = BIT_BLT;
                 blitStruct->rastOp = BLACKNESS;
                 return true;
             }
-            // TODO Need to check src alpha
-            return false;
+            blitStruct->blitFunctintType = COMPOSITE_BLT;
+            return true;
 
         default:
             return false;
@@ -469,14 +482,106 @@
 BOOL initBitmap
 (SURFACE_STRUCTURE *srcSurf, JNIEnv *env, jobject srcData, BOOL alphaPre){
 
-       HBITMAP srcBmp = srcSurf->bitmap;
+    HBITMAP srcBmp = srcSurf->bitmap;
     if(!srcBmp){
         return false;
     }
-       updateCache(srcSurf, env, srcData, alphaPre != 0);
-       SetDIBits(srcSurf->srcDC, srcSurf->bitmap, 0, srcSurf->height, srcSurf->bmpData,
(BITMAPINFO *)&srcSurf->bmpInfo, DIB_RGB_COLORS);
+    updateCache(srcSurf, env, srcData, alphaPre != 0);
+    SetDIBits(srcSurf->srcDC, srcSurf->bitmap, 0, srcSurf->height, srcSurf->bmpData,
(BITMAPINFO *)&srcSurf->bmpInfo, DIB_RGB_COLORS);
     return true;
 }
 
+void CompositeBlt
+(HDC dstDC, jint dstX, jint dstY, jint width, jint height, SURFACE_STRUCTURE *srcSurf, 
+        void * srcData, jint srcX, jint srcY, UINT compType, UCHAR alpha, PXFORM currentTransform,

+        PXFORM transform){
+
+    HDC dc = GetDC(NULL);
+    if(dc == NULL) return;
+
+    HDC tmpDC = CreateCompatibleDC(dc);
+    if(!tmpDC){
+        ReleaseDC(NULL, dc);
+        return;
+    }
+
+    HBITMAP tmpBitmap = CreateCompatibleBitmap(dc, width, height);
+    if(tmpBitmap == NULL){
+        ReleaseDC(NULL, dc);
+        DeleteDC(tmpDC);
+        return;
+    }
 
+    ReleaseDC(NULL, dc);
 
+    SelectObject(tmpDC, tmpBitmap);
+
+    GraphicsInfo *gi = (GraphicsInfo *)malloc(sizeof(GraphicsInfo));
+    if(gi == NULL){
+        DeleteObject(tmpBitmap);
+        DeleteDC(tmpDC);
+        return;
+    }
+    memset(gi, 0, sizeof(GraphicsInfo));
+
+    SURFACE_STRUCTURE *tmpSurf = (SURFACE_STRUCTURE *)malloc(sizeof(SURFACE_STRUCTURE));
+    if(tmpSurf == NULL){
+        DeleteObject(tmpBitmap);
+        DeleteDC(tmpDC);
+        free(gi);
+        return;
+    }
+    memset(tmpSurf, 0, sizeof(SURFACE_STRUCTURE));
+
+    gi->hdc = tmpDC;
+    gi->bmp = tmpBitmap;
+
+    tmpSurf->width = width;
+    tmpSurf->height = height;
+    tmpSurf->gi = (GraphicsInfo *)gi;
+    parseFormat(tmpSurf);
+    tmpSurf->bmpData = (BYTE *)malloc(tmpSurf->bmpInfo.bmiHeader.biSizeImage);
+    if(tmpSurf->bmpData == NULL){
+        DeleteObject(tmpBitmap);
+        DeleteDC(tmpDC);
+        free(gi);
+        free(tmpSurf);
+        return;
+    }
+
+    BitBlt(tmpDC, 0, 0, width, height, dstDC, dstX, dstY, SRCCOPY);
+
+    GetDIBits(tmpDC, tmpBitmap, 0, tmpSurf->height, tmpSurf->bmpData, 
+                          (BITMAPINFO *)&tmpSurf->bmpInfo, DIB_RGB_COLORS);
+
+    switch(compType){
+        case COMPOSITE_DST_IN:
+        case COMPOSITE_DST_ATOP:
+            dst_atop_custom(srcX, srcY, srcSurf, srcData, 0, 0, tmpSurf, 
+                    tmpSurf->bmpData, width, height, alpha);
+            break;
+
+        case COMPOSITE_DST_OUT:
+        case COMPOSITE_XOR:
+            dst_out_custom(srcX, srcY, srcSurf, srcData, 0, 0, tmpSurf, 
+                    tmpSurf->bmpData, width, height, alpha);
+    }
+
+    SetDIBits(tmpDC, tmpBitmap, 0, tmpSurf->height, tmpSurf->bmpData, (BITMAPINFO *)&tmpSurf->bmpInfo,
DIB_RGB_COLORS);
+
+    GetWorldTransform(dstDC, currentTransform);
+    SetWorldTransform(dstDC, transform);
+    BitBlt(dstDC, dstX, dstY, width, height, tmpDC, 0, 0, SRCCOPY);
+
+    DeleteObject(tmpBitmap);
+    DeleteDC(tmpDC);
+
+    free(gi);
+    free(tmpSurf->bmpData);
+    if(tmpSurf->bits) free(tmpSurf->bits);
+    if(tmpSurf->colormap) free(tmpSurf->colormap);
+    if(tmpSurf->bank_indexes) free(tmpSurf->bank_indexes);
+    if(tmpSurf->band_offsets) free(tmpSurf->band_offsets);
+    free(tmpSurf);
+
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/gl/windows/GDIBlitter.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/gl/windows/GDIBlitter.h?view=diff&rev=566010&r1=566009&r2=566010
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/gl/windows/GDIBlitter.h
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/gl/windows/GDIBlitter.h
Tue Aug 14 20:05:21 2007
@@ -33,6 +33,7 @@
 #define TRANSPARENT_BLT 1
 #define ALPHA_BLEND     2
 #define NULL_BLT        3
+#define COMPOSITE_BLT   4
 
 void findNonExistColor(DWORD &, DWORD *, UINT);
 BOOL isRepeatColor(UINT , DWORD *, UINT);
@@ -41,4 +42,7 @@
                                 UCHAR srcConstAlpha, BLITSTRUCT *blitStruct);
 
 BOOL initBitmap(SURFACE_STRUCTURE *srcSurf, JNIEnv *env, jobject srcData, BOOL alphaPre);
+
+void CompositeBlt(HDC, jint, jint, jint, jint, SURFACE_STRUCTURE *, void *, jint, jint, UINT,
UCHAR, PXFORM, PXFORM);
+
 #endif

Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/gl/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/gl/windows/makefile?view=diff&rev=566010&r1=566009&r2=566010
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/gl/windows/makefile
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/gl/windows/makefile
Tue Aug 14 20:05:21 2007
@@ -23,7 +23,7 @@
 LIBNAME=$(LIBPATH)$(LIBBASE).lib
 HYLDFLAGS = $(HYLDFLAGS) -def:$(LIBBASE).def
 
-HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB)include /I$(SHAREDSUB) \
+HYCFLAGS = $(HYCFLAGS) /D_WIN32_WINNT=0x0500 /I$(SHAREDSUB)include /I$(SHAREDSUB) \
            /I$(PNG_DIR) /Iinclude
 
 BUILDFILES = \
@@ -32,6 +32,7 @@
   WinGDIPGraphics2D.obj \
   WinGraphicsEnvironment.obj \
   WinThemeGraphics.obj \
+  LockingKeys.obj \
   $(SHAREDSUB)blitter.obj \
   $(SHAREDSUB)gifdecoder.obj \
   $(SHAREDSUB)LUTTables.obj \

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/HashMap.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/HashMap.java?view=diff&rev=566010&r1=566009&r2=566010
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/HashMap.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/HashMap.java
Tue Aug 14 20:05:21 2007
@@ -331,11 +331,16 @@
     public Object clone() {
         try {
             HashMap<K, V> map = (HashMap<K, V>) super.clone();
+            map.elementCount = 0;
             map.elementData = newElementArray(elementData.length);
             Entry<K, V> entry;
             for (int i = 0; i < elementData.length; i++) {
-                if ((entry = elementData[i]) != null) {
-                    map.elementData[i] = (Entry<K, V>) entry.clone();
+                if ((entry = elementData[i]) != null){
+                    map.putImpl(entry.getKey(), entry.getValue());
+                    while (entry.next != null){
+                        entry = entry.next;
+                        map.putImpl(entry.getKey(), entry.getValue());
+                    }
                 }
             }
             return map;
@@ -526,7 +531,7 @@
         return putImpl(key, value);
     }
 
-    private V putImpl(K key, V value) {
+    V putImpl(K key, V value) {
         Entry<K,V> entry;
         if(key == null) {
             entry = findNullKeyEntry();

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/LinkedHashMap.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/LinkedHashMap.java?view=diff&rev=566010&r1=566009&r2=566010
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/LinkedHashMap.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/LinkedHashMap.java
Tue Aug 14 20:05:21 2007
@@ -332,7 +332,20 @@
      */
     @Override
     public V put(K key, V value) {
+        V result = putImpl(key,value);
+
+        if (removeEldestEntry(head)) {
+            remove(head.key);
+        }
+
+        return result;
+    }
+    
+    V putImpl(K key, V value){
         LinkedHashMapEntry<K, V> m;
+        if (elementCount == 0){
+            head = tail = null;
+        }
         if (key == null) {
             m = (LinkedHashMapEntry<K, V>)findNullKeyEntry();
             if (m == null) {
@@ -352,7 +365,7 @@
             int hash = key.hashCode();
             int index = (hash & 0x7FFFFFFF) % elementData.length;
             m = (LinkedHashMapEntry<K, V>)findNonNullKeyEntry(key, index, hash);
-            if (m == null) {
+            if (m == null) {                
                 modCount++;
                 if (++elementCount > threshold) {
                     rehash();
@@ -366,11 +379,6 @@
 
         V result = m.value;
         m.value = value;
-
-        if (removeEldestEntry(head)) {
-            remove(head.key);
-        }
-
         return result;
     }
 
@@ -583,21 +591,4 @@
         head = tail = null;
     }
 
-    /**
-     * Answers a new HashMap with the same mappings and size as this HashMap.
-     * 
-     * @return a shallow copy of this HashMap
-     * 
-     * @see java.lang.Cloneable
-     */
-    @Override
-    @SuppressWarnings("unchecked")
-    public Object clone() {
-        LinkedHashMap<K, V> map = (LinkedHashMap<K, V>) super.clone();
-        map.clear();
-        for (Map.Entry<K, V> entry : entrySet()) {
-            map.put(entry.getKey(), entry.getValue());
-        }
-        return map;
-    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Random.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Random.java?view=diff&rev=566010&r1=566009&r2=566010
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Random.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Random.java
Tue Aug 14 20:05:21 2007
@@ -59,7 +59,7 @@
      * @see #setSeed
      */
     public Random() {
-        setSeed(System.currentTimeMillis());
+        setSeed(System.currentTimeMillis() + hashCode());
     }
 
     /**

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/HashMapTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/HashMapTest.java?view=diff&rev=566010&r1=566009&r2=566010
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/HashMapTest.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/HashMapTest.java
Tue Aug 14 20:05:21 2007
@@ -187,6 +187,17 @@
 		assertTrue("keySet() is identical", key2 != keys);
 		assertEquals("keySet() was not cloned", 
 				"key2", key2.iterator().next());
+        
+        // regresion test for HARMONY-4603
+        HashMap hashmap = new HashMap();
+        MockClonable mock = new MockClonable(1);
+        hashmap.put(1, mock);
+        assertEquals(1, ((MockClonable) hashmap.get(1)).i);
+        HashMap hm3 = (HashMap)hashmap.clone();
+        assertEquals(1, ((MockClonable) hm3.get(1)).i);
+        mock.i = 0;
+        assertEquals(0, ((MockClonable) hashmap.get(1)).i);
+        assertEquals(0, ((MockClonable) hm3.get(1)).i);
 	}
 
 	/**
@@ -477,6 +488,19 @@
 	    expected += key.hashCode() ^ val.hashCode();
 	    assertEquals(expected, map.hashCode());
 	} 
+    
+    class MockClonable implements Cloneable{
+        public int i;
+        
+        public MockClonable(int i) {
+            this.i = i;
+        }
+        
+        @Override
+        protected Object clone() throws CloneNotSupportedException {
+            return new MockClonable(i);
+        }
+    }
 	
 	/**
 	 * Sets up the fixture, for example, open a network connection. This method

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/LinkedHashMapTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/LinkedHashMapTest.java?view=diff&rev=566010&r1=566009&r2=566010
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/LinkedHashMapTest.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/LinkedHashMapTest.java
Tue Aug 14 20:05:21 2007
@@ -371,6 +371,33 @@
 		assertEquals("keySet() was not cloned", 
 				"key2", key2.iterator().next());
 	}
+    
+    // regresion test for HARMONY-4603
+    public void test_clone_Mock() {
+        LinkedHashMap hashMap = new MockMap();
+        String value = "value a";
+        hashMap.put("key", value);
+        MockMap cloneMap = (MockMap) hashMap.clone();
+        assertEquals(value, cloneMap.get("key"));
+        assertEquals(hashMap, cloneMap);
+        assertEquals(1, cloneMap.num);
+
+        hashMap.put("key", "value b");
+        assertFalse(hashMap.equals(cloneMap));
+    }
+
+    class MockMap extends LinkedHashMap {
+        int num;
+
+        public Object put(Object k, Object v) {
+            num++;
+            return super.put(k, v);
+        }
+
+        protected boolean removeEldestEntry(Map.Entry e) {
+            return num > 1;
+        }
+    } 
 
 	/**
 	 * @tests java.util.LinkedHashMap#containsKey(java.lang.Object)

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/RandomTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/RandomTest.java?view=diff&rev=566010&r1=566009&r2=566010
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/RandomTest.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/RandomTest.java
Tue Aug 14 20:05:21 2007
@@ -243,6 +243,17 @@
 					"Reseting a random to its old seed did not result in the same chain of values as it
gave before",
 					aRandom.nextLong() == randomArray[counter]);
 	}
+    
+    // two random create at a time should also generated different results
+    // regression test for Harmony 4616
+    public void test_random_generate() throws Exception {
+        for (int i = 0; i < 100; i++) {
+            Random random1 = new Random();
+            Random random2 = new Random();
+            assertFalse(random1.nextLong() == random2.nextLong());    
+        }
+    }
+
 
 	/**
 	 * Sets up the fixture, for example, open a network connection. This method

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/JOptionPane.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/JOptionPane.java?view=diff&rev=566010&r1=566009&r2=566010
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/JOptionPane.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/JOptionPane.java
Tue Aug 14 20:05:21 2007
@@ -456,6 +456,7 @@
         Object oldValue = message;
         message = newMessage;
         firePropertyChange(MESSAGE_PROPERTY, oldValue, newMessage);
+		updateUI();
     }
 
     public Object getMessage() {
@@ -466,6 +467,7 @@
         Icon oldValue = icon;
         icon = newIcon;
         firePropertyChange(ICON_PROPERTY, oldValue, newIcon);
+		updateUI();
     }
 
     public Icon getIcon() {
@@ -476,6 +478,7 @@
         Object oldValue = value;
         value = newValue;
         firePropertyChange(VALUE_PROPERTY, oldValue, newValue);
+		updateUI();
     }
 
     public Object getValue() {
@@ -486,6 +489,7 @@
         Object[] oldValue = options;
         options = newOptions;
         firePropertyChange(OPTIONS_PROPERTY, oldValue, newOptions);
+		updateUI();
     }
 
     public Object[] getOptions() {
@@ -496,6 +500,7 @@
         Object oldValue = initialValue;
         initialValue = newValue;
         firePropertyChange(INITIAL_VALUE_PROPERTY, oldValue, newValue);
+		updateUI();
     }
 
     public Object getInitialValue() {
@@ -519,6 +524,7 @@
                     "JOptionPane.WARNING_MESSAGE, JOptionPane.QUESTION_MESSAGE " + //$NON-NLS-1$
                     "or JOptionPane.PLAIN_MESSAGE"); //$NON-NLS-1$
         }
+		updateUI();
     }
 
     public int getMessageType() {
@@ -538,6 +544,7 @@
         default:
             throw new RuntimeException(Messages.getString("swing.20")); //$NON-NLS-1$
         }
+		updateUI();
     }
 
     public int getOptionType() {
@@ -549,6 +556,7 @@
         selectionValues = newValues;
         firePropertyChange(SELECTION_VALUES_PROPERTY, oldSelectionValues, newValues);
         setWantsInput(selectionValues != null);
+		updateUI();
     }
 
     public Object[] getSelectionValues() {
@@ -559,6 +567,7 @@
         Object oldInitialSelectionValue = initialSelectionValue;
         initialSelectionValue = newValue;
         firePropertyChange(INITIAL_SELECTION_VALUE_PROPERTY, oldInitialSelectionValue, newValue);
+		updateUI();
     }
 
     public Object getInitialSelectionValue() {
@@ -569,6 +578,7 @@
         Object oldValue = inputValue;
         inputValue = newValue;
         firePropertyChange(INPUT_VALUE_PROPERTY, oldValue, newValue);
+		updateUI();
     }
 
     public Object getInputValue() {
@@ -583,6 +593,7 @@
         boolean oldValue = wantsInput;
         wantsInput = newValue;
         firePropertyChange(WANTS_INPUT_PROPERTY, oldValue, newValue);
+		updateUI();
     }
 
     public boolean getWantsInput() {
@@ -638,5 +649,6 @@
             return;
         }
         dialog.getRootPane().setWindowDecorationStyle(messageTypeToRootPaneDecoration(messageType));
+		//updateUI();
     }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/HTMLDocument.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/HTMLDocument.java?view=diff&rev=566010&r1=566009&r2=566010
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/HTMLDocument.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/HTMLDocument.java
Tue Aug 14 20:05:21 2007
@@ -690,8 +690,22 @@
             }
         }
 
-        protected void preContent(final char[] data) {
-            addContent(data, 0, data.length);
+        protected void preContent(char[] data) {
+            int offset = 0;
+
+            for (int i = 0; i < data.length; i++) {
+                if ((data[i] == '\n') || (data[i] == '\r')) {
+                    addContent(data, offset, i - offset);
+                    blockClose(HTML.Tag.IMPLIED);
+
+                    blockOpen(HTML.Tag.IMPLIED, new SimpleAttributeSet());
+                    offset = i + 1;
+                }
+            }
+
+            if (offset < data.length) {
+                addContent(data, offset, data.length - offset);
+            }
         }
 
         protected void addContent(final char[] data, final int offset,

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/parser/Lexer.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/parser/Lexer.java?view=diff&rev=566010&r1=566009&r2=566010
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/parser/Lexer.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/parser/Lexer.java
Tue Aug 14 20:05:21 2007
@@ -381,6 +381,8 @@
 	private int offsetCDATA=0;
 	
 	private LexerTextStateType textState = LexerTextStateType.DEFAULT;
+	
+	private int preEntryCounter;
 
 	/**
 	 * Decsribes whether a piece of text (no white space) was parsed.
@@ -544,17 +546,8 @@
 						buffer.append(yytext());
 					break;
 					case LINE_TERMINATOR:
-						if (terminatorSkipped) {
-							buffer.append(yytext());
-						}  
-						/* 
-						* Collapses if there is only one last line terminator. 
-						* If there are more then doesn't do it (same as RI)
-						* FIXME 
-						*/
-						skipLastLineTerminator = !lastWasLineTerminator;
-						lastWasLineTerminator = true;
-						terminatorSkipped = true;
+					    buffer.append(yytext());
+					    terminatorSkipped = false;
 					break;
 					case TEXT:
 						buffer.append(yytext());
@@ -644,7 +637,7 @@
 		textParsed = false;
 		terminatorSkipped = false;
 		lastWasLineTerminator = false;
-		textState = LexerTextStateType.DEFAULT;
+		
 		return textToken;
 	}
 
@@ -801,7 +794,13 @@
    * @param newState the new lexical state
    */
   public final void yybegin(int newState) {
-    zzLexicalState = newState;
+      if ((newState == ENDTAG) && isPreformatted(yytext().substring(2))) {
+          preEntryCounter --;
+          textState = (preEntryCounter == 0) ? LexerTextStateType.DEFAULT : 
+              LexerTextStateType.PREFORMATTED;
+      }
+      
+      zzLexicalState = newState;
   }
 
 
@@ -1460,6 +1459,7 @@
 			yybegin(TAG_IGNORE_ATTS);
 		} else {
 			if (isPreformatted(tagName)) {
+			    preEntryCounter ++;
 				textState = LexerTextStateType.PREFORMATTED;
 			}
 			currentCDATAClosingTag = null;

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/text/html/HTMLDocument_Reader_ActionsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/text/html/HTMLDocument_Reader_ActionsTest.java?view=diff&rev=566010&r1=566009&r2=566010
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/text/html/HTMLDocument_Reader_ActionsTest.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/text/html/HTMLDocument_Reader_ActionsTest.java
Tue Aug 14 20:05:21 2007
@@ -20,10 +20,12 @@
 */
 package javax.swing.text.html;
 
+import java.io.StringReader;
 import java.net.URL;
 import java.util.ArrayList;
 
 import javax.swing.text.AttributeSet;
+import javax.swing.text.Element;
 import javax.swing.text.MutableAttributeSet;
 import javax.swing.text.SimpleAttributeSet;
 import javax.swing.text.Style;
@@ -543,9 +545,8 @@
         assertEquals(2, reader.parseBuffer.size());
         reader.handleText(text.toCharArray(), 0);
         
-        assertEquals(3, reader.parseBuffer.size());
-        ElementSpec spec = (ElementSpec)reader.parseBuffer.get(2);
-        assertEquals(text.length(), spec.getLength());
+        assertEquals(7, reader.parseBuffer.size());
+        ElementSpec spec = (ElementSpec)reader.parseBuffer.get(6);
         assertEquals(text.length(), spec.getArray().length);
     }
     
@@ -559,10 +560,39 @@
         assertEquals(2, reader.parseBuffer.size());
         reader.preContent(text.toCharArray());
         
-        assertEquals(3, reader.parseBuffer.size());
-        ElementSpec spec = (ElementSpec)reader.parseBuffer.get(2);
-        assertEquals(text.length(), spec.getLength());
+        assertEquals(7, reader.parseBuffer.size());
+        ElementSpec spec = (ElementSpec)reader.parseBuffer.get(6);
         assertEquals(text.length(), spec.getArray().length);
+    }
+    
+    public void testHarmony_4582() throws Exception {
+        final Element pre;
+        final HTMLDocument doc = new HTMLDocument();
+
+        new HTMLEditorKit().read(new StringReader("<html><body><pre>line1\n"
//$NON-NLS-1$
+                + "line2</pre></body></html>"), doc, 0); //$NON-NLS-1$
+
+        assertEquals("line1", doc.getText(1, 5)); //$NON-NLS-1$
+        assertEquals("line2", doc.getText(7, 5)); //$NON-NLS-1$
+
+        pre = doc.getRootElements()[0].getElement(1).getElement(0);
+        assertEquals(1, pre.getElement(0).getStartOffset());
+        assertEquals(7, pre.getElement(0).getEndOffset());
+        assertEquals(7, pre.getElement(1).getStartOffset());
+        assertEquals(13, pre.getElement(1).getEndOffset());
+    }
+    
+    public void testHarmony_4615() throws Exception {
+        final HTMLDocument doc = new HTMLDocument();
+
+        new HTMLEditorKit().read(new StringReader("<html><body><pre>line1\n"
//$NON-NLS-1$
+                + "<font color='red'>line2 \n line3</font>" //$NON-NLS-1$
+                + "line3</pre>line4 \n line4</body></html>"), doc, 0);
//$NON-NLS-1$
+
+        assertEquals("line1\n", doc.getText(1, 6)); //$NON-NLS-1$
+        assertEquals("line2 \n line3", doc.getText(7, 13)); //$NON-NLS-1$
+        assertEquals("line3", doc.getText(20, 5)); //$NON-NLS-1$
+        assertEquals("line4 line4", doc.getText(26, 11)); //$NON-NLS-1$
     }
     
     public void testTag_ContentWhitespaces() {



Mime
View raw message