| 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/table/table_view_views.h" | 5 #include "ui/views/controls/table/table_view_views.h" |
| 6 | 6 |
| 7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "third_party/skia/include/core/SkBitmap.h" | 8 #include "third_party/skia/include/core/SkBitmap.h" |
| 9 #include "ui/base/models/table_model.h" | 9 #include "ui/base/models/table_model.h" |
| 10 #include "ui/gfx/canvas_skia.h" | 10 #include "ui/gfx/canvas.h" |
| 11 #include "ui/gfx/native_theme.h" | 11 #include "ui/gfx/native_theme.h" |
| 12 #include "ui/gfx/skia_util.h" | 12 #include "ui/gfx/skia_util.h" |
| 13 #include "ui/views/border.h" | 13 #include "ui/views/border.h" |
| 14 #include "ui/views/controls/scroll_view.h" | 14 #include "ui/views/controls/scroll_view.h" |
| 15 #include "ui/views/controls/table/table_view_observer.h" | 15 #include "ui/views/controls/table/table_view_observer.h" |
| 16 | 16 |
| 17 // Padding around the text (on each side). | 17 // Padding around the text (on each side). |
| 18 static const int kTextVerticalPadding = 3; | 18 static const int kTextVerticalPadding = 3; |
| 19 static const int kTextHorizontalPadding = 2; | 19 static const int kTextHorizontalPadding = 2; |
| 20 | 20 |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 void TableView::OnPaint(gfx::Canvas* canvas) { | 216 void TableView::OnPaint(gfx::Canvas* canvas) { |
| 217 // Don't invoke View::OnPaint so that we can render our own focus border. | 217 // Don't invoke View::OnPaint so that we can render our own focus border. |
| 218 OnPaintBackground(canvas); | 218 OnPaintBackground(canvas); |
| 219 | 219 |
| 220 if (!RowCount()) | 220 if (!RowCount()) |
| 221 return; | 221 return; |
| 222 | 222 |
| 223 int min_y, max_y; | 223 int min_y, max_y; |
| 224 { | 224 { |
| 225 SkRect sk_clip_rect; | 225 SkRect sk_clip_rect; |
| 226 if (canvas->GetSkCanvas()->getClipBounds(&sk_clip_rect)) { | 226 if (canvas->sk_canvas()->getClipBounds(&sk_clip_rect)) { |
| 227 gfx::Rect clip_rect = gfx::SkRectToRect(sk_clip_rect); | 227 gfx::Rect clip_rect = gfx::SkRectToRect(sk_clip_rect); |
| 228 min_y = clip_rect.y(); | 228 min_y = clip_rect.y(); |
| 229 max_y = clip_rect.bottom(); | 229 max_y = clip_rect.bottom(); |
| 230 } else { | 230 } else { |
| 231 gfx::Rect vis_bounds = GetVisibleBounds(); | 231 gfx::Rect vis_bounds = GetVisibleBounds(); |
| 232 min_y = vis_bounds.y(); | 232 min_y = vis_bounds.y(); |
| 233 max_y = vis_bounds.bottom(); | 233 max_y = vis_bounds.bottom(); |
| 234 } | 234 } |
| 235 } | 235 } |
| 236 | 236 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 void TableView::NumRowsChanged() { | 280 void TableView::NumRowsChanged() { |
| 281 PreferredSizeChanged(); | 281 PreferredSizeChanged(); |
| 282 SchedulePaint(); | 282 SchedulePaint(); |
| 283 } | 283 } |
| 284 | 284 |
| 285 gfx::Rect TableView::GetRowBounds(int row) { | 285 gfx::Rect TableView::GetRowBounds(int row) { |
| 286 return gfx::Rect(0, row * row_height_, width(), row_height_); | 286 return gfx::Rect(0, row * row_height_, width(), row_height_); |
| 287 } | 287 } |
| 288 | 288 |
| 289 } // namespace views | 289 } // namespace views |
| OLD | NEW |