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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 11 matching lines...) Expand all
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "config.h" 26 #include "config.h"
27 27
28 #include "core/rendering/RenderLayerCompositor.h" 28 #include "core/rendering/RenderLayerCompositor.h"
29 29
30 #include "CSSPropertyNames.h" 30 #include "CSSPropertyNames.h"
31 #include "HTMLNames.h" 31 #include "HTMLNames.h"
32 #include "RuntimeEnabledFeatures.h"
33 #include "core/dom/FullscreenElementStack.h"
32 #include "core/dom/NodeList.h" 34 #include "core/dom/NodeList.h"
33 #include "core/html/HTMLCanvasElement.h" 35 #include "core/html/HTMLCanvasElement.h"
34 #include "core/html/HTMLIFrameElement.h" 36 #include "core/html/HTMLIFrameElement.h"
37 #include "core/html/HTMLVideoElement.h"
35 #include "core/html/canvas/CanvasRenderingContext.h" 38 #include "core/html/canvas/CanvasRenderingContext.h"
36 #include "core/inspector/InspectorInstrumentation.h" 39 #include "core/inspector/InspectorInstrumentation.h"
37 #include "core/page/Chrome.h" 40 #include "core/page/Chrome.h"
38 #include "core/page/ChromeClient.h" 41 #include "core/page/ChromeClient.h"
39 #include "core/page/Frame.h" 42 #include "core/page/Frame.h"
40 #include "core/page/FrameView.h" 43 #include "core/page/FrameView.h"
41 #include "core/page/Page.h" 44 #include "core/page/Page.h"
42 #include "core/page/Settings.h" 45 #include "core/page/Settings.h"
43 #include "core/page/animation/AnimationController.h" 46 #include "core/page/animation/AnimationController.h"
44 #include "core/page/scrolling/ScrollingConstraints.h" 47 #include "core/page/scrolling/ScrollingConstraints.h"
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 346
344 for (HashSet<RenderLayer*>::iterator it = m_outOfFlowPositionedLayers.begin( ); it != m_outOfFlowPositionedLayers.end(); ++it) 347 for (HashSet<RenderLayer*>::iterator it = m_outOfFlowPositionedLayers.begin( ); it != m_outOfFlowPositionedLayers.end(); ++it)
345 (*it)->updateHasUnclippedDescendant(); 348 (*it)->updateHasUnclippedDescendant();
346 349
347 if (!compositorDrivenAcceleratedScrollingEnabled) { 350 if (!compositorDrivenAcceleratedScrollingEnabled) {
348 for (FrameView::ScrollableAreaSet::iterator it = scrollableAreas->begin( ); it != scrollableAreas->end(); ++it) 351 for (FrameView::ScrollableAreaSet::iterator it = scrollableAreas->begin( ); it != scrollableAreas->end(); ++it)
349 (*it)->updateNeedsCompositedScrolling(); 352 (*it)->updateNeedsCompositedScrolling();
350 } 353 }
351 } 354 }
352 355
356 static RenderVideo* findFullscreenVideoRenderer(Document* document)
357 {
358 Element* fullscreenElement = FullscreenElementStack::currentFullScreenElemen tFrom(document);
359 while (fullscreenElement && fullscreenElement->isFrameOwnerElement()) {
360 document = toHTMLFrameOwnerElement(fullscreenElement)->contentDocument() ;
361 if (!document)
362 return 0;
363 fullscreenElement = FullscreenElementStack::currentFullScreenElementFrom (document);
364 }
365 if (!fullscreenElement || !isHTMLVideoElement(fullscreenElement))
366 return 0;
367 RenderObject* renderer = fullscreenElement->renderer();
368 if (!renderer)
369 return 0;
370 return toRenderVideo(renderer);
371 }
372
353 void RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType update Type, RenderLayer* updateRoot) 373 void RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType update Type, RenderLayer* updateRoot)
354 { 374 {
355 // Avoid updating the layers with old values. Compositing layers will be upd ated after the layout is finished. 375 // Avoid updating the layers with old values. Compositing layers will be upd ated after the layout is finished.
356 if (m_renderView->needsLayout()) 376 if (m_renderView->needsLayout())
357 return; 377 return;
358 378
359 if (m_forceCompositingMode && !m_compositing) 379 if (m_forceCompositingMode && !m_compositing)
360 enableCompositingMode(true); 380 enableCompositingMode(true);
361 381
362 if (!m_reevaluateCompositingAfterLayout && !m_compositing) 382 if (!m_reevaluateCompositingAfterLayout && !m_compositing)
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 // Update the hierarchy of the compositing layers. 460 // Update the hierarchy of the compositing layers.
441 Vector<GraphicsLayer*> childList; 461 Vector<GraphicsLayer*> childList;
442 HashSet<RenderLayer*> visited; 462 HashSet<RenderLayer*> visited;
443 { 463 {
444 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::rebuildCompo sitingLayerTree"); 464 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::rebuildCompo sitingLayerTree");
445 rebuildCompositingLayerTree(updateRoot, childList, visited, 0); 465 rebuildCompositingLayerTree(updateRoot, childList, visited, 0);
446 } 466 }
447 467
448 // Host the document layer in the RenderView's root layer. 468 // Host the document layer in the RenderView's root layer.
449 if (isFullUpdate) { 469 if (isFullUpdate) {
470 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && isMai nFrame()) {
471 RenderVideo* video = findFullscreenVideoRenderer(&m_renderView-> document());
472 if (video) {
473 RenderLayerBacking* backing = video->backing();
474 if (backing) {
475 childList.clear();
476 childList.append(backing->graphicsLayer());
477 }
478 }
479 }
450 // Even when childList is empty, don't drop out of compositing mode if there are 480 // Even when childList is empty, don't drop out of compositing mode if there are
451 // composited layers that we didn't hit in our traversal (e.g. becau se of visibility:hidden). 481 // composited layers that we didn't hit in our traversal (e.g. becau se of visibility:hidden).
452 if (childList.isEmpty() && !hasAnyAdditionalCompositedLayers(updateR oot)) 482 if (childList.isEmpty() && !hasAnyAdditionalCompositedLayers(updateR oot))
453 destroyRootLayer(); 483 destroyRootLayer();
454 else 484 else
455 m_rootContentLayer->setChildren(childList); 485 m_rootContentLayer->setChildren(childList);
456 } 486 }
457 } else if (needGeometryUpdate) { 487 } else if (needGeometryUpdate) {
458 // We just need to do a geometry update. This is only used for position: fixed scrolling; 488 // We just need to do a geometry update. This is only used for position: fixed scrolling;
459 // most of the time, geometry is updated via RenderLayer::styleChanged() . 489 // most of the time, geometry is updated via RenderLayer::styleChanged() .
(...skipping 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after
1916 return false; 1946 return false;
1917 1947
1918 RenderStyle* style = renderer->style(); 1948 RenderStyle* style = renderer->style();
1919 // Note that we ask the renderer if it has a transform, because the style ma y have transforms, 1949 // Note that we ask the renderer if it has a transform, because the style ma y have transforms,
1920 // but the renderer may be an inline that doesn't suppport them. 1950 // but the renderer may be an inline that doesn't suppport them.
1921 return renderer->hasTransform() && style->transform().has3DOperation(); 1951 return renderer->hasTransform() && style->transform().has3DOperation();
1922 } 1952 }
1923 1953
1924 bool RenderLayerCompositor::requiresCompositingForVideo(RenderObject* renderer) const 1954 bool RenderLayerCompositor::requiresCompositingForVideo(RenderObject* renderer) const
1925 { 1955 {
1956 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && renderer->isV ideo()) {
1957 HTMLMediaElement* media = toHTMLMediaElement(renderer->node());
1958 return media->isFullscreen();
1959 }
1960
1926 if (!(m_compositingTriggers & ChromeClient::VideoTrigger)) 1961 if (!(m_compositingTriggers & ChromeClient::VideoTrigger))
1927 return false; 1962 return false;
1928 1963
1929 if (renderer->isVideo()) { 1964 if (renderer->isVideo()) {
1930 RenderVideo* video = toRenderVideo(renderer); 1965 RenderVideo* video = toRenderVideo(renderer);
1931 return video->shouldDisplayVideo() && canAccelerateVideoRendering(video) ; 1966 return video->shouldDisplayVideo() && canAccelerateVideoRendering(video) ;
1932 } 1967 }
1933 return false; 1968 return false;
1934 } 1969 }
1935 1970
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after
2816 } else if (graphicsLayer == m_scrollLayer.get()) { 2851 } else if (graphicsLayer == m_scrollLayer.get()) {
2817 name = "Frame Scrolling Layer"; 2852 name = "Frame Scrolling Layer";
2818 } else { 2853 } else {
2819 ASSERT_NOT_REACHED(); 2854 ASSERT_NOT_REACHED();
2820 } 2855 }
2821 2856
2822 return name; 2857 return name;
2823 } 2858 }
2824 2859
2825 } // namespace WebCore 2860 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698