[haiku-webkit-commits] r562 - webkit/trunk/WebKit/haiku/WebPositive/autocompletion

  • From: noreply@xxxxxxxxxxxx
  • To: haiku-webkit-commits@xxxxxxxxxxxxx
  • Date: Wed, 29 Dec 2010 23:08:08 +0100 (CET)

Author: leavengood
Date: Wed Dec 29 23:08:08 2010
New Revision: 562
URL: http://webpositive.haiku-os.org/changeset/562

Log:
Only use the scrollview if it is needed (to avoid the problem of a useless
disabled scrollbar.)

Modified:
   
webkit/trunk/WebKit/haiku/WebPositive/autocompletion/AutoCompleterDefaultImpl.cpp

Modified: 
webkit/trunk/WebKit/haiku/WebPositive/autocompletion/AutoCompleterDefaultImpl.cpp
==============================================================================
--- 
webkit/trunk/WebKit/haiku/WebPositive/autocompletion/AutoCompleterDefaultImpl.cpp
   Wed Dec 29 22:00:13 2010        (r561)
+++ 
webkit/trunk/WebKit/haiku/WebPositive/autocompletion/AutoCompleterDefaultImpl.cpp
   Wed Dec 29 23:08:08 2010        (r562)
@@ -374,12 +374,18 @@
                );
        }
 
-       BScrollView *scrollView = new BScrollView("", fListView, B_FOLLOW_NONE, 
0, false, true, B_NO_BORDER);
+       BScrollView *scrollView = NULL;
+       if (count > fMaxVisibleChoices) {
+               scrollView = new BScrollView("", fListView, B_FOLLOW_NONE, 0, 
false, true, B_NO_BORDER);
+       }
 
        fWindow = new BWindow(BRect(0, 0, 100, 100), "", 
B_BORDERED_WINDOW_LOOK, 
                B_NORMAL_WINDOW_FEEL, B_NOT_MOVABLE | B_WILL_ACCEPT_FIRST_CLICK 
                        | B_AVOID_FOCUS | B_ASYNCHRONOUS_CONTROLS);
-       fWindow->AddChild(scrollView);
+       if (scrollView != NULL)
+               fWindow->AddChild(scrollView);
+       else
+               fWindow->AddChild(fListView);
 
        int32 visibleCount = min_c(count, fMaxVisibleChoices);
        float listHeight = fListView->ItemFrame(visibleCount - 1).bottom + 1;
@@ -393,13 +399,18 @@
        else
                listRect.OffsetTo(pvRect.left, pvRect.top - listHeight);
 
-       // Moving here to cut off the scrollbar top
-       scrollView->MoveTo(0, -1);
-       // Adding the 1 and 2 to cut-off the scroll-bar top, right and bottom
-       scrollView->ResizeTo(listRect.Width() + 1, listRect.Height() + 2);
-       // Move here to compensate for the above
-       fListView->MoveTo(0, 1);
-       fListView->ResizeTo(listRect.Width() - B_V_SCROLL_BAR_WIDTH, 
listRect.Height());
+       if (scrollView != NULL) {
+               // Moving here to cut off the scrollbar top
+               scrollView->MoveTo(0, -1);
+               // Adding the 1 and 2 to cut-off the scroll-bar top, right and 
bottom
+               scrollView->ResizeTo(listRect.Width() + 1, listRect.Height() + 
2);
+               // Move here to compensate for the above
+               fListView->MoveTo(0, 1);
+               fListView->ResizeTo(listRect.Width() - B_V_SCROLL_BAR_WIDTH, 
listRect.Height());
+       } else {
+               fListView->MoveTo(0, 0);
+               fListView->ResizeTo(listRect.Width(), listRect.Height());
+       }
        fWindow->MoveTo(listRect.left, listRect.top);
        fWindow->ResizeTo(listRect.Width(), listRect.Height());
        fWindow->Show();

Other related posts:

  • » [haiku-webkit-commits] r562 - webkit/trunk/WebKit/haiku/WebPositive/autocompletion - noreply