Commit 1ace5b9a authored by aberent@chromium.org's avatar aberent@chromium.org

Use different icons for the overlay and non-overlay cast buttons

We want the overlay cast icon to be visible on all backgrounds, so its
background has to be at least semi-opaque. The non-overlay cast icon,
however, should have the same background as the media controls, which
is easiest to achive by making its background transparent. As such we
need different icons for the two cases.

Note that this also needs a Chromium CL for the new versions of the
icons.

BUG=426373

Review URL: https://codereview.chromium.org/716613002

git-svn-id: svn://svn.chromium.org/blink/trunk@185125 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent bbc0f859
...@@ -1379,9 +1379,9 @@ crbug.com/429133 [ SnowLeopard ] virtual/textblob/fast/text/text-combine-shrink- ...@@ -1379,9 +1379,9 @@ crbug.com/429133 [ SnowLeopard ] virtual/textblob/fast/text/text-combine-shrink-
crbug.com/384723 accessibility/chromium-only-roles.html [ Failure ] crbug.com/384723 accessibility/chromium-only-roles.html [ Failure ]
crbug.com/385014 accessibility/canvas-fallback-content-2.html [ Failure ] crbug.com/385014 accessibility/canvas-fallback-content-2.html [ Failure ]
crbug.com/429843 [ Win Linux ] media/video-controls-with-cast-rendering.html [ Pass ImageOnlyFailure ] crbug.com/429843 media/video-controls-with-cast-rendering.html [ NeedsRebaseline ]
crbug.com/432079 [ Win Linux ] media/video-overlay-cast-dark-rendering.html [ Pass ImageOnlyFailure ] crbug.com/432079 media/video-overlay-cast-dark-rendering.html [ NeedsRebaseline ]
crbug.com/432080 [ Win Linux ] media/video-overlay-cast-light-rendering.html [ Pass ImageOnlyFailure ] crbug.com/432080 media/video-overlay-cast-light-rendering.html [ NeedsRebaseline ]
crbug.com/431152 inspector/audits/audits-panel-functional.html [ Pass Failure ] crbug.com/431152 inspector/audits/audits-panel-functional.html [ Pass Failure ]
crbug.com/431688 [ Win Release ] webaudio/oscillator-sine.html [ Failure ] crbug.com/431688 [ Win Release ] webaudio/oscillator-sine.html [ Failure ]
......
...@@ -570,6 +570,7 @@ void MediaControlFullscreenButtonElement::setIsFullscreen(bool isFullscreen) ...@@ -570,6 +570,7 @@ void MediaControlFullscreenButtonElement::setIsFullscreen(bool isFullscreen)
MediaControlCastButtonElement::MediaControlCastButtonElement(MediaControls& mediaControls, bool isOverlayButton) MediaControlCastButtonElement::MediaControlCastButtonElement(MediaControls& mediaControls, bool isOverlayButton)
: MediaControlInputElement(mediaControls, MediaCastOnButton), m_isOverlayButton(isOverlayButton) : MediaControlInputElement(mediaControls, MediaCastOnButton), m_isOverlayButton(isOverlayButton)
{ {
setIsPlayingRemotely(false);
} }
PassRefPtrWillBeRawPtr<MediaControlCastButtonElement> MediaControlCastButtonElement::create(MediaControls& mediaControls, bool isOverlayButton) PassRefPtrWillBeRawPtr<MediaControlCastButtonElement> MediaControlCastButtonElement::create(MediaControls& mediaControls, bool isOverlayButton)
...@@ -601,7 +602,19 @@ const AtomicString& MediaControlCastButtonElement::shadowPseudoId() const ...@@ -601,7 +602,19 @@ const AtomicString& MediaControlCastButtonElement::shadowPseudoId() const
void MediaControlCastButtonElement::setIsPlayingRemotely(bool isPlayingRemotely) void MediaControlCastButtonElement::setIsPlayingRemotely(bool isPlayingRemotely)
{ {
setDisplayType(isPlayingRemotely ? MediaCastOnButton : MediaCastOffButton); if (isPlayingRemotely) {
if (m_isOverlayButton) {
setDisplayType(MediaOverlayCastOnButton);
} else {
setDisplayType(MediaCastOnButton);
}
} else {
if (m_isOverlayButton) {
setDisplayType(MediaOverlayCastOffButton);
} else {
setDisplayType(MediaCastOffButton);
}
}
} }
bool MediaControlCastButtonElement::keepEventInNode(Event* event) bool MediaControlCastButtonElement::keepEventInNode(Event* event)
......
...@@ -345,15 +345,24 @@ static bool paintMediaCastButton(RenderObject* object, const PaintInfo& paintInf ...@@ -345,15 +345,24 @@ static bool paintMediaCastButton(RenderObject* object, const PaintInfo& paintInf
if (!mediaElement) if (!mediaElement)
return false; return false;
static Image* mediaCastOnButton = platformResource("mediaplayerCastOn"); static Image* mediaCastOn = platformResource("mediaplayerCastOn");
static Image* mediaCastOffButton = platformResource("mediaplayerCastOff"); static Image* mediaCastOff = platformResource("mediaplayerCastOff");
// 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");
if (mediaElement->isPlayingRemotely()) { switch (mediaControlElementType(object->node())) {
return paintMediaButton(paintInfo.context, rect, mediaCastOnButton); case MediaCastOnButton:
case MediaOverlayCastOnButton:
return paintMediaButton(paintInfo.context, rect, mediaCastOn);
case MediaCastOffButton:
return paintMediaButton(paintInfo.context, rect, mediaCastOff);
case MediaOverlayCastOffButton:
return paintMediaButton(paintInfo.context, rect, mediaOverlayCastOff);
default:
ASSERT_NOT_REACHED();
return false;
} }
return paintMediaButton(paintInfo.context, rect, mediaCastOffButton);
} }
bool RenderMediaControls::paintMediaControlsPart(MediaControlElementType part, RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) bool RenderMediaControls::paintMediaControlsPart(MediaControlElementType part, RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment