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

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

Issue 6685069: Disambiguate OnMouseCaptureLost from OnMouseReleased, etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refinements, 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
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/single_split_view.h" 5 #include "views/controls/single_split_view.h"
6 6
7 #if defined(OS_LINUX) 7 #if defined(OS_LINUX)
8 #include <gdk/gdk.h> 8 #include <gdk/gdk.h>
9 #endif 9 #endif
10 10
11 #include "skia/ext/skia_utils_win.h" 11 #include "skia/ext/skia_utils_win.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 new_size = std::min(GetPrimaryAxisSize() - kDividerSize, new_size); 175 new_size = std::min(GetPrimaryAxisSize() - kDividerSize, new_size);
176 176
177 if (new_size != divider_offset_) { 177 if (new_size != divider_offset_) {
178 set_divider_offset(new_size); 178 set_divider_offset(new_size);
179 if (!observer_ || observer_->SplitHandleMoved(this)) 179 if (!observer_ || observer_->SplitHandleMoved(this))
180 Layout(); 180 Layout();
181 } 181 }
182 return true; 182 return true;
183 } 183 }
184 184
185 void SingleSplitView::OnMouseReleased(const MouseEvent& event, bool canceled) { 185 void SingleSplitView::OnMouseCaptureLost() {
186 // TODO(msw): Was this intentionally a no-op on non-cancelled mouse releases?
msw 2011/03/17 23:28:51 Need guidance / testing / revision history researc
186 if (child_count() < 2) 187 if (child_count() < 2)
187 return; 188 return;
188 189
189 if (canceled && drag_info_.initial_divider_offset != divider_offset_) { 190 if (drag_info_.initial_divider_offset != divider_offset_) {
190 set_divider_offset(drag_info_.initial_divider_offset); 191 set_divider_offset(drag_info_.initial_divider_offset);
191 if (!observer_ || observer_->SplitHandleMoved(this)) 192 if (!observer_ || observer_->SplitHandleMoved(this))
192 Layout(); 193 Layout();
193 } 194 }
194 } 195 }
195 196
196 void SingleSplitView::OnBoundsChanged(const gfx::Rect& previous_bounds) { 197 void SingleSplitView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
197 divider_offset_ = CalculateDividerOffset(divider_offset_, previous_bounds, 198 divider_offset_ = CalculateDividerOffset(divider_offset_, previous_bounds,
198 bounds()); 199 bounds());
199 } 200 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 int SingleSplitView::NormalizeDividerOffset(int divider_offset, 243 int SingleSplitView::NormalizeDividerOffset(int divider_offset,
243 const gfx::Rect& bounds) const { 244 const gfx::Rect& bounds) const {
244 int primary_axis_size = GetPrimaryAxisSize(bounds.width(), bounds.height()); 245 int primary_axis_size = GetPrimaryAxisSize(bounds.width(), bounds.height());
245 if (divider_offset < 0) 246 if (divider_offset < 0)
246 return (primary_axis_size - kDividerSize) / 2; 247 return (primary_axis_size - kDividerSize) / 2;
247 return std::min(divider_offset, 248 return std::min(divider_offset,
248 std::max(primary_axis_size - kDividerSize, 0)); 249 std::max(primary_axis_size - kDividerSize, 0));
249 } 250 }
250 251
251 } // namespace views 252 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698