summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa
diff options
context:
space:
mode:
authordmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-04 21:09:42 +0000
committerdmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-04 21:09:42 +0000
commitcec0a28770788ef39d820f890e18bd047d54c356 (patch)
tree83776e7af12f1ec0a18472b49641e6e7d6cd91cd /chrome/browser/cocoa
parentbdc212920d88fe76821fbc2afea8e3863dda9e42 (diff)
downloadchromium_src-cec0a28770788ef39d820f890e18bd047d54c356.zip
chromium_src-cec0a28770788ef39d820f890e18bd047d54c356.tar.gz
chromium_src-cec0a28770788ef39d820f890e18bd047d54c356.tar.bz2
Shifted patterns in tabs and background pattern over so that patterns line up correctly with the
browser window. BUG=18548 TEST=Open window with Legal Pad theme from the them gallery and make sure the red lines line up. Review URL: http://codereview.chromium.org/351010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30998 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r--chrome/browser/cocoa/browser_frame_view.mm21
-rw-r--r--chrome/browser/cocoa/browser_window_controller.mm10
2 files changed, 19 insertions, 12 deletions
diff --git a/chrome/browser/cocoa/browser_frame_view.mm b/chrome/browser/cocoa/browser_frame_view.mm
index 45fcda3..fd7ee30 100644
--- a/chrome/browser/cocoa/browser_frame_view.mm
+++ b/chrome/browser/cocoa/browser_frame_view.mm
@@ -12,13 +12,6 @@
#import "chrome/browser/cocoa/chrome_browser_window.h"
#import "third_party/GTM/AppKit/GTMTheme.h"
-// To line up our background pattern with the patterns in the tabs we need
-// to move our background patterns in the window frame up by two pixels.
-// This will make the themes look slightly different than in Windows/Linux
-// because of the differing heights between window top and tab top, but this
-// has been approved by UI.
-static const NSInteger kBrowserFrameViewPatternPhaseOffset = 2;
-
@interface NSView (Swizzles)
- (void)drawRectOriginal:(NSRect)rect;
- (BOOL)_mouseInGroup:(NSButton*)widget;
@@ -118,9 +111,17 @@ static const NSInteger kBrowserFrameViewPatternPhaseOffset = 2;
NSColor* color = [theme backgroundPatternColorForStyle:GTMThemeStyleWindow
state:state];
if (color) {
- // If we have a theme pattern, draw it here.
- NSPoint phase = NSMakePoint(0, (NSHeight(windowRect) +
- kBrowserFrameViewPatternPhaseOffset));
+ // If there is a theme pattern, draw it here.
+
+ // To line up the background pattern with the patterns in the tabs the
+ // background pattern in the window frame need to be moved up by two
+ // pixels and left by 5.
+ // This will make the themes look slightly different than in Windows/Linux
+ // because of the differing heights between window top and tab top, but this
+ // has been approved by UI.
+ static const NSPoint kBrowserFrameViewPatternPhaseOffset = { -5, 2 };
+ NSPoint phase = kBrowserFrameViewPatternPhaseOffset;
+ phase.y += NSHeight(windowRect);
[[NSGraphicsContext currentContext] setPatternPhase:phase];
[color set];
NSRectFill(rect);
diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm
index f8d0b75..f310c07 100644
--- a/chrome/browser/cocoa/browser_window_controller.mm
+++ b/chrome/browser/cocoa/browser_window_controller.mm
@@ -1051,17 +1051,23 @@ willPositionSheet:(NSWindow*)sheet
- (NSPoint)gtm_themePatternPhaseForWindow:(NSWindow*)window {
// Our patterns want to be drawn from the upper left hand corner of the view.
// Cocoa wants to do it from the lower left of the window.
+ //
// Rephase our pattern to fit this view. Some other views (Tabs, Toolbar etc.)
// will phase their patterns relative to this so all the views look right.
+ //
+ // To line up the background pattern with the pattern in the browser window
+ // the background pattern for the tabs needs to be moved left by 5 pixels.
+ const CGFloat kPatternHorizontalOffset = -5;
NSView* tabStripView = [self tabStripView];
NSRect tabStripViewWindowBounds = [tabStripView bounds];
NSView* windowChromeView = [[window contentView] superview];
tabStripViewWindowBounds =
[tabStripView convertRect:tabStripViewWindowBounds
toView:windowChromeView];
- NSPoint phase = NSMakePoint(NSMinX(tabStripViewWindowBounds),
+ NSPoint phase = NSMakePoint(NSMinX(tabStripViewWindowBounds)
+ + kPatternHorizontalOffset,
NSMinY(tabStripViewWindowBounds)
- + [TabStripController defaultTabHeight]);
+ + [TabStripController defaultTabHeight]);
return phase;
}