|
| 1 | +diff --git a/chrome/browser/ui/views/download/download_item_view.cc b/chrome/browser/ui/views/download/download_item_view.cc |
| 2 | +index 42706748b2d50..90ce02a65ebd1 100644 |
| 3 | +--- a/chrome/browser/ui/views/download/download_item_view.cc |
| 4 | ++++ b/chrome/browser/ui/views/download/download_item_view.cc |
| 5 | +@@ -65,6 +65,7 @@ |
| 6 | + #include "ui/base/mojom/menu_source_type.mojom-forward.h" |
| 7 | + #include "ui/base/text/bytes_formatting.h" |
| 8 | + #include "ui/base/themed_vector_icon.h" |
| 9 | ++#include "ui/base/ui_base_features.h" |
| 10 | + #include "ui/color/color_id.h" |
| 11 | + #include "ui/color/color_provider.h" |
| 12 | + #include "ui/compositor/layer.h" |
| 13 | +@@ -116,7 +117,7 @@ namespace { |
| 14 | + constexpr int kTextWidth = 140; |
| 15 | + |
| 16 | + // Padding before the icon and at end of the item. |
| 17 | +-constexpr int kStartPadding = 12; |
| 18 | ++constexpr int kStartPadding = 8; |
| 19 | + constexpr int kEndPadding = 6; |
| 20 | + |
| 21 | + // Horizontal padding between progress indicator and filename/status text. |
| 22 | +@@ -192,6 +193,12 @@ class TransparentButton : public views::Button { |
| 23 | + |
| 24 | + void OnTooltipTextUpdated() { parent()->GetTooltipText(); } |
| 25 | + |
| 26 | ++ // Fix bug in CR af6f4b9c4f3b02fbcba3ffa3c7f4b65b0995aba3 that prevented download item tooltip from showing. |
| 27 | ++ std::u16string GetRenderedTooltipText(const gfx::Point& p) const override { |
| 28 | ++ const std::u16string this_tooltip_text = parent()->GetTooltipText(); |
| 29 | ++ return this_tooltip_text; |
| 30 | ++ } |
| 31 | ++ |
| 32 | + private: |
| 33 | + base::CallbackListSubscription tooltip_text_changed_subscription_; |
| 34 | + }; |
| 35 | +@@ -602,6 +609,9 @@ gfx::Size DownloadItemView::CalculatePreferredSize( |
| 36 | + } |
| 37 | + } |
| 38 | + |
| 39 | ++ if (features::IsThorium2024()) { |
| 40 | ++ height -= 16; |
| 41 | ++ } |
| 42 | + // The normal height of the item which may be exceeded if text is large. |
| 43 | + constexpr int kDefaultDownloadItemHeight = 48; |
| 44 | + return gfx::Size(width, std::max(kDefaultDownloadItemHeight, |
| 45 | +@@ -610,13 +620,6 @@ gfx::Size DownloadItemView::CalculatePreferredSize( |
| 46 | + |
| 47 | + void DownloadItemView::OnPaintBackground(gfx::Canvas* canvas) { |
| 48 | + View::OnPaintBackground(canvas); |
| 49 | +- |
| 50 | +- // Draw the separator as part of the background. It will be covered by the |
| 51 | +- // focus ring when the view has focus. |
| 52 | +- gfx::Rect rect(width() - 1, 0, 1, height()); |
| 53 | +- rect.Inset(gfx::Insets::VH(kTopBottomPadding, 0)); |
| 54 | +- canvas->FillRect(GetMirroredRect(rect), |
| 55 | +- GetColorProvider()->GetColor(kColorToolbarSeparator)); |
| 56 | + } |
| 57 | + |
| 58 | + void DownloadItemView::OnPaint(gfx::Canvas* canvas) { |
| 59 | +@@ -694,6 +697,14 @@ void DownloadItemView::OnPaint(gfx::Canvas* canvas) { |
| 60 | + canvas->DrawImageInt(icon, bounds.x(), bounds.y()); |
| 61 | + } |
| 62 | + |
| 63 | ++ // Draw the separator as part of the background. It will be covered by the |
| 64 | ++ // focus ring when the view has focus. |
| 65 | ++ // Alex313031: TODO: Use NTB method to pop out to overlay and move right 1px |
| 66 | ++ gfx::Rect rect(width() - 1, 0, 1, height()); |
| 67 | ++ rect.Inset(gfx::Insets::VH(kTopBottomPadding, 0)); |
| 68 | ++ canvas->FillRect(GetMirroredRect(rect), |
| 69 | ++ GetColorProvider()->GetColor(kColorToolbarSeparator)); |
| 70 | ++ |
| 71 | + OnPaintBorder(canvas); |
| 72 | + } |
| 73 | + |
0 commit comments