bool RenderThemeQt::paintMediaPlayButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { HTMLMediaElement* mediaElement = toParentMediaElement(o); if (!mediaElement) return false; QSharedPointer<StylePainter> p = getStylePainter(paintInfo); if (p.isNull() || !p->isValid()) return true; p->painter->setRenderHint(QPainter::Antialiasing, true); paintMediaBackground(p->painter, r); WorldMatrixTransformer transformer(p->painter, o, r); p->painter->setBrush(getMediaControlForegroundColor(o)); if (mediaElement->canPlay()) { const QPointF playPolygon[3] = { QPointF(0, 0), QPointF(100, 50), QPointF(0, 100)}; p->painter->drawPolygon(playPolygon, 3); } else { p->painter->drawRect(0, 0, 30, 100); p->painter->drawRect(70, 0, 30, 100); } return false; }
bool RenderThemeGtk::paintMediaPlayButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) { HTMLMediaElement* mediaElement = getMediaElementFromRenderObject(o); if (!mediaElement) return false; return paintMediaButton(paintInfo.context, r, mediaElement->canPlay() ? m_playButton.get() : m_pauseButton.get(), m_panelColor, m_mediaIconSize); }
static bool paintMediaOverlayPlayButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) { HTMLMediaElement* mediaElement = toParentMediaElement(object); if (!mediaElement) return false; if (!hasSource(mediaElement) || !mediaElement->canPlay()) return false; static Image* mediaOverlayPlay = platformResource("mediaplayerOverlayPlay"); return paintMediaButton(paintInfo.context, rect, mediaOverlayPlay); }
static bool paintMediaPlayButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) { HTMLMediaElement* mediaElement = toParentMediaElement(object); if (!mediaElement) return false; static Image* mediaPlay = platformResource("mediaPlay"); static Image* mediaPause = platformResource("mediaPause"); static Image* mediaPlayDisabled = platformResource("mediaPlayDisabled"); if (!hasSource(mediaElement)) return paintMediaButton(paintInfo.context, rect, mediaPlayDisabled); return paintMediaButton(paintInfo.context, rect, mediaElement->canPlay() ? mediaPlay : mediaPause); }
bool RenderThemeSafari::paintMediaPlayButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) { Node* node = o->element(); Node* mediaNode = node ? node->shadowAncestorNode() : 0; if (!mediaNode || (!mediaNode->hasTagName(videoTag) && !mediaNode->hasTagName(audioTag))) return false; HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(mediaNode); if (!mediaElement) return false; #if defined(SAFARI_THEME_VERSION) && SAFARI_THEME_VERSION >= 2 ASSERT(SafariThemeLibrary()); paintThemePart(mediaElement->canPlay() ? SafariTheme::MediaPlayButtonPart : SafariTheme::MediaPauseButtonPart, paintInfo.context->platformContext(), r, NSRegularControlSize, determineState(o)); #endif return false; }
void MediaControls::updateControlVisibility() { if (!m_panel || !m_panel->renderer()) return; // Don't fade for audio controls. HTMLMediaElement* media = m_mediaElement; if (!media->hasVideo()) return; ASSERT(media->renderer()); // Don't fade if the media element is not visible if (media->renderer()->style()->visibility() != VISIBLE) return; bool shouldHideController = !m_mouseOver && !media->canPlay(); // Do fading manually, css animations don't work with shadow trees float animateFrom = m_panel->renderer()->style()->opacity(); float animateTo = shouldHideController ? 0.0f : 1.0f; if (animateFrom == animateTo) return; if (m_opacityAnimationTimer.isActive()) { if (m_opacityAnimationTo == animateTo) return; m_opacityAnimationTimer.stop(); } if (animateFrom < animateTo) m_opacityAnimationDuration = m_panel->renderer()->theme()->mediaControlsFadeInDuration(); else m_opacityAnimationDuration = m_panel->renderer()->theme()->mediaControlsFadeOutDuration(); m_opacityAnimationFrom = animateFrom; m_opacityAnimationTo = animateTo; m_opacityAnimationStartTime = currentTime(); m_opacityAnimationTimer.startRepeating(cOpacityAnimationRepeatDelay); }
bool RenderThemeQt::paintMediaPlayButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) { HTMLMediaElement* mediaElement = getMediaElementFromRenderObject(o); if (!mediaElement) return false; StylePainter p(paintInfo); if (!p.isValid()) return true; paintMediaBackground(p.painter, r); WorldMatrixTransformer transformer(p.painter, o, r); p.painter->setBrush(getMediaControlForegroundColor(o)); if (mediaElement->canPlay()) { const QPointF playPolygon[3] = { QPointF(0, 0), QPointF(100, 50), QPointF(0, 100)}; p.painter->drawPolygon(playPolygon, 3); } else { p.painter->drawRect(0, 0, 30, 100); p.painter->drawRect(70, 0, 30, 100); } return false; }