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

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: rebased 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
« no previous file with comments | « Source/core/rendering/RenderLayerBacking.cpp ('k') | Source/core/rendering/RenderLayerModelObject.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderLayerCompositor.cpp
diff --git a/Source/core/rendering/RenderLayerCompositor.cpp b/Source/core/rendering/RenderLayerCompositor.cpp
index 9f00079e3ed7fcb81b0741c276db3153671cc373..8f640100f51e4fb5a7eaba3e6ffe0fa9d64e368b 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.
@@ -446,6 +466,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))
@@ -1853,6 +1883,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;
« no previous file with comments | « Source/core/rendering/RenderLayerBacking.cpp ('k') | Source/core/rendering/RenderLayerModelObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698