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

Unified Diff: Source/core/platform/mac/ThemeMac.mm

Issue 14413014: Remove -webkit-appearance:default-button. This was only used in Safari. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/platform/ThemeTypes.h ('k') | Source/core/platform/mac/WebCoreSystemInterface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/platform/mac/ThemeMac.mm
diff --git a/Source/core/platform/mac/ThemeMac.mm b/Source/core/platform/mac/ThemeMac.mm
index 1b007339dfd5cbd4dc5ac43287ee6587ce5c42f4..2e5a3cdf372a6751ad55e0ca1fa96139bd9eba23 100644
--- a/Source/core/platform/mac/ThemeMac.mm
+++ b/Source/core/platform/mac/ThemeMac.mm
@@ -30,7 +30,6 @@
#import "BlockExceptions.h"
#import "LocalCurrentGraphicsContext.h"
#import "WebCoreNSCellExtras.h"
-#import "WebCoreSystemInterface.h"
#import "core/platform/ScrollView.h"
#import "core/platform/graphics/GraphicsContext.h"
#include <wtf/StdLibExtras.h>
@@ -90,8 +89,6 @@ NSRect focusRingClipRect;
@end
-// FIXME: Default buttons really should be more like push buttons and not like buttons.
-
namespace WebCore {
enum {
@@ -409,18 +406,6 @@ static const int* buttonMargins(NSControlSize controlSize)
return margins[controlSize];
}
-enum ButtonCellType { NormalButtonCell, DefaultButtonCell };
-
-static NSButtonCell *leakButtonCell(ButtonCellType type)
-{
- NSButtonCell *cell = [[NSButtonCell alloc] init];
- [cell setTitle:nil];
- [cell setButtonType:NSMomentaryPushInButton];
- if (type == DefaultButtonCell)
- [cell setKeyEquivalent:@"\r"];
- return cell;
-}
-
static void setUpButtonCell(NSButtonCell *cell, ControlPart part, ControlStates states, const IntRect& zoomedRect, float zoomFactor)
{
// Set the control size based off the rectangle we're painting into.
@@ -440,15 +425,13 @@ static void setUpButtonCell(NSButtonCell *cell, ControlPart part, ControlStates
static NSButtonCell *button(ControlPart part, ControlStates states, const IntRect& zoomedRect, float zoomFactor)
{
- NSButtonCell *cell;
- if (states & DefaultState) {
- static NSButtonCell *defaultCell = leakButtonCell(DefaultButtonCell);
- cell = defaultCell;
- } else {
- static NSButtonCell *normalCell = leakButtonCell(NormalButtonCell);
- cell = normalCell;
+ static NSButtonCell *cell = nil;
+ if (!cell) {
+ cell = [[NSButtonCell alloc] init];
+ [cell setTitle:nil];
+ [cell setButtonType:NSMomentaryPushInButton];
}
- setUpButtonCell(cell, part, states, zoomedRect, zoomFactor);
+ setUpButtonCell(cell, part, states, zoomedRect, zoomFactor);
return cell;
}
@@ -487,13 +470,6 @@ static void paintButton(ControlPart part, ControlStates states, GraphicsContext*
LocalCurrentGraphicsContext localContext(context);
NSView *view = ThemeMac::ensuredView(scrollView);
NSWindow *window = [view window];
- NSButtonCell *previousDefaultButtonCell = [window defaultButtonCell];
-
- if (states & DefaultState) {
- [window setDefaultButtonCell:buttonCell];
- WKAdvanceDefaultButtonPulseAnimation(buttonCell);
- } else if ([previousDefaultButtonCell isEqual:buttonCell])
- [window setDefaultButtonCell:nil];
[buttonCell drawWithFrame:NSRect(inflatedRect) inView:view];
#if !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING
@@ -502,9 +478,6 @@ static void paintButton(ControlPart part, ControlStates states, GraphicsContext*
#endif
[buttonCell setControlView:nil];
- if (![previousDefaultButtonCell isEqual:buttonCell])
- [window setDefaultButtonCell:previousDefaultButtonCell];
-
END_BLOCK_OBJC_EXCEPTIONS
}
@@ -636,7 +609,6 @@ LengthSize ThemeMac::minimumControlSize(ControlPart part, const Font& font, floa
{
switch (part) {
case SquareButtonPart:
- case DefaultButtonPart:
case ButtonPart:
return LengthSize(Length(0, Fixed), Length(static_cast<int>(15 * zoomFactor), Fixed));
case InnerSpinButtonPart:{
@@ -653,7 +625,6 @@ LengthBox ThemeMac::controlBorder(ControlPart part, const Font& font, const Leng
{
switch (part) {
case SquareButtonPart:
- case DefaultButtonPart:
case ButtonPart:
return LengthBox(0, zoomedBox.right().value(), 0, zoomedBox.left().value());
default:
@@ -705,7 +676,6 @@ void ThemeMac::inflateControlPaintRect(ControlPart part, ControlStates states, I
break;
}
case PushButtonPart:
- case DefaultButtonPart:
case ButtonPart: {
NSButtonCell *cell = button(part, states, zoomedRect, zoomFactor);
NSControlSize controlSize = [cell controlSize];
@@ -744,7 +714,6 @@ void ThemeMac::paint(ControlPart part, ControlStates states, GraphicsContext* co
paintRadio(states, context, zoomedRect, zoomFactor, scrollView);
break;
case PushButtonPart:
- case DefaultButtonPart:
case ButtonPart:
case SquareButtonPart:
paintButton(part, states, context, zoomedRect, zoomFactor, scrollView);
« no previous file with comments | « Source/core/platform/ThemeTypes.h ('k') | Source/core/platform/mac/WebCoreSystemInterface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698