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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 #endif | 195 #endif |
196 }; | 196 }; |
197 | 197 |
198 RenderLayerCompositor::RenderLayerCompositor(RenderView& renderView) | 198 RenderLayerCompositor::RenderLayerCompositor(RenderView& renderView) |
199 : m_renderView(renderView) | 199 : m_renderView(renderView) |
200 , m_compositingReasonFinder(renderView) | 200 , m_compositingReasonFinder(renderView) |
201 , m_pendingUpdateType(CompositingUpdateNone) | 201 , m_pendingUpdateType(CompositingUpdateNone) |
202 , m_hasAcceleratedCompositing(true) | 202 , m_hasAcceleratedCompositing(true) |
203 , m_showRepaintCounter(false) | 203 , m_showRepaintCounter(false) |
204 , m_needsToRecomputeCompositingRequirements(false) | 204 , m_needsToRecomputeCompositingRequirements(false) |
205 , m_needsToUpdateLayerTreeGeometry(false) | |
206 , m_compositing(false) | 205 , m_compositing(false) |
207 , m_compositingLayersNeedRebuild(false) | 206 , m_compositingLayersNeedRebuild(false) |
208 , m_forceCompositingMode(false) | 207 , m_forceCompositingMode(false) |
209 , m_needsUpdateCompositingRequirementsState(false) | 208 , m_needsUpdateCompositingRequirementsState(false) |
210 , m_isTrackingRepaints(false) | 209 , m_isTrackingRepaints(false) |
211 , m_rootLayerAttachment(RootLayerUnattached) | 210 , m_rootLayerAttachment(RootLayerUnattached) |
212 { | 211 { |
213 } | 212 } |
214 | 213 |
215 RenderLayerCompositor::~RenderLayerCompositor() | 214 RenderLayerCompositor::~RenderLayerCompositor() |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 return; | 360 return; |
362 | 361 |
363 m_pendingUpdateType = std::max(m_pendingUpdateType, updateType); | 362 m_pendingUpdateType = std::max(m_pendingUpdateType, updateType); |
364 | 363 |
365 switch (updateType) { | 364 switch (updateType) { |
366 case CompositingUpdateNone: | 365 case CompositingUpdateNone: |
367 ASSERT_NOT_REACHED(); | 366 ASSERT_NOT_REACHED(); |
368 break; | 367 break; |
369 case CompositingUpdateAfterStyleChange: | 368 case CompositingUpdateAfterStyleChange: |
370 m_needsToRecomputeCompositingRequirements = true; | 369 m_needsToRecomputeCompositingRequirements = true; |
371 m_needsToUpdateLayerTreeGeometry = true; | |
372 break; | 370 break; |
373 case CompositingUpdateAfterLayout: | 371 case CompositingUpdateAfterLayout: |
374 m_needsToRecomputeCompositingRequirements = true; | 372 m_needsToRecomputeCompositingRequirements = true; |
375 m_needsToUpdateLayerTreeGeometry = true; | |
376 break; | 373 break; |
377 case CompositingUpdateOnScroll: | 374 case CompositingUpdateOnScroll: |
378 m_needsToRecomputeCompositingRequirements = true; // Overlap can change
with scrolling, so need to check for hierarchy updates. | 375 m_needsToRecomputeCompositingRequirements = true; // Overlap can change
with scrolling, so need to check for hierarchy updates. |
379 m_needsToUpdateLayerTreeGeometry = true; | |
380 break; | 376 break; |
381 case CompositingUpdateOnCompositedScroll: | 377 case CompositingUpdateOnCompositedScroll: |
382 m_needsToUpdateLayerTreeGeometry = true; | |
383 break; | |
384 case CompositingUpdateAfterCanvasContextChange: | 378 case CompositingUpdateAfterCanvasContextChange: |
385 m_needsToUpdateLayerTreeGeometry = true; | |
386 break; | 379 break; |
387 } | 380 } |
388 | 381 |
389 page()->animator().scheduleVisualUpdate(); | 382 page()->animator().scheduleVisualUpdate(); |
390 } | 383 } |
391 | 384 |
392 static void clearAncestorDependentPropertyCacheRecursive(RenderLayer* layer) | 385 static void clearAncestorDependentPropertyCacheRecursive(RenderLayer* layer) |
393 { | 386 { |
394 layer->clearAncestorDependentPropertyCache(); | 387 layer->clearAncestorDependentPropertyCache(); |
395 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), AllChildren
); | 388 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), AllChildren
); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 if (childCompositor && childCompositor->hasUnresolvedDirtyBits()) { | 425 if (childCompositor && childCompositor->hasUnresolvedDirtyBits()) { |
433 m_renderView.frameView()->scheduleAnimation(); | 426 m_renderView.frameView()->scheduleAnimation(); |
434 return; | 427 return; |
435 } | 428 } |
436 } | 429 } |
437 } | 430 } |
438 } | 431 } |
439 | 432 |
440 bool RenderLayerCompositor::hasUnresolvedDirtyBits() | 433 bool RenderLayerCompositor::hasUnresolvedDirtyBits() |
441 { | 434 { |
442 return m_needsToRecomputeCompositingRequirements || m_compositingLayersNeedR
ebuild || m_needsToUpdateLayerTreeGeometry || m_needsUpdateCompositingRequiremen
tsState || m_pendingUpdateType > CompositingUpdateNone; | 435 return m_needsToRecomputeCompositingRequirements || m_compositingLayersNeedR
ebuild || m_needsUpdateCompositingRequirementsState || m_pendingUpdateType > Com
positingUpdateNone; |
443 } | 436 } |
444 | 437 |
445 void RenderLayerCompositor::updateCompositingLayersInternal() | 438 void RenderLayerCompositor::updateCompositingLayersInternal() |
446 { | 439 { |
447 if (isMainFrame() && m_renderView.frameView()) | 440 if (isMainFrame() && m_renderView.frameView()) |
448 finishCompositingUpdateForFrameTree(&m_renderView.frameView()->frame()); | 441 finishCompositingUpdateForFrameTree(&m_renderView.frameView()->frame()); |
449 | 442 |
450 if (m_forceCompositingMode && !m_compositing) | 443 if (m_forceCompositingMode && !m_compositing) |
451 enableCompositingMode(true); | 444 enableCompositingMode(true); |
452 | 445 |
453 if (!m_needsToRecomputeCompositingRequirements && !m_compositing) | 446 if (!m_needsToRecomputeCompositingRequirements && !m_compositing) |
454 return; | 447 return; |
455 | 448 |
456 CompositingUpdateType updateType = m_pendingUpdateType; | 449 CompositingUpdateType updateType = m_pendingUpdateType; |
457 | 450 |
458 bool needCompositingRequirementsUpdate = m_needsToRecomputeCompositingRequir
ements; | 451 bool needCompositingRequirementsUpdate = m_needsToRecomputeCompositingRequir
ements; |
459 bool needHierarchyAndGeometryUpdate = m_compositingLayersNeedRebuild; | 452 bool needHierarchyAndGeometryUpdate = m_compositingLayersNeedRebuild; |
460 bool needGeometryUpdate = m_needsToUpdateLayerTreeGeometry; | |
461 bool needsToUpdateScrollingCoordinator = scrollingCoordinator() ? scrollingC
oordinator()->needsToUpdateAfterCompositingChange() : false; | 453 bool needsToUpdateScrollingCoordinator = scrollingCoordinator() ? scrollingC
oordinator()->needsToUpdateAfterCompositingChange() : false; |
462 | 454 |
463 if (!needCompositingRequirementsUpdate && !needHierarchyAndGeometryUpdate &&
!needGeometryUpdate && !needsToUpdateScrollingCoordinator) | 455 if (updateType == CompositingUpdateNone && !needCompositingRequirementsUpdat
e && !needHierarchyAndGeometryUpdate && !needsToUpdateScrollingCoordinator) |
464 return; | 456 return; |
465 | 457 |
466 m_pendingUpdateType = CompositingUpdateNone; | 458 m_pendingUpdateType = CompositingUpdateNone; |
467 | 459 |
468 GraphicsLayerUpdater::UpdateType graphicsLayerUpdateType = GraphicsLayerUpda
ter::DoNotForceUpdate; | 460 GraphicsLayerUpdater::UpdateType graphicsLayerUpdateType = GraphicsLayerUpda
ter::DoNotForceUpdate; |
469 CompositingPropertyUpdater::UpdateType compositingPropertyUpdateType = Compo
sitingPropertyUpdater::DoNotForceUpdate; | 461 CompositingPropertyUpdater::UpdateType compositingPropertyUpdateType = Compo
sitingPropertyUpdater::DoNotForceUpdate; |
470 | 462 |
471 // FIXME: Teach non-style compositing updates how to do partial tree walks. | 463 // FIXME: Teach non-style compositing updates how to do partial tree walks. |
472 if (updateType >= CompositingUpdateAfterLayout) { | 464 if (updateType >= CompositingUpdateAfterLayout) { |
473 graphicsLayerUpdateType = GraphicsLayerUpdater::ForceUpdate; | 465 graphicsLayerUpdateType = GraphicsLayerUpdater::ForceUpdate; |
474 compositingPropertyUpdateType = CompositingPropertyUpdater::ForceUpdate; | 466 compositingPropertyUpdateType = CompositingPropertyUpdater::ForceUpdate; |
475 } | 467 } |
476 | 468 |
477 // Only clear the flags if we're updating the entire hierarchy. | 469 // Only clear the flags if we're updating the entire hierarchy. |
478 m_compositingLayersNeedRebuild = false; | 470 m_compositingLayersNeedRebuild = false; |
479 m_needsToUpdateLayerTreeGeometry = false; | |
480 m_needsToRecomputeCompositingRequirements = false; | 471 m_needsToRecomputeCompositingRequirements = false; |
481 | 472 |
482 RenderLayer* updateRoot = rootRenderLayer(); | 473 RenderLayer* updateRoot = rootRenderLayer(); |
483 | 474 |
484 if (needCompositingRequirementsUpdate) { | 475 if (needCompositingRequirementsUpdate) { |
485 // Go through the layers in presentation order, so that we can compute w
hich RenderLayers need compositing layers. | 476 // Go through the layers in presentation order, so that we can compute w
hich RenderLayers need compositing layers. |
486 // FIXME: we could maybe do this and the hierarchy udpate in one pass, b
ut the parenting logic would be more complex. | 477 // FIXME: we could maybe do this and the hierarchy udpate in one pass, b
ut the parenting logic would be more complex. |
487 CompositingRecursionData recursionData(updateRoot, 0, true); | 478 CompositingRecursionData recursionData(updateRoot, 0, true); |
488 bool layersChanged = false; | 479 bool layersChanged = false; |
489 bool saw3DTransform = false; | 480 bool saw3DTransform = false; |
(...skipping 30 matching lines...) Expand all Loading... |
520 if (scrollableAreas) { | 511 if (scrollableAreas) { |
521 for (FrameView::ScrollableAreaSet::iterator it = scrollableAreas
->begin(); it != scrollableAreas->end(); ++it) | 512 for (FrameView::ScrollableAreaSet::iterator it = scrollableAreas
->begin(); it != scrollableAreas->end(); ++it) |
522 (*it)->updateHasVisibleNonLayerContent(); | 513 (*it)->updateHasVisibleNonLayerContent(); |
523 } | 514 } |
524 } | 515 } |
525 | 516 |
526 if (layersChanged) | 517 if (layersChanged) |
527 needHierarchyAndGeometryUpdate = true; | 518 needHierarchyAndGeometryUpdate = true; |
528 } | 519 } |
529 | 520 |
530 if (needGeometryUpdate || needHierarchyAndGeometryUpdate) { | 521 if (updateType >= CompositingUpdateAfterStyleChange || needHierarchyAndGeome
tryUpdate) { |
531 TRACE_EVENT0("blink_rendering", "GraphicsLayerUpdater::updateRecursive")
; | 522 TRACE_EVENT0("blink_rendering", "GraphicsLayerUpdater::updateRecursive")
; |
532 GraphicsLayerUpdater().update(*updateRoot, graphicsLayerUpdateType); | 523 GraphicsLayerUpdater().update(*updateRoot, graphicsLayerUpdateType); |
533 #if !ASSERT_DISABLED | 524 #if !ASSERT_DISABLED |
534 // FIXME: Move this check to the end of the compositing update. | 525 // FIXME: Move this check to the end of the compositing update. |
535 GraphicsLayerUpdater::assertNeedsToUpdateGraphicsLayerBitsCleared(*updat
eRoot); | 526 GraphicsLayerUpdater::assertNeedsToUpdateGraphicsLayerBitsCleared(*updat
eRoot); |
536 #endif | 527 #endif |
537 } | 528 } |
538 | 529 |
539 if (needHierarchyAndGeometryUpdate) { | 530 if (needHierarchyAndGeometryUpdate) { |
540 // Update the hierarchy of the compositing layers. | 531 // Update the hierarchy of the compositing layers. |
(...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2109 } else if (graphicsLayer == m_scrollLayer.get()) { | 2100 } else if (graphicsLayer == m_scrollLayer.get()) { |
2110 name = "LocalFrame Scrolling Layer"; | 2101 name = "LocalFrame Scrolling Layer"; |
2111 } else { | 2102 } else { |
2112 ASSERT_NOT_REACHED(); | 2103 ASSERT_NOT_REACHED(); |
2113 } | 2104 } |
2114 | 2105 |
2115 return name; | 2106 return name; |
2116 } | 2107 } |
2117 | 2108 |
2118 } // namespace WebCore | 2109 } // namespace WebCore |
OLD | NEW |