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

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

Issue 606593002: Move bookmark's folder menu upwards only when its parent button is moved (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comments 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 1917 matching lines...) Expand 10 before | Expand all | Expand 10 after
1928 for (NSInteger i = 0; i < buttonIndex; ++i) { 1928 for (NSInteger i = 0; i < buttonIndex; ++i) {
1929 BookmarkButton* button = [buttons_ objectAtIndex:i]; 1929 BookmarkButton* button = [buttons_ objectAtIndex:i];
1930 NSRect buttonFrame = [button frame]; 1930 NSRect buttonFrame = [button frame];
1931 buttonFrame.origin.y -= bookmarks::kBookmarkFolderButtonHeight; 1931 buttonFrame.origin.y -= bookmarks::kBookmarkFolderButtonHeight;
1932 [button setFrame:buttonFrame]; 1932 [button setFrame:buttonFrame];
1933 } 1933 }
1934 // Search for and adjust submenus, if necessary. 1934 // Search for and adjust submenus, if necessary.
1935 NSInteger buttonCount = [buttons_ count]; 1935 NSInteger buttonCount = [buttons_ count];
1936 if (buttonCount) { 1936 if (buttonCount) {
1937 BookmarkButton* subButton = [folderController_ parentButton]; 1937 BookmarkButton* subButton = [folderController_ parentButton];
1938 NSInteger targetIndex = 0;
1938 for (NSButton* aButton in buttons_.get()) { 1939 for (NSButton* aButton in buttons_.get()) {
1939 // If this button is showing its menu then we need to move the menu, too. 1940 targetIndex++;
1940 if (aButton == subButton) 1941 // If this button is showing its menu and is below the removed button,
1941 [folderController_ 1942 // i.e its index is greater, then we need to move the menu too.
1942 offsetFolderMenuWindow:NSMakeSize(0.0, chrome::kBookmarkBarHeight)]; 1943 if (aButton == subButton && targetIndex > buttonIndex) {
1944 [folderController_ offsetFolderMenuWindow:NSMakeSize(0.0,
1945 bookmarks::kBookmarkFolderButtonHeight)];
1946 break;
Gaja 2014/10/07 04:39:12 Is it okay to break the loop once we found the but
1947 }
1943 } 1948 }
1944 } else if (parentButton_ != [barController_ otherBookmarksButton]) { 1949 } else if (parentButton_ != [barController_ otherBookmarksButton]) {
1945 // If all nodes have been removed from this folder then add in the 1950 // If all nodes have been removed from this folder then add in the
1946 // 'empty' placeholder button except for "Other bookmarks" folder 1951 // 'empty' placeholder button except for "Other bookmarks" folder
1947 // as we are going to hide it. 1952 // as we are going to hide it.
1948 NSRect buttonFrame = 1953 NSRect buttonFrame =
1949 GetFirstButtonFrameForHeight([self menuHeightForButtonCount:1]); 1954 GetFirstButtonFrameForHeight([self menuHeightForButtonCount:1]);
1950 BookmarkButton* button = [self makeButtonForNode:nil 1955 BookmarkButton* button = [self makeButtonForNode:nil
1951 frame:buttonFrame]; 1956 frame:buttonFrame];
1952 [buttons_ addObject:button]; 1957 [buttons_ addObject:button];
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
2003 2008
2004 - (void)setIgnoreAnimations:(BOOL)ignore { 2009 - (void)setIgnoreAnimations:(BOOL)ignore {
2005 ignoreAnimations_ = ignore; 2010 ignoreAnimations_ = ignore;
2006 } 2011 }
2007 2012
2008 - (BookmarkButton*)buttonThatMouseIsIn { 2013 - (BookmarkButton*)buttonThatMouseIsIn {
2009 return buttonThatMouseIsIn_; 2014 return buttonThatMouseIsIn_;
2010 } 2015 }
2011 2016
2012 @end // BookmarkBarFolderController 2017 @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