| 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/browser/views/bookmark_table_view.h" | 5 #include "chrome/browser/views/bookmark_table_view.h" |
| 6 | 6 |
| 7 #include "base/base_drag_source.h" | 7 #include "base/base_drag_source.h" |
| 8 #include "chrome/browser/bookmarks/bookmark_utils.h" | 8 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_model.h" | 9 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_table_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_table_model.h" |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 } | 421 } |
| 422 | 422 |
| 423 void BookmarkTableView::PaintAltText() { | 423 void BookmarkTableView::PaintAltText() { |
| 424 if (alt_text_.empty()) | 424 if (alt_text_.empty()) |
| 425 return; | 425 return; |
| 426 | 426 |
| 427 HDC dc = GetDC(GetNativeControlHWND()); | 427 HDC dc = GetDC(GetNativeControlHWND()); |
| 428 ChromeFont font = GetAltTextFont(); | 428 ChromeFont font = GetAltTextFont(); |
| 429 gfx::Rect bounds = GetAltTextBounds(); | 429 gfx::Rect bounds = GetAltTextBounds(); |
| 430 ChromeCanvas canvas(bounds.width(), bounds.height(), false); | 430 ChromeCanvas canvas(bounds.width(), bounds.height(), false); |
| 431 canvas.DrawStringInt(alt_text_, font, SK_ColorDKGRAY, 0, 0, bounds.width(), | 431 // Pad by 1 for halo. |
| 432 bounds.height()); | 432 canvas.DrawStringWithHalo(alt_text_, font, SK_ColorDKGRAY, SK_ColorWHITE, 1, |
| 433 1, bounds.width() - 2, bounds.height() - 2, |
| 434 ChromeCanvas::TEXT_ALIGN_LEFT); |
| 433 canvas.getTopPlatformDevice().drawToHDC(dc, bounds.x(), bounds.y(), NULL); | 435 canvas.getTopPlatformDevice().drawToHDC(dc, bounds.x(), bounds.y(), NULL); |
| 434 ReleaseDC(GetNativeControlHWND(), dc); | 436 ReleaseDC(GetNativeControlHWND(), dc); |
| 435 } | 437 } |
| 436 | 438 |
| 437 gfx::Rect BookmarkTableView::GetAltTextBounds() { | 439 gfx::Rect BookmarkTableView::GetAltTextBounds() { |
| 438 static const int kXOffset = 16; | 440 static const int kXOffset = 16; |
| 439 DCHECK(GetNativeControlHWND()); | 441 DCHECK(GetNativeControlHWND()); |
| 440 CRect client_rect; | 442 CRect client_rect; |
| 441 GetClientRect(GetNativeControlHWND(), client_rect); | 443 GetClientRect(GetNativeControlHWND(), client_rect); |
| 442 ChromeFont font = GetAltTextFont(); | 444 ChromeFont font = GetAltTextFont(); |
| 445 // Pad height by 2 for halo. |
| 443 return gfx::Rect(kXOffset, content_offset(), client_rect.Width() - kXOffset, | 446 return gfx::Rect(kXOffset, content_offset(), client_rect.Width() - kXOffset, |
| 444 std::max(kImageSize, font.height())); | 447 std::max(kImageSize, font.height() + 2)); |
| 445 } | 448 } |
| 446 | 449 |
| 447 ChromeFont BookmarkTableView::GetAltTextFont() { | 450 ChromeFont BookmarkTableView::GetAltTextFont() { |
| 448 return ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont); | 451 return ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont); |
| 449 } | 452 } |
| OLD | NEW |