OLD | NEW |
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 Loading... |
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 Loading... |
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 if (needHierarchyUpdate) { | 459 if (needHierarchyUpdate) { |
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 { | 462 { |
443 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::rebuildCompo
sitingLayerTree"); | 463 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::rebuildCompo
sitingLayerTree"); |
444 rebuildCompositingLayerTree(updateRoot, childList, 0); | 464 rebuildCompositingLayerTree(updateRoot, childList, 0); |
445 } | 465 } |
446 | 466 |
447 // Host the document layer in the RenderView's root layer. | 467 // Host the document layer in the RenderView's root layer. |
448 if (isFullUpdate) { | 468 if (isFullUpdate) { |
| 469 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && isMai
nFrame()) { |
| 470 RenderVideo* video = findFullscreenVideoRenderer(&m_renderView->
document()); |
| 471 if (video) { |
| 472 RenderLayerBacking* backing = video->backing(); |
| 473 if (backing) { |
| 474 childList.clear(); |
| 475 childList.append(backing->graphicsLayer()); |
| 476 } |
| 477 } |
| 478 } |
449 // Even when childList is empty, don't drop out of compositing mode
if there are | 479 // 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). | 480 // composited layers that we didn't hit in our traversal (e.g. becau
se of visibility:hidden). |
451 if (childList.isEmpty() && !hasAnyAdditionalCompositedLayers(updateR
oot)) | 481 if (childList.isEmpty() && !hasAnyAdditionalCompositedLayers(updateR
oot)) |
452 destroyRootLayer(); | 482 destroyRootLayer(); |
453 else | 483 else |
454 m_rootContentLayer->setChildren(childList); | 484 m_rootContentLayer->setChildren(childList); |
455 } | 485 } |
456 } else if (needGeometryUpdate) { | 486 } else if (needGeometryUpdate) { |
457 // We just need to do a geometry update. This is only used for position:
fixed scrolling; | 487 // 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()
. | 488 // most of the time, geometry is updated via RenderLayer::styleChanged()
. |
(...skipping 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1846 return false; | 1876 return false; |
1847 | 1877 |
1848 RenderStyle* style = renderer->style(); | 1878 RenderStyle* style = renderer->style(); |
1849 // Note that we ask the renderer if it has a transform, because the style ma
y have transforms, | 1879 // Note that we ask the renderer if it has a transform, because the style ma
y have transforms, |
1850 // but the renderer may be an inline that doesn't suppport them. | 1880 // but the renderer may be an inline that doesn't suppport them. |
1851 return renderer->hasTransform() && style->transform().has3DOperation(); | 1881 return renderer->hasTransform() && style->transform().has3DOperation(); |
1852 } | 1882 } |
1853 | 1883 |
1854 bool RenderLayerCompositor::requiresCompositingForVideo(RenderObject* renderer)
const | 1884 bool RenderLayerCompositor::requiresCompositingForVideo(RenderObject* renderer)
const |
1855 { | 1885 { |
| 1886 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && renderer->isV
ideo()) { |
| 1887 HTMLMediaElement* media = toHTMLMediaElement(renderer->node()); |
| 1888 return media->isFullscreen(); |
| 1889 } |
| 1890 |
1856 if (!(m_compositingTriggers & ChromeClient::VideoTrigger)) | 1891 if (!(m_compositingTriggers & ChromeClient::VideoTrigger)) |
1857 return false; | 1892 return false; |
1858 | 1893 |
1859 if (renderer->isVideo()) { | 1894 if (renderer->isVideo()) { |
1860 RenderVideo* video = toRenderVideo(renderer); | 1895 RenderVideo* video = toRenderVideo(renderer); |
1861 return video->shouldDisplayVideo() && canAccelerateVideoRendering(video)
; | 1896 return video->shouldDisplayVideo() && canAccelerateVideoRendering(video)
; |
1862 } | 1897 } |
1863 return false; | 1898 return false; |
1864 } | 1899 } |
1865 | 1900 |
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2746 } else if (graphicsLayer == m_scrollLayer.get()) { | 2781 } else if (graphicsLayer == m_scrollLayer.get()) { |
2747 name = "Frame Scrolling Layer"; | 2782 name = "Frame Scrolling Layer"; |
2748 } else { | 2783 } else { |
2749 ASSERT_NOT_REACHED(); | 2784 ASSERT_NOT_REACHED(); |
2750 } | 2785 } |
2751 | 2786 |
2752 return name; | 2787 return name; |
2753 } | 2788 } |
2754 | 2789 |
2755 } // namespace WebCore | 2790 } // namespace WebCore |
OLD | NEW |