Support captions when PLUGIN_PROXY_FOR_VIDEO

https://bugs.webkit.org/show_bug.cgi?id=100690

Reviewed by Simon Fraser.

When built with PLUGIN_PROXY_FOR_VIDEO, WebCore uses a plug-in for the media element's
platform media engine. Update this code path so the shadow DOM elements used to display
text tracks are created and configured correctly.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::configureMediaControls): Create media controls if necessary.

* rendering/RenderEmbeddedObject.cpp:
(WebCore::RenderEmbeddedObject::layout): Set the position and size of the shadow DOM when the
    position of the embedded element changes.
* rendering/RenderEmbeddedObject.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132842 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 5052ad78
2012-10-29 Eric Carlson <eric.carlson@apple.com>
Support captions when PLUGIN_PROXY_FOR_VIDEO
https://bugs.webkit.org/show_bug.cgi?id=100690
Reviewed by Simon Fraser.
When built with PLUGIN_PROXY_FOR_VIDEO, WebCore uses a plug-in for the media element's
platform media engine. Update this code path so the shadow DOM elements used to display
text tracks are created and configured correctly.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::configureMediaControls): Create media controls if necessary.
* rendering/RenderEmbeddedObject.cpp:
(WebCore::RenderEmbeddedObject::layout): Set the position and size of the shadow DOM when the
position of the embedded element changes.
* rendering/RenderEmbeddedObject.h:
2012-10-29 Justin Novosad <junov@google.com>
[Chromium] flickering observed when copying 2D canvas to webGL texture
......@@ -4172,6 +4172,9 @@ void HTMLMediaElement::configureMediaControls()
mediaControls()->show();
#else
if (!hasMediaControls())
createMediaControls();
if (m_player)
m_player->setControls(controls());
#endif
......
......@@ -53,6 +53,10 @@
#include "Text.h"
#include "TextRun.h"
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
#include "HTMLMediaElement.h"
#endif
namespace WebCore {
using namespace HTMLNames;
......@@ -231,6 +235,10 @@ void RenderEmbeddedObject::layout()
StackStats::LayoutCheckPoint layoutCheckPoint;
ASSERT(needsLayout());
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
LayoutSize oldSize = contentBoxRect().size();
#endif
updateLogicalWidth();
updateLogicalHeight();
......@@ -245,6 +253,31 @@ void RenderEmbeddedObject::layout()
frameView()->addWidgetToUpdate(this);
setNeedsLayout(false);
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
// This code copied from RenderMedia::layout().
RenderBox* controlsRenderer = toRenderBox(m_children.firstChild());
if (!controlsRenderer)
return;
LayoutSize newSize = contentBoxRect().size();
if (newSize == oldSize && !controlsRenderer->needsLayout())
return;
// When calling layout() on a child node, a parent must either push a LayoutStateMaintainter, or
// instantiate LayoutStateDisabler. Since using a LayoutStateMaintainer is slightly more efficient,
// and this method will be called many times per second during playback, use a LayoutStateMaintainer:
LayoutStateMaintainer statePusher(view(), this, locationOffset(), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode());
controlsRenderer->setLocation(LayoutPoint(borderLeft(), borderTop()) + LayoutSize(paddingLeft(), paddingTop()));
controlsRenderer->style()->setHeight(Length(newSize.height(), Fixed));
controlsRenderer->style()->setWidth(Length(newSize.width(), Fixed));
controlsRenderer->setNeedsLayout(true, MarkOnlyThis);
controlsRenderer->layout();
setChildNeedsLayout(false);
statePusher.pop();
#endif
}
void RenderEmbeddedObject::viewCleared()
......
......@@ -62,6 +62,11 @@ protected:
virtual CursorDirective getCursor(const LayoutPoint&, Cursor&) const;
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
const RenderObjectChildList* children() const { return &m_children; }
RenderObjectChildList* children() { return &m_children; }
#endif
private:
virtual const char* renderName() const { return "RenderEmbeddedObject"; }
virtual bool isEmbeddedObject() const { return true; }
......@@ -83,6 +88,12 @@ private:
bool isInUnavailablePluginIndicator(const LayoutPoint&) const;
bool getReplacementTextGeometry(const LayoutPoint& accumulatedOffset, FloatRect& contentRect, Path&, FloatRect& replacementTextRect, Font&, TextRun&, float& textWidth) const;
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
virtual bool canHaveChildren() const { return node() && toElement(node())->isMediaElement(); }
virtual RenderObjectChildList* virtualChildren() { return children(); }
virtual const RenderObjectChildList* virtualChildren() const { return children(); }
#endif
bool m_hasFallbackContent; // FIXME: This belongs on HTMLObjectElement.
bool m_showsUnavailablePluginIndicator;
......@@ -90,6 +101,9 @@ private:
String m_unavailablePluginReplacementText;
bool m_unavailablePluginIndicatorIsPressed;
bool m_mouseDownWasInUnavailablePluginIndicator;
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
RenderObjectChildList m_children;
#endif
};
inline RenderEmbeddedObject* toRenderEmbeddedObject(RenderObject* object)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment