harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r564147 - in /harmony/enhanced/classlib/branches/java6/modules: awt/src/main/java/common/org/apache/harmony/awt/gl/ awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/ awt/src/main/native/gl/windows/include/ awt/src/test/api/java/c...
Date Thu, 09 Aug 2007 08:54:20 GMT
Author: pyang
Date: Thu Aug  9 01:54:18 2007
New Revision: 564147

URL: http://svn.apache.org/viewvc?view=rev&rev=564147
Log:
Merge updates from classlib trunk@564086 since r562232

Modified:
    harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/Crossing.java
    harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/ImageSurface.java
    harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGraphicsConfiguration.java
    harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/gl/windows/include/org_apache_harmony_awt_gl_windows_GDIBlitter.h
    harmony/enhanced/classlib/branches/java6/modules/awt/src/test/api/java/common/java/awt/geom/AreaTest.java
    harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSliderUI.java
    harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSplitPaneUI.java
    harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/BackgroundImageLoader.java
    harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/CSS.java
    harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/FormViewComponentFactory.java
    harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/ImageView.java
    harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/default.css
    harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/text/html/ImageViewTest.java

Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/Crossing.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/Crossing.java?view=diff&rev=564147&r1=564146&r2=564147
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/Crossing.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/Crossing.java
Thu Aug  9 01:54:18 2007
@@ -382,14 +382,9 @@
             }
         }
 
-        // START
-        if (x == x1) {
-            return x1 < x2 ? 0 : -1;
-        }
-
-        // END
-        if (x == x2) {
-            return x1 < x2 ? 1 : 0;
+        // START or END
+        if (x == x1 || x == x2) {
+            return 0;
         }
 
         // INSIDE-DOWN

Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/ImageSurface.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/ImageSurface.java?view=diff&rev=564147&r1=564146&r2=564147
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/ImageSurface.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/ImageSurface.java
Thu Aug  9 01:54:18 2007
@@ -218,7 +218,7 @@
     }
 
     @Override
-    public void dispose() {
+    public synchronized void dispose() {
         if(surfaceDataPtr != 0L){
             dispose(surfaceDataPtr);
             surfaceDataPtr = 0L;

Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGraphicsConfiguration.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGraphicsConfiguration.java?view=diff&rev=564147&r1=564146&r2=564147
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGraphicsConfiguration.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGraphicsConfiguration.java
Thu Aug  9 01:54:18 2007
@@ -99,6 +99,11 @@
         }
 
         bits = pfd.get_cColorBits();
+        if (bits == 0) { 
+            cm = null; 
+            return; 
+        }
+        
         redBits = pfd.get_cRedBits();
         redShift = pfd.get_cRedShift();
         rmask = (int)(Math.pow(2,redBits)-1) << redShift;

Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/gl/windows/include/org_apache_harmony_awt_gl_windows_GDIBlitter.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/gl/windows/include/org_apache_harmony_awt_gl_windows_GDIBlitter.h?view=diff&rev=564147&r1=564146&r2=564147
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/gl/windows/include/org_apache_harmony_awt_gl_windows_GDIBlitter.h
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/gl/windows/include/org_apache_harmony_awt_gl_windows_GDIBlitter.h
Thu Aug  9 01:54:18 2007
@@ -72,7 +72,7 @@
  */
 JNIEXPORT void JNICALL
 Java_org_apache_harmony_awt_gl_windows_GDIBlitter_bltBGImage(JNIEnv *, jobject, 
-    jint, jint, jlong, jobject, jint, jint, jlong, jint, jint, jint, jint, jfloat, jdoubleArray,
jintArray, jint jboolean);
+    jint, jint, jlong, jobject, jint, jint, jlong, jint, jint, jint, jint, jfloat, jdoubleArray,
jintArray, jint, jboolean);
 
 
 #ifdef __cplusplus

Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/test/api/java/common/java/awt/geom/AreaTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/test/api/java/common/java/awt/geom/AreaTest.java?view=diff&rev=564147&r1=564146&r2=564147
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/test/api/java/common/java/awt/geom/AreaTest.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/test/api/java/common/java/awt/geom/AreaTest.java
Thu Aug  9 01:54:18 2007
@@ -46,14 +46,6 @@
     
     public void testContainsPoint() {
         try {
-             Area area = new Area(new Ellipse2D.Double(200, 300, 400, 200));
-             assertTrue(area.contains(250, 350));
-             assertFalse(area.contains(200, 300));
-             assertFalse(area.contains(50, 50));
-             
-             assertTrue(area.contains(new Point2D.Double(500, 400)));
-             assertFalse(area.contains(new Point2D.Double(700, 400)));
-             
              // Regression test HARMONY-1404
              Area emptyArea = new Area();
              emptyArea.contains((Point2D)null);
@@ -61,6 +53,25 @@
          } catch (NullPointerException e) {
              // expected
          }
+         
+         Area area = new Area(new Ellipse2D.Double(200, 300, 400, 200));
+         assertTrue(area.contains(250, 350));
+         assertFalse(area.contains(200, 300));
+         assertFalse(area.contains(50, 50));
+         
+         assertTrue(area.contains(new Point2D.Double(500, 400)));
+         assertFalse(area.contains(new Point2D.Double(700, 400)));
+         
+         // Regression test HARMONY-4612
+         GeneralPath path = new GeneralPath();
+         path.moveTo(50, 100);
+         path.lineTo(100, 50);
+         path.lineTo(150, 100);
+         path.lineTo(100, 150);
+         path.closePath();
+         
+         Area areaPath = new Area(path);
+         assertFalse(areaPath.contains(100, 50));
      }
 
      public void testContainsRect() {

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSliderUI.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSliderUI.java?view=diff&rev=564147&r1=564146&r2=564147
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSliderUI.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSliderUI.java
Thu Aug  9 01:54:18 2007
@@ -700,28 +700,36 @@
                                                 : heightOfLowValueLabel / 2;
             }
         } else {
-            trackBuffer = (slider.getOrientation() == JSlider.HORIZONTAL)
-                       ? getThumbSize().width / 2
-                       : getThumbSize().height / 2;
+            trackBuffer = 0;
         }
     }
 
     protected void calculateTrackRect() {
-        if (slider.getOrientation() == JSlider.HORIZONTAL) {
-            int width = contentRect.width - trackBuffer * 2 - thumbRect.width;
-            int x = contentRect.x + trackBuffer + thumbRect.width / 2;
-            int y = contentRect.y + contentRect.height / 2 - (thumbRect.height + labelRect.height
+ tickRect.height) / 2;
-            trackRect.setBounds(x, y, width, thumbRect.height);
-        } else {
-            int height = contentRect.height - trackBuffer * 2 - thumbRect.height;
-            int x;
+
+        if (slider.getOrientation() == JSlider.HORIZONTAL) {            
+            int width = contentRect.width - trackBuffer * 2
+                          - getThumbSize().width;
+            int x = contentRect.x + trackBuffer + getThumbSize().width / 2;
+            int y = contentRect.y + (contentRect.height - getThumbSize().height
+                          + labelRect.height + tickRect.height) / 2;
+            
+            trackRect.setBounds(x, y, width, getThumbSize().height);
+            
+        } else {            
+            int height = contentRect.height - trackBuffer * 2
+                          - getThumbSize().height;
             int sizeToCenter = (getThumbSize().width + labelRect.width + tickRect.width)
/ 2;
+            int y = contentRect.y + trackBuffer + getThumbSize().height / 2;
+            int x;
+            
             if (slider.getComponentOrientation().isLeftToRight()) {
                 x = contentRect.x + contentRect.width / 2 - sizeToCenter;
+                
             } else {
-                x = contentRect.x + contentRect.width / 2 + sizeToCenter - getThumbSize().width;
+                x = contentRect.x + contentRect.width / 2 + sizeToCenter
+                          - getThumbSize().width;
             }
-            int y = contentRect.y + trackBuffer + thumbRect.height / 2;
+            
             trackRect.setBounds(x, y, getThumbSize().width, height);
         }
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSplitPaneUI.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSplitPaneUI.java?view=diff&rev=564147&r1=564146&r2=564147
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSplitPaneUI.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSplitPaneUI.java
Thu Aug  9 01:54:18 2007
@@ -382,6 +382,18 @@
                     splitPane.setDividerLocation(dividerLocation);
                 }
             }
+            if ((components[RIGHT_COMPONENT_INDEX] != null) && (components[LEFT_COMPONENT_INDEX]
== null)) {
+                dividerLocation = topLeft;
+                if (dividerLocation != splitPane.getDividerLocation() && isDisplayed)
{
+                    splitPane.setDividerLocation(dividerLocation);
+                }
+            }            
+            if ((components[RIGHT_COMPONENT_INDEX] == null) && (components[LEFT_COMPONENT_INDEX]
!= null)) {
+                dividerLocation = containerSize - bottomRight - dividerSize;
+                if (dividerLocation != splitPane.getDividerLocation() && isDisplayed)
{
+                    splitPane.setDividerLocation(dividerLocation);
+                }
+            }            
         }
     }
 

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/BackgroundImageLoader.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/BackgroundImageLoader.java?view=diff&rev=564147&r1=564146&r2=564147
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/BackgroundImageLoader.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/BackgroundImageLoader.java
Thu Aug  9 01:54:18 2007
@@ -40,16 +40,26 @@
     private volatile boolean ready;
     private volatile boolean error;
 
-    BackgroundImageLoader(final URL url,
+    private boolean synchronous;
+    Object lock = new Object();
+
+    final Toolkit tk = Toolkit.getDefaultToolkit();
+
+    BackgroundImageLoader(final URL url, boolean synchronous,
                           final int desiredWidth, final int desiredHeight) {
         this.desiredWidth = desiredWidth;
         this.desiredHeight = desiredHeight;
 
+        this.synchronous = synchronous;
+
         error = url == null;
         if (!error) {
-            final Toolkit tk = Toolkit.getDefaultToolkit();
             image = tk.createImage(url);
-            tk.prepareImage(image, desiredWidth, desiredHeight, this);
+            if (synchronous){
+                waitForImage();
+            } else {
+                tk.prepareImage(image, desiredWidth, desiredHeight, this);
+            }
         } else {
             image = null;
         }
@@ -64,16 +74,22 @@
         if ((flags & HEIGHT) != 0) {
             imageHeight = desiredHeight == -1 ? height : desiredHeight;
         }
-        if ((flags & ALLBITS) != 0) {
+        if ((flags & (FRAMEBITS | ALLBITS)) != 0) {
             ready = true;
             onReady();
         }
         if ((flags & (ERROR | ABORT)) != 0) {
             error = true;
             onError();
-            return false;
         }
-        return width == -1 || height == -1 || !ready;
+
+        if (synchronous){
+            synchronized (lock){
+                lock.notify();
+            }
+        }
+
+        return (flags & ALLBITS) == 0;
     }
 
     public final Image getImage() {
@@ -97,11 +113,15 @@
     }
 
     public final void waitForImage() {
-        while (!ready && !error) {
-            try {
-                Thread.sleep(100);
-            } catch (InterruptedException e) {
-                e.printStackTrace();
+        synchronized (lock){
+            if (!tk.prepareImage(image, desiredWidth, desiredHeight, this)) {
+                while (!(error | ready)) {
+                    try {
+                        lock.wait(1000);
+                    } catch(InterruptedException e) {
+                        Thread.currentThread().interrupt();
+                    }
+                }
             }
         }
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/CSS.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/CSS.java?view=diff&rev=564147&r1=564146&r2=564147
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/CSS.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/CSS.java
Thu Aug  9 01:54:18 2007
@@ -528,7 +528,7 @@
             if (path != null && imageLoader == null) {
 
                 final URL url = HTML.resolveURL(path, base);
-                imageLoader = new BackgroundImageLoader(url, -1, -1) {
+                imageLoader = new BackgroundImageLoader(url, true, -1, -1) {
                     protected void onReady() {
                         super.onReady();
                         notifyViews();

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/FormViewComponentFactory.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/FormViewComponentFactory.java?view=diff&rev=564147&r1=564146&r2=564147
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/FormViewComponentFactory.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/FormViewComponentFactory.java
Thu Aug  9 01:54:18 2007
@@ -86,7 +86,7 @@
                 if (url == null) {
                     icon = HTMLIconFactory.getLoadingFailedIcon();
                 } else {
-                    loader = new BackgroundImageLoader(url, -1, -1) {
+                    loader = new BackgroundImageLoader(url, true, -1, -1) {
                         protected void onReady() {
                             super.onReady();
                             view.preferenceChanged(view, true, true);

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/ImageView.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/ImageView.java?view=diff&rev=564147&r1=564146&r2=564147
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/ImageView.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/ImageView.java
Thu Aug  9 01:54:18 2007
@@ -53,11 +53,15 @@
 
     private BackgroundImageLoader loader;
     private String src;
-    private URL imageURL;
 
-    private boolean synchronous;
+    //TODO We can load images only synchronously yet
+    private boolean synchronous = true;
 
     private Color color;
+    
+    private int border;
+    private int vSpace;
+    private int hSpace;
 
     public ImageView(final Element element) {
         super(element);
@@ -67,15 +71,12 @@
     }
 
     public Image getImage() {
-        return loader.image;
+        return loader.getImage();
     }
 
     public URL getImageURL() {
-        if (imageURL == null) {
-            URL base = ((HTMLDocument)getDocument()).getBase();
-            imageURL = HTML.resolveURL(src, base);
-        }
-        return imageURL;
+        URL base = ((HTMLDocument)getDocument()).getBase();
+        return HTML.resolveURL(src, base);
     }
 
     public Icon getLoadingImageIcon() {
@@ -100,23 +101,24 @@
             FontMetrics metrics = null;
             if (alt != null) {
                 Font font = getStyleSheet().getFont(getAttributes());
-                metrics = Toolkit.getDefaultToolkit().getFontMetrics(font);
+                metrics = Toolkit.getDefaultToolkit().getFontMetrics(font);             
  
             }
-
-            return axis == X_AXIS
-                   ? getNoImageIcon().getIconWidth()
-                     + (metrics != null ? metrics.stringWidth(alt) : 0)
-                   : Math.max(getNoImageIcon().getIconHeight(),
-                     (metrics != null ? metrics.getHeight() : 0));
+           
+            return axis == X_AXIS ? getNoImageIcon().getIconWidth()
+                        + 2 * border + 2 * hSpace
+                        + ((metrics == null) ? 0 : metrics.stringWidth(alt))
+                        : ((metrics == null) ? getNoImageIcon().getIconHeight()
+                                : Math.max(getNoImageIcon().getIconHeight(),metrics.getHeight())
+                                + 2 * border + 2 * vSpace);
         }
         if (!loader.isReady()) {
-            return axis == X_AXIS ? getLoadingImageIcon().getIconWidth()
-                                  : getLoadingImageIcon().getIconHeight();
+            return axis == X_AXIS ? getLoadingImageIcon().getIconWidth()+ 2 * border + 2
* hSpace
+                                  : getLoadingImageIcon().getIconHeight() + 2 * border +
2 * vSpace;
         }
         if (axis == X_AXIS) {
-            return loader.getWidth();
+            return loader.getWidth() + 2 * border + 2 * hSpace;
         }
-        return loader.getHeight();
+        return loader.getHeight() + 2 * border + 2 * vSpace;
     }
 
     public String getToolTipText(final float x, final float y,
@@ -129,9 +131,13 @@
                        .getAttribute(HTML.Attribute.ALT);
     }
 
-    public void paint(final Graphics g, final Shape shape) {
+public void paint(final Graphics g, final Shape shape) {
+        
         Rectangle rc = shape.getBounds();
-
+        rc.setSize(rc.width - 2*(hSpace + border), rc.height - 2*(vSpace + border));
+        
+        
+        
         // TODO change layered highlight painting code
         JTextComponent tc = (JTextComponent)getContainer();
         Highlighter hl = tc.getHighlighter();
@@ -141,11 +147,20 @@
                                                             getEndOffset(),
                                                             shape, tc, this);
         }
+        
+        Color oldColor = g.getColor();
+        g.setColor(color);
+        g.fillRect(rc.x + hSpace, rc.y + vSpace, rc.width + 2 * border,
+                rc.height + 2 * border);
+        g.setColor(oldColor);
+        g.fillRect(rc.x + hSpace + border, rc.y + vSpace + border, rc.width,
+                rc.height);
 
         if (loader.isError()) {
-            getNoImageIcon().paintIcon(null, g, rc.x, rc.y);
-            Color oldColor = g.getColor();
+            
             g.setColor(color);
+            
+            getNoImageIcon().paintIcon(null, g, rc.x + hSpace + border, rc.y+vSpace + border);
 
             String alt = getAltText();
             if (alt != null) {
@@ -154,12 +169,12 @@
                 Font font = getStyleSheet().getFont(getAttributes());
                 g.setFont(font);
                 FontMetrics metrics = g.getFontMetrics();
-                g.drawString(alt, rc.x + getNoImageIcon().getIconWidth(),
-                             rc.y + metrics.getAscent());
-
+                g.drawString(alt, rc.x + hSpace + border
+                        + getNoImageIcon().getIconWidth(), rc.y + vSpace + border+ metrics.getAscent());
+                
                 g.setFont(oldFont);
             }
-            g.drawRect(rc.x, rc.y, rc.width - 1, rc.height - 1);
+            
             g.setColor(oldColor);
             return;
         }
@@ -167,13 +182,11 @@
         if (!loader.isReady()) {
             if (!synchronous) {
                 getLoadingImageIcon().paintIcon(null, g, rc.x, rc.y);
-            } else {
-                loader.waitForImage();
+                return;
             }
-            return;
         }
 
-        g.drawImage(getImage(), rc.x, rc.y, rc.width, rc.height, loader);
+        g.drawImage(getImage(), rc.x + hSpace + border, rc.y + vSpace + border, rc.width,
rc.height, loader);
     }
 
     public Shape modelToView(final int pos, final Shape shape, final Bias bias)
@@ -222,8 +235,15 @@
     protected void setPropertiesFromAttributes() {
         attrs = getStyleSheet().getViewAttributes(this);
 
-        src = (String)getElement().getAttributes()
-                      .getAttribute(HTML.Attribute.SRC);
+        AttributeSet elAttrs = getElement().getAttributes();
+
+        src = (String) elAttrs.getAttribute(HTML.Attribute.SRC);
+        
+        border = getIntProperty(elAttrs,HTML.Attribute.BORDER);
+        
+        hSpace = getIntProperty(elAttrs,HTML.Attribute.HSPACE);
+        
+        vSpace = getIntProperty(elAttrs,HTML.Attribute.VSPACE);
 
         Object size = getAttributes().getAttribute(CSS.Attribute.WIDTH);
         int desiredWidth = -1;
@@ -240,10 +260,24 @@
 
         color = getStyleSheet().getForeground(getAttributes());
     }
+    
+    private int getIntProperty(AttributeSet source, HTML.Attribute attr) {
+        String result = (String) source.getAttribute(attr);
+        // Null verification is added for possibly improved performance:
+        // throwing and
+        // catching an exception is slower than null verification
+        if (result != null) {
+            try {
+                return Integer.parseInt(result);
+            } catch (NumberFormatException nfe) {
+                // Ignored, return 0, according to RI's result
+            }
+        }
+        return 0;
+    }
 
     private void createImage(final int desiredWidth, final int desiredHeight) {
-        imageURL = null;
-        loader = new BackgroundImageLoader(getImageURL(),
+        loader = new BackgroundImageLoader(getImageURL(), synchronous,
                                            desiredWidth, desiredHeight) {
             protected void onReady() {
                 super.onReady();

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/default.css
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/default.css?view=diff&rev=564147&r1=564146&r2=564147
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/default.css
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/default.css
Thu Aug  9 01:54:18 2007
@@ -86,4 +86,8 @@
 
 big {
     font-size: larger;
-}
\ No newline at end of file
+}
+
+center {
+    text-align: center;
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/text/html/ImageViewTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/text/html/ImageViewTest.java?view=diff&rev=564147&r1=564146&r2=564147
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/text/html/ImageViewTest.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/text/html/ImageViewTest.java
Thu Aug  9 01:54:18 2007
@@ -263,17 +263,11 @@
         assertEquals(isHarmony() ? 18 : 38, icon.getIconHeight());
     }
 
-    public void testSetLoadsSynchronously() {
-        assertFalse(view.getLoadsSynchronously());
-
+    public void testSetGetLoadsSynchronously() {
         view.setLoadsSynchronously(true);
         assertTrue(view.getLoadsSynchronously());
 
         view.setLoadsSynchronously(false);
-        assertFalse(view.getLoadsSynchronously());
-    }
-
-    public void testGetLoadsSynchronously() {
         assertFalse(view.getLoadsSynchronously());
     }
 



Mime
View raw message