Reviewers: jlabanca, minz,
Description:
There was a focus issue with the fasttree when the size of the tree was
larger than the viewport, this was especially manifested with very large
trees.
Please review this at http://gwt-code-reviews.appspot.com/18801
Affected files:
com/google/gwt/gen2/complexpanel/client/FastTree.java
Index: com/google/gwt/gen2/complexpanel/client/FastTree.java
===
--- com/google/gwt/gen2/complexpanel/client/FastTree.java (revision 1594)
+++ com/google/gwt/gen2/complexpanel/client/FastTree.java (working copy)
@@ -53,6 +53,7 @@
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Accessibility;
import com.google.gwt.user.client.ui.Focusable;
import com.google.gwt.user.client.ui.Panel;
@@ -849,15 +850,26 @@
}
private void moveElementOverTarget(Element movable, Element target) {
-int containerTop = getAbsoluteTop();
-
-int top = DOM.getAbsoluteTop(target) - containerTop;
+int top = DOM.getAbsoluteTop(target);
int height = DOM.getElementPropertyInt(target, "offsetHeight");
+int left = DOM.getAbsoluteLeft(target) + getAbsoluteLeft();
+int width = DOM.getElementPropertyInt(target, "offsetWidth");
+
+int maxBottom = Window.getScrollTop() + Window.getClientHeight();
+if (top + target.getOffsetHeight() > maxBottom) {
+ top = maxBottom - target.getOffsetHeight();
+}
+
// Set the element's position and size to exactly underlap the
// item's content element.
DOM.setStyleAttribute(movable, "height", height + "px");
-DOM.setStyleAttribute(movable, "top", top + "px");
+
+if (top > 0) {
+ DOM.setStyleAttribute(movable, "top", top + "px");
+}
+DOM.setStyleAttribute(movable, "left", left + "px");
+DOM.setStyleAttribute(movable, "width", width + "px");
}
/**
--~--~-~--~~~---~--~~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~--~~~~--~~--~--~---