Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: chrome/browser/cocoa/bookmark_bar_folder_controller.mm

Issue 2884026: Initial bookmark bar folder window tries harder to be on-screen.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/cocoa/bookmark_bar_folder_controller.h" 5 #import "chrome/browser/cocoa/bookmark_bar_folder_controller.h"
6 #include "base/mac_util.h" 6 #include "base/mac_util.h"
7 #include "base/nsimage_cache_mac.h" 7 #include "base/nsimage_cache_mac.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #include "chrome/browser/bookmarks/bookmark_model.h" 9 #include "chrome/browser/bookmarks/bookmark_model.h"
10 #include "chrome/browser/bookmarks/bookmark_utils.h" 10 #include "chrome/browser/bookmarks/bookmark_utils.h"
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 NSPoint buttonBottomLeftInScreen = 333 NSPoint buttonBottomLeftInScreen =
334 [[parentButton_ window] 334 [[parentButton_ window]
335 convertBaseToScreen:[parentButton_ 335 convertBaseToScreen:[parentButton_
336 convertPoint:NSZeroPoint toView:nil]]; 336 convertPoint:NSZeroPoint toView:nil]];
337 NSPoint bookmarkBarBottomLeftInScreen = 337 NSPoint bookmarkBarBottomLeftInScreen =
338 [[parentButton_ window] 338 [[parentButton_ window]
339 convertBaseToScreen:[[parentButton_ superview] 339 convertBaseToScreen:[[parentButton_ superview]
340 convertPoint:NSZeroPoint toView:nil]]; 340 convertPoint:NSZeroPoint toView:nil]];
341 newWindowTopLeft = NSMakePoint(buttonBottomLeftInScreen.x, 341 newWindowTopLeft = NSMakePoint(buttonBottomLeftInScreen.x,
342 bookmarkBarBottomLeftInScreen.y); 342 bookmarkBarBottomLeftInScreen.y);
343 // Make sure the window is on-screen; if not, push left. It is
344 // intentional that top level folders "push left" slightly
345 // different than subfolders.
346 NSRect screenFrame = [[[parentButton_ window] screen] frame];
347 CGFloat spillOff = (newWindowTopLeft.x + windowWidth) - NSMaxX(screenFrame);
348 if (spillOff > 0.0) {
349 newWindowTopLeft.x = std::max(newWindowTopLeft.x - spillOff,
350 NSMinX(screenFrame));
351 }
343 } else { 352 } else {
344 // Parent is a folder; grow right/left. 353 // Parent is a folder; grow right/left.
345 newWindowTopLeft.x = [self childFolderWindowLeftForWidth:windowWidth]; 354 newWindowTopLeft.x = [self childFolderWindowLeftForWidth:windowWidth];
346 NSPoint top = NSMakePoint(0, (NSMaxY([parentButton_ frame]) + 355 NSPoint top = NSMakePoint(0, (NSMaxY([parentButton_ frame]) +
347 bookmarks::kBookmarkVerticalPadding)); 356 bookmarks::kBookmarkVerticalPadding));
348 NSPoint topOfWindow = 357 NSPoint topOfWindow =
349 [[parentButton_ window] 358 [[parentButton_ window]
350 convertBaseToScreen:[[parentButton_ superview] 359 convertBaseToScreen:[[parentButton_ superview]
351 convertPoint:top toView:nil]]; 360 convertPoint:top toView:nil]];
352 newWindowTopLeft.y = topOfWindow.y; 361 newWindowTopLeft.y = topOfWindow.y;
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 return [folderController_ controllerForNode:node]; 1374 return [folderController_ controllerForNode:node];
1366 } 1375 }
1367 1376
1368 #pragma mark TestingAPI Only 1377 #pragma mark TestingAPI Only
1369 1378
1370 - (void)setIgnoreAnimations:(BOOL)ignore { 1379 - (void)setIgnoreAnimations:(BOOL)ignore {
1371 ignoreAnimations_ = ignore; 1380 ignoreAnimations_ = ignore;
1372 } 1381 }
1373 1382
1374 @end // BookmarkBarFolderController 1383 @end // BookmarkBarFolderController
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698