Diff
Modified: trunk/Source/WebCore/ChangeLog (137781 => 137782)
--- trunk/Source/WebCore/ChangeLog 2012-12-14 23:18:25 UTC (rev 137781)
+++ trunk/Source/WebCore/ChangeLog 2012-12-14 23:23:25 UTC (rev 137782)
@@ -1,3 +1,65 @@
+2012-12-14 Jer Noble <[email protected]>
+
+ Allow the text track contents to be displayed externally to WebCore.
+ https://bugs.webkit.org/show_bug.cgi?id=105052
+
+ Reviewed by Eric Carlson.
+
+ Support scenarios where the text track contents must be rendered outside of WebCore, such as to an external
+ display or window. Add an abstract base class which encapsulates the external representation to which the
+ text tracks will be rendered.
+
+ Add a new abstract base class and client to wrap the external rendering of a TextTrack.
+ * platform/graphics/TextTrackRepresentation.h: Added.
+ (WebCore::TextTrackRepresentationClient::~TextTrackRepresentationClient):
+ (WebCore::TextTrackRepresentation::~TextTrackRepresentation):
+
+ Add an empty concrete implementation for those ports who do not yet support external display of subtitles.
+ * platform/graphics/TextTrackRepresentation.cpp: Added.
+ (NullTextTrackRepresentation):
+ (WebCore::NullTextTrackRepresentation::~NullTextTrackRepresentation):
+ (WebCore::NullTextTrackRepresentation::update):
+ (WebCore::NullTextTrackRepresentation::platformLayer):
+ (WebCore::NullTextTrackRepresentation::setContentScale):
+ (WebCore::NullTextTrackRepresentation::bounds):
+ (WebCore::TextTrackRepresentation::create):
+
+ Add methods to MediaPlayerPrivateIOS to handle the TextTrackRepresentation.
+ * platform/graphics/ios/MediaPlayerPrivateIOS.h:
+ * platform/graphics/ios/MediaPlayerPrivateIOS.mm:
+ (WebCore::MediaPlayerPrivateIOS::deliverNotification): Remove the representation when exiting full screen.
+ (WebCore::MediaPlayerPrivateIOS::requiresTextTrackRepresentation): Return YES if in full screen mode.
+ (WebCore::MediaPlayerPrivateIOS::setTextTrackRepresentation): Pass the representation's layer to the player plug-in.
+
+ Expose those methods via HTMLMediaElement:
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::requiresTextTrackRepresentation):
+ (WebCore::HTMLMediaElement::setTextTrackRepresentation):
+ * html/HTMLMediaElement.h:
+ * platform/graphics/MediaPlayer.cpp:
+ (WebCore::MediaPlayer::requiresTextTrackRepresentation):
+ (WebCore::MediaPlayer::setTextTrackRepresentation):
+ * platform/graphics/MediaPlayer.h:
+ (WebCore::MediaPlayerClient::textTrackRepresentationBoundsChanged):
+ (WebCore::MediaPlayerClient::paintTextTrackRepresentation):
+ * platform/graphics/MediaPlayerPrivate.h:
+ (WebCore::MediaPlayerPrivateInterface::requiresTextTrackRepresentation):
+ (WebCore::MediaPlayerPrivateInterface::setTextTrackRepresentation):
+
+ * html/shadow/MediaControlElements.cpp:
+ (WebCore::MediaControlTextTrackContainerElement::updateDisplay): Create the representation, if necessary.
+ (WebCore::MediaControlTextTrackContainerElement::updateSizes): Use the representation to determine the font size.
+ (WebCore::MediaControlTextTrackContainerElement::paintTextTrackRepresentation): Added. Paint the TextTrack into the provided graphics context.
+ (WebCore::MediaControlTextTrackContainerElement::textTrackRepresentationBoundsChanged): Added. Call updateSizes().
+ * html/shadow/MediaControlElements.h:
+
+ Add the new files to the project.
+ * WebCore.xcodeproj/project.pbxproj:
+ * GNUmakefile.list.am:
+ * Target.pri:
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+
2012-12-14 Fady Samuel <[email protected]>
Allow embedder to observe changes to frame names
Modified: trunk/Source/WebCore/GNUmakefile.list.am (137781 => 137782)
--- trunk/Source/WebCore/GNUmakefile.list.am 2012-12-14 23:18:25 UTC (rev 137781)
+++ trunk/Source/WebCore/GNUmakefile.list.am 2012-12-14 23:23:25 UTC (rev 137782)
@@ -5583,6 +5583,8 @@
Source/WebCore/platform/graphics/TextRenderingMode.h \
Source/WebCore/platform/graphics/TextRun.cpp \
Source/WebCore/platform/graphics/TextRun.h \
+ Source/WebCore/platform/graphics/TextTrackRepresentation.cpp \
+ Source/WebCore/platform/graphics/TextTrackRepresentation.h \
Source/WebCore/platform/graphics/TiledBacking.h \
Source/WebCore/platform/graphics/transforms/AffineTransform.cpp \
Source/WebCore/platform/graphics/transforms/AffineTransform.h \
Modified: trunk/Source/WebCore/Target.pri (137781 => 137782)
--- trunk/Source/WebCore/Target.pri 2012-12-14 23:18:25 UTC (rev 137781)
+++ trunk/Source/WebCore/Target.pri 2012-12-14 23:23:25 UTC (rev 137782)
@@ -1007,6 +1007,7 @@
platform/graphics/surfaces/qt/GraphicsSurfaceQt.cpp \
platform/graphics/SurrogatePairAwareTextIterator.cpp \
platform/graphics/TextRun.cpp \
+ platform/graphics/TextTrackRepresentation.cpp \
platform/graphics/TiledBackingStore.cpp \
platform/graphics/transforms/AffineTransform.cpp \
platform/graphics/transforms/TransformationMatrix.cpp \
Modified: trunk/Source/WebCore/WebCore.gypi (137781 => 137782)
--- trunk/Source/WebCore/WebCore.gypi 2012-12-14 23:18:25 UTC (rev 137781)
+++ trunk/Source/WebCore/WebCore.gypi 2012-12-14 23:23:25 UTC (rev 137782)
@@ -3748,6 +3748,8 @@
'platform/graphics/SurrogatePairAwareTextIterator.cpp',
'platform/graphics/SurrogatePairAwareTextIterator.h',
'platform/graphics/TextRun.cpp',
+ 'platform/graphics/TextTrackRepresentation.cpp',
+ 'platform/graphics/TextTrackRepresentation.h',
'platform/graphics/Tile.h',
'platform/graphics/TiledBackingStore.cpp',
'platform/graphics/TiledBackingStore.h',
Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (137781 => 137782)
--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-12-14 23:18:25 UTC (rev 137781)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-12-14 23:23:25 UTC (rev 137782)
@@ -29885,6 +29885,14 @@
>
</File>
<File
+ RelativePath="..\platform\graphics\TextTrackRepresentation.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\graphics\TextTrackRepresentation.h"
+ >
+ </File>
+ <File
RelativePath="..\platform\graphics\UnitBezier.h"
>
</File>
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (137781 => 137782)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-12-14 23:18:25 UTC (rev 137781)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-12-14 23:23:25 UTC (rev 137782)
@@ -5918,6 +5918,7 @@
CCC2B51615F613060048CDD6 /* DeviceController.h in Headers */ = {isa = PBXBuildFile; fileRef = CCC2B51215F613060048CDD6 /* DeviceController.h */; settings = {ATTRIBUTES = (Private, ); }; };
CD127DED14F3097D00E84779 /* WebCoreFullScreenWindow.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD127DEB14F3097900E84779 /* WebCoreFullScreenWindow.mm */; };
CD127DEE14F3098400E84779 /* WebCoreFullScreenWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = CD127DEA14F3097900E84779 /* WebCoreFullScreenWindow.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ CD1E7347167BC78E009A885D /* TextTrackRepresentation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD1E7346167BC78E009A885D /* TextTrackRepresentation.cpp */; };
CD27F6E51457685A0078207D /* JSMediaController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD27F6E2145767580078207D /* JSMediaController.cpp */; };
CD27F6E7145770D30078207D /* MediaController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD27F6E6145770D30078207D /* MediaController.cpp */; };
CD37B39815C1B971006DC898 /* DiagnosticLoggingKeys.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD37B37415C1A7E1006DC898 /* DiagnosticLoggingKeys.cpp */; };
@@ -13360,6 +13361,7 @@
CCC2B51215F613060048CDD6 /* DeviceController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceController.h; sourceTree = "<group>"; };
CD127DEA14F3097900E84779 /* WebCoreFullScreenWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreFullScreenWindow.h; sourceTree = "<group>"; };
CD127DEB14F3097900E84779 /* WebCoreFullScreenWindow.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreFullScreenWindow.mm; sourceTree = "<group>"; };
+ CD1E7346167BC78E009A885D /* TextTrackRepresentation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextTrackRepresentation.cpp; sourceTree = "<group>"; };
CD27F6E014575C1B0078207D /* MediaController.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = MediaController.idl; sourceTree = "<group>"; };
CD27F6E2145767580078207D /* JSMediaController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaController.cpp; sourceTree = "<group>"; };
CD27F6E3145767580078207D /* JSMediaController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaController.h; sourceTree = "<group>"; };
@@ -13394,6 +13396,7 @@
CDC69DD816371FD3007C38DF /* WebCoreFullScreenPlaceholderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreFullScreenPlaceholderView.h; sourceTree = "<group>"; };
CDC69DD916371FD3007C38DF /* WebCoreFullScreenPlaceholderView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreFullScreenPlaceholderView.mm; sourceTree = "<group>"; };
CDCE5CD014633BC900D47CCA /* EventTargetFactory.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EventTargetFactory.in; sourceTree = "<group>"; };
+ CDD1E525167BA56400CE820B /* TextTrackRepresentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextTrackRepresentation.h; sourceTree = "<group>"; };
CDEA762C14608224008B31F1 /* Clock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Clock.h; sourceTree = "<group>"; };
CDEA762E146084DE008B31F1 /* PlatformClockCA.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformClockCA.cpp; sourceTree = "<group>"; };
CDEA762F146084EE008B31F1 /* PlatformClockCA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformClockCA.h; sourceTree = "<group>"; };
@@ -20252,6 +20255,8 @@
087E0AF413606D0B00FA4BA8 /* SVGGlyph.cpp */,
087E0AF513606D0B00FA4BA8 /* SVGGlyph.h */,
930FC6891072B9280045293E /* TextRenderingMode.h */,
+ CDD1E525167BA56400CE820B /* TextTrackRepresentation.h */,
+ CD1E7346167BC78E009A885D /* TextTrackRepresentation.cpp */,
376DCCE013B4F966002EBEFC /* TextRun.cpp */,
A824B4640E2EF2EA0081A7B7 /* TextRun.h */,
1AF89A411518FDEA00E547B5 /* TiledBacking.h */,
@@ -29061,6 +29066,7 @@
FE456F181677D74E005EDDF9 /* DatabaseManager.cpp in Sources */,
FEDEF84116797108000E444A /* DatabaseStrategy.cpp in Sources */,
F37A56221679CF7B00C57046 /* HeapGraphSerializer.cpp in Sources */,
+ CD1E7347167BC78E009A885D /* TextTrackRepresentation.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (137781 => 137782)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2012-12-14 23:18:25 UTC (rev 137781)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2012-12-14 23:23:25 UTC (rev 137782)
@@ -3897,6 +3897,19 @@
#endif
}
+#if ENABLE(VIDEO_TRACK)
+bool HTMLMediaElement::requiresTextTrackRepresentation() const
+{
+ return m_player ? m_player->requiresTextTrackRepresentation() : 0;
+}
+
+void HTMLMediaElement::setTextTrackRepresentation(TextTrackRepresentation* representation)
+{
+ if (m_player)
+ m_player->setTextTrackRepresentation(representation);
+}
+#endif // ENABLE(VIDEO_TRACK)
+
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
void HTMLMediaElement::ensureMediaPlayer()
Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (137781 => 137782)
--- trunk/Source/WebCore/html/HTMLMediaElement.h 2012-12-14 23:18:25 UTC (rev 137781)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h 2012-12-14 23:23:25 UTC (rev 137782)
@@ -264,6 +264,9 @@
virtual void textTrackRemoveCues(TextTrack*, const TextTrackCueList*);
virtual void textTrackAddCue(TextTrack*, PassRefPtr<TextTrackCue>);
virtual void textTrackRemoveCue(TextTrack*, PassRefPtr<TextTrackCue>);
+
+ bool requiresTextTrackRepresentation() const;
+ void setTextTrackRepresentation(TextTrackRepresentation*);
#endif
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
Modified: trunk/Source/WebCore/html/shadow/MediaControlElements.cpp (137781 => 137782)
--- trunk/Source/WebCore/html/shadow/MediaControlElements.cpp 2012-12-14 23:18:25 UTC (rev 137781)
+++ trunk/Source/WebCore/html/shadow/MediaControlElements.cpp 2012-12-14 23:23:25 UTC (rev 137782)
@@ -37,6 +37,7 @@
#include "EventTarget.h"
#include "FloatConversion.h"
#include "Frame.h"
+#include "GraphicsContext.h"
#include "HTMLVideoElement.h"
#include "Language.h"
#include "LocalizedStrings.h"
@@ -44,10 +45,12 @@
#include "MouseEvent.h"
#include "Page.h"
#include "PageGroup.h"
+#include "RenderLayer.h"
#include "RenderMediaControlElements.h"
#include "RenderSlider.h"
#include "RenderTheme.h"
#include "RenderVideo.h"
+#include "RenderView.h"
#include "Settings.h"
#if ENABLE(VIDEO_TRACK)
#include "TextTrack.h"
@@ -1282,27 +1285,100 @@
}
// 11. Return output.
- hasChildNodes() ? show() : hide();
+ if (hasChildNodes()) {
+ show();
+ if (mediaElement->requiresTextTrackRepresentation()) {
+ if (!m_textTrackRepresentation)
+ m_textTrackRepresentation = TextTrackRepresentation::create(this);
+ mediaElement->setTextTrackRepresentation(m_textTrackRepresentation.get());
+
+ if (Page* page = document()->page())
+ m_textTrackRepresentation->setContentScale(page->deviceScaleFactor());
+
+ m_textTrackRepresentation->update();
+ setInlineStyleProperty(CSSPropertyWidth, String::number(m_videoDisplaySize.size().width()) + "px");
+ setInlineStyleProperty(CSSPropertyHeight, String::number(m_videoDisplaySize.size().height()) + "px");
+ }
+ } else {
+ hide();
+ m_textTrackRepresentation = nullptr;
+ mediaElement->setTextTrackRepresentation(0);
+ removeInlineStyleProperty(CSSPropertyWidth);
+ removeInlineStyleProperty(CSSPropertyHeight);
+ }
}
void MediaControlTextTrackContainerElement::updateSizes()
{
HTMLMediaElement* mediaElement = toParentMediaElement(this);
- if (!mediaElement || !mediaElement->renderer() || !mediaElement->renderer()->isVideo())
+ if (!mediaElement)
return;
if (!document()->page())
return;
- IntRect videoBox = toRenderVideo(mediaElement->renderer())->videoBox();
+ IntRect videoBox;
- float fontSize = videoBox.size().height() * (document()->page()->group().captionFontSizeScale());
+ if (m_textTrackRepresentation)
+ videoBox = m_textTrackRepresentation->bounds();
+ else {
+ if (!mediaElement->renderer() || !mediaElement->renderer()->isVideo())
+ return;
+ videoBox = toRenderVideo(mediaElement->renderer())->videoBox();
+ }
+
+ if (m_videoDisplaySize == videoBox)
+ return;
+ m_videoDisplaySize = videoBox;
+
+ if (m_textTrackRepresentation) {
+ setInlineStyleProperty(CSSPropertyWidth, String::number(m_videoDisplaySize.size().width()) + "px");
+ setInlineStyleProperty(CSSPropertyHeight, String::number(m_videoDisplaySize.size().height()) + "px");
+ }
+
+ float smallestDimension = std::min(m_videoDisplaySize.size().height(), m_videoDisplaySize.size().width());
+
+ float fontSize = smallestDimension * (document()->page()->group().captionFontSizeScale());
if (fontSize != m_fontSize) {
m_fontSize = fontSize;
setInlineStyleProperty(CSSPropertyFontSize, String::number(fontSize) + "px");
}
}
+void MediaControlTextTrackContainerElement::paintTextTrackRepresentation(GraphicsContext* context, const IntRect& contextRect)
+{
+ if (!hasChildNodes())
+ return;
+
+ RenderObject* renderer = this->renderer();
+ if (!renderer)
+ return;
+
+ Frame* frame = document()->frame();
+ if (!frame)
+ return;
+
+ document()->updateLayout();
+
+ LayoutRect topLevelRect;
+ IntRect paintingRect = pixelSnappedIntRect(renderer->paintingRootRect(topLevelRect));
+
+ // Translate the renderer painting rect into graphics context coordinates.
+ FloatSize translation(-paintingRect.x(), -paintingRect.y());
+
+ // But anchor to the bottom of the graphics context rect.
+ translation.expand(max(0, contextRect.width() - paintingRect.width()), max(0, contextRect.height() - paintingRect.height()));
+
+ context->translate(translation);
+
+ RenderLayer* layer = frame->contentRenderer()->layer();
+ layer->paint(context, paintingRect, PaintBehaviorFlattenCompositingLayers, renderer, 0, RenderLayer::PaintLayerPaintingCompositingAllPhases);
+}
+
+void MediaControlTextTrackContainerElement::textTrackRepresentationBoundsChanged(const IntRect&)
+{
+ updateSizes();
+}
#endif // ENABLE(VIDEO_TRACK)
// ----------------------------
Modified: trunk/Source/WebCore/html/shadow/MediaControlElements.h (137781 => 137782)
--- trunk/Source/WebCore/html/shadow/MediaControlElements.h 2012-12-14 23:18:25 UTC (rev 137781)
+++ trunk/Source/WebCore/html/shadow/MediaControlElements.h 2012-12-14 23:23:25 UTC (rev 137782)
@@ -32,6 +32,7 @@
#if ENABLE(VIDEO)
#include "MediaControlElementTypes.h"
+#include "TextTrackRepresentation.h"
namespace WebCore {
@@ -432,7 +433,7 @@
#if ENABLE(VIDEO_TRACK)
-class MediaControlTextTrackContainerElement : public MediaControlDivElement {
+class MediaControlTextTrackContainerElement : public MediaControlDivElement, public TextTrackRepresentationClient {
public:
static PassRefPtr<MediaControlTextTrackContainerElement> create(Document*);
@@ -446,6 +447,10 @@
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+ virtual void paintTextTrackRepresentation(GraphicsContext*, const IntRect&) OVERRIDE;
+ virtual void textTrackRepresentationBoundsChanged(const IntRect&) OVERRIDE;
+ OwnPtr<TextTrackRepresentation> m_textTrackRepresentation;
+
IntRect m_videoDisplaySize;
float m_fontSize;
RefPtr<HTMLElement> m_cueContainer;
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp (137781 => 137782)
--- trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp 2012-12-14 23:18:25 UTC (rev 137781)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp 2012-12-14 23:23:25 UTC (rev 137782)
@@ -1129,6 +1129,16 @@
m_mediaPlayerClient->mediaPlayerDidRemoveTrack(track);
}
+
+bool MediaPlayer::requiresTextTrackRepresentation() const
+{
+ return m_private->requiresTextTrackRepresentation();
+}
+
+void MediaPlayer::setTextTrackRepresentation(TextTrackRepresentation* representation)
+{
+ m_private->setTextTrackRepresentation(representation);
+}
#endif
}
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.h (137781 => 137782)
--- trunk/Source/WebCore/platform/graphics/MediaPlayer.h 2012-12-14 23:18:25 UTC (rev 137781)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.h 2012-12-14 23:23:25 UTC (rev 137782)
@@ -62,6 +62,7 @@
class GStreamerGWorld;
class MediaPlayerPrivateInterface;
class MediaSource;
+class TextTrackRepresentation;
// Structure that will hold every native
// types supported by the current media player.
@@ -213,6 +214,9 @@
#if ENABLE(VIDEO_TRACK)
virtual void mediaPlayerDidAddTrack(PassRefPtr<InbandTextTrackPrivate>) { }
virtual void mediaPlayerDidRemoveTrack(PassRefPtr<InbandTextTrackPrivate>) { }
+
+ virtual void textTrackRepresentationBoundsChanged(const IntRect&) { }
+ virtual void paintTextTrackRepresentation(GraphicsContext*, const IntRect&) { }
#endif
};
@@ -436,6 +440,9 @@
#if ENABLE(VIDEO_TRACK)
void addTextTrack(PassRefPtr<InbandTextTrackPrivate>);
void removeTextTrack(PassRefPtr<InbandTextTrackPrivate>);
+
+ bool requiresTextTrackRepresentation() const;
+ void setTextTrackRepresentation(TextTrackRepresentation*);
#endif
private:
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h (137781 => 137782)
--- trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h 2012-12-14 23:18:25 UTC (rev 137781)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h 2012-12-14 23:23:25 UTC (rev 137782)
@@ -184,6 +184,10 @@
virtual MediaPlayer::MediaKeyException cancelKeyRequest(const String&, const String&) { return MediaPlayer::KeySystemNotSupported; }
#endif
+#if ENABLE(VIDEO_TRACK)
+ virtual bool requiresTextTrackRepresentation() const { return false; }
+ virtual void setTextTrackRepresentation(TextTrackRepresentation*) { }
+#endif
};
}
Added: trunk/Source/WebCore/platform/graphics/TextTrackRepresentation.cpp (0 => 137782)
--- trunk/Source/WebCore/platform/graphics/TextTrackRepresentation.cpp (rev 0)
+++ trunk/Source/WebCore/platform/graphics/TextTrackRepresentation.cpp 2012-12-14 23:23:25 UTC (rev 137782)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2012 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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.
+ */
+
+#include "config.h"
+
+#if ENABLE(VIDEO_TRACK)
+
+#include "TextTrackRepresentation.h"
+
+namespace WebCore {
+
+class NullTextTrackRepresentation : public TextTrackRepresentation {
+public:
+ virtual ~NullTextTrackRepresentation() { }
+ virtual void update() { }
+ virtual PlatformLayer* platformLayer() { return 0; }
+ virtual void setContentScale(float) { }
+ virtual IntRect bounds() const { return IntRect(); }
+};
+
+PassOwnPtr<TextTrackRepresentation> TextTrackRepresentation::create(TextTrackRepresentationClient*)
+{
+ return WTF::adoptPtr(new NullTextTrackRepresentation());
+}
+
+}
+
+#endif
Added: trunk/Source/WebCore/platform/graphics/TextTrackRepresentation.h (0 => 137782)
--- trunk/Source/WebCore/platform/graphics/TextTrackRepresentation.h (rev 0)
+++ trunk/Source/WebCore/platform/graphics/TextTrackRepresentation.h 2012-12-14 23:23:25 UTC (rev 137782)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2012 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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.
+ */
+
+#ifndef TextTrackRepresentation_h
+#define TextTrackRepresentation_h
+
+#if ENABLE(VIDEO_TRACK)
+
+#include "IntRect.h"
+#include "PlatformLayer.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace WebCore {
+
+class GraphicsContext;
+class IntRect;
+
+class TextTrackRepresentationClient {
+public:
+ virtual ~TextTrackRepresentationClient() { }
+
+ virtual void paintTextTrackRepresentation(GraphicsContext*, const IntRect&) = 0;
+ virtual void textTrackRepresentationBoundsChanged(const IntRect&) = 0;
+};
+
+class TextTrackRepresentation {
+public:
+ static PassOwnPtr<TextTrackRepresentation> create(TextTrackRepresentationClient*);
+
+ virtual ~TextTrackRepresentation() { }
+
+ virtual void update() = 0;
+ virtual PlatformLayer* platformLayer() = 0;
+ virtual void setContentScale(float) = 0;
+ virtual IntRect bounds() const = 0;
+};
+
+}
+
+#endif
+
+#endif // TextTrackRepresentation_h