diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-26 20:28:25 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-26 20:28:25 +0000 |
commit | b4f5916b698aa02705fe45e5cdf27ed04bc2b325 (patch) | |
tree | 758787f379735e38b77ad4b83b69822b7da14ebb /chrome | |
parent | f0c33d8b99d25a575e025db8ffe69d58187b9566 (diff) | |
download | chromium_src-b4f5916b698aa02705fe45e5cdf27ed04bc2b325.zip chromium_src-b4f5916b698aa02705fe45e5cdf27ed04bc2b325.tar.gz chromium_src-b4f5916b698aa02705fe45e5cdf27ed04bc2b325.tar.bz2 |
This change should have few user-visible effects. I think I slightly modified the window layout (by a pixel or so) in the popup window case, which I haven't tried to make pixel-perfect yet anyway. Otherwise it's all reorg.
Clean up logic of nonclient view to be more consistent and coherent. Most things are now based on a small set of core functions that return various frame/nonclient thicknesses. This allows a noticeable reduction in the number of hardcoded constants, makes the code make more sense (even though a few places are longer than before), and makes it much easier to do things in the future like resizing various borders or handling system metrics better.
Rename and update comments for all constants to be more descriptive and less redundant.
Rename helper functions and variables for consistency, now that they've changed.
Remove an unused variant of TileImageInt(). Add a new one that takes an offset into the source image. This is used to rewrite the maximized bottom border tiling call in a way that doesn't rely on someone else clipping out or painting over the overdraw from tiling "too large" a source image. Probably no visible effect.
Make resize border hittest helper function able to handle borders of varying widths, and try to make parameter names more meaningful. Technically, we don't need the extra flexibility, since our bottom and side borders are the same thickness, but since there are different functions calculating that thickness on the caller side, it didn't hurt to not rely on that for the future.
BUG=5054
Review URL: http://codereview.chromium.org/18804
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8658 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/views/constrained_window_impl.cc | 7 | ||||
-rw-r--r-- | chrome/browser/views/frame/opaque_non_client_view.cc | 520 | ||||
-rw-r--r-- | chrome/browser/views/frame/opaque_non_client_view.h | 56 | ||||
-rw-r--r-- | chrome/common/gfx/chrome_canvas.cc | 21 | ||||
-rw-r--r-- | chrome/common/gfx/chrome_canvas.h | 7 | ||||
-rw-r--r-- | chrome/views/custom_frame_window.cc | 8 | ||||
-rw-r--r-- | chrome/views/non_client_view.cc | 37 | ||||
-rw-r--r-- | chrome/views/non_client_view.h | 7 |
8 files changed, 341 insertions, 322 deletions
diff --git a/chrome/browser/views/constrained_window_impl.cc b/chrome/browser/views/constrained_window_impl.cc index 7f5eafe..e7b4c5e 100644 --- a/chrome/browser/views/constrained_window_impl.cc +++ b/chrome/browser/views/constrained_window_impl.cc @@ -374,10 +374,9 @@ int ConstrainedWindowNonClientView::NonClientHitTest(const gfx::Point& point) { if (icon_bounds_.Contains(point)) return HTSYSMENU; - component = GetHTComponentForFrame(point, kResizeAreaSize, - kResizeAreaCornerSize, - kResizeAreaNorthSize, - window_delegate_->CanResize()); + component = GetHTComponentForFrame(point, kResizeAreaNorthSize, + kResizeAreaSize, kResizeAreaSize, kResizeAreaCornerSize, + window_delegate_->CanResize()); if (component == HTNOWHERE) { // Finally fall back to the caption. if (bounds().Contains(point)) diff --git a/chrome/browser/views/frame/opaque_non_client_view.cc b/chrome/browser/views/frame/opaque_non_client_view.cc index ff02b83..f59b988 100644 --- a/chrome/browser/views/frame/opaque_non_client_view.cc +++ b/chrome/browser/views/frame/opaque_non_client_view.cc @@ -269,6 +269,7 @@ class OTRInactiveWindowResources : public views::WindowResources { DISALLOW_EVIL_CONSTRUCTORS(OTRInactiveWindowResources); }; + // static SkBitmap* ActiveWindowResources::standard_frame_bitmaps_[]; SkBitmap* InactiveWindowResources::standard_frame_bitmaps_[]; @@ -285,106 +286,80 @@ SkBitmap OpaqueNonClientView::app_top_center_; SkBitmap OpaqueNonClientView::app_top_right_; ChromeFont OpaqueNonClientView::title_font_; -// The distance between the top of the window and the top of the window -// controls when the window is restored. -static const int kWindowControlsTopOffset = 1; -// The distance between the right edge of the window and the right edge of the -// right-most window control when the window is restored. -static const int kWindowControlsRightOffset = 4; -// The distance between the bottom of the window's top border and the top of the -// window controls' images when the window is maximized. We extend the -// clickable area all the way to the top of the window to obey Fitts' Law. -static const int kWindowControlsZoomedTopExtraHeight = 1; -// The distance between right edge of the right-most window control and the left -// edge of the window's right border when the window is maximized. -static const int kWindowControlsZoomedRightOffset = 3; -// The distance between the left edge of the window and the left edge of the -// window icon when a title-bar is showing and the window is restored. -static const int kWindowIconLeftOffset = 6; -// The distance between the right edge of the window's left border and the left -// edge of the window icon when a title-bar is showing and the window is -// maximized. -static const int kWindowIconZoomedLeftOffset = 2; -// The proportion of vertical space the icon takes up after subtracting the top -// and bottom borders of the titlebar (expressed as two values to avoid -// floating point representation errors that goof up the calculation). -static const int kWindowIconFractionNumerator = 16; -static const int kWindowIconFractionDenominator = 25; -// The distance between the top edge of the window and the top edge of the -// window title when a title-bar is showing and the window is restored. -static const int kWindowTitleTopOffset = 6; -// The distance between the bottom edge of the window's top border and the top -// edge of the window title when a title-bar is showing and the window is -// maximized. -static const int kWindowTitleZoomedTopOffset = 4; -// The distance between the window icon and the window title when a title-bar -// is showing. -static const int kWindowIconTitleSpacing = 4; -// The distance between the right edge of the title text bounding box and the -// left edge of the distributor logo. -static const int kTitleLogoSpacing = 5; -// The distance between the bottom of the title text and the TabStrip when a -// title-bar is showing and the window is restored. -static const int kTitleBottomSpacing = 7; -// The distance between the bottom of the title text and the TabStrip when a -// title-bar is showing and the window is maximized. -static const int kTitleZoomedBottomSpacing = 5; -// The distance between the top edge of the window and the TabStrip when there -// is no title-bar showing, and the window is restored. -static const int kNoTitleTopSpacing = 15; -// The number of pixels to crop off the bottom of the images making up the top -// client edge when the window is maximized, so we only draw a shadowed titlebar -// and not a grey client area border below it. -static const int kClientEdgeZoomedBottomCrop = 1; -// The amount of horizontal and vertical distance from a corner of the window -// within which a mouse-drive resize operation will resize the window in two -// dimensions. -static const int kResizeAreaCornerSize = 16; -// The width of the sizing border on the left and right edge of the window. -static const int kWindowHorizontalBorderSize = 5; -// The height of the sizing border at the top edge of the window -static const int kWindowVerticalBorderTopSize = 3; -// The height of the sizing border on the bottom edge of the window when the -// window is restored. -static const int kWindowVerticalBorderBottomSize = 5; -// The additional height beyond the system-provided thickness of the border on -// the bottom edge of the window when the window is maximized. -static const int kWindowVerticalBorderZoomedBottomSize = 1; -// The minimum width and height of the window icon that appears at the top left -// of pop-up and app windows. -static const int kWindowIconMinimumSize = 16; -// The minimum height reserved for the window title font. -static const int kWindowTitleMinimumHeight = 11; -// The horizontal distance of the right edge of the distributor logo from the -// left edge of the left-most window control. -static const int kDistributorLogoHorizontalOffset = 7; -// The vertical distance of the top of the distributor logo from the top edge -// of the window. -static const int kDistributorLogoVerticalOffset = 3; -// The distance between the left edge of the window and the OTR avatar icon when -// the window is restored. -static const int kOTRLeftOffset = 7; -// The distance between the right edge of the window's left border and the OTR -// avatar icon when the window is maximized. -static const int kOTRZoomedLeftOffset = 2; -// The distance between the top edge of the client area and the OTR avatar icon -// when the window is maximized. -static const int kOTRZoomedTopSpacing = 2; -// The distance between the bottom of the OTR avatar icon and the bottom of the -// tabstrip. -static const int kOTRBottomSpacing = 2; -// The number of pixels to crop off the top of the OTR image when the window is -// maximized. -static const int kOTRZoomedTopCrop = 4; -// Horizontal distance between the right edge of the OTR avatar icon and the -// left edge of the tabstrip. -static const int kOTRTabStripSpacing = 2; -// Horizontal distance between the right edge of the new tab icon and the left -// edge of the window minimize icon when the window is restored. -static const int kNewTabIconMinimizeSpacing = 5; -// Horizontal distance between the right edge of the new tab icon and the left -// edge of the window minimize icon when the window is maximized. -static const int kNewTabIconMinimizeZoomedSpacing = 16; +namespace { +// The frame border is only visible in restored mode and is hardcoded to 4 px on +// each side regardless of the system window border size. +const int kFrameBorderThickness = 4; +// In maximized mode, where no frame border is otherwise visible, we draw a +// different, 1 px high border along the bottom of the screen. +const int kFrameBorderMaximizedExtraBottomThickness = 1; +// Various edges of the frame border have a 1 px shadow along their edges; in a +// few cases we shift elements based on this amount for visual appeal. +const int kFrameShadowThickness = 1; +// Besides the frame border, there's another 11 px of empty space atop the +// window in restored mode, to use to drag the window around. +const int kNonClientRestoredExtraThickness = 11; +// In restored mode, we draw a 1 px edge around the content area inside the +// frame border. +const int kClientEdgeThickness = 1; +// While resize areas on Windows are normally the same size as the window +// borders, our top area is shrunk by 1 px to make it easier to move the window +// around with our thinner top grabbable strip. (Incidentally, our side and +// bottom resize areas don't match the frame border thickness either -- they +// span the whole nonclient area, so there's no "dead zone" for the mouse.) +const int kTopResizeAdjust = 1; +// In the window corners, the resize areas don't actually expand bigger, but the +// 16 px at the end of each edge triggers diagonal resizing. +const int kResizeAreaCornerSize = 16; +// The titlebar never shrinks to less than 19 px tall, plus the height of the +// frame border. +const int kTitlebarMinimumHeight = 19; +// The icon is inset 2 px from the left frame border. +const int kIconLeftSpacing = 2; +// The icon takes up 16/25th of the available titlebar height. (This is +// expressed as two ints to avoid precision losses leading to off-by-one pixel +// errors.) +const int kIconHeightFractionNumerator = 16; +const int kIconHeightFractionDenominator = 25; +// The icon never shrinks below 16 px on a side. +const int kIconMinimumSize = 16; +// Because our frame border has a different "3D look" than Windows', with a less +// cluttered top edge, we need to shift the icon up by 1 px in restored mode so +// it looks more centered. +const int kIconRestoredAdjust = 1; +// There is a 4 px gap between the icon and the title text. +const int kIconTitleSpacing = 4; +// The title text starts 2 px below the bottom of the top frame border. +const int kTitleTopSpacing = 2; +// There is a 5 px gap between the title text and the distributor logo (if +// present) or caption buttons. +const int kTitleLogoSpacing = 5; +// 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; +// In restored mode, the New Tab button isn't at the same height as the caption +// buttons, but the space will look cluttered if it actually slides under them, +// so we stop it when the gap between the two is down to 5 px. +const int kNewTabCaptionRestoredSpacing = 5; +// In maximized mode, where the New Tab button and the caption buttons are at +// similar vertical coordinates, we need to reserve a larger, 16 px gap to avoid +// looking too cluttered. +const int kNewTabCaptionMaximizedSpacing = 16; +// When there's a distributor logo, we leave a 7 px gap between it and the +// caption buttons. +const int kLogoCaptionSpacing = 7; +// The caption buttons are always drawn 1 px down from the visible top of the +// window (the true top in restored mode, or the top of the screen in maximized +// mode). +const int kCaptionTopSpacing = 1; +} /////////////////////////////////////////////////////////////////////////////// // OpaqueNonClientView, public: @@ -487,24 +462,23 @@ OpaqueNonClientView::~OpaqueNonClientView() { gfx::Rect OpaqueNonClientView::GetWindowBoundsForClientBounds( const gfx::Rect& client_bounds) { - int top_height = CalculateNonClientTopHeight(); - int horizontal_border = HorizontalBorderSize(); - int window_x = std::max(0, client_bounds.x() - horizontal_border); + int top_height = NonClientTopBorderHeight(); + int border_width = NonClientBorderWidth(); + int window_x = std::max(0, client_bounds.x() - border_width); int window_y = std::max(0, client_bounds.y() - top_height); - int window_w = client_bounds.width() + (2 * horizontal_border); + int window_w = client_bounds.width() + (2 * border_width); int window_h = - client_bounds.height() + top_height + VerticalBorderBottomSize(); + client_bounds.height() + top_height + NonClientBottomBorderHeight(); return gfx::Rect(window_x, window_y, window_w, window_h); } gfx::Rect OpaqueNonClientView::GetBoundsForTabStrip(TabStrip* tabstrip) { int tabstrip_x = browser_view_->ShouldShowOffTheRecordAvatar() ? - (otr_avatar_bounds_.right() + kOTRTabStripSpacing) : - HorizontalBorderSize(); + (otr_avatar_bounds_.right() + kOTRSideSpacing) : NonClientBorderWidth(); int tabstrip_width = minimize_button_->x() - tabstrip_x - (frame_->IsMaximized() ? - kNewTabIconMinimizeZoomedSpacing : kNewTabIconMinimizeSpacing); - return gfx::Rect(tabstrip_x, CalculateNonClientTopHeight(), + kNewTabCaptionMaximizedSpacing : kNewTabCaptionRestoredSpacing); + return gfx::Rect(tabstrip_x, NonClientTopBorderHeight(), std::max(0, tabstrip_width), tabstrip->GetPreferredHeight()); } @@ -532,15 +506,14 @@ SkBitmap OpaqueNonClientView::GetFavIconForTabIconView() { // OpaqueNonClientView, views::BaseButton::ButtonListener implementation: void OpaqueNonClientView::ButtonPressed(views::BaseButton* sender) { - if (sender == minimize_button_) { + if (sender == minimize_button_) frame_->ExecuteSystemMenuCommand(SC_MINIMIZE); - } else if (sender == maximize_button_) { + else if (sender == maximize_button_) frame_->ExecuteSystemMenuCommand(SC_MAXIMIZE); - } else if (sender == restore_button_) { + else if (sender == restore_button_) frame_->ExecuteSystemMenuCommand(SC_RESTORE); - } else if (sender == close_button_) { + else if (sender == close_button_) frame_->ExecuteSystemMenuCommand(SC_CLOSE); - } } /////////////////////////////////////////////////////////////////////////////// @@ -548,18 +521,18 @@ void OpaqueNonClientView::ButtonPressed(views::BaseButton* sender) { gfx::Rect OpaqueNonClientView::CalculateClientAreaBounds(int width, int height) const { - int top_margin = CalculateNonClientTopHeight(); - int horizontal_border = HorizontalBorderSize(); - return gfx::Rect(horizontal_border, top_margin, - std::max(0, width - (2 * horizontal_border)), - std::max(0, height - top_margin - VerticalBorderBottomSize())); + int top_height = NonClientTopBorderHeight(); + int border_width = NonClientBorderWidth(); + return gfx::Rect(border_width, top_height, + std::max(0, width - (2 * border_width)), + std::max(0, height - top_height - NonClientBottomBorderHeight())); } gfx::Size OpaqueNonClientView::CalculateWindowSizeForClientSize( int width, int height) const { - return gfx::Size(width + (2 * HorizontalBorderSize()), - height + CalculateNonClientTopHeight() + VerticalBorderBottomSize()); + return gfx::Size(width + (2 * NonClientBorderWidth()), + height + NonClientTopBorderHeight() + NonClientBottomBorderHeight()); } CPoint OpaqueNonClientView::GetSystemMenuPoint() const { @@ -591,13 +564,12 @@ int OpaqueNonClientView::NonClientHitTest(const gfx::Point& point) { window_icon_->GetBounds(APPLY_MIRRORING_TRANSFORMATION).Contains(point)) return HTSYSMENU; - int window_component = GetHTComponentForFrame(point, HorizontalBorderSize(), - kResizeAreaCornerSize, kWindowVerticalBorderTopSize, - frame_->window_delegate()->CanResize()); + int window_component = GetHTComponentForFrame(point, + TopResizeHeight(), NonClientBorderWidth(), NonClientBottomBorderHeight(), + kResizeAreaCornerSize, frame_->window_delegate()->CanResize()); // Fall back to the caption if no other component matches. - if ((window_component == HTNOWHERE) && bounds().Contains(point)) - window_component = HTCAPTION; - return window_component; + return ((window_component == HTNOWHERE) && bounds().Contains(point)) ? + HTCAPTION : window_component; } void OpaqueNonClientView::GetWindowMask(const gfx::Size& size, @@ -641,15 +613,13 @@ void OpaqueNonClientView::Paint(ChromeCanvas* canvas) { if (frame_->IsMaximized()) PaintMaximizedFrameBorder(canvas); else - PaintFrameBorder(canvas); + PaintRestoredFrameBorder(canvas); PaintDistributorLogo(canvas); PaintTitleBar(canvas); PaintToolbarBackground(canvas); PaintOTRAvatar(canvas); - if (frame_->IsMaximized()) - PaintMaximizedClientEdge(canvas); - else - PaintClientEdge(canvas); + if (!frame_->IsMaximized()) + PaintRestoredClientEdge(canvas); } void OpaqueNonClientView::Layout() { @@ -662,8 +632,8 @@ void OpaqueNonClientView::Layout() { gfx::Size OpaqueNonClientView::GetPreferredSize() { gfx::Size prefsize(frame_->client_view()->GetPreferredSize()); - prefsize.Enlarge(2 * HorizontalBorderSize(), - CalculateNonClientTopHeight() + VerticalBorderBottomSize()); + prefsize.Enlarge(2 * NonClientBorderWidth(), + NonClientTopBorderHeight() + NonClientBottomBorderHeight()); return prefsize; } @@ -672,8 +642,8 @@ views::View* OpaqueNonClientView::GetViewForPoint(const gfx::Point& point, // We override this function because the ClientView can overlap the non - // client view, making it impossible to click on the window controls. We need // to ensure the window controls are checked _first_. - views::View* views[] = { close_button_, restore_button_, maximize_button_, - minimize_button_ }; + views::View* views[] = + { close_button_, restore_button_, maximize_button_, minimize_button_ }; for (int i = 0; i < arraysize(views); ++i) { if (!views[i]->IsVisible()) continue; @@ -723,35 +693,73 @@ void OpaqueNonClientView::SetAccessibleName(const std::wstring& name) { /////////////////////////////////////////////////////////////////////////////// // OpaqueNonClientView, private: -int OpaqueNonClientView::CalculateNonClientTopHeight() const { - bool show_title = frame_->window_delegate()->ShouldShowWindowTitle(); - int title_height = std::max(title_font_.height(), kWindowTitleMinimumHeight); - if (frame_->IsMaximized()) { - int top_height = GetSystemMetrics(SM_CYSIZEFRAME); - if (show_title) { - top_height += kWindowTitleZoomedTopOffset + title_height + - kTitleZoomedBottomSpacing; - } - if (!browser_view_->IsToolbarVisible()) - top_height -= kClientEdgeZoomedBottomCrop; - return top_height; - } - return show_title ? - (kWindowTitleTopOffset + title_height + kTitleBottomSpacing) : - kNoTitleTopSpacing; +int OpaqueNonClientView::FrameBorderWidth() const { + return frame_->IsMaximized() ? + GetSystemMetrics(SM_CXSIZEFRAME) : kFrameBorderThickness; } -int OpaqueNonClientView::HorizontalBorderSize() const { +int OpaqueNonClientView::FrameTopBorderHeight() const { return frame_->IsMaximized() ? - GetSystemMetrics(SM_CXSIZEFRAME) : kWindowHorizontalBorderSize; + GetSystemMetrics(SM_CYSIZEFRAME) : kFrameBorderThickness; } -int OpaqueNonClientView::VerticalBorderBottomSize() const { +int OpaqueNonClientView::TopResizeHeight() const { + return FrameTopBorderHeight() - kTopResizeAdjust; +} + +int OpaqueNonClientView::NonClientBorderWidth() const { + // In maximized mode, we don't show a client edge. + return FrameBorderWidth() + + (frame_->IsMaximized() ? 0 : kClientEdgeThickness); +} + +int OpaqueNonClientView::NonClientTopBorderHeight() const { + if (!frame_->window_delegate()->ShouldShowWindowTitle()) { + return FrameTopBorderHeight() + + (frame_->IsMaximized() ? 0 : kNonClientRestoredExtraThickness); + } + + int title_top_spacing, title_thickness; + return TitleCoordinates(&title_top_spacing, &title_thickness); +} + +int OpaqueNonClientView::NonClientBottomBorderHeight() const { + // In maximized mode, we don't show a client edge, but the frame border is + // extended slightly. return frame_->IsMaximized() ? (GetSystemMetrics(SM_CYSIZEFRAME) + - kWindowVerticalBorderZoomedBottomSize) : kWindowVerticalBorderBottomSize; + kFrameBorderMaximizedExtraBottomThickness) : + (kFrameBorderThickness + kClientEdgeThickness); } -void OpaqueNonClientView::PaintFrameBorder(ChromeCanvas* canvas) { +int OpaqueNonClientView::ClientEdgeThicknessWithinNonClientHeight() const { + return (frame_->IsMaximized() || browser_view_->IsToolbarVisible()) ? + 0 : kClientEdgeThickness; +} + +int OpaqueNonClientView::TitleCoordinates(int* title_top_spacing, + int* title_thickness) const { + int top_height = FrameTopBorderHeight(); + int min_titlebar_height = kTitlebarMinimumHeight + top_height; + *title_top_spacing = top_height + kTitleTopSpacing; + // The bottom spacing should be the same apparent height as the top spacing. + // Because the actual top spacing height varies based on the system border + // thickness, we calculate this based on the restored top spacing and then + // adjust for maximized mode. + int title_bottom_spacing = kFrameBorderThickness + kTitleTopSpacing; + if (frame_->IsMaximized()) { + // When we maximize, the top border appears to be chopped off; shift the + // title down to stay centered within the remaining space. + int title_adjust = (kFrameBorderThickness / 2); + *title_top_spacing += title_adjust; + title_bottom_spacing -= title_adjust; + } + *title_thickness = std::max(title_font_.height(), + min_titlebar_height - *title_top_spacing - title_bottom_spacing); + return *title_top_spacing + *title_thickness + title_bottom_spacing + + ClientEdgeThicknessWithinNonClientHeight(); +} + +void OpaqueNonClientView::PaintRestoredFrameBorder(ChromeCanvas* canvas) { SkBitmap* top_left_corner = resources()->GetPartBitmap(FRAME_TOP_LEFT_CORNER); SkBitmap* top_right_corner = @@ -771,6 +779,10 @@ void OpaqueNonClientView::PaintFrameBorder(ChromeCanvas* canvas) { width() - top_right_corner->width(), top_edge->height()); canvas->DrawBitmapInt(*top_right_corner, width() - top_right_corner->width(), 0); + // Note: When we don't have a toolbar, we need to draw some kind of bottom + // edge here. Because the App Window graphics we use for this have an + // attached client edge and their sizing algorithm is a little involved, we do + // all this in PaintRestoredClientEdge(). // Right. canvas->TileImageInt(*right_edge, width() - right_edge->width(), @@ -798,15 +810,25 @@ void OpaqueNonClientView::PaintFrameBorder(ChromeCanvas* canvas) { void OpaqueNonClientView::PaintMaximizedFrameBorder(ChromeCanvas* canvas) { SkBitmap* top_edge = resources()->GetPartBitmap(FRAME_MAXIMIZED_TOP_EDGE); - int frame_thickness = GetSystemMetrics(SM_CYSIZEFRAME); - canvas->TileImageInt(*top_edge, 0, frame_thickness, width(), + canvas->TileImageInt(*top_edge, 0, FrameTopBorderHeight(), width(), top_edge->height()); + if (!browser_view_->IsToolbarVisible()) { + // There's no toolbar to edge the frame border, so we need to draw a bottom + // edge. The App Window graphic we use for this has a built in client edge, + // so we clip it off the bottom. + int edge_height = app_top_center_.height() - kClientEdgeThickness; + canvas->TileImageInt(app_top_center_, 0, + frame_->client_view()->y() - edge_height, width(), edge_height); + } + SkBitmap* bottom_edge = resources()->GetPartBitmap(FRAME_MAXIMIZED_BOTTOM_EDGE); + // We draw the bottom edge of this image. canvas->TileImageInt(*bottom_edge, 0, - height() - bottom_edge->height() - frame_thickness, width(), - bottom_edge->height()); + bottom_edge->height() - kFrameBorderMaximizedExtraBottomThickness, 0, + height() - NonClientBottomBorderHeight(), width(), + kFrameBorderMaximizedExtraBottomThickness); } void OpaqueNonClientView::PaintDistributorLogo(ChromeCanvas* canvas) { @@ -825,10 +847,12 @@ void OpaqueNonClientView::PaintTitleBar(ChromeCanvas* canvas) { canvas->DrawStringInt(d->GetWindowTitle(), title_font_, SK_ColorWHITE, MirroredLeftPointForRect(title_bounds_), title_bounds_.y(), title_bounds_.width(), title_bounds_.height()); - /* TODO(pkasting): - if (app window && active) - Draw Drop Shadow; - */ + /* TODO(pkasting): If this window is active, we should also draw a drop + * shadow on the title. This is tricky, because we don't want to hardcode a + * shadow color (since we want to work with various themes), but we can't + * alpha-blend either (since the Windows text APIs don't really do this). + * So we'd need to sample the background color at the right location and + * synthesize a good shadow color. */ } } @@ -858,16 +882,20 @@ void OpaqueNonClientView::PaintToolbarBackground(ChromeCanvas* canvas) { } void OpaqueNonClientView::PaintOTRAvatar(ChromeCanvas* canvas) { - if (browser_view_->ShouldShowOffTheRecordAvatar()) { - int src_y = frame_->IsMaximized() ? kOTRZoomedTopCrop : 0; - canvas->DrawBitmapInt(browser_view_->GetOTRAvatarIcon(), 0, src_y, - 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); - } + 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 OpaqueNonClientView::PaintClientEdge(ChromeCanvas* canvas) { +void OpaqueNonClientView::PaintRestoredClientEdge(ChromeCanvas* canvas) { + int client_area_top = frame_->client_view()->y(); + // The toolbar draws a client edge along its own bottom edge when it's // visible. However, it only draws this for the width of the actual client // area, leaving a gap at the left and right edges: @@ -876,17 +904,16 @@ void OpaqueNonClientView::PaintClientEdge(ChromeCanvas* canvas) { // ----- (toolbar client edge) ----- <-- gap // | Client area | <-- right client edge // - // To address this, we extend the left and right client edges up one pixel to - // fill the gap, by pretending the toolbar is one pixel shorter than it really - // is. + // To address this, we extend the left and right client edges up to fill the + // gap, by pretending the toolbar is shorter than it really is. // // Note: We can get away with this hackery because we only draw a top edge - // when there is no toolbar. If we tried to draw a top edge over the - // toolbar's top edge, we'd need a different solution. - gfx::Rect toolbar_bounds = browser_view_->GetToolbarBounds(); - if (browser_view_->IsToolbarVisible()) - toolbar_bounds.set_height(std::max(0, toolbar_bounds.height() - 1)); - int client_area_top = frame_->client_view()->y() + toolbar_bounds.bottom(); + // when there is no toolbar. If we tried to draw a client edge over the + // toolbar's bottom edge, we'd need a different solution. + if (browser_view_->IsToolbarVisible()) { + client_area_top += + browser_view_->GetToolbarBounds().bottom() - kClientEdgeThickness; + } // When we don't have a toolbar to draw a top edge for us, draw a top edge. gfx::Rect client_area_bounds = CalculateClientAreaBounds(width(), height()); @@ -906,7 +933,7 @@ void OpaqueNonClientView::PaintClientEdge(ChromeCanvas* canvas) { } int client_area_bottom = - std::max(client_area_top, height() - VerticalBorderBottomSize()); + std::max(client_area_top, height() - NonClientBottomBorderHeight()); int client_area_height = client_area_bottom - client_area_top; SkBitmap* right = resources()->GetPartBitmap(FRAME_CLIENT_EDGE_RIGHT); canvas->TileImageInt(*right, client_area_bounds.right(), client_area_top, @@ -931,15 +958,6 @@ void OpaqueNonClientView::PaintClientEdge(ChromeCanvas* canvas) { client_area_top, left->width(), client_area_height); } -void OpaqueNonClientView::PaintMaximizedClientEdge(ChromeCanvas* canvas) { - if (browser_view_->IsToolbarVisible()) - return; // The toolbar draws its own client edge, which is sufficient. - - int edge_height = app_top_center_.height() - kClientEdgeZoomedBottomCrop; - canvas->TileImageInt(app_top_center_, 0, - frame_->client_view()->y() - edge_height, width(), edge_height); -} - void OpaqueNonClientView::LayoutWindowControls() { // TODO(pkasting): This function is almost identical to // DefaultNonClientView::LayoutWindowControls(), they should be combined. @@ -948,23 +966,20 @@ void OpaqueNonClientView::LayoutWindowControls() { // Maximized buttons start at window top so that even if their images aren't // drawn flush with the screen edge, they still obey Fitts' Law. bool is_maximized = frame_->IsMaximized(); - int top_offset = is_maximized ? 0 : kWindowControlsTopOffset; - int top_extra_height = is_maximized ? - (GetSystemMetrics(SM_CYSIZEFRAME) + kWindowControlsZoomedTopExtraHeight) : - 0; - int right_offset = is_maximized ? - (GetSystemMetrics(SM_CXSIZEFRAME) + kWindowControlsZoomedRightOffset) : - kWindowControlsRightOffset; + int caption_y = is_maximized ? FrameTopBorderHeight() : kCaptionTopSpacing; + int top_extra_height = is_maximized ? kCaptionTopSpacing : 0; + // There should always be the same number of non-shadow pixels visible to the + // side of the caption buttons. In maximized mode we extend the rightmost + // button to the screen corner to obey Fitts' Law. + int right_extra_width = is_maximized ? + (kFrameBorderThickness - kFrameShadowThickness) : 0; + int right_spacing = is_maximized ? (GetSystemMetrics(SM_CXSIZEFRAME) + + right_extra_width) : FrameBorderWidth(); gfx::Size close_button_size = close_button_->GetPreferredSize(); - close_button_->SetBounds( - (width() - close_button_size.width() - right_offset), - top_offset, - (is_maximized ? - // We extend the maximized close button to the screen corner to obey - // Fitts' Law. - (close_button_size.width() + kWindowControlsZoomedRightOffset) : - close_button_size.width()), - (close_button_size.height() + top_extra_height)); + close_button_->SetBounds(width() - close_button_size.width() - right_spacing, + caption_y, + close_button_size.width() + right_extra_width, + close_button_size.height() + top_extra_height); // When the window is restored, we show a maximized button; otherwise, we show // a restore button. @@ -980,7 +995,7 @@ void OpaqueNonClientView::LayoutWindowControls() { views::Button::ALIGN_BOTTOM); gfx::Size visible_button_size = visible_button->GetPreferredSize(); visible_button->SetBounds(close_button_->x() - visible_button_size.width(), - top_offset, + caption_y, visible_button_size.width(), visible_button_size.height() + top_extra_height); @@ -989,93 +1004,80 @@ void OpaqueNonClientView::LayoutWindowControls() { views::Button::ALIGN_BOTTOM); gfx::Size minimize_button_size = minimize_button_->GetPreferredSize(); minimize_button_->SetBounds( - visible_button->x() - minimize_button_size.width(), - top_offset, + visible_button->x() - minimize_button_size.width(), caption_y, minimize_button_size.width(), minimize_button_size.height() + top_extra_height); } void OpaqueNonClientView::LayoutDistributorLogo() { - logo_bounds_.SetRect(minimize_button_->x() - distributor_logo_.width() - - kDistributorLogoHorizontalOffset, kDistributorLogoVerticalOffset, - distributor_logo_.width(), distributor_logo_.height()); + // Always lay out the logo, even when it's not present, so we can lay out the + // window title based on its position. + int logo_x = minimize_button_->x() - (distributor_logo_.empty() ? + 0 : (distributor_logo_.width() + kLogoCaptionSpacing)); + logo_bounds_.SetRect(logo_x, TopResizeHeight(), distributor_logo_.width(), + distributor_logo_.height()); } void OpaqueNonClientView::LayoutTitleBar() { - // Size the window icon, even if it is hidden so we can size the title based - // on its position. - int left_offset = frame_->IsMaximized() ? - (GetSystemMetrics(SM_CXSIZEFRAME) + kWindowIconZoomedLeftOffset) : - kWindowIconLeftOffset; + // Always lay out the icon, even when it's not present, so we can lay out the + // window title based on its position. + int icon_x = FrameBorderWidth() + kIconLeftSpacing; // The usable height of the titlebar area is the total height minus the top // resize border, the one shadow pixel at the bottom, and any client edge area - // we draw below that shadow pixel (only in restored mode). - // TODO(pkasting): Clean up this "4" hack. - int top_border_height = - frame_->IsMaximized() ? GetSystemMetrics(SM_CYSIZEFRAME) : 4; - int available_height = CalculateNonClientTopHeight() - top_border_height - 1; - if (!frame_->IsMaximized()) - available_height -= kClientEdgeZoomedBottomCrop; + // we draw below that shadow pixel. + int title_top_spacing, title_thickness; + int top_height = TitleCoordinates(&title_top_spacing, &title_thickness); + int top_border_height = FrameTopBorderHeight(); + int available_height = top_height - top_border_height - + kFrameShadowThickness - ClientEdgeThicknessWithinNonClientHeight(); // The icon takes up a constant fraction of the available height, down to a // minimum size, and is always an even number of pixels on a side (presumably // to make scaled icons look better). It's centered within the usable height. - int icon_size = std::max((available_height * kWindowIconFractionNumerator / - kWindowIconFractionDenominator) / 2 * 2, kWindowIconMinimumSize); - int icon_top_offset = - ((available_height - icon_size) / 2) + top_border_height; + int icon_size = std::max((available_height * kIconHeightFractionNumerator / + kIconHeightFractionDenominator) / 2 * 2, kIconMinimumSize); + int icon_y = ((available_height - icon_size) / 2) + top_border_height; // Hack: Our frame border has a different "3D look" than Windows'. Theirs has // a more complex gradient on the top that they push their icon/title below; // then the maximized window cuts this off and the icon/title are centered in // the remaining space. Because the apparent shape of our border is simpler, // using the same positioning makes things look slightly uncentered with - // restored windows, so we come up one pixel to compensate. + // restored windows, so we come up to compensate. if (!frame_->IsMaximized()) - --icon_top_offset; + icon_y -= kIconRestoredAdjust; views::WindowDelegate* d = frame_->window_delegate(); if (!d->ShouldShowWindowIcon()) icon_size = 0; - icon_bounds_.SetRect(left_offset, icon_top_offset, icon_size, icon_size); + icon_bounds_.SetRect(icon_x, icon_y, icon_size, icon_size); if (window_icon_) window_icon_->SetBounds(icon_bounds_); // Size the title, if visible. if (d->ShouldShowWindowTitle()) { - int title_right = logo_bounds_.x() - kTitleLogoSpacing; int icon_right = icon_bounds_.right(); - int title_left = - icon_right + (d->ShouldShowWindowIcon() ? kWindowIconTitleSpacing : 0); - int title_top_offset = frame_->IsMaximized() ? - (GetSystemMetrics(SM_CYSIZEFRAME) + kWindowTitleZoomedTopOffset) : - kWindowTitleTopOffset; - if (title_font_.height() < kWindowTitleMinimumHeight) { - title_top_offset += - (kWindowTitleMinimumHeight - title_font_.height()) / 2; - } - title_bounds_.SetRect(title_left, title_top_offset, - std::max(0, title_right - icon_right), title_font_.height()); + int title_x = + icon_right + (d->ShouldShowWindowIcon() ? kLogoCaptionSpacing : 0); + title_bounds_.SetRect(title_x, + title_top_spacing + ((title_thickness - title_font_.height()) / 2), + std::max(0, logo_bounds_.x() - kTitleLogoSpacing - icon_right), + title_font_.height()); } } void OpaqueNonClientView::LayoutOTRAvatar() { SkBitmap otr_avatar_icon = browser_view_->GetOTRAvatarIcon(); - int non_client_height = CalculateNonClientTopHeight(); - int otr_bottom = non_client_height + browser_view_->GetTabStripHeight() - - kOTRBottomSpacing; - int otr_x, otr_y, otr_height; - if (frame_->IsMaximized()) { - otr_x = GetSystemMetrics(SM_CXSIZEFRAME) + kOTRZoomedLeftOffset; - otr_y = non_client_height + kOTRZoomedTopSpacing; - otr_height = otr_bottom - otr_y; - } else { - otr_x = kOTRLeftOffset; - otr_height = otr_avatar_icon.height(); - otr_y = otr_bottom - otr_height; - } - otr_avatar_bounds_.SetRect(otr_x, otr_y, otr_avatar_icon.width(), otr_height); + int top_height = NonClientTopBorderHeight(); + int tabstrip_height = browser_view_->GetTabStripHeight() - kOTRBottomSpacing; + int otr_bottom = top_height + tabstrip_height; + int otr_height = frame_->IsMaximized() ? + (tabstrip_height - kOTRMaximizedTopSpacing) : + otr_avatar_icon.height(); + int otr_y = otr_bottom - otr_height; + otr_avatar_bounds_.SetRect(NonClientBorderWidth() + kOTRSideSpacing, otr_y, + otr_avatar_icon.width(), otr_height); } void OpaqueNonClientView::LayoutClientView() { diff --git a/chrome/browser/views/frame/opaque_non_client_view.h b/chrome/browser/views/frame/opaque_non_client_view.h index 632b5a9..55a2096 100644 --- a/chrome/browser/views/frame/opaque_non_client_view.h +++ b/chrome/browser/views/frame/opaque_non_client_view.h @@ -70,27 +70,51 @@ class OpaqueNonClientView : public views::NonClientView, virtual void SetAccessibleName(const std::wstring& name); private: - // Returns the height of the non-client area at the top of the window (the - // title bar, etc). - int CalculateNonClientTopHeight() const; - - // Returns the current thickness of the border that makes up the window left - // and right edges. - int HorizontalBorderSize() const; - - // Returns the current thickness of the border that makes up the window bottom - // edge. - int VerticalBorderBottomSize() const; - - // Paint various sub-components of this view. - void PaintFrameBorder(ChromeCanvas* canvas); + // Returns the width of the border that makes up the window frame left and + // right edges. This does not include any client edge. + int FrameBorderWidth() const; + + // Returns the height of the border that makes up the window frame top edge. + // Because this border is graphically one component with the rest of the + // nonclient top border, this is rarely useful directly. + int FrameTopBorderHeight() const; + + // Returns the height of the top resize area. This is smaller than the frame + // border height in order to increase the window draggable area. + int TopResizeHeight() const; + + // Returns the width of the entire nonclient left and right borders, including + // both the window frame and any client edge. + int NonClientBorderWidth() const; + + // Returns the height of the entire nonclient top border, including the window + // frame, any title area, and any connected client edge. + int NonClientTopBorderHeight() const; + + // Returns the height of the entire nonclient bottom border, including both + // the window frame and the client edge. + int NonClientBottomBorderHeight() const; + + // For windows without a toolbar, restored mode also draws a client edge below + // the titlebar which is considered part of the nonclient height. This + // returns the height of any such edge. + int ClientEdgeThicknessWithinNonClientHeight() const; + + // Calculates multiple values related to title layout. Returns the height of + // the entire titlebar including any connected client edge. + int TitleCoordinates(int* title_top_spacing, + int* title_thickness) const; + + // Paint various sub-components of this view. The *FrameBorder() functions + // also paint the background of the titlebar area, since the top frame border + // and titlebar background are a contiguous component. + void PaintRestoredFrameBorder(ChromeCanvas* canvas); void PaintMaximizedFrameBorder(ChromeCanvas* canvas); void PaintDistributorLogo(ChromeCanvas* canvas); void PaintTitleBar(ChromeCanvas* canvas); void PaintToolbarBackground(ChromeCanvas* canvas); void PaintOTRAvatar(ChromeCanvas* canvas); - void PaintClientEdge(ChromeCanvas* canvas); - void PaintMaximizedClientEdge(ChromeCanvas* canvas); + void PaintRestoredClientEdge(ChromeCanvas* canvas); // Layout various sub-components of this view. void LayoutWindowControls(); diff --git a/chrome/common/gfx/chrome_canvas.cc b/chrome/common/gfx/chrome_canvas.cc index 66c9c66..f439680 100644 --- a/chrome/common/gfx/chrome_canvas.cc +++ b/chrome/common/gfx/chrome_canvas.cc @@ -207,9 +207,13 @@ 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, - SkPorterDuff::Mode mode) { - if (!IntersectsClipRectInt(x, y, w, h)) + int x, int y, int w, int 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; @@ -218,23 +222,18 @@ void ChromeCanvas::TileImageInt(const SkBitmap& bitmap, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode); paint.setShader(shader); - paint.setPorterDuffXfermode(mode); + paint.setPorterDuffXfermode(SkPorterDuff::kSrcOver_Mode); // CreateBitmapShader returns a Shader with a reference count of one, we // 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(); } -void ChromeCanvas::TileImageInt(const SkBitmap& bitmap, - int x, int y, int w, int h) { - TileImageInt(bitmap, x, y, w, h, SkPorterDuff::kSrcOver_Mode); -} - SkBitmap ChromeCanvas::ExtractBitmap() { const SkBitmap& device_bitmap = getDevice()->accessBitmap(false); diff --git a/chrome/common/gfx/chrome_canvas.h b/chrome/common/gfx/chrome_canvas.h index 0575b00..370098f 100644 --- a/chrome/common/gfx/chrome_canvas.h +++ b/chrome/common/gfx/chrome_canvas.h @@ -151,12 +151,9 @@ class ChromeCanvas : public skia::PlatformCanvas { void DrawFocusRect(int x, int y, int width, int height); // Tiles the image in the specified region. - void TileImageInt(const SkBitmap& bitmap, int x, int y, int w, int h, - SkPorterDuff::Mode mode); - - // Tiles the image in the specified region using a transfer mode of - // SkPorterDuff::kSrcOver_Mode. 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(); diff --git a/chrome/views/custom_frame_window.cc b/chrome/views/custom_frame_window.cc index 8ab4425..25dc089 100644 --- a/chrome/views/custom_frame_window.cc +++ b/chrome/views/custom_frame_window.cc @@ -396,7 +396,6 @@ gfx::Rect DefaultNonClientView::CalculateClientAreaBounds(int width, gfx::Size DefaultNonClientView::CalculateWindowSizeForClientSize( int width, int height) const { - int contents_top = CalculateContentsTop(); return gfx::Size(width + (2 * kWindowHorizontalBorderSize), height + CalculateContentsTop() + kWindowVerticalBorderSize); } @@ -447,11 +446,8 @@ int DefaultNonClientView::NonClientHitTest(const gfx::Point& point) { if (button_bounds.Contains(point)) return HTSYSMENU; - component = GetHTComponentForFrame( - point, - kResizeAreaSize, - kResizeAreaCornerSize, - kResizeAreaNorthSize, + component = GetHTComponentForFrame(point, kResizeAreaNorthSize, + kResizeAreaSize, kResizeAreaSize, kResizeAreaCornerSize, container_->window_delegate()->CanResize()); if (component == HTNOWHERE) { // Finally fall back to the caption. diff --git a/chrome/views/non_client_view.cc b/chrome/views/non_client_view.cc index 63fcd34..3e1ebde 100644 --- a/chrome/views/non_client_view.cc +++ b/chrome/views/non_client_view.cc @@ -7,42 +7,43 @@ namespace views { int NonClientView::GetHTComponentForFrame(const gfx::Point& point, - int resize_area_size, - int resize_area_corner_size, - int top_resize_area_size, + int top_resize_border_height, + int resize_border_width, + int bottom_resize_border_height, + int resize_corner_size, bool can_resize) { int component = HTNOWHERE; - if (point.x() < resize_area_size) { - if (point.y() < resize_area_corner_size) { + if (point.x() < resize_border_width) { + if (point.y() < resize_corner_size) { component = HTTOPLEFT; - } else if (point.y() >= (height() - resize_area_corner_size)) { + } else if (point.y() >= (height() - resize_corner_size)) { component = HTBOTTOMLEFT; } else { component = HTLEFT; } - } else if (point.x() < resize_area_corner_size) { - if (point.y() < top_resize_area_size) { + } else if (point.x() < resize_corner_size) { + if (point.y() < top_resize_border_height) { component = HTTOPLEFT; - } else if (point.y() >= (height() - resize_area_size)) { + } else if (point.y() >= (height() - bottom_resize_border_height)) { component = HTBOTTOMLEFT; } - } else if (point.x() >= (width() - resize_area_size)) { - if (point.y() < resize_area_corner_size) { + } else if (point.x() >= (width() - resize_border_width)) { + if (point.y() < resize_corner_size) { component = HTTOPRIGHT; - } else if (point.y() >= (height() - resize_area_corner_size)) { + } else if (point.y() >= (height() - resize_corner_size)) { component = HTBOTTOMRIGHT; - } else if (point.x() >= (width() - resize_area_size)) { + } else { component = HTRIGHT; } - } else if (point.x() >= (width() - resize_area_corner_size)) { - if (point.y() < top_resize_area_size) { + } else if (point.x() >= (width() - resize_corner_size)) { + if (point.y() < top_resize_border_height) { component = HTTOPRIGHT; - } else if (point.y() >= (height() - resize_area_size)) { + } else if (point.y() >= (height() - bottom_resize_border_height)) { component = HTBOTTOMRIGHT; } - } else if (point.y() < top_resize_area_size) { + } else if (point.y() < top_resize_border_height) { component = HTTOP; - } else if (point.y() >= (height() - resize_area_size)) { + } else if (point.y() >= (height() - bottom_resize_border_height)) { component = HTBOTTOM; } diff --git a/chrome/views/non_client_view.h b/chrome/views/non_client_view.h index d8de9ea..3643bbe 100644 --- a/chrome/views/non_client_view.h +++ b/chrome/views/non_client_view.h @@ -75,9 +75,10 @@ class NonClientView : public View { // the size of the sizing edges, and whether or not the window can be // resized. int GetHTComponentForFrame(const gfx::Point& point, - int resize_area_size, - int resize_area_corner_size, - int top_resize_area_size, + int top_resize_border_height, + int resize_border_width, + int bottom_resize_border_height, + int resize_corner_size, bool can_resize); // Accessor for paint_as_active_. |