2009-10-05 Pierre d'Herbemont <pdherbemont@webkit.org>

        Reviewed by Simon Fraser

        Support fullscreen in MediaPlayer (Mac)
        https://bugs.webkit.org/show_bug.cgi?id=26742

        Add a fullscreen button to the <video> controller if the media engine,
        and the theme have support for fullscreen, and can show appropriate controls.
        Clicking the button calls through the ChromeClient to the WebVideoFullscreenController
        in WebKit to do a nice animation to fullscreen, with a custom controller.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49136 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 028a1c5b
2009-10-05 Pierre d'Herbemont <pdherbemont@webkit.org>
Reviewed by Simon Fraser
Support fullscreen in MediaPlayer (Mac)
https://bugs.webkit.org/show_bug.cgi?id=26742
Add a fullscreen button to the <video> controller if the media engine,
and the theme have support for fullscreen, and can show appropriate controls.
Clicking the button calls through the ChromeClient to the WebVideoFullscreenController
in WebKit to do a nice animation to fullscreen, with a custom controller.
* DerivedSources.make:
* WebCore.Video.exp: Added.
New export file for when VIDEO is enabled.
* WebCore.base.exp: Export WebCore::HTMLNames::videoTag
* WebCore.xcodeproj/project.pbxproj: New files
* html/HTMLMediaElement.h:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement):
(WebCore::HTMLMediaElement::willRemove):
(WebCore::HTMLMediaElement::screenRect):
(WebCore::HTMLMediaElement::enterFullscreen):
(WebCore::HTMLMediaElement::exitFullscreen):
(WebCore::HTMLMediaElement::platformMedia):
Add fullscreen logic. platformMedia returns a pointer to platform-specific playback data
used for fullscreen.
* html/HTMLVideoElement.h:
* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::supportsFullscreen): Check with both the player and the ChromeClient
to see if it's possile to enter fullscreen for this element.
* page/ChromeClient.h:
(WebCore::ChromeClient::supportsFullscreenForNode):
(WebCore::ChromeClient::enterFullscreenForNode):
(WebCore::ChromeClient::exitFullscreenForNode):
New methods
* platform/graphics/MediaPlayer.h:
* platform/graphics/MediaPlayer.cpp:
(WebCore::NullMediaPlayerPrivate::platformMedia):
(WebCore::MediaPlayer::platformMedia):
* platform/graphics/MediaPlayerPrivate.h:
(WebCore::MediaPlayerPrivateInterface::platformMedia):
* platform/graphics/mac/MediaPlayerPrivateQTKit.h:
* platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
(WebCore::MediaPlayerPrivate::platformMedia):
(WebCore::MediaPlayerPrivate::supportsFullscreen):
New methods to return platform-specific playback data for fullscreen.
* rendering/MediaControlElements.cpp:
(WebCore::MediaControlFullscreenButtonElement::defaultEventHandler):
Hook up the fullscreen button.
* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::shouldRenderMediaControlPart):
Allow the RenderThemeMac to make a decision about the availability of fullscreen based
on the QuickTime version, since this affects what controls are availabl.e
2009-10-05 Kevin Decker <kdecker@apple.com>
Export a few more methods from Settings.h
......@@ -839,6 +839,10 @@ ifeq ($(findstring ENABLE_PLUGIN_PROXY_FOR_VIDEO,$(FEATURE_DEFINES)), ENABLE_PLU
WEBCORE_EXPORT_DEPENDENCIES := $(WEBCORE_EXPORT_DEPENDENCIES) WebCore.VideoProxy.exp
endif
ifeq ($(findstring ENABLE_VIDEO,$(FEATURE_DEFINES)), ENABLE_VIDEO)
WEBCORE_EXPORT_DEPENDENCIES := $(WEBCORE_EXPORT_DEPENDENCIES) WebCore.Video.exp
endif
WebCore.exp : WebCore.base.exp $(WEBCORE_EXPORT_DEPENDENCIES)
cat $^ > $@
......
__ZN7WebCore16HTMLMediaElement4playEv
__ZN7WebCore16HTMLMediaElement5pauseEv
__ZNK7WebCore16HTMLMediaElement6volumeEv
__ZNK7WebCore16HTMLMediaElement7canPlayEv
__ZNK7WebCore16HTMLMediaElement8durationEv
__ZN7WebCore16HTMLMediaElement9setVolumeEfRi
__ZN7WebCore16HTMLMediaElement6rewindEf
__ZN7WebCore16HTMLMediaElement10screenRectEv
__ZNK7WebCore16HTMLMediaElement11currentTimeEv
__ZNK7WebCore16HTMLMediaElement13platformMediaEv
__ZN7WebCore16HTMLMediaElement14setCurrentTimeEfRi
__ZN7WebCore16HTMLMediaElement14exitFullscreenEv
......@@ -719,6 +719,7 @@ __ZN7WebCore9HTMLNames7srcAttrE
__ZN7WebCore9HTMLNames8frameTagE
__ZN7WebCore9HTMLNames8hrefAttrE
__ZN7WebCore9HTMLNames8inputTagE
__ZN7WebCore9HTMLNames8videoTagE
__ZN7WebCore9HTMLNames9iframeTagE
__ZN7WebCore9HTMLNames9scriptTagE
__ZN7WebCore9PageCache11setCapacityEi
......
......@@ -6335,6 +6335,7 @@
63189AE20E83A33300012E41 /* NodeRareData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeRareData.h; sourceTree = "<group>"; };
637B7ADE0E8767B800E32194 /* ElementRareData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementRareData.h; sourceTree = "<group>"; };
63D7B32C0E78CD3F00F7617C /* NodeRenderStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeRenderStyle.h; sourceTree = "<group>"; };
63F371CD100E790000BBA87A /* WebCore.Video.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; path = WebCore.Video.exp; sourceTree = "<group>"; };
650F53DB09D15DDA00C9B0C8 /* CSSGrammar.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSGrammar.h; sourceTree = "<group>"; };
650FBF270D9AF046008FC292 /* SVGHKernElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGHKernElement.cpp; sourceTree = "<group>"; };
650FBF280D9AF047008FC292 /* SVGHKernElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGHKernElement.h; sourceTree = "<group>"; };
......@@ -10510,6 +10511,7 @@
449195970FBE17D700D9F824 /* WebCore.SVG.Filters.exp */,
449195960FBE17D700D9F824 /* WebCore.SVG.ForeignObject.exp */,
449195950FBE17D700D9F824 /* WebCore.Tiger.exp */,
63F371CD100E790000BBA87A /* WebCore.Video.exp */,
449195940FBE17D700D9F824 /* WebCore.VideoProxy.exp */,
);
name = Exports;
......@@ -28,6 +28,7 @@
#if ENABLE(VIDEO)
#include "HTMLMediaElement.h"
#include "ChromeClient.h"
#include "CSSHelper.h"
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
......@@ -55,6 +56,8 @@
#include "RenderVideo.h"
#include "ScriptEventListener.h"
#include "TimeRanges.h"
#include "ClientRect.h"
#include "ClientRectList.h"
#include <limits>
#include <wtf/CurrentTime.h>
#include <wtf/MathExtras.h>
......@@ -111,6 +114,7 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* doc)
, m_sentEndEvent(false)
, m_pausedInternal(false)
, m_sendProgressEvents(true)
, m_isFullscreen(false)
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
, m_needWidgetUpdate(false)
#endif
......@@ -241,6 +245,12 @@ void HTMLMediaElement::insertedIntoDocument()
scheduleLoad();
}
void HTMLMediaElement::willRemove()
{
if (m_isFullscreen)
exitFullscreen();
HTMLElement::willRemove();
}
void HTMLMediaElement::removedFromDocument()
{
if (m_networkState > NETWORK_EMPTY)
......@@ -1696,6 +1706,14 @@ void HTMLMediaElement::mediaVolumeDidChange()
updateVolume();
}
const IntRect HTMLMediaElement::screenRect()
{
IntRect elementRect;
if (renderer())
elementRect = renderer()->view()->frameView()->contentsToScreen(renderer()->absoluteBoundingBoxRect());
return elementRect;
}
void HTMLMediaElement::defaultEventHandler(Event* event)
{
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
......@@ -1768,6 +1786,28 @@ void HTMLMediaElement::finishParsingChildren()
#endif
void HTMLMediaElement::enterFullscreen()
{
ASSERT(!m_isFullscreen);
if (!renderer())
return;
if (document() && document()->page())
document()->page()->chrome()->client()->enterFullscreenForNode(this);
m_isFullscreen = true;
}
void HTMLMediaElement::exitFullscreen()
{
ASSERT(m_isFullscreen);
if (document() && document()->page())
document()->page()->chrome()->client()->exitFullscreenForNode(this);
m_isFullscreen = false;
}
PlatformMedia HTMLMediaElement::platformMedia() const
{
return m_player ? m_player->platformMedia() : NoPlatformMedia;
}
}
#endif
......@@ -43,7 +43,7 @@ class HTMLSourceElement;
class MediaError;
class KURL;
class TimeRanges;
class HTMLMediaElement : public HTMLElement, public MediaPlayerClient {
public:
HTMLMediaElement(const QualifiedName&, Document*);
......@@ -57,6 +57,7 @@ public:
virtual bool rendererIsNeeded(RenderStyle*);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
virtual void insertedIntoDocument();
virtual void willRemove();
virtual void removedFromDocument();
virtual void attach();
virtual void recalcStyle(StyleChange);
......@@ -73,6 +74,8 @@ public:
// Eventually overloaded in HTMLVideoElement
virtual bool supportsFullscreen() const { return false; };
virtual bool supportsSave() const;
PlatformMedia platformMedia() const;
void scheduleLoad();
......@@ -141,6 +144,8 @@ public:
void beginScrubbing();
void endScrubbing();
const IntRect screenRect();
bool canPlay() const;
float percentLoaded() const;
......@@ -154,6 +159,9 @@ public:
#endif
bool hasSingleSecurityOrigin() const { return !m_player || m_player->hasSingleSecurityOrigin(); }
void enterFullscreen();
void exitFullscreen();
protected:
float getTimeOffsetAttribute(const QualifiedName&, float valueOnError) const;
......@@ -310,6 +318,8 @@ protected:
// support progress events so setting m_sendProgressEvents disables them
bool m_sendProgressEvents : 1;
bool m_isFullscreen : 1;
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
bool m_needWidgetUpdate : 1;
#endif
......
......@@ -28,6 +28,7 @@
#if ENABLE(VIDEO)
#include "HTMLVideoElement.h"
#include "ChromeClient.h"
#include "CSSHelper.h"
#include "CSSPropertyNames.h"
#include "Document.h"
......@@ -112,6 +113,18 @@ void HTMLVideoElement::parseMappedAttribute(MappedAttribute* attr)
HTMLMediaElement::parseMappedAttribute(attr);
}
bool HTMLVideoElement::supportsFullscreen() const
{
Page* page = document() ? document()->page() : 0;
if (!page)
return false;
if (!m_player || !m_player->supportsFullscreen())
return false;
return page->chrome()->client()->supportsFullscreenForNode(this);
}
unsigned HTMLVideoElement::videoWidth() const
{
if (!m_player)
......
......@@ -49,7 +49,7 @@ public:
virtual void parseMappedAttribute(MappedAttribute* attr);
virtual bool isVideo() const { return true; }
virtual bool hasVideo() const { return player() && player()->hasVideo(); }
virtual bool supportsFullscreen() const { return player() && player()->supportsFullscreen(); }
virtual bool supportsFullscreen() const;
virtual bool isURLAttribute(Attribute*) const;
virtual const QualifiedName& imageSourceAttributeName() const;
......
......@@ -203,6 +203,10 @@ namespace WebCore {
virtual void scheduleCompositingLayerSync() = 0;
#endif
virtual bool supportsFullscreenForNode(const Node*) { return false; }
virtual void enterFullscreenForNode(Node*) { }
virtual void exitFullscreenForNode(Node*) { }
#if PLATFORM(MAC)
virtual KeyboardUIMode keyboardUIMode() { return KeyboardAccessDefault; }
......
......@@ -65,7 +65,7 @@ public:
virtual void play() { }
virtual void pause() { }
virtual bool supportsFullscreen() const { return false; }
virtual PlatformMedia platformMedia() const { return NoPlatformMedia; }
virtual IntSize naturalSize() const { return IntSize(0, 0); }
......@@ -338,6 +338,11 @@ bool MediaPlayer::inMediaDocument()
return document && document->isMediaDocument();
}
PlatformMedia MediaPlayer::platformMedia() const
{
return m_private->platformMedia();
}
MediaPlayer::NetworkState MediaPlayer::networkState()
{
return m_private->networkState();
......
......@@ -38,8 +38,24 @@
#include <wtf/OwnPtr.h>
#include <wtf/Noncopyable.h>
#ifdef __OBJC__
@class QTMovie;
#else
class QTMovie;
#endif
namespace WebCore {
// Structure that will hold every native
// types supported by the current media player.
// We have to do that has multiple media players
// backend can live at runtime.
typedef struct PlatformMedia {
QTMovie* qtMovie;
} PlatformMedia;
static const PlatformMedia NoPlatformMedia = { 0 };
class ContentType;
class FrameView;
class GraphicsContext;
......@@ -110,6 +126,8 @@ public:
bool supportsFullscreen() const;
bool supportsSave() const;
PlatformMedia platformMedia() const;
IntSize naturalSize();
bool hasVideo() const;
bool hasAudio() const;
......
......@@ -43,6 +43,8 @@ public:
virtual void load(const String& url) = 0;
virtual void cancelLoad() = 0;
virtual PlatformMedia platformMedia() const { return NoPlatformMedia; }
virtual void play() = 0;
virtual void pause() = 0;
......
......@@ -77,9 +77,12 @@ private:
static MediaPlayer::SupportsType supportsType(const String& type, const String& codecs);
static bool isAvailable();
PlatformMedia platformMedia() const;
IntSize naturalSize() const;
bool hasVideo() const;
bool hasAudio() const;
bool supportsFullscreen() const;
void load(const String& url);
void cancelLoad();
......
......@@ -565,6 +565,12 @@ void MediaPlayerPrivate::load(const String& url)
[m_objcObserver.get() setDelayCallbacks:NO];
}
PlatformMedia MediaPlayerPrivate::platformMedia() const
{
PlatformMedia plaftformMedia = { m_qtMovie.get() };
return plaftformMedia;
}
void MediaPlayerPrivate::play()
{
if (!metaDataAvailable())
......@@ -729,6 +735,11 @@ bool MediaPlayerPrivate::hasAudio() const
return [[m_qtMovie.get() attributeForKey:QTMovieHasAudioAttribute] boolValue];
}
bool MediaPlayerPrivate::supportsFullscreen() const
{
return true;
}
void MediaPlayerPrivate::setVolume(float volume)
{
if (m_qtMovie)
......
......@@ -646,12 +646,12 @@ MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(Documen
void MediaControlFullscreenButtonElement::defaultEventHandler(Event* event)
{
if (event->type() == eventNames().clickEvent) {
m_mediaElement->enterFullscreen();
event->setDefaultHandled();
}
HTMLInputElement::defaultEventHandler(event);
}
// ----------------------------
MediaControlTimeDisplayElement::MediaControlTimeDisplayElement(Document* document, PseudoId pseudo, HTMLMediaElement* element)
......
......@@ -132,6 +132,8 @@ protected:
// Media controls
virtual String extraMediaControlsStyleSheet();
virtual bool shouldRenderMediaControlPart(ControlPart, Element*);
#endif
private:
......
......@@ -1697,7 +1697,16 @@ String RenderThemeMac::extraMediaControlsStyleSheet()
else
return String();
}
#endif
bool RenderThemeMac::shouldRenderMediaControlPart(ControlPart part, Element* e)
{
if (part == MediaFullscreenButtonPart)
return mediaControllerTheme() == MediaControllerThemeQT;
return RenderTheme::shouldRenderMediaControlPart(part, e);
}
#endif // ENABLE(VIDEO)
NSPopUpButtonCell* RenderThemeMac::popupButton() const
{
......
2009-10-05 Pierre d'Herbemont <pdherbemont@webkit.org>
Reviewed by Simon Fraser
Support fullscreen in MediaPlayer (Mac)
https://bugs.webkit.org/show_bug.cgi?id=26742
Add new files for video fullscreen.
* WebKit.xcodeproj/project.pbxproj:
2009-10-05 Pavel Feldman <pfeldman@chromium.org>
Reviewed by Timothy Hatcher.
......
......@@ -15,6 +15,12 @@
0AB752380FA2E4DB00D7CBB1 /* WebNetscapeContainerCheckContextInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0AB752360FA2E4DB00D7CBB1 /* WebNetscapeContainerCheckContextInfo.mm */; };
0AEBFF630F9FA8BE000D486B /* WebNetscapeContainerCheckPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 0AEBFF610F9FA8BE000D486B /* WebNetscapeContainerCheckPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
0AEBFF640F9FA8BE000D486B /* WebNetscapeContainerCheckPrivate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0AEBFF620F9FA8BE000D486B /* WebNetscapeContainerCheckPrivate.mm */; };
0FD3B0F21076C3E900039B96 /* WebVideoFullscreenController.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD3B0EE1076C3E900039B96 /* WebVideoFullscreenController.h */; };
0FD3B0F31076C3E900039B96 /* WebVideoFullscreenController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FD3B0EF1076C3E900039B96 /* WebVideoFullscreenController.mm */; };
0FD3B0F41076C3E900039B96 /* WebVideoFullscreenHUDWindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD3B0F01076C3E900039B96 /* WebVideoFullscreenHUDWindowController.h */; };
0FD3B0F51076C3E900039B96 /* WebVideoFullscreenHUDWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FD3B0F11076C3E900039B96 /* WebVideoFullscreenHUDWindowController.mm */; };
0FD3B0F81076C3F700039B96 /* WebWindowAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD3B0F61076C3F700039B96 /* WebWindowAnimation.h */; };
0FD3B0F91076C3F700039B96 /* WebWindowAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FD3B0F71076C3F700039B96 /* WebWindowAnimation.m */; };
14D8252F0AF955090004F057 /* WebChromeClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D8252D0AF955090004F057 /* WebChromeClient.h */; };
14D825300AF955090004F057 /* WebChromeClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 14D8252E0AF955090004F057 /* WebChromeClient.mm */; };
1A20D08B0ED384F20043FA9F /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A20D08A0ED384F20043FA9F /* QuartzCore.framework */; };
......@@ -349,6 +355,12 @@
0AB752360FA2E4DB00D7CBB1 /* WebNetscapeContainerCheckContextInfo.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebNetscapeContainerCheckContextInfo.mm; sourceTree = "<group>"; };
0AEBFF610F9FA8BE000D486B /* WebNetscapeContainerCheckPrivate.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = WebNetscapeContainerCheckPrivate.h; sourceTree = "<group>"; };
0AEBFF620F9FA8BE000D486B /* WebNetscapeContainerCheckPrivate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebNetscapeContainerCheckPrivate.mm; sourceTree = "<group>"; };
0FD3B0EE1076C3E900039B96 /* WebVideoFullscreenController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebVideoFullscreenController.h; sourceTree = "<group>"; };
0FD3B0EF1076C3E900039B96 /* WebVideoFullscreenController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebVideoFullscreenController.mm; sourceTree = "<group>"; };
0FD3B0F01076C3E900039B96 /* WebVideoFullscreenHUDWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebVideoFullscreenHUDWindowController.h; sourceTree = "<group>"; };
0FD3B0F11076C3E900039B96 /* WebVideoFullscreenHUDWindowController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebVideoFullscreenHUDWindowController.mm; sourceTree = "<group>"; };
0FD3B0F61076C3F700039B96 /* WebWindowAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebWindowAnimation.h; sourceTree = "<group>"; };
0FD3B0F71076C3F700039B96 /* WebWindowAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WebWindowAnimation.m; sourceTree = "<group>"; };
14D8252D0AF955090004F057 /* WebChromeClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebChromeClient.h; sourceTree = "<group>"; };
14D8252E0AF955090004F057 /* WebChromeClient.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebChromeClient.mm; sourceTree = "<group>"; };
1A20D08A0ED384F20043FA9F /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = /System/Library/Frameworks/QuartzCore.framework; sourceTree = "<absolute>"; };
......@@ -1118,12 +1130,18 @@
F834AAD60E64B1C700E2737C /* WebTextIterator.mm */,
515E27CC0458C86500CA2D3A /* WebUIDelegate.h */,
65A7D44A0568AB2600E70EF6 /* WebUIDelegatePrivate.h */,
0FD3B0EE1076C3E900039B96 /* WebVideoFullscreenController.h */,
0FD3B0EF1076C3E900039B96 /* WebVideoFullscreenController.mm */,
0FD3B0F01076C3E900039B96 /* WebVideoFullscreenHUDWindowController.h */,
0FD3B0F11076C3E900039B96 /* WebVideoFullscreenHUDWindowController.mm */,
51A8B579042834F700CA2D3A /* WebView.h */,
51A8B57A042834F700CA2D3A /* WebView.mm */,
BC2E464B0FD8A96800A9D9DE /* WebViewData.h */,
BC2E464C0FD8A96800A9D9DE /* WebViewData.mm */,
930D02BB06275F640076701E /* WebViewInternal.h */,
51A8B57D0428353A00CA2D3A /* WebViewPrivate.h */,
0FD3B0F61076C3F700039B96 /* WebWindowAnimation.h */,
0FD3B0F71076C3F700039B96 /* WebWindowAnimation.m */,
);
name = WebView;
path = mac/WebView;
......@@ -1482,6 +1500,9 @@
37D1DCA81065928C0068F7EF /* WebJSPDFDoc.h in Headers */,
5158F6EF106D862A00AF457C /* WebHistoryDelegate.h in Headers */,
5185F62610712B80007AA393 /* WebNavigationData.h in Headers */,
0FD3B0F21076C3E900039B96 /* WebVideoFullscreenController.h in Headers */,
0FD3B0F41076C3E900039B96 /* WebVideoFullscreenHUDWindowController.h in Headers */,
0FD3B0F81076C3F700039B96 /* WebWindowAnimation.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -1817,6 +1838,9 @@
37B6FB4F1063530C000FDB3B /* WebPDFDocumentExtras.mm in Sources */,
37D1DCA91065928C0068F7EF /* WebJSPDFDoc.mm in Sources */,
5185F62810712B97007AA393 /* WebNavigationData.mm in Sources */,
0FD3B0F31076C3E900039B96 /* WebVideoFullscreenController.mm in Sources */,
0FD3B0F51076C3E900039B96 /* WebVideoFullscreenHUDWindowController.mm in Sources */,
0FD3B0F91076C3F700039B96 /* WebWindowAnimation.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
2009-10-05 Pierre d'Herbemont <pdherbemont@webkit.org>
Reviewed by Simon Fraser
Support fullscreen in MediaPlayer (Mac)
https://bugs.webkit.org/show_bug.cgi?id=26742
Add a fullscreen button to the <video> controller if the media engine,
and the theme have support for fullscreen, and can show appropriate controls.
Clicking the button calls through the ChromeClient to the WebVideoFullscreenController
in WebKit to do a nice animation to fullscreen, with a custom controller.
* WebCoreSupport/WebChromeClient.h:
* WebCoreSupport/WebChromeClient.mm:
(WebChromeClient::supportsFullscreenForNode):
(WebChromeClient::enterFullscreenForNode):
(WebChromeClient::exitFullscreenForNode):
New methods to ask whether fullscreen is possible for a given node, and
notifications on enterying and exiting fullscreen.
* WebView/WebVideoFullscreenController.h: Added.
* WebView/WebVideoFullscreenController.mm: Added.
WebVideoFullscreenController is responsible for creating the fullscreen window,
and coordinating the various animations when going fullscreen.
* WebView/WebVideoFullscreenHUDWindowController.h: Added.
* WebView/WebVideoFullscreenHUDWindowController.mm: Added.
This class manages the heads-up display (HUD) control bar.
* WebView/WebView.mm:
(-[WebView _close]):
Make sure we come out of fullscreen if the WebView is torn down (e.g. if
you close a background window).
(-[WebView _enterFullscreenForNode:WebCore::]):
Make a WebVideoFullscreenController and tell is to start to go fullscreen.
(-[WebView _exitFullscreen]):
Tell the WebVideoFullscreenController to come out of fullscreen, and clean up.
* WebView/WebViewData.h:
* WebView/WebViewData.mm:
(-[WebViewPrivate dealloc]):
(-[WebViewPrivate finalize]):
* WebView/WebViewInternal.h:
Keep a pointer to the WebVideoFullscreenController.
* WebView/WebWindowAnimation.h: Added.
* WebView/WebWindowAnimation.m: Added.
(WebWindowAnimationDurationFromDuration):
(scaledRect):
(squaredDistance):
Handle the animations used during the transitition to fullscreen.
2009-10-05 Anders Carlsson <andersca@apple.com>
Reviewed by Kevin Decker.
......
......@@ -150,6 +150,10 @@ public:
virtual void scheduleCompositingLayerSync();
#endif
virtual bool supportsFullscreenForNode(const WebCore::Node*);
virtual void enterFullscreenForNode(WebCore::Node*);
virtual void exitFullscreenForNode(WebCore::Node*);
virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*);
private:
......
......@@ -55,6 +55,7 @@
#import <WebCore/FrameLoadRequest.h>
#import <WebCore/Geolocation.h>
#import <WebCore/HitTestResult.h>
#import <WebCore/HTMLNames.h>
#import <WebCore/IntRect.h>
#import <WebCore/Page.h>
#import <WebCore/PlatformScreen.h>
......@@ -715,6 +716,29 @@ void WebChromeClient::scheduleCompositingLayerSync()
#endif
#if ENABLE(VIDEO)
bool WebChromeClient::supportsFullscreenForNode(const Node* node)
{
return node->hasTagName(WebCore::HTMLNames::videoTag);
}
void WebChromeClient::enterFullscreenForNode(Node* node)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
[m_webView _enterFullscreenForNode:node];
END_BLOCK_OBJC_EXCEPTIONS;
}
void WebChromeClient::exitFullscreenForNode(Node*)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
[m_webView _exitFullscreen];
END_BLOCK_OBJC_EXCEPTIONS;
}
#endif
void WebChromeClient::requestGeolocationPermissionForFrame(Frame* frame, Geolocation* geolocation)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
......
/*
* Copyright (C) 2009 Apple Inc. All rights reserved.
*
* 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,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* 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.
*/
#if ENABLE(VIDEO)
#import <Cocoa/Cocoa.h>
#import <wtf/RefPtr.h>
#import <WebCore/HTMLMediaElement.h>
@protocol WebVideoFullscreenControllerDelegate;
@class WebVideoFullscreenHUDWindowController;
@class WebWindowFadeAnimation;
@interface WebVideoFullscreenController : NSWindowControlle