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