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

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

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