| OLD | NEW |
| 1 /** | 1 /** |
| 2 * This file is part of the theme implementation for form controls in WebCore. | 2 * This file is part of the theme implementation for form controls in WebCore. |
| 3 * | 3 * |
| 4 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Computer, Inc. | 4 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Computer, Inc. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 if (m_platformTheme) { | 110 if (m_platformTheme) { |
| 111 switch (part) { | 111 switch (part) { |
| 112 case CheckboxPart: | 112 case CheckboxPart: |
| 113 case InnerSpinButtonPart: | 113 case InnerSpinButtonPart: |
| 114 case RadioPart: | 114 case RadioPart: |
| 115 case PushButtonPart: | 115 case PushButtonPart: |
| 116 case SquareButtonPart: | 116 case SquareButtonPart: |
| 117 case ButtonPart: { | 117 case ButtonPart: { |
| 118 // Border | 118 // Border |
| 119 LengthBox borderBox(style.borderTopWidth(), style.borderRightWidth()
, style.borderBottomWidth(), style.borderLeftWidth()); | 119 LengthBox borderBox(style.borderTopWidth(), style.borderRightWidth()
, style.borderBottomWidth(), style.borderLeftWidth()); |
| 120 borderBox = m_platformTheme->controlBorder(part, style.font().fontDe
scription(), borderBox, style.effectiveZoom()); | 120 borderBox = m_platformTheme->controlBorder(part, style.font().getFon
tDescription(), borderBox, style.effectiveZoom()); |
| 121 if (borderBox.top().value() != static_cast<int>(style.borderTopWidth
())) { | 121 if (borderBox.top().value() != static_cast<int>(style.borderTopWidth
())) { |
| 122 if (borderBox.top().value()) | 122 if (borderBox.top().value()) |
| 123 style.setBorderTopWidth(borderBox.top().value()); | 123 style.setBorderTopWidth(borderBox.top().value()); |
| 124 else | 124 else |
| 125 style.resetBorderTop(); | 125 style.resetBorderTop(); |
| 126 } | 126 } |
| 127 if (borderBox.right().value() != static_cast<int>(style.borderRightW
idth())) { | 127 if (borderBox.right().value() != static_cast<int>(style.borderRightW
idth())) { |
| 128 if (borderBox.right().value()) | 128 if (borderBox.right().value()) |
| 129 style.setBorderRightWidth(borderBox.right().value()); | 129 style.setBorderRightWidth(borderBox.right().value()); |
| 130 else | 130 else |
| 131 style.resetBorderRight(); | 131 style.resetBorderRight(); |
| 132 } | 132 } |
| 133 if (borderBox.bottom().value() != static_cast<int>(style.borderBotto
mWidth())) { | 133 if (borderBox.bottom().value() != static_cast<int>(style.borderBotto
mWidth())) { |
| 134 style.setBorderBottomWidth(borderBox.bottom().value()); | 134 style.setBorderBottomWidth(borderBox.bottom().value()); |
| 135 if (borderBox.bottom().value()) | 135 if (borderBox.bottom().value()) |
| 136 style.setBorderBottomWidth(borderBox.bottom().value()); | 136 style.setBorderBottomWidth(borderBox.bottom().value()); |
| 137 else | 137 else |
| 138 style.resetBorderBottom(); | 138 style.resetBorderBottom(); |
| 139 } | 139 } |
| 140 if (borderBox.left().value() != static_cast<int>(style.borderLeftWid
th())) { | 140 if (borderBox.left().value() != static_cast<int>(style.borderLeftWid
th())) { |
| 141 style.setBorderLeftWidth(borderBox.left().value()); | 141 style.setBorderLeftWidth(borderBox.left().value()); |
| 142 if (borderBox.left().value()) | 142 if (borderBox.left().value()) |
| 143 style.setBorderLeftWidth(borderBox.left().value()); | 143 style.setBorderLeftWidth(borderBox.left().value()); |
| 144 else | 144 else |
| 145 style.resetBorderLeft(); | 145 style.resetBorderLeft(); |
| 146 } | 146 } |
| 147 | 147 |
| 148 // Padding | 148 // Padding |
| 149 LengthBox paddingBox = m_platformTheme->controlPadding(part, style.f
ont().fontDescription(), style.paddingBox(), style.effectiveZoom()); | 149 LengthBox paddingBox = m_platformTheme->controlPadding(part, style.f
ont().getFontDescription(), style.paddingBox(), style.effectiveZoom()); |
| 150 if (paddingBox != style.paddingBox()) | 150 if (paddingBox != style.paddingBox()) |
| 151 style.setPaddingBox(paddingBox); | 151 style.setPaddingBox(paddingBox); |
| 152 | 152 |
| 153 // Whitespace | 153 // Whitespace |
| 154 if (m_platformTheme->controlRequiresPreWhiteSpace(part)) | 154 if (m_platformTheme->controlRequiresPreWhiteSpace(part)) |
| 155 style.setWhiteSpace(PRE); | 155 style.setWhiteSpace(PRE); |
| 156 | 156 |
| 157 // Width / Height | 157 // Width / Height |
| 158 // The width and height here are affected by the zoom. | 158 // The width and height here are affected by the zoom. |
| 159 // FIXME: Check is flawed, since it doesn't take min-width/max-width
into account. | 159 // FIXME: Check is flawed, since it doesn't take min-width/max-width
into account. |
| 160 LengthSize controlSize = m_platformTheme->controlSize(part, style.fo
nt().fontDescription(), LengthSize(style.width(), style.height()), style.effecti
veZoom()); | 160 LengthSize controlSize = m_platformTheme->controlSize(part, style.fo
nt().getFontDescription(), LengthSize(style.width(), style.height()), style.effe
ctiveZoom()); |
| 161 if (controlSize.width() != style.width()) | 161 if (controlSize.width() != style.width()) |
| 162 style.setWidth(controlSize.width()); | 162 style.setWidth(controlSize.width()); |
| 163 if (controlSize.height() != style.height()) | 163 if (controlSize.height() != style.height()) |
| 164 style.setHeight(controlSize.height()); | 164 style.setHeight(controlSize.height()); |
| 165 | 165 |
| 166 // Min-Width / Min-Height | 166 // Min-Width / Min-Height |
| 167 LengthSize minControlSize = m_platformTheme->minimumControlSize(part
, style.font().fontDescription(), style.effectiveZoom()); | 167 LengthSize minControlSize = m_platformTheme->minimumControlSize(part
, style.font().getFontDescription(), style.effectiveZoom()); |
| 168 if (minControlSize.width() != style.minWidth()) | 168 if (minControlSize.width() != style.minWidth()) |
| 169 style.setMinWidth(minControlSize.width()); | 169 style.setMinWidth(minControlSize.width()); |
| 170 if (minControlSize.height() != style.minHeight()) | 170 if (minControlSize.height() != style.minHeight()) |
| 171 style.setMinHeight(minControlSize.height()); | 171 style.setMinHeight(minControlSize.height()); |
| 172 | 172 |
| 173 // Font | 173 // Font |
| 174 FontDescription controlFont = m_platformTheme->controlFont(part, sty
le.font().fontDescription(), style.effectiveZoom()); | 174 FontDescription controlFont = m_platformTheme->controlFont(part, sty
le.font().getFontDescription(), style.effectiveZoom()); |
| 175 if (controlFont != style.font().fontDescription()) { | 175 if (controlFont != style.font().getFontDescription()) { |
| 176 // Reset our line-height | 176 // Reset our line-height |
| 177 style.setLineHeight(ComputedStyle::initialLineHeight()); | 177 style.setLineHeight(ComputedStyle::initialLineHeight()); |
| 178 | 178 |
| 179 // Now update our font. | 179 // Now update our font. |
| 180 if (style.setFontDescription(controlFont)) | 180 if (style.setFontDescription(controlFont)) |
| 181 style.font().update(nullptr); | 181 style.font().update(nullptr); |
| 182 } | 182 } |
| 183 } | 183 } |
| 184 default: | 184 default: |
| 185 break; | 185 break; |
| (...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 | 927 |
| 928 // padding - not honored by WinIE, needs to be removed. | 928 // padding - not honored by WinIE, needs to be removed. |
| 929 style.resetPadding(); | 929 style.resetPadding(); |
| 930 | 930 |
| 931 // border - honored by WinIE, but looks terrible (just paints in the control
box and turns off the Windows XP theme) | 931 // border - honored by WinIE, but looks terrible (just paints in the control
box and turns off the Windows XP theme) |
| 932 // for now, we will not honor it. | 932 // for now, we will not honor it. |
| 933 style.resetBorder(); | 933 style.resetBorder(); |
| 934 } | 934 } |
| 935 | 935 |
| 936 } // namespace blink | 936 } // namespace blink |
| OLD | NEW |