Fixes issue #979; when using UIObject.addStyleName() on a element with no existing style, an extra space is no longer put on the front.

Suggested by: aitor.imaz
Review by: knorton


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@1056 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/user/client/ui/UIObject.java b/user/src/com/google/gwt/user/client/ui/UIObject.java
index 23cc9de..15e4e83 100644
--- a/user/src/com/google/gwt/user/client/ui/UIObject.java
+++ b/user/src/com/google/gwt/user/client/ui/UIObject.java
@@ -80,7 +80,10 @@
     if (add) {
       // Only add the style if it's not already present.
       if (idx == -1) {
-        DOM.setElementProperty(elem, "className", oldStyle + " " + style);
+        if (oldStyle.length() > 0) {
+          oldStyle += " ";
+        }
+        DOM.setElementProperty(elem, "className", oldStyle + style);
       }
     } else {
       // Don't try to remove the style if it's not there.