OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008, 2009 Google, Inc. | 3 * Copyright (C) 2008, 2009 Google, Inc. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 - (NSText *)currentEditor | 105 - (NSText *)currentEditor |
106 { | 106 { |
107 return nil; | 107 return nil; |
108 } | 108 } |
109 | 109 |
110 @end | 110 @end |
111 | 111 |
112 namespace blink { | 112 namespace blink { |
113 | 113 |
| 114 namespace { |
| 115 |
| 116 bool fontSizeMatchesToControlSize(const ComputedStyle& style) |
| 117 { |
| 118 int fontSize = style.fontSize(); |
| 119 if (fontSize == [NSFont systemFontSizeForControlSize:NSRegularControlSize]) |
| 120 return true; |
| 121 if (fontSize == [NSFont systemFontSizeForControlSize:NSSmallControlSize]) |
| 122 return true; |
| 123 if (fontSize == [NSFont systemFontSizeForControlSize:NSMiniControlSize]) |
| 124 return true; |
| 125 return false; |
| 126 } |
| 127 |
| 128 } // namespace |
| 129 |
114 using namespace HTMLNames; | 130 using namespace HTMLNames; |
115 | 131 |
116 LayoutThemeMac::LayoutThemeMac() | 132 LayoutThemeMac::LayoutThemeMac() |
117 : LayoutTheme(platformTheme()) | 133 : LayoutTheme(platformTheme()) |
118 , m_notificationObserver(AdoptNS, [[BlinkLayoutThemeNotificationObserver all
oc] initWithTheme:this]) | 134 , m_notificationObserver(AdoptNS, [[BlinkLayoutThemeNotificationObserver all
oc] initWithTheme:this]) |
119 , m_painter(*this, platformTheme()) | 135 , m_painter(*this, platformTheme()) |
120 { | 136 { |
121 [[NSNotificationCenter defaultCenter] addObserver:m_notificationObserver.get
() | 137 [[NSNotificationCenter defaultCenter] addObserver:m_notificationObserver.get
() |
122 selector:@selector(systemColorsDidC
hange:) | 138 selector:@selector(systemColorsDidC
hange:) |
123 name:NSSystemColorsDidChangeNot
ification | 139 name:NSSystemColorsDidChangeNot
ification |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 m_systemColorCache.set(cssValueId, color.rgb()); | 454 m_systemColorCache.set(cssValueId, color.rgb()); |
439 | 455 |
440 return color; | 456 return color; |
441 } | 457 } |
442 | 458 |
443 bool LayoutThemeMac::isControlStyled(const ComputedStyle& style) const | 459 bool LayoutThemeMac::isControlStyled(const ComputedStyle& style) const |
444 { | 460 { |
445 if (style.appearance() == TextFieldPart || style.appearance() == TextAreaPar
t) | 461 if (style.appearance() == TextFieldPart || style.appearance() == TextAreaPar
t) |
446 return style.hasAuthorBorder() || style.boxShadow(); | 462 return style.hasAuthorBorder() || style.boxShadow(); |
447 | 463 |
448 // FIXME: This is horrible, but there is not much else that can be done. | 464 if (style.appearance() == MenulistPart) { |
449 // Menu lists cannot draw properly when scaled. They can't really draw | 465 // FIXME: This is horrible, but there is not much else that can be done. |
450 // properly when transformed either. We can't detect the transform case at | 466 // Menu lists cannot draw properly when scaled. They can't really draw |
451 // style adjustment time so that will just have to stay broken. We can | 467 // properly when transformed either. We can't detect the transform case |
452 // however detect that we're zooming. If zooming is in effect we treat it | 468 // at style adjustment time so that will just have to stay broken. We |
453 // like the control is styled. | 469 // can however detect that we're zooming. If zooming is in effect we |
454 if (style.appearance() == MenulistPart && style.effectiveZoom() != 1.0f) | 470 // treat it like the control is styled. |
455 return true; | 471 if (style.effectiveZoom() != 1.0f) |
| 472 return true; |
| 473 if (!fontSizeMatchesToControlSize(style)) |
| 474 return true; |
| 475 if (style.getFontDescription().family().family() != "BlinkMacSystemFont"
) |
| 476 return true; |
| 477 if (!style.height().isIntrinsicOrAuto()) |
| 478 return true; |
| 479 } |
456 // Some other cells don't work well when scaled. | 480 // Some other cells don't work well when scaled. |
457 if (style.effectiveZoom() != 1) { | 481 if (style.effectiveZoom() != 1) { |
458 switch (style.appearance()) { | 482 switch (style.appearance()) { |
459 case ButtonPart: | 483 case ButtonPart: |
460 case PushButtonPart: | 484 case PushButtonPart: |
461 case SearchFieldPart: | 485 case SearchFieldPart: |
462 case SquareButtonPart: | 486 case SquareButtonPart: |
463 return true; | 487 return true; |
464 default: | 488 default: |
465 break; | 489 break; |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 | 1101 |
1078 bool LayoutThemeMac::shouldUseFallbackTheme(const ComputedStyle& style) const | 1102 bool LayoutThemeMac::shouldUseFallbackTheme(const ComputedStyle& style) const |
1079 { | 1103 { |
1080 ControlPart part = style.appearance(); | 1104 ControlPart part = style.appearance(); |
1081 if (part == CheckboxPart || part == RadioPart) | 1105 if (part == CheckboxPart || part == RadioPart) |
1082 return style.effectiveZoom() != 1; | 1106 return style.effectiveZoom() != 1; |
1083 return false; | 1107 return false; |
1084 } | 1108 } |
1085 | 1109 |
1086 } // namespace blink | 1110 } // namespace blink |
OLD | NEW |