| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/controls/single_split_view.h" | 5 #include "ui/views/controls/single_split_view.h" |
| 6 | 6 |
| 7 #include "skia/ext/skia_utils_win.h" | 7 #include "skia/ext/skia_utils_win.h" |
| 8 #include "ui/accessibility/ax_view_state.h" | 8 #include "ui/accessibility/ax_view_state.h" |
| 9 #include "ui/base/cursor/cursor.h" | 9 #include "ui/base/cursor/cursor.h" |
| 10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 const char* SingleSplitView::GetClassName() const { | 59 const char* SingleSplitView::GetClassName() const { |
| 60 return kViewClassName; | 60 return kViewClassName; |
| 61 } | 61 } |
| 62 | 62 |
| 63 void SingleSplitView::GetAccessibleState(ui::AXViewState* state) { | 63 void SingleSplitView::GetAccessibleState(ui::AXViewState* state) { |
| 64 state->role = ui::AX_ROLE_GROUP; | 64 state->role = ui::AX_ROLE_GROUP; |
| 65 state->name = accessible_name_; | 65 state->name = accessible_name_; |
| 66 } | 66 } |
| 67 | 67 |
| 68 gfx::Size SingleSplitView::GetPreferredSize() { | 68 gfx::Size SingleSplitView::GetPreferredSize() const { |
| 69 int width = 0; | 69 int width = 0; |
| 70 int height = 0; | 70 int height = 0; |
| 71 for (int i = 0; i < 2 && i < child_count(); ++i) { | 71 for (int i = 0; i < 2 && i < child_count(); ++i) { |
| 72 View* view = child_at(i); | 72 const View* view = child_at(i); |
| 73 gfx::Size pref = view->GetPreferredSize(); | 73 gfx::Size pref = view->GetPreferredSize(); |
| 74 if (is_horizontal_) { | 74 if (is_horizontal_) { |
| 75 width += pref.width(); | 75 width += pref.width(); |
| 76 height = std::max(height, pref.height()); | 76 height = std::max(height, pref.height()); |
| 77 } else { | 77 } else { |
| 78 width = std::max(width, pref.width()); | 78 width = std::max(width, pref.width()); |
| 79 height += pref.height(); | 79 height += pref.height(); |
| 80 } | 80 } |
| 81 } | 81 } |
| 82 if (is_horizontal_) | 82 if (is_horizontal_) |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 const gfx::Rect& bounds) const { | 244 const gfx::Rect& bounds) const { |
| 245 int primary_axis_size = GetPrimaryAxisSize(bounds.width(), bounds.height()); | 245 int primary_axis_size = GetPrimaryAxisSize(bounds.width(), bounds.height()); |
| 246 if (divider_offset < 0) | 246 if (divider_offset < 0) |
| 247 // primary_axis_size may < GetDividerSize during initial layout. | 247 // primary_axis_size may < GetDividerSize during initial layout. |
| 248 return std::max(0, (primary_axis_size - GetDividerSize()) / 2); | 248 return std::max(0, (primary_axis_size - GetDividerSize()) / 2); |
| 249 return std::min(divider_offset, | 249 return std::min(divider_offset, |
| 250 std::max(primary_axis_size - GetDividerSize(), 0)); | 250 std::max(primary_axis_size - GetDividerSize(), 0)); |
| 251 } | 251 } |
| 252 | 252 |
| 253 } // namespace views | 253 } // namespace views |
| OLD | NEW |