OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/gtk/bookmark_bar_gtk.h" | 5 #include "chrome/browser/gtk/bookmark_bar_gtk.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "app/gfx/text_elider.h" | 9 #include "app/gfx/text_elider.h" |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 // static | 551 // static |
552 gboolean BookmarkBarGtk::OnButtonReleased(GtkWidget* sender, | 552 gboolean BookmarkBarGtk::OnButtonReleased(GtkWidget* sender, |
553 GdkEventButton* event, | 553 GdkEventButton* event, |
554 BookmarkBarGtk* bar) { | 554 BookmarkBarGtk* bar) { |
555 if (bar->ignore_button_release_) { | 555 if (bar->ignore_button_release_) { |
556 // Don't handle this message; it was a drag. | 556 // Don't handle this message; it was a drag. |
557 bar->ignore_button_release_ = false; | 557 bar->ignore_button_release_ = false; |
558 return FALSE; | 558 return FALSE; |
559 } | 559 } |
560 | 560 |
| 561 // Don't take any action if the user releases outside the button. |
| 562 if (event->x < 0 || event->y < 0 || event->x >= sender->allocation.width || |
| 563 event->y >= sender->allocation.height) { |
| 564 return FALSE; |
| 565 } |
| 566 |
561 const BookmarkNode* node = bar->GetNodeForToolButton(sender); | 567 const BookmarkNode* node = bar->GetNodeForToolButton(sender); |
562 DCHECK(node); | 568 DCHECK(node); |
563 DCHECK(bar->page_navigator_); | 569 DCHECK(bar->page_navigator_); |
564 | 570 |
565 if (node->is_url()) { | 571 if (node->is_url()) { |
566 bar->page_navigator_->OpenURL( | 572 bar->page_navigator_->OpenURL( |
567 node->GetURL(), GURL(), | 573 node->GetURL(), GURL(), |
568 event_utils::DispositionFromEventFlags(event->state), | 574 event_utils::DispositionFromEventFlags(event->state), |
569 PageTransition::AUTO_BOOKMARK); | 575 PageTransition::AUTO_BOOKMARK); |
570 } else { | 576 } else { |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 bar->InitBackground(); | 838 bar->InitBackground(); |
833 gfx::Point tabstrip_origin = | 839 gfx::Point tabstrip_origin = |
834 bar->window_->tabstrip()->GetTabStripOriginForWidget(widget); | 840 bar->window_->tabstrip()->GetTabStripOriginForWidget(widget); |
835 bar->background_ninebox_->RenderTopCenterStrip( | 841 bar->background_ninebox_->RenderTopCenterStrip( |
836 cr, tabstrip_origin.x(), tabstrip_origin.y(), | 842 cr, tabstrip_origin.x(), tabstrip_origin.y(), |
837 event->area.x + event->area.width - tabstrip_origin.x()); | 843 event->area.x + event->area.width - tabstrip_origin.x()); |
838 cairo_destroy(cr); | 844 cairo_destroy(cr); |
839 | 845 |
840 return FALSE; // Propagate expose to children. | 846 return FALSE; // Propagate expose to children. |
841 } | 847 } |
OLD | NEW |