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

Side by Side Diff: chrome/browser/ui/cocoa/gradient_button_cell.mm

Issue 2134823002: [Material][Mac] Fix for Bookmark Subfolders Hover State (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment nit Created 4 years, 5 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 #include "chrome/browser/ui/cocoa/gradient_button_cell.h" 5 #include "chrome/browser/ui/cocoa/gradient_button_cell.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #import "base/mac/scoped_nsobject.h" 10 #import "base/mac/scoped_nsobject.h"
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 clipPath:NULL]; 586 clipPath:NULL];
587 587
588 BOOL pressed = ([((NSControl*)[self controlView]) isEnabled] && 588 BOOL pressed = ([((NSControl*)[self controlView]) isEnabled] &&
589 [self isHighlighted]); 589 [self isHighlighted]);
590 NSWindow* window = [controlView window]; 590 NSWindow* window = [controlView window];
591 const ui::ThemeProvider* themeProvider = [window themeProvider]; 591 const ui::ThemeProvider* themeProvider = [window themeProvider];
592 BOOL active = [window isKeyWindow] || [window isMainWindow]; 592 BOOL active = [window isKeyWindow] || [window isMainWindow];
593 593
594 // Stroke the borders and appropriate fill gradient. If we're borderless, the 594 // Stroke the borders and appropriate fill gradient. If we're borderless, the
595 // only time we want to draw the inner gradient is if we're highlighted or if 595 // only time we want to draw the inner gradient is if we're highlighted or if
596 // we're drawing the focus ring manually. 596 // we're drawing the focus ring manually. In Material Design, the "border" is
597 // actually a highlight, which should be drawn if
598 // |showsBorderOnlyWhileMouseInside| is true.
599 BOOL hasMaterialHighlight =
600 [self tag] == kMaterialStandardButtonTypeWithLimitedClickFeedback &&
601 ![self showsBorderOnlyWhileMouseInside];
597 if (([self isBordered] && ![self showsBorderOnlyWhileMouseInside]) || 602 if (([self isBordered] && ![self showsBorderOnlyWhileMouseInside]) ||
598 pressed || [self isMouseInside] || [self isContinuousPulsing]) { 603 pressed || [self isMouseInside] || [self isContinuousPulsing] ||
604 hasMaterialHighlight) {
599 // When pulsing we want the bookmark to stand out a little more. 605 // When pulsing we want the bookmark to stand out a little more.
600 BOOL showClickedGradient = pressed || 606 BOOL showClickedGradient = pressed ||
601 (pulseState_ == gradient_button_cell::kPulsingContinuous); 607 (pulseState_ == gradient_button_cell::kPulsingContinuous);
608 BOOL showHighlightGradient = [self isHighlighted] || hasMaterialHighlight;
602 609
603 [self drawBorderAndFillForTheme:themeProvider 610 [self drawBorderAndFillForTheme:themeProvider
604 controlView:controlView 611 controlView:controlView
605 innerPath:innerPath 612 innerPath:innerPath
606 showClickedGradient:showClickedGradient 613 showClickedGradient:showClickedGradient
607 showHighlightGradient:[self isHighlighted] 614 showHighlightGradient:showHighlightGradient
608 hoverAlpha:[self hoverAlpha] 615 hoverAlpha:[self hoverAlpha]
609 active:active 616 active:active
610 cellFrame:cellFrame 617 cellFrame:cellFrame
611 defaultGradient:nil]; 618 defaultGradient:nil];
612 } 619 }
613 620
614 // If this is the left side of a segmented button, draw a slight shadow. 621 // If this is the left side of a segmented button, draw a slight shadow.
615 ButtonType type = [[(NSControl*)controlView cell] tag]; 622 ButtonType type = [[(NSControl*)controlView cell] tag];
616 if (type == kLeftButtonWithShadowType) { 623 if (type == kLeftButtonWithShadowType) {
617 const CGFloat lineWidth = [controlView cr_lineWidth]; 624 const CGFloat lineWidth = [controlView cr_lineWidth];
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 options:options 852 options:options
846 owner:self 853 owner:self
847 userInfo:nil]); 854 userInfo:nil]);
848 if (isMouseInside_ != mouseInView) { 855 if (isMouseInside_ != mouseInView) {
849 [self setMouseInside:mouseInView animate:NO]; 856 [self setMouseInside:mouseInView animate:NO];
850 [controlView setNeedsDisplay:YES]; 857 [controlView setNeedsDisplay:YES];
851 } 858 }
852 } 859 }
853 860
854 @end 861 @end
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