| OLD | NEW |
| (Empty) | |
| 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. |
| 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
| 4 * Copyright (C) 2008 Collabora Ltd. |
| 5 * Copyright (C) 2008, 2009 Google Inc. |
| 6 * Copyright (C) 2009 Kenneth Rohde Christiansen |
| 7 * |
| 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either |
| 11 * version 2 of the License, or (at your option) any later version. |
| 12 * |
| 13 * This library is distributed in the hope that it will be useful, |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 * Library General Public License for more details. |
| 17 * |
| 18 * You should have received a copy of the GNU Library General Public License |
| 19 * along with this library; see the file COPYING.LIB. If not, write to |
| 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 21 * Boston, MA 02110-1301, USA. |
| 22 * |
| 23 */ |
| 24 |
| 25 #include "config.h" |
| 26 #include "core/paint/ThemePainterDefault.h" |
| 27 |
| 28 #include "core/layout/LayoutObject.h" |
| 29 #include "core/layout/LayoutProgress.h" |
| 30 #include "core/layout/LayoutTheme.h" |
| 31 #include "core/paint/MediaControlsPainter.h" |
| 32 #include "core/paint/PaintInfo.h" |
| 33 #include "platform/LayoutTestSupport.h" |
| 34 #include "platform/graphics/Color.h" |
| 35 #include "platform/graphics/GraphicsContext.h" |
| 36 #include "platform/graphics/GraphicsContextStateSaver.h" |
| 37 #include "public/platform/Platform.h" |
| 38 #include "public/platform/WebRect.h" |
| 39 #include "public/platform/WebThemeEngine.h" |
| 40 |
| 41 namespace blink { |
| 42 |
| 43 namespace { |
| 44 |
| 45 const unsigned defaultButtonBackgroundColor = 0xffdddddd; |
| 46 |
| 47 bool useMockTheme() |
| 48 { |
| 49 return LayoutTestSupport::isRunningLayoutTest(); |
| 50 } |
| 51 |
| 52 WebThemeEngine::State getWebThemeState(const LayoutObject* o) |
| 53 { |
| 54 if (!LayoutTheme::isEnabled(o)) |
| 55 return WebThemeEngine::StateDisabled; |
| 56 if (useMockTheme() && LayoutTheme::isReadOnlyControl(o)) |
| 57 return WebThemeEngine::StateReadonly; |
| 58 if (LayoutTheme::isPressed(o)) |
| 59 return WebThemeEngine::StatePressed; |
| 60 if (useMockTheme() && LayoutTheme::isFocused(o)) |
| 61 return WebThemeEngine::StateFocused; |
| 62 if (LayoutTheme::isHovered(o)) |
| 63 return WebThemeEngine::StateHover; |
| 64 |
| 65 return WebThemeEngine::StateNormal; |
| 66 } |
| 67 |
| 68 class DirectionFlippingScope { |
| 69 public: |
| 70 DirectionFlippingScope(LayoutObject*, const PaintInfo&, const IntRect&); |
| 71 ~DirectionFlippingScope(); |
| 72 |
| 73 private: |
| 74 bool m_needsFlipping; |
| 75 const PaintInfo& m_paintInfo; |
| 76 }; |
| 77 |
| 78 DirectionFlippingScope::DirectionFlippingScope(LayoutObject* layoutObject, const
PaintInfo& paintInfo, const IntRect& rect) |
| 79 : m_needsFlipping(!layoutObject->styleRef().isLeftToRightDirection()) |
| 80 , m_paintInfo(paintInfo) |
| 81 { |
| 82 if (!m_needsFlipping) |
| 83 return; |
| 84 m_paintInfo.context->save(); |
| 85 m_paintInfo.context->translate(2 * rect.x() + rect.width(), 0); |
| 86 m_paintInfo.context->scale(-1, 1); |
| 87 } |
| 88 |
| 89 DirectionFlippingScope::~DirectionFlippingScope() |
| 90 { |
| 91 if (!m_needsFlipping) |
| 92 return; |
| 93 m_paintInfo.context->restore(); |
| 94 } |
| 95 |
| 96 IntRect determinateProgressValueRectFor(LayoutProgress* layoutProgress, const In
tRect& rect) |
| 97 { |
| 98 int dx = rect.width() * layoutProgress->position(); |
| 99 return IntRect(rect.x(), rect.y(), dx, rect.height()); |
| 100 } |
| 101 |
| 102 IntRect indeterminateProgressValueRectFor(LayoutProgress* layoutProgress, const
IntRect& rect) |
| 103 { |
| 104 // Value comes from default of GTK+. |
| 105 static const int progressActivityBlocks = 5; |
| 106 |
| 107 int valueWidth = rect.width() / progressActivityBlocks; |
| 108 int movableWidth = rect.width() - valueWidth; |
| 109 if (movableWidth <= 0) |
| 110 return IntRect(); |
| 111 |
| 112 double progress = layoutProgress->animationProgress(); |
| 113 if (progress < 0.5) |
| 114 return IntRect(rect.x() + progress * 2 * movableWidth, rect.y(), valueWi
dth, rect.height()); |
| 115 return IntRect(rect.x() + (1.0 - progress) * 2 * movableWidth, rect.y(), val
ueWidth, rect.height()); |
| 116 } |
| 117 |
| 118 IntRect progressValueRectFor(LayoutProgress* layoutProgress, const IntRect& rect
) |
| 119 { |
| 120 return layoutProgress->isDeterminate() ? determinateProgressValueRectFor(lay
outProgress, rect) : indeterminateProgressValueRectFor(layoutProgress, rect); |
| 121 } |
| 122 |
| 123 IntRect convertToPaintingRect(LayoutObject* inputLayoutObject, const LayoutObjec
t* partLayoutObject, LayoutRect partRect, const IntRect& localOffset) |
| 124 { |
| 125 // Compute an offset between the partLayoutObject and the inputLayoutObject. |
| 126 LayoutSize offsetFromInputLayoutObject = -partLayoutObject->offsetFromAncest
orContainer(inputLayoutObject); |
| 127 // Move the rect into partLayoutObject's coords. |
| 128 partRect.move(offsetFromInputLayoutObject); |
| 129 // Account for the local drawing offset. |
| 130 partRect.move(localOffset.x(), localOffset.y()); |
| 131 |
| 132 return pixelSnappedIntRect(partRect); |
| 133 } |
| 134 |
| 135 } // namespace |
| 136 |
| 137 bool ThemePainterDefault::paintCheckbox(LayoutObject* o, const PaintInfo& i, con
st IntRect& rect) |
| 138 { |
| 139 WebThemeEngine::ExtraParams extraParams; |
| 140 WebCanvas* canvas = i.context->canvas(); |
| 141 extraParams.button.checked = LayoutTheme::isChecked(o); |
| 142 extraParams.button.indeterminate = LayoutTheme::isIndeterminate(o); |
| 143 |
| 144 float zoomLevel = o->style()->effectiveZoom(); |
| 145 GraphicsContextStateSaver stateSaver(*i.context, false); |
| 146 IntRect unzoomedRect = rect; |
| 147 if (zoomLevel != 1) { |
| 148 stateSaver.save(); |
| 149 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); |
| 150 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); |
| 151 i.context->translate(unzoomedRect.x(), unzoomedRect.y()); |
| 152 i.context->scale(zoomLevel, zoomLevel); |
| 153 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); |
| 154 } |
| 155 |
| 156 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartCheckb
ox, getWebThemeState(o), WebRect(unzoomedRect), &extraParams); |
| 157 return false; |
| 158 } |
| 159 |
| 160 bool ThemePainterDefault::paintRadio(LayoutObject* o, const PaintInfo& i, const
IntRect& rect) |
| 161 { |
| 162 WebThemeEngine::ExtraParams extraParams; |
| 163 WebCanvas* canvas = i.context->canvas(); |
| 164 extraParams.button.checked = LayoutTheme::isChecked(o); |
| 165 |
| 166 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartRadio,
getWebThemeState(o), WebRect(rect), &extraParams); |
| 167 return false; |
| 168 } |
| 169 |
| 170 bool ThemePainterDefault::paintButton(LayoutObject* o, const PaintInfo& i, const
IntRect& rect) |
| 171 { |
| 172 WebThemeEngine::ExtraParams extraParams; |
| 173 WebCanvas* canvas = i.context->canvas(); |
| 174 extraParams.button.hasBorder = true; |
| 175 extraParams.button.backgroundColor = useMockTheme() ? 0xffc0c0c0 : defaultBu
ttonBackgroundColor; |
| 176 if (o->hasBackground()) |
| 177 extraParams.button.backgroundColor = o->resolveColor(CSSPropertyBackgrou
ndColor).rgb(); |
| 178 |
| 179 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartButton
, getWebThemeState(o), WebRect(rect), &extraParams); |
| 180 return false; |
| 181 } |
| 182 |
| 183 bool ThemePainterDefault::paintTextField(LayoutObject* o, const PaintInfo& i, co
nst IntRect& rect) |
| 184 { |
| 185 // WebThemeEngine does not handle border rounded corner and background image |
| 186 // so return true to draw CSS border and background. |
| 187 if (o->style()->hasBorderRadius() || o->style()->hasBackgroundImage()) |
| 188 return true; |
| 189 |
| 190 ControlPart part = o->style()->appearance(); |
| 191 |
| 192 WebThemeEngine::ExtraParams extraParams; |
| 193 extraParams.textField.isTextArea = part == TextAreaPart; |
| 194 extraParams.textField.isListbox = part == ListboxPart; |
| 195 |
| 196 WebCanvas* canvas = i.context->canvas(); |
| 197 |
| 198 Color backgroundColor = o->resolveColor(CSSPropertyBackgroundColor); |
| 199 extraParams.textField.backgroundColor = backgroundColor.rgb(); |
| 200 |
| 201 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartTextFi
eld, getWebThemeState(o), WebRect(rect), &extraParams); |
| 202 return false; |
| 203 } |
| 204 |
| 205 bool ThemePainterDefault::paintMenuList(LayoutObject* o, const PaintInfo& i, con
st IntRect& rect) |
| 206 { |
| 207 if (!o->isBox()) |
| 208 return false; |
| 209 |
| 210 const int right = rect.x() + rect.width(); |
| 211 const int middle = rect.y() + rect.height() / 2; |
| 212 |
| 213 WebThemeEngine::ExtraParams extraParams; |
| 214 extraParams.menuList.arrowY = middle; |
| 215 const LayoutBox* box = toLayoutBox(o); |
| 216 // Match Chromium Win behaviour of showing all borders if any are shown. |
| 217 extraParams.menuList.hasBorder = box->borderRight() || box->borderLeft() ||
box->borderTop() || box->borderBottom(); |
| 218 extraParams.menuList.hasBorderRadius = o->style()->hasBorderRadius(); |
| 219 // Fallback to transparent if the specified color object is invalid. |
| 220 Color backgroundColor(Color::transparent); |
| 221 if (o->hasBackground()) |
| 222 backgroundColor = o->resolveColor(CSSPropertyBackgroundColor); |
| 223 extraParams.menuList.backgroundColor = backgroundColor.rgb(); |
| 224 |
| 225 // If we have a background image, don't fill the content area to expose the |
| 226 // parent's background. Also, we shouldn't fill the content area if the |
| 227 // alpha of the color is 0. The API of Windows GDI ignores the alpha. |
| 228 // FIXME: the normal Aura theme doesn't care about this, so we should |
| 229 // investigate if we really need fillContentArea. |
| 230 extraParams.menuList.fillContentArea = !o->style()->hasBackgroundImage() &&
backgroundColor.alpha(); |
| 231 |
| 232 if (useMockTheme()) { |
| 233 // The size and position of the drop-down button is different between |
| 234 // the mock theme and the regular aura theme. |
| 235 int spacingTop = box->borderTop() + box->paddingTop(); |
| 236 int spacingBottom = box->borderBottom() + box->paddingBottom(); |
| 237 int spacingRight = box->borderRight() + box->paddingRight(); |
| 238 extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x(
) + 4 + spacingRight: right - 13 - spacingRight; |
| 239 extraParams.menuList.arrowHeight = rect.height() - spacingBottom - spaci
ngTop; |
| 240 } else { |
| 241 extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x(
) + 7 : right - 13; |
| 242 } |
| 243 |
| 244 WebCanvas* canvas = i.context->canvas(); |
| 245 |
| 246 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartMenuLi
st, getWebThemeState(o), WebRect(rect), &extraParams); |
| 247 return false; |
| 248 } |
| 249 |
| 250 bool ThemePainterDefault::paintMenuListButton(LayoutObject* o, const PaintInfo&
i, const IntRect& rect) |
| 251 { |
| 252 if (!o->isBox()) |
| 253 return false; |
| 254 |
| 255 const int right = rect.x() + rect.width(); |
| 256 const int middle = rect.y() + rect.height() / 2; |
| 257 |
| 258 WebThemeEngine::ExtraParams extraParams; |
| 259 extraParams.menuList.arrowY = middle; |
| 260 extraParams.menuList.hasBorder = false; |
| 261 extraParams.menuList.hasBorderRadius = o->style()->hasBorderRadius(); |
| 262 extraParams.menuList.backgroundColor = Color::transparent; |
| 263 extraParams.menuList.fillContentArea = false; |
| 264 |
| 265 if (useMockTheme()) { |
| 266 const LayoutBox* box = toLayoutBox(o); |
| 267 // The size and position of the drop-down button is different between |
| 268 // the mock theme and the regular aura theme. |
| 269 int spacingTop = box->borderTop() + box->paddingTop(); |
| 270 int spacingBottom = box->borderBottom() + box->paddingBottom(); |
| 271 int spacingRight = box->borderRight() + box->paddingRight(); |
| 272 extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x(
) + 4 + spacingRight: right - 13 - spacingRight; |
| 273 extraParams.menuList.arrowHeight = rect.height() - spacingBottom - spaci
ngTop; |
| 274 } else { |
| 275 extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x(
) + 7 : right - 13; |
| 276 } |
| 277 |
| 278 WebCanvas* canvas = i.context->canvas(); |
| 279 |
| 280 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartMenuLi
st, getWebThemeState(o), WebRect(rect), &extraParams); |
| 281 return false; |
| 282 } |
| 283 |
| 284 bool ThemePainterDefault::paintSliderTrack(LayoutObject* o, const PaintInfo& i,
const IntRect& rect) |
| 285 { |
| 286 WebThemeEngine::ExtraParams extraParams; |
| 287 WebCanvas* canvas = i.context->canvas(); |
| 288 extraParams.slider.vertical = o->style()->appearance() == SliderVerticalPart
; |
| 289 |
| 290 paintSliderTicks(o, i, rect); |
| 291 |
| 292 // FIXME: Mock theme doesn't handle zoomed sliders. |
| 293 float zoomLevel = useMockTheme() ? 1 : o->style()->effectiveZoom(); |
| 294 GraphicsContextStateSaver stateSaver(*i.context, false); |
| 295 IntRect unzoomedRect = rect; |
| 296 if (zoomLevel != 1) { |
| 297 stateSaver.save(); |
| 298 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); |
| 299 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); |
| 300 i.context->translate(unzoomedRect.x(), unzoomedRect.y()); |
| 301 i.context->scale(zoomLevel, zoomLevel); |
| 302 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); |
| 303 } |
| 304 |
| 305 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartSlider
Track, getWebThemeState(o), WebRect(unzoomedRect), &extraParams); |
| 306 |
| 307 return false; |
| 308 } |
| 309 |
| 310 bool ThemePainterDefault::paintSliderThumb(LayoutObject* o, const PaintInfo& i,
const IntRect& rect) |
| 311 { |
| 312 WebThemeEngine::ExtraParams extraParams; |
| 313 WebCanvas* canvas = i.context->canvas(); |
| 314 extraParams.slider.vertical = o->style()->appearance() == SliderThumbVertica
lPart; |
| 315 extraParams.slider.inDrag = LayoutTheme::isPressed(o); |
| 316 |
| 317 // FIXME: Mock theme doesn't handle zoomed sliders. |
| 318 float zoomLevel = useMockTheme() ? 1 : o->style()->effectiveZoom(); |
| 319 GraphicsContextStateSaver stateSaver(*i.context, false); |
| 320 IntRect unzoomedRect = rect; |
| 321 if (zoomLevel != 1) { |
| 322 stateSaver.save(); |
| 323 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); |
| 324 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); |
| 325 i.context->translate(unzoomedRect.x(), unzoomedRect.y()); |
| 326 i.context->scale(zoomLevel, zoomLevel); |
| 327 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); |
| 328 } |
| 329 |
| 330 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartSlider
Thumb, getWebThemeState(o), WebRect(unzoomedRect), &extraParams); |
| 331 return false; |
| 332 } |
| 333 |
| 334 bool ThemePainterDefault::paintInnerSpinButton(LayoutObject* o, const PaintInfo&
i, const IntRect& rect) |
| 335 { |
| 336 WebThemeEngine::ExtraParams extraParams; |
| 337 WebCanvas* canvas = i.context->canvas(); |
| 338 extraParams.innerSpin.spinUp = (LayoutTheme::controlStatesForLayoutObject(o)
& SpinUpControlState); |
| 339 extraParams.innerSpin.readOnly = LayoutTheme::isReadOnlyControl(o); |
| 340 |
| 341 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartInnerS
pinButton, getWebThemeState(o), WebRect(rect), &extraParams); |
| 342 return false; |
| 343 } |
| 344 |
| 345 bool ThemePainterDefault::paintProgressBar(LayoutObject* o, const PaintInfo& i,
const IntRect& rect) |
| 346 { |
| 347 if (!o->isProgress()) |
| 348 return true; |
| 349 |
| 350 LayoutProgress* layoutProgress = toLayoutProgress(o); |
| 351 IntRect valueRect = progressValueRectFor(layoutProgress, rect); |
| 352 |
| 353 WebThemeEngine::ExtraParams extraParams; |
| 354 extraParams.progressBar.determinate = layoutProgress->isDeterminate(); |
| 355 extraParams.progressBar.valueRectX = valueRect.x(); |
| 356 extraParams.progressBar.valueRectY = valueRect.y(); |
| 357 extraParams.progressBar.valueRectWidth = valueRect.width(); |
| 358 extraParams.progressBar.valueRectHeight = valueRect.height(); |
| 359 |
| 360 DirectionFlippingScope scope(o, i, rect); |
| 361 WebCanvas* canvas = i.context->canvas(); |
| 362 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartProgre
ssBar, getWebThemeState(o), WebRect(rect), &extraParams); |
| 363 return false; |
| 364 } |
| 365 |
| 366 bool ThemePainterDefault::paintTextArea(LayoutObject* o, const PaintInfo& i, con
st IntRect& r) |
| 367 { |
| 368 return paintTextField(o, i, r); |
| 369 } |
| 370 |
| 371 bool ThemePainterDefault::paintSearchField(LayoutObject* o, const PaintInfo& i,
const IntRect& r) |
| 372 { |
| 373 return paintTextField(o, i, r); |
| 374 } |
| 375 |
| 376 bool ThemePainterDefault::paintSearchFieldCancelButton(LayoutObject* cancelButto
nObject, const PaintInfo& paintInfo, const IntRect& r) |
| 377 { |
| 378 // Get the layoutObject of <input> element. |
| 379 if (!cancelButtonObject->node()) |
| 380 return false; |
| 381 Node* input = cancelButtonObject->node()->shadowHost(); |
| 382 LayoutObject* baseLayoutObject = input ? input->layoutObject() : cancelButto
nObject; |
| 383 if (!baseLayoutObject->isBox()) |
| 384 return false; |
| 385 LayoutBox* inputLayoutBox = toLayoutBox(baseLayoutObject); |
| 386 LayoutRect inputContentBox = inputLayoutBox->contentBoxRect(); |
| 387 |
| 388 // Make sure the scaled button stays square and will fit in its parent's box
. |
| 389 LayoutUnit cancelButtonSize = std::min(inputContentBox.width(), std::min<Lay
outUnit>(inputContentBox.height(), r.height())); |
| 390 // Calculate cancel button's coordinates relative to the input element. |
| 391 // Center the button vertically. Round up though, so if it has to be one pi
xel off-center, it will |
| 392 // be one pixel closer to the bottom of the field. This tends to look bette
r with the text. |
| 393 LayoutRect cancelButtonRect(cancelButtonObject->offsetFromAncestorContainer(
inputLayoutBox).width(), |
| 394 inputContentBox.y() + (inputContentBox.height() - cancelButtonSize + 1)
/ 2, |
| 395 cancelButtonSize, cancelButtonSize); |
| 396 IntRect paintingRect = convertToPaintingRect(inputLayoutBox, cancelButtonObj
ect, cancelButtonRect, r); |
| 397 |
| 398 DEFINE_STATIC_REF(Image, cancelImage, (Image::loadPlatformResource("searchCa
ncel"))); |
| 399 DEFINE_STATIC_REF(Image, cancelPressedImage, (Image::loadPlatformResource("s
earchCancelPressed"))); |
| 400 paintInfo.context->drawImage(LayoutTheme::isPressed(cancelButtonObject) ? ca
ncelPressedImage : cancelImage, paintingRect); |
| 401 return false; |
| 402 } |
| 403 |
| 404 bool ThemePainterDefault::paintSearchFieldResultsDecoration(LayoutObject* magnif
ierObject, const PaintInfo& paintInfo, const IntRect& r) |
| 405 { |
| 406 // Get the layoutObject of <input> element. |
| 407 if (!magnifierObject->node()) |
| 408 return false; |
| 409 Node* input = magnifierObject->node()->shadowHost(); |
| 410 LayoutObject* baseLayoutObject = input ? input->layoutObject() : magnifierOb
ject; |
| 411 if (!baseLayoutObject->isBox()) |
| 412 return false; |
| 413 LayoutBox* inputLayoutBox = toLayoutBox(baseLayoutObject); |
| 414 LayoutRect inputContentBox = inputLayoutBox->contentBoxRect(); |
| 415 |
| 416 // Make sure the scaled decoration stays square and will fit in its parent's
box. |
| 417 LayoutUnit magnifierSize = std::min(inputContentBox.width(), std::min<Layout
Unit>(inputContentBox.height(), r.height())); |
| 418 // Calculate decoration's coordinates relative to the input element. |
| 419 // Center the decoration vertically. Round up though, so if it has to be on
e pixel off-center, it will |
| 420 // be one pixel closer to the bottom of the field. This tends to look bette
r with the text. |
| 421 LayoutRect magnifierRect(magnifierObject->offsetFromAncestorContainer(inputL
ayoutBox).width(), |
| 422 inputContentBox.y() + (inputContentBox.height() - magnifierSize + 1) / 2
, |
| 423 magnifierSize, magnifierSize); |
| 424 IntRect paintingRect = convertToPaintingRect(inputLayoutBox, magnifierObject
, magnifierRect, r); |
| 425 |
| 426 DEFINE_STATIC_REF(Image, magnifierImage, (Image::loadPlatformResource("searc
hMagnifier"))); |
| 427 paintInfo.context->drawImage(magnifierImage, paintingRect); |
| 428 return false; |
| 429 } |
| 430 |
| 431 bool ThemePainterDefault::paintMediaSliderTrack(LayoutObject* object, const Pain
tInfo& paintInfo, const IntRect& rect) |
| 432 { |
| 433 return MediaControlsPainter::paintMediaControlsPart(MediaSlider, object, pai
ntInfo, rect); |
| 434 } |
| 435 |
| 436 bool ThemePainterDefault::paintMediaVolumeSliderTrack(LayoutObject* object, cons
t PaintInfo& paintInfo, const IntRect& rect) |
| 437 { |
| 438 return MediaControlsPainter::paintMediaControlsPart(MediaVolumeSlider, objec
t, paintInfo, rect); |
| 439 } |
| 440 |
| 441 bool ThemePainterDefault::paintMediaSliderThumb(LayoutObject* object, const Pain
tInfo& paintInfo, const IntRect& rect) |
| 442 { |
| 443 return MediaControlsPainter::paintMediaControlsPart(MediaSliderThumb, object
, paintInfo, rect); |
| 444 } |
| 445 |
| 446 bool ThemePainterDefault::paintMediaToggleClosedCaptionsButton(LayoutObject* o,
const PaintInfo& paintInfo, const IntRect& r) |
| 447 { |
| 448 return MediaControlsPainter::paintMediaControlsPart(MediaShowClosedCaptionsB
utton, o, paintInfo, r); |
| 449 } |
| 450 |
| 451 bool ThemePainterDefault::paintMediaCastButton(LayoutObject* o, const PaintInfo&
paintInfo, const IntRect& r) |
| 452 { |
| 453 return MediaControlsPainter::paintMediaControlsPart(MediaCastOffButton, o, p
aintInfo, r); |
| 454 } |
| 455 |
| 456 bool ThemePainterDefault::paintMediaVolumeSliderThumb(LayoutObject* object, cons
t PaintInfo& paintInfo, const IntRect& rect) |
| 457 { |
| 458 return MediaControlsPainter::paintMediaControlsPart(MediaVolumeSliderThumb,
object, paintInfo, rect); |
| 459 } |
| 460 |
| 461 bool ThemePainterDefault::paintMediaPlayButton(LayoutObject* object, const Paint
Info& paintInfo, const IntRect& rect) |
| 462 { |
| 463 return MediaControlsPainter::paintMediaControlsPart(MediaPlayButton, object,
paintInfo, rect); |
| 464 } |
| 465 |
| 466 bool ThemePainterDefault::paintMediaOverlayPlayButton(LayoutObject* object, cons
t PaintInfo& paintInfo, const IntRect& rect) |
| 467 { |
| 468 return MediaControlsPainter::paintMediaControlsPart(MediaOverlayPlayButton,
object, paintInfo, rect); |
| 469 } |
| 470 |
| 471 bool ThemePainterDefault::paintMediaMuteButton(LayoutObject* object, const Paint
Info& paintInfo, const IntRect& rect) |
| 472 { |
| 473 return MediaControlsPainter::paintMediaControlsPart(MediaMuteButton, object,
paintInfo, rect); |
| 474 } |
| 475 |
| 476 bool ThemePainterDefault::paintMediaFullscreenButton(LayoutObject* object, const
PaintInfo& paintInfo, const IntRect& rect) |
| 477 { |
| 478 return MediaControlsPainter::paintMediaControlsPart(MediaEnterFullscreenButt
on, object, paintInfo, rect); |
| 479 } |
| 480 |
| 481 } // namespace blink |
| OLD | NEW |