[haiku-webkit-commits] r469 - webkit/trunk/WebKit/haiku/WebPositive/tabview

  • From: webkit@xxxxxxxxxxxxxxx
  • To: haiku-webkit-commits@xxxxxxxxxxxxx
  • Date: Sat, 01 May 2010 18:07:40 +0000

Author: stippi
Date: Sat May  1 18:07:40 2010
New Revision: 469
URL: http://mmlr.dyndns.org/changeset/469

Log:
Fix a bug with closing tabs by pressing the tertiary mouse button. fMouseDown
would be true, but the fLastMouseEventTab would have been reset when removing
the tab. Rather than fixing this problem, behave the same as Firefox and close
the tab on mouse up (when the mouse is still over the tab, which allows the
user a way back out). Avoids the above problem as a side effect.

Modified:
   webkit/trunk/WebKit/haiku/WebPositive/tabview/TabContainerView.cpp
   webkit/trunk/WebKit/haiku/WebPositive/tabview/TabManager.cpp

Modified: webkit/trunk/WebKit/haiku/WebPositive/tabview/TabContainerView.cpp
==============================================================================
--- webkit/trunk/WebKit/haiku/WebPositive/tabview/TabContainerView.cpp  Fri Apr 
30 17:49:21 2010        (r468)
+++ webkit/trunk/WebKit/haiku/WebPositive/tabview/TabContainerView.cpp  Sat May 
 1 18:07:40 2010        (r469)
@@ -440,7 +440,7 @@
                return;
        }
 
-       if (fLastMouseEventTab && fLastMouseEventTab == tab)
+       if (fLastMouseEventTab != NULL && fLastMouseEventTab == tab)
                fLastMouseEventTab->MouseMoved(where, B_INSIDE_VIEW, 
dragMessage);
        else {
                if (fLastMouseEventTab)

Modified: webkit/trunk/WebKit/haiku/WebPositive/tabview/TabManager.cpp
==============================================================================
--- webkit/trunk/WebKit/haiku/WebPositive/tabview/TabManager.cpp        Fri Apr 
30 17:49:21 2010        (r468)
+++ webkit/trunk/WebKit/haiku/WebPositive/tabview/TabManager.cpp        Sat May 
 1 18:07:40 2010        (r469)
@@ -366,6 +366,7 @@
        TabManagerController* fController;
        bool fOverCloseRect;
        bool fClicked;
+       bool fCloseOnMouseUp;
 };
 
 
@@ -375,7 +376,8 @@
        fIcon(NULL),
        fController(controller),
        fOverCloseRect(false),
-       fClicked(false)
+       fClicked(false),
+       fCloseOnMouseUp(false)
 {
 }
 
@@ -449,7 +451,7 @@
 WebTabView::MouseDown(BPoint where, uint32 buttons)
 {
        if (buttons & B_TERTIARY_MOUSE_BUTTON) {
-               fController->CloseTab(ContainerView()->IndexOf(this));
+               fCloseOnMouseUp = true;
                return;
        }
 
@@ -467,12 +469,20 @@
 void
 WebTabView::MouseUp(BPoint where)
 {
-       if (!fClicked) {
+       if (!fClicked && !fCloseOnMouseUp) {
                TabView::MouseUp(where);
                return;
        }
 
+       if (fCloseOnMouseUp && Frame().Contains(where)) {
+               fCloseOnMouseUp = false;
+               fController->CloseTab(ContainerView()->IndexOf(this));
+               // Probably this object is toast now, better return here.
+               return;
+       }
+
        fClicked = false;
+       fCloseOnMouseUp = false;
 
        if (_CloseRectFrame(Frame()).Contains(where))
                fController->CloseTab(ContainerView()->IndexOf(this));

Other related posts:

  • » [haiku-webkit-commits] r469 - webkit/trunk/WebKit/haiku/WebPositive/tabview - webkit