Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: Source/core/rendering/RenderLayerCompositor.cpp

Issue 22454003: Support subtitles for native fullscreen video (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: revert video-controls-override.html Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/rendering/RenderLayerCompositor.cpp
diff --git a/Source/core/rendering/RenderLayerCompositor.cpp b/Source/core/rendering/RenderLayerCompositor.cpp
index 7e69cf5deac8b64d7d9594e6133848eb29a42eb1..19678d693cd99e166eb4f0727d27c2efe014b176 100644
--- a/Source/core/rendering/RenderLayerCompositor.cpp
+++ b/Source/core/rendering/RenderLayerCompositor.cpp
@@ -29,9 +29,12 @@
#include "CSSPropertyNames.h"
#include "HTMLNames.h"
+#include "RuntimeEnabledFeatures.h"
+#include "core/dom/FullscreenElementStack.h"
#include "core/dom/NodeList.h"
#include "core/html/HTMLCanvasElement.h"
#include "core/html/HTMLIFrameElement.h"
+#include "core/html/HTMLVideoElement.h"
#include "core/html/canvas/CanvasRenderingContext.h"
#include "core/inspector/InspectorInstrumentation.h"
#include "core/page/Chrome.h"
@@ -350,6 +353,23 @@ void RenderLayerCompositor::updateCompositingRequirementsState()
}
}
+static RenderVideo* findFullscreenVideoRenderer(Document* document)
+{
+ Element* fullscreenElement = FullscreenElementStack::currentFullScreenElementFrom(document);
+ while (fullscreenElement && fullscreenElement->isFrameOwnerElement()) {
+ document = toHTMLFrameOwnerElement(fullscreenElement)->contentDocument();
+ if (!document)
+ return 0;
+ fullscreenElement = FullscreenElementStack::currentFullScreenElementFrom(document);
+ }
+ if (!fullscreenElement || !isHTMLVideoElement(fullscreenElement))
+ return 0;
+ RenderObject* renderer = fullscreenElement->renderer();
+ if (!renderer)
+ return 0;
+ return toRenderVideo(renderer);
+}
+
void RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType updateType, RenderLayer* updateRoot)
{
// Avoid updating the layers with old values. Compositing layers will be updated after the layout is finished.
@@ -447,6 +467,16 @@ void RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType update
// Host the document layer in the RenderView's root layer.
if (isFullUpdate) {
+ if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && isMainFrame()) {
+ RenderVideo* video = findFullscreenVideoRenderer(&m_renderView->document());
+ if (video) {
+ RenderLayerBacking* backing = video->backing();
+ if (backing) {
+ childList.clear();
+ childList.append(backing->graphicsLayer());
+ }
+ }
+ }
// Even when childList is empty, don't drop out of compositing mode if there are
// composited layers that we didn't hit in our traversal (e.g. because of visibility:hidden).
if (childList.isEmpty() && !hasAnyAdditionalCompositedLayers(updateRoot))
@@ -1923,6 +1953,11 @@ bool RenderLayerCompositor::requiresCompositingForTransform(RenderObject* render
bool RenderLayerCompositor::requiresCompositingForVideo(RenderObject* renderer) const
{
+ if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && renderer->isVideo()) {
+ HTMLMediaElement* media = toHTMLMediaElement(renderer->node());
+ return media->isFullscreen();
+ }
+
if (!(m_compositingTriggers & ChromeClient::VideoTrigger))
return false;

Powered by Google App Engine
This is Rietveld 408576698