| Index: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm
|
| diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm
|
| index 0b7f2aa3064225b9d7d285f20af5f54590e44202..9a8f38a4553e2b328bcac6b9234d159d6e06b4fa 100644
|
| --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm
|
| +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm
|
| @@ -67,6 +67,7 @@
|
| #import "ui/base/cocoa/cocoa_base_utils.h"
|
| #import "ui/base/cocoa/nsview_additions.h"
|
| #include "ui/base/l10n/l10n_util_mac.h"
|
| +#include "ui/base/material_design/material_design_controller.h"
|
| #include "ui/base/resource/resource_bundle.h"
|
| #include "ui/gfx/image/image.h"
|
| #include "ui/resources/grit/ui_resources.h"
|
| @@ -244,6 +245,38 @@ void RecordAppLaunch(Profile* profile, GURL url) {
|
|
|
| @end
|
|
|
| +namespace bookmarks {
|
| +
|
| +CGFloat BookmarkHorizontalPadding() {
|
| + if (!ui::MaterialDesignController::IsModeMaterial()) {
|
| + return 1.0;
|
| + }
|
| + return 16.0;
|
| +}
|
| +
|
| +CGFloat BookmarkVerticalPadding() {
|
| + if (!ui::MaterialDesignController::IsModeMaterial()) {
|
| + return 2.0;
|
| + }
|
| + return 4.0;
|
| +}
|
| +
|
| +CGFloat BookmarkLeftMargin() {
|
| + if (!ui::MaterialDesignController::IsModeMaterial()) {
|
| + return 2.0;
|
| + }
|
| + return 10.0;
|
| +}
|
| +
|
| +CGFloat BookmarkRightMargin() {
|
| + if (!ui::MaterialDesignController::IsModeMaterial()) {
|
| + return 2.0;
|
| + }
|
| + return 10.0;
|
| +}
|
| +
|
| +} // namespace bookmarks
|
| +
|
| @implementation BookmarkBarController
|
|
|
| @synthesize currentState = currentState_;
|
| @@ -275,6 +308,10 @@ void RecordAppLaunch(Profile* profile, GURL url) {
|
| ResourceBundle& rb = ResourceBundle::GetSharedInstance();
|
| folderImage_.reset(
|
| rb.GetNativeImageNamed(IDR_BOOKMARK_BAR_FOLDER).CopyNSImage());
|
| + if (ui::MaterialDesignController::IsModeMaterial()) {
|
| + folderImageWhite_.reset(
|
| + rb.GetNativeImageNamed(IDR_BOOKMARK_BAR_FOLDER_WHITE).CopyNSImage());
|
| + }
|
| defaultImage_.reset(
|
| rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON).CopyNSImage());
|
|
|
| @@ -533,7 +570,12 @@ void RecordAppLaunch(Profile* profile, GURL url) {
|
| // Add padding to the detached bookmark bar.
|
| // The state of our morph (if any); 1 is total bubble, 0 is the regular bar.
|
| CGFloat morph = [self detachedMorphProgress];
|
| - CGFloat padding = bookmarks::kNTPBookmarkBarPadding;
|
| + CGFloat padding = 0;
|
| + if (ui::MaterialDesignController::IsModeMaterial()) {
|
| + padding = bookmarks::kMaterialNTPBookmarkBarPadding;
|
| + } else {
|
| + padding = bookmarks::kNTPBookmarkBarPadding;
|
| + }
|
| buttonViewFrame =
|
| NSInsetRect(buttonViewFrame, morph * padding, morph * padding);
|
|
|
| @@ -630,25 +672,44 @@ void RecordAppLaunch(Profile* profile, GURL url) {
|
| return [self isInState:BookmarkBar::SHOW] ? 0 : 1;
|
| }
|
|
|
| -- (NSImage*)faviconForNode:(const BookmarkNode*)node {
|
| +- (NSImage*)faviconForNode:(const BookmarkNode*)node
|
| + forADarkTheme:(BOOL)forADarkTheme {
|
| if (!node)
|
| return defaultImage_;
|
|
|
| - if (node == managedBookmarkService_->managed_node()) {
|
| - // Most users never see this node, so the image is only loaded if needed.
|
| - ResourceBundle& rb = ResourceBundle::GetSharedInstance();
|
| - return rb.GetNativeImageNamed(IDR_BOOKMARK_BAR_FOLDER_MANAGED).ToNSImage();
|
| - }
|
| + if (forADarkTheme && ui::MaterialDesignController::IsModeMaterial()) {
|
| + if (node == managedBookmarkService_->managed_node()) {
|
| + ResourceBundle& rb = ResourceBundle::GetSharedInstance();
|
| + return rb.GetNativeImageNamed(
|
| + IDR_BOOKMARK_BAR_FOLDER_MANAGED_WHITE).ToNSImage();
|
| + }
|
|
|
| - if (node == managedBookmarkService_->supervised_node()) {
|
| - // Most users never see this node, so the image is only loaded if needed.
|
| - ResourceBundle& rb = ResourceBundle::GetSharedInstance();
|
| - return rb.GetNativeImageNamed(
|
| - IDR_BOOKMARK_BAR_FOLDER_SUPERVISED).ToNSImage();
|
| - }
|
| + if (node == managedBookmarkService_->supervised_node()) {
|
| + ResourceBundle& rb = ResourceBundle::GetSharedInstance();
|
| + return rb.GetNativeImageNamed(
|
| + IDR_BOOKMARK_BAR_FOLDER_SUPERVISED_WHITE).ToNSImage();
|
| + }
|
| +
|
| + if (node->is_folder())
|
| + return folderImageWhite_;
|
| + } else {
|
| + if (node == managedBookmarkService_->managed_node()) {
|
| + // Most users never see this node, so the image is only loaded if needed.
|
| + ResourceBundle& rb = ResourceBundle::GetSharedInstance();
|
| + return rb.GetNativeImageNamed(
|
| + IDR_BOOKMARK_BAR_FOLDER_MANAGED).ToNSImage();
|
| + }
|
| +
|
| + if (node == managedBookmarkService_->supervised_node()) {
|
| + // Most users never see this node, so the image is only loaded if needed.
|
| + ResourceBundle& rb = ResourceBundle::GetSharedInstance();
|
| + return rb.GetNativeImageNamed(
|
| + IDR_BOOKMARK_BAR_FOLDER_SUPERVISED).ToNSImage();
|
| + }
|
|
|
| - if (node->is_folder())
|
| - return folderImage_;
|
| + if (node->is_folder())
|
| + return folderImage_;
|
| + }
|
|
|
| const gfx::Image& favicon = bookmarkModel_->GetFavicon(node);
|
| if (!favicon.IsEmpty())
|
| @@ -827,7 +888,7 @@ void RecordAppLaunch(Profile* profile, GURL url) {
|
| // Position the right-side buttons including the off-the-side chevron.
|
| - (void)positionRightSideButtons {
|
| int maxX = NSMaxX([[self buttonView] bounds]) -
|
| - bookmarks::kBookmarkHorizontalPadding;
|
| + bookmarks::BookmarkHorizontalPadding();
|
| int right = maxX;
|
|
|
| int ignored = 0;
|
| @@ -1052,7 +1113,7 @@ void RecordAppLaunch(Profile* profile, GURL url) {
|
| action:nil
|
| keyEquivalent:@""] autorelease];
|
| [menu addItem:item];
|
| - [item setImage:[self faviconForNode:child]];
|
| + [item setImage:[self faviconForNode:child forADarkTheme:NO]];
|
| if (child->is_folder()) {
|
| NSMenu* submenu = [[[NSMenu alloc] initWithTitle:title] autorelease];
|
| [menu setSubmenu:submenu forItem:item];
|
| @@ -1138,7 +1199,7 @@ void RecordAppLaunch(Profile* profile, GURL url) {
|
|
|
| CGFloat maxViewX = NSMaxX([[self view] bounds]);
|
| int xOffset =
|
| - bookmarks::kBookmarkLeftMargin - bookmarks::kBookmarkHorizontalPadding;
|
| + bookmarks::BookmarkLeftMargin() - bookmarks::BookmarkHorizontalPadding();
|
|
|
| // Draw the apps bookmark if needed.
|
| if (![appsPageShortcutButton_ isHidden]) {
|
| @@ -1150,7 +1211,7 @@ void RecordAppLaunch(Profile* profile, GURL url) {
|
|
|
| // Draw the managed bookmark folder if needed.
|
| if (![managedBookmarksButton_ isHidden]) {
|
| - xOffset += bookmarks::kBookmarkHorizontalPadding;
|
| + xOffset += bookmarks::BookmarkHorizontalPadding();
|
| NSRect frame =
|
| [self frameForBookmarkButtonFromCell:[managedBookmarksButton_ cell]
|
| xOffset:&xOffset];
|
| @@ -1159,7 +1220,7 @@ void RecordAppLaunch(Profile* profile, GURL url) {
|
|
|
| // Draw the supervised bookmark folder if needed.
|
| if (![supervisedBookmarksButton_ isHidden]) {
|
| - xOffset += bookmarks::kBookmarkHorizontalPadding;
|
| + xOffset += bookmarks::BookmarkHorizontalPadding();
|
| NSRect frame =
|
| [self frameForBookmarkButtonFromCell:[supervisedBookmarksButton_ cell]
|
| xOffset:&xOffset];
|
| @@ -1236,7 +1297,7 @@ void RecordAppLaunch(Profile* profile, GURL url) {
|
| NSMutableArray* buttons = [self buttons];
|
| for (NSButton* button in buttons) {
|
| if (NSMaxX([button frame]) > (NSMinX([offTheSideButton_ frame]) -
|
| - bookmarks::kBookmarkHorizontalPadding))
|
| + bookmarks::BookmarkHorizontalPadding()))
|
| break;
|
| [buttonView_ addSubview:button];
|
| ++displayedButtonCount_;
|
| @@ -1620,25 +1681,25 @@ void RecordAppLaunch(Profile* profile, GURL url) {
|
| // Returns NSZeroRect if there is no such button in the bookmark bar.
|
| // Enables you to work out where a button will end up when it is done animating.
|
| - (NSRect)finalRectOfButton:(BookmarkButton*)wantedButton {
|
| - CGFloat left = bookmarks::kBookmarkLeftMargin;
|
| + CGFloat left = bookmarks::BookmarkLeftMargin();
|
| NSRect buttonFrame = NSZeroRect;
|
|
|
| // Draw the apps bookmark if needed.
|
| if (![appsPageShortcutButton_ isHidden]) {
|
| left = NSMaxX([appsPageShortcutButton_ frame]) +
|
| - bookmarks::kBookmarkHorizontalPadding;
|
| + bookmarks::BookmarkHorizontalPadding();
|
| }
|
|
|
| // Draw the managed bookmarks folder if needed.
|
| if (![managedBookmarksButton_ isHidden]) {
|
| left = NSMaxX([managedBookmarksButton_ frame]) +
|
| - bookmarks::kBookmarkHorizontalPadding;
|
| + bookmarks::BookmarkHorizontalPadding();
|
| }
|
|
|
| // Draw the supervised bookmarks folder if needed.
|
| if (![supervisedBookmarksButton_ isHidden]) {
|
| left = NSMaxX([supervisedBookmarksButton_ frame]) +
|
| - bookmarks::kBookmarkHorizontalPadding;
|
| + bookmarks::BookmarkHorizontalPadding();
|
| }
|
|
|
| for (NSButton* button in buttons_.get()) {
|
| @@ -1647,7 +1708,7 @@ void RecordAppLaunch(Profile* profile, GURL url) {
|
| continue;
|
| buttonFrame = [button frame];
|
| buttonFrame.origin.x = left;
|
| - left += buttonFrame.size.width + bookmarks::kBookmarkHorizontalPadding;
|
| + left += buttonFrame.size.width + bookmarks::BookmarkHorizontalPadding();
|
| if (button == wantedButton)
|
| return buttonFrame;
|
| }
|
| @@ -1666,14 +1727,14 @@ void RecordAppLaunch(Profile* profile, GURL url) {
|
| // If necessary, pull in the width to account for the Other Bookmarks button.
|
| if ([self setOtherBookmarksButtonVisibility]) {
|
| maxViewX = [otherBookmarksButton_ frame].origin.x -
|
| - bookmarks::kBookmarkRightMargin;
|
| + bookmarks::BookmarkRightMargin();
|
| }
|
|
|
| [self positionRightSideButtons];
|
| // If we're already overflowing, then we need to account for the chevron.
|
| if (visible) {
|
| maxViewX =
|
| - [offTheSideButton_ frame].origin.x - bookmarks::kBookmarkRightMargin;
|
| + [offTheSideButton_ frame].origin.x - bookmarks::BookmarkRightMargin();
|
| }
|
|
|
| return maxViewX;
|
| @@ -1712,19 +1773,19 @@ void RecordAppLaunch(Profile* profile, GURL url) {
|
| int xOffset;
|
| if (displayedButtonCount_ > 0) {
|
| xOffset = NSMaxX([self finalRectOfLastButton]) +
|
| - bookmarks::kBookmarkHorizontalPadding;
|
| + bookmarks::BookmarkHorizontalPadding();
|
| } else if (![managedBookmarksButton_ isHidden]) {
|
| xOffset = NSMaxX([managedBookmarksButton_ frame]) +
|
| - bookmarks::kBookmarkHorizontalPadding;
|
| + bookmarks::BookmarkHorizontalPadding();
|
| } else if (![supervisedBookmarksButton_ isHidden]) {
|
| xOffset = NSMaxX([supervisedBookmarksButton_ frame]) +
|
| - bookmarks::kBookmarkHorizontalPadding;
|
| + bookmarks::BookmarkHorizontalPadding();
|
| } else if (![appsPageShortcutButton_ isHidden]) {
|
| xOffset = NSMaxX([appsPageShortcutButton_ frame]) +
|
| - bookmarks::kBookmarkHorizontalPadding;
|
| + bookmarks::BookmarkHorizontalPadding();
|
| } else {
|
| - xOffset = bookmarks::kBookmarkLeftMargin -
|
| - bookmarks::kBookmarkHorizontalPadding;
|
| + xOffset = bookmarks::BookmarkLeftMargin() -
|
| + bookmarks::BookmarkHorizontalPadding();
|
| }
|
| for (int i = displayedButtonCount_; i < barCount; ++i) {
|
| const BookmarkNode* child = node->GetChild(i);
|
| @@ -1813,13 +1874,19 @@ void RecordAppLaunch(Profile* profile, GURL url) {
|
| // Return an autoreleased NSCell suitable for a bookmark button.
|
| // TODO(jrg): move much of the cell config into the BookmarkButtonCell class.
|
| - (BookmarkButtonCell*)cellForBookmarkNode:(const BookmarkNode*)node {
|
| - NSImage* image = node ? [self faviconForNode:node] : nil;
|
| + BOOL darkTheme = [[[self view] window] hasDarkTheme];
|
| + NSImage* image = node ? [self faviconForNode:node forADarkTheme:darkTheme]
|
| + : nil;
|
| BookmarkButtonCell* cell =
|
| [BookmarkButtonCell buttonCellForNode:node
|
| text:nil
|
| image:image
|
| menuController:contextMenuController_];
|
| - [cell setTag:kStandardButtonTypeWithLimitedClickFeedback];
|
| + if (ui::MaterialDesignController::IsModeMaterial()) {
|
| + [cell setTag:kMaterialStandardButtonTypeWithLimitedClickFeedback];
|
| + } else {
|
| + [cell setTag:kStandardButtonTypeWithLimitedClickFeedback];
|
| + }
|
|
|
| // Note: a quirk of setting a cell's text color is that it won't work
|
| // until the cell is associated with a button, so we can't theme the cell yet.
|
| @@ -1836,7 +1903,11 @@ void RecordAppLaunch(Profile* profile, GURL url) {
|
| [BookmarkButtonCell buttonCellWithText:text
|
| image:image
|
| menuController:contextMenuController_];
|
| - [cell setTag:kStandardButtonTypeWithLimitedClickFeedback];
|
| + if (ui::MaterialDesignController::IsModeMaterial()) {
|
| + [cell setTag:kMaterialStandardButtonTypeWithLimitedClickFeedback];
|
| + } else {
|
| + [cell setTag:kStandardButtonTypeWithLimitedClickFeedback];
|
| + }
|
|
|
| // Note: a quirk of setting a cell's text color is that it won't work
|
| // until the cell is associated with a button, so we can't theme the cell yet.
|
| @@ -1852,11 +1923,15 @@ void RecordAppLaunch(Profile* profile, GURL url) {
|
| xOffset:(int*)xOffset {
|
| DCHECK(xOffset);
|
| NSRect bounds = [buttonView_ bounds];
|
| - bounds.size.height = bookmarks::kBookmarkButtonHeight;
|
| + if (ui::MaterialDesignController::IsModeMaterial()) {
|
| + bounds.size.height = bookmarks::kMaterialBookmarkButtonHeight;
|
| + } else {
|
| + bounds.size.height = bookmarks::kBookmarkButtonHeight;
|
| + }
|
|
|
| NSRect frame = NSInsetRect(bounds,
|
| - bookmarks::kBookmarkHorizontalPadding,
|
| - bookmarks::kBookmarkVerticalPadding);
|
| + bookmarks::BookmarkHorizontalPadding(),
|
| + bookmarks::BookmarkVerticalPadding());
|
| frame.size.width = [self widthForBookmarkButtonCell:cell];
|
|
|
| // Add an X offset based on what we've already done
|
| @@ -2159,15 +2234,15 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) {
|
| CGFloat left;
|
| if (![supervisedBookmarksButton_ isHidden]) {
|
| left = NSMaxX([supervisedBookmarksButton_ frame]) +
|
| - bookmarks::kBookmarkHorizontalPadding;
|
| + bookmarks::BookmarkHorizontalPadding();
|
| } else if (![managedBookmarksButton_ isHidden]) {
|
| left = NSMaxX([managedBookmarksButton_ frame]) +
|
| - bookmarks::kBookmarkHorizontalPadding;
|
| + bookmarks::BookmarkHorizontalPadding();
|
| } else if (![appsPageShortcutButton_ isHidden]) {
|
| left = NSMaxX([appsPageShortcutButton_ frame]) +
|
| - bookmarks::kBookmarkHorizontalPadding;
|
| + bookmarks::BookmarkHorizontalPadding();
|
| } else {
|
| - left = bookmarks::kBookmarkLeftMargin;
|
| + left = bookmarks::BookmarkLeftMargin();
|
| }
|
| CGFloat paddingWidth = bookmarks::kDefaultBookmarkWidth;
|
| BookmarkButton* draggedButton = [BookmarkButton draggedButton];
|
| @@ -2190,7 +2265,7 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) {
|
| left += buttonFrame.size.width;
|
| if (left > insertionPos_)
|
| buttonFrame.origin.x += paddingWidth;
|
| - left += bookmarks::kBookmarkHorizontalPadding;
|
| + left += bookmarks::BookmarkHorizontalPadding();
|
| if (innerContentAnimationsEnabled_)
|
| [[button animator] setFrame:buttonFrame];
|
| else
|
| @@ -2206,15 +2281,15 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) {
|
| - (void)resetAllButtonPositionsWithAnimation:(BOOL)animate {
|
|
|
| // Position the apps bookmark if needed.
|
| - CGFloat left = bookmarks::kBookmarkLeftMargin;
|
| + CGFloat left = bookmarks::BookmarkLeftMargin();
|
| if (![appsPageShortcutButton_ isHidden]) {
|
| - int xOffset =
|
| - bookmarks::kBookmarkLeftMargin - bookmarks::kBookmarkHorizontalPadding;
|
| + int xOffset = bookmarks::BookmarkLeftMargin() -
|
| + bookmarks::BookmarkHorizontalPadding();
|
| NSRect frame =
|
| [self frameForBookmarkButtonFromCell:[appsPageShortcutButton_ cell]
|
| xOffset:&xOffset];
|
| [appsPageShortcutButton_ setFrame:frame];
|
| - left = xOffset + bookmarks::kBookmarkHorizontalPadding;
|
| + left = xOffset + bookmarks::BookmarkHorizontalPadding();
|
| }
|
|
|
| // Position the managed bookmarks folder if needed.
|
| @@ -2224,7 +2299,7 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) {
|
| [self frameForBookmarkButtonFromCell:[managedBookmarksButton_ cell]
|
| xOffset:&xOffset];
|
| [managedBookmarksButton_ setFrame:frame];
|
| - left = xOffset + bookmarks::kBookmarkHorizontalPadding;
|
| + left = xOffset + bookmarks::BookmarkHorizontalPadding();
|
| }
|
|
|
| // Position the supervised bookmarks folder if needed.
|
| @@ -2234,7 +2309,7 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) {
|
| [self frameForBookmarkButtonFromCell:[supervisedBookmarksButton_ cell]
|
| xOffset:&xOffset];
|
| [supervisedBookmarksButton_ setFrame:frame];
|
| - left = xOffset + bookmarks::kBookmarkHorizontalPadding;
|
| + left = xOffset + bookmarks::BookmarkHorizontalPadding();
|
| }
|
|
|
| animate &= innerContentAnimationsEnabled_;
|
| @@ -2245,7 +2320,7 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) {
|
| continue;
|
| NSRect buttonFrame = [button frame];
|
| buttonFrame.origin.x = left;
|
| - left += buttonFrame.size.width + bookmarks::kBookmarkHorizontalPadding;
|
| + left += buttonFrame.size.width + bookmarks::BookmarkHorizontalPadding();
|
| if (animate)
|
| [[button animator] setFrame:buttonFrame];
|
| else
|
| @@ -2374,8 +2449,10 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) {
|
| for (BookmarkButton* button in buttons_.get()) {
|
| const BookmarkNode* cellnode = [button bookmarkNode];
|
| if (cellnode == node) {
|
| + BOOL darkTheme = [[[self view] window] hasDarkTheme];
|
| + NSImage* theImage = [self faviconForNode:node forADarkTheme:darkTheme];
|
| [[button cell] setBookmarkCellText:[button title]
|
| - image:[self faviconForNode:node]];
|
| + image:theImage];
|
| // Adding an image means we might need more room for the
|
| // bookmark. Test for it by growing the button (if needed)
|
| // and shifting everything else over.
|
| @@ -2538,7 +2615,16 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) {
|
| // bookmark folders, not a button context menu.
|
| - (void)closeAllBookmarkFolders {
|
| [self watchForExitEvent:NO];
|
| +
|
| + // Grab the parent button under Material Design to make sure that the
|
| + // highlighting that was applied while revealing the menu is turned off.
|
| + BookmarkButton* parentButton = nil;
|
| + if (!ui::MaterialDesignController::IsModeMaterial()) {
|
| + parentButton = [folderController_ parentButton];
|
| + }
|
| [folderController_ close];
|
| + [[parentButton cell] setHighlighted:NO];
|
| + [parentButton setNeedsDisplay:YES];
|
| folderController_ = nil;
|
| }
|
|
|
| @@ -2681,7 +2767,7 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) {
|
| // Return the x position for a drop indicator.
|
| - (CGFloat)indicatorPosForDragToPoint:(NSPoint)point {
|
| CGFloat x = 0;
|
| - CGFloat halfHorizontalPadding = 0.5 * bookmarks::kBookmarkHorizontalPadding;
|
| + CGFloat halfHorizontalPadding = 0.5 * bookmarks::BookmarkHorizontalPadding();
|
| int destIndex = [self indexForDragToPoint:point];
|
| int numButtons = displayedButtonCount_;
|
|
|
| @@ -2694,7 +2780,7 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) {
|
| } else if (![appsPageShortcutButton_ isHidden]) {
|
| leftmostX = NSMaxX([appsPageShortcutButton_ frame]) + halfHorizontalPadding;
|
| } else {
|
| - leftmostX = bookmarks::kBookmarkLeftMargin - halfHorizontalPadding;
|
| + leftmostX = bookmarks::BookmarkLeftMargin() - halfHorizontalPadding;
|
| }
|
|
|
| // If it's a drop strictly between existing buttons ...
|
| @@ -2797,7 +2883,7 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) {
|
| - (void)addButtonForNode:(const BookmarkNode*)node
|
| atIndex:(NSInteger)buttonIndex {
|
| int newOffset =
|
| - bookmarks::kBookmarkLeftMargin - bookmarks::kBookmarkHorizontalPadding;
|
| + bookmarks::BookmarkLeftMargin() - bookmarks::BookmarkHorizontalPadding();
|
| if (buttonIndex == -1)
|
| buttonIndex = [buttons_ count]; // New button goes at the end.
|
| if (buttonIndex <= (NSInteger)[buttons_ count]) {
|
| @@ -2805,7 +2891,7 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) {
|
| BookmarkButton* targetButton = [buttons_ objectAtIndex:buttonIndex - 1];
|
| NSRect targetFrame = [targetButton frame];
|
| newOffset = targetFrame.origin.x + NSWidth(targetFrame) +
|
| - bookmarks::kBookmarkHorizontalPadding;
|
| + bookmarks::BookmarkHorizontalPadding();
|
| }
|
| BookmarkButton* newButton = [self buttonForNode:node xOffset:&newOffset];
|
| ++displayedButtonCount_;
|
|
|