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

Side by Side Diff: chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm

Issue 1781593005: Fix regression in dragging location bar right edge (Mac). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@md_extensions_buttons
Patch Set: Created 4 years, 9 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 | chrome/browser/ui/cocoa/toolbar/toolbar_controller.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) 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/extensions/browser_actions_controller.h" 5 #import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 gfx::Rect frameRect = toolbarActionsBar_->GetFrameForIndex(index); 881 gfx::Rect frameRect = toolbarActionsBar_->GetFrameForIndex(index);
882 int iconWidth = ToolbarActionsBar::IconWidth(false); 882 int iconWidth = ToolbarActionsBar::IconWidth(false);
883 // The toolbar actions bar will return an empty rect if the index is for an 883 // The toolbar actions bar will return an empty rect if the index is for an
884 // action that is before range we show (i.e., is for a button that's on the 884 // action that is before range we show (i.e., is for a button that's on the
885 // main bar, and this is the overflow). Set the frame to be outside the bounds 885 // main bar, and this is the overflow). Set the frame to be outside the bounds
886 // of the view. 886 // of the view.
887 NSRect frame = frameRect.IsEmpty() ? 887 NSRect frame = frameRect.IsEmpty() ?
888 NSMakeRect(-iconWidth - 1, 0, iconWidth, 888 NSMakeRect(-iconWidth - 1, 0, iconWidth,
889 ToolbarActionsBar::IconHeight()) : 889 ToolbarActionsBar::IconHeight()) :
890 NSRectFromCGRect(frameRect.ToCGRect()); 890 NSRectFromCGRect(frameRect.ToCGRect());
891 // On Material Design, inset the items by the left padding.
892 if (ui::MaterialDesignController::IsModeMaterial()) {
893 frame.origin.x += toolbarActionsBar_->platform_settings().left_padding;
894 }
891 // We need to flip the y coordinate for Cocoa's view system. 895 // We need to flip the y coordinate for Cocoa's view system.
892 frame.origin.y = NSHeight([containerView_ frame]) - NSMaxY(frame); 896 frame.origin.y = NSHeight([containerView_ frame]) - NSMaxY(frame);
893 return frame; 897 return frame;
894 } 898 }
895 899
896 - (NSPoint)popupPointForView:(NSView*)view 900 - (NSPoint)popupPointForView:(NSView*)view
897 withBounds:(NSRect)bounds { 901 withBounds:(NSRect)bounds {
898 // Anchor point just above the center of the bottom. 902 // Anchor point just above the center of the bottom.
899 int y = [view isFlipped] ? NSMaxY(bounds) - kBrowserActionBubbleYOffset : 903 int y = [view isFlipped] ? NSMaxY(bounds) - kBrowserActionBubbleYOffset :
900 kBrowserActionBubbleYOffset; 904 kBrowserActionBubbleYOffset;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 } 1075 }
1072 1076
1073 #pragma mark - 1077 #pragma mark -
1074 #pragma mark Testing Methods 1078 #pragma mark Testing Methods
1075 1079
1076 - (BrowserActionButton*)buttonWithIndex:(NSUInteger)index { 1080 - (BrowserActionButton*)buttonWithIndex:(NSUInteger)index {
1077 return index < [buttons_ count] ? [buttons_ objectAtIndex:index] : nil; 1081 return index < [buttons_ count] ? [buttons_ objectAtIndex:index] : nil;
1078 } 1082 }
1079 1083
1080 @end 1084 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698