Title: [132842] trunk/Source/WebCore
- Revision
- 132842
- Author
- eric.carl...@apple.com
- Date
- 2012-10-29 13:01:04 -0700 (Mon, 29 Oct 2012)
Log Message
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:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (132841 => 132842)
--- trunk/Source/WebCore/ChangeLog 2012-10-29 19:59:27 UTC (rev 132841)
+++ trunk/Source/WebCore/ChangeLog 2012-10-29 20:01:04 UTC (rev 132842)
@@ -1,3 +1,22 @@
+2012-10-29 Eric Carlson <eric.carl...@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 <ju...@google.com>
[Chromium] flickering observed when copying 2D canvas to webGL texture
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (132841 => 132842)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2012-10-29 19:59:27 UTC (rev 132841)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2012-10-29 20:01:04 UTC (rev 132842)
@@ -4172,6 +4172,9 @@
mediaControls()->show();
#else
+ if (!hasMediaControls())
+ createMediaControls();
+
if (m_player)
m_player->setControls(controls());
#endif
Modified: trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp (132841 => 132842)
--- trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp 2012-10-29 19:59:27 UTC (rev 132841)
+++ trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp 2012-10-29 20:01:04 UTC (rev 132842)
@@ -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 @@
StackStats::LayoutCheckPoint layoutCheckPoint;
ASSERT(needsLayout());
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+ LayoutSize oldSize = contentBoxRect().size();
+#endif
+
updateLogicalWidth();
updateLogicalHeight();
@@ -245,6 +253,31 @@
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()
Modified: trunk/Source/WebCore/rendering/RenderEmbeddedObject.h (132841 => 132842)
--- trunk/Source/WebCore/rendering/RenderEmbeddedObject.h 2012-10-29 19:59:27 UTC (rev 132841)
+++ trunk/Source/WebCore/rendering/RenderEmbeddedObject.h 2012-10-29 20:01:04 UTC (rev 132842)
@@ -62,6 +62,11 @@
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 @@
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 @@
String m_unavailablePluginReplacementText;
bool m_unavailablePluginIndicatorIsPressed;
bool m_mouseDownWasInUnavailablePluginIndicator;
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+ RenderObjectChildList m_children;
+#endif
};
inline RenderEmbeddedObject* toRenderEmbeddedObject(RenderObject* object)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes