summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-29 17:37:45 +0000
committerpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-29 17:37:45 +0000
commitbf7b0118488dca550c4fe2fc6afa2d5974fd5654 (patch)
tree9adba2488af0a20c7139690687c6ac321b5771b1 /chrome
parent41314457279190664076d06b57c69d0facbdba98 (diff)
downloadchromium_src-bf7b0118488dca550c4fe2fc6afa2d5974fd5654.zip
chromium_src-bf7b0118488dca550c4fe2fc6afa2d5974fd5654.tar.gz
chromium_src-bf7b0118488dca550c4fe2fc6afa2d5974fd5654.tar.bz2
Toolbar facelift. Main buttons larger and more spread out, only get borders when mouse is inside. Fix to gradient button to not show border on mouseover when disabled. Adjust "overlap" between the toolbar and bookmark bar to allow for larger buttons w/out clipping.
Nib change: All buttons changed to not bordered, button cell tags are 0. Buttons are 31x31 and spread out a bit more. BUG=44574 TEST=toolbar and bookmark bar appearance, hidden, always showing, and detached on NTP. Review URL: http://codereview.chromium.org/2806041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51143 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/nibs/Toolbar.xib26
-rw-r--r--chrome/browser/cocoa/bookmark_bar_constants.h17
-rw-r--r--chrome/browser/cocoa/bookmark_bar_controller.mm2
-rw-r--r--chrome/browser/cocoa/bookmark_bar_controller_unittest.mm2
-rw-r--r--chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm18
-rw-r--r--chrome/browser/cocoa/gradient_button_cell.mm4
-rw-r--r--chrome/browser/cocoa/toolbar_controller.mm4
7 files changed, 46 insertions, 27 deletions
diff --git a/chrome/app/nibs/Toolbar.xib b/chrome/app/nibs/Toolbar.xib
index 9a530c0..912ba7c 100644
--- a/chrome/app/nibs/Toolbar.xib
+++ b/chrome/app/nibs/Toolbar.xib
@@ -3,7 +3,7 @@
<data>
<int key="IBDocument.SystemTarget">1050</int>
<string key="IBDocument.SystemVersion">9L31a</string>
- <string key="IBDocument.InterfaceBuilderVersion">680</string>
+ <string key="IBDocument.InterfaceBuilderVersion">677</string>
<string key="IBDocument.AppKitVersion">949.54</string>
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
@@ -87,7 +87,7 @@
<object class="NSButton" id="368496192">
<reference key="NSNextResponder" ref="928520650"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{66, 5}, {31, 27}}</string>
+ <string key="NSFrame">{{69, 3}, {31, 31}}</string>
<reference key="NSSuperview" ref="928520650"/>
<int key="NSTag">33003</int>
<bool key="NSEnabled">YES</bool>
@@ -101,7 +101,7 @@
<int key="NSfFlags">1044</int>
</object>
<reference key="NSControlView" ref="368496192"/>
- <int key="NSButtonFlags">-2030812929</int>
+ <int key="NSButtonFlags">-2039201537</int>
<int key="NSButtonFlags2">6</int>
<object class="NSCustomResource" key="NSNormalImage">
<string key="NSClassName">NSImage</string>
@@ -116,7 +116,7 @@
<object class="NSButton" id="458854861">
<reference key="NSNextResponder" ref="928520650"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{101, 5}, {31, 27}}</string>
+ <string key="NSFrame">{{102, 3}, {31, 31}}</string>
<reference key="NSSuperview" ref="928520650"/>
<int key="NSTag">33002</int>
<bool key="NSEnabled">YES</bool>
@@ -126,7 +126,7 @@
<string key="NSContents"/>
<reference key="NSSupport" ref="64724822"/>
<reference key="NSControlView" ref="458854861"/>
- <int key="NSButtonFlags">-2033434369</int>
+ <int key="NSButtonFlags">-2041822977</int>
<int key="NSButtonFlags2">6</int>
<object class="NSCustomResource" key="NSNormalImage">
<string key="NSClassName">NSImage</string>
@@ -141,7 +141,7 @@
<object class="NSButton" id="781044416">
<reference key="NSNextResponder" ref="928520650"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{34, 5}, {28, 27}}</string>
+ <string key="NSFrame">{{36, 3}, {31, 31}}</string>
<reference key="NSSuperview" ref="928520650"/>
<int key="NSTag">33001</int>
<bool key="NSEnabled">YES</bool>
@@ -150,9 +150,8 @@
<int key="NSCellFlags2">134250496</int>
<string key="NSContents"/>
<reference key="NSSupport" ref="64724822"/>
- <int key="NSTag">1</int>
<reference key="NSControlView" ref="781044416"/>
- <int key="NSButtonFlags">-2031861505</int>
+ <int key="NSButtonFlags">-2040250113</int>
<int key="NSButtonFlags2">6</int>
<object class="NSCustomResource" key="NSNormalImage">
<string key="NSClassName">NSImage</string>
@@ -167,7 +166,7 @@
<object class="NSButton" id="634265909">
<reference key="NSNextResponder" ref="928520650"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{5, 5}, {29, 27}}</string>
+ <string key="NSFrame">{{3, 3}, {31, 31}}</string>
<reference key="NSSuperview" ref="928520650"/>
<int key="NSTag">33000</int>
<bool key="NSEnabled">YES</bool>
@@ -176,9 +175,8 @@
<int key="NSCellFlags2">134250496</int>
<string key="NSContents"/>
<reference key="NSSupport" ref="64724822"/>
- <int key="NSTag">-2</int>
<reference key="NSControlView" ref="634265909"/>
- <int key="NSButtonFlags">-2030812929</int>
+ <int key="NSButtonFlags">-2039201537</int>
<int key="NSButtonFlags2">6</int>
<object class="NSCustomResource" key="NSNormalImage">
<string key="NSClassName">NSImage</string>
@@ -193,7 +191,7 @@
<object class="NSButton" id="602421009">
<reference key="NSNextResponder" ref="928520650"/>
<int key="NSvFlags">265</int>
- <string key="NSFrame">{{577, 5}, {35, 27}}</string>
+ <string key="NSFrame">{{577, 3}, {35, 31}}</string>
<reference key="NSSuperview" ref="928520650"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="204555298">
@@ -634,7 +632,7 @@
<string key="superclassName">StyledTextField</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
- <string key="minorKey">browser/cocoa/autocomplete_text_field.h</string>
+ <string key="minorKey">browser/cocoa/location_bar/autocomplete_text_field.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
@@ -642,7 +640,7 @@
<string key="superclassName">StyledTextFieldCell</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
- <string key="minorKey">browser/cocoa/autocomplete_text_field_cell.h</string>
+ <string key="minorKey">browser/cocoa/location_bar/autocomplete_text_field_cell.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
diff --git a/chrome/browser/cocoa/bookmark_bar_constants.h b/chrome/browser/cocoa/bookmark_bar_constants.h
index 216fc8c..0c0a905 100644
--- a/chrome/browser/cocoa/bookmark_bar_constants.h
+++ b/chrome/browser/cocoa/bookmark_bar_constants.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -11,8 +11,15 @@
namespace bookmarks {
-// Our height, when opened in "always visible" mode.
-const int kBookmarkBarHeight = 28;
+// Correction used for computing other values based on the height.
+const int kVisualHeightOffset = 2;
+
+// Bar height, when opened in "always visible" mode. This is actually a little
+// smaller than it should be (by |kVisualHeightOffset| points) because of the
+// visual overlap with the main toolbar. When using this to compute values
+// other than the actual height of the toolbar, be sure to add
+// |kVisualHeightOffset|.
+const int kBookmarkBarHeight = 26;
// Our height, when visible in "new tab page" mode.
const int kNTPBookmarkBarHeight = 40;
@@ -20,10 +27,10 @@ const int kNTPBookmarkBarHeight = 40;
// The amount of space between the inner bookmark bar and the outer toolbar on
// new tab pages.
const int kNTPBookmarkBarPadding =
- (kNTPBookmarkBarHeight - kBookmarkBarHeight) / 2;
+ (kNTPBookmarkBarHeight - (kBookmarkBarHeight + kVisualHeightOffset)) / 2;
// The height of buttons in the bookmark bar.
-const int kBookmarkButtonHeight = kBookmarkBarHeight;
+const int kBookmarkButtonHeight = kBookmarkBarHeight + kVisualHeightOffset;
} // namespace bookmarks
diff --git a/chrome/browser/cocoa/bookmark_bar_controller.mm b/chrome/browser/cocoa/bookmark_bar_controller.mm
index 8317f78..4d91c88 100644
--- a/chrome/browser/cocoa/bookmark_bar_controller.mm
+++ b/chrome/browser/cocoa/bookmark_bar_controller.mm
@@ -109,7 +109,7 @@ namespace {
// Overlap (in pixels) between the toolbar and the bookmark bar (when showing in
// normal mode).
-const CGFloat kBookmarkBarOverlap = 5.0;
+const CGFloat kBookmarkBarOverlap = 3.0;
// Duration of the bookmark bar animations.
const NSTimeInterval kBookmarkBarAnimationDuration = 0.12;
diff --git a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm
index 82dfe0d..8e51f6a 100644
--- a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm
+++ b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm
@@ -996,7 +996,7 @@ TEST_F(BookmarkBarControllerTest, BookmarkButtonSizing) {
EXPECT_GT([buttons count], 0u);
for (NSButton* button in buttons) {
EXPECT_FLOAT_EQ(
- bookmarks::kBookmarkBarHeight - 2 *
+ (bookmarks::kBookmarkBarHeight + bookmarks::kVisualHeightOffset) - 2 *
bookmarks::kBookmarkVerticalPadding,
[button frame].size.height);
}
diff --git a/chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm b/chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm
index 39546df..5a92135 100644
--- a/chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm
+++ b/chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm
@@ -533,8 +533,10 @@ TEST_F(BookmarkBarFolderControllerMenuTest, DragMoveBarBookmarkToFolder) {
// and grown vertically.
NSRect expectedToWindowFrame = oldToWindowFrame;
expectedToWindowFrame.origin.x -= horizontalShift;
- expectedToWindowFrame.origin.y -= bookmarks::kBookmarkBarHeight;
- expectedToWindowFrame.size.height += bookmarks::kBookmarkBarHeight;
+ expectedToWindowFrame.origin.y -=
+ bookmarks::kBookmarkBarHeight + bookmarks::kVisualHeightOffset;
+ expectedToWindowFrame.size.height +=
+ bookmarks::kBookmarkBarHeight + bookmarks::kVisualHeightOffset;
EXPECT_NSRECT_EQ(expectedToWindowFrame, newToWindowFrame);
// Move the button back to the bar at the beginning.
@@ -595,8 +597,10 @@ TEST_F(BookmarkBarFolderControllerMenuTest, DragCopyBarBookmarkToFolder) {
EXPECT_NSRECT_EQ(oldToFolderFrame, newToFolderFrame);
// The toWindow should have shifted down vertically and grown vertically.
NSRect expectedToWindowFrame = oldToWindowFrame;
- expectedToWindowFrame.origin.y -= bookmarks::kBookmarkBarHeight;
- expectedToWindowFrame.size.height += bookmarks::kBookmarkBarHeight;
+ expectedToWindowFrame.origin.y -=
+ bookmarks::kBookmarkBarHeight + bookmarks::kVisualHeightOffset;
+ expectedToWindowFrame.size.height +=
+ bookmarks::kBookmarkBarHeight + bookmarks::kVisualHeightOffset;
EXPECT_NSRECT_EQ(expectedToWindowFrame, newToWindowFrame);
// Copy the button back to the bar after "3b".
@@ -668,8 +672,10 @@ TEST_F(BookmarkBarFolderControllerMenuTest, DragMoveBarBookmarkToSubfolder) {
EXPECT_NSRECT_EQ(oldToWindowFrame, newToWindowFrame);
NSRect newToSubwindowFrame = [toSubwindow frame];
NSRect expectedToSubwindowFrame = oldToSubwindowFrame;
- expectedToSubwindowFrame.origin.y -= bookmarks::kBookmarkBarHeight;
- expectedToSubwindowFrame.size.height += bookmarks::kBookmarkBarHeight;
+ expectedToSubwindowFrame.origin.y -=
+ bookmarks::kBookmarkBarHeight + bookmarks::kVisualHeightOffset;
+ expectedToSubwindowFrame.size.height +=
+ bookmarks::kBookmarkBarHeight + bookmarks::kVisualHeightOffset;
EXPECT_NSRECT_EQ(expectedToSubwindowFrame, newToSubwindowFrame);
}
diff --git a/chrome/browser/cocoa/gradient_button_cell.mm b/chrome/browser/cocoa/gradient_button_cell.mm
index 523b4d7..d6bd544 100644
--- a/chrome/browser/cocoa/gradient_button_cell.mm
+++ b/chrome/browser/cocoa/gradient_button_cell.mm
@@ -266,6 +266,10 @@ static const NSTimeInterval kAnimationHideDuration = 0.4;
[NSGraphicsContext restoreGraphicsState];
}
+ // Don't draw anything else for disabled flat buttons.
+ if (isFlatButton && ![self isEnabled])
+ return;
+
// Draw the outer stroke.
NSColor* strokeColor = nil;
if (showClickedGradient) {
diff --git a/chrome/browser/cocoa/toolbar_controller.mm b/chrome/browser/cocoa/toolbar_controller.mm
index 43f6f55..4823f31 100644
--- a/chrome/browser/cocoa/toolbar_controller.mm
+++ b/chrome/browser/cocoa/toolbar_controller.mm
@@ -231,6 +231,10 @@ class PrefObserverBridge : public NotificationObserver {
[homeButton_ setImage:nsimage_cache::ImageNamed(kHomeButtonImageName)];
[wrenchButton_ setImage:nsimage_cache::ImageNamed(kWrenchButtonImageName)];
+ [backButton_ setShowsBorderOnlyWhileMouseInside:YES];
+ [forwardButton_ setShowsBorderOnlyWhileMouseInside:YES];
+ [reloadButton_ setShowsBorderOnlyWhileMouseInside:YES];
+ [homeButton_ setShowsBorderOnlyWhileMouseInside:YES];
[wrenchButton_ setShowsBorderOnlyWhileMouseInside:YES];
[self initCommandStatus:commands_];