Commit 0fb98694 authored by qinmin@chromium.org's avatar qinmin@chromium.org

Fix an issue that subtitle is not shown for native fullscreen video that is inside an iframe

Subtitle support for native fullscreen video is enabled in https://codereview.chromium.org/22454003/.
However, there are a couple bugs:
1. FullscreenElementStack::currentFullScreenElementFrom() returns NULL if the 
fullscreen element is in a child frame, we need to use 
FullscreenElementStack::fullscreenElementFrom().

2. When the video element is appended to the top level frame, we should exclude 
it when rebuilding the compositing layer tree.

A new layout test is added: fullscreen/full-screen-iframe-allowed-video.html

This CL also fixes a bug that some of the fullscreen pixel tests are no longer 
running due to  https://codereview.chromium.org/24438004

BUG=349222,347843

Review URL: https://codereview.chromium.org/187193002

git-svn-id: svn://svn.chromium.org/blink/trunk@168578 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 40b1b03a
......@@ -902,3 +902,11 @@ crbug.com/348911 [ Mac ] fast/text/international/rtl-space-in-ltr-element.html [
# Temporary until the Web Notification API test-runner changes finished.
crbug.com/349015 fast/notifications/notifications-constructor-with-permission.html [ Failure Pass ]
#Test cases need to rebaseline as reported in crbug.com/349222
crbug.com/349222 fullscreen/full-screen-iframe-zIndex.html [ NeedsRebaseline ]
crbug.com/349222 fullscreen/full-screen-remove-ancestor-after.html [ NeedsRebaseline ]
crbug.com/349222 fullscreen/full-screen-zIndex-after.html [ NeedsRebaseline ]
crbug.com/349222 virtual/android/fullscreen/full-screen-iframe-zIndex.html [ NeedsRebaseline ]
crbug.com/349222 virtual/android/fullscreen/full-screen-zIndex-after.html [ NeedsRebaseline ]
crbug.com/349222 virtual/android/fullscreen/full-screen-remove-ancestor-after.html [ NeedsRebaseline ]
Video inside an iframe is allowed to enter fullscreen
SUCCEED - entered full screen!
END OF TEST
<!DOCTYPE html>
<script>
if (window.internals)
runPixelTests = internals.runtimeFlags.overlayFullscreenVideoEnabled;
</script>
<script src="full-screen-test.js"></script>
<script>
var initialized = false;
window.onmessage = function(messageEvent) {
if (!initialized) {
// video has been loaded and messaged us.
// Send click to center of iframe.
iframe = document.getElementById("frame");
x = iframe.offsetLeft + iframe.offsetWidth / 2;
y = iframe.offsetTop + iframe.offsetHeight / 2;
if (window.eventSender) {
eventSender.mouseMoveTo(x, y);
eventSender.mouseDown();
eventSender.mouseUp();
}
initialized = true;
} else {
consoleWrite(messageEvent.data);
endTest();
}
}
</script>
Video inside an iframe is allowed to enter fullscreen</p>
<iframe id="frame" src="resources/video.html" width="320" height="240" allowfullscreen></iframe>
......@@ -4,7 +4,10 @@ var printFullTestDetails = true; // This is optionaly switched of by test whose
logConsole();
if (window.testRunner) {
testRunner.dumpAsText();
if (window.runPixelTests)
testRunner.dumpAsTextWithPixelResults();
else
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
......
<!DOCTYPE html>
<script src="../../media/media-file.js"></script>
<script>
function canplaythrough() {
parent.postMessage("Video loaded", "*");
}
function fullscreenChanged() {
parent.postMessage("SUCCEED - entered full screen!", "*");
}
onload = function() {
var video = document.getElementById('video');
var mediaFile = findMediaFile("video", "../../media/content/test");
video.src = mediaFile;
video.addEventListener('canplaythrough', canplaythrough);
video.addEventListener('webkitfullscreenchange', fullscreenChanged);
video.onclick = function() {
video.webkitRequestFullscreen();
};
}
</script>
<video id="video" controls width="320" height="240"></video>
......@@ -27,6 +27,7 @@
#include "config.h"
#include "core/rendering/compositing/GraphicsLayerUpdater.h"
#include "core/html/HTMLMediaElement.h"
#include "core/rendering/RenderLayer.h"
#include "core/rendering/RenderLayerReflectionInfo.h"
#include "core/rendering/RenderPart.h"
......@@ -37,6 +38,16 @@
namespace WebCore {
bool shouldAppendLayer(const RenderLayer& layer)
{
if (!RuntimeEnabledFeatures::overlayFullscreenVideoEnabled())
return true;
Node* node = layer.renderer()->node();
if (isHTMLMediaElement(*node) && toHTMLMediaElement(node)->isFullscreen())
return false;
return true;
}
GraphicsLayerUpdater::GraphicsLayerUpdater(RenderView& renderView)
: m_renderView(renderView)
, m_pixelsWithoutPromotingAllTransitions(0.0)
......@@ -122,7 +133,8 @@ void GraphicsLayerUpdater::rebuildTree(RenderLayer& layer, Vector<GraphicsLayer*
}
}
childLayersOfEnclosingLayer.append(currentCompositedLayerMapping->childForSuperlayers());
if (shouldAppendLayer(layer))
childLayersOfEnclosingLayer.append(currentCompositedLayerMapping->childForSuperlayers());
}
if (!depth) {
......
......@@ -314,12 +314,12 @@ void RenderLayerCompositor::updateCompositingRequirementsState()
static RenderVideo* findFullscreenVideoRenderer(Document& document)
{
Element* fullscreenElement = FullscreenElementStack::currentFullScreenElementFrom(document);
Element* fullscreenElement = FullscreenElementStack::fullscreenElementFrom(document);
while (fullscreenElement && fullscreenElement->isFrameOwnerElement()) {
Document* contentDocument = toHTMLFrameOwnerElement(fullscreenElement)->contentDocument();
if (!contentDocument)
return 0;
fullscreenElement = FullscreenElementStack::currentFullScreenElementFrom(*contentDocument);
fullscreenElement = FullscreenElementStack::fullscreenElementFrom(*contentDocument);
}
if (!fullscreenElement || !fullscreenElement->hasTagName(videoTag))
return 0;
......
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