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

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: incorporated all review comments by Sky and Tfarina 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
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 // Prevents negative check fail in gfx::Size() for an embedded
sky 2011/09/09 15:32:23 For a comment, how about 'primary_axis_size may <
Gajen 2011/09/12 15:13:44 Agreed but it won't add more value b'coz 0)Adds on
250 // SingleSplitView on very first Layout.
251 return std::max(0, (primary_axis_size - kDividerSize) / 2);
250 return std::min(divider_offset, 252 return std::min(divider_offset,
251 std::max(primary_axis_size - kDividerSize, 0)); 253 std::max(primary_axis_size - kDividerSize, 0));
252 } 254 }
253 255
254 } // namespace views 256 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698