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

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

Issue 3027021: The scrollability of a bookmark menu should be reconsidered whenever there is... (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 | no next file » | 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 NSRect mainViewFrame = NSMakeRect(0, 0, 386 NSRect mainViewFrame = NSMakeRect(0, 0,
387 NSWidth(windowFrame) - 387 NSWidth(windowFrame) -
388 bookmarks::kScrollViewContentWidthMargin, 388 bookmarks::kScrollViewContentWidthMargin,
389 NSHeight(windowFrame)); 389 NSHeight(windowFrame));
390 [mainView_ setFrame:mainViewFrame]; 390 [mainView_ setFrame:mainViewFrame];
391 391
392 // Make sure the window fits on the screen. If not, constrain. 392 // Make sure the window fits on the screen. If not, constrain.
393 // We'll scroll to allow the user to see all the content. 393 // We'll scroll to allow the user to see all the content.
394 NSRect screenFrame = [[[self window] screen] frame]; 394 NSRect screenFrame = [[[self window] screen] frame];
395 screenFrame = NSInsetRect(screenFrame, 0, kScrollWindowVerticalMargin); 395 screenFrame = NSInsetRect(screenFrame, 0, kScrollWindowVerticalMargin);
396 BOOL wasScrollable = scrollable_;
396 if (!NSContainsRect(screenFrame, windowFrame)) { 397 if (!NSContainsRect(screenFrame, windowFrame)) {
397 scrollable_ = YES; 398 scrollable_ = YES;
398 windowFrame = NSIntersectionRect(screenFrame, windowFrame); 399 windowFrame = NSIntersectionRect(screenFrame, windowFrame);
399 } else { 400 } else {
400 scrollable_ = NO; 401 scrollable_ = NO;
401 } 402 }
402 [[self window] setFrame:windowFrame display:YES]; 403 NSWindow* window = [self window];
404 [window setFrame:windowFrame display:YES];
403 // If scrollable then offset the view and show the arrows. 405 // If scrollable then offset the view and show the arrows.
404 if (scrollable_) { 406 if (wasScrollable != scrollable_) {
405 [mainView_ scrollPoint:NSMakePoint(0, (NSHeight(mainViewFrame) - 407 [mainView_ scrollPoint:NSMakePoint(0, (NSHeight(mainViewFrame) -
406 NSHeight(windowFrame)))]; 408 NSHeight(windowFrame)))];
407 [self showOrHideScrollArrows]; 409 [self showOrHideScrollArrows];
408 [self addOrUpdateScrollTracking]; 410 [self addOrUpdateScrollTracking];
409 } 411 }
410 } 412 }
411 413
412 // Determine window size and position. 414 // Determine window size and position.
413 // Create buttons for all our nodes. 415 // Create buttons for all our nodes.
414 // TODO(jrg): break up into more and smaller routines for easier unit testing. 416 // TODO(jrg): break up into more and smaller routines for easier unit testing.
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after
1375 return [folderController_ controllerForNode:node]; 1377 return [folderController_ controllerForNode:node];
1376 } 1378 }
1377 1379
1378 #pragma mark TestingAPI Only 1380 #pragma mark TestingAPI Only
1379 1381
1380 - (void)setIgnoreAnimations:(BOOL)ignore { 1382 - (void)setIgnoreAnimations:(BOOL)ignore {
1381 ignoreAnimations_ = ignore; 1383 ignoreAnimations_ = ignore;
1382 } 1384 }
1383 1385
1384 @end // BookmarkBarFolderController 1386 @end // BookmarkBarFolderController
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698