Chromium Code Reviews| Index: chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc |
| diff --git a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc |
| index 8c5563303cd3529c20e9f013fb357e4dde5716a3..105a2c6f3758a0d4cc07bd0aa96632229d72fbb8 100644 |
| --- a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc |
| +++ b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc |
| @@ -6,6 +6,7 @@ |
| #include <algorithm> |
| +#include "base/feature_list.h" |
| #include "base/lazy_instance.h" |
| #include "base/macros.h" |
| #include "build/build_config.h" |
| @@ -14,6 +15,7 @@ |
| #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| #include "chrome/browser/ui/views/omnibox/omnibox_result_view.h" |
| #include "chrome/browser/ui/views/theme_copying_widget.h" |
| +#include "components/omnibox/browser/omnibox_field_trial.h" |
| #include "components/omnibox/browser/omnibox_view.h" |
| #include "third_party/skia/include/core/SkDrawLooper.h" |
| #include "ui/base/theme_provider.h" |
| @@ -455,17 +457,28 @@ const char* OmniboxPopupContentsView::GetClassName() const { |
| } |
| void OmniboxPopupContentsView::OnPaint(gfx::Canvas* canvas) { |
| - canvas->TileImageInt(g_top_shadow.Get(), 0, 0, width(), |
| + bool match_omnibox_width = base::FeatureList::IsEnabled( |
|
Peter Kasting
2017/06/05 18:25:45
It seems like the implementation in this file leav
tommycli
2017/06/05 22:39:21
Done. Thank you for this feedback! This made thing
|
| + omnibox::kUIExperimentSuggestionsDropdownWidth); |
| + int shadow_x = match_omnibox_width ? start_margin_ : 0; |
| + int shadow_width = |
| + match_omnibox_width ? width() - start_margin_ - end_margin_ : 0; |
| + |
| + canvas->TileImageInt(g_top_shadow.Get(), shadow_x, 0, shadow_width, |
| g_top_shadow.Get().height()); |
| - canvas->TileImageInt(g_bottom_shadow.Get(), 0, |
| - height() - g_bottom_shadow.Get().height(), width(), |
| + canvas->TileImageInt(g_bottom_shadow.Get(), shadow_x, |
| + height() - g_bottom_shadow.Get().height(), shadow_width, |
| g_bottom_shadow.Get().height()); |
| } |
| void OmniboxPopupContentsView::PaintChildren(const ui::PaintContext& context) { |
| gfx::Rect contents_bounds = GetContentsBounds(); |
| - contents_bounds.Inset(0, g_top_shadow.Get().height(), 0, |
| - g_bottom_shadow.Get().height()); |
| + bool match_omnibox_width = base::FeatureList::IsEnabled( |
| + omnibox::kUIExperimentSuggestionsDropdownWidth); |
| + int contents_start = match_omnibox_width ? start_margin_ : 0; |
| + int contents_end = match_omnibox_width ? end_margin_ : 0; |
| + |
| + contents_bounds.Inset(contents_start, g_top_shadow.Get().height(), |
| + contents_end, g_bottom_shadow.Get().height()); |
| ui::ClipRecorder clip_recorder(context); |
| clip_recorder.ClipRect(contents_bounds); |