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

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

Issue 7846010: Fixed crash when a SinglesplitView gets embdedded inside SingleSplitView (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Comments incorporated as per Sky review Created 9 years, 3 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 | « AUTHORS ('k') | views/examples/double_split_view_example.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) 2011 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
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 divider_offset = kDividerSize; 239 divider_offset = kDividerSize;
240 } 240 }
241 } 241 }
242 return divider_offset; 242 return divider_offset;
243 } 243 }
244 244
245 int SingleSplitView::NormalizeDividerOffset(int divider_offset, 245 int SingleSplitView::NormalizeDividerOffset(int divider_offset,
246 const gfx::Rect& bounds) const { 246 const gfx::Rect& bounds) const {
247 int primary_axis_size = GetPrimaryAxisSize(bounds.width(), bounds.height()); 247 int primary_axis_size = GetPrimaryAxisSize(bounds.width(), bounds.height());
248 if (divider_offset < 0) 248 if (divider_offset < 0)
249 return (primary_axis_size - kDividerSize) / 2; 249 // primary_axis_size may < kDividerSize during initial layout
sky 2011/09/14 15:01:16 end with a '.'.
Gajen 2011/09/14 15:50:01 Done.
250 return std::max(0, (primary_axis_size - kDividerSize) / 2);
250 return std::min(divider_offset, 251 return std::min(divider_offset,
251 std::max(primary_axis_size - kDividerSize, 0)); 252 std::max(primary_axis_size - kDividerSize, 0));
252 } 253 }
253 254
254 } // namespace views 255 } // namespace views
OLDNEW
« no previous file with comments | « AUTHORS ('k') | views/examples/double_split_view_example.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698