Changeset 75944 in webkit
- Timestamp:
- Jan 17, 2011 8:00:31 AM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 2 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r75940 r75944 1 2011-01-17 Yi Shen <yi.4.shen@nokia.com> 2 3 Reviewed by Andreas Kling. 4 5 [Qt] Extend the Platform Plugin to support full screen video handler 6 https://bugs.webkit.org/show_bug.cgi?id=51249 7 8 Make MediaPlayerPrivateQt support a fullscreen player. 9 10 No new tests because LayoutTests/media/media-fullscreen-inline.html already exists. 11 However, this test failed for Qt (QtMediaPlayer) due to durationchange event getting fired twice. 12 So, still skip it for Qt. 13 14 * WebCore.pro: 15 * features.pri: 16 * platform/graphics/qt/MediaPlayerPrivateQt.cpp: 17 (WebCore::MediaPlayerPrivateQt::MediaPlayerPrivateQt): 18 (WebCore::MediaPlayerPrivateQt::removeVideoItem): 19 (WebCore::MediaPlayerPrivateQt::restoreVideoItem): 20 * platform/graphics/qt/MediaPlayerPrivateQt.h: 21 (WebCore::MediaPlayerPrivateQt::supportsFullscreen): 22 (WebCore::MediaPlayerPrivateQt::mediaPlayer): 23 1 24 2011-01-17 Anthony Ricaud <rik@webkit.org> 2 25 -
trunk/Source/WebCore/WebCore.pro
r75908 r75944 3258 3258 PKGCONFIG += glib-2.0 gio-2.0 gstreamer-0.10 gstreamer-app-0.10 gstreamer-base-0.10 gstreamer-interfaces-0.10 gstreamer-pbutils-0.10 gstreamer-plugins-base-0.10 gstreamer-video-0.10 3259 3259 } else:contains(MOBILITY_CONFIG, multimedia) { 3260 HEADERS += platform/graphics/qt/MediaPlayerPrivateQt.h 3261 SOURCES += platform/graphics/qt/MediaPlayerPrivateQt.cpp 3260 HEADERS += \ 3261 platform/graphics/qt/MediaPlayerPrivateQt.h \ 3262 $$PWD/../../WebKit/qt/WebCoreSupport/FullScreenVideoQt.h 3263 3264 SOURCES += \ 3265 platform/graphics/qt/MediaPlayerPrivateQt.cpp \ 3266 $$PWD/../../WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp 3262 3267 3263 3268 CONFIG *= mobility -
trunk/Source/WebCore/features.pri
r75206 r75944 153 153 DEFINES -= ENABLE_VIDEO=0 154 154 DEFINES += ENABLE_VIDEO=1 155 DEFINES -= ENABLE_QT_MULTIMEDIA=0 156 DEFINES += ENABLE_QT_MULTIMEDIA=1 155 157 } else:contains(QT_CONFIG, phonon) { 156 158 DEFINES -= ENABLE_VIDEO=0 157 159 DEFINES += ENABLE_VIDEO=1 160 DEFINES -= ENABLE_QT_MULTIMEDIA=1 161 DEFINES += ENABLE_QT_MULTIMEDIA=0 158 162 } 159 163 } -
trunk/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp
r75885 r75944 109 109 , m_preload(MediaPlayer::Auto) 110 110 { 111 m_mediaPlayer-> bind(m_videoItem);111 m_mediaPlayer->setVideoOutput(m_videoItem); 112 112 m_videoScene->addItem(m_videoItem); 113 113 … … 588 588 } 589 589 590 void MediaPlayerPrivateQt::removeVideoItem() 591 { 592 m_oldNaturalSize = m_naturalSize; 593 m_mediaPlayer->setVideoOutput(static_cast<QGraphicsVideoItem*>(0)); 594 m_videoScene->removeItem(m_videoItem); 595 } 596 597 void MediaPlayerPrivateQt::restoreVideoItem() 598 { 599 m_mediaPlayer->setVideoOutput(m_videoItem); 600 m_videoScene->addItem(m_videoItem); 601 // FIXME: a qtmobility bug, need to reset the size when restore the videoitem, otherwise the size is 0 602 // http://bugreports.qt.nokia.com/browse/QTMOBILITY-971 603 nativeSizeChanged(QSize(m_oldNaturalSize)); 604 } 605 590 606 void MediaPlayerPrivateQt::paint(GraphicsContext* context, const IntRect& rect) 591 607 { -
trunk/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h
r75885 r75944 91 91 void paint(GraphicsContext*, const IntRect&); 92 92 93 bool supportsFullscreen() const { return false; }93 bool supportsFullscreen() const { return true; } 94 94 95 95 #if USE(ACCELERATED_COMPOSITING) … … 109 109 110 110 virtual PlatformMedia platformMedia() const; 111 112 QMediaPlayer* mediaPlayer() const { return m_mediaPlayer; } 113 void removeVideoItem(); 114 void restoreVideoItem(); 115 111 116 private slots: 112 117 void mediaStatusChanged(QMediaPlayer::MediaStatus); … … 143 148 IntSize m_currentSize; 144 149 IntSize m_naturalSize; 150 IntSize m_oldNaturalSize; 145 151 bool m_isVisible; 146 152 bool m_isSeeking; -
trunk/Source/WebKit/qt/Api/qwebkitplatformplugin.h
r75885 r75944 29 29 #include <QObject> 30 30 #include <QUrl> 31 #if defined(ENABLE_QT_MULTIMEDIA) && ENABLE_QT_MULTIMEDIA 32 #include <QMediaPlayer> 33 #endif 31 34 32 35 class QWebSelectData … … 116 119 }; 117 120 121 #if defined(ENABLE_QT_MULTIMEDIA) && ENABLE_QT_MULTIMEDIA 122 class QWebFullScreenVideoHandler : public QObject { 123 Q_OBJECT 124 public: 125 QWebFullScreenVideoHandler() {} 126 virtual ~QWebFullScreenVideoHandler() {} 127 virtual bool requiresFullScreenForVideoPlayback() const = 0; 128 129 Q_SIGNALS: 130 void fullScreenClosed(); 131 132 public Q_SLOTS: 133 virtual void enterFullScreen(QMediaPlayer*) = 0; 134 virtual void exitFullScreen() = 0; 135 }; 136 #endif 137 118 138 class QWebKitPlatformPlugin 119 139 { … … 125 145 Notifications, 126 146 Haptics, 127 TouchInteraction 147 TouchInteraction, 148 FullScreenVideoPlayer 128 149 }; 129 150 … … 133 154 134 155 QT_BEGIN_NAMESPACE 135 Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1. 6");156 Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.7"); 136 157 QT_END_NAMESPACE 137 158 -
trunk/Source/WebKit/qt/ChangeLog
r75908 r75944 1 2011-01-17 Yi Shen <yi.4.shen@nokia.com> 2 3 Reviewed by Andreas Kling. 4 5 [Qt] Extend the Platform Plugin to support full screen video handler 6 https://bugs.webkit.org/show_bug.cgi?id=51249 7 8 Add a new webkit platform plugin interface to support full screen video handler. 9 10 * Api/qwebkitplatformplugin.h: 11 (QWebFullScreenVideoHandler::QWebFullScreenVideoHandler): 12 (QWebFullScreenVideoHandler::~QWebFullScreenVideoHandler): 13 * WebCoreSupport/ChromeClientQt.cpp: 14 (WebCore::ChromeClientQt::ChromeClientQt): 15 (WebCore::ChromeClientQt::~ChromeClientQt): 16 (WebCore::ChromeClientQt::fullScreenVideo): 17 (WebCore::ChromeClientQt::supportsFullscreenForNode): 18 (WebCore::ChromeClientQt::requiresFullscreenForVideoPlayback): 19 (WebCore::ChromeClientQt::enterFullscreenForNode): 20 (WebCore::ChromeClientQt::exitFullscreenForNode): 21 * WebCoreSupport/ChromeClientQt.h: 22 * WebCoreSupport/FullScreenVideoQt.cpp: Added. 23 (WebCore::FullScreenVideoQt::FullScreenVideoQt): 24 (WebCore::FullScreenVideoQt::~FullScreenVideoQt): 25 (WebCore::FullScreenVideoQt::enterFullScreenForNode): 26 (WebCore::FullScreenVideoQt::exitFullScreenForNode): 27 (WebCore::FullScreenVideoQt::aboutToClose): 28 (WebCore::FullScreenVideoQt::mediaPlayer): 29 (WebCore::FullScreenVideoQt::mediaPlayerForNode): 30 (WebCore::FullScreenVideoQt::requiresFullScreenForVideoPlayback): 31 * WebCoreSupport/FullScreenVideoQt.h: Added. 32 (WebCore::FullScreenVideoQt::isValid): 33 * WebCoreSupport/QtPlatformPlugin.cpp: 34 (WebCore::QtPlatformPlugin::createFullScreenVideoHandler): 35 * WebCoreSupport/QtPlatformPlugin.h: 36 * examples/platformplugin/WebPlugin.cpp: 37 (FullScreenVideoWidget::FullScreenVideoWidget): 38 (FullScreenVideoWidget::event): 39 (FullScreenVideoWidget::keyPressEvent): 40 (FullScreenVideoHandler::FullScreenVideoHandler): 41 (FullScreenVideoHandler::~FullScreenVideoHandler): 42 (FullScreenVideoHandler::requiresFullScreenForVideoPlayback): 43 (FullScreenVideoHandler::enterFullScreen): 44 (FullScreenVideoHandler::exitFullScreen): 45 (WebPlugin::supportsExtension): 46 (WebPlugin::createExtension): 47 * examples/platformplugin/WebPlugin.h: 48 (FullScreenVideoWidget::~FullScreenVideoWidget): 49 * examples/platformplugin/platformplugin.pro: 50 * examples/platformplugin/qwebkitplatformplugin.h: 51 (QWebFullScreenVideoHandler::QWebFullScreenVideoHandler): 52 (QWebFullScreenVideoHandler::~QWebFullScreenVideoHandler): 53 1 54 2011-01-16 Adam Barth <abarth@webkit.org> 2 55 -
trunk/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
r75885 r75944 77 77 #include <wtf/OwnPtr.h> 78 78 79 #if ENABLE(VIDEO) && ENABLE(QT_MULTIMEDIA) 80 #include "FullScreenVideoQt.h" 81 #include "HTMLMediaElement.h" 82 #include "HTMLNames.h" 83 #include "HTMLVideoElement.h" 84 #include "MediaPlayerPrivateQt.h" 85 #endif 86 79 87 namespace WebCore { 80 88 … … 84 92 : m_webPage(webPage) 85 93 , m_eventLoop(0) 94 #if ENABLE(VIDEO) && ENABLE(QT_MULTIMEDIA) 95 , m_fullScreenVideo(0) 96 #endif 86 97 { 87 98 toolBarsVisible = statusBarVisible = menuBarVisible = true; … … 92 103 if (m_eventLoop) 93 104 m_eventLoop->exit(); 105 106 #if ENABLE(VIDEO) && ENABLE(QT_MULTIMEDIA) 107 delete m_fullScreenVideo; 108 #endif 94 109 } 95 110 … … 649 664 #endif 650 665 666 #if ENABLE(VIDEO) && ENABLE(QT_MULTIMEDIA) 667 FullScreenVideoQt* ChromeClientQt::fullScreenVideo() 668 { 669 if (!m_fullScreenVideo) 670 m_fullScreenVideo = new FullScreenVideoQt(this); 671 return m_fullScreenVideo; 672 } 673 674 bool ChromeClientQt::supportsFullscreenForNode(const Node* node) 675 { 676 ASSERT(node); 677 return node->hasTagName(HTMLNames::videoTag) && fullScreenVideo()->isValid(); 678 } 679 680 bool ChromeClientQt::requiresFullscreenForVideoPlayback() 681 { 682 return fullScreenVideo()->requiresFullScreenForVideoPlayback(); 683 } 684 685 void ChromeClientQt::enterFullscreenForNode(Node* node) 686 { 687 ASSERT(node && node->hasTagName(HTMLNames::videoTag)); 688 689 HTMLVideoElement* videoElement = static_cast<HTMLVideoElement*>(node); 690 PlatformMedia platformMedia = videoElement->platformMedia(); 691 692 ASSERT(platformMedia.type == PlatformMedia::QtMediaPlayerType); 693 if (platformMedia.type != PlatformMedia::QtMediaPlayerType) 694 return; 695 696 fullScreenVideo()->enterFullScreenForNode(node); 697 } 698 699 void ChromeClientQt::exitFullscreenForNode(Node* node) 700 { 701 ASSERT(node && node->hasTagName(HTMLNames::videoTag)); 702 703 HTMLVideoElement* videoElement = static_cast<HTMLVideoElement*>(node); 704 PlatformMedia platformMedia = videoElement->platformMedia(); 705 706 ASSERT(platformMedia.type == PlatformMedia::QtMediaPlayerType); 707 if (platformMedia.type != PlatformMedia::QtMediaPlayerType) 708 return; 709 710 fullScreenVideo()->exitFullScreenForNode(node); 711 } 712 #endif 713 651 714 QWebSelectMethod* ChromeClientQt::createSelectPopup() const 652 715 { -
trunk/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h
r75885 r75944 51 51 class QtAbstractWebPopup; 52 52 struct ViewportArguments; 53 #if ENABLE(VIDEO) && ENABLE(QT_MULTIMEDIA) 54 class FullScreenVideoQt; 55 #endif 53 56 54 57 class ChromeClientQt : public ChromeClient … … 163 166 virtual void needTouchEvents(bool) { } 164 167 #endif 168 169 #if ENABLE(VIDEO) && ENABLE(QT_MULTIMEDIA) 170 virtual bool supportsFullscreenForNode(const Node*); 171 virtual void enterFullscreenForNode(Node*); 172 virtual void exitFullscreenForNode(Node*); 173 virtual bool requiresFullscreenForVideoPlayback(); 174 FullScreenVideoQt* fullScreenVideo(); 175 #endif 165 176 166 177 virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>); … … 197 208 QEventLoop* m_eventLoop; 198 209 210 #if ENABLE(VIDEO) && ENABLE(QT_MULTIMEDIA) 211 FullScreenVideoQt* m_fullScreenVideo; 212 #endif 213 199 214 static bool dumpVisitedLinksCallbacks; 200 215 -
trunk/Source/WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp
r75885 r75944 128 128 } 129 129 130 #if ENABLE(VIDEO) && ENABLE(QT_MULTIMEDIA) 131 QWebFullScreenVideoHandler* QtPlatformPlugin::createFullScreenVideoHandler() 132 { 133 QWebKitPlatformPlugin* p = plugin(); 134 return p ? static_cast<QWebFullScreenVideoHandler*>(p->createExtension(QWebKitPlatformPlugin::FullScreenVideoPlayer)) : 0; 130 135 } 136 #endif 137 138 } -
trunk/Source/WebKit/qt/WebCoreSupport/QtPlatformPlugin.h
r75885 r75944 30 30 class QWebSelectData; 31 31 class QWebTouchModifier; 32 #if ENABLE(VIDEO) && ENABLE(QT_MULTIMEDIA) 33 class QWebFullScreenVideoHandler; 34 #endif 32 35 33 36 namespace WebCore { … … 42 45 QWebHapticFeedbackPlayer* createHapticFeedbackPlayer(); 43 46 QWebTouchModifier* createTouchModifier(); 47 #if ENABLE(VIDEO) && ENABLE(QT_MULTIMEDIA) 48 QWebFullScreenVideoHandler* createFullScreenVideoHandler(); 49 #endif 44 50 45 51 QWebKitPlatformPlugin* plugin(); -
trunk/Source/WebKit/qt/examples/platformplugin/WebPlugin.cpp
r75885 r75944 20 20 #include "WebPlugin.h" 21 21 22 #include <QEvent> 22 23 #include <QHBoxLayout> 24 #include <QKeyEvent> 23 25 #include <QListWidget> 24 26 #include <QListWidgetItem> … … 209 211 } 210 212 213 #if defined(ENABLE_QT_MULTIMEDIA) && ENABLE_QT_MULTIMEDIA 214 FullScreenVideoWidget::FullScreenVideoWidget(QMediaPlayer* player) 215 : QVideoWidget() 216 , m_mediaPlayer(player) 217 { 218 Q_ASSERT(m_mediaPlayer); 219 220 setFullScreen(true); 221 m_mediaPlayer->setVideoOutput(this); 222 } 223 224 bool FullScreenVideoWidget::event(QEvent* ev) 225 { 226 if (ev->type() == QEvent::MouseButtonDblClick) { 227 emit fullScreenClosed(); 228 ev->accept(); 229 return true; 230 } 231 return QWidget::event(ev); 232 } 233 234 void FullScreenVideoWidget::keyPressEvent(QKeyEvent* ev) 235 { 236 if (ev->key() == Qt::Key_Space) { 237 if (m_mediaPlayer->state() == QMediaPlayer::PlayingState) 238 m_mediaPlayer->pause(); 239 else 240 m_mediaPlayer->play(); 241 ev->accept(); 242 return; 243 } 244 } 245 246 FullScreenVideoHandler::FullScreenVideoHandler() 247 : m_mediaWidget(0) 248 { 249 } 250 251 FullScreenVideoHandler::~FullScreenVideoHandler() 252 { 253 delete m_mediaWidget; 254 } 255 256 bool FullScreenVideoHandler::requiresFullScreenForVideoPlayback() const 257 { 258 return true; 259 } 260 261 void FullScreenVideoHandler::enterFullScreen(QMediaPlayer* player) 262 { 263 Q_ASSERT(player); 264 265 m_mediaWidget = new FullScreenVideoWidget(player); 266 connect(m_mediaWidget, SIGNAL(fullScreenClosed()), this, SIGNAL(fullScreenClosed())); 267 m_mediaWidget->showFullScreen(); 268 } 269 270 void FullScreenVideoHandler::exitFullScreen() 271 { 272 m_mediaWidget->hide(); 273 delete m_mediaWidget; 274 m_mediaWidget = 0; 275 } 276 #endif 277 211 278 bool WebPlugin::supportsExtension(Extension extension) const 212 279 { … … 220 287 case TouchInteraction: 221 288 return true; 289 #if defined(ENABLE_QT_MULTIMEDIA) && ENABLE_QT_MULTIMEDIA 290 case FullScreenVideoPlayer: 291 return true; 292 #endif 222 293 default: 223 294 return false; … … 236 307 case TouchInteraction: 237 308 return new TouchModifier(); 309 #if defined(ENABLE_QT_MULTIMEDIA) && ENABLE_QT_MULTIMEDIA 310 case FullScreenVideoPlayer: 311 return new FullScreenVideoHandler(); 312 #endif 238 313 default: 239 314 return 0; -
trunk/Source/WebKit/qt/examples/platformplugin/WebPlugin.h
r75885 r75944 25 25 26 26 #include <QDialog> 27 #if defined(ENABLE_QT_MULTIMEDIA) && ENABLE_QT_MULTIMEDIA 28 #include <QVideoWidget> 29 #endif 27 30 28 31 class QListWidgetItem; … … 95 98 }; 96 99 100 #if defined(ENABLE_QT_MULTIMEDIA) && ENABLE_QT_MULTIMEDIA 101 class FullScreenVideoWidget : public QVideoWidget { 102 Q_OBJECT 103 public: 104 FullScreenVideoWidget(QMediaPlayer*); 105 virtual ~FullScreenVideoWidget() {} 106 107 Q_SIGNALS: 108 void fullScreenClosed(); 109 110 protected: 111 bool event(QEvent*); 112 void keyPressEvent(QKeyEvent*); 113 114 private: 115 QMediaPlayer* m_mediaPlayer; // not owned 116 }; 117 118 class FullScreenVideoHandler : public QWebFullScreenVideoHandler { 119 Q_OBJECT 120 public: 121 FullScreenVideoHandler(); 122 virtual ~FullScreenVideoHandler(); 123 bool requiresFullScreenForVideoPlayback() const; 124 125 public Q_SLOTS: 126 void enterFullScreen(QMediaPlayer*); 127 void exitFullScreen(); 128 129 private: 130 FullScreenVideoWidget* m_mediaWidget; // owned 131 }; 132 #endif 133 97 134 class WebPlugin : public QObject, public QWebKitPlatformPlugin 98 135 { -
trunk/Source/WebKit/qt/examples/platformplugin/platformplugin.pro
r75885 r75944 3 3 TEMPLATE = lib 4 4 CONFIG += plugin 5 6 ## load mobilityconfig if mobility is available 7 load(mobilityconfig, true) 8 9 # HTML5 Media Support 10 # We require QtMultimedia 11 !contains(DEFINES, ENABLE_VIDEO=.) { 12 contains(MOBILITY_CONFIG, multimedia) { 13 CONFIG += mobility 14 MOBILITY += multimedia 15 DEFINES -= ENABLE_VIDEO=0 16 DEFINES += ENABLE_VIDEO=1 17 DEFINES -= ENABLE_QT_MULTIMEDIA=0 18 DEFINES += ENABLE_QT_MULTIMEDIA=1 19 } 20 } 5 21 6 22 DESTDIR = $$[QT_INSTALL_PLUGINS]/webkit -
trunk/Source/WebKit/qt/examples/platformplugin/qwebkitplatformplugin.h
r75885 r75944 29 29 #include <QObject> 30 30 #include <QUrl> 31 #if defined(ENABLE_QT_MULTIMEDIA) && ENABLE_QT_MULTIMEDIA 32 #include <QMediaPlayer> 33 #endif 31 34 32 35 class QWebSelectData … … 116 119 }; 117 120 121 #if defined(ENABLE_QT_MULTIMEDIA) && ENABLE_QT_MULTIMEDIA 122 class QWebFullScreenVideoHandler : public QObject { 123 Q_OBJECT 124 public: 125 QWebFullScreenVideoHandler() {} 126 virtual ~QWebFullScreenVideoHandler() {} 127 virtual bool requiresFullScreenForVideoPlayback() const = 0; 128 129 Q_SIGNALS: 130 void fullScreenClosed(); 131 132 public Q_SLOTS: 133 virtual void enterFullScreen(QMediaPlayer*) = 0; 134 virtual void exitFullScreen() = 0; 135 }; 136 #endif 137 118 138 class QWebKitPlatformPlugin 119 139 { … … 125 145 Notifications, 126 146 Haptics, 127 TouchInteraction 147 TouchInteraction, 148 FullScreenVideoPlayer 128 149 }; 129 150 … … 133 154 134 155 QT_BEGIN_NAMESPACE 135 Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1. 6");156 Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.7"); 136 157 QT_END_NAMESPACE 137 158
Note: See TracChangeset
for help on using the changeset viewer.