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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 namespace blink { | 55 namespace blink { |
56 | 56 |
57 ThemePainterMac::ThemePainterMac(LayoutThemeMac& layoutTheme) | 57 ThemePainterMac::ThemePainterMac(LayoutThemeMac& layoutTheme) |
58 : ThemePainter(), m_layoutTheme(layoutTheme) {} | 58 : ThemePainter(), m_layoutTheme(layoutTheme) {} |
59 | 59 |
60 bool ThemePainterMac::paintTextField(const LayoutObject& o, | 60 bool ThemePainterMac::paintTextField(const LayoutObject& o, |
61 const PaintInfo& paintInfo, | 61 const PaintInfo& paintInfo, |
62 const IntRect& r) { | 62 const IntRect& r) { |
63 LocalCurrentGraphicsContext localContext(paintInfo.context, r); | 63 LocalCurrentGraphicsContext localContext(paintInfo.context, r); |
64 | 64 |
65 #if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 | |
66 bool useNSTextFieldCell = o.styleRef().hasAppearance() && | 65 bool useNSTextFieldCell = o.styleRef().hasAppearance() && |
67 o.styleRef().visitedDependentColor( | 66 o.styleRef().visitedDependentColor( |
68 CSSPropertyBackgroundColor) == Color::white && | 67 CSSPropertyBackgroundColor) == Color::white && |
69 !o.styleRef().hasBackgroundImage(); | 68 !o.styleRef().hasBackgroundImage(); |
70 | 69 |
71 // We do not use NSTextFieldCell to draw styled text fields on Lion and | 70 // We do not use NSTextFieldCell to draw styled text fields since it induces a |
72 // SnowLeopard because there are a number of bugs on those platforms that | 71 // behavior change while remaining a fragile solution. |
73 // require NSTextFieldCell to be in charge of painting its own | 72 // https://bugs.chromium.org/p/chromium/issues/detail?id=658085#c3 |
74 // background. We need WebCore to paint styled backgrounds, so we'll use | |
75 // this AppKit SPI function instead. | |
76 if (!useNSTextFieldCell) { | 73 if (!useNSTextFieldCell) { |
77 _NSDrawCarbonThemeBezel( | 74 _NSDrawCarbonThemeBezel( |
78 r, LayoutTheme::isEnabled(o) && !LayoutTheme::isReadOnlyControl(o), | 75 r, LayoutTheme::isEnabled(o) && !LayoutTheme::isReadOnlyControl(o), |
79 YES); | 76 YES); |
80 return false; | 77 return false; |
81 } | 78 } |
82 #endif | |
83 | 79 |
84 NSTextFieldCell* textField = m_layoutTheme.textField(); | 80 NSTextFieldCell* textField = m_layoutTheme.textField(); |
85 | 81 |
86 GraphicsContextStateSaver stateSaver(paintInfo.context); | 82 GraphicsContextStateSaver stateSaver(paintInfo.context); |
87 | 83 |
88 [textField setEnabled:(LayoutTheme::isEnabled(o) && | 84 [textField setEnabled:(LayoutTheme::isEnabled(o) && |
89 !LayoutTheme::isReadOnlyControl(o))]; | 85 !LayoutTheme::isReadOnlyControl(o))]; |
90 [textField drawWithFrame:NSRect(r) inView:m_layoutTheme.documentViewFor(o)]; | 86 [textField drawWithFrame:NSRect(r) inView:m_layoutTheme.documentViewFor(o)]; |
91 | 87 |
92 [textField setControlView:nil]; | 88 [textField setControlView:nil]; |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 backgroundBounds.origin.y = bounds.origin.y + (heightDiff / 2) + 1; | 802 backgroundBounds.origin.y = bounds.origin.y + (heightDiff / 2) + 1; |
807 } | 803 } |
808 | 804 |
809 LocalCurrentGraphicsContext localContext(paintInfo.context, rect); | 805 LocalCurrentGraphicsContext localContext(paintInfo.context, rect); |
810 HIThemeDrawButton(&backgroundBounds, &drawInfo, localContext.cgContext(), | 806 HIThemeDrawButton(&backgroundBounds, &drawInfo, localContext.cgContext(), |
811 kHIThemeOrientationNormal, 0); | 807 kHIThemeOrientationNormal, 0); |
812 return false; | 808 return false; |
813 } | 809 } |
814 | 810 |
815 } // namespace blink | 811 } // namespace blink |
OLD | NEW |