| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 #endif | 197 #endif |
| 198 }; | 198 }; |
| 199 | 199 |
| 200 RenderLayerCompositor::RenderLayerCompositor(RenderView* renderView) | 200 RenderLayerCompositor::RenderLayerCompositor(RenderView* renderView) |
| 201 : m_renderView(renderView) | 201 : m_renderView(renderView) |
| 202 , m_compositingReasonFinder(*renderView) | 202 , m_compositingReasonFinder(*renderView) |
| 203 , m_hasAcceleratedCompositing(true) | 203 , m_hasAcceleratedCompositing(true) |
| 204 , m_showRepaintCounter(false) | 204 , m_showRepaintCounter(false) |
| 205 , m_needsToRecomputeCompositingRequirements(false) | 205 , m_needsToRecomputeCompositingRequirements(false) |
| 206 , m_needsToUpdateLayerTreeGeometry(false) | 206 , m_needsToUpdateLayerTreeGeometry(false) |
| 207 , m_pendingUpdateType(GraphicsLayerUpdater::DoNotForceUpdate) |
| 207 , m_compositing(false) | 208 , m_compositing(false) |
| 208 , m_compositingLayersNeedRebuild(false) | 209 , m_compositingLayersNeedRebuild(false) |
| 209 , m_forceCompositingMode(false) | 210 , m_forceCompositingMode(false) |
| 210 , m_needsUpdateCompositingRequirementsState(false) | 211 , m_needsUpdateCompositingRequirementsState(false) |
| 211 , m_isTrackingRepaints(false) | 212 , m_isTrackingRepaints(false) |
| 212 , m_rootLayerAttachment(RootLayerUnattached) | 213 , m_rootLayerAttachment(RootLayerUnattached) |
| 213 { | 214 { |
| 214 ASSERT(renderView); | 215 ASSERT(renderView); |
| 215 } | 216 } |
| 216 | 217 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 return; | 356 return; |
| 356 | 357 |
| 357 if (m_forceCompositingMode && !m_compositing) | 358 if (m_forceCompositingMode && !m_compositing) |
| 358 enableCompositingMode(true); | 359 enableCompositingMode(true); |
| 359 | 360 |
| 360 if (!m_needsToRecomputeCompositingRequirements && !m_compositing) | 361 if (!m_needsToRecomputeCompositingRequirements && !m_compositing) |
| 361 return; | 362 return; |
| 362 | 363 |
| 363 switch (updateType) { | 364 switch (updateType) { |
| 364 case CompositingUpdateAfterStyleChange: | 365 case CompositingUpdateAfterStyleChange: |
| 366 m_needsToRecomputeCompositingRequirements = true; |
| 367 break; |
| 365 case CompositingUpdateAfterLayout: | 368 case CompositingUpdateAfterLayout: |
| 366 m_needsToRecomputeCompositingRequirements = true; | 369 m_needsToRecomputeCompositingRequirements = true; |
| 370 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't
need a ForceUpdate here. |
| 371 m_pendingUpdateType = GraphicsLayerUpdater::ForceUpdate; |
| 367 break; | 372 break; |
| 368 case CompositingUpdateOnScroll: | 373 case CompositingUpdateOnScroll: |
| 369 m_needsToRecomputeCompositingRequirements = true; // Overlap can change
with scrolling, so need to check for hierarchy updates. | 374 m_needsToRecomputeCompositingRequirements = true; // Overlap can change
with scrolling, so need to check for hierarchy updates. |
| 370 m_needsToUpdateLayerTreeGeometry = true; | 375 m_needsToUpdateLayerTreeGeometry = true; |
| 376 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't
need a ForceUpdate here. |
| 377 m_pendingUpdateType = GraphicsLayerUpdater::ForceUpdate; |
| 371 break; | 378 break; |
| 372 case CompositingUpdateOnCompositedScroll: | 379 case CompositingUpdateOnCompositedScroll: |
| 373 m_needsToUpdateLayerTreeGeometry = true; | 380 m_needsToUpdateLayerTreeGeometry = true; |
| 381 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't
need a ForceUpdate here. |
| 382 m_pendingUpdateType = GraphicsLayerUpdater::ForceUpdate; |
| 374 break; | 383 break; |
| 375 } | 384 } |
| 376 | 385 |
| 377 m_renderView->frameView()->scheduleAnimation(); | 386 m_renderView->frameView()->scheduleAnimation(); |
| 378 } | 387 } |
| 379 | 388 |
| 380 void RenderLayerCompositor::updateCompositingLayers() | 389 void RenderLayerCompositor::updateCompositingLayers() |
| 381 { | 390 { |
| 382 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::updateCompositingLay
ers"); | 391 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::updateCompositingLay
ers"); |
| 383 | 392 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 412 return; | 421 return; |
| 413 | 422 |
| 414 bool needCompositingRequirementsUpdate = m_needsToRecomputeCompositingRequir
ements; | 423 bool needCompositingRequirementsUpdate = m_needsToRecomputeCompositingRequir
ements; |
| 415 bool needHierarchyAndGeometryUpdate = m_compositingLayersNeedRebuild; | 424 bool needHierarchyAndGeometryUpdate = m_compositingLayersNeedRebuild; |
| 416 bool needGeometryUpdate = m_needsToUpdateLayerTreeGeometry; | 425 bool needGeometryUpdate = m_needsToUpdateLayerTreeGeometry; |
| 417 bool needsToUpdateScrollingCoordinator = scrollingCoordinator() ? scrollingC
oordinator()->needsToUpdateAfterCompositingChange() : false; | 426 bool needsToUpdateScrollingCoordinator = scrollingCoordinator() ? scrollingC
oordinator()->needsToUpdateAfterCompositingChange() : false; |
| 418 | 427 |
| 419 if (!needCompositingRequirementsUpdate && !needHierarchyAndGeometryUpdate &&
!needGeometryUpdate && !needsToUpdateScrollingCoordinator) | 428 if (!needCompositingRequirementsUpdate && !needHierarchyAndGeometryUpdate &&
!needGeometryUpdate && !needsToUpdateScrollingCoordinator) |
| 420 return; | 429 return; |
| 421 | 430 |
| 431 GraphicsLayerUpdater::UpdateType updateType = m_pendingUpdateType; |
| 432 |
| 422 // Only clear the flags if we're updating the entire hierarchy. | 433 // Only clear the flags if we're updating the entire hierarchy. |
| 423 m_compositingLayersNeedRebuild = false; | 434 m_compositingLayersNeedRebuild = false; |
| 424 m_needsToUpdateLayerTreeGeometry = false; | 435 m_needsToUpdateLayerTreeGeometry = false; |
| 425 m_needsToRecomputeCompositingRequirements = false; | 436 m_needsToRecomputeCompositingRequirements = false; |
| 437 m_pendingUpdateType = GraphicsLayerUpdater::DoNotForceUpdate; |
| 438 |
| 426 RenderLayer* updateRoot = rootRenderLayer(); | 439 RenderLayer* updateRoot = rootRenderLayer(); |
| 427 | 440 |
| 428 if (needCompositingRequirementsUpdate) { | 441 if (needCompositingRequirementsUpdate) { |
| 429 // Go through the layers in presentation order, so that we can compute w
hich RenderLayers need compositing layers. | 442 // Go through the layers in presentation order, so that we can compute w
hich RenderLayers need compositing layers. |
| 430 // FIXME: we could maybe do this and the hierarchy udpate in one pass, b
ut the parenting logic would be more complex. | 443 // FIXME: we could maybe do this and the hierarchy udpate in one pass, b
ut the parenting logic would be more complex. |
| 431 CompositingRecursionData recursionData(updateRoot, 0, true); | 444 CompositingRecursionData recursionData(updateRoot, 0, true); |
| 432 bool layersChanged = false; | 445 bool layersChanged = false; |
| 433 bool saw3DTransform = false; | 446 bool saw3DTransform = false; |
| 434 { | 447 { |
| 435 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::computeCompo
sitingRequirements"); | 448 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::computeCompo
sitingRequirements"); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 464 | 477 |
| 465 if (layersChanged) | 478 if (layersChanged) |
| 466 needHierarchyAndGeometryUpdate = true; | 479 needHierarchyAndGeometryUpdate = true; |
| 467 } | 480 } |
| 468 | 481 |
| 469 if (needHierarchyAndGeometryUpdate) { | 482 if (needHierarchyAndGeometryUpdate) { |
| 470 // Update the hierarchy of the compositing layers. | 483 // Update the hierarchy of the compositing layers. |
| 471 Vector<GraphicsLayer*> childList; | 484 Vector<GraphicsLayer*> childList; |
| 472 { | 485 { |
| 473 TRACE_EVENT0("blink_rendering", "GraphicsLayerUpdater::rebuildTree")
; | 486 TRACE_EVENT0("blink_rendering", "GraphicsLayerUpdater::rebuildTree")
; |
| 474 GraphicsLayerUpdater(*m_renderView).rebuildTree(*updateRoot, childLi
st, 0); | 487 GraphicsLayerUpdater(*m_renderView).rebuildTree(*updateRoot, updateT
ype, childList, 0); |
| 475 } | 488 } |
| 476 | 489 |
| 477 // Host the document layer in the RenderView's root layer. | 490 // Host the document layer in the RenderView's root layer. |
| 478 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && isMainFra
me()) { | 491 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && isMainFra
me()) { |
| 479 RenderVideo* video = findFullscreenVideoRenderer(m_renderView->docum
ent()); | 492 RenderVideo* video = findFullscreenVideoRenderer(m_renderView->docum
ent()); |
| 480 if (video && video->hasCompositedLayerMapping()) { | 493 if (video && video->hasCompositedLayerMapping()) { |
| 481 childList.clear(); | 494 childList.clear(); |
| 482 childList.append(video->compositedLayerMapping()->mainGraphicsLa
yer()); | 495 childList.append(video->compositedLayerMapping()->mainGraphicsLa
yer()); |
| 483 } | 496 } |
| 484 } | 497 } |
| 485 | 498 |
| 486 if (childList.isEmpty()) | 499 if (childList.isEmpty()) |
| 487 destroyRootLayer(); | 500 destroyRootLayer(); |
| 488 else | 501 else |
| 489 m_rootContentLayer->setChildren(childList); | 502 m_rootContentLayer->setChildren(childList); |
| 490 } else if (needGeometryUpdate) { | 503 } else if (needGeometryUpdate) { |
| 491 // We just need to do a geometry update. This is only used for position:
fixed scrolling; | 504 // We just need to do a geometry update. This is only used for position:
fixed scrolling; |
| 492 // most of the time, geometry is updated via RenderLayer::styleChanged()
. | 505 // most of the time, geometry is updated via RenderLayer::styleChanged()
. |
| 493 TRACE_EVENT0("blink_rendering", "GraphicsLayerUpdater::updateRecursive")
; | 506 TRACE_EVENT0("blink_rendering", "GraphicsLayerUpdater::updateRecursive")
; |
| 494 GraphicsLayerUpdater(*m_renderView).updateRecursive(*updateRoot); | 507 GraphicsLayerUpdater(*m_renderView).updateRecursive(*updateRoot, updateT
ype); |
| 495 } | 508 } |
| 496 | 509 |
| 497 ASSERT(updateRoot || !m_compositingLayersNeedRebuild); | 510 ASSERT(updateRoot || !m_compositingLayersNeedRebuild); |
| 498 | 511 |
| 499 if (!hasAcceleratedCompositing()) | 512 if (!hasAcceleratedCompositing()) |
| 500 enableCompositingMode(false); | 513 enableCompositingMode(false); |
| 501 | 514 |
| 502 // The scrolling coordinator may realize that it needs updating while compos
iting was being updated in this function. | 515 // The scrolling coordinator may realize that it needs updating while compos
iting was being updated in this function. |
| 503 needsToUpdateScrollingCoordinator |= scrollingCoordinator() ? scrollingCoord
inator()->needsToUpdateAfterCompositingChange() : false; | 516 needsToUpdateScrollingCoordinator |= scrollingCoordinator() ? scrollingCoord
inator()->needsToUpdateAfterCompositingChange() : false; |
| 504 if (needsToUpdateScrollingCoordinator && isMainFrame() && scrollingCoordinat
or() && inCompositingMode()) | 517 if (needsToUpdateScrollingCoordinator && isMainFrame() && scrollingCoordinat
or() && inCompositingMode()) |
| (...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1392 if (layer->hasCompositedLayerMapping()) { | 1405 if (layer->hasCompositedLayerMapping()) { |
| 1393 CompositedLayerMappingPtr compositedLayerMapping = layer->composited
LayerMapping(); | 1406 CompositedLayerMappingPtr compositedLayerMapping = layer->composited
LayerMapping(); |
| 1394 compositedLayerMapping->updateCompositedBounds(); | 1407 compositedLayerMapping->updateCompositedBounds(); |
| 1395 | 1408 |
| 1396 if (layer->reflectionInfo()) { | 1409 if (layer->reflectionInfo()) { |
| 1397 RenderLayer* reflectionLayer = layer->reflectionInfo()->reflecti
onLayer(); | 1410 RenderLayer* reflectionLayer = layer->reflectionInfo()->reflecti
onLayer(); |
| 1398 if (reflectionLayer->hasCompositedLayerMapping()) | 1411 if (reflectionLayer->hasCompositedLayerMapping()) |
| 1399 reflectionLayer->compositedLayerMapping()->updateCompositedB
ounds(); | 1412 reflectionLayer->compositedLayerMapping()->updateCompositedB
ounds(); |
| 1400 } | 1413 } |
| 1401 | 1414 |
| 1402 compositedLayerMapping->updateGraphicsLayerGeometry(); | 1415 compositedLayerMapping->updateGraphicsLayerGeometry(GraphicsLayerUpd
ater::ForceUpdate); |
| 1403 if (compositedChildrenOnly) | 1416 if (compositedChildrenOnly) |
| 1404 return; | 1417 return; |
| 1405 } | 1418 } |
| 1406 } | 1419 } |
| 1407 | 1420 |
| 1408 if (layer->reflectionInfo()) | 1421 if (layer->reflectionInfo()) |
| 1409 updateCompositingDescendantGeometry(compositingAncestor, layer->reflecti
onInfo()->reflectionLayer(), compositedChildrenOnly); | 1422 updateCompositingDescendantGeometry(compositingAncestor, layer->reflecti
onInfo()->reflectionLayer(), compositedChildrenOnly); |
| 1410 | 1423 |
| 1411 if (!layer->hasCompositingDescendant()) | 1424 if (!layer->hasCompositingDescendant()) |
| 1412 return; | 1425 return; |
| (...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2231 } else if (graphicsLayer == m_scrollLayer.get()) { | 2244 } else if (graphicsLayer == m_scrollLayer.get()) { |
| 2232 name = "LocalFrame Scrolling Layer"; | 2245 name = "LocalFrame Scrolling Layer"; |
| 2233 } else { | 2246 } else { |
| 2234 ASSERT_NOT_REACHED(); | 2247 ASSERT_NOT_REACHED(); |
| 2235 } | 2248 } |
| 2236 | 2249 |
| 2237 return name; | 2250 return name; |
| 2238 } | 2251 } |
| 2239 | 2252 |
| 2240 } // namespace WebCore | 2253 } // namespace WebCore |
| OLD | NEW |