summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-04 01:02:00 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-04 01:02:00 +0000
commitb42a775d173e7e66271d82a5ea00ca8efcf37081 (patch)
tree618bc1a3ebbe2c3f9a70404c2e8fcd2befc9550f /chrome
parentf13b4acdd4699cd35d85dc742dc5719ed7755fc2 (diff)
downloadchromium_src-b42a775d173e7e66271d82a5ea00ca8efcf37081.zip
chromium_src-b42a775d173e7e66271d82a5ea00ca8efcf37081.tar.gz
chromium_src-b42a775d173e7e66271d82a5ea00ca8efcf37081.tar.bz2
Improved OTR avatar and popup window rendering. Neither one precisely matches the old code but IMO each looks better.
Once again, the aero_glass_non_client_view changes here are hackish, and will get cleaned up later. BUG=5054 Review URL: http://codereview.chromium.org/20011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9116 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup.cc2
-rw-r--r--chrome/browser/views/frame/aero_glass_frame.cc51
-rw-r--r--chrome/browser/views/frame/aero_glass_non_client_view.cc138
-rw-r--r--chrome/browser/views/frame/browser_view.cc4
-rw-r--r--chrome/browser/views/location_bar_view.cc56
-rw-r--r--chrome/browser/views/location_bar_view.h12
-rw-r--r--chrome/browser/views/toolbar_view.cc5
-rw-r--r--chrome/common/gfx/chrome_canvas.cc11
-rw-r--r--chrome/common/gfx/chrome_canvas.h2
9 files changed, 132 insertions, 149 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_popup.cc b/chrome/browser/autocomplete/autocomplete_popup.cc
index c8c3f79..773f7f0 100644
--- a/chrome/browser/autocomplete/autocomplete_popup.cc
+++ b/chrome/browser/autocomplete/autocomplete_popup.cc
@@ -122,7 +122,7 @@ void AutocompletePopupView::UpdatePopupAppearance() {
// TODO(pkasting): http://b/972786 This shouldn't be hardcoded to rely on
// LocationBarView constants. Instead we should just make the edit be "at the
// right coordinates", or something else generic.
- rc.InflateRect(1, -LocationBarView::kTextVertMargin);
+ rc.InflateRect(1, -LocationBarView::kVertMargin);
// Now rc is the exact width we want and is positioned like the edit would
// be, so shift the top and bottom downwards so the new top is where the old
// bottom is and the rect has the height we need for all our entries, plus a
diff --git a/chrome/browser/views/frame/aero_glass_frame.cc b/chrome/browser/views/frame/aero_glass_frame.cc
index ccf11a0..d78f12c 100644
--- a/chrome/browser/views/frame/aero_glass_frame.cc
+++ b/chrome/browser/views/frame/aero_glass_frame.cc
@@ -143,33 +143,23 @@ LRESULT AeroGlassFrame::OnNCActivate(BOOL active) {
LRESULT AeroGlassFrame::OnNCCalcSize(BOOL mode, LPARAM l_param) {
// By default the client side is set to the window size which is what
// we want.
- if (browser_view_->IsToolbarVisible() && mode == TRUE) {
- // To be on the safe side and avoid side-effects, we only adjust the client
- // size to non-standard values when we must - i.e. when we're showing a
- // TabStrip.
- if (browser_view_->IsTabStripVisible()) {
- // Calculate new NCCALCSIZE_PARAMS based on custom NCA inset.
- NCCALCSIZE_PARAMS* params = reinterpret_cast<NCCALCSIZE_PARAMS*>(l_param);
-
- // Hack necessary to stop black background flicker, we cut out
- // resizeborder here to save us from having to do too much
- // addition and subtraction in Layout(). We don't cut off the
- // top + titlebar as that prevents the window controls from
- // highlighting.
- params->rgrc[0].left +=
- (kResizeBorder - kWindowHorizontalClientEdgeWidth);
- params->rgrc[0].right -=
- (kResizeBorder - kWindowHorizontalClientEdgeWidth);
- params->rgrc[0].bottom -=
- (kResizeBorder - kWindowBottomClientEdgeHeight);
-
- SetMsgHandled(TRUE);
- } else {
- // We don't adjust the client size for detached popups, so we need to
- // tell Windows we didn't handle the message here so that it doesn't
- // screw up the non-client area.
- SetMsgHandled(FALSE);
- }
+ if (browser_view_->IsTabStripVisible() && mode == TRUE) {
+ // Calculate new NCCALCSIZE_PARAMS based on custom NCA inset.
+ NCCALCSIZE_PARAMS* params = reinterpret_cast<NCCALCSIZE_PARAMS*>(l_param);
+
+ // Hack necessary to stop black background flicker, we cut out
+ // resizeborder here to save us from having to do too much
+ // addition and subtraction in Layout(). We don't cut off the
+ // top + titlebar as that prevents the window controls from
+ // highlighting.
+ params->rgrc[0].left +=
+ (kResizeBorder - kWindowHorizontalClientEdgeWidth);
+ params->rgrc[0].right -=
+ (kResizeBorder - kWindowHorizontalClientEdgeWidth);
+ params->rgrc[0].bottom -=
+ (kResizeBorder - kWindowBottomClientEdgeHeight);
+
+ SetMsgHandled(TRUE);
// We need to reset the frame, as Vista resets it whenever it changes
// composition modes (and NCCALCSIZE is the closest thing we get to
@@ -206,10 +196,9 @@ void AeroGlassFrame::UpdateDWMFrame() {
if (!client_view())
return;
- // We only adjust the DWM's glass rendering when we're a browser window or a
- // detached popup. App windows get the standard client edge.
- if (browser_view_->IsTabStripVisible() ||
- browser_view_->IsToolbarVisible()) {
+ // We only adjust the DWM's glass rendering when we're a browser window.
+ // Popups and app windows get the standard client edge.
+ if (browser_view_->IsTabStripVisible()) {
// By default, we just want to adjust the glass by the width of the inner
// bevel that aero renders to demarcate the client area. We supply our own
// client edge for the browser window and detached popups, so we don't want
diff --git a/chrome/browser/views/frame/aero_glass_non_client_view.cc b/chrome/browser/views/frame/aero_glass_non_client_view.cc
index 1cbea04..6f1098b 100644
--- a/chrome/browser/views/frame/aero_glass_non_client_view.cc
+++ b/chrome/browser/views/frame/aero_glass_non_client_view.cc
@@ -113,17 +113,16 @@ static const int kPixel = 1;
static const int kWindowSizingBorderSize = 8;
// The size (width/height) of the window icon.
static const int kWindowIconSize = 16;
-// The distance from the left of the window of the OTR avatar icon.
-static const int kOTRAvatarIconMargin = 9;
-// The distance from the right edge of the OTR avatar icon to the left edge of
-// the TabStrip.
-static const int kOTRAvatarIconTabStripSpacing = 6;
-// The distance from the top of the window of the OTR avatar icon when the
-// window is maximized.
-static const int kNoTitleOTRTopSpacing = 23;
-// The distance from the top of the window of the OTR avatar icon when the
-// window is maximized.
-static const int kNoTitleOTRZoomedTopSpacing = 3;
+// In maximized mode, the OTR avatar starts 2 px below the top of the screen, so
+// that it doesn't extend into the "3D edge" portion of the titlebar.
+const int kOTRMaximizedTopSpacing = 2;
+// The OTR avatar ends 2 px above the bottom of the tabstrip (which, given the
+// way the tabstrip draws its bottom edge, will appear like a 1 px gap to the
+// user).
+const int kOTRBottomSpacing = 2;
+// There are 2 px on each side of the OTR avatar (between the frame border and
+// it on the left, and between it and the tabstrip on the right).
+const int kOTRSideSpacing = 2;
///////////////////////////////////////////////////////////////////////////////
// AeroGlassNonClientView, public:
@@ -140,7 +139,7 @@ AeroGlassNonClientView::~AeroGlassNonClientView() {
gfx::Rect AeroGlassNonClientView::GetBoundsForTabStrip(TabStrip* tabstrip) {
int tabstrip_x = browser_view_->ShouldShowOffTheRecordAvatar() ?
- (otr_avatar_bounds_.right() + kOTRAvatarIconTabStripSpacing) :
+ (otr_avatar_bounds_.right() + kOTRSideSpacing) :
kWindowHorizontalClientEdgeWidth;
int tabstrip_width = width() - tabstrip_x - kTabStripRightHorizOffset -
(frame_->IsMaximized() ? frame_->GetMinimizeButtonOffset() : 0);
@@ -155,10 +154,8 @@ gfx::Rect AeroGlassNonClientView::GetBoundsForTabStrip(TabStrip* tabstrip) {
gfx::Rect AeroGlassNonClientView::CalculateClientAreaBounds(int win_width,
int win_height) const {
- if (!browser_view_->IsToolbarVisible()) {
- // App windows don't have a toolbar.
+ if (!browser_view_->IsTabStripVisible())
return gfx::Rect(0, 0, width(), height());
- }
int top_margin = CalculateNonClientTopHeight();
return gfx::Rect(kWindowHorizontalClientEdgeWidth, top_margin,
@@ -190,9 +187,9 @@ int AeroGlassNonClientView::NonClientHitTest(const gfx::Point& point) {
if (component != HTNOWHERE)
return component;
- // This check is only done when we have a toolbar, which is the only time
+ // This check is only done when we have a tabstrip, which is the only time
// that we have a non-standard non-client area.
- if (browser_view_->IsToolbarVisible()) {
+ if (browser_view_->IsTabStripVisible()) {
// Because we tell Windows that our client area extends all the way to the
// top of the browser window, but our BrowserView doesn't actually go up that
// high, we need to make sure the right hit-test codes are returned for the
@@ -229,12 +226,12 @@ void AeroGlassNonClientView::ResetWindowControls() {
// AeroGlassNonClientView, views::View overrides:
void AeroGlassNonClientView::Paint(ChromeCanvas* canvas) {
- PaintOTRAvatar(canvas);
PaintDistributorLogo(canvas);
- if (browser_view_->IsToolbarVisible()) {
+ if (browser_view_->IsTabStripVisible())
PaintToolbarBackground(canvas);
+ PaintOTRAvatar(canvas);
+ if (browser_view_->IsTabStripVisible())
PaintClientEdge(canvas);
- }
}
void AeroGlassNonClientView::Layout() {
@@ -271,11 +268,15 @@ int AeroGlassNonClientView::CalculateNonClientTopHeight() const {
}
void AeroGlassNonClientView::PaintOTRAvatar(ChromeCanvas* canvas) {
- if (browser_view_->ShouldShowOffTheRecordAvatar()) {
- int icon_x = MirroredLeftPointForRect(otr_avatar_bounds_);
- canvas->DrawBitmapInt(browser_view_->GetOTRAvatarIcon(), icon_x,
- otr_avatar_bounds_.y());
- }
+ if (!browser_view_->ShouldShowOffTheRecordAvatar())
+ return;
+
+ SkBitmap otr_avatar_icon = browser_view_->GetOTRAvatarIcon();
+ canvas->DrawBitmapInt(otr_avatar_icon, 0,
+ (otr_avatar_icon.height() - otr_avatar_bounds_.height()) / 2,
+ otr_avatar_bounds_.width(), otr_avatar_bounds_.height(),
+ MirroredLeftPointForRect(otr_avatar_bounds_), otr_avatar_bounds_.y(),
+ otr_avatar_bounds_.width(), otr_avatar_bounds_.height(), false);
}
void AeroGlassNonClientView::PaintDistributorLogo(ChromeCanvas* canvas) {
@@ -289,43 +290,31 @@ void AeroGlassNonClientView::PaintDistributorLogo(ChromeCanvas* canvas) {
}
void AeroGlassNonClientView::PaintToolbarBackground(ChromeCanvas* canvas) {
- if (browser_view_->IsToolbarVisible() ||
- browser_view_->IsTabStripVisible()) {
- SkBitmap* toolbar_left =
- resources_->GetPartBitmap(FRAME_CLIENT_EDGE_TOP_LEFT);
- SkBitmap* toolbar_center =
- resources_->GetPartBitmap(FRAME_CLIENT_EDGE_TOP);
- SkBitmap* toolbar_right =
- resources_->GetPartBitmap(FRAME_CLIENT_EDGE_TOP_RIGHT);
-
- gfx::Rect toolbar_bounds = browser_view_->GetToolbarBounds();
- gfx::Point topleft(toolbar_bounds.x(), toolbar_bounds.y());
- View::ConvertPointToView(frame_->client_view(), this, &topleft);
- toolbar_bounds.set_x(topleft.x());
- toolbar_bounds.set_y(topleft.y());
-
- // We use TileImageInt for the left and right caps to clip the rendering
- // to the appropriate height of the toolbar.
- canvas->TileImageInt(*toolbar_left,
- toolbar_bounds.x() - toolbar_left->width(),
- toolbar_bounds.y(), toolbar_left->width(),
- toolbar_bounds.height());
- canvas->TileImageInt(*toolbar_center,
- toolbar_bounds.x(), toolbar_bounds.y(),
- toolbar_bounds.width(), toolbar_center->height());
- canvas->TileImageInt(*toolbar_right, toolbar_bounds.right(),
- toolbar_bounds.y(), toolbar_right->width(),
- toolbar_bounds.height());
-
- if (frame_->window_delegate()->ShouldShowWindowTitle()) {
- // Since we're showing the toolbar or the tabstrip, we need to draw a
- // single pixel grey line along underneath them to terminate them
- // cleanly.
- canvas->FillRectInt(SkColorSetRGB(180, 188, 199), toolbar_bounds.x(),
- toolbar_bounds.bottom() - 1, toolbar_bounds.width(),
- 1);
- }
- }
+ SkBitmap* toolbar_left =
+ resources_->GetPartBitmap(FRAME_CLIENT_EDGE_TOP_LEFT);
+ SkBitmap* toolbar_center =
+ resources_->GetPartBitmap(FRAME_CLIENT_EDGE_TOP);
+ SkBitmap* toolbar_right =
+ resources_->GetPartBitmap(FRAME_CLIENT_EDGE_TOP_RIGHT);
+
+ gfx::Rect toolbar_bounds = browser_view_->GetToolbarBounds();
+ gfx::Point topleft(toolbar_bounds.x(), toolbar_bounds.y());
+ View::ConvertPointToView(frame_->client_view(), this, &topleft);
+ toolbar_bounds.set_x(topleft.x());
+ toolbar_bounds.set_y(topleft.y());
+
+ // We use TileImageInt for the left and right caps to clip the rendering
+ // to the appropriate height of the toolbar.
+ canvas->TileImageInt(*toolbar_left,
+ toolbar_bounds.x() - toolbar_left->width(),
+ toolbar_bounds.y(), toolbar_left->width(),
+ toolbar_bounds.height());
+ canvas->TileImageInt(*toolbar_center,
+ toolbar_bounds.x(), toolbar_bounds.y(),
+ toolbar_bounds.width(), toolbar_center->height());
+ canvas->TileImageInt(*toolbar_right, toolbar_bounds.right(),
+ toolbar_bounds.y(), toolbar_right->width(),
+ toolbar_bounds.height());
}
void AeroGlassNonClientView::PaintClientEdge(ChromeCanvas* canvas) {
@@ -377,20 +366,17 @@ void AeroGlassNonClientView::PaintClientEdge(ChromeCanvas* canvas) {
}
void AeroGlassNonClientView::LayoutOTRAvatar() {
- int otr_x = 0;
- int top_spacing = frame_->IsMaximized() ? kNoTitleOTRZoomedTopSpacing
- : kNoTitleOTRTopSpacing;
- int otr_y = browser_view_->GetTabStripHeight() + top_spacing;
- int otr_width = 0;
- int otr_height = 0;
- if (browser_view_->ShouldShowOffTheRecordAvatar()) {
- SkBitmap otr_avatar_icon = browser_view_->GetOTRAvatarIcon();
- otr_width = otr_avatar_icon.width();
- otr_height = otr_avatar_icon.height();
- otr_x = kOTRAvatarIconMargin;
- otr_y -= otr_avatar_icon.height() + 2;
- }
- otr_avatar_bounds_.SetRect(otr_x, otr_y, otr_width, otr_height);
+ SkBitmap otr_avatar_icon = browser_view_->GetOTRAvatarIcon();
+ int top_height = (frame_->IsMaximized() ?
+ (CalculateNonClientTopHeight() - 2) : kTabStripY);
+ int tabstrip_height = browser_view_->GetTabStripHeight() - kOTRBottomSpacing;
+ int otr_height = frame_->IsMaximized() ?
+ (tabstrip_height - kOTRMaximizedTopSpacing) :
+ otr_avatar_icon.height();
+ otr_avatar_bounds_.SetRect(
+ kWindowHorizontalClientEdgeWidth + kOTRSideSpacing,
+ top_height + tabstrip_height - otr_height, otr_avatar_icon.width(),
+ otr_height);
}
void AeroGlassNonClientView::LayoutDistributorLogo() {
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index a6ab4cf..e57b2cc 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -1094,10 +1094,6 @@ int BrowserView::LayoutToolbar(int top) {
gfx::Size ps = toolbar_->GetPreferredSize();
int toolbar_y =
top - (IsTabStripVisible() ? kToolbarTabStripVerticalOverlap : 0);
- // With detached popup windows with the aero glass frame, we need to offset
- // by a pixel to make things look good.
- if (!IsTabStripVisible() && win_util::ShouldUseVistaFrame())
- ps.Enlarge(0, -1);
int browser_view_width = width();
#ifdef CHROME_PERSONALIZATION
if (IsPersonalizationEnabled())
diff --git a/chrome/browser/views/location_bar_view.cc b/chrome/browser/views/location_bar_view.cc
index ae32080..ad6b15a 100644
--- a/chrome/browser/views/location_bar_view.cc
+++ b/chrome/browser/views/location_bar_view.cc
@@ -33,7 +33,7 @@
using views::View;
-const int LocationBarView::kTextVertMargin = 2;
+const int LocationBarView::kVertMargin = 2;
const COLORREF LocationBarView::kBackgroundColorByLevel[] = {
RGB(255, 245, 195), // SecurityLevel SECURE: Yellow.
@@ -41,10 +41,6 @@ const COLORREF LocationBarView::kBackgroundColorByLevel[] = {
RGB(255, 255, 255), // SecurityLevel INSECURE: White.
};
-// The margins around the solid color we draw.
-static const int kBackgroundVertMargin = 2;
-static const int kBackgroundHoriMargin = 0;
-
// Padding on the right and left of the entry field.
static const int kEntryPadding = 3;
@@ -54,7 +50,6 @@ static const int kInnerPadding = 3;
static const SkBitmap* kBackground = NULL;
static const SkBitmap* kPopupBackground = NULL;
-static const int kPopupBackgroundVertMargin = 2;
// The delay the mouse has to be hovering over the lock/warning icon before the
// info bubble is shown.
@@ -198,8 +193,8 @@ void LocationBarView::SetProfile(Profile* profile) {
gfx::Size LocationBarView::GetPreferredSize() {
return gfx::Size(0,
- std::max((popup_window_mode_ ? kPopupBackground : kBackground)->height(),
- security_image_view_.GetPreferredSize().height()));
+ (popup_window_mode_ ? kPopupBackground : kBackground)->height() -
+ TopOffset());
}
void LocationBarView::Layout() {
@@ -214,19 +209,13 @@ void LocationBarView::Paint(ChromeCanvas* canvas) {
GetGValue(kBackgroundColorByLevel[model_->GetSchemeSecurityLevel()]),
GetBValue(kBackgroundColorByLevel[model_->GetSchemeSecurityLevel()]));
- 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);
- }
+ const SkBitmap* background =
+ popup_window_mode_ ? kPopupBackground : kBackground;
+ int top_offset = TopOffset();
+ canvas->TileImageInt(*background, 0, top_offset, 0, 0, width(), height());
+ int top_margin = TopMargin();
+ canvas->FillRectInt(bg, 0, top_margin, width(),
+ height() - top_margin - kVertMargin);
}
bool LocationBarView::CanProcessTabKeyEvents() {
@@ -340,7 +329,7 @@ void LocationBarView::DoLayout(const bool force_layout) {
RECT edit_bounds;
location_entry_->GetClientRect(&edit_bounds);
- int entry_width = width() - kEntryPadding - kEntryPadding;
+ int entry_width = width() - (kEntryPadding * 2);
gfx::Size security_image_size;
if (security_image_view_.IsVisible()) {
security_image_size = security_image_view_.GetPreferredSize();
@@ -364,11 +353,8 @@ void LocationBarView::DoLayout(const bool force_layout) {
return;
// TODO(sky): baseline layout.
- 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);
+ int location_y = TopMargin();
+ int location_height = height() - location_y - kVertMargin;
if (info_label_.IsVisible()) {
info_label_.SetBounds(width() - kEntryPadding - info_label_size.width(),
location_y,
@@ -377,11 +363,9 @@ void LocationBarView::DoLayout(const bool force_layout) {
if (security_image_view_.IsVisible()) {
const int info_label_width = info_label_size.width() ?
info_label_size.width() + kInnerPadding : 0;
- security_image_view_.SetBounds(width() - kEntryPadding -
- info_label_width -
- security_image_size.width(),
- location_y,
- security_image_size.width(), location_height);
+ security_image_view_.SetBounds(width() - kEntryPadding - info_label_width -
+ security_image_size.width(), location_y, security_image_size.width(),
+ location_height);
}
gfx::Rect location_bounds(kEntryPadding, location_y, entry_width,
location_height);
@@ -407,6 +391,14 @@ void LocationBarView::DoLayout(const bool force_layout) {
}
}
+int LocationBarView::TopOffset() const {
+ return (popup_window_mode_ && win_util::ShouldUseVistaFrame()) ? 1 : 0;
+}
+
+int LocationBarView::TopMargin() const {
+ return kVertMargin - TopOffset();
+}
+
int LocationBarView::TextDisplayWidth() {
POINT last_char_position =
location_entry_->PosFromChar(location_entry_->GetTextLength());
diff --git a/chrome/browser/views/location_bar_view.h b/chrome/browser/views/location_bar_view.h
index ec01c63..0764bd9 100644
--- a/chrome/browser/views/location_bar_view.h
+++ b/chrome/browser/views/location_bar_view.h
@@ -121,7 +121,7 @@ class LocationBarView : public LocationBar,
virtual void FocusSearch();
virtual void SaveStateToContents(TabContents* contents);
- static const int kTextVertMargin;
+ static const int kVertMargin;
static const COLORREF kBackgroundColorByLevel[];
protected:
@@ -283,6 +283,16 @@ class LocationBarView : public LocationBar,
// to necessitate a layout, layout occurs as well.
void DoLayout(bool force_layout);
+ // Returns the number of pixels to clip off the top edge of the background
+ // graphics. With the Vista frame, the DWM draws a dark border around the
+ // content, so we clip the single dark pixel on the popup background image,
+ // which otherwise looks redundant.
+ int TopOffset() const;
+
+ // Returns the height in pixels of the margin at the top of the bar, after
+ // TopOffset() pixels have been clipped off.
+ int TopMargin() const;
+
// Returns the width in pixels of the contents of the edit.
int TextDisplayWidth();
diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc
index 8ceb421..42dffa7 100644
--- a/chrome/browser/views/toolbar_view.cc
+++ b/chrome/browser/views/toolbar_view.cc
@@ -35,6 +35,7 @@
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/common/resource_bundle.h"
+#include "chrome/common/win_util.h"
#include "chrome/views/background.h"
#include "chrome/views/button_dropdown.h"
#include "chrome/views/hwnd_view.h"
@@ -479,13 +480,15 @@ gfx::Size BrowserToolbarView::GetPreferredSize() {
return gfx::Size(0, normal_background.height());
}
+ // With the non-Vista frame, we'll draw a client edge below the toolbar for
+ // non-maximized popups.
// Note: We make sure to return the same value in the "no browser window" case
// as the "not maximized" case, so that when a popup is opened at a particular
// requested size, we'll report the same preferred size during the initial
// window size calculation (when there isn't yet a browser window) as when
// we're actually laying things out after setting up the browser window. This
// prevents the content area from being off by |kClientEdgeThickness| px.
- int client_edge_height =
+ int client_edge_height = win_util::ShouldUseVistaFrame() ||
(browser_->window() && browser_->window()->IsMaximized()) ?
0 : views::NonClientView::kClientEdgeThickness;
return gfx::Size(0,
diff --git a/chrome/common/gfx/chrome_canvas.cc b/chrome/common/gfx/chrome_canvas.cc
index 673b73b..f439680 100644
--- a/chrome/common/gfx/chrome_canvas.cc
+++ b/chrome/common/gfx/chrome_canvas.cc
@@ -208,7 +208,12 @@ void ChromeCanvas::DrawBitmapInt(const SkBitmap& bitmap, int src_x, int src_y,
void ChromeCanvas::TileImageInt(const SkBitmap& bitmap,
int x, int y, int w, int h) {
- if (!IntersectsClipRectInt(x, y, w, h))
+ TileImageInt(bitmap, 0, 0, x, y, w, h);
+}
+
+void ChromeCanvas::TileImageInt(const SkBitmap& bitmap, int src_x, int src_y,
+ int dest_x, int dest_y, int w, int h) {
+ if (!IntersectsClipRectInt(dest_x, dest_y, w, h))
return;
SkPaint paint;
@@ -223,8 +228,8 @@ void ChromeCanvas::TileImageInt(const SkBitmap& bitmap,
// need to unref after paint takes ownership of the shader.
shader->unref();
save();
- translate(SkIntToScalar(x), SkIntToScalar(y));
- ClipRectInt(0, 0, w, h);
+ translate(SkIntToScalar(dest_x - src_x), SkIntToScalar(dest_y - src_y));
+ ClipRectInt(src_x, src_y, w, h);
drawPaint(paint);
restore();
}
diff --git a/chrome/common/gfx/chrome_canvas.h b/chrome/common/gfx/chrome_canvas.h
index 6465298..a78d85c 100644
--- a/chrome/common/gfx/chrome_canvas.h
+++ b/chrome/common/gfx/chrome_canvas.h
@@ -152,6 +152,8 @@ class ChromeCanvas : public skia::PlatformCanvas {
// Tiles the image in the specified region.
void TileImageInt(const SkBitmap& bitmap, int x, int y, int w, int h);
+ void TileImageInt(const SkBitmap& bitmap, int src_x, int src_y,
+ int dest_x, int dest_y, int w, int h);
// Extracts a bitmap from the contents of this canvas.
SkBitmap ExtractBitmap();