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

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: 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 embedded SingleSplitView
tfarina 2011/09/08 20:39:45 add space between gfx::Size() and for and "for an
Gajen 2011/09/09 13:58:02 Done.
250 // on very first Layout.
251 return std::max(0, ((primary_axis_size - kDividerSize) / 2));
tfarina 2011/09/08 20:39:45 is there an extra (unnecessary) parentheses around
Gajen 2011/09/09 13:58:02 Done.
252
250 return std::min(divider_offset, 253 return std::min(divider_offset,
sky 2011/09/08 14:27:11 Put the std::max call here, eg std::max(0, divider
251 std::max(primary_axis_size - kDividerSize, 0)); 254 std::max(primary_axis_size - kDividerSize, 0));
252 } 255 }
253 256
254 } // namespace views 257 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698