Position DropDown on parent top if there is not enough space on bottom
diff --git a/bundles/org.eclipse.rap.addons.dropdown/js/rwt/dropdown/DropDown.js b/bundles/org.eclipse.rap.addons.dropdown/js/rwt/dropdown/DropDown.js
index f9a0561..fc6a0fe 100644
--- a/bundles/org.eclipse.rap.addons.dropdown/js/rwt/dropdown/DropDown.js
+++ b/bundles/org.eclipse.rap.addons.dropdown/js/rwt/dropdown/DropDown.js
@@ -314,7 +314,6 @@
   // Internals
 
   var renderLayout = function() {
-    var yOffset = this._.parent.getHeight();
     var font = this._.grid.getFont();
     // NOTE: Guessing the lineheight to be 1.3
     var padding = getPadding();
@@ -322,13 +321,21 @@
     var visibleItems = Math.min( this._.visibleItemCount, this.getItemCount() );
     var gridWidth = calcGridWidth.apply( this );
     var gridHeight = visibleItems * itemHeight;
-    this._.popup.positionRelativeTo( this._.parent, 0, yOffset );
+    renderPosition.call( this );
     this._.popup.setWidth( gridWidth + FRAMEWIDTH );
     this._.popup.setHeight( gridHeight + FRAMEWIDTH );
     this._.grid.setDimension( gridWidth, gridHeight );
     renderItemMetrics.apply( this, [ itemHeight, gridWidth, padding ] );
   };
 
+  var renderPosition = function() {
+    this._.popup.positionRelativeTo( this._.parent, 0, this._.parent.getHeight() );
+    var docHeight = rwt.widgets.base.ClientDocument.getInstance().getInnerHeight();
+    if( this._.popup.getTop() + this._.popup.getHeight() > docHeight ) {
+      this._.popup.positionRelativeTo( this._.parent, 0, -1 * this._.popup.getHeight() );
+    }
+  };
+
   var calcGridWidth = function() {
     var result = this._.parent.getWidth() - FRAMEWIDTH;
     if( this._.columns ) {
@@ -464,7 +471,7 @@
 
   var onAppear = function( event ) {
     // NOTE: widget absolute position can change without changing it's relative postion, therefore:
-    this._.popup.positionRelativeTo( this._.parent, 0, this._.parent.getHeight() );
+    renderPosition.call( this );
     fireEvent.call( this, "Show" );
   };
 
diff --git a/tests/org.eclipse.rap.addons.dropdown.test/js/rwt/dropdown/DropDown_Test.js b/tests/org.eclipse.rap.addons.dropdown.test/js/rwt/dropdown/DropDown_Test.js
index 9782def..c79fcce 100644
--- a/tests/org.eclipse.rap.addons.dropdown.test/js/rwt/dropdown/DropDown_Test.js
+++ b/tests/org.eclipse.rap.addons.dropdown.test/js/rwt/dropdown/DropDown_Test.js
@@ -363,6 +363,17 @@
       assertEquals( 100, popup.getTop() );
     },
 
+    testShow_LayoutsPopUpOnTopOfParentIfNotEnoughSpace : function() {
+      var doc = rwt.widgets.base.ClientDocument.getInstance();
+      doc.getInnerHeight = function() { return 100; };
+
+      shell.setTop( 40 );
+      showDropDown();
+
+      assertEquals( 33, popup.getTop() );
+      delete doc.getInnerHeight;
+    },
+
     testShow_SendsVisible : function() {
       showDropDown();
       rwt.remote.Server.getInstance().send();