Fix dropdown position when website-like scrolling is enabled
DropDown.js#renderPosition doesn't respect scroll offset. Thus, dropdown
position is wrong when there is no enough space.
Use viewport height and scroll offset instead of document height in
DropDown.js#renderPosition.
Change-Id: I0ce038d0b767a027a5b78ea31994508af4f9668b
diff --git a/bundles/org.eclipse.rap.rwt/js/rwt/widgets/DropDown.js b/bundles/org.eclipse.rap.rwt/js/rwt/widgets/DropDown.js
index 2fea28e..397e78d 100644
--- a/bundles/org.eclipse.rap.rwt/js/rwt/widgets/DropDown.js
+++ b/bundles/org.eclipse.rap.rwt/js/rwt/widgets/DropDown.js
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013, 2015 EclipseSource and others.
+ * Copyright (c) 2013, 2016 EclipseSource and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -373,8 +373,9 @@
function renderPosition() {
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 ) {
+ var viewportHeight = rwt.html.Viewport.getHeight();
+ var scrollTop = rwt.html.Viewport.getScrollTop();
+ if( this._.popup.getTop() + this._.popup.getHeight() > viewportHeight + scrollTop ) {
this._.popup.positionRelativeTo( this._.parent, 0, -1 * this._.popup.getHeight() );
}
}