[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.21-584-g1e41756
vestbo at webkit.org
vestbo at webkit.org
Fri Feb 26 22:27:03 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 9dddb823a8f3d255d69988963505fb54587e4fc6
Author: vestbo at webkit.org <vestbo at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Feb 22 13:42:13 2010 +0000
[Qt] Switching from Phonon to QtMultimedia Backend for Qt 4.7
Patch by Nicholas Young <nicholas.young at nokia.com> on 2010-02-22
Reviewed by Tor Arne Vestbø.
https://bugs.webkit.org/show_bug.cgi?id=34631
No new tests. This patch only affects multimedia backend.
* WebCore.pro: Build depends on Qt version.
* css/mediaControlsQt.css: Updated media controls.
* platform/graphics/MediaPlayer.cpp: Different backend included depending on Qt version.
* platform/graphics/qt/MediaPlayerPrivateQt.cpp: Added new QtMultimedia Backend.
(WebCore::MediaPlayerPrivate::create):
(WebCore::MediaPlayerPrivate::registerMediaEngine):
(WebCore::MediaPlayerPrivate::getSupportedTypes):
(WebCore::MediaPlayerPrivate::supportsType):
(WebCore::MediaPlayerPrivate::MediaPlayerPrivate):
(WebCore::MediaPlayerPrivate::~MediaPlayerPrivate):
(WebCore::MediaPlayerPrivate::hasVideo):
(WebCore::MediaPlayerPrivate::hasAudio):
(WebCore::MediaPlayerPrivate::load):
(WebCore::MediaPlayerPrivate::cancelLoad):
(WebCore::MediaPlayerPrivate::play):
(WebCore::MediaPlayerPrivate::pause):
(WebCore::MediaPlayerPrivate::paused):
(WebCore::MediaPlayerPrivate::seek):
(WebCore::MediaPlayerPrivate::seeking):
(WebCore::MediaPlayerPrivate::duration):
(WebCore::MediaPlayerPrivate::currentTime):
(WebCore::MediaPlayerPrivate::buffered):
(WebCore::MediaPlayerPrivate::maxTimeSeekable):
(WebCore::MediaPlayerPrivate::bytesLoaded):
(WebCore::MediaPlayerPrivate::totalBytes):
(WebCore::MediaPlayerPrivate::setRate):
(WebCore::MediaPlayerPrivate::setVolume):
(WebCore::MediaPlayerPrivate::supportsMuting):
(WebCore::MediaPlayerPrivate::setMuted):
(WebCore::MediaPlayerPrivate::networkState):
(WebCore::MediaPlayerPrivate::readyState):
(WebCore::MediaPlayerPrivate::setVisible):
(WebCore::MediaPlayerPrivate::mediaStatusChanged):
(WebCore::MediaPlayerPrivate::handleError):
(WebCore::MediaPlayerPrivate::stateChanged):
(WebCore::MediaPlayerPrivate::nativeSizeChanged):
(WebCore::MediaPlayerPrivate::queuedSeekTimeout):
(WebCore::MediaPlayerPrivate::seekTimeout):
(WebCore::MediaPlayerPrivate::positionChanged):
(WebCore::MediaPlayerPrivate::durationChanged):
(WebCore::MediaPlayerPrivate::volumeChanged):
(WebCore::MediaPlayerPrivate::mutedChanged):
(WebCore::MediaPlayerPrivate::updateStates):
(WebCore::MediaPlayerPrivate::setSize):
(WebCore::MediaPlayerPrivate::naturalSize):
(WebCore::MediaPlayerPrivate::paint):
(WebCore::MediaPlayerPrivate::repaint):
* platform/graphics/qt/MediaPlayerPrivateQt.h: Added new QtMultimedia Backend.
(WebCore::MediaPlayerPrivate::isAvailable):
(WebCore::MediaPlayerPrivate::supportsFullscreen):
* platform/qt/RenderThemeQt.cpp:
(WebCore::RenderThemeQt::mediaControlsBaselineOpacity): New method.
(WebCore::RenderThemeQt::paintMediaBackground): Background depends on baseline opacity.
(WebCore::RenderThemeQt::paintMediaMuteButton): Changed styling.
(WebCore::RenderThemeQt::paintMediaCurrentTime): Added current time display.
(WebCore::RenderThemeQt::formatMediaControlsCurrentTime): Added time formatting.
(WebCore::RenderThemeQt::formatMediaControlsRemainingTime): Added time formatting.
(WebCore::RenderThemeQt::paintMediaVolumeSliderTrack): Volume slider added.
(WebCore::RenderThemeQt::paintMediaVolumeSliderThumb): Volume slider added.
(WebCore::RenderThemeQt::paintMediaSliderTrack): Updated for QtMultimedia.
(WebCore::RenderThemeQt::paintMediaSliderThumb): Dropped an unnecessary check.
(WebCore::RenderThemeQt::adjustSliderThumbSize): Handle a missing case.
* platform/qt/RenderThemeQt.h: Reimplemented a few more methods.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55079 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 3deda6a..d7881f6 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,77 @@
+2010-02-22 Nicholas Young <nicholas.young at nokia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ [Qt] Switching from Phonon to QtMultimedia Backend for Qt 4.7
+
+ https://bugs.webkit.org/show_bug.cgi?id=34631
+
+ No new tests. This patch only affects multimedia backend.
+
+ * WebCore.pro: Build depends on Qt version.
+ * css/mediaControlsQt.css: Updated media controls.
+ * platform/graphics/MediaPlayer.cpp: Different backend included depending on Qt version.
+ * platform/graphics/qt/MediaPlayerPrivateQt.cpp: Added new QtMultimedia Backend.
+ (WebCore::MediaPlayerPrivate::create):
+ (WebCore::MediaPlayerPrivate::registerMediaEngine):
+ (WebCore::MediaPlayerPrivate::getSupportedTypes):
+ (WebCore::MediaPlayerPrivate::supportsType):
+ (WebCore::MediaPlayerPrivate::MediaPlayerPrivate):
+ (WebCore::MediaPlayerPrivate::~MediaPlayerPrivate):
+ (WebCore::MediaPlayerPrivate::hasVideo):
+ (WebCore::MediaPlayerPrivate::hasAudio):
+ (WebCore::MediaPlayerPrivate::load):
+ (WebCore::MediaPlayerPrivate::cancelLoad):
+ (WebCore::MediaPlayerPrivate::play):
+ (WebCore::MediaPlayerPrivate::pause):
+ (WebCore::MediaPlayerPrivate::paused):
+ (WebCore::MediaPlayerPrivate::seek):
+ (WebCore::MediaPlayerPrivate::seeking):
+ (WebCore::MediaPlayerPrivate::duration):
+ (WebCore::MediaPlayerPrivate::currentTime):
+ (WebCore::MediaPlayerPrivate::buffered):
+ (WebCore::MediaPlayerPrivate::maxTimeSeekable):
+ (WebCore::MediaPlayerPrivate::bytesLoaded):
+ (WebCore::MediaPlayerPrivate::totalBytes):
+ (WebCore::MediaPlayerPrivate::setRate):
+ (WebCore::MediaPlayerPrivate::setVolume):
+ (WebCore::MediaPlayerPrivate::supportsMuting):
+ (WebCore::MediaPlayerPrivate::setMuted):
+ (WebCore::MediaPlayerPrivate::networkState):
+ (WebCore::MediaPlayerPrivate::readyState):
+ (WebCore::MediaPlayerPrivate::setVisible):
+ (WebCore::MediaPlayerPrivate::mediaStatusChanged):
+ (WebCore::MediaPlayerPrivate::handleError):
+ (WebCore::MediaPlayerPrivate::stateChanged):
+ (WebCore::MediaPlayerPrivate::nativeSizeChanged):
+ (WebCore::MediaPlayerPrivate::queuedSeekTimeout):
+ (WebCore::MediaPlayerPrivate::seekTimeout):
+ (WebCore::MediaPlayerPrivate::positionChanged):
+ (WebCore::MediaPlayerPrivate::durationChanged):
+ (WebCore::MediaPlayerPrivate::volumeChanged):
+ (WebCore::MediaPlayerPrivate::mutedChanged):
+ (WebCore::MediaPlayerPrivate::updateStates):
+ (WebCore::MediaPlayerPrivate::setSize):
+ (WebCore::MediaPlayerPrivate::naturalSize):
+ (WebCore::MediaPlayerPrivate::paint):
+ (WebCore::MediaPlayerPrivate::repaint):
+ * platform/graphics/qt/MediaPlayerPrivateQt.h: Added new QtMultimedia Backend.
+ (WebCore::MediaPlayerPrivate::isAvailable):
+ (WebCore::MediaPlayerPrivate::supportsFullscreen):
+ * platform/qt/RenderThemeQt.cpp:
+ (WebCore::RenderThemeQt::mediaControlsBaselineOpacity): New method.
+ (WebCore::RenderThemeQt::paintMediaBackground): Background depends on baseline opacity.
+ (WebCore::RenderThemeQt::paintMediaMuteButton): Changed styling.
+ (WebCore::RenderThemeQt::paintMediaCurrentTime): Added current time display.
+ (WebCore::RenderThemeQt::formatMediaControlsCurrentTime): Added time formatting.
+ (WebCore::RenderThemeQt::formatMediaControlsRemainingTime): Added time formatting.
+ (WebCore::RenderThemeQt::paintMediaVolumeSliderTrack): Volume slider added.
+ (WebCore::RenderThemeQt::paintMediaVolumeSliderThumb): Volume slider added.
+ (WebCore::RenderThemeQt::paintMediaSliderTrack): Updated for QtMultimedia.
+ (WebCore::RenderThemeQt::paintMediaSliderThumb): Dropped an unnecessary check.
+ (WebCore::RenderThemeQt::adjustSliderThumbSize): Handle a missing case.
+ * platform/qt/RenderThemeQt.h: Reimplemented a few more methods.
+
2010-02-22 Alexander Pavlov <apavlov at chromium.org>
Not reviewed: mac build fix
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 2e8e47e..97959cf 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -131,11 +131,21 @@ mameo5|symbian|embedded {
include($$PWD/../JavaScriptCore/JavaScriptCore.pri)
-# Disable HTML5 media compilation if phonon is unavailable
-!contains(DEFINES, ENABLE_VIDEO=1) {
- !contains(QT_CONFIG, phonon) {
- DEFINES -= ENABLE_VIDEO=1
- DEFINES += ENABLE_VIDEO=0
+
+# HTML5 Media Support
+# We require phonon for versions of Qt < 4.7
+# We require QtMultimedia for versions of Qt >= 4.7
+!contains(DEFINES, ENABLE_VIDEO=.) {
+ DEFINES -= ENABLE_VIDEO=1
+ DEFINES += ENABLE_VIDEO=0
+
+ lessThan(QT_MINOR_VERSION, 7):contains(QT_CONFIG, phonon) {
+ DEFINES -= ENABLE_VIDEO=0
+ DEFINES += ENABLE_VIDEO=1
+ }
+ !lessThan(QT_MINOR_VERSION, 7):contains(QT_CONFIG, multimedia) {
+ DEFINES -= ENABLE_VIDEO=0
+ DEFINES += ENABLE_VIDEO=1
}
}
@@ -2304,21 +2314,29 @@ contains(DEFINES, ENABLE_VIDEO=1) {
rendering/RenderMedia.cpp \
bindings/js/JSAudioConstructor.cpp
- HEADERS += \
- platform/graphics/qt/MediaPlayerPrivatePhonon.h
+ # QtMultimedia since 4.7
+ greaterThan(QT_MINOR_VERSION, 6) {
+ HEADERS += platform/graphics/qt/MediaPlayerPrivateQt.h
+ SOURCES += platform/graphics/qt/MediaPlayerPrivateQt.cpp
- SOURCES += \
- platform/graphics/qt/MediaPlayerPrivatePhonon.cpp
-
- # Add phonon manually to prevent it from coming first in
- # the include paths, as Phonon's path.h conflicts with
- # WebCore's Path.h on case-insensitive filesystems.
- qtAddLibrary(phonon)
- INCLUDEPATH -= $$QMAKE_INCDIR_QT/phonon
- INCLUDEPATH += $$QMAKE_INCDIR_QT/phonon
- mac {
- INCLUDEPATH -= $$QMAKE_LIBDIR_QT/phonon.framework/Headers
- INCLUDEPATH += $$QMAKE_LIBDIR_QT/phonon.framework/Headers
+ QT += multimedia
+ } else {
+ HEADERS += \
+ platform/graphics/qt/MediaPlayerPrivatePhonon.h
+
+ SOURCES += \
+ platform/graphics/qt/MediaPlayerPrivatePhonon.cpp
+
+ # Add phonon manually to prevent it from coming first in
+ # the include paths, as Phonon's path.h conflicts with
+ # WebCore's Path.h on case-insensitive filesystems.
+ qtAddLibrary(phonon)
+ INCLUDEPATH -= $$QMAKE_INCDIR_QT/phonon
+ INCLUDEPATH += $$QMAKE_INCDIR_QT/phonon
+ mac {
+ INCLUDEPATH -= $$QMAKE_LIBDIR_QT/phonon.framework/Headers
+ INCLUDEPATH += $$QMAKE_LIBDIR_QT/phonon.framework/Headers
+ }
}
}
diff --git a/WebCore/css/mediaControlsQt.css b/WebCore/css/mediaControlsQt.css
index a9c3609..d49fe96 100644
--- a/WebCore/css/mediaControlsQt.css
+++ b/WebCore/css/mediaControlsQt.css
@@ -51,8 +51,6 @@ video:-webkit-full-page-media::-webkit-media-controls-panel {
}
audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button {
- left: auto;
- right: 5px;
width: 12px;
height: 12px;
padding: 6px;
@@ -60,7 +58,6 @@ audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-bu
}
audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button {
- left: 5px;
width: 9px;
height: 12px;
padding: 6px 12px 6px 11px;
@@ -72,7 +69,21 @@ audio::-webkit-media-controls-timeline-container, video::-webkit-media-controls-
}
audio::-webkit-media-controls-current-time-display, video::-webkit-media-controls-current-time-display {
- display: none;
+ -webkit-appearance: media-current-time-display;
+ -webkit-user-select: none;
+ display: inline-block;
+ height: 12px;
+ padding: 6px;
+ margin: 5px 3px;
+
+ overflow: hidden;
+ cursor: default;
+
+ text-align: center;
+ font-size: 10px;
+ font-family: Verdana;
+ font-weight: bold;
+ color: white;
}
audio::-webkit-media-controls-time-remaining-display, video::-webkit-media-controls-time-remaining-display {
@@ -80,51 +91,38 @@ audio::-webkit-media-controls-time-remaining-display, video::-webkit-media-contr
}
audio::-webkit-media-controls-timeline, video::-webkit-media-controls-timeline {
- left: 42px;
- right: 34px;
height: 12px;
padding: 6px 8px;
- margin: 5px 0px;
+ margin: 5px 3px;
}
audio::-webkit-media-controls-volume-slider-container, video::-webkit-media-controls-volume-slider-container {
- display: none;
+ -webkit-appearance: media-volume-slider-container;
+ position: absolute;
+ height: 103px;
+ width: 24px;
}
audio::-webkit-media-controls-volume-slider, video::-webkit-media-controls-volume-slider {
- display: none;
+ -webkit-appearance: media-volume-slider;
+ display: inline;
+ position: absolute;
+
+ width: 12px;
+ padding: 6px;
+ height: 88px;
+ margin: 0 0 3px 0;
}
audio::-webkit-media-controls-seek-back-button, video::-webkit-media-controls-seek-back-button {
- /* Since MediaControlElements are always created with a renderer we have to hide
- the controls we don't use, so they don't mess up activation and event handling */
- left: 0px;
- top: 0px;
- width: 0px;
- height: 0px;
-
display: none;
}
audio::-webkit-media-controls-seek-forward-button, video::-webkit-media-controls-seek-forward-button {
- /* Since MediaControlElements are always created with a renderer we have to hide
- the controls we don't use, so they don't mess up activation and event handling */
- left: 0px;
- top: 0px;
- width: 0px;
- height: 0px;
-
display: none;
}
audio::-webkit-media-controls-fullscreen-button, video::-webkit-media-controls-fullscreen-button {
- /* Since MediaControlElements are always created with a renderer we have to hide
- the controls we don't use, so they don't mess up activation and event handling */
- left: 0px;
- top: 0px;
- width: 0px;
- height: 0px;
-
display: none;
}
@@ -136,3 +134,7 @@ audio::-webkit-media-controls-return-to-realtime-button, video::-webkit-media-co
display: none;
}
+audio::-webkit-media-controls-toggle-closed-captions-button, video::-webkit-media-controls-toggle-closed-captions-button {
+ display: none;
+}
+
diff --git a/WebCore/platform/graphics/MediaPlayer.cpp b/WebCore/platform/graphics/MediaPlayer.cpp
index 9f8e923..ff9303a 100644
--- a/WebCore/platform/graphics/MediaPlayer.cpp
+++ b/WebCore/platform/graphics/MediaPlayer.cpp
@@ -37,6 +37,10 @@
#include "Document.h"
#include "TimeRanges.h"
+#if PLATFORM(QT)
+#include <QtGlobal>
+#endif
+
#if PLATFORM(MAC)
#include "MediaPlayerPrivateQTKit.h"
#elif OS(WINCE) && !PLATFORM(QT)
@@ -46,7 +50,11 @@
#elif PLATFORM(GTK)
#include "MediaPlayerPrivateGStreamer.h"
#elif PLATFORM(QT)
+#if QT_VERSION < 0x040700
#include "MediaPlayerPrivatePhonon.h"
+#else
+#include "MediaPlayerPrivateQt.h"
+#endif
#elif PLATFORM(CHROMIUM)
#include "MediaPlayerPrivateChromium.h"
#endif
diff --git a/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp b/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp
new file mode 100644
index 0000000..e178144
--- /dev/null
+++ b/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp
@@ -0,0 +1,539 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include "MediaPlayerPrivateQt.h"
+
+#include "CString.h"
+#include "FrameLoaderClientQt.h"
+#include "FrameView.h"
+#include "GraphicsContext.h"
+#include "HTMLMediaElement.h"
+#include "HTMLVideoElement.h"
+#include "TimeRanges.h"
+#include "Widget.h"
+#include "qwebframe.h"
+#include "qwebpage.h"
+
+#include <QGraphicsScene>
+#include <QGraphicsVideoItem>
+#include <QMediaPlayerControl>
+#include <QMediaService>
+#include <QNetworkAccessManager>
+#include <QNetworkCookieJar>
+#include <QNetworkRequest>
+#include <QPainter>
+#include <QPoint>
+#include <QRect>
+#include <QTime>
+#include <QTimer>
+#include <QUrl>
+#include <limits>
+#include <wtf/HashSet.h>
+
+using namespace WTF;
+
+namespace WebCore {
+
+MediaPlayerPrivateInterface* MediaPlayerPrivate::create(MediaPlayer* player)
+{
+ return new MediaPlayerPrivate(player);
+}
+
+void MediaPlayerPrivate::registerMediaEngine(MediaEngineRegistrar registrar)
+{
+ registrar(create, getSupportedTypes, supportsType);
+}
+
+void MediaPlayerPrivate::getSupportedTypes(HashSet<String> &supported)
+{
+ QStringList types = QMediaPlayer::supportedMimeTypes();
+
+ for (int i = 0; i < types.size(); i++)
+ supported.add(types.at(i));
+}
+
+MediaPlayer::SupportsType MediaPlayerPrivate::supportsType(const String& mime, const String& codec)
+{
+ if (QMediaPlayer::hasSupport(mime, QStringList(codec)) >= QtMultimedia::ProbablySupported)
+ return MediaPlayer::IsSupported;
+
+ return MediaPlayer::MayBeSupported;
+}
+
+MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player)
+ : m_player(player)
+ , m_mediaPlayer(new QMediaPlayer)
+ , m_videoItem(new QGraphicsVideoItem)
+ , m_videoScene(new QGraphicsScene)
+ , m_networkState(MediaPlayer::Empty)
+ , m_readyState(MediaPlayer::HaveNothing)
+ , m_isVisible(false)
+ , m_isSeeking(false)
+ , m_queuedSeek(-1)
+{
+ m_videoItem->setMediaObject(m_mediaPlayer);
+ m_videoScene->addItem(m_videoItem);
+
+ // Signal Handlers
+ connect(m_mediaPlayer, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),
+ this, SLOT(mediaStatusChanged(QMediaPlayer::MediaStatus)));
+ connect(m_mediaPlayer, SIGNAL(stateChanged(QMediaPlayer::State)),
+ this, SLOT(stateChanged(QMediaPlayer::State)));
+ connect(m_mediaPlayer, SIGNAL(error(QMediaPlayer::Error)),
+ this, SLOT(handleError(QMediaPlayer::Error)));
+ connect(m_mediaPlayer, SIGNAL(durationChanged(qint64)),
+ this, SLOT(durationChanged(qint64)));
+ connect(m_mediaPlayer, SIGNAL(positionChanged(qint64)),
+ this, SLOT(positionChanged(qint64)));
+ connect(m_mediaPlayer, SIGNAL(volumeChanged(int)),
+ this, SLOT(volumeChanged(int)));
+ connect(m_mediaPlayer, SIGNAL(mutedChanged(bool)),
+ this, SLOT(mutedChanged(bool)));
+ connect(m_videoScene, SIGNAL(changed(QList<QRectF>)),
+ this, SLOT(repaint()));
+ connect(m_videoItem, SIGNAL(nativeSizeChanged(QSizeF)),
+ this, SLOT(nativeSizeChanged(QSizeF)));
+
+ // Grab the player control
+ QMediaService* service = m_mediaPlayer->service();
+ if (service) {
+ m_mediaPlayerControl = qobject_cast<QMediaPlayerControl *>(
+ service->control(QMediaPlayerControl_iid));
+ }
+}
+
+MediaPlayerPrivate::~MediaPlayerPrivate()
+{
+ delete m_mediaPlayer;
+ delete m_videoScene;
+}
+
+bool MediaPlayerPrivate::hasVideo() const
+{
+ return m_mediaPlayer->isVideoAvailable();
+}
+
+bool MediaPlayerPrivate::hasAudio() const
+{
+ return true;
+}
+
+void MediaPlayerPrivate::load(const String& url)
+{
+ // We are now loading
+ if (m_networkState != MediaPlayer::Loading) {
+ m_networkState = MediaPlayer::Loading;
+ m_player->networkStateChanged();
+ }
+
+ // And we don't have any data yet
+ if (m_readyState != MediaPlayer::HaveNothing) {
+ m_readyState = MediaPlayer::HaveNothing;
+ m_player->readyStateChanged();
+ }
+
+ const QUrl rUrl = QUrl(QString(url));
+ const QString scheme = rUrl.scheme().toLower();
+
+ // Grab the client media element
+ HTMLMediaElement* element = static_cast<HTMLMediaElement*>(m_player->mediaPlayerClient());
+
+ // Construct the media content with a network request if the resource is http[s]
+ if (scheme == "http" || scheme == "https") {
+ QNetworkRequest request = QNetworkRequest(rUrl);
+
+ // Grab the current document
+ Document* document = element->document();
+ if (!document)
+ document = element->ownerDocument();
+
+ // Grab the frame and network manager
+ Frame* frame = document ? document->frame() : 0;
+ FrameLoaderClientQt* frameLoader = frame ? static_cast<FrameLoaderClientQt*>(frame->loader()->client()) : 0;
+ QNetworkAccessManager* manager = frameLoader ? frameLoader->webFrame()->page()->networkAccessManager() : 0;
+
+ if (document && manager) {
+ // Set the cookies
+ QNetworkCookieJar* jar = manager->cookieJar();
+ QList<QNetworkCookie> cookies = jar->cookiesForUrl(rUrl);
+
+ // Don't set the header if there are no cookies.
+ // This prevents a warning from being emitted.
+ if (!cookies.isEmpty())
+ request.setHeader(QNetworkRequest::CookieHeader, qVariantFromValue(cookies));
+
+ // Set the refferer, but not when requesting insecure content from a secure page
+ QUrl documentUrl = QUrl(QString(document->documentURI()));
+ if (documentUrl.scheme().toLower() == "http" || scheme == "https")
+ request.setRawHeader("Referer", documentUrl.toEncoded());
+
+ // Set the user agent
+ request.setRawHeader("User-Agent", frameLoader->userAgent(rUrl).utf8().data());
+ }
+
+ m_mediaPlayer->setMedia(QMediaContent(request));
+ } else {
+ // Otherwise, just use the URL
+ m_mediaPlayer->setMedia(QMediaContent(rUrl));
+ }
+
+ // Set the current volume and mute status
+ // We get these from the element, rather than the player, in case we have
+ // transitioned from a media engine which doesn't support muting, to a media
+ // engine which does.
+ m_mediaPlayer->setMuted(element->muted());
+ m_mediaPlayer->setVolume(static_cast<int>(element->volume() * 100.0));
+}
+
+void MediaPlayerPrivate::cancelLoad()
+{
+ m_mediaPlayer->setMedia(QMediaContent());
+ updateStates();
+}
+
+void MediaPlayerPrivate::play()
+{
+ if (m_mediaPlayer->state() != QMediaPlayer::PlayingState)
+ m_mediaPlayer->play();
+}
+
+void MediaPlayerPrivate::pause()
+{
+ if (m_mediaPlayer->state() == QMediaPlayer::PlayingState)
+ m_mediaPlayer->pause();
+}
+
+bool MediaPlayerPrivate::paused() const
+{
+ return (m_mediaPlayer->state() != QMediaPlayer::PlayingState);
+}
+
+void MediaPlayerPrivate::seek(float position)
+{
+ if (!m_mediaPlayer->isSeekable())
+ return;
+
+ if (m_mediaPlayerControl && !m_mediaPlayerControl->availablePlaybackRanges().contains(position * 1000))
+ return;
+
+ if (m_isSeeking)
+ return;
+
+ if (position > duration())
+ position = duration();
+
+ // Seeking is most reliable when we're paused.
+ // Webkit will try to pause before seeking, but due to the asynchronous nature
+ // of the backend, the player may not actually be paused yet.
+ // In this case, we should queue the seek and wait until pausing has completed
+ // before attempting to seek.
+ if (m_mediaPlayer->state() == QMediaPlayer::PlayingState) {
+ m_mediaPlayer->pause();
+ m_isSeeking = true;
+ m_queuedSeek = static_cast<qint64>(position * 1000);
+
+ // Set a timeout, so that in the event that we don't get a state changed
+ // signal, we still attempt the seek.
+ QTimer::singleShot(1000, this, SLOT(queuedSeekTimeout()));
+ } else {
+ m_isSeeking = true;
+ m_mediaPlayer->setPosition(static_cast<qint64>(position * 1000));
+
+ // Set a timeout, in case we don't get a position changed signal
+ QTimer::singleShot(10000, this, SLOT(seekTimeout()));
+ }
+}
+
+bool MediaPlayerPrivate::seeking() const
+{
+ return m_isSeeking;
+}
+
+float MediaPlayerPrivate::duration() const
+{
+ if (m_readyState < MediaPlayer::HaveMetadata)
+ return 0.0f;
+
+ float duration = m_mediaPlayer->duration() / 1000.0f;
+
+ // We are streaming
+ if (duration <= 0.0f)
+ duration = std::numeric_limits<float>::infinity();
+
+ return duration;
+}
+
+float MediaPlayerPrivate::currentTime() const
+{
+ float currentTime = m_mediaPlayer->position() / 1000.0f;
+ return currentTime;
+}
+
+PassRefPtr<TimeRanges> MediaPlayerPrivate::buffered() const
+{
+ RefPtr<TimeRanges> buffered = TimeRanges::create();
+
+ if (!m_mediaPlayerControl)
+ return buffered;
+
+ QMediaTimeRange playbackRanges = m_mediaPlayerControl->availablePlaybackRanges();
+
+ foreach (const QMediaTimeInterval interval, playbackRanges.intervals()) {
+ float rangeMin = static_cast<float>(interval.start()) / 1000.0f;
+ float rangeMax = static_cast<float>(interval.end()) / 1000.0f;
+ buffered->add(rangeMin, rangeMax);
+ }
+
+ return buffered.release();
+}
+
+float MediaPlayerPrivate::maxTimeSeekable() const
+{
+ if (!m_mediaPlayerControl)
+ return 0;
+
+ return static_cast<float>(m_mediaPlayerControl->availablePlaybackRanges().latestTime()) / 1000.0f;
+}
+
+unsigned MediaPlayerPrivate::bytesLoaded() const
+{
+ unsigned percentage = m_mediaPlayer->bufferStatus();
+
+ if (percentage == 100) {
+ if (m_networkState != MediaPlayer::Idle) {
+ m_networkState = MediaPlayer::Idle;
+ m_player->networkStateChanged();
+ }
+ if (m_readyState != MediaPlayer::HaveEnoughData) {
+ m_readyState = MediaPlayer::HaveEnoughData;
+ m_player->readyStateChanged();
+ }
+ }
+
+ QLatin1String bytesLoadedKey("bytes-loaded");
+ if (m_mediaPlayer->availableExtendedMetaData().contains(bytesLoadedKey))
+ return m_mediaPlayer->extendedMetaData(bytesLoadedKey).toInt();
+
+ return percentage;
+}
+
+unsigned MediaPlayerPrivate::totalBytes() const
+{
+ if (m_mediaPlayer->availableMetaData().contains(QtMultimedia::Size))
+ return m_mediaPlayer->metaData(QtMultimedia::Size).toInt();
+
+ return 100;
+}
+
+void MediaPlayerPrivate::setRate(float rate)
+{
+ m_mediaPlayer->setPlaybackRate(rate);
+}
+
+void MediaPlayerPrivate::setVolume(float volume)
+{
+ m_mediaPlayer->setVolume(static_cast<int>(volume * 100.0));
+}
+
+bool MediaPlayerPrivate::supportsMuting() const
+{
+ return true;
+}
+
+void MediaPlayerPrivate::setMuted(bool muted)
+{
+ m_mediaPlayer->setMuted(muted);
+}
+
+MediaPlayer::NetworkState MediaPlayerPrivate::networkState() const
+{
+ return m_networkState;
+}
+
+MediaPlayer::ReadyState MediaPlayerPrivate::readyState() const
+{
+ return m_readyState;
+}
+
+void MediaPlayerPrivate::setVisible(bool visible)
+{
+ m_isVisible = visible;
+}
+
+void MediaPlayerPrivate::mediaStatusChanged(QMediaPlayer::MediaStatus)
+{
+ updateStates();
+}
+
+void MediaPlayerPrivate::handleError(QMediaPlayer::Error)
+{
+ updateStates();
+}
+
+void MediaPlayerPrivate::stateChanged(QMediaPlayer::State state)
+{
+ if (state != QMediaPlayer::PlayingState && m_isSeeking && m_queuedSeek >= 0) {
+ m_mediaPlayer->setPosition(m_queuedSeek);
+ m_queuedSeek = -1;
+ }
+}
+
+void MediaPlayerPrivate::nativeSizeChanged(const QSizeF&)
+{
+ m_player->sizeChanged();
+}
+
+void MediaPlayerPrivate::queuedSeekTimeout()
+{
+ // If we haven't heard anything, assume the player is now paused
+ // and we can attempt the seek
+ if (m_isSeeking && m_queuedSeek >= 0) {
+ m_mediaPlayer->setPosition(m_queuedSeek);
+ m_queuedSeek = -1;
+
+ // Set a timeout, in case we don't get a position changed signal
+ QTimer::singleShot(10000, this, SLOT(seekTimeout()));
+ }
+}
+
+void MediaPlayerPrivate::seekTimeout()
+{
+ // If we haven't heard anything, assume the seek succeeded
+ if (m_isSeeking) {
+ m_player->timeChanged();
+ m_isSeeking = false;
+ }
+}
+
+void MediaPlayerPrivate::positionChanged(qint64)
+{
+ // Only propogate this event if we are seeking
+ if (m_isSeeking && m_queuedSeek == -1) {
+ m_player->timeChanged();
+ m_isSeeking = false;
+ }
+}
+
+void MediaPlayerPrivate::durationChanged(qint64)
+{
+ m_player->durationChanged();
+}
+
+void MediaPlayerPrivate::volumeChanged(int volume)
+{
+ m_player->volumeChanged(static_cast<float>(volume) / 100.0);
+}
+
+void MediaPlayerPrivate::mutedChanged(bool muted)
+{
+ m_player->muteChanged(muted);
+}
+
+void MediaPlayerPrivate::updateStates()
+{
+ // Store the old states so that we can detect a change and raise change events
+ MediaPlayer::NetworkState oldNetworkState = m_networkState;
+ MediaPlayer::ReadyState oldReadyState = m_readyState;
+
+ QMediaPlayer::MediaStatus currentStatus = m_mediaPlayer->mediaStatus();
+ QMediaPlayer::Error currentError = m_mediaPlayer->error();
+
+ if (currentError != QMediaPlayer::NoError) {
+ m_readyState = MediaPlayer::HaveNothing;
+ if (currentError == QMediaPlayer::FormatError)
+ m_networkState = MediaPlayer::FormatError;
+ else
+ m_networkState = MediaPlayer::NetworkError;
+ } else if (currentStatus == QMediaPlayer::UnknownMediaStatus
+ || currentStatus == QMediaPlayer::NoMedia) {
+ m_networkState = MediaPlayer::Idle;
+ m_readyState = MediaPlayer::HaveNothing;
+ } else if (currentStatus == QMediaPlayer::LoadingMedia) {
+ m_networkState = MediaPlayer::Loading;
+ m_readyState = MediaPlayer::HaveNothing;
+ } else if (currentStatus == QMediaPlayer::LoadedMedia) {
+ m_networkState = MediaPlayer::Loading;
+ m_readyState = MediaPlayer::HaveMetadata;
+ } else if (currentStatus == QMediaPlayer::BufferingMedia) {
+ m_networkState = MediaPlayer::Loading;
+ m_readyState = MediaPlayer::HaveFutureData;
+ } else if (currentStatus == QMediaPlayer::StalledMedia) {
+ m_networkState = MediaPlayer::Loading;
+ m_readyState = MediaPlayer::HaveCurrentData;
+ } else if (currentStatus == QMediaPlayer::BufferedMedia
+ || currentStatus == QMediaPlayer::EndOfMedia) {
+ m_networkState = MediaPlayer::Idle;
+ m_readyState = MediaPlayer::HaveEnoughData;
+ } else if (currentStatus == QMediaPlayer::InvalidMedia) {
+ m_networkState = MediaPlayer::NetworkError;
+ m_readyState = MediaPlayer::HaveNothing;
+ }
+
+ // Log the state changes and raise the state change events
+ // NB: The readyStateChanged event must come before the networkStateChanged event.
+ // Breaking this invariant will cause the resource selection algorithm for multiple
+ // sources to fail.
+ if (m_readyState != oldReadyState)
+ m_player->readyStateChanged();
+
+ if (m_networkState != oldNetworkState)
+ m_player->networkStateChanged();
+}
+
+void MediaPlayerPrivate::setSize(const IntSize& size)
+{
+ if (size == m_currentSize)
+ return;
+
+ m_currentSize = size;
+ m_videoItem->setSize(QSizeF(QSize(size)));
+}
+
+IntSize MediaPlayerPrivate::naturalSize() const
+{
+ if (!hasVideo() || m_readyState < MediaPlayer::HaveMetadata)
+ return IntSize();
+
+ return IntSize(m_videoItem->nativeSize().toSize());
+}
+
+void MediaPlayerPrivate::paint(GraphicsContext* context, const IntRect& rect)
+{
+ if (context->paintingDisabled())
+ return;
+
+ if (!m_isVisible)
+ return;
+
+ // Grab the painter and widget
+ QPainter* painter = context->platformContext();
+
+ // Render the video
+ m_videoScene->render(painter, QRectF(QRect(rect)));
+}
+
+void MediaPlayerPrivate::repaint()
+{
+ m_player->repaint();
+}
+
+} // namespace WebCore
+
+#include "moc_MediaPlayerPrivateQt.cpp"
diff --git a/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h b/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h
new file mode 100644
index 0000000..6234311
--- /dev/null
+++ b/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h
@@ -0,0 +1,121 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef MediaPlayerPrivateQt_h
+#define MediaPlayerPrivateQt_h
+
+#include "MediaPlayerPrivate.h"
+
+#include <QMediaPlayer>
+#include <QObject>
+
+class QMediaPlayerControl;
+class QGraphicsVideoItem;
+class QGraphicsScene;
+
+namespace WebCore {
+
+class MediaPlayerPrivate : public QObject, public MediaPlayerPrivateInterface {
+
+ Q_OBJECT
+
+public:
+ static MediaPlayerPrivateInterface* create(MediaPlayer* player);
+ ~MediaPlayerPrivate();
+
+ static void registerMediaEngine(MediaEngineRegistrar);
+ static void getSupportedTypes(HashSet<String>&);
+ static MediaPlayer::SupportsType supportsType(const String&, const String&);
+ static bool isAvailable() { return true; }
+
+ bool hasVideo() const;
+ bool hasAudio() const;
+
+ void load(const String &url);
+ void cancelLoad();
+
+ void play();
+ void pause();
+
+ bool paused() const;
+ bool seeking() const;
+
+ float duration() const;
+ float currentTime() const;
+ void seek(float);
+
+ void setRate(float);
+ void setVolume(float);
+
+ bool supportsMuting() const;
+ void setMuted(bool);
+
+ MediaPlayer::NetworkState networkState() const;
+ MediaPlayer::ReadyState readyState() const;
+
+ PassRefPtr<TimeRanges> buffered() const;
+ float maxTimeSeekable() const;
+ unsigned bytesLoaded() const;
+ unsigned totalBytes() const;
+
+ void setVisible(bool);
+
+ IntSize naturalSize() const;
+ void setSize(const IntSize&);
+
+ void paint(GraphicsContext*, const IntRect&);
+
+ bool supportsFullscreen() const { return false; }
+
+private slots:
+ void mediaStatusChanged(QMediaPlayer::MediaStatus);
+ void handleError(QMediaPlayer::Error);
+ void stateChanged(QMediaPlayer::State);
+ void nativeSizeChanged(const QSizeF&);
+ void queuedSeekTimeout();
+ void seekTimeout();
+ void positionChanged(qint64);
+ void durationChanged(qint64);
+ void volumeChanged(int);
+ void mutedChanged(bool);
+ void repaint();
+
+private:
+ void updateStates();
+
+private:
+ MediaPlayerPrivate(MediaPlayer*);
+
+ MediaPlayer* m_player;
+ QMediaPlayer* m_mediaPlayer;
+ QMediaPlayerControl* m_mediaPlayerControl;
+ QGraphicsVideoItem* m_videoItem;
+ QGraphicsScene* m_videoScene;
+
+ mutable MediaPlayer::NetworkState m_networkState;
+ mutable MediaPlayer::ReadyState m_readyState;
+
+ IntSize m_currentSize;
+ bool m_isVisible;
+ bool m_isSeeking;
+ qint64 m_queuedSeek;
+};
+}
+
+#endif // MediaPlayerPrivateQt_h
diff --git a/WebCore/platform/qt/RenderThemeQt.cpp b/WebCore/platform/qt/RenderThemeQt.cpp
index 271c11a..af58356 100644
--- a/WebCore/platform/qt/RenderThemeQt.cpp
+++ b/WebCore/platform/qt/RenderThemeQt.cpp
@@ -39,6 +39,7 @@
#include "Font.h"
#include "FontSelector.h"
#include "GraphicsContext.h"
+#include "HTMLInputElement.h"
#include "HTMLMediaElement.h"
#include "HTMLNames.h"
#include "NotImplemented.h"
@@ -47,6 +48,7 @@
#include "RenderBox.h"
#include "RenderSlider.h"
#include "RenderTheme.h"
+#include "TimeRanges.h"
#include "ScrollbarThemeQt.h"
#include "UserAgentStyleSheets.h"
#include "qwebpage.h"
@@ -882,10 +884,15 @@ HTMLMediaElement* RenderThemeQt::getMediaElementFromRenderObject(RenderObject* o
return static_cast<HTMLMediaElement*>(mediaNode);
}
+double RenderThemeQt::mediaControlsBaselineOpacity() const
+{
+ return 0.4;
+}
+
void RenderThemeQt::paintMediaBackground(QPainter* painter, const IntRect& r) const
{
painter->setPen(Qt::NoPen);
- static QColor transparentBlack(0, 0, 0, 100);
+ static QColor transparentBlack(0, 0, 0, mediaControlsBaselineOpacity() * 255);
painter->setBrush(transparentBlack);
painter->drawRoundedRect(r.x(), r.y(), r.width(), r.height(), 5.0, 5.0);
}
@@ -921,14 +928,9 @@ bool RenderThemeQt::paintMediaMuteButton(RenderObject* o, const RenderObject::Pa
const QPointF speakerPolygon[6] = { QPointF(20, 30), QPointF(50, 30), QPointF(80, 0),
QPointF(80, 100), QPointF(50, 70), QPointF(20, 70)};
- p.painter->setBrush(getMediaControlForegroundColor(o));
+ p.painter->setBrush(mediaElement->muted() ? Qt::darkRed : getMediaControlForegroundColor(o));
p.painter->drawPolygon(speakerPolygon, 6);
- if (mediaElement->muted()) {
- p.painter->setPen(Qt::red);
- p.painter->drawLine(0, 100, 100, 0);
- }
-
return false;
}
@@ -971,6 +973,86 @@ bool RenderThemeQt::paintMediaSeekForwardButton(RenderObject*, const RenderObjec
return false;
}
+bool RenderThemeQt::paintMediaCurrentTime(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
+{
+ StylePainter p(this, paintInfo);
+ if (!p.isValid())
+ return true;
+
+ p.painter->setRenderHint(QPainter::Antialiasing, true);
+ paintMediaBackground(p.painter, r);
+
+ return false;
+}
+
+String RenderThemeQt::formatMediaControlsCurrentTime(float currentTime, float duration) const
+{
+ return formatMediaControlsTime(currentTime) + " / " + formatMediaControlsTime(duration);
+}
+
+String RenderThemeQt::formatMediaControlsRemainingTime(float currentTime, float duration) const
+{
+ return String();
+}
+
+bool RenderThemeQt::paintMediaVolumeSliderTrack(RenderObject *o, const RenderObject::PaintInfo &paintInfo, const IntRect &r)
+{
+ StylePainter p(this, paintInfo);
+ if (!p.isValid())
+ return true;
+
+ p.painter->setRenderHint(QPainter::Antialiasing, true);
+
+ paintMediaBackground(p.painter, r);
+
+ if (!o->isSlider())
+ return false;
+
+ IntRect b = toRenderBox(o)->contentBoxRect();
+
+ // Position the outer rectangle
+ int top = r.y() + b.y();
+ int left = r.x() + b.x();
+ int width = b.width();
+ int height = b.height();
+
+ // Get the scale color from the page client
+ QPalette pal = QApplication::palette();
+ setPaletteFromPageClientIfExists(pal);
+ const QColor highlightText = pal.brush(QPalette::Active, QPalette::HighlightedText).color();
+ const QColor scaleColor(highlightText.red(), highlightText.green(), highlightText.blue(), mediaControlsBaselineOpacity() * 255);
+
+ // Draw the outer rectangle
+ p.painter->setBrush(scaleColor);
+ p.painter->drawRect(left, top, width, height);
+
+ if (!o->node() || !o->node()->hasTagName(inputTag))
+ return false;
+
+ HTMLInputElement* slider = static_cast<HTMLInputElement*>(o->node());
+
+ // Position the inner rectangle
+ height = height * slider->valueAsNumber();
+ top += b.height() - height;
+
+ // Draw the inner rectangle
+ p.painter->setPen(Qt::NoPen);
+ p.painter->setBrush(getMediaControlForegroundColor(o));
+ p.painter->drawRect(left, top, width, height);
+
+ return false;
+}
+
+bool RenderThemeQt::paintMediaVolumeSliderThumb(RenderObject *o, const RenderObject::PaintInfo &paintInfo, const IntRect &r)
+{
+ StylePainter p(this, paintInfo);
+ if (!p.isValid())
+ return true;
+
+ // Nothing to draw here, this is all done in the track
+ return false;
+}
+
bool RenderThemeQt::paintMediaSliderTrack(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
{
HTMLMediaElement* mediaElement = getMediaElementFromRenderObject(o);
@@ -985,15 +1067,31 @@ bool RenderThemeQt::paintMediaSliderTrack(RenderObject* o, const RenderObject::P
paintMediaBackground(p.painter, r);
+#if QT_VERSION >= 0x040700
+ if (MediaPlayer* player = mediaElement->player()) {
+ // Get the buffered parts of the media
+ PassRefPtr<TimeRanges> buffered = player->buffered();
+ if (buffered->length() > 0 && player->duration() < std::numeric_limits<float>::infinity()) {
+ // Set the transform and brush
+ WorldMatrixTransformer transformer(p.painter, o, r);
+ p.painter->setBrush(getMediaControlForegroundColor());
+
+ // Paint each buffered section
+ ExceptionCode ex;
+ for (int i = 0; i < buffered->length(); i++) {
+ float startX = (buffered->start(i, ex) / player->duration()) * 100;
+ float width = ((buffered->end(i, ex) / player->duration()) * 100) - startX;
+ p.painter->drawRect(startX, 37, width, 26);
+ }
+ }
+ }
+#endif
+
return false;
}
bool RenderThemeQt::paintMediaSliderThumb(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
{
- HTMLMediaElement* mediaElement = getMediaElementFromRenderObject(o->parent());
- if (!mediaElement)
- return false;
-
StylePainter p(this, paintInfo);
if (!p.isValid())
return true;
@@ -1019,6 +1117,13 @@ void RenderThemeQt::adjustSliderThumbSize(RenderObject* o) const
int parentHeight = parentStyle->height().value();
o->style()->setWidth(Length(parentHeight / 3, Fixed));
o->style()->setHeight(Length(parentHeight, Fixed));
+ } else if (part == MediaVolumeSliderThumbPart) {
+ RenderStyle* parentStyle = o->parent()->style();
+ Q_ASSERT(parentStyle);
+
+ int parentWidth = parentStyle->width().value();
+ o->style()->setHeight(Length(parentWidth / 3, Fixed));
+ o->style()->setWidth(Length(parentWidth, Fixed));
} else if (part == SliderThumbHorizontalPart || part == SliderThumbVerticalPart) {
QStyleOptionSlider option;
if (part == SliderThumbVerticalPart)
diff --git a/WebCore/platform/qt/RenderThemeQt.h b/WebCore/platform/qt/RenderThemeQt.h
index 5385881..8a22df1 100644
--- a/WebCore/platform/qt/RenderThemeQt.h
+++ b/WebCore/platform/qt/RenderThemeQt.h
@@ -127,10 +127,15 @@ protected:
virtual bool paintMediaSeekForwardButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
virtual bool paintMediaSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
virtual bool paintMediaSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
-
+ virtual bool paintMediaCurrentTime(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual bool paintMediaVolumeSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual bool paintMediaVolumeSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual String formatMediaControlsCurrentTime(float currentTime, float duration) const;
+ virtual String formatMediaControlsRemainingTime(float currentTime, float duration) const;
private:
HTMLMediaElement* getMediaElementFromRenderObject(RenderObject* o) const;
void paintMediaBackground(QPainter* painter, const IntRect& r) const;
+ double mediaControlsBaselineOpacity() const;
QColor getMediaControlForegroundColor(RenderObject* o = 0) const;
#endif
void computeSizeBasedOnStyle(RenderStyle* renderStyle) const;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list