diff options
-rw-r--r-- | chrome/browser/cocoa/browser_frame_view.mm | 21 | ||||
-rw-r--r-- | chrome/browser/cocoa/browser_window_controller.mm | 10 |
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; } |