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

Side by Side Diff: views/controls/resize_area.cc

Issue 6685069: Disambiguate OnMouseCaptureLost from OnMouseReleased, etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments, fix tests, cleanup, etc. Created 9 years, 9 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/controls/resize_area.h ('k') | views/controls/scrollbar/bitmap_scroll_bar.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "views/controls/resize_area.h" 5 #include "views/controls/resize_area.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/base/accessibility/accessible_view_state.h" 8 #include "ui/base/accessibility/accessible_view_state.h"
9 #include "ui/base/resource/resource_bundle.h" 9 #include "ui/base/resource/resource_bundle.h"
10 10
11 #if defined(OS_LINUX) 11 #if defined(OS_LINUX)
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 63 }
64 64
65 bool ResizeArea::OnMouseDragged(const views::MouseEvent& event) { 65 bool ResizeArea::OnMouseDragged(const views::MouseEvent& event) {
66 if (!event.IsLeftMouseButton()) 66 if (!event.IsLeftMouseButton())
67 return false; 67 return false;
68 68
69 ReportResizeAmount(event.x(), false); 69 ReportResizeAmount(event.x(), false);
70 return true; 70 return true;
71 } 71 }
72 72
73 void ResizeArea::OnMouseReleased(const views::MouseEvent& event, 73 void ResizeArea::OnMouseReleased(const views::MouseEvent& event) {
74 bool canceled) { 74 ReportResizeAmount(event.x(), true);
75 ReportResizeAmount(canceled ? initial_position_ : event.x(), true); 75 }
76
77 void ResizeArea::OnMouseCaptureLost() {
78 ReportResizeAmount(initial_position_, true);
76 } 79 }
77 80
78 void ResizeArea::GetAccessibleState(ui::AccessibleViewState* state) { 81 void ResizeArea::GetAccessibleState(ui::AccessibleViewState* state) {
79 state->role = ui::AccessibilityTypes::ROLE_SEPARATOR; 82 state->role = ui::AccessibilityTypes::ROLE_SEPARATOR;
80 } 83 }
81 84
82 void ResizeArea::ReportResizeAmount(int resize_amount, bool last_update) { 85 void ResizeArea::ReportResizeAmount(int resize_amount, bool last_update) {
83 gfx::Point point(resize_amount, 0); 86 gfx::Point point(resize_amount, 0);
84 View::ConvertPointToScreen(this, &point); 87 View::ConvertPointToScreen(this, &point);
85 resize_amount = point.x() - initial_position_; 88 resize_amount = point.x() - initial_position_;
86 delegate_->OnResize(base::i18n::IsRTL() ? -resize_amount : resize_amount, 89 delegate_->OnResize(base::i18n::IsRTL() ? -resize_amount : resize_amount,
87 last_update); 90 last_update);
88 } 91 }
89 92
90 } // namespace views 93 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/resize_area.h ('k') | views/controls/scrollbar/bitmap_scroll_bar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698