RenderThemeManx.cpp 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. /*
  2. * Copyright (C) 2008 Apple Computer, Inc. All rights reserved.
  3. * Copyright (C) 2009 Google Inc.
  4. * Copyright (C) 2012 Sony Computer Entertainment Inc.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. * 1. Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. * 2. Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. *
  15. * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
  16. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  17. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  18. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
  19. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  20. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  21. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  22. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  23. * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  25. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. #include "config.h"
  28. #include "RenderThemeManx.h"
  29. #include "BitmapImage.h"
  30. #include "CSSValueKeywords.h"
  31. #include "GraphicsContext.h"
  32. #include "Image.h"
  33. #include "NotImplemented.h"
  34. #include "PaintInfo.h"
  35. #include "SharedBuffer.h"
  36. #include "UserAgentStyleSheets.h"
  37. #include <wtf/text/StringConcatenate.h>
  38. #if ENABLE(VIDEO)
  39. #include "HTMLMediaElement.h"
  40. #include "RenderMediaControls.h"
  41. #endif
  42. namespace WebCore {
  43. static const unsigned aquaFocusRingColor = 0xFF7DADD9;
  44. RenderThemeManx::~RenderThemeManx()
  45. {
  46. }
  47. PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page* page)
  48. {
  49. static RenderTheme* rt = RenderThemeManx::create().leakRef();
  50. return rt;
  51. }
  52. PassRefPtr<RenderTheme> RenderThemeManx::create()
  53. {
  54. return adoptRef(new RenderThemeManx());
  55. }
  56. #if ENABLE(VIDEO)
  57. String RenderThemeManx::extraMediaControlsStyleSheet()
  58. {
  59. #if OS(PSP2)
  60. return String(mediaControlsManxPSP2UserAgentStyleSheet, sizeof(mediaControlsManxPSP2UserAgentStyleSheet));
  61. #elif OS(ORBIS)
  62. return String(mediaControlsManxOrbisUserAgentStyleSheet, sizeof(mediaControlsManxOrbisUserAgentStyleSheet));
  63. #endif
  64. }
  65. #endif
  66. #if ENABLE(FULLSCREEN_API)
  67. String RenderThemeManx::extraFullScreenStyleSheet()
  68. {
  69. #if OS(PSP2)
  70. return String(fullscreenManxPSP2UserAgentStyleSheet, sizeof(fullscreenManxPSP2UserAgentStyleSheet));
  71. #elif OS(ORBIS)
  72. return String(fullscreenManxOrbisUserAgentStyleSheet, sizeof(fullscreenManxOrbisUserAgentStyleSheet));
  73. #endif
  74. }
  75. #endif
  76. PassRefPtr<Image> RenderThemeManx::loadThemeImage(const char* name)
  77. {
  78. static const char *path = getenv("WEBKIT_THEME_PATH");
  79. RefPtr<BitmapImage> img = BitmapImage::create();
  80. if (path) {
  81. RefPtr<SharedBuffer> buffer = SharedBuffer::createWithContentsOfFile(makeString(path, "/", name, ".png"));
  82. if (buffer)
  83. img->setData(buffer.release(), true);
  84. }
  85. return img.release();
  86. }
  87. void RenderThemeManx::paintThemeImage(GraphicsContext* ctx, Image* image, const IntRect& rect,
  88. ColorSpace styleColorSpace)
  89. {
  90. ctx->drawImage(image, styleColorSpace, rect);
  91. }
  92. void RenderThemeManx::paintThemeImage3x3(GraphicsContext* ctx, Image* image, const IntRect& rect,
  93. int left, int right, int top, int bottom,
  94. ColorSpace styleColorSpace)
  95. {
  96. IntRect dstRect = rect;
  97. IntRect srcRect = image->rect();
  98. // top-left
  99. ctx->drawImage(image, styleColorSpace,
  100. IntRect(dstRect.x(), dstRect.y(), left, top),
  101. IntRect(srcRect.x(), srcRect.y(), left, top));
  102. // top-middle
  103. ctx->drawImage(image, styleColorSpace,
  104. IntRect(dstRect.x() + left, dstRect.y(), dstRect.width() - left - right, top),
  105. IntRect(srcRect.x() + left, srcRect.y(), srcRect.width() - left - right, top));
  106. // top-right
  107. ctx->drawImage(image, styleColorSpace,
  108. IntRect(dstRect.x() + dstRect.width() - right, dstRect.y(), right, top),
  109. IntRect(srcRect.x() + srcRect.width() - right, srcRect.y(), right, top));
  110. // middle-left
  111. ctx->drawImage(image, styleColorSpace,
  112. IntRect(dstRect.x(), dstRect.y() + top, left, dstRect.height() - top - bottom),
  113. IntRect(srcRect.x(), srcRect.y() + top, left, srcRect.height() - top - bottom));
  114. // middle-middle
  115. ctx->drawImage(image, styleColorSpace,
  116. IntRect(dstRect.x() + left, dstRect.y() + top, dstRect.width() - left - right, dstRect.height() - top - bottom),
  117. IntRect(srcRect.x() + left, srcRect.y() + top, srcRect.width() - left - right, srcRect.height() - top - bottom));
  118. // middle-right
  119. ctx->drawImage(image, styleColorSpace,
  120. IntRect(dstRect.x() + dstRect.width() - right, dstRect.y() + top, right, dstRect.height() - top - bottom),
  121. IntRect(srcRect.x() + srcRect.width() - right, srcRect.y() + top, right, srcRect.height() - top - bottom));
  122. // bottom-left
  123. ctx->drawImage(image, styleColorSpace,
  124. IntRect(dstRect.x(), dstRect.y() + dstRect.height() - bottom, left, bottom),
  125. IntRect(srcRect.x(), srcRect.y() + srcRect.height() - bottom, left, bottom));
  126. // bottom-middle
  127. ctx->drawImage(image, styleColorSpace,
  128. IntRect(dstRect.x() + left, dstRect.y() + dstRect.height() - bottom, dstRect.width() - left - right, bottom),
  129. IntRect(srcRect.x() + left, srcRect.y() + srcRect.height() - bottom, srcRect.width() - left - right, bottom));
  130. // bottom-right
  131. ctx->drawImage(image, styleColorSpace,
  132. IntRect(dstRect.x() + dstRect.width() - right, dstRect.y() + dstRect.height() - bottom, right, bottom),
  133. IntRect(srcRect.x() + srcRect.width() - right, srcRect.y() + srcRect.height() - bottom, right, bottom));
  134. }
  135. bool RenderThemeManx::supportsHover(const RenderStyle*) const
  136. {
  137. return true;
  138. }
  139. bool RenderThemeManx::supportsFocusRing(const RenderStyle*) const
  140. {
  141. return false;
  142. }
  143. Color RenderThemeManx::platformFocusRingColor() const
  144. {
  145. return aquaFocusRingColor;
  146. }
  147. void RenderThemeManx::systemFont(int propId, FontDescription& fontDescription) const
  148. {
  149. float fontSize = 16;
  150. switch (propId) {
  151. case CSSValueWebkitMiniControl:
  152. case CSSValueWebkitSmallControl:
  153. case CSSValueWebkitControl:
  154. // Why 2 points smaller? Because that's what Gecko does. Note that we
  155. // are assuming a 96dpi screen, which is the default that we use on
  156. // Windows.
  157. static const float pointsPerInch = 72.0f;
  158. static const float pixelsPerInch = 96.0f;
  159. fontSize -= (2.0f / pointsPerInch) * pixelsPerInch;
  160. break;
  161. }
  162. fontDescription.setOneFamily("sans-serif");
  163. fontDescription.setSpecifiedSize(fontSize);
  164. fontDescription.setIsAbsoluteSize(true);
  165. fontDescription.setGenericFamily(FontDescription::NoFamily);
  166. fontDescription.setWeight(FontWeightNormal);
  167. fontDescription.setItalic(false);
  168. }
  169. bool RenderThemeManx::paintCheckbox(RenderObject* obj, const PaintInfo& info, const IntRect& rect)
  170. {
  171. static Image* const onNormal = loadThemeImage("checkbox/checkbox_on_normal").leakRef();
  172. static Image* const onFocus = loadThemeImage("checkbox/checkbox_on_focus").leakRef();
  173. static Image* const onHover = loadThemeImage("checkbox/checkbox_on_hover").leakRef();
  174. static Image* const offNormal = loadThemeImage("checkbox/checkbox_off_normal").leakRef();
  175. static Image* const offFocus = loadThemeImage("checkbox/checkbox_off_focus").leakRef();
  176. static Image* const offHover = loadThemeImage("checkbox/checkbox_off_hover").leakRef();
  177. Image* image;
  178. if (this->isChecked(obj))
  179. image = isFocused(obj) ? onFocus : isHovered(obj) ? onHover : onNormal;
  180. else
  181. image = isFocused(obj) ? offFocus : isHovered(obj) ? offHover : offNormal;
  182. paintThemeImage(info.context, image, rect, obj->style()->colorSpace());
  183. return false;
  184. }
  185. void RenderThemeManx::setCheckboxSize(RenderStyle* style) const
  186. {
  187. // width and height both specified so do nothing
  188. if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto())
  189. return;
  190. // hardcode size to 13 to match Firefox
  191. if (style->width().isIntrinsicOrAuto())
  192. style->setWidth(Length(13, Fixed));
  193. if (style->height().isAuto())
  194. style->setHeight(Length(13, Fixed));
  195. }
  196. bool RenderThemeManx::paintRadio(RenderObject* obj, const PaintInfo& info, const IntRect& rect)
  197. {
  198. static Image* const onNormal = loadThemeImage("radio/radio_on_normal").leakRef();
  199. static Image* const onFocus = loadThemeImage("radio/radio_on_focus").leakRef();
  200. static Image* const onHover = loadThemeImage("radio/radio_on_hover").leakRef();
  201. static Image* const offNormal = loadThemeImage("radio/radio_off_normal").leakRef();
  202. static Image* const offFocus = loadThemeImage("radio/radio_off_focus").leakRef();
  203. static Image* const offHover = loadThemeImage("radio/radio_off_hover").leakRef();
  204. Image* image;
  205. if (isChecked(obj))
  206. image = isFocused(obj) ? onFocus : isHovered(obj) ? onHover : onNormal;
  207. else
  208. image = isFocused(obj) ? offFocus : isHovered(obj) ? offHover : offNormal;
  209. paintThemeImage(info.context, image, rect, obj->style()->colorSpace());
  210. return false;
  211. }
  212. void RenderThemeManx::setRadioSize(RenderStyle* style) const
  213. {
  214. // width and height both specified so do nothing
  215. if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto())
  216. return;
  217. // hardcode size to 13 to match Firefox
  218. if (style->width().isIntrinsicOrAuto())
  219. style->setWidth(Length(13, Fixed));
  220. if (style->height().isAuto())
  221. style->setHeight(Length(13, Fixed));
  222. }
  223. void RenderThemeManx::adjustButtonStyle(StyleResolver*, RenderStyle* style, Element*) const
  224. {
  225. // ignore line-height
  226. if (style->appearance() == PushButtonPart)
  227. style->setLineHeight(RenderStyle::initialLineHeight());
  228. }
  229. bool RenderThemeManx::paintButton(RenderObject* obj, const PaintInfo& info, const IntRect& rect)
  230. {
  231. static Image* const normal = loadThemeImage("button/button_normal").leakRef();
  232. static Image* const press = loadThemeImage("button/button_press").leakRef();
  233. static Image* const focus = loadThemeImage("button/button_focus").leakRef();
  234. static Image* const hover = loadThemeImage("button/button_hover").leakRef();
  235. Image* image = isPressed(obj) ? press : isFocused(obj) ? focus : isHovered(obj) ? hover : normal;
  236. paintThemeImage3x3(info.context, image, rect, 6, 6, 6, 6, obj->style()->colorSpace());
  237. return false;
  238. }
  239. void RenderThemeManx::adjustMenuListStyle(StyleResolver*, RenderStyle* style, Element*) const
  240. {
  241. // The tests check explicitly that select menu buttons ignore line height.
  242. style->setLineHeight(RenderStyle::initialLineHeight());
  243. // We cannot give a proper rendering when border radius is active, unfortunately.
  244. style->resetBorderRadius();
  245. }
  246. bool RenderThemeManx::paintMenuList(RenderObject* obj, const PaintInfo& info, const IntRect& rect)
  247. {
  248. static Image* const normal = loadThemeImage("menulist/menulist_normal").leakRef();
  249. static Image* const press = loadThemeImage("menulist/menulist_press").leakRef();
  250. static Image* const focus = loadThemeImage("menulist/menulist_focus").leakRef();
  251. static Image* const hover = loadThemeImage("menulist/menulist_hover").leakRef();
  252. Image* image = isPressed(obj) ? press : isFocused(obj) ? focus : isHovered(obj) ? hover : normal;
  253. paintThemeImage3x3(info.context, image, rect, 6, 20, 6, 6, obj->style()->colorSpace());
  254. return paintMenuListButton(obj, info, rect);
  255. }
  256. void RenderThemeManx::adjustMenuListButtonStyle(StyleResolver* selector, RenderStyle* style, Element* element) const
  257. {
  258. adjustMenuListStyle(selector, style, element);
  259. }
  260. bool RenderThemeManx::paintMenuListButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
  261. {
  262. IntRect bounds = IntRect(r.x() + o->style()->borderLeftWidth(),
  263. r.y() + o->style()->borderTopWidth(),
  264. r.width() - o->style()->borderLeftWidth() - o->style()->borderRightWidth(),
  265. r.height() - o->style()->borderTopWidth() - o->style()->borderBottomWidth());
  266. const float arrowHeight = 5;
  267. const float arrowWidth = 7;
  268. const int arrowPaddingLeft = 5;
  269. const int arrowPaddingRight = 5;
  270. // Since we actually know the size of the control here, we restrict the font scale to make sure the arrow will fit vertically in the bounds
  271. float centerY = bounds.y() + bounds.height() / 2.0f;
  272. float leftEdge = bounds.maxX() - arrowPaddingRight - arrowWidth;
  273. float buttonWidth = arrowPaddingLeft + arrowWidth + arrowPaddingRight;
  274. if (bounds.width() < arrowWidth + arrowPaddingLeft)
  275. return false;
  276. GraphicsContext& context = *paintInfo.context;
  277. context.save();
  278. // Draw button background
  279. int fgGray = isPressed(o) ? 247 : isHovered(o) ? 84 : 94;
  280. int bgGray = isPressed(o) ? 84 : isHovered(o) ? 216 : 226;
  281. Color fgColor(fgGray, fgGray, fgGray);
  282. Color bgColor(bgGray, bgGray, bgGray);
  283. context.setStrokeStyle(SolidStroke);
  284. context.setStrokeColor(fgColor, ColorSpaceDeviceRGB);
  285. context.setFillColor(bgColor, ColorSpaceDeviceRGB);
  286. FloatRect button(bounds.maxX() - buttonWidth, bounds.y(), buttonWidth, bounds.height());
  287. button.inflate(-2);
  288. context.fillRect(button);
  289. context.strokeRect(button, 1);
  290. // Draw the arrow
  291. context.setFillColor(fgColor, ColorSpaceDeviceRGB);
  292. context.setStrokeColor(NoStroke, ColorSpaceDeviceRGB);
  293. FloatPoint arrow[3];
  294. arrow[0] = FloatPoint(leftEdge, centerY - arrowHeight / 2.0f);
  295. arrow[1] = FloatPoint(leftEdge + arrowWidth, centerY - arrowHeight / 2.0f);
  296. arrow[2] = FloatPoint(leftEdge + arrowWidth / 2.0f, centerY + arrowHeight / 2.0f);
  297. context.drawConvexPolygon(3, arrow, true);
  298. context.restore();
  299. return false;
  300. }
  301. bool RenderThemeManx::paintTextArea(RenderObject* obj, const PaintInfo& info, const IntRect& rect)
  302. {
  303. #if OS(PSP2)
  304. if (obj->style()->appearance() == ListboxPart)
  305. return paintMenuList(obj, info, rect);
  306. #endif
  307. return true;
  308. }
  309. int RenderThemeManx::popupInternalPaddingLeft(RenderStyle*) const
  310. {
  311. return 5;
  312. }
  313. int RenderThemeManx::popupInternalPaddingRight(RenderStyle*) const
  314. {
  315. return 5 + 20; // offset 20 for menulist button icon
  316. }
  317. int RenderThemeManx::popupInternalPaddingTop(RenderStyle*) const
  318. {
  319. return 3;
  320. }
  321. int RenderThemeManx::popupInternalPaddingBottom(RenderStyle*) const
  322. {
  323. return 3;
  324. }
  325. #if ENABLE(VIDEO)
  326. static bool paintDummyButton(RenderObject* object, const PaintInfo& info, const IntRect& rect, Color color = Color(0, 255, 0))
  327. {
  328. info.context->save();
  329. info.context->setFillColor(color, ColorSpaceDeviceRGB);
  330. info.context->drawRect(rect);
  331. info.context->restore();
  332. return true;
  333. }
  334. static bool paintDummyBackground(RenderObject* object, const PaintInfo& info, const IntRect& rect, Color color = Color(Color::darkGray))
  335. {
  336. info.context->save();
  337. info.context->setStrokeStyle(NoStroke);
  338. info.context->setFillColor(color, ColorSpaceDeviceRGB);
  339. info.context->drawRect(rect);
  340. info.context->restore();
  341. return true;
  342. }
  343. static bool paintMediaSlider(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
  344. {
  345. HTMLMediaElement* mediaElement = toParentMediaElement(object);
  346. if (!mediaElement)
  347. return false;
  348. GraphicsContext* context = paintInfo.context;
  349. int borderWidth = 1;
  350. // Draw the border of the time bar.
  351. // FIXME: this should be a rounded rect but need to fix GraphicsContextSkia first.
  352. // https://bugs.webkit.org/show_bug.cgi?id=30143
  353. context->save();
  354. context->setShouldAntialias(true);
  355. context->setStrokeStyle(SolidStroke);
  356. context->setStrokeColor(Color::white, ColorSpaceDeviceRGB);
  357. context->setStrokeThickness(borderWidth);
  358. context->setFillColor(Color::darkGray, ColorSpaceDeviceRGB);
  359. context->drawRect(rect);
  360. context->restore();
  361. // Draw the buffered ranges.
  362. // FIXME: Draw multiple ranges if there are multiple buffered ranges.
  363. IntRect bufferedRect = rect;
  364. bufferedRect.inflate(-borderWidth);
  365. double bufferedWidth = 0.0;
  366. if (mediaElement->percentLoaded() > 0.0) {
  367. #if 0 // TODO:
  368. // Account for the width of the slider thumb.
  369. Image* mediaSliderThumb = getMediaSliderThumb();
  370. double thumbWidth = mediaSliderThumb->width() / 2.0 + 1.0;
  371. #else
  372. double thumbWidth = 0;
  373. #endif
  374. double rectWidth = bufferedRect.width() - thumbWidth;
  375. if (rectWidth < 0.0)
  376. rectWidth = 0.0;
  377. bufferedWidth = rectWidth * mediaElement->percentLoaded() + thumbWidth;
  378. }
  379. bufferedRect.setWidth(static_cast<int>(bufferedWidth));
  380. // Don't bother drawing an empty area.
  381. if (!bufferedRect.isEmpty()) {
  382. IntPoint sliderTopLeft = bufferedRect.location();
  383. IntPoint sliderTopRight = sliderTopLeft;
  384. sliderTopRight.move(0, bufferedRect.height());
  385. RefPtr<Gradient> gradient = Gradient::create(sliderTopLeft, sliderTopRight);
  386. Color startColor(255, 64, 64);
  387. gradient->addColorStop(0.0, startColor);
  388. gradient->addColorStop(1.0, Color(startColor.red() / 2, startColor.green() / 2, startColor.blue() / 2, startColor.alpha()));
  389. context->save();
  390. context->setStrokeStyle(NoStroke);
  391. context->setFillGradient(gradient);
  392. context->fillRect(bufferedRect);
  393. context->restore();
  394. }
  395. return true;
  396. }
  397. const int sliderThumbWidth = 7;
  398. const int sliderThumbHeight = 15;
  399. void RenderThemeManx::adjustSliderThumbSize(RenderStyle* style, Element*) const
  400. {
  401. ControlPart part = style->appearance();
  402. switch (part) {
  403. case SliderThumbVerticalPart:
  404. case MediaVolumeSliderThumbPart:
  405. style->setWidth(Length(sliderThumbHeight, Fixed));
  406. style->setHeight(Length(sliderThumbWidth, Fixed));
  407. break;
  408. case SliderThumbHorizontalPart:
  409. case MediaSliderThumbPart:
  410. style->setWidth(Length(sliderThumbWidth, Fixed));
  411. style->setHeight(Length(sliderThumbHeight, Fixed));
  412. break;
  413. default:
  414. break;
  415. }
  416. }
  417. bool RenderThemeManx::paintMediaFullscreenButton(RenderObject* object, const PaintInfo& info, const IntRect& rect)
  418. {
  419. static Image* const image = loadThemeImage("media/media_fullscreen").leakRef();
  420. paintThemeImage(info.context, image, rect, object->style()->colorSpace());
  421. return true;
  422. }
  423. bool RenderThemeManx::paintMediaPlayButton(RenderObject* object, const PaintInfo& info, const IntRect& rect)
  424. {
  425. static Image* const playImage = loadThemeImage("media/media_play").leakRef();
  426. static Image* const pauseImage = loadThemeImage("media/media_pause").leakRef();
  427. Node* node = object->node();
  428. if (!node)
  429. return false;
  430. Image* image;
  431. if (mediaControlElementType(node) == MediaPlayButton)
  432. image = playImage;
  433. else
  434. image = pauseImage;
  435. paintThemeImage(info.context, image, rect, object->style()->colorSpace());
  436. return true;
  437. }
  438. bool RenderThemeManx::paintMediaMuteButton(RenderObject* object, const PaintInfo& info, const IntRect& rect)
  439. {
  440. return paintDummyButton(object, info, rect);
  441. }
  442. bool RenderThemeManx::paintMediaSeekBackButton(RenderObject* object, const PaintInfo& info, const IntRect& rect)
  443. {
  444. return paintDummyButton(object, info, rect);
  445. }
  446. bool RenderThemeManx::paintMediaSeekForwardButton(RenderObject* object, const PaintInfo& info, const IntRect& rect)
  447. {
  448. return paintDummyButton(object, info, rect);
  449. }
  450. bool RenderThemeManx::paintMediaSliderTrack(RenderObject* object, const PaintInfo& info, const IntRect& rect)
  451. {
  452. return paintMediaSlider(object, info, rect);
  453. }
  454. bool RenderThemeManx::paintMediaSliderThumb(RenderObject* object, const PaintInfo& info, const IntRect& rect)
  455. {
  456. return paintDummyButton(object, info, rect);
  457. }
  458. bool RenderThemeManx::paintMediaVolumeSliderContainer(RenderObject* object, const PaintInfo& info, const IntRect& rect)
  459. {
  460. return paintDummyBackground(object, info, rect);
  461. }
  462. bool RenderThemeManx::paintMediaVolumeSliderTrack(RenderObject* object, const PaintInfo& info, const IntRect& rect)
  463. {
  464. return paintDummyButton(object, info, rect);
  465. }
  466. bool RenderThemeManx::paintMediaVolumeSliderThumb(RenderObject* object, const PaintInfo& info, const IntRect& rect)
  467. {
  468. return paintDummyButton(object, info, rect);
  469. }
  470. bool RenderThemeManx::paintMediaRewindButton(RenderObject* object, const PaintInfo& info, const IntRect& rect)
  471. {
  472. static Image* const image = loadThemeImage("media/media_rewind").leakRef();
  473. paintThemeImage(info.context, image, rect, object->style()->colorSpace());
  474. return true;
  475. }
  476. bool RenderThemeManx::paintMediaReturnToRealtimeButton(RenderObject* object, const PaintInfo& info, const IntRect& rect)
  477. {
  478. return paintDummyButton(object, info, rect);
  479. }
  480. bool RenderThemeManx::paintMediaToggleClosedCaptionsButton(RenderObject* object, const PaintInfo& info, const IntRect& rect)
  481. {
  482. return paintDummyButton(object, info, rect);
  483. }
  484. bool RenderThemeManx::paintMediaControlsBackground(RenderObject* object, const PaintInfo& info, const IntRect& rect)
  485. {
  486. return false;
  487. }
  488. bool RenderThemeManx::paintMediaCurrentTime(RenderObject* object, const PaintInfo& info, const IntRect& rect)
  489. {
  490. return true;
  491. }
  492. bool RenderThemeManx::paintMediaTimeRemaining(RenderObject* object, const PaintInfo& info, const IntRect& rect)
  493. {
  494. return true;
  495. }
  496. bool RenderThemeManx::paintMediaFullScreenVolumeSliderTrack(RenderObject* object, const PaintInfo& info, const IntRect& rect)
  497. {
  498. return paintDummyButton(object, info, rect);
  499. }
  500. bool RenderThemeManx::paintMediaFullScreenVolumeSliderThumb(RenderObject* object, const PaintInfo& info, const IntRect& rect)
  501. {
  502. return paintDummyButton(object, info, rect);
  503. }
  504. IntPoint RenderThemeManx::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const IntSize& size) const
  505. {
  506. return RenderMediaControls::volumeSliderOffsetFromMuteButton(muteButtonBox, size);
  507. }
  508. #endif
  509. bool RenderThemeManx::delegatesMenuListRendering() const
  510. {
  511. #if OS(PSP2)
  512. return true;
  513. #else
  514. return false;
  515. #endif
  516. }
  517. bool RenderThemeManx::popsMenuByArrowKeys() const
  518. {
  519. return false;
  520. }
  521. bool RenderThemeManx::popsMenuBySpaceOrReturn() const
  522. {
  523. return false;
  524. }
  525. }