Modified: trunk/Source/WebCore/ChangeLog (166267 => 166268)
--- trunk/Source/WebCore/ChangeLog 2014-03-25 23:37:01 UTC (rev 166267)
+++ trunk/Source/WebCore/ChangeLog 2014-03-25 23:43:13 UTC (rev 166268)
@@ -1,3 +1,23 @@
+2014-03-21 Jer Noble <jer.no...@apple.com>
+
+ [iOS] Enable caption support in full screen.
+ https://bugs.webkit.org/show_bug.cgi?id=130603
+
+ Reviewed by Eric Carlson.
+
+ Add TextTrackRepresentation support to MediaPlayerPrivateAVFoundationObjC.
+
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoLayer): Add the m_textTrackRepresenationLayer if present.
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer): Ditto.
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::requiresTextTrackRepresentation): True, if a m_videoFullscreenLayer is present.
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::setTextTrackRepresentation): Remove the old, and add the new m_textTrackRepresenationLayer.
+
+ Make the text track container a stacking context for painting purposes.
+ * Modules/mediacontrols/mediaControlsiOS.css:
+ (video::-webkit-media-text-track-container):
+
2014-03-25 Brian Burg <bb...@apple.com>
Web Replay: resource unique identifiers should be unique-per-frame, not globally
Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.css (166267 => 166268)
--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.css 2014-03-25 23:37:01 UTC (rev 166267)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.css 2014-03-25 23:43:13 UTC (rev 166268)
@@ -295,6 +295,7 @@
width: 100%;
overflow: hidden;
padding-bottom: 5px;
+ z-index: 0;
text-align: center;
color: rgba(255, 255, 255, 1);
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h (166267 => 166268)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h 2014-03-25 23:37:01 UTC (rev 166267)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h 2014-03-25 23:43:13 UTC (rev 166268)
@@ -190,7 +190,12 @@
virtual void updateVideoLayerGravity() override;
virtual bool hasSingleSecurityOrigin() const;
-
+
+#if ENABLE(VIDEO_TRACK)
+ virtual bool requiresTextTrackRepresentation() const override;
+ virtual void setTextTrackRepresentation(TextTrackRepresentation*) override;
+#endif
+
void createImageGenerator();
void destroyImageGenerator();
RetainPtr<CGImageRef> createImageForTimeInRect(float, const IntRect&);
@@ -254,6 +259,7 @@
RetainPtr<PlatformLayer> m_videoFullscreenLayer;
FloatRect m_videoFullscreenFrame;
MediaPlayer::VideoGravity m_videoFullscreenGravity;
+ RetainPtr<PlatformLayer> m_textTrackRepresentationLayer;
#endif
RetainPtr<WebCoreAVFMovieObserver> m_objcObserver;
RetainPtr<id> m_timeObserver;
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (166267 => 166268)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2014-03-25 23:37:01 UTC (rev 166267)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2014-03-25 23:43:13 UTC (rev 166268)
@@ -48,6 +48,7 @@
#import "PlatformTimeRanges.h"
#import "SecurityOrigin.h"
#import "SoftLinking.h"
+#import "TextTrackRepresentation.h"
#import "UUID.h"
#import "VideoTrackPrivateAVFObjC.h"
#import "WebCoreAVFResourceLoader.h"
@@ -511,7 +512,7 @@
#if PLATFORM(IOS)
if (m_videoFullscreenLayer) {
[m_videoLayer setFrame:CGRectMake(0, 0, m_videoFullscreenFrame.width(), m_videoFullscreenFrame.height())];
- [m_videoFullscreenLayer addSublayer:m_videoLayer.get()];
+ [m_videoFullscreenLayer insertSublayer:m_videoLayer.get() atIndex:0];
}
#endif
player()->mediaPlayerClient()->mediaPlayerRenderingModeChanged(player());
@@ -799,20 +800,33 @@
m_videoFullscreenLayer = videoFullscreenLayer;
- if (!m_videoFullscreenLayer || !m_videoLayer)
- return;
+ CGRect frame = CGRectMake(0, 0, m_videoFullscreenFrame.width(), m_videoFullscreenFrame.height());
- [m_videoLayer setFrame:CGRectMake(0, 0, m_videoFullscreenFrame.width(), m_videoFullscreenFrame.height())];
- [m_videoFullscreenLayer addSublayer:m_videoLayer.get()];
+ if (m_videoFullscreenLayer && m_videoLayer) {
+ [m_videoLayer setFrame:frame];
+ [m_videoFullscreenLayer insertSublayer:m_videoLayer.get() atIndex:0];
+ }
+
+ if (m_videoFullscreenLayer && m_textTrackRepresentationLayer) {
+ CGRect textFrame = m_videoLayer ? [m_videoLayer videoRect] : frame;
+ [m_textTrackRepresentationLayer setFrame:textFrame];
+ [m_videoFullscreenLayer addSublayer:m_textTrackRepresentationLayer.get()];
+ }
}
void MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenFrame(FloatRect frame)
{
m_videoFullscreenFrame = frame;
- if (!m_videoFullscreenLayer || !m_videoLayer)
+ if (!m_videoFullscreenLayer)
return;
-
- [m_videoLayer setFrame:CGRectMake(0, 0, frame.width(), frame.height())];
+
+ if (m_videoLayer)
+ [m_videoLayer setFrame:CGRectMake(0, 0, frame.width(), frame.height())];
+
+ if (m_textTrackRepresentationLayer) {
+ CGRect textFrame = m_videoLayer ? [m_videoLayer videoRect] : static_cast<CGRect>(frame);
+ [m_textTrackRepresentationLayer setFrame:textFrame];
+ }
}
void MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenGravity(MediaPlayer::VideoGravity gravity)
@@ -1466,6 +1480,39 @@
{
determineChangedTracksFromNewTracksAndOldItems(m_cachedTracks.get(), AVMediaTypeVideo, m_videoTracks, &VideoTrackPrivateAVFObjC::create, player(), &MediaPlayer::removeVideoTrack, &MediaPlayer::addVideoTrack);
}
+
+bool MediaPlayerPrivateAVFoundationObjC::requiresTextTrackRepresentation() const
+{
+#if PLATFORM(IOS)
+ if (m_videoFullscreenLayer)
+ return true;
+#endif
+ return false;
+}
+
+void MediaPlayerPrivateAVFoundationObjC::setTextTrackRepresentation(TextTrackRepresentation* representation)
+{
+#if PLATFORM(IOS)
+ PlatformLayer* representationLayer = representation ? representation->platformLayer() : nil;
+ if (representationLayer == m_textTrackRepresentationLayer)
+ return;
+
+ if (m_textTrackRepresentationLayer)
+ [m_textTrackRepresentationLayer removeFromSuperlayer];
+
+ m_textTrackRepresentationLayer = representationLayer;
+
+ if (m_videoFullscreenLayer && m_textTrackRepresentationLayer) {
+ CGRect textFrame = m_videoLayer ? [m_videoLayer videoRect] : CGRectMake(0, 0, m_videoFullscreenFrame.width(), m_videoFullscreenFrame.height());
+
+ [m_textTrackRepresentationLayer setFrame:textFrame];
+ [m_videoFullscreenLayer addSublayer:m_textTrackRepresentationLayer.get()];
+ }
+
+#else
+ UNUSED_PARAM(representation);
+#endif
+}
#endif // ENABLE(VIDEO_TRACK)
void MediaPlayerPrivateAVFoundationObjC::sizeChanged()