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/native_theme/native_theme_aura.h" | 5 #include "ui/native_theme/native_theme_aura.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 SkColorSetA(kOverlayScrollbarStrokeColor[theme], thumb_alpha)); | 226 SkColorSetA(kOverlayScrollbarStrokeColor[theme], thumb_alpha)); |
227 paint.setStyle(SkPaint::kStroke_Style); | 227 paint.setStyle(SkPaint::kStroke_Style); |
228 paint.setStrokeWidth(kStrokeWidth); | 228 paint.setStrokeWidth(kStrokeWidth); |
229 | 229 |
230 gfx::RectF stroke_rect(thumb_rect); | 230 gfx::RectF stroke_rect(thumb_rect); |
231 constexpr float kHalfStrokeWidth = kStrokeWidth / 2.f; | 231 constexpr float kHalfStrokeWidth = kStrokeWidth / 2.f; |
232 stroke_rect.Inset(kHalfStrokeWidth, kHalfStrokeWidth); | 232 stroke_rect.Inset(kHalfStrokeWidth, kHalfStrokeWidth); |
233 canvas->drawRect(gfx::RectFToSkRect(stroke_rect), paint); | 233 canvas->drawRect(gfx::RectFToSkRect(stroke_rect), paint); |
234 | 234 |
235 // Inset the all the edges edges so we fill-in the stroke below. | 235 // Inset the all the edges edges so we fill-in the stroke below. |
236 thumb_rect.Inset(kStrokeWidth, kStrokeWidth); | 236 // TODO(bokan): Need to flip this for text direction of scroller. |
| 237 if (part == NativeTheme::kScrollbarVerticalThumb) |
| 238 thumb_rect.Inset(kStrokeWidth, kStrokeWidth, 0, kStrokeWidth); |
| 239 else |
| 240 thumb_rect.Inset(kStrokeWidth, kStrokeWidth, kStrokeWidth, 0); |
| 241 |
237 } else { | 242 } else { |
238 // If there are no scrollbuttons then provide some padding so that the thumb | 243 // If there are no scrollbuttons then provide some padding so that the thumb |
239 // doesn't touch the top of the track. | 244 // doesn't touch the top of the track. |
240 const int kThumbPadding = 2; | 245 const int kThumbPadding = 2; |
241 const int extra_padding = | 246 const int extra_padding = |
242 (scrollbar_button_length() == 0) ? kThumbPadding : 0; | 247 (scrollbar_button_length() == 0) ? kThumbPadding : 0; |
243 if (part == NativeTheme::kScrollbarVerticalThumb) | 248 if (part == NativeTheme::kScrollbarVerticalThumb) |
244 thumb_rect.Inset(kThumbPadding, extra_padding); | 249 thumb_rect.Inset(kThumbPadding, extra_padding); |
245 else | 250 else |
246 thumb_rect.Inset(extra_padding, kThumbPadding); | 251 thumb_rect.Inset(extra_padding, kThumbPadding); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 // scrollbars isn't asking for part sizes that don't exist. | 287 // scrollbars isn't asking for part sizes that don't exist. |
283 // crbug.com/657159. | 288 // crbug.com/657159. |
284 break; | 289 break; |
285 } | 290 } |
286 } | 291 } |
287 | 292 |
288 return NativeThemeBase::GetPartSize(part, state, extra); | 293 return NativeThemeBase::GetPartSize(part, state, extra); |
289 } | 294 } |
290 | 295 |
291 } // namespace ui | 296 } // namespace ui |
OLD | NEW |