| 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/base/accessibility/accessible_view_state.h" | 8 #include "ui/base/accessibility/accessible_view_state.h" |
| 9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
| 10 #include "ui/views/background.h" | 10 #include "ui/views/background.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 std::max(0, bounds.width() - divider_at - divider_size), | 141 std::max(0, bounds.width() - divider_at - divider_size), |
| 142 bounds.height()); | 142 bounds.height()); |
| 143 } else { | 143 } else { |
| 144 *leading_bounds = gfx::Rect(0, 0, bounds.width(), divider_at); | 144 *leading_bounds = gfx::Rect(0, 0, bounds.width(), divider_at); |
| 145 *trailing_bounds = | 145 *trailing_bounds = |
| 146 gfx::Rect(0, divider_at + divider_size, bounds.width(), | 146 gfx::Rect(0, divider_at + divider_size, bounds.width(), |
| 147 std::max(0, bounds.height() - divider_at - divider_size)); | 147 std::max(0, bounds.height() - divider_at - divider_size)); |
| 148 } | 148 } |
| 149 } | 149 } |
| 150 | 150 |
| 151 void SingleSplitView::SetAccessibleName(const string16& name) { | 151 void SingleSplitView::SetAccessibleName(const base::string16& name) { |
| 152 accessible_name_ = name; | 152 accessible_name_ = name; |
| 153 } | 153 } |
| 154 | 154 |
| 155 bool SingleSplitView::OnMousePressed(const ui::MouseEvent& event) { | 155 bool SingleSplitView::OnMousePressed(const ui::MouseEvent& event) { |
| 156 if (!IsPointInDivider(event.location())) | 156 if (!IsPointInDivider(event.location())) |
| 157 return false; | 157 return false; |
| 158 drag_info_.initial_mouse_offset = GetPrimaryAxisSize(event.x(), event.y()); | 158 drag_info_.initial_mouse_offset = GetPrimaryAxisSize(event.x(), event.y()); |
| 159 drag_info_.initial_divider_offset = | 159 drag_info_.initial_divider_offset = |
| 160 NormalizeDividerOffset(divider_offset_, bounds()); | 160 NormalizeDividerOffset(divider_offset_, bounds()); |
| 161 return true; | 161 return true; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 const gfx::Rect& bounds) const { | 252 const gfx::Rect& bounds) const { |
| 253 int primary_axis_size = GetPrimaryAxisSize(bounds.width(), bounds.height()); | 253 int primary_axis_size = GetPrimaryAxisSize(bounds.width(), bounds.height()); |
| 254 if (divider_offset < 0) | 254 if (divider_offset < 0) |
| 255 // primary_axis_size may < GetDividerSize during initial layout. | 255 // primary_axis_size may < GetDividerSize during initial layout. |
| 256 return std::max(0, (primary_axis_size - GetDividerSize()) / 2); | 256 return std::max(0, (primary_axis_size - GetDividerSize()) / 2); |
| 257 return std::min(divider_offset, | 257 return std::min(divider_offset, |
| 258 std::max(primary_axis_size - GetDividerSize(), 0)); | 258 std::max(primary_axis_size - GetDividerSize(), 0)); |
| 259 } | 259 } |
| 260 | 260 |
| 261 } // namespace views | 261 } // namespace views |
| OLD | NEW |