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

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: enabling layout tests 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"
32 #include "core/dom/NodeList.h" 33 #include "core/dom/NodeList.h"
33 #include "core/html/HTMLCanvasElement.h" 34 #include "core/html/HTMLCanvasElement.h"
34 #include "core/html/HTMLIFrameElement.h" 35 #include "core/html/HTMLIFrameElement.h"
35 #include "core/html/canvas/CanvasRenderingContext.h" 36 #include "core/html/canvas/CanvasRenderingContext.h"
36 #include "core/inspector/InspectorInstrumentation.h" 37 #include "core/inspector/InspectorInstrumentation.h"
37 #include "core/page/Chrome.h" 38 #include "core/page/Chrome.h"
38 #include "core/page/ChromeClient.h" 39 #include "core/page/ChromeClient.h"
39 #include "core/page/Frame.h" 40 #include "core/page/Frame.h"
40 #include "core/page/FrameView.h" 41 #include "core/page/FrameView.h"
41 #include "core/page/Page.h" 42 #include "core/page/Page.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 , m_compositedLayerCount(0) 223 , m_compositedLayerCount(0)
223 , m_showRepaintCounter(false) 224 , m_showRepaintCounter(false)
224 , m_reevaluateCompositingAfterLayout(false) 225 , m_reevaluateCompositingAfterLayout(false)
225 , m_compositing(false) 226 , m_compositing(false)
226 , m_compositingLayersNeedRebuild(false) 227 , m_compositingLayersNeedRebuild(false)
227 , m_forceCompositingMode(false) 228 , m_forceCompositingMode(false)
228 , m_inPostLayoutUpdate(false) 229 , m_inPostLayoutUpdate(false)
229 , m_needsUpdateCompositingRequirementsState(false) 230 , m_needsUpdateCompositingRequirementsState(false)
230 , m_isTrackingRepaints(false) 231 , m_isTrackingRepaints(false)
231 , m_rootLayerAttachment(RootLayerUnattached) 232 , m_rootLayerAttachment(RootLayerUnattached)
233 , m_currentFullscreenRenderer(0)
232 #if !LOG_DISABLED 234 #if !LOG_DISABLED
233 , m_rootLayerUpdateCount(0) 235 , m_rootLayerUpdateCount(0)
234 , m_obligateCompositedLayerCount(0) 236 , m_obligateCompositedLayerCount(0)
235 , m_secondaryCompositedLayerCount(0) 237 , m_secondaryCompositedLayerCount(0)
236 , m_obligatoryBackingStoreBytes(0) 238 , m_obligatoryBackingStoreBytes(0)
237 , m_secondaryBackingStoreBytes(0) 239 , m_secondaryBackingStoreBytes(0)
238 #endif 240 #endif
239 { 241 {
240 } 242 }
241 243
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 if (needHierarchyUpdate) { 441 if (needHierarchyUpdate) {
440 // Update the hierarchy of the compositing layers. 442 // Update the hierarchy of the compositing layers.
441 Vector<GraphicsLayer*> childList; 443 Vector<GraphicsLayer*> childList;
442 { 444 {
443 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::rebuildCompo sitingLayerTree"); 445 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::rebuildCompo sitingLayerTree");
444 rebuildCompositingLayerTree(updateRoot, childList, 0); 446 rebuildCompositingLayerTree(updateRoot, childList, 0);
445 } 447 }
446 448
447 // Host the document layer in the RenderView's root layer. 449 // Host the document layer in the RenderView's root layer.
448 if (isFullUpdate) { 450 if (isFullUpdate) {
451 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && m_cur rentFullscreenRenderer && m_currentFullscreenRenderer->isMedia()) {
452 RenderLayerModelObject* renderer = toRenderLayerModelObject(m_cu rrentFullscreenRenderer);
esprehn 2013/09/13 02:46:07 SVG elements can never be full screen? They're not
trchen 2013/09/13 05:14:58 This special code path only applies for RenderMedi
453 RenderLayerBacking* backing = renderer->layer() ? renderer->laye r()->backing() : 0;
esprehn 2013/09/13 02:46:07 You should just add a method to RenderLayerModelOb
trchen 2013/09/13 05:14:58 Done.
454 if (backing) {
455 childList.clear();
456 childList.append(backing->graphicsLayer());
457 }
458 }
449 // Even when childList is empty, don't drop out of compositing mode if there are 459 // Even when childList is empty, don't drop out of compositing mode if there are
450 // composited layers that we didn't hit in our traversal (e.g. becau se of visibility:hidden). 460 // composited layers that we didn't hit in our traversal (e.g. becau se of visibility:hidden).
451 if (childList.isEmpty() && !hasAnyAdditionalCompositedLayers(updateR oot)) 461 if (childList.isEmpty() && !hasAnyAdditionalCompositedLayers(updateR oot))
452 destroyRootLayer(); 462 destroyRootLayer();
453 else 463 else
454 m_rootContentLayer->setChildren(childList); 464 m_rootContentLayer->setChildren(childList);
455 } 465 }
456 } else if (needGeometryUpdate) { 466 } else if (needGeometryUpdate) {
457 // We just need to do a geometry update. This is only used for position: fixed scrolling; 467 // We just need to do a geometry update. This is only used for position: fixed scrolling;
458 // most of the time, geometry is updated via RenderLayer::styleChanged() . 468 // most of the time, geometry is updated via RenderLayer::styleChanged() .
(...skipping 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1828 return false; 1838 return false;
1829 1839
1830 RenderStyle* style = renderer->style(); 1840 RenderStyle* style = renderer->style();
1831 // Note that we ask the renderer if it has a transform, because the style ma y have transforms, 1841 // Note that we ask the renderer if it has a transform, because the style ma y have transforms,
1832 // but the renderer may be an inline that doesn't suppport them. 1842 // but the renderer may be an inline that doesn't suppport them.
1833 return renderer->hasTransform() && style->transform().has3DOperation(); 1843 return renderer->hasTransform() && style->transform().has3DOperation();
1834 } 1844 }
1835 1845
1836 bool RenderLayerCompositor::requiresCompositingForVideo(RenderObject* renderer) const 1846 bool RenderLayerCompositor::requiresCompositingForVideo(RenderObject* renderer) const
1837 { 1847 {
1848 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && renderer->isV ideo() && renderer == m_currentFullscreenRenderer)
1849 return true;
1850
1838 if (!(m_compositingTriggers & ChromeClient::VideoTrigger)) 1851 if (!(m_compositingTriggers & ChromeClient::VideoTrigger))
1839 return false; 1852 return false;
1840 1853
1841 if (renderer->isVideo()) { 1854 if (renderer->isVideo()) {
1842 RenderVideo* video = toRenderVideo(renderer); 1855 RenderVideo* video = toRenderVideo(renderer);
1843 return video->shouldDisplayVideo() && canAccelerateVideoRendering(video) ; 1856 return video->shouldDisplayVideo() && canAccelerateVideoRendering(video) ;
1844 } 1857 }
1845 return false; 1858 return false;
1846 } 1859 }
1847 1860
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
2754 name = "Frame Clipping Layer"; 2767 name = "Frame Clipping Layer";
2755 } else if (graphicsLayer == m_scrollLayer.get()) { 2768 } else if (graphicsLayer == m_scrollLayer.get()) {
2756 name = "Frame Scrolling Layer"; 2769 name = "Frame Scrolling Layer";
2757 } else { 2770 } else {
2758 ASSERT_NOT_REACHED(); 2771 ASSERT_NOT_REACHED();
2759 } 2772 }
2760 2773
2761 return name; 2774 return name;
2762 } 2775 }
2763 2776
2777 void RenderLayerCompositor::setCurrentFullscreenRenderer(RenderObject* renderer)
2778 {
2779 if (renderer == m_currentFullscreenRenderer)
2780 return;
2781 m_currentFullscreenRenderer = renderer;
esprehn 2013/09/13 02:46:07 I'm not a fan of keeping RenderObjects across fram
trchen 2013/09/13 05:14:58 That is one alternative way I have thought about.
2782 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && (!renderer || renderer->isVideo()))
2783 setCompositingLayersNeedRebuild(true);
2784 }
2785
2764 } // namespace WebCore 2786 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698