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

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

Issue 629973002: Adjust bookmark folder menu window if its parent button is partly off-screen to the left. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/cocoa/bookmarks/bookmark_bar_folder_controller.h" 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.h"
6 6
7 #include "base/mac/bundle_locations.h" 7 #include "base/mac/bundle_locations.h"
8 #include "base/mac/mac_util.h" 8 #include "base/mac/mac_util.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #import "chrome/browser/bookmarks/bookmark_model_factory.h" 10 #import "chrome/browser/bookmarks/bookmark_model_factory.h"
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 newWindowTopLeft.x = [self childFolderWindowLeftForWidth:windowWidth]; 551 newWindowTopLeft.x = [self childFolderWindowLeftForWidth:windowWidth];
552 NSPoint topOfWindow = NSMakePoint(0, 552 NSPoint topOfWindow = NSMakePoint(0,
553 NSMaxY([parentButton_ frame]) - 553 NSMaxY([parentButton_ frame]) -
554 bookmarks::kBookmarkVerticalPadding); 554 bookmarks::kBookmarkVerticalPadding);
555 topOfWindow = [[parentButton_ window] 555 topOfWindow = [[parentButton_ window]
556 convertBaseToScreen:[[parentButton_ superview] 556 convertBaseToScreen:[[parentButton_ superview]
557 convertPoint:topOfWindow toView:nil]]; 557 convertPoint:topOfWindow toView:nil]];
558 newWindowTopLeft.y = topOfWindow.y + 558 newWindowTopLeft.y = topOfWindow.y +
559 2 * bookmarks::kBookmarkVerticalPadding; 559 2 * bookmarks::kBookmarkVerticalPadding;
560 } 560 }
561
562 // If parent button was partially off screen to the left, offset it's folder
563 // menu window horizontally, so that complete menu is seen from the left.
564 if (newWindowTopLeft.x < 0.0)
Alexei Svitkine (slow) 2014/10/06 17:55:28 Are you sure this is correct? What if the user ha
Gaja 2014/10/07 07:41:10 Oh, I did not think of it. But I have a doubt here
565 newWindowTopLeft.x = 0.0;
566
561 return newWindowTopLeft; 567 return newWindowTopLeft;
562 } 568 }
563 569
564 // Set our window level to the right spot so we're above the menubar, dock, etc. 570 // Set our window level to the right spot so we're above the menubar, dock, etc.
565 // Factored out so we can override/noop in a unit test. 571 // Factored out so we can override/noop in a unit test.
566 - (void)configureWindowLevel { 572 - (void)configureWindowLevel {
567 [[self window] setLevel:NSPopUpMenuWindowLevel]; 573 [[self window] setLevel:NSPopUpMenuWindowLevel];
568 } 574 }
569 575
570 - (int)menuHeightForButtonCount:(int)buttonCount { 576 - (int)menuHeightForButtonCount:(int)buttonCount {
(...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after
2003 2009
2004 - (void)setIgnoreAnimations:(BOOL)ignore { 2010 - (void)setIgnoreAnimations:(BOOL)ignore {
2005 ignoreAnimations_ = ignore; 2011 ignoreAnimations_ = ignore;
2006 } 2012 }
2007 2013
2008 - (BookmarkButton*)buttonThatMouseIsIn { 2014 - (BookmarkButton*)buttonThatMouseIsIn {
2009 return buttonThatMouseIsIn_; 2015 return buttonThatMouseIsIn_;
2010 } 2016 }
2011 2017
2012 @end // BookmarkBarFolderController 2018 @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