| OLD | NEW |
| 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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 break; | 539 break; |
| 540 } | 540 } |
| 541 if (type == kLeftButtonWithShadowType) | 541 if (type == kLeftButtonWithShadowType) |
| 542 innerFrame.size.width -= 1.0; | 542 innerFrame.size.width -= 1.0; |
| 543 | 543 |
| 544 // Return results if |return...| not null. | 544 // Return results if |return...| not null. |
| 545 if (returnInnerFrame) | 545 if (returnInnerFrame) |
| 546 *returnInnerFrame = innerFrame; | 546 *returnInnerFrame = innerFrame; |
| 547 if (returnInnerPath) { | 547 if (returnInnerPath) { |
| 548 DCHECK(*returnInnerPath == nil); | 548 DCHECK(*returnInnerPath == nil); |
| 549 // In Material Design on Retina, nudge the hover background by 1px. |
| 550 if ([self tag] == kMaterialStandardButtonTypeWithLimitedClickFeedback && |
| 551 kLineWidth < 1) { |
| 552 drawFrame.origin.y -= kLineWidth; |
| 553 } |
| 554 |
| 549 *returnInnerPath = [NSBezierPath bezierPathWithRoundedRect:drawFrame | 555 *returnInnerPath = [NSBezierPath bezierPathWithRoundedRect:drawFrame |
| 550 xRadius:cornerRadius | 556 xRadius:cornerRadius |
| 551 yRadius:cornerRadius]; | 557 yRadius:cornerRadius]; |
| 552 [*returnInnerPath setLineWidth:kLineWidth]; | 558 [*returnInnerPath setLineWidth:kLineWidth]; |
| 553 } | 559 } |
| 554 if (returnClipPath) { | 560 if (returnClipPath) { |
| 555 DCHECK(*returnClipPath == nil); | 561 DCHECK(*returnClipPath == nil); |
| 556 NSRect clipPathRect = | 562 NSRect clipPathRect = |
| 557 NSInsetRect(drawFrame, -kHalfLineWidth, -kHalfLineWidth); | 563 NSInsetRect(drawFrame, -kHalfLineWidth, -kHalfLineWidth); |
| 558 *returnClipPath = [NSBezierPath | 564 *returnClipPath = [NSBezierPath |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 options:options | 834 options:options |
| 829 owner:self | 835 owner:self |
| 830 userInfo:nil]); | 836 userInfo:nil]); |
| 831 if (isMouseInside_ != mouseInView) { | 837 if (isMouseInside_ != mouseInView) { |
| 832 [self setMouseInside:mouseInView animate:NO]; | 838 [self setMouseInside:mouseInView animate:NO]; |
| 833 [controlView setNeedsDisplay:YES]; | 839 [controlView setNeedsDisplay:YES]; |
| 834 } | 840 } |
| 835 } | 841 } |
| 836 | 842 |
| 837 @end | 843 @end |
| OLD | NEW |