diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-27 22:26:11 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-27 22:26:11 +0000 |
commit | b06878082f5dd7a9e289c0363e2aa9331a154fdb (patch) | |
tree | c5d46a1c7737577cf39efb570d3bf164b6771b93 /chrome/browser/views | |
parent | fc14cef961fa421cc1c44e373e3f3f0fb84ec545 (diff) | |
download | chromium_src-b06878082f5dd7a9e289c0363e2aa9331a154fdb.zip chromium_src-b06878082f5dd7a9e289c0363e2aa9331a154fdb.tar.gz chromium_src-b06878082f5dd7a9e289c0363e2aa9331a154fdb.tar.bz2 |
Extend the popup-mode location bar out into the nonclient view. This makes popup mode pixel perfect except for the off-by-one sizing regression caught by the interactive UI test, which I haven't figured out yet.
BUG=5054
Review URL: http://codereview.chromium.org/18862
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8763 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r-- | chrome/browser/views/frame/opaque_non_client_view.cc | 32 | ||||
-rw-r--r-- | chrome/browser/views/location_bar_view.cc | 54 |
2 files changed, 34 insertions, 52 deletions
diff --git a/chrome/browser/views/frame/opaque_non_client_view.cc b/chrome/browser/views/frame/opaque_non_client_view.cc index a59cd10..7272303 100644 --- a/chrome/browser/views/frame/opaque_non_client_view.cc +++ b/chrome/browser/views/frame/opaque_non_client_view.cc @@ -63,6 +63,10 @@ enum { FRAME_CLIENT_EDGE_BOTTOM_LEFT, FRAME_CLIENT_EDGE_LEFT, + // Popup-mode toolbar edges. + FRAME_TOOLBAR_POPUP_EDGE_LEFT, + FRAME_TOOLBAR_POPUP_EDGE_RIGHT, + FRAME_PART_BITMAP_COUNT // Must be last. }; @@ -98,6 +102,7 @@ class ActiveWindowResources : public views::WindowResources { IDR_CONTENT_TOP_RIGHT_CORNER, IDR_CONTENT_RIGHT_SIDE, IDR_CONTENT_BOTTOM_RIGHT_CORNER, IDR_CONTENT_BOTTOM_CENTER, IDR_CONTENT_BOTTOM_LEFT_CORNER, IDR_CONTENT_LEFT_SIDE, + IDR_LOCATIONBG_POPUPMODE_LEFT, IDR_LOCATIONBG_POPUPMODE_RIGHT, 0 }; @@ -149,6 +154,7 @@ class InactiveWindowResources : public views::WindowResources { IDR_CONTENT_TOP_RIGHT_CORNER, IDR_CONTENT_RIGHT_SIDE, IDR_CONTENT_BOTTOM_RIGHT_CORNER, IDR_CONTENT_BOTTOM_CENTER, IDR_CONTENT_BOTTOM_LEFT_CORNER, IDR_CONTENT_LEFT_SIDE, + IDR_LOCATIONBG_POPUPMODE_LEFT, IDR_LOCATIONBG_POPUPMODE_RIGHT, 0 }; @@ -200,6 +206,7 @@ class OTRActiveWindowResources : public views::WindowResources { IDR_CONTENT_TOP_RIGHT_CORNER, IDR_CONTENT_RIGHT_SIDE, IDR_CONTENT_BOTTOM_RIGHT_CORNER, IDR_CONTENT_BOTTOM_CENTER, IDR_CONTENT_BOTTOM_LEFT_CORNER, IDR_CONTENT_LEFT_SIDE, + IDR_LOCATIONBG_POPUPMODE_LEFT, IDR_LOCATIONBG_POPUPMODE_RIGHT, 0 }; @@ -251,6 +258,7 @@ class OTRInactiveWindowResources : public views::WindowResources { IDR_CONTENT_TOP_RIGHT_CORNER, IDR_CONTENT_RIGHT_SIDE, IDR_CONTENT_BOTTOM_RIGHT_CORNER, IDR_CONTENT_BOTTOM_CENTER, IDR_CONTENT_BOTTOM_LEFT_CORNER, IDR_CONTENT_LEFT_SIDE, + IDR_LOCATIONBG_POPUPMODE_LEFT, IDR_LOCATIONBG_POPUPMODE_RIGHT, 0 }; @@ -861,28 +869,30 @@ void OpaqueNonClientView::PaintTitleBar(ChromeCanvas* canvas) { } void OpaqueNonClientView::PaintToolbarBackground(ChromeCanvas* canvas) { - if (!browser_view_->IsToolbarVisible() || - !browser_view_->IsToolbarDisplayModeNormal()) + if (!browser_view_->IsToolbarVisible()) return; - + gfx::Rect toolbar_bounds(browser_view_->GetToolbarBounds()); gfx::Point toolbar_origin(toolbar_bounds.origin()); View::ConvertPointToView(frame_->client_view(), this, &toolbar_origin); toolbar_bounds.set_origin(toolbar_origin); - SkBitmap* toolbar_left = - resources()->GetPartBitmap(FRAME_CLIENT_EDGE_TOP_LEFT); + bool normal_mode = browser_view_->IsToolbarDisplayModeNormal(); + SkBitmap* toolbar_left = resources()->GetPartBitmap(normal_mode ? + FRAME_CLIENT_EDGE_TOP_LEFT : FRAME_TOOLBAR_POPUP_EDGE_LEFT); canvas->DrawBitmapInt(*toolbar_left, toolbar_bounds.x() - toolbar_left->width(), toolbar_bounds.y()); - SkBitmap* toolbar_center = - resources()->GetPartBitmap(FRAME_CLIENT_EDGE_TOP); - canvas->TileImageInt(*toolbar_center, toolbar_bounds.x(), toolbar_bounds.y(), - toolbar_bounds.width(), toolbar_center->height()); + if (normal_mode) { + SkBitmap* toolbar_center = + resources()->GetPartBitmap(FRAME_CLIENT_EDGE_TOP); + canvas->TileImageInt(*toolbar_center, toolbar_bounds.x(), + toolbar_bounds.y(), toolbar_bounds.width(), toolbar_center->height()); + } - canvas->DrawBitmapInt( - *resources()->GetPartBitmap(FRAME_CLIENT_EDGE_TOP_RIGHT), + canvas->DrawBitmapInt(*resources()->GetPartBitmap(normal_mode ? + FRAME_CLIENT_EDGE_TOP_RIGHT : FRAME_TOOLBAR_POPUP_EDGE_RIGHT), toolbar_bounds.right(), toolbar_bounds.y()); } diff --git a/chrome/browser/views/location_bar_view.cc b/chrome/browser/views/location_bar_view.cc index 0ee51ea..ae32080 100644 --- a/chrome/browser/views/location_bar_view.cc +++ b/chrome/browser/views/location_bar_view.cc @@ -53,11 +53,8 @@ static const int kInnerPadding = 3; static const SkBitmap* kBackground = NULL; -static const SkBitmap* kPopupBackgroundLeft = NULL; -static const SkBitmap* kPopupBackgroundCenter = NULL; -static const SkBitmap* kPopupBackgroundRight = NULL; +static const SkBitmap* kPopupBackground = NULL; static const int kPopupBackgroundVertMargin = 2; -static const int kPopupBackgroundHorzMargin = 2; // The delay the mouse has to be hovering over the lock/warning icon before the // info bubble is shown. @@ -101,12 +98,7 @@ LocationBarView::LocationBarView(Profile* profile, if (!kBackground) { ResourceBundle &rb = ResourceBundle::GetSharedInstance(); kBackground = rb.GetBitmapNamed(IDR_LOCATIONBG); - kPopupBackgroundLeft = - rb.GetBitmapNamed(IDR_LOCATIONBG_POPUPMODE_LEFT); - kPopupBackgroundCenter = - rb.GetBitmapNamed(IDR_LOCATIONBG_POPUPMODE_CENTER); - kPopupBackgroundRight = - rb.GetBitmapNamed(IDR_LOCATIONBG_POPUPMODE_RIGHT); + kPopupBackground = rb.GetBitmapNamed(IDR_LOCATIONBG_POPUPMODE_CENTER); } } @@ -205,12 +197,9 @@ void LocationBarView::SetProfile(Profile* profile) { } gfx::Size LocationBarView::GetPreferredSize() { - return gfx::Size( - 0, - std::max( - (popup_window_mode_ ? kPopupBackgroundCenter - : kBackground)->height(), - security_image_view_.GetPreferredSize().width())); + return gfx::Size(0, + std::max((popup_window_mode_ ? kPopupBackground : kBackground)->height(), + security_image_view_.GetPreferredSize().height())); } void LocationBarView::Layout() { @@ -225,35 +214,18 @@ void LocationBarView::Paint(ChromeCanvas* canvas) { GetGValue(kBackgroundColorByLevel[model_->GetSchemeSecurityLevel()]), GetBValue(kBackgroundColorByLevel[model_->GetSchemeSecurityLevel()])); - if (popup_window_mode_ == false) { + if (popup_window_mode_) { + canvas->TileImageInt(*kPopupBackground, 0, 0, width(), + kPopupBackground->height()); + canvas->FillRectInt(bg, 0, kPopupBackgroundVertMargin, width(), + kPopupBackground->height() - (kPopupBackgroundVertMargin * 2)); + } else { int bh = kBackground->height(); - canvas->TileImageInt(*kBackground, 0, (height() - bh) / 2, width(), bh); - canvas->FillRectInt(bg, kBackgroundHoriMargin, kBackgroundVertMargin, width() - 2 * kBackgroundHoriMargin, bh - kBackgroundVertMargin * 2); - } else { - canvas->TileImageInt(*kPopupBackgroundLeft, 0, 0, - kPopupBackgroundLeft->width(), - kPopupBackgroundLeft->height()); - canvas->TileImageInt(*kPopupBackgroundCenter, - kPopupBackgroundLeft->width(), 0, - width() - - kPopupBackgroundLeft->width() - - kPopupBackgroundRight->width(), - kPopupBackgroundCenter->height()); - canvas->TileImageInt(*kPopupBackgroundRight, - width() - kPopupBackgroundRight->width(), - 0, kPopupBackgroundRight->width(), - kPopupBackgroundRight->height()); - - canvas->FillRectInt(bg, kPopupBackgroundHorzMargin, - kPopupBackgroundVertMargin, - width() - kPopupBackgroundHorzMargin * 2, - kPopupBackgroundCenter->height() - - kPopupBackgroundVertMargin * 2); } } @@ -392,8 +364,8 @@ void LocationBarView::DoLayout(const bool force_layout) { return; // TODO(sky): baseline layout. - const SkBitmap* background = popup_window_mode_ ? kPopupBackgroundCenter - : kBackground; + const SkBitmap* background = + popup_window_mode_ ? kPopupBackground : kBackground; int bh = background->height(); int location_y = ((height() - bh) / 2) + kTextVertMargin; int location_height = bh - (2 * kTextVertMargin); |