| OLD | NEW |
| 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 Loading... |
| 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. |
| 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 |
| OLD | NEW |