Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Unified Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 2673503002: Slightly simplify location bar bg/border painting. (Closed)
Patch Set: pkasting review Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/location_bar/location_bar_view.cc
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index 6fa564c80ed6cf52220c34dac82c0389ce3cc1ed..a74b167806b21d9be863b7bca661dcdd84f35088 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -105,7 +105,7 @@ using views::View;
namespace {
-// The border color for MD windows, as well as non-MD popup windows.
+// The border color, drawn on top of the toolbar.
const SkColor kBorderColor = SkColorSetA(SK_ColorBLACK, 0x4D);
} // namespace
@@ -162,12 +162,10 @@ LocationBarView::~LocationBarView() {
// LocationBarView, public:
// static
-SkColor LocationBarView::GetBorderColor(bool incognito) {
- return color_utils::AlphaBlend(
- SkColorSetA(kBorderColor, SK_AlphaOPAQUE),
- ThemeProperties::GetDefaultColor(ThemeProperties::COLOR_TOOLBAR,
- incognito),
- SkColorGetA(kBorderColor));
+SkColor LocationBarView::GetOpaqueBorderColor(bool incognito) {
+ return color_utils::GetResultingPaintColor(
+ kBorderColor, ThemeProperties::GetDefaultColor(
+ ThemeProperties::COLOR_TOOLBAR, incognito));
}
void LocationBarView::Init() {
@@ -640,11 +638,16 @@ void LocationBarView::Layout() {
void LocationBarView::OnNativeThemeChanged(const ui::NativeTheme* theme) {
RefreshLocationIcon();
- if (!is_popup_mode_) {
+ if (is_popup_mode_) {
+ set_background(
+ views::Background::CreateSolidBackground(GetColor(BACKGROUND)));
+ } else {
+ // This border color will be blended on top of the toolbar (which may use an
+ // image in the case of themes).
set_background(
new BackgroundWith1PxBorder(GetColor(BACKGROUND), kBorderColor));
- SchedulePaint();
}
+ SchedulePaint();
}
void LocationBarView::Update(const WebContents* contents) {
@@ -1148,20 +1151,15 @@ void LocationBarView::OnPaint(gfx::Canvas* canvas) {
canvas->DrawRoundRect(focus_rect,
BackgroundWith1PxBorder::kCornerRadius + 0.5f, paint);
}
+}
+
+void LocationBarView::OnPaintBorder(gfx::Canvas* canvas) {
if (!is_popup_mode_)
- return; // The background and border are painted by our Background.
+ return; // The border is painted by our Background.
- // Fill the location bar background color behind the border. Parts of the
- // border images are meant to rest atop the toolbar background and parts atop
- // the omnibox background, so we can't just blindly fill our entire bounds.
gfx::Rect bounds(GetContentsBounds());
- bounds.Inset(GetHorizontalEdgeThickness(),
- is_popup_mode_
- ? 0
- : BackgroundWith1PxBorder::kLocationBarBorderThicknessDip);
- SkColor background_color(GetColor(BACKGROUND));
- canvas->FillRect(bounds, background_color);
- const SkColor border_color = GetBorderColor(profile()->IsOffTheRecord());
+ const SkColor border_color =
+ GetOpaqueBorderColor(profile()->IsOffTheRecord());
BrowserView::Paint1pxHorizontalLine(canvas, border_color, bounds, false);
BrowserView::Paint1pxHorizontalLine(canvas, border_color, bounds, true);
}
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698