| 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 return adjustMeterStyle(style, e); | 258 return adjustMeterStyle(style, e); |
| 259 #if ENABLE(INPUT_SPEECH) | 259 #if ENABLE(INPUT_SPEECH) |
| 260 case InputSpeechButtonPart: | 260 case InputSpeechButtonPart: |
| 261 return adjustInputFieldSpeechButtonStyle(style, e); | 261 return adjustInputFieldSpeechButtonStyle(style, e); |
| 262 #endif | 262 #endif |
| 263 default: | 263 default: |
| 264 break; | 264 break; |
| 265 } | 265 } |
| 266 } | 266 } |
| 267 | 267 |
| 268 bool RenderTheme::paint(RenderObject* o, const PaintInfo& paintInfo, const IntRe
ct& r) | 268 bool RenderTheme::paint(RenderObject* o, PaintInfo& paintInfo, const IntRect& r) |
| 269 { | 269 { |
| 270 // If painting is disabled, but we aren't updating control tints, then just
bail. | 270 // If painting is disabled, but we aren't updating control tints, then just
bail. |
| 271 // If we are updating control tints, just schedule a repaint if the theme su
pports tinting | 271 // If we are updating control tints, just schedule a repaint if the theme su
pports tinting |
| 272 // for that control. | 272 // for that control. |
| 273 if (paintInfo.context->updatingControlTints()) { | 273 if (paintInfo.getContext()->updatingControlTints()) { |
| 274 if (controlSupportsTints(o)) | 274 if (controlSupportsTints(o)) |
| 275 o->repaint(); | 275 o->repaint(); |
| 276 return false; | 276 return false; |
| 277 } | 277 } |
| 278 if (paintInfo.context->paintingDisabled()) | 278 if (paintInfo.getContext()->paintingDisabled()) |
| 279 return false; | 279 return false; |
| 280 | 280 |
| 281 ControlPart part = o->style()->appearance(); | 281 ControlPart part = o->style()->appearance(); |
| 282 | 282 |
| 283 if (shouldUseFallbackTheme(o->style())) | 283 if (shouldUseFallbackTheme(o->style())) |
| 284 return paintUsingFallbackTheme(o, paintInfo, r); | 284 return paintUsingFallbackTheme(o, paintInfo, r); |
| 285 | 285 |
| 286 #if USE(NEW_THEME) | 286 #if USE(NEW_THEME) |
| 287 switch (part) { | 287 switch (part) { |
| 288 case CheckboxPart: | 288 case CheckboxPart: |
| 289 case RadioPart: | 289 case RadioPart: |
| 290 case PushButtonPart: | 290 case PushButtonPart: |
| 291 case SquareButtonPart: | 291 case SquareButtonPart: |
| 292 case ButtonPart: | 292 case ButtonPart: |
| 293 case InnerSpinButtonPart: | 293 case InnerSpinButtonPart: |
| 294 m_theme->paint(part, controlStatesForRenderer(o), const_cast<GraphicsCon
text*>(paintInfo.context), r, o->style()->effectiveZoom(), o->view()->frameView(
)); | 294 m_theme->paint(part, controlStatesForRenderer(o), const_cast<GraphicsCon
text*>(paintInfo.getContext()), r, o->style()->effectiveZoom(), o->view()->frame
View()); |
| 295 return false; | 295 return false; |
| 296 default: | 296 default: |
| 297 break; | 297 break; |
| 298 } | 298 } |
| 299 #endif | 299 #endif |
| 300 | 300 |
| 301 // Call the appropriate paint method based off the appearance value. | 301 // Call the appropriate paint method based off the appearance value. |
| 302 switch (part) { | 302 switch (part) { |
| 303 #if !USE(NEW_THEME) | 303 #if !USE(NEW_THEME) |
| 304 case CheckboxPart: | 304 case CheckboxPart: |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 case InputSpeechButtonPart: | 386 case InputSpeechButtonPart: |
| 387 return paintInputFieldSpeechButton(o, paintInfo, r); | 387 return paintInputFieldSpeechButton(o, paintInfo, r); |
| 388 #endif | 388 #endif |
| 389 default: | 389 default: |
| 390 break; | 390 break; |
| 391 } | 391 } |
| 392 | 392 |
| 393 return true; // We don't support the appearance, so let the normal backgroun
d/border paint. | 393 return true; // We don't support the appearance, so let the normal backgroun
d/border paint. |
| 394 } | 394 } |
| 395 | 395 |
| 396 bool RenderTheme::paintBorderOnly(RenderObject* o, const PaintInfo& paintInfo, c
onst IntRect& r) | 396 bool RenderTheme::paintBorderOnly(RenderObject* o, PaintInfo& paintInfo, const I
ntRect& r) |
| 397 { | 397 { |
| 398 if (paintInfo.context->paintingDisabled()) | 398 if (paintInfo.getContext()->paintingDisabled()) |
| 399 return false; | 399 return false; |
| 400 | 400 |
| 401 // Call the appropriate paint method based off the appearance value. | 401 // Call the appropriate paint method based off the appearance value. |
| 402 switch (o->style()->appearance()) { | 402 switch (o->style()->appearance()) { |
| 403 case TextFieldPart: | 403 case TextFieldPart: |
| 404 return paintTextField(o, paintInfo, r); | 404 return paintTextField(o, paintInfo, r); |
| 405 case ListboxPart: | 405 case ListboxPart: |
| 406 case TextAreaPart: | 406 case TextAreaPart: |
| 407 return paintTextArea(o, paintInfo, r); | 407 return paintTextArea(o, paintInfo, r); |
| 408 case MenulistButtonPart: | 408 case MenulistButtonPart: |
| (...skipping 21 matching lines...) Expand all Loading... |
| 430 #if ENABLE(INPUT_SPEECH) | 430 #if ENABLE(INPUT_SPEECH) |
| 431 case InputSpeechButtonPart: | 431 case InputSpeechButtonPart: |
| 432 #endif | 432 #endif |
| 433 default: | 433 default: |
| 434 break; | 434 break; |
| 435 } | 435 } |
| 436 | 436 |
| 437 return false; | 437 return false; |
| 438 } | 438 } |
| 439 | 439 |
| 440 bool RenderTheme::paintDecorations(RenderObject* o, const PaintInfo& paintInfo,
const IntRect& r) | 440 bool RenderTheme::paintDecorations(RenderObject* o, PaintInfo& paintInfo, const
IntRect& r) |
| 441 { | 441 { |
| 442 if (paintInfo.context->paintingDisabled()) | 442 if (paintInfo.getContext()->paintingDisabled()) |
| 443 return false; | 443 return false; |
| 444 | 444 |
| 445 // Call the appropriate paint method based off the appearance value. | 445 // Call the appropriate paint method based off the appearance value. |
| 446 switch (o->style()->appearance()) { | 446 switch (o->style()->appearance()) { |
| 447 case MenulistButtonPart: | 447 case MenulistButtonPart: |
| 448 return paintMenuListButton(o, paintInfo, r); | 448 return paintMenuListButton(o, paintInfo, r); |
| 449 case TextFieldPart: | 449 case TextFieldPart: |
| 450 case TextAreaPart: | 450 case TextAreaPart: |
| 451 case ListboxPart: | 451 case ListboxPart: |
| 452 case CheckboxPart: | 452 case CheckboxPart: |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 void RenderTheme::adjustMenuListStyle(RenderStyle*, Element*) const | 948 void RenderTheme::adjustMenuListStyle(RenderStyle*, Element*) const |
| 949 { | 949 { |
| 950 } | 950 } |
| 951 | 951 |
| 952 #if ENABLE(INPUT_SPEECH) | 952 #if ENABLE(INPUT_SPEECH) |
| 953 void RenderTheme::adjustInputFieldSpeechButtonStyle(RenderStyle* style, Element*
element) const | 953 void RenderTheme::adjustInputFieldSpeechButtonStyle(RenderStyle* style, Element*
element) const |
| 954 { | 954 { |
| 955 RenderInputSpeech::adjustInputFieldSpeechButtonStyle(style, element); | 955 RenderInputSpeech::adjustInputFieldSpeechButtonStyle(style, element); |
| 956 } | 956 } |
| 957 | 957 |
| 958 bool RenderTheme::paintInputFieldSpeechButton(RenderObject* object, const PaintI
nfo& paintInfo, const IntRect& rect) | 958 bool RenderTheme::paintInputFieldSpeechButton(RenderObject* object, PaintInfo& p
aintInfo, const IntRect& rect) |
| 959 { | 959 { |
| 960 return RenderInputSpeech::paintInputFieldSpeechButton(object, paintInfo, rec
t); | 960 return RenderInputSpeech::paintInputFieldSpeechButton(object, paintInfo, rec
t); |
| 961 } | 961 } |
| 962 #endif | 962 #endif |
| 963 | 963 |
| 964 void RenderTheme::adjustMeterStyle(RenderStyle* style, Element*) const | 964 void RenderTheme::adjustMeterStyle(RenderStyle* style, Element*) const |
| 965 { | 965 { |
| 966 } | 966 } |
| 967 | 967 |
| 968 IntSize RenderTheme::meterSizeForBounds(const RenderMeter*, const IntRect& bound
s) const | 968 IntSize RenderTheme::meterSizeForBounds(const RenderMeter*, const IntRect& bound
s) const |
| 969 { | 969 { |
| 970 return bounds.size(); | 970 return bounds.size(); |
| 971 } | 971 } |
| 972 | 972 |
| 973 bool RenderTheme::supportsMeter(ControlPart) const | 973 bool RenderTheme::supportsMeter(ControlPart) const |
| 974 { | 974 { |
| 975 return false; | 975 return false; |
| 976 } | 976 } |
| 977 | 977 |
| 978 bool RenderTheme::paintMeter(RenderObject*, const PaintInfo&, const IntRect&) | 978 bool RenderTheme::paintMeter(RenderObject*, PaintInfo&, const IntRect&) |
| 979 { | 979 { |
| 980 return true; | 980 return true; |
| 981 } | 981 } |
| 982 | 982 |
| 983 LayoutUnit RenderTheme::sliderTickSnappingThreshold() const | 983 LayoutUnit RenderTheme::sliderTickSnappingThreshold() const |
| 984 { | 984 { |
| 985 return 5; | 985 return 5; |
| 986 } | 986 } |
| 987 | 987 |
| 988 void RenderTheme::paintSliderTicks(RenderObject* o, const PaintInfo& paintInfo,
const IntRect& rect) | 988 void RenderTheme::paintSliderTicks(RenderObject* o, PaintInfo& paintInfo, const
IntRect& rect) |
| 989 { | 989 { |
| 990 Node* node = o->node(); | 990 Node* node = o->node(); |
| 991 if (!node || !node->hasTagName(inputTag)) | 991 if (!node || !node->hasTagName(inputTag)) |
| 992 return; | 992 return; |
| 993 | 993 |
| 994 HTMLInputElement* input = toHTMLInputElement(node); | 994 HTMLInputElement* input = toHTMLInputElement(node); |
| 995 HTMLDataListElement* dataList = input->dataList(); | 995 HTMLDataListElement* dataList = input->dataList(); |
| 996 if (!dataList) | 996 if (!dataList) |
| 997 return; | 997 return; |
| 998 | 998 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1037 tickRegionSideMargin = trackBounds.x() + (thumbSize.width() - tickSize.w
idth() * zoomFactor) / 2.0; | 1037 tickRegionSideMargin = trackBounds.x() + (thumbSize.width() - tickSize.w
idth() * zoomFactor) / 2.0; |
| 1038 tickRegionWidth = trackBounds.width() - thumbSize.width(); | 1038 tickRegionWidth = trackBounds.width() - thumbSize.width(); |
| 1039 } else { | 1039 } else { |
| 1040 tickRect.setWidth(floor(tickSize.height() * zoomFactor)); | 1040 tickRect.setWidth(floor(tickSize.height() * zoomFactor)); |
| 1041 tickRect.setHeight(floor(tickSize.width() * zoomFactor)); | 1041 tickRect.setHeight(floor(tickSize.width() * zoomFactor)); |
| 1042 tickRect.setX(floor(rect.x() + rect.width() / 2.0 + sliderTickOffsetFrom
TrackCenter() * zoomFactor)); | 1042 tickRect.setX(floor(rect.x() + rect.width() / 2.0 + sliderTickOffsetFrom
TrackCenter() * zoomFactor)); |
| 1043 tickRegionSideMargin = trackBounds.y() + (thumbSize.width() - tickSize.w
idth() * zoomFactor) / 2.0; | 1043 tickRegionSideMargin = trackBounds.y() + (thumbSize.width() - tickSize.w
idth() * zoomFactor) / 2.0; |
| 1044 tickRegionWidth = trackBounds.height() - thumbSize.width(); | 1044 tickRegionWidth = trackBounds.height() - thumbSize.width(); |
| 1045 } | 1045 } |
| 1046 RefPtr<HTMLCollection> options = dataList->options(); | 1046 RefPtr<HTMLCollection> options = dataList->options(); |
| 1047 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 1047 GraphicsContextStateSaver stateSaver(*(paintInfo.getContext())); |
| 1048 paintInfo.context->setFillColor(o->resolveColor(CSSPropertyColor)); | 1048 paintInfo.getContext()->setFillColor(o->resolveColor(CSSPropertyColor)); |
| 1049 for (unsigned i = 0; Node* node = options->item(i); i++) { | 1049 for (unsigned i = 0; Node* node = options->item(i); i++) { |
| 1050 ASSERT(node->hasTagName(optionTag)); | 1050 ASSERT(node->hasTagName(optionTag)); |
| 1051 HTMLOptionElement* optionElement = toHTMLOptionElement(node); | 1051 HTMLOptionElement* optionElement = toHTMLOptionElement(node); |
| 1052 String value = optionElement->value(); | 1052 String value = optionElement->value(); |
| 1053 if (!input->isValidValue(value)) | 1053 if (!input->isValidValue(value)) |
| 1054 continue; | 1054 continue; |
| 1055 double parsedValue = parseToDoubleForNumberType(input->sanitizeValue(val
ue)); | 1055 double parsedValue = parseToDoubleForNumberType(input->sanitizeValue(val
ue)); |
| 1056 double tickFraction = (parsedValue - min) / (max - min); | 1056 double tickFraction = (parsedValue - min) / (max - min); |
| 1057 double tickRatio = isHorizontal && o->style()->isLeftToRightDirection()
? tickFraction : 1.0 - tickFraction; | 1057 double tickRatio = isHorizontal && o->style()->isLeftToRightDirection()
? tickFraction : 1.0 - tickFraction; |
| 1058 double tickPosition = round(tickRegionSideMargin + tickRegionWidth * tic
kRatio); | 1058 double tickPosition = round(tickRegionSideMargin + tickRegionWidth * tic
kRatio); |
| 1059 if (isHorizontal) | 1059 if (isHorizontal) |
| 1060 tickRect.setX(tickPosition); | 1060 tickRect.setX(tickPosition); |
| 1061 else | 1061 else |
| 1062 tickRect.setY(tickPosition); | 1062 tickRect.setY(tickPosition); |
| 1063 paintInfo.context->fillRect(tickRect); | 1063 paintInfo.getContext()->fillRect(tickRect); |
| 1064 } | 1064 } |
| 1065 } | 1065 } |
| 1066 | 1066 |
| 1067 double RenderTheme::animationRepeatIntervalForProgressBar(RenderProgress*) const | 1067 double RenderTheme::animationRepeatIntervalForProgressBar(RenderProgress*) const |
| 1068 { | 1068 { |
| 1069 return 0; | 1069 return 0; |
| 1070 } | 1070 } |
| 1071 | 1071 |
| 1072 double RenderTheme::animationDurationForProgressBar(RenderProgress*) const | 1072 double RenderTheme::animationDurationForProgressBar(RenderProgress*) const |
| 1073 { | 1073 { |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1294 switch (part) { | 1294 switch (part) { |
| 1295 case CheckboxPart: | 1295 case CheckboxPart: |
| 1296 return adjustCheckboxStyleUsingFallbackTheme(style, e); | 1296 return adjustCheckboxStyleUsingFallbackTheme(style, e); |
| 1297 case RadioPart: | 1297 case RadioPart: |
| 1298 return adjustRadioStyleUsingFallbackTheme(style, e); | 1298 return adjustRadioStyleUsingFallbackTheme(style, e); |
| 1299 default: | 1299 default: |
| 1300 break; | 1300 break; |
| 1301 } | 1301 } |
| 1302 } | 1302 } |
| 1303 | 1303 |
| 1304 bool RenderTheme::paintUsingFallbackTheme(RenderObject* o, const PaintInfo& i, c
onst IntRect& r) | 1304 bool RenderTheme::paintUsingFallbackTheme(RenderObject* o, PaintInfo& i, const I
ntRect& r) |
| 1305 { | 1305 { |
| 1306 ControlPart part = o->style()->appearance(); | 1306 ControlPart part = o->style()->appearance(); |
| 1307 switch (part) { | 1307 switch (part) { |
| 1308 case CheckboxPart: | 1308 case CheckboxPart: |
| 1309 return paintCheckboxUsingFallbackTheme(o, i, r); | 1309 return paintCheckboxUsingFallbackTheme(o, i, r); |
| 1310 case RadioPart: | 1310 case RadioPart: |
| 1311 return paintRadioUsingFallbackTheme(o, i, r); | 1311 return paintRadioUsingFallbackTheme(o, i, r); |
| 1312 default: | 1312 default: |
| 1313 break; | 1313 break; |
| 1314 } | 1314 } |
| 1315 return true; | 1315 return true; |
| 1316 } | 1316 } |
| 1317 | 1317 |
| 1318 // static | 1318 // static |
| 1319 void RenderTheme::setSizeIfAuto(RenderStyle* style, const IntSize& size) | 1319 void RenderTheme::setSizeIfAuto(RenderStyle* style, const IntSize& size) |
| 1320 { | 1320 { |
| 1321 if (style->width().isIntrinsicOrAuto()) | 1321 if (style->width().isIntrinsicOrAuto()) |
| 1322 style->setWidth(Length(size.width(), Fixed)); | 1322 style->setWidth(Length(size.width(), Fixed)); |
| 1323 if (style->height().isAuto()) | 1323 if (style->height().isAuto()) |
| 1324 style->setHeight(Length(size.height(), Fixed)); | 1324 style->setHeight(Length(size.height(), Fixed)); |
| 1325 } | 1325 } |
| 1326 | 1326 |
| 1327 bool RenderTheme::paintCheckboxUsingFallbackTheme(RenderObject* o, const PaintIn
fo& i, const IntRect& r) | 1327 bool RenderTheme::paintCheckboxUsingFallbackTheme(RenderObject* o, PaintInfo& i,
const IntRect& r) |
| 1328 { | 1328 { |
| 1329 WebKit::WebFallbackThemeEngine::ExtraParams extraParams; | 1329 WebKit::WebFallbackThemeEngine::ExtraParams extraParams; |
| 1330 WebKit::WebCanvas* canvas = i.context->canvas(); | 1330 WebKit::WebCanvas* canvas = i.getContext()->canvas(); |
| 1331 extraParams.button.checked = isChecked(o); | 1331 extraParams.button.checked = isChecked(o); |
| 1332 extraParams.button.indeterminate = isIndeterminate(o); | 1332 extraParams.button.indeterminate = isIndeterminate(o); |
| 1333 | 1333 |
| 1334 float zoomLevel = o->style()->effectiveZoom(); | 1334 float zoomLevel = o->style()->effectiveZoom(); |
| 1335 GraphicsContextStateSaver stateSaver(*i.context); | 1335 GraphicsContextStateSaver stateSaver(*(i.getContext())); |
| 1336 IntRect unzoomedRect = r; | 1336 IntRect unzoomedRect = r; |
| 1337 if (zoomLevel != 1) { | 1337 if (zoomLevel != 1) { |
| 1338 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); | 1338 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); |
| 1339 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); | 1339 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); |
| 1340 i.context->translate(unzoomedRect.x(), unzoomedRect.y()); | 1340 i.getContext()->translate(unzoomedRect.x(), unzoomedRect.y()); |
| 1341 i.context->scale(FloatSize(zoomLevel, zoomLevel)); | 1341 i.getContext()->scale(FloatSize(zoomLevel, zoomLevel)); |
| 1342 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); | 1342 i.getContext()->translate(-unzoomedRect.x(), -unzoomedRect.y()); |
| 1343 } | 1343 } |
| 1344 | 1344 |
| 1345 WebKit::Platform::current()->fallbackThemeEngine()->paint(canvas, WebKit::We
bFallbackThemeEngine::PartCheckbox, getWebFallbackThemeState(this, o), WebKit::W
ebRect(unzoomedRect), &extraParams); | 1345 WebKit::Platform::current()->fallbackThemeEngine()->paint(canvas, WebKit::We
bFallbackThemeEngine::PartCheckbox, getWebFallbackThemeState(this, o), WebKit::W
ebRect(unzoomedRect), &extraParams); |
| 1346 return false; | 1346 return false; |
| 1347 } | 1347 } |
| 1348 | 1348 |
| 1349 void RenderTheme::adjustCheckboxStyleUsingFallbackTheme(RenderStyle* style, Elem
ent*) const | 1349 void RenderTheme::adjustCheckboxStyleUsingFallbackTheme(RenderStyle* style, Elem
ent*) const |
| 1350 { | 1350 { |
| 1351 // If the width and height are both specified, then we have nothing to do. | 1351 // If the width and height are both specified, then we have nothing to do. |
| 1352 if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) | 1352 if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) |
| 1353 return; | 1353 return; |
| 1354 | 1354 |
| 1355 IntSize size = WebKit::Platform::current()->fallbackThemeEngine()->getSize(W
ebKit::WebFallbackThemeEngine::PartCheckbox); | 1355 IntSize size = WebKit::Platform::current()->fallbackThemeEngine()->getSize(W
ebKit::WebFallbackThemeEngine::PartCheckbox); |
| 1356 float zoomLevel = style->effectiveZoom(); | 1356 float zoomLevel = style->effectiveZoom(); |
| 1357 size.setWidth(size.width() * zoomLevel); | 1357 size.setWidth(size.width() * zoomLevel); |
| 1358 size.setHeight(size.height() * zoomLevel); | 1358 size.setHeight(size.height() * zoomLevel); |
| 1359 setSizeIfAuto(style, size); | 1359 setSizeIfAuto(style, size); |
| 1360 | 1360 |
| 1361 // padding - not honored by WinIE, needs to be removed. | 1361 // padding - not honored by WinIE, needs to be removed. |
| 1362 style->resetPadding(); | 1362 style->resetPadding(); |
| 1363 | 1363 |
| 1364 // border - honored by WinIE, but looks terrible (just paints in the control
box and turns off the Windows XP theme) | 1364 // border - honored by WinIE, but looks terrible (just paints in the control
box and turns off the Windows XP theme) |
| 1365 // for now, we will not honor it. | 1365 // for now, we will not honor it. |
| 1366 style->resetBorder(); | 1366 style->resetBorder(); |
| 1367 } | 1367 } |
| 1368 | 1368 |
| 1369 bool RenderTheme::paintRadioUsingFallbackTheme(RenderObject* o, const PaintInfo&
i, const IntRect& r) | 1369 bool RenderTheme::paintRadioUsingFallbackTheme(RenderObject* o, PaintInfo& i, co
nst IntRect& r) |
| 1370 { | 1370 { |
| 1371 WebKit::WebFallbackThemeEngine::ExtraParams extraParams; | 1371 WebKit::WebFallbackThemeEngine::ExtraParams extraParams; |
| 1372 WebKit::WebCanvas* canvas = i.context->canvas(); | 1372 WebKit::WebCanvas* canvas = i.getContext()->canvas(); |
| 1373 extraParams.button.checked = isChecked(o); | 1373 extraParams.button.checked = isChecked(o); |
| 1374 extraParams.button.indeterminate = isIndeterminate(o); | 1374 extraParams.button.indeterminate = isIndeterminate(o); |
| 1375 | 1375 |
| 1376 float zoomLevel = o->style()->effectiveZoom(); | 1376 float zoomLevel = o->style()->effectiveZoom(); |
| 1377 GraphicsContextStateSaver stateSaver(*i.context); | 1377 GraphicsContextStateSaver stateSaver(*(i.getContext())); |
| 1378 IntRect unzoomedRect = r; | 1378 IntRect unzoomedRect = r; |
| 1379 if (zoomLevel != 1) { | 1379 if (zoomLevel != 1) { |
| 1380 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); | 1380 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); |
| 1381 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); | 1381 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); |
| 1382 i.context->translate(unzoomedRect.x(), unzoomedRect.y()); | 1382 i.getContext()->translate(unzoomedRect.x(), unzoomedRect.y()); |
| 1383 i.context->scale(FloatSize(zoomLevel, zoomLevel)); | 1383 i.getContext()->scale(FloatSize(zoomLevel, zoomLevel)); |
| 1384 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); | 1384 i.getContext()->translate(-unzoomedRect.x(), -unzoomedRect.y()); |
| 1385 } | 1385 } |
| 1386 | 1386 |
| 1387 WebKit::Platform::current()->fallbackThemeEngine()->paint(canvas, WebKit::We
bFallbackThemeEngine::PartRadio, getWebFallbackThemeState(this, o), WebKit::WebR
ect(unzoomedRect), &extraParams); | 1387 WebKit::Platform::current()->fallbackThemeEngine()->paint(canvas, WebKit::We
bFallbackThemeEngine::PartRadio, getWebFallbackThemeState(this, o), WebKit::WebR
ect(unzoomedRect), &extraParams); |
| 1388 return false; | 1388 return false; |
| 1389 } | 1389 } |
| 1390 | 1390 |
| 1391 void RenderTheme::adjustRadioStyleUsingFallbackTheme(RenderStyle* style, Element
*) const | 1391 void RenderTheme::adjustRadioStyleUsingFallbackTheme(RenderStyle* style, Element
*) const |
| 1392 { | 1392 { |
| 1393 // If the width and height are both specified, then we have nothing to do. | 1393 // If the width and height are both specified, then we have nothing to do. |
| 1394 if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) | 1394 if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) |
| 1395 return; | 1395 return; |
| 1396 | 1396 |
| 1397 IntSize size = WebKit::Platform::current()->fallbackThemeEngine()->getSize(W
ebKit::WebFallbackThemeEngine::PartRadio); | 1397 IntSize size = WebKit::Platform::current()->fallbackThemeEngine()->getSize(W
ebKit::WebFallbackThemeEngine::PartRadio); |
| 1398 float zoomLevel = style->effectiveZoom(); | 1398 float zoomLevel = style->effectiveZoom(); |
| 1399 size.setWidth(size.width() * zoomLevel); | 1399 size.setWidth(size.width() * zoomLevel); |
| 1400 size.setHeight(size.height() * zoomLevel); | 1400 size.setHeight(size.height() * zoomLevel); |
| 1401 setSizeIfAuto(style, size); | 1401 setSizeIfAuto(style, size); |
| 1402 | 1402 |
| 1403 // padding - not honored by WinIE, needs to be removed. | 1403 // padding - not honored by WinIE, needs to be removed. |
| 1404 style->resetPadding(); | 1404 style->resetPadding(); |
| 1405 | 1405 |
| 1406 // border - honored by WinIE, but looks terrible (just paints in the control
box and turns off the Windows XP theme) | 1406 // border - honored by WinIE, but looks terrible (just paints in the control
box and turns off the Windows XP theme) |
| 1407 // for now, we will not honor it. | 1407 // for now, we will not honor it. |
| 1408 style->resetBorder(); | 1408 style->resetBorder(); |
| 1409 } | 1409 } |
| 1410 | 1410 |
| 1411 } // namespace WebCore | 1411 } // namespace WebCore |
| OLD | NEW |