| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/views/native_scroll_bar.h" | 5 #include "chrome/views/native_scroll_bar.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <atlbase.h> | 8 #include <atlbase.h> |
| 9 #include <atlapp.h> | 9 #include <atlapp.h> |
| 10 #include <atlcrack.h> | 10 #include <atlcrack.h> |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 GetLocalBounds(&lb, true); | 243 GetLocalBounds(&lb, true); |
| 244 sb_view_->SetBounds(0, 0, lb.Width(), lb.Height()); | 244 sb_view_->SetBounds(0, 0, lb.Width(), lb.Height()); |
| 245 } | 245 } |
| 246 } | 246 } |
| 247 | 247 |
| 248 void NativeScrollBar::DidChangeBounds(const CRect& previous, | 248 void NativeScrollBar::DidChangeBounds(const CRect& previous, |
| 249 const CRect& current) { | 249 const CRect& current) { |
| 250 Layout(); | 250 Layout(); |
| 251 } | 251 } |
| 252 | 252 |
| 253 void NativeScrollBar::GetPreferredSize(CSize *out) { | 253 gfx::Size NativeScrollBar::GetPreferredSize() { |
| 254 DCHECK(out); | 254 if (IsHorizontal()) |
| 255 if (IsHorizontal()) { | 255 return gfx::Size(0, GetLayoutSize()); |
| 256 out->cx = 0; | 256 return gfx::Size(GetLayoutSize(), 0); |
| 257 out->cy = GetLayoutSize(); | |
| 258 } else { | |
| 259 out->cx = GetLayoutSize(); | |
| 260 out->cy = 0; | |
| 261 } | |
| 262 } | 257 } |
| 263 | 258 |
| 264 void NativeScrollBar::Update(int viewport_size, int content_size, int current_po
s) { | 259 void NativeScrollBar::Update(int viewport_size, int content_size, int current_po
s) { |
| 265 ScrollBar::Update(viewport_size, content_size, current_pos); | 260 ScrollBar::Update(viewport_size, content_size, current_pos); |
| 266 if (!sb_container_) | 261 if (!sb_container_) |
| 267 return; | 262 return; |
| 268 | 263 |
| 269 if (content_size < 0) | 264 if (content_size < 0) |
| 270 content_size = 0; | 265 content_size = 0; |
| 271 | 266 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 return ::GetSystemMetrics(SM_CYHSCROLL); | 353 return ::GetSystemMetrics(SM_CYHSCROLL); |
| 359 } | 354 } |
| 360 | 355 |
| 361 //static | 356 //static |
| 362 int NativeScrollBar::GetVerticalScrollBarWidth() { | 357 int NativeScrollBar::GetVerticalScrollBarWidth() { |
| 363 return ::GetSystemMetrics(SM_CXVSCROLL); | 358 return ::GetSystemMetrics(SM_CXVSCROLL); |
| 364 } | 359 } |
| 365 | 360 |
| 366 } | 361 } |
| 367 | 362 |
| OLD | NEW |