Fix for bug that broke client-side layout of ScrolledComposites and workaround that restores SC origins after TextSizeDetermination
diff --git a/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/internal/graphics/FontSizeCalculationHandler.java b/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/internal/graphics/FontSizeCalculationHandler.java
index aa80a87..2894855 100644
--- a/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/internal/graphics/FontSizeCalculationHandler.java
+++ b/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/internal/graphics/FontSizeCalculationHandler.java
@@ -4,7 +4,7 @@
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
+ *
  * Contributors:
  *     Innoopract Informationssysteme GmbH - initial API and implementation
  ******************************************************************************/
@@ -16,7 +16,9 @@
 import javax.servlet.http.*;
 
 import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.internal.graphics.FontSizeCalculator.ICalculationItem;
 import org.eclipse.swt.internal.graphics.FontSizeProbeStore.IProbe;
 import org.eclipse.swt.internal.widgets.WidgetTreeVisitor;
@@ -33,38 +35,38 @@
   implements PhaseListener, HttpSessionBindingListener
 {
   private static final long serialVersionUID = 1L;
-  private static final String CALCULATION_HANDLER 
+  private static final String CALCULATION_HANDLER
     = FontSizeCalculationHandler.class.getName() + ".CalculationHandler";
-  
+
   private final Display display;
   private ICalculationItem[] calculationItems;
   private IProbe[] probes;
   private boolean renderDone;
-  
-  
+
+
   static void register() {
     final Display display = Display.getCurrent();
     if( display != null && display.getThread() == Thread.currentThread() ) {
       ISessionStore session = ContextProvider.getSession();
       if( session.getAttribute( CALCULATION_HANDLER ) == null ) {
-        FontSizeCalculationHandler handler 
+        FontSizeCalculationHandler handler
           = new FontSizeCalculationHandler( display );
         session.setAttribute( CALCULATION_HANDLER, handler );
         W4TContext.getLifeCycle().addPhaseListener( handler );
       }
     }
   }
-  
+
   private FontSizeCalculationHandler( final Display display ) {
     this.display = display;
   }
-  
+
   //////////////////////////
   // interface PhaseListener
-  
+
   public void beforePhase( final PhaseEvent event ) {
   }
-  
+
   public void afterPhase( final PhaseEvent event ) {
     if( display == Display.getCurrent() ) {
       try {
@@ -75,7 +77,7 @@
           for( int i = 0; i < shells.length; i++ ) {
             // TODO [fappel]: Think about a lighter recalculation trigger.
             Point buffer = shells[ i ].getSize();
-            AllWidgetTreeVisitor visitor = new AllWidgetTreeVisitor() {
+            AllWidgetTreeVisitor clearLayout = new AllWidgetTreeVisitor() {
               public boolean doVisit( final Widget widget ) {
                 if( widget instanceof Composite ) {
                   Composite composite = ( Composite )widget;
@@ -84,10 +86,38 @@
                 return true;
               }
             };
-            WidgetTreeVisitor.accept( shells[ i ], visitor );
+            // TODO [rst] Special handling for ScrolledComposites:
+            //            Resizing makes SCs forget about their scroll position.
+            final String sc_origin_key = "org.eclipse.rap.sc-origin";
+            AllWidgetTreeVisitor saveSCOrigins = new AllWidgetTreeVisitor() {
+              public boolean doVisit( final Widget widget ) {
+                if( widget instanceof ScrolledComposite ) {
+                  ScrolledComposite composite = ( ScrolledComposite )widget;
+                  composite.setData( sc_origin_key, composite.getOrigin() );
+                }
+                return true;
+              }
+            };
+            AllWidgetTreeVisitor restoreSCOrigins = new AllWidgetTreeVisitor() {
+              public boolean doVisit( final Widget widget ) {
+                // restore sc origins
+                if( widget instanceof ScrolledComposite ) {
+                  ScrolledComposite composite = ( ScrolledComposite )widget;
+                  Point oldOrigin = ( Point )composite.getData( sc_origin_key );
+                  if( oldOrigin != null ) {
+                    composite.setOrigin( oldOrigin );
+                    composite.setData( sc_origin_key, null );
+                  }
+                }
+                return true;
+              }
+            };
+            WidgetTreeVisitor.accept( shells[ i ], saveSCOrigins );
+            WidgetTreeVisitor.accept( shells[ i ], clearLayout );
             shells[ i ].setSize( buffer.x + 1000, buffer.y + 1000 );
-            WidgetTreeVisitor.accept( shells[ i ], visitor );
+            WidgetTreeVisitor.accept( shells[ i ], clearLayout );
             shells[ i ].setSize( buffer );
+            WidgetTreeVisitor.accept( shells[ i ], restoreSCOrigins );
           }
         }
         if( event.getPhaseId() == PhaseId.RENDER ) {
@@ -111,7 +141,7 @@
   public PhaseId getPhaseId() {
     return PhaseId.ANY;
   }
-  
+
 
   public static void readProbedFonts( final IProbe[] probes ) {
     boolean hasProbes = probes != null;
@@ -126,14 +156,14 @@
       }
     }
   }
-  
-  
+
+
   ///////////////////////////////////////
   // interface HttpSessionBindingListener
-  
+
   public void valueBound( final HttpSessionBindingEvent event ) {
   }
-  
+
   public void valueUnbound( final HttpSessionBindingEvent event ) {
     UICallBackUtil.runNonUIThreadWithFakeContext( display, new Runnable() {
       public void run() {
@@ -142,12 +172,12 @@
       }
     } );
   }
-  
+
   //////////////////
   // helping methods
-  
+
   private ICalculationItem[] writeStringMeasurements()
-    throws IOException 
+    throws IOException
   {
     ICalculationItem[] items = FontSizeCalculator.getCalculationItems();
     if( items.length > 0 ) {
@@ -172,12 +202,12 @@
       }
       param.append( " ]" );
       String funcName = "org.eclipse.swt.FontSizeCalculation.measureStrings";
-      writer.callStatic( funcName, 
-                         new Object[] { new JSVar( param.toString() ) } );      
+      writer.callStatic( funcName,
+                         new Object[] { new JSVar( param.toString() ) } );
     }
     return items;
   }
-  
+
   private IProbe[] writeFontProbing() throws IOException {
     IProbe[] requests = FontSizeProbeStore.getProbeRequests();
     if( requests.length > 0 ) {
@@ -193,26 +223,26 @@
       }
       param.append( " ]" );
       String funcName = "org.eclipse.swt.FontSizeCalculation.probe";
-      writer.callStatic( funcName, 
+      writer.callStatic( funcName,
                          new Object[] { new JSVar( param.toString() ) } );
     }
     return requests;
   }
-  
+
   private void readProbedFonts() {
     readProbedFonts( probes );
   }
-  
+
   static String createFontParam( final Font font ) {
     // TODO [fappel]: For convenience I reused the the WidgetLCAUtil#writeFont
     //                method. This may have performance problems since a lot
-    //                of buffering and some additional string operations are 
+    //                of buffering and some additional string operations are
     //                used. So revise this...
     StringBuffer result = new StringBuffer();
     Shell shell = new Shell( Display.getCurrent(), SWT.NONE );
     Label label = new Label( shell, SWT.NONE );
     IServiceStateInfo stateInfo = ContextProvider.getStateInfo();
-    HtmlResponseWriter buffer = stateInfo.getResponseWriter(); 
+    HtmlResponseWriter buffer = stateInfo.getResponseWriter();
     try {
       HtmlResponseWriter htmlWriter = new HtmlResponseWriter();
       stateInfo.setResponseWriter( htmlWriter );
@@ -235,7 +265,7 @@
     }
     return result.toString();
   }
-  
+
   private void readMeasuredStrings() {
     boolean hasItems = calculationItems != null;
     HttpServletRequest request = ContextProvider.getRequest();
@@ -246,17 +276,17 @@
       // TODO [fappel]: Workaround for background process problem
       if( value != null ) {
         Point size = getSize( value );
-        FontSizeDataBase.store( item.getFont(), 
-                                item.getString(), 
+        FontSizeDataBase.store( item.getFont(),
+                                item.getString(),
                                 item.getWrapWidth(),
                                 size );
       }
     }
   }
-  
+
   private static Point getSize( final String value ) {
     String[] split = value.split( "," );
-    return new Point( Integer.parseInt( split[ 0 ] ), 
+    return new Point( Integer.parseInt( split[ 0 ] ),
                       Integer.parseInt( split[ 1 ] ) );
   }
 }
\ No newline at end of file
diff --git a/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/lifecycle/WidgetLCAUtil.java b/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/lifecycle/WidgetLCAUtil.java
index 7120333..de6b5d2 100644
--- a/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/lifecycle/WidgetLCAUtil.java
+++ b/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/lifecycle/WidgetLCAUtil.java
@@ -17,6 +17,7 @@
 import java.util.regex.Pattern;
 import javax.servlet.http.HttpServletRequest;
 import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
 import org.eclipse.swt.graphics.*;
 import org.eclipse.swt.internal.widgets.Props;
 import org.eclipse.swt.widgets.*;
@@ -26,6 +27,8 @@
 
 public final class WidgetLCAUtil {
 
+  private static final String JS_PROP_HEIGHT = "height";
+  private static final String JS_PROP_WIDTH = "width";
   private static final String JS_PROP_CLIP_WIDTH = "clipWidth";
   private static final String JS_PROP_CLIP_HEIGHT = "clipHeight";
   private static final String PARAM_X = "bounds.x";
@@ -43,7 +46,7 @@
   private static final String JS_PROP_CONTEXT_MENU = "contextMenu";
 
   private static final String JS_FUNC_SET_TOOL_TIP = "setToolTip";
-  
+
   private static final Pattern HTML_ESCAPE_PATTERN
     = Pattern.compile( "&|<|>|\\\"" );
   private static final Pattern DOUBLE_QUOTE_PATTERN
@@ -217,18 +220,26 @@
       }
 
       JSWriter writer = JSWriter.getWriterFor( widget );
-      int[] args = new int[]{
-        newBounds.x, newBounds.width, newBounds.y, newBounds.height
-      };
-
-      writer.set( JS_PROP_SPACE, args );
+      // Note [rst] Children of ScrolledComposites must not render their x and y
+      //            coordinates as the content of SCs is scrolled automatically
+      //            by the client according to the position of the scrollbars.
+      //            Setting negative values breaks the layout on the client.
+      if( parent instanceof ScrolledComposite ) {
+        writer.set( JS_PROP_WIDTH, newBounds.width );
+        writer.set( JS_PROP_HEIGHT, newBounds.height );
+      } else {
+        int[] args = new int[] {
+          newBounds.x, newBounds.width, newBounds.y, newBounds.height
+        };
+        writer.set( JS_PROP_SPACE, args );
+      }
       if( clip ) {
-        writer.set( JS_PROP_CLIP_HEIGHT, args[ 3 ] );
-        writer.set( JS_PROP_CLIP_WIDTH, args[ 1 ] );
+        writer.set( JS_PROP_CLIP_WIDTH, newBounds.width );
+        writer.set( JS_PROP_CLIP_HEIGHT, newBounds.height );
       }
     }
   }
-  
+
   public static void resetBounds() throws IOException {
     JSWriter writer = JSWriter.getWriterForResetHandler();
     writer.reset( JS_PROP_CLIP_WIDTH );
@@ -251,7 +262,7 @@
       }
     }
   }
-  
+
   public static void resetMenu() throws IOException {
     JSWriter writer = JSWriter.getWriterForResetHandler();
     writer.reset( JS_PROP_CONTEXT_MENU );
@@ -276,8 +287,8 @@
                  JS_FUNC_SET_TOOL_TIP,
                  new Object[] { JSWriter.WIDGET_REF } );
   }
-  
-  
+
+
   /////////////////////////////////////////////////
   // write-methods used by other ...LCAUtil classes
 
@@ -307,7 +318,7 @@
     JSWriter writer = JSWriter.getWriterFor( widget );
     writer.set( jsProperty, imagePath );
   }
-  
+
   public static void writeFont( final Widget widget, final Font font )
     throws IOException
   {
@@ -344,7 +355,7 @@
     JSWriter writer = JSWriter.getWriterForResetHandler();
     writer.reset( JSConst.QX_FIELD_FONT );
   }
-  
+
   public static void writeForeground( final Widget widget,
                                       final Color newColor )
     throws IOException
@@ -355,7 +366,7 @@
       writer.call( JSWriter.WIDGET_MANAGER_REF, "setForeground", args );
     }
   }
-  
+
   public static void resetForeground() throws IOException {
     JSWriter writer = JSWriter.getWriterForResetHandler();
     writer.reset( "textColor" );
@@ -381,7 +392,7 @@
     JSWriter writer = JSWriter.getWriterForResetHandler();
     writer.reset( JSConst.QX_FIELD_BG_COLOR );
   }
-  
+
   public static void writeEnabled( final Widget widget, final boolean enabled )
     throws IOException
   {
@@ -390,7 +401,7 @@
     Boolean defValue = Boolean.TRUE;
     writer.set( Props.ENABLED, JSConst.QX_FIELD_ENABLED, newValue, defValue );
   }
-  
+
   public static void resetEnabled() throws IOException {
     JSWriter writer = JSWriter.getWriterForResetHandler();
     // TODO [fappel]: check whether to use reset
diff --git a/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/ScrollBar.java b/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/ScrollBar.java
index b6bd39c..e3c83ea 100644
--- a/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/ScrollBar.java
+++ b/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/ScrollBar.java
@@ -4,7 +4,7 @@
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
+ *
  * Contributors:
  *     Innoopract Informationssysteme GmbH - initial API and implementation
  ******************************************************************************/
@@ -19,9 +19,9 @@
 
 /**
  * Instances of this class are selectable user interface
- * objects that represent a range of positive, numeric values. 
+ * objects that represent a range of positive, numeric values.
  * <p>
- * At any given moment, a given scroll bar will have a 
+ * At any given moment, a given scroll bar will have a
  * single 'selection' that is considered to be its
  * value, which is constrained to be within the range of
  * values the scroll bar represents (that is, between its
@@ -61,7 +61,7 @@
  * have no operating system resources and are not children of the control.
  * For this reason, scroll bars are treated specially.  To create a control
  * that looks like a scroll bar but has operating system resources, use
- * <code>Slider</code>. 
+ * <code>Slider</code>.
  * </p>
  * <dl>
  * <dt><b>Styles:</b></dt>
@@ -82,16 +82,16 @@
  *
  * <p>(current) limitations:</p>
  * <ul>
- * <li>minimum, maximum, thumb, increment and pageIncrement properties are not 
+ * <li>minimum, maximum, thumb, increment and pageIncrement properties are not
  * rendered (no corresponding client-side property)</li>
- * <li>size (width when V_SCROLL, height when H_SCROLL) is hard-coded and may 
+ * <li>size (width when V_SCROLL, height when H_SCROLL) is hard-coded and may
  * not match what the browser actually shows</li>
- * </ul>  
+ * </ul>
  */
 // TODO [rh] include ScrollBar in widget hierarchy (child of Scrollable)?
 public class ScrollBar extends Widget {
 
-  // TODO [rh] scroll bar size could be determined in index.html and be held 
+  // TODO [rh] scroll bar size could be determined in index.html and be held
   //      individually per session
   static final int SCROLL_BAR_WIDTH = 16;
   static final int SCROLL_BAR_HEIGHT = 16;
@@ -126,13 +126,13 @@
     checkWidget();
     return parent;
   }
-  
+
   /////////////
   // Visibility
-  
+
   /**
    * Marks the receiver as visible if the argument is <code>true</code>,
-   * and marks it invisible otherwise. 
+   * and marks it invisible otherwise.
    * <p>
    * If one of the receiver's ancestors is not visible or some
    * other condition makes the receiver not visible, marking
@@ -175,7 +175,7 @@
     checkWidget();
     return ( state & HIDDEN ) == 0;
   }
-  
+
   /**
    * Returns <code>true</code> if the receiver is visible and all
    * of the receiver's ancestors are visible and <code>false</code>
@@ -194,10 +194,10 @@
     checkWidget();
     return getVisible() && parent.isVisible();
   }
-  
+
   /////////////
   // Enablement
-  
+
   /**
    * Enables the receiver if the argument is <code>true</code>,
    * and disables it otherwise. A disabled control is typically
@@ -232,7 +232,7 @@
    *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
    *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
    * </ul>
-   * 
+   *
    * @see #isEnabled
    */
   public boolean getEnabled() {
@@ -252,7 +252,7 @@
    *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
    *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
    * </ul>
-   * 
+   *
    * @see #getEnabled
    */
   public boolean isEnabled() {
@@ -280,7 +280,7 @@
     } else {
       result.x = SCROLL_BAR_HEIGHT;
     }
-    return result; 
+    return result;
   }
 
   /**
@@ -319,7 +319,7 @@
     checkWidget();
     this.thumb = thumb;
   }
-  
+
   /**
    * Returns the maximum value which the receiver will allow.
    *
@@ -400,9 +400,14 @@
    */
   public void setSelection( final int selection ) {
     checkWidget();
-    this.selection = selection;
+    if( this.selection != selection ) {
+      this.selection = selection;
+      SelectionEvent evt
+        = new SelectionEvent( this, null, SelectionEvent.WIDGET_SELECTED );
+      evt.processEvent();
+    }
   }
-  
+
   /**
    * Returns the single 'selection' that is the receiver's value.
    *
@@ -417,10 +422,10 @@
     checkWidget();
     return selection;
   }
-  
+
   ////////////////////
   // SelectionListener
-  
+
   /**
    * Adds the listener to the collection of listeners who will
    * be notified when the receiver's value changes, by sending
@@ -479,10 +484,10 @@
     checkWidget();
     SelectionEvent.removeListener( this, listener );
   }
-  
+
   // /////////////////
   // Widget overrides
-  
+
   public Display getDisplay() {
     checkWidget();
     return parent.getDisplay();
@@ -500,7 +505,7 @@
 
   //////////////////
   // Helping methods
-  
+
   private static int checkStyle( final int style ) {
     return checkBits( style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0 );
   }
diff --git a/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/internal/custom/scrolledcompositekit/ScrolledCompositeLCA_Test.java b/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/internal/custom/scrolledcompositekit/ScrolledCompositeLCA_Test.java
index fdd1c81..8fbf0a0 100644
--- a/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/internal/custom/scrolledcompositekit/ScrolledCompositeLCA_Test.java
+++ b/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/internal/custom/scrolledcompositekit/ScrolledCompositeLCA_Test.java
@@ -16,20 +16,26 @@
 import org.eclipse.swt.RWTFixture;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.internal.widgets.buttonkit.ButtonLCA;
 import org.eclipse.swt.lifecycle.IWidgetAdapter;
 import org.eclipse.swt.lifecycle.WidgetUtil;
 import org.eclipse.swt.widgets.*;
 
+import com.w4t.Fixture;
+
 public class ScrolledCompositeLCA_Test extends TestCase {
 
+  private static final String PROP_V_BAR_SELECTION = "vBarSelection";
+  private static final String PROP_H_BAR_SELECTION = "hBarSelection";
+
   public void testPreserveValues() {
     Display display = new Display();
-    Composite shell = new Shell( display , SWT.NONE );
-    int style = SWT.H_SCROLL | SWT.V_SCROLL;
-    ScrolledComposite sc = new ScrolledComposite( shell, style );
+    Shell shell = new Shell( display , SWT.NONE );
+    int scStyle = SWT.H_SCROLL | SWT.V_SCROLL;
+    ScrolledComposite sc = new ScrolledComposite( shell, scStyle );
     IWidgetAdapter adapter = WidgetUtil.getAdapter( sc );
-    assertEquals( null, adapter.getPreserved( "hBarSelection" ) );
-    assertEquals( null, adapter.getPreserved( "vBarSelection" ) );
+    assertEquals( null, adapter.getPreserved( PROP_H_BAR_SELECTION ) );
+    assertEquals( null, adapter.getPreserved( PROP_V_BAR_SELECTION ) );
     sc.getHorizontalBar().setSelection( 23 );
     sc.getVerticalBar().setSelection( 42 );
     assertEquals( 23, sc.getHorizontalBar().getSelection() );
@@ -38,11 +44,31 @@
     sc.getVerticalBar().setVisible( true );
     RWTFixture.markInitialized( display );
     RWTFixture.preserveWidgets();
-    assertEquals( new Integer( 23 ), adapter.getPreserved( "hBarSelection" ) );
-    assertEquals( new Integer( 42 ), adapter.getPreserved( "vBarSelection" ) );
+    assertEquals( new Integer( 23 ),
+                  adapter.getPreserved( PROP_H_BAR_SELECTION ) );
+    assertEquals( new Integer( 42 ),
+                  adapter.getPreserved( PROP_V_BAR_SELECTION ) );
     display.dispose();
   }
 
+  public void testNoBounds() throws Exception {
+    // For direct children of ScrolledComposites, no bounds must not be written.
+    // This results in negative locations which destroys client-side layout.
+    Display display = new Display();
+    Shell shell = new Shell( display , SWT.NONE );
+    int scStyle = SWT.H_SCROLL | SWT.V_SCROLL;
+    ScrolledComposite sc = new ScrolledComposite( shell, scStyle );
+    Button button = new Button( sc, SWT.PUSH );
+    RWTFixture.markInitialized( display );
+    RWTFixture.preserveWidgets();
+    button.setSize( 300, 400 );
+    Fixture.fakeResponseWriter();
+    ButtonLCA lca = new ButtonLCA();
+    lca.renderChanges( button );
+    System.out.println( Fixture.getAllMarkup() );
+    assertTrue( Fixture.getAllMarkup().indexOf( "setSpace" ) == -1 );
+  }
+
   protected void setUp() throws Exception {
     RWTFixture.setUp();
   }
diff --git a/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/internal/widgets/controlkit/ControlLCA_Test.java b/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/internal/widgets/controlkit/ControlLCA_Test.java
index 1015761..de01946 100644
--- a/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/internal/widgets/controlkit/ControlLCA_Test.java
+++ b/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/internal/widgets/controlkit/ControlLCA_Test.java
@@ -4,7 +4,7 @@
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
+ *
  * Contributors:
  *     Innoopract Informationssysteme GmbH - initial API and implementation
  ******************************************************************************/
@@ -31,14 +31,14 @@
     RWTFixture.fakeUIThread();
     ThemeManager.getInstance().initialize();
   }
-  
+
   protected void tearDown() throws Exception {
 // TODO [rst] Keeping the ThemeManager initialized speeds up TestSuite
 //    ThemeManager.getInstance().deregisterAll();
     RWTFixture.removeUIThread();
     RWTFixture.tearDown();
   }
-  
+
   public void testPreserveValues() {
     Display display = new Display();
     Composite shell = new Shell( display , SWT.NONE );
@@ -57,20 +57,20 @@
     listeners = ( Boolean )adapter.getPreserved( Props.CONTROL_LISTENERS );
     assertEquals( Boolean.TRUE, listeners );
   }
-  
+
   public void testWriteVisibility() throws IOException {
     Display display = new Display();
     Shell shell = new Shell( display , SWT.NONE );
     Button button = new Button( shell, SWT.PUSH );
     shell.open();
     AbstractWidgetLCA lca = WidgetUtil.getLCA( button );
-    
+
     // Initial JavaScript code must not contain setVisibility()
     Fixture.fakeResponseWriter();
     lca.renderInitialization( button );
     lca.renderChanges( button );
     assertTrue( Fixture.getAllMarkup().indexOf( "setVisibility" ) == -1 );
-    
+
     // Unchanged visible attribute must not be rendered
     Fixture.fakeResponseWriter();
     RWTFixture.markInitialized( display );
@@ -88,7 +88,7 @@
     lca.renderChanges( button );
     assertTrue( Fixture.getAllMarkup().indexOf( "setVisibility" ) != -1 );
   }
-  
+
   public void testWriteBounds() throws IOException {
     Fixture.fakeBrowser( new Mozilla1_7up( true, true ) );
     Display display = new Display();
@@ -96,7 +96,7 @@
     Control control = new Button( shell, SWT.PUSH );
     Composite parent = control.getParent();
 
-    // call writeBounds once to elimniate the uninteresting JavaScript prolog 
+    // call writeBounds once to elimniate the uninteresting JavaScript prolog
     Fixture.fakeResponseWriter();
     WidgetLCAUtil.writeBounds( control, parent, control.getBounds(), false );
 
@@ -104,30 +104,30 @@
     Fixture.fakeResponseWriter();
     control.setBounds( 1, 2, 100, 200 );
     WidgetLCAUtil.writeBounds( control, parent, control.getBounds(), false );
-    // TODO [fappel]: check whether minWidth and minHeight is still needed - 
+    // TODO [fappel]: check whether minWidth and minHeight is still needed -
     //                causes problems on FF with caching
-    // String expected 
-    //   = "w.setSpace( 1, 100, 2, 200 );" 
-    //   + "w.setMinWidth( 0 );w.setMinHeight( 0 );"; 
-    String expected = "w.setSpace( 1, 100, 2, 200 );"; 
+    // String expected
+    //   = "w.setSpace( 1, 100, 2, 200 );"
+    //   + "w.setMinWidth( 0 );w.setMinHeight( 0 );";
+    String expected = "w.setSpace( 1, 100, 2, 200 );";
     assertEquals( expected, Fixture.getAllMarkup() );
-    
+
     // Test with clip
     Fixture.fakeResponseWriter();
     control.setBounds( 1, 2, 100, 200 );
     WidgetLCAUtil.writeBounds( control, parent, control.getBounds(), true );
-    // TODO [fappel]: check whether minWidth and minHeight is still needed - 
+    // TODO [fappel]: check whether minWidth and minHeight is still needed -
     //                causes problems on FF with caching
-    //expected 
-    //  =   "w.setSpace( 1, 100, 2, 200 );" 
-    //    + "w.setMinWidth( 0 );w.setMinHeight( 0 );" 
+    //expected
+    //  =   "w.setSpace( 1, 100, 2, 200 );"
+    //    + "w.setMinWidth( 0 );w.setMinHeight( 0 );"
     //    + "w.setClipHeight( 200 );w.setClipWidth( 100 );";
-    expected 
-      =   "w.setSpace( 1, 100, 2, 200 );" 
-        + "w.setClipHeight( 200 );w.setClipWidth( 100 );";
+    expected
+      =   "w.setSpace( 1, 100, 2, 200 );"
+        + "w.setClipWidth( 100 );w.setClipHeight( 200 );";
     assertEquals( expected, Fixture.getAllMarkup() );
   }
-  
+
   public void testWriteFocusListener() throws IOException {
     FocusAdapter focusListener = new FocusAdapter() {
     };
@@ -137,8 +137,8 @@
     label.addFocusListener( focusListener );
     Button button = new Button( shell, SWT.PUSH );
     button.addFocusListener( focusListener );
-    // Test that JavaScript focus listeners are rendered for a focusable control 
-    // (e.g. button) 
+    // Test that JavaScript focus listeners are rendered for a focusable control
+    // (e.g. button)
     Fixture.fakeResponseWriter();
     ControlLCAUtil.writeChanges( button ); // calls writeFocusListener
     String focusGained = "org.eclipse.swt.EventUtil.focusGained";
@@ -146,11 +146,11 @@
     String markup = Fixture.getAllMarkup();
     assertTrue( markup.indexOf( focusGained ) != -1 );
     assertTrue( markup.indexOf( focusLost ) != -1 );
-    
+
     // Test that for a non-focusable control (e.g. label), no focus-listener
-    // JavaScript code is emitted 
+    // JavaScript code is emitted
     Fixture.fakeResponseWriter();
-    ControlLCAUtil.writeChanges( label ); 
+    ControlLCAUtil.writeChanges( label );
     markup = Fixture.getAllMarkup();
     assertEquals( -1, markup.indexOf( focusGained ) );
     assertEquals( -1, markup.indexOf( focusLost ) );