Commit 1078d256 authored by spqchan's avatar spqchan Committed by Commit bot

[Material][Mac] Fixed Bookmark Items Highlight Issues

Remove calls to setHighlighted: for MD bookmark items.
Ensure that the items aren't highlighted when they are not enabled

BUG=627722, 628187, 628204

Review-Url: https://codereview.chromium.org/2169623002
Cr-Commit-Position: refs/heads/master@{#407032}
parent 5ff10302
...@@ -1971,12 +1971,10 @@ CGFloat BookmarkRightMargin() { ...@@ -1971,12 +1971,10 @@ CGFloat BookmarkRightMargin() {
[BookmarkButtonCell buttonCellWithText:text [BookmarkButtonCell buttonCellWithText:text
image:image image:image
menuController:contextMenuController_]; menuController:contextMenuController_];
if (ui::MaterialDesignController::IsModeMaterial()) { if (ui::MaterialDesignController::IsModeMaterial())
[cell setTag:kMaterialStandardButtonTypeWithLimitedClickFeedback]; [cell setTag:kMaterialStandardButtonTypeWithLimitedClickFeedback];
[cell setHighlightsBy:NSNoCellMask]; else
} else {
[cell setTag:kStandardButtonTypeWithLimitedClickFeedback]; [cell setTag:kStandardButtonTypeWithLimitedClickFeedback];
}
// Note: a quirk of setting a cell's text color is that it won't work // 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. // until the cell is associated with a button, so we can't theme the cell yet.
...@@ -2636,10 +2634,6 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) { ...@@ -2636,10 +2634,6 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) {
// Update |hoverButton_| so that it corresponds to the open folder. // Update |hoverButton_| so that it corresponds to the open folder.
hoverButton_.reset([sender retain]); hoverButton_.reset([sender retain]);
[folderTarget_ openBookmarkFolderFromButton:sender]; [folderTarget_ openBookmarkFolderFromButton:sender];
const BookmarkButtonCell* cell = [sender cell];
if ([cell tag] == kMaterialStandardButtonTypeWithLimitedClickFeedback)
[cell setHighlighted:YES];
} else { } else {
// We're over a non-folder bookmark so close any old folders. // We're over a non-folder bookmark so close any old folders.
[folderController_ close]; [folderController_ close];
...@@ -2691,7 +2685,6 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) { ...@@ -2691,7 +2685,6 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) {
parentButton = [folderController_ parentButton]; parentButton = [folderController_ parentButton];
} }
[folderController_ close]; [folderController_ close];
[[parentButton cell] setHighlighted:NO];
[parentButton setNeedsDisplay:YES]; [parentButton setNeedsDisplay:YES];
folderController_ = nil; folderController_ = nil;
} }
......
...@@ -360,16 +360,6 @@ BookmarkButton* gDraggedButton = nil; // Weak ...@@ -360,16 +360,6 @@ BookmarkButton* gDraggedButton = nil; // Weak
[delegate_ mouseExitedButton:self event:event]; [delegate_ mouseExitedButton:self event:event];
} }
- (void)mouseDown:(NSEvent*)theEvent {
// Clicking on a bookmark button in Material Design should highlight it.
const int kCellTag = [[self cell] tag];
if (kCellTag == kMaterialStandardButtonTypeWithLimitedClickFeedback &&
[self isEnabled]) {
[self highlight:YES];
}
[super mouseDown:theEvent];
}
- (void)mouseMoved:(NSEvent*)theEvent { - (void)mouseMoved:(NSEvent*)theEvent {
if ([delegate_ respondsToSelector:@selector(mouseMoved:)]) if ([delegate_ respondsToSelector:@selector(mouseMoved:)])
[id(delegate_) mouseMoved:theEvent]; [id(delegate_) mouseMoved:theEvent];
......
...@@ -346,8 +346,6 @@ static const NSTimeInterval kAnimationContinuousCycleDuration = 0.4; ...@@ -346,8 +346,6 @@ static const NSTimeInterval kAnimationContinuousCycleDuration = 0.4;
[super setShowsBorderOnlyWhileMouseInside:showOnly]; [super setShowsBorderOnlyWhileMouseInside:showOnly];
if (showOnly) { if (showOnly) {
[self updateTrackingAreas]; [self updateTrackingAreas];
if ([self tag] == kMaterialStandardButtonTypeWithLimitedClickFeedback)
[self setHighlighted:isMouseInside_];
} else { } else {
if (trackingArea_) { if (trackingArea_) {
[[self controlView] removeTrackingArea:trackingArea_]; [[self controlView] removeTrackingArea:trackingArea_];
...@@ -585,8 +583,8 @@ static const NSTimeInterval kAnimationContinuousCycleDuration = 0.4; ...@@ -585,8 +583,8 @@ static const NSTimeInterval kAnimationContinuousCycleDuration = 0.4;
innerPath:&innerPath innerPath:&innerPath
clipPath:NULL]; clipPath:NULL];
BOOL pressed = ([((NSControl*)[self controlView]) isEnabled] && BOOL enabled = [((NSControl*)[self controlView]) isEnabled];
[self isHighlighted]); BOOL pressed = enabled && [self isHighlighted];
NSWindow* window = [controlView window]; NSWindow* window = [controlView window];
const ui::ThemeProvider* themeProvider = [window themeProvider]; const ui::ThemeProvider* themeProvider = [window themeProvider];
BOOL active = [window isKeyWindow] || [window isMainWindow]; BOOL active = [window isKeyWindow] || [window isMainWindow];
...@@ -598,7 +596,8 @@ static const NSTimeInterval kAnimationContinuousCycleDuration = 0.4; ...@@ -598,7 +596,8 @@ static const NSTimeInterval kAnimationContinuousCycleDuration = 0.4;
// |showsBorderOnlyWhileMouseInside| is true. // |showsBorderOnlyWhileMouseInside| is true.
BOOL hasMaterialHighlight = BOOL hasMaterialHighlight =
[self tag] == kMaterialStandardButtonTypeWithLimitedClickFeedback && [self tag] == kMaterialStandardButtonTypeWithLimitedClickFeedback &&
![self showsBorderOnlyWhileMouseInside]; ![self showsBorderOnlyWhileMouseInside] &&
enabled;
if (([self isBordered] && ![self showsBorderOnlyWhileMouseInside]) || if (([self isBordered] && ![self showsBorderOnlyWhileMouseInside]) ||
pressed || [self isMouseInside] || [self isContinuousPulsing] || pressed || [self isMouseInside] || [self isContinuousPulsing] ||
hasMaterialHighlight) { hasMaterialHighlight) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment