| 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 "chrome/browser/ui/views/location_bar/icon_label_bubble_view.h" | 5 #include "chrome/browser/ui/views/location_bar/icon_label_bubble_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/layout_constants.h" | 7 #include "chrome/browser/ui/layout_constants.h" |
| 8 #include "chrome/browser/ui/views/location_bar/background_with_1_px_border.h" | 8 #include "chrome/browser/ui/views/location_bar/background_with_1_px_border.h" |
| 9 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 9 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 10 #include "ui/accessibility/ax_node_data.h" | 10 #include "ui/accessibility/ax_node_data.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 constexpr int kSpaceBesideSeparator = 8; | 23 constexpr int kSpaceBesideSeparator = 8; |
| 24 | 24 |
| 25 } // namespace | 25 } // namespace |
| 26 | 26 |
| 27 IconLabelBubbleView::IconLabelBubbleView(const gfx::FontList& font_list, | 27 IconLabelBubbleView::IconLabelBubbleView(const gfx::FontList& font_list, |
| 28 bool elide_in_middle) | 28 bool elide_in_middle) |
| 29 : image_(new views::ImageView()), | 29 : image_(new views::ImageView()), |
| 30 label_(new views::Label(base::string16(), font_list)) { | 30 label_(new views::Label(base::string16(), font_list)) { |
| 31 // Disable separate hit testing for |image_|. This prevents views treating | 31 // Disable separate hit testing for |image_|. This prevents views treating |
| 32 // |image_| as a separate mouse hover region from |this|. | 32 // |image_| as a separate mouse hover region from |this|. |
| 33 image_->set_interactive(false); | 33 image_->set_can_process_events_within_subtree(false); |
| 34 image_->SetBorder(views::CreateEmptyBorder( | 34 image_->SetBorder(views::CreateEmptyBorder( |
| 35 gfx::Insets(LocationBarView::kIconInteriorPadding))); | 35 gfx::Insets(LocationBarView::kIconInteriorPadding))); |
| 36 AddChildView(image_); | 36 AddChildView(image_); |
| 37 | 37 |
| 38 label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 38 label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 39 | 39 |
| 40 if (elide_in_middle) | 40 if (elide_in_middle) |
| 41 label_->SetElideBehavior(gfx::ELIDE_MIDDLE); | 41 label_->SetElideBehavior(gfx::ELIDE_MIDDLE); |
| 42 AddChildView(label_); | 42 AddChildView(label_); |
| 43 | 43 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 | 232 |
| 233 // Draw the 1 px separator. | 233 // Draw the 1 px separator. |
| 234 gfx::ScopedCanvas scoped_canvas(canvas); | 234 gfx::ScopedCanvas scoped_canvas(canvas); |
| 235 const float scale = canvas->UndoDeviceScaleFactor(); | 235 const float scale = canvas->UndoDeviceScaleFactor(); |
| 236 // Keep the separator aligned on a pixel center. | 236 // Keep the separator aligned on a pixel center. |
| 237 const gfx::RectF pixel_aligned_bounds = | 237 const gfx::RectF pixel_aligned_bounds = |
| 238 gfx::ScaleRect(gfx::RectF(bounds), scale) - gfx::Vector2dF(0.5f, 0); | 238 gfx::ScaleRect(gfx::RectF(bounds), scale) - gfx::Vector2dF(0.5f, 0); |
| 239 canvas->DrawLine(pixel_aligned_bounds.top_right(), | 239 canvas->DrawLine(pixel_aligned_bounds.top_right(), |
| 240 pixel_aligned_bounds.bottom_right(), separator_color); | 240 pixel_aligned_bounds.bottom_right(), separator_color); |
| 241 } | 241 } |
| OLD | NEW |