Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2869)

Unified Diff: chrome/browser/ui/panels/panel_browser_view.cc

Issue 8539035: Fix 3 panel related bugs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/panels/panel_browser_view.cc
diff --git a/chrome/browser/ui/panels/panel_browser_view.cc b/chrome/browser/ui/panels/panel_browser_view.cc
index fe84d774019a734c6e51613234fe1040956c6771..65271a2e55514634cb5b35130e81c5faf868d6b0 100644
--- a/chrome/browser/ui/panels/panel_browser_view.cc
+++ b/chrome/browser/ui/panels/panel_browser_view.cc
@@ -381,8 +381,12 @@ PanelBrowserFrameView* PanelBrowserView::GetFrameView() const {
}
bool PanelBrowserView::OnTitlebarMousePressed(const gfx::Point& location) {
+ // |location| is in the view's coordinate system. Convert it to the screen
+ // coordinate system.
+ mouse_location_ = location;
+ views::View::ConvertPointToScreen(this, &mouse_location_);
+
mouse_pressed_ = true;
- mouse_pressed_point_ = location;
mouse_pressed_time_ = base::TimeTicks::Now();
mouse_dragging_state_ = NO_DRAGGING;
return true;
@@ -392,8 +396,15 @@ bool PanelBrowserView::OnTitlebarMouseDragged(const gfx::Point& location) {
if (!mouse_pressed_)
return false;
- int delta_x = location.x() - mouse_pressed_point_.x();
- int delta_y = location.y() - mouse_pressed_point_.y();
+ gfx::Point last_mouse_location = mouse_location_;
+
+ // |location| is in the view's coordinate system. Convert it to the screen
+ // coordinate system.
+ mouse_location_ = location;
Dmitry Titov 2011/11/12 01:34:54 The way it's written it can easily look like mixin
jianli 2011/11/15 19:26:24 'location' is passed by const reference. So I can'
+ views::View::ConvertPointToScreen(this, &mouse_location_);
+
+ int delta_x = mouse_location_.x() - last_mouse_location.x();
+ int delta_y = mouse_location_.y() - last_mouse_location.y();
if (mouse_dragging_state_ == NO_DRAGGING &&
ExceededDragThreshold(delta_x, delta_y)) {
// When a drag begins, we do not want to the client area to still receive
@@ -505,12 +516,14 @@ void NativePanelTestingWin::ReleaseMouseButtonTitlebar() {
}
void NativePanelTestingWin::DragTitlebar(int delta_x, int delta_y) {
- // TODO(jianli): Need a comment here that explains why we use
- // mouse_pressed_point_ and not current bounds as obtained by
- // GetRestoredBounds(). http://crbug.com/102730
- panel_browser_view_->OnTitlebarMouseDragged(gfx::Point(
- panel_browser_view_->mouse_pressed_point_.x() + delta_x,
- panel_browser_view_->mouse_pressed_point_.y() + delta_y));
+ gfx::Point new_mouse_location = panel_browser_view_->mouse_location_;
+ new_mouse_location.Offset(delta_x, delta_y);
+
+ // Convert from the screen coordinate system to the view's coordinate system
+ // since OnTitlebarMouseDragged takes the point in the latter.
+ views::View::ConvertPointToView(NULL, panel_browser_view_,
+ &new_mouse_location);
+ panel_browser_view_->OnTitlebarMouseDragged(new_mouse_location);
}
void NativePanelTestingWin::CancelDragTitlebar() {
« no previous file with comments | « chrome/browser/ui/panels/panel_browser_view.h ('k') | chrome/browser/ui/panels/panel_settings_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698