MediaControlElementType AccessibilityMediaControl::controlType() const { if (!renderer() || !renderer()->node()) return MediaTimelineContainer; // Timeline container is not accessible. return mediaControlElementType(renderer()->node()); }
bool MediaControlsPainter::paintMediaCastButton(const LayoutObject& object, const PaintInfo& paintInfo, const IntRect& rect) { const HTMLMediaElement* mediaElement = toParentMediaElement(object); if (!mediaElement) return false; static Image* mediaCastOn = platformResource("mediaplayerCastOn", "mediaplayerCastOnNew"); static Image* mediaCastOff = platformResource("mediaplayerCastOff", "mediaplayerCastOffNew"); // To ensure that the overlaid cast button is visible when overlaid on pale videos we use a // different version of it for the overlaid case with a semi-opaque background. static Image* mediaOverlayCastOff = platformResource( "mediaplayerOverlayCastOff", "mediaplayerOverlayCastOffNew"); bool isEnabled = mediaElement->hasRemoteRoutes(); switch (mediaControlElementType(object.node())) { case MediaCastOnButton: return paintMediaButton(paintInfo.context, rect, mediaCastOn, isEnabled); case MediaOverlayCastOnButton: return paintMediaButton(paintInfo.context, rect, mediaCastOn); case MediaCastOffButton: return paintMediaButton(paintInfo.context, rect, mediaCastOff, isEnabled); case MediaOverlayCastOffButton: return paintMediaButton(paintInfo.context, rect, mediaOverlayCastOff); default: ASSERT_NOT_REACHED(); return false; } }
void RenderTextTrackContainerElement::layout() { RenderBlock::layout(); if (style()->display() == NONE) return; ASSERT(mediaControlElementType(node()) == MediaTextTrackDisplayContainer); LayoutStateDisabler layoutStateDisabler(&view()); static_cast<MediaControlTextTrackContainerElement*>(node())->updateSizes(); }
void RenderTextTrackContainerElement::layout() { RenderBlockFlow::layout(); if (style()->display() == NONE) return; ASSERT(mediaControlElementType(node()) == MediaTextTrackDisplayContainer); DeprecatedScheduleStyleRecalcDuringLayout marker(node()->document().lifecycle()); static_cast<MediaControlTextTrackContainerElement*>(node())->updateSizes(); }
bool MediaControlsPainter::paintMediaPlayButton(const LayoutObject& object, const PaintInfo& paintInfo, const IntRect& rect) { const HTMLMediaElement* mediaElement = toParentMediaElement(object); if (!mediaElement) return false; static Image* mediaPlay = platformResource("mediaplayerPlay", "mediaplayerPlayNew"); static Image* mediaPause = platformResource("mediaplayerPause", "mediaplayerPauseNew"); // For this case, the new UI draws the normal icon, but the entire panel // grays out. static Image* mediaPlayDisabled = platformResource("mediaplayerPlayDisabled", "mediaplayerPlayNew"); if (!hasSource(mediaElement)) return paintMediaButton(paintInfo.context, rect, mediaPlayDisabled, false); Image * image = !object.node()->isMediaControlElement() || mediaControlElementType(object.node()) == MediaPlayButton ? mediaPlay : mediaPause; return paintMediaButton(paintInfo.context, rect, image); }
bool MediaControlsPainter::paintMediaFullscreenButton(const LayoutObject& object, const PaintInfo& paintInfo, const IntRect& rect) { const HTMLMediaElement* mediaElement = toParentMediaElement(object); if (!mediaElement) return false; // With the new player UI, we have separate assets for enter / exit // fullscreen mode. static Image* mediaEnterFullscreenButton = platformResource( "mediaplayerFullscreen", "mediaplayerEnterFullscreen"); static Image* mediaExitFullscreenButton = platformResource( "mediaplayerFullscreen", "mediaplayerExitFullscreen"); bool isEnabled = hasSource(mediaElement); if (mediaControlElementType(object.node()) == MediaExitFullscreenButton) return paintMediaButton(paintInfo.context, rect, mediaExitFullscreenButton, isEnabled); return paintMediaButton(paintInfo.context, rect, mediaEnterFullscreenButton, isEnabled); }