Title: [109776] trunk/Source/WebCore
Revision
109776
Author
commit-qu...@webkit.org
Date
2012-03-05 11:38:04 -0800 (Mon, 05 Mar 2012)

Log Message

Add media control css for chromium on android
https://bugs.webkit.org/show_bug.cgi?id=79550

Patch by Min Qin <qin...@google.com> on 2012-03-05
Reviewed by Adam Barth.

This should not change the any test results as it does not affect the any current bots. New test expectations will be added if we have a android bot on webkit.

* WebCore.gyp/WebCore.gyp:
* css/mediaControlsChromiumAndroid.css: Added.
(body:-webkit-full-page-media):
(audio):
(audio:-webkit-full-page-media, video:-webkit-full-page-media):
(audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel):
(video:-webkit-full-page-media::-webkit-media-controls-panel):
(audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button):
(audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button):
(audio::-webkit-media-controls-timeline-container):
(video::-webkit-media-controls-timeline-container):
(audio::-webkit-media-controls-current-time-display, video::-webkit-media-controls-current-time-display):
(audio::-webkit-media-controls-timeline, video::-webkit-media-controls-timeline):
(video::-webkit-media-controls-fullscreen-button):
(audio::-webkit-media-controls-fullscreen-button):
(audio::-webkit-media-controls-volume-slider-container, video::-webkit-media-controls-volume-slider-container):
(audio::-webkit-media-controls-volume-slider, video::-webkit-media-controls-volume-slider):
* rendering/RenderMediaControlsChromium.cpp:
(WebCore::paintMediaFullscreenButton):
(WebCore):
(WebCore::RenderMediaControlsChromium::paintMediaControlsPart):
* rendering/RenderThemeChromiumAndroid.cpp:
(WebCore::RenderThemeChromiumAndroid::extraMediaControlsStyleSheet):
(WebCore):
(WebCore::RenderThemeChromiumAndroid::paintMediaFullscreenButton):
* rendering/RenderThemeChromiumAndroid.h:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (109775 => 109776)


--- trunk/Source/WebCore/ChangeLog	2012-03-05 19:26:02 UTC (rev 109775)
+++ trunk/Source/WebCore/ChangeLog	2012-03-05 19:38:04 UTC (rev 109776)
@@ -1,3 +1,39 @@
+2012-03-05  Min Qin  <qin...@google.com>
+
+        Add media control css for chromium on android
+        https://bugs.webkit.org/show_bug.cgi?id=79550
+
+        Reviewed by Adam Barth.
+
+        This should not change the any test results as it does not affect the any current bots. New test expectations will be added if we have a android bot on webkit.
+
+        * WebCore.gyp/WebCore.gyp:
+        * css/mediaControlsChromiumAndroid.css: Added.
+        (body:-webkit-full-page-media):
+        (audio):
+        (audio:-webkit-full-page-media, video:-webkit-full-page-media):
+        (audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel):
+        (video:-webkit-full-page-media::-webkit-media-controls-panel):
+        (audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button):
+        (audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button):
+        (audio::-webkit-media-controls-timeline-container):
+        (video::-webkit-media-controls-timeline-container):
+        (audio::-webkit-media-controls-current-time-display, video::-webkit-media-controls-current-time-display):
+        (audio::-webkit-media-controls-timeline, video::-webkit-media-controls-timeline):
+        (video::-webkit-media-controls-fullscreen-button):
+        (audio::-webkit-media-controls-fullscreen-button):
+        (audio::-webkit-media-controls-volume-slider-container, video::-webkit-media-controls-volume-slider-container):
+        (audio::-webkit-media-controls-volume-slider, video::-webkit-media-controls-volume-slider):
+        * rendering/RenderMediaControlsChromium.cpp:
+        (WebCore::paintMediaFullscreenButton):
+        (WebCore):
+        (WebCore::RenderMediaControlsChromium::paintMediaControlsPart):
+        * rendering/RenderThemeChromiumAndroid.cpp:
+        (WebCore::RenderThemeChromiumAndroid::extraMediaControlsStyleSheet):
+        (WebCore):
+        (WebCore::RenderThemeChromiumAndroid::paintMediaFullscreenButton):
+        * rendering/RenderThemeChromiumAndroid.h:
+
 2012-03-05  Anders Carlsson  <ander...@apple.com>
 
         Fix crash in ScrollingCoordinator::updateMainFrameScrollPositionAndScrollLayerPosition

Modified: trunk/Source/WebCore/WebCore.gyp/WebCore.gyp (109775 => 109776)


--- trunk/Source/WebCore/WebCore.gyp/WebCore.gyp	2012-03-05 19:26:02 UTC (rev 109775)
+++ trunk/Source/WebCore/WebCore.gyp/WebCore.gyp	2012-03-05 19:38:04 UTC (rev 109776)
@@ -827,6 +827,7 @@
               '../css/mathml.css',
               '../css/mediaControls.css',
               '../css/mediaControlsChromium.css',
+              '../css/mediaControlsChromiumAndroid.css',
               '../css/fullscreen.css',
               # Skip fullscreenQuickTime.
             ],

Added: trunk/Source/WebCore/css/mediaControlsChromiumAndroid.css (0 => 109776)


--- trunk/Source/WebCore/css/mediaControlsChromiumAndroid.css	                        (rev 0)
+++ trunk/Source/WebCore/css/mediaControlsChromiumAndroid.css	2012-03-05 19:38:04 UTC (rev 109776)
@@ -0,0 +1,186 @@
+/*
+ * Copyright (C) 2012 Google Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Media controls for Chromium on Android*/
+
+body:-webkit-full-page-media {
+    background-color: rgb(0, 0, 0);
+}
+
+audio {
+    width: 300px;
+    height: 32px;
+}
+
+audio:-webkit-full-page-media, video:-webkit-full-page-media {
+    max-height: 100%;
+    max-width: 100%;
+}
+
+audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel {
+    -webkit-user-select: none;
+    position: absolute;
+    overflow: visible;
+    bottom: 0;
+    width: 100%;
+    height: 32px;
+    z-index: 0;
+    background-color: rgba(0, 0, 0, 0.6);
+}
+
+video:-webkit-full-page-media::-webkit-media-controls-panel {
+    bottom: 0px;
+}
+
+audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button {
+    display: none;
+}
+
+audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button {
+    -webkit-appearance: media-play-button;
+
+    position: absolute;
+    top: auto;
+    bottom: 7px;
+    left: 7px;
+    right: 6px;
+
+    width: 18px;
+    height: 19px;
+}
+
+audio::-webkit-media-controls-timeline-container {
+    -webkit-appearance: media-timeline-container;
+    -webkit-user-select: none;
+    -webkit-box-orient: horizontal;
+    -webkit-box-align: center;
+    -webkit-box-pack: center;
+    -webkit-box-flex: 1;
+
+    position: absolute;
+    top: auto;
+    bottom: 0;
+    left: 30px;
+    right: 0;
+
+    width: auto;
+    height: 32px;
+
+    border-left: 1px solid rgba(255, 255, 255, 0.2);
+    border-right: 1px solid rgba(255, 255, 255, 0.2);
+}
+
+video::-webkit-media-controls-timeline-container {
+    -webkit-appearance: media-timeline-container;
+    -webkit-user-select: none;
+    -webkit-box-orient: horizontal;
+    -webkit-box-align: center;
+    -webkit-box-pack: center;
+    -webkit-box-flex: 1;
+
+    position: absolute;
+    top: auto;
+    bottom: 0;
+    left: 30px;
+    right: 34px;
+
+    width: auto;
+    height: 32px;
+
+    border-left: 1px solid rgba(255, 255, 255, 0.2);
+    border-right: 1px solid rgba(255, 255, 255, 0.2);
+}
+
+audio::-webkit-media-controls-current-time-display, video::-webkit-media-controls-current-time-display {
+    -webkit-appearance: media-current-time-display;
+    -webkit-user-select: none;
+    display: -webkit-box;
+    -webkit-box-flex: 0;
+    -webkit-box-pack: center;
+    -webkit-box-align: center;
+
+    overflow: hidden;
+    cursor: default;
+
+    line-height: 21px;
+    height: 20px;
+    width: 58px;
+
+    text-align: center;
+    font-family: Arial;
+    font-size: 16px;
+    font-weight: bold;
+    color: white;
+
+    letter-spacing: normal;
+    word-spacing: normal;
+    text-transform: none;
+    text-indent: 0;
+    text-shadow: none;
+    text-decoration: none;
+}
+
+audio::-webkit-media-controls-timeline, video::-webkit-media-controls-timeline {
+    -webkit-appearance: media-slider;
+    display: -webkit-box;
+    box-sizing: border-box;
+    -webkit-box-flex: 1;
+
+    padding: 0px;
+    margin: 0px 6px;
+    height: 18px;
+
+    border-color: rgba(255, 255, 255, 0.2);
+    border-style: solid;
+    border-width: 1px;
+    border-radius: 2px;
+    background-color: rgba(255, 255, 255, 0.08);
+    color: rgb(50, 140, 223);
+}
+
+
+video::-webkit-media-controls-fullscreen-button {
+    -webkit-appearance: media-fullscreen-button;
+    position: absolute;
+    top: auto;
+    bottom: 0;
+    right: 0;
+    left: auto;
+
+    width: 34px;
+    height: 32px;
+}
+
+audio::-webkit-media-controls-fullscreen-button {
+    -webkit-appearance: media-fullscreen-button;
+    display: none;
+}
+
+audio::-webkit-media-controls-volume-slider-container, video::-webkit-media-controls-volume-slider-container {
+    display: none;
+}
+
+audio::-webkit-media-controls-volume-slider, video::-webkit-media-controls-volume-slider {
+    display: none;
+}

Modified: trunk/Source/WebCore/rendering/RenderMediaControlsChromium.cpp (109775 => 109776)


--- trunk/Source/WebCore/rendering/RenderMediaControlsChromium.cpp	2012-03-05 19:26:02 UTC (rev 109775)
+++ trunk/Source/WebCore/rendering/RenderMediaControlsChromium.cpp	2012-03-05 19:38:04 UTC (rev 109776)
@@ -238,6 +238,16 @@
     return true;
 }
 
+static bool paintMediaFullscreenButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
+{
+    HTMLMediaElement* mediaElement = toParentMediaElement(object);
+    if (!mediaElement)
+        return false;
+
+    DEFINE_STATIC_LOCAL(Image*, mediaFullscreen, (platformResource("mediaFullscreen")));
+    return paintMediaButton(paintInfo.context, rect, mediaFullscreen);
+}
+
 bool RenderMediaControlsChromium::paintMediaControlsPart(MediaControlElementType part, RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
 {
     switch (part) {
@@ -257,8 +267,9 @@
         return paintMediaVolumeSliderThumb(object, paintInfo, rect);
     case MediaTimelineContainer:
         return paintMediaTimelineContainer(object, paintInfo, rect);
+    case MediaFullscreenButton:
+        return paintMediaFullscreenButton(object, paintInfo, rect);
     case MediaVolumeSliderMuteButton:
-    case MediaFullscreenButton:
     case MediaSeekBackButton:
     case MediaSeekForwardButton:
     case MediaVolumeSliderContainer:

Modified: trunk/Source/WebCore/rendering/RenderThemeChromiumAndroid.cpp (109775 => 109776)


--- trunk/Source/WebCore/rendering/RenderThemeChromiumAndroid.cpp	2012-03-05 19:26:02 UTC (rev 109775)
+++ trunk/Source/WebCore/rendering/RenderThemeChromiumAndroid.cpp	2012-03-05 19:38:04 UTC (rev 109776)
@@ -30,6 +30,7 @@
 #include "Color.h"
 #include "PaintInfo.h"
 #include "PlatformSupport.h"
+#include "RenderMediaControlsChromium.h"
 #include "RenderObject.h"
 #include "RenderProgress.h"
 #include "RenderSlider.h"
@@ -63,6 +64,11 @@
     return RenderTheme::systemColor(cssValueId);
 }
 
+String RenderThemeChromiumAndroid::extraMediaControlsStyleSheet()
+{
+    return String(mediaControlsChromiumAndroidUserAgentStyleSheet, sizeof(mediaControlsChromiumAndroidUserAgentStyleSheet));
+}
+
 String RenderThemeChromiumAndroid::extraDefaultStyleSheet()
 {
     return RenderThemeChromiumLinux::extraDefaultStyleSheet() +
@@ -81,4 +87,16 @@
     }
 }
 
+bool RenderThemeChromiumAndroid::paintMediaFullscreenButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
+{
+#if ENABLE(VIDEO)
+    return RenderMediaControlsChromium::paintMediaControlsPart(MediaFullscreenButton, object, paintInfo, rect);
+#else
+    UNUSED_PARAM(object);
+    UNUSED_PARAM(paintInfo);
+    UNUSED_PARAM(rect);
+    return false;
+#endif
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/RenderThemeChromiumAndroid.h (109775 => 109776)


--- trunk/Source/WebCore/rendering/RenderThemeChromiumAndroid.h	2012-03-05 19:26:02 UTC (rev 109775)
+++ trunk/Source/WebCore/rendering/RenderThemeChromiumAndroid.h	2012-03-05 19:38:04 UTC (rev 109776)
@@ -41,6 +41,12 @@
 
     virtual bool delegatesMenuListRendering() const OVERRIDE { return true; }
 
+    virtual bool paintMediaFullscreenButton(RenderObject*, const PaintInfo&, const IntRect&);
+
+#if ENABLE(VIDEO)
+    virtual String extraMediaControlsStyleSheet() OVERRIDE;
+#endif
+
 #if ENABLE(TOUCH_EVENTS)
     virtual Color platformTapHighlightColor() const OVERRIDE
     {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to