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" |
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 Loading... |
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 |
242 RenderLayerCompositor::~RenderLayerCompositor() | 244 RenderLayerCompositor::~RenderLayerCompositor() |
243 { | 245 { |
244 ASSERT(m_rootLayerAttachment == RootLayerUnattached); | 246 ASSERT(m_rootLayerAttachment == RootLayerUnattached); |
| 247 ASSERT(!m_currentFullscreenRenderer); |
245 } | 248 } |
246 | 249 |
247 void RenderLayerCompositor::enableCompositingMode(bool enable /* = true */) | 250 void RenderLayerCompositor::enableCompositingMode(bool enable /* = true */) |
248 { | 251 { |
249 if (enable != m_compositing) { | 252 if (enable != m_compositing) { |
250 m_compositing = enable; | 253 m_compositing = enable; |
251 | 254 |
252 if (m_compositing) { | 255 if (m_compositing) { |
253 ensureRootLayer(); | 256 ensureRootLayer(); |
254 notifyIFramesOfCompositingChange(); | 257 notifyIFramesOfCompositingChange(); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 if (needHierarchyUpdate) { | 442 if (needHierarchyUpdate) { |
440 // Update the hierarchy of the compositing layers. | 443 // Update the hierarchy of the compositing layers. |
441 Vector<GraphicsLayer*> childList; | 444 Vector<GraphicsLayer*> childList; |
442 { | 445 { |
443 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::rebuildCompo
sitingLayerTree"); | 446 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::rebuildCompo
sitingLayerTree"); |
444 rebuildCompositingLayerTree(updateRoot, childList, 0); | 447 rebuildCompositingLayerTree(updateRoot, childList, 0); |
445 } | 448 } |
446 | 449 |
447 // Host the document layer in the RenderView's root layer. | 450 // Host the document layer in the RenderView's root layer. |
448 if (isFullUpdate) { | 451 if (isFullUpdate) { |
| 452 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && m_cur
rentFullscreenRenderer && m_currentFullscreenRenderer->isMedia()) { |
| 453 RenderLayerModelObject* renderer = toRenderLayerModelObject(m_cu
rrentFullscreenRenderer); |
| 454 RenderLayerBacking* backing = renderer->backing(); |
| 455 if (backing) { |
| 456 childList.clear(); |
| 457 childList.append(backing->graphicsLayer()); |
| 458 } |
| 459 } |
449 // Even when childList is empty, don't drop out of compositing mode
if there are | 460 // 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). | 461 // composited layers that we didn't hit in our traversal (e.g. becau
se of visibility:hidden). |
451 if (childList.isEmpty() && !hasAnyAdditionalCompositedLayers(updateR
oot)) | 462 if (childList.isEmpty() && !hasAnyAdditionalCompositedLayers(updateR
oot)) |
452 destroyRootLayer(); | 463 destroyRootLayer(); |
453 else | 464 else |
454 m_rootContentLayer->setChildren(childList); | 465 m_rootContentLayer->setChildren(childList); |
455 } | 466 } |
456 } else if (needGeometryUpdate) { | 467 } else if (needGeometryUpdate) { |
457 // We just need to do a geometry update. This is only used for position:
fixed scrolling; | 468 // 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()
. | 469 // 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; | 1857 return false; |
1847 | 1858 |
1848 RenderStyle* style = renderer->style(); | 1859 RenderStyle* style = renderer->style(); |
1849 // Note that we ask the renderer if it has a transform, because the style ma
y have transforms, | 1860 // 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. | 1861 // but the renderer may be an inline that doesn't suppport them. |
1851 return renderer->hasTransform() && style->transform().has3DOperation(); | 1862 return renderer->hasTransform() && style->transform().has3DOperation(); |
1852 } | 1863 } |
1853 | 1864 |
1854 bool RenderLayerCompositor::requiresCompositingForVideo(RenderObject* renderer)
const | 1865 bool RenderLayerCompositor::requiresCompositingForVideo(RenderObject* renderer)
const |
1855 { | 1866 { |
| 1867 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && renderer->isV
ideo() && renderer == m_currentFullscreenRenderer) |
| 1868 return true; |
| 1869 |
1856 if (!(m_compositingTriggers & ChromeClient::VideoTrigger)) | 1870 if (!(m_compositingTriggers & ChromeClient::VideoTrigger)) |
1857 return false; | 1871 return false; |
1858 | 1872 |
1859 if (renderer->isVideo()) { | 1873 if (renderer->isVideo()) { |
1860 RenderVideo* video = toRenderVideo(renderer); | 1874 RenderVideo* video = toRenderVideo(renderer); |
1861 return video->shouldDisplayVideo() && canAccelerateVideoRendering(video)
; | 1875 return video->shouldDisplayVideo() && canAccelerateVideoRendering(video)
; |
1862 } | 1876 } |
1863 return false; | 1877 return false; |
1864 } | 1878 } |
1865 | 1879 |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2745 name = "Frame Clipping Layer"; | 2759 name = "Frame Clipping Layer"; |
2746 } else if (graphicsLayer == m_scrollLayer.get()) { | 2760 } else if (graphicsLayer == m_scrollLayer.get()) { |
2747 name = "Frame Scrolling Layer"; | 2761 name = "Frame Scrolling Layer"; |
2748 } else { | 2762 } else { |
2749 ASSERT_NOT_REACHED(); | 2763 ASSERT_NOT_REACHED(); |
2750 } | 2764 } |
2751 | 2765 |
2752 return name; | 2766 return name; |
2753 } | 2767 } |
2754 | 2768 |
| 2769 void RenderLayerCompositor::setCurrentFullscreenRenderer(RenderObject* renderer) |
| 2770 { |
| 2771 if (renderer == m_currentFullscreenRenderer) |
| 2772 return; |
| 2773 #ifndef NDEBUG |
| 2774 if (m_currentFullscreenRenderer) |
| 2775 m_currentFullscreenRenderer->setIsCurrentFullscreen(false); |
| 2776 #endif |
| 2777 m_currentFullscreenRenderer = renderer; |
| 2778 #ifndef NDEBUG |
| 2779 if (m_currentFullscreenRenderer) |
| 2780 m_currentFullscreenRenderer->setIsCurrentFullscreen(true); |
| 2781 #endif |
| 2782 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && (!renderer ||
renderer->isVideo())) |
| 2783 setCompositingLayersNeedRebuild(true); |
| 2784 } |
| 2785 |
2755 } // namespace WebCore | 2786 } // namespace WebCore |
OLD | NEW |