LGTM One nit: You set " bottom = (int) (progress * offsetHeight)", but you could just use "bottom = top + height" or even just "bottom = height".
Thanks, John LaBanca [email protected] On Tue, Jan 13, 2009 at 2:41 PM, <[email protected]> wrote: > Reviewers: jlabanca, > > Description: > For SuggestBox and DropDownListBox, porting the RollDown animation class > from incubator. Testing in the suggest box visual test. > > Please review this at http://gwt-code-reviews.appspot.com/2004 > > Affected files: > user/src/com/google/gwt/user/client/ui/PopupPanel.java > > > Index: user/src/com/google/gwt/user/client/ui/PopupPanel.java > =================================================================== > --- user/src/com/google/gwt/user/client/ui/PopupPanel.java (revision > 4431) > +++ user/src/com/google/gwt/user/client/ui/PopupPanel.java (working > copy) > @@ -100,7 +100,7 @@ > * </ul> > */ > static enum AnimationType { > - CENTER, ONE_WAY_CORNER > + CENTER, ONE_WAY_CORNER, ROLL_DOWN > } > > /** > @@ -144,7 +144,7 @@ > > // Determine if we need to animate > boolean animate = curPanel.isAnimationEnabled; > - if (curPanel.animType == AnimationType.ONE_WAY_CORNER && !showing) { > + if (curPanel.animType != AnimationType.CENTER && !showing) { > animate = false; > } > > @@ -210,17 +210,25 @@ > int bottom = 0; > int height = (int) (progress * offsetHeight); > int width = (int) (progress * offsetWidth); > - if (curPanel.animType == AnimationType.CENTER) { > - top = (offsetHeight - height) >> 1; > - left = (offsetWidth - width) >> 1; > - } else if (curPanel.animType == AnimationType.ONE_WAY_CORNER) { > - if (LocaleInfo.getCurrentLocale().isRTL()) { > - left = offsetWidth - width; > - } > + switch (curPanel.animType) { > + case ROLL_DOWN: > + right = offsetWidth; > + bottom = (int) (progress * offsetHeight); > + break; > + case CENTER: > + top = (offsetHeight - height) >> 1; > + left = (offsetWidth - width) >> 1; > + right = left + width; > + bottom = top + height; > + break; > + case ONE_WAY_CORNER: > + if (LocaleInfo.getCurrentLocale().isRTL()) { > + left = offsetWidth - width; > + } > + right = left + width; > + bottom = top + height; > + break; > } > - right = left + width; > - bottom = top + height; > - > // Set the rect clipping > impl.setClip(curPanel.getElement(), getRectString(top, right, bottom, > left)); > > > --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
