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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
191 bool m_hasUnisolatedCompositedBlendingDescendant; | 191 bool m_hasUnisolatedCompositedBlendingDescendant; |
192 bool m_testingOverlap; | 192 bool m_testingOverlap; |
193 #ifndef NDEBUG | 193 #ifndef NDEBUG |
194 int m_depth; | 194 int m_depth; |
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_hasAcceleratedCompositing(true) | 202 , m_hasAcceleratedCompositing(true) |
202 , m_showRepaintCounter(false) | 203 , m_showRepaintCounter(false) |
203 , m_needsToRecomputeCompositingRequirements(false) | 204 , m_needsToRecomputeCompositingRequirements(false) |
204 , m_needsToUpdateLayerTreeGeometry(false) | 205 , m_needsToUpdateLayerTreeGeometry(false) |
205 , m_pendingUpdateType(GraphicsLayerUpdater::DoNotForceUpdate) | |
206 , m_pendingPropertyUpdateType(CompositingPropertyUpdater::DoNotForceUpdate) | |
207 , m_compositing(false) | 206 , m_compositing(false) |
208 , m_compositingLayersNeedRebuild(false) | 207 , m_compositingLayersNeedRebuild(false) |
209 , m_forceCompositingMode(false) | 208 , m_forceCompositingMode(false) |
210 , m_needsUpdateCompositingRequirementsState(false) | 209 , m_needsUpdateCompositingRequirementsState(false) |
211 , m_isTrackingRepaints(false) | 210 , m_isTrackingRepaints(false) |
212 , m_rootLayerAttachment(RootLayerUnattached) | 211 , m_rootLayerAttachment(RootLayerUnattached) |
213 { | 212 { |
214 } | 213 } |
215 | 214 |
216 RenderLayerCompositor::~RenderLayerCompositor() | 215 RenderLayerCompositor::~RenderLayerCompositor() |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
353 // Avoid updating the layers with old values. Compositing layers will be upd ated after the layout is finished. | 352 // Avoid updating the layers with old values. Compositing layers will be upd ated after the layout is finished. |
354 if (m_renderView.needsLayout()) | 353 if (m_renderView.needsLayout()) |
355 return; | 354 return; |
356 | 355 |
357 if (m_forceCompositingMode && !m_compositing) | 356 if (m_forceCompositingMode && !m_compositing) |
358 enableCompositingMode(true); | 357 enableCompositingMode(true); |
359 | 358 |
360 if (!m_needsToRecomputeCompositingRequirements && !m_compositing) | 359 if (!m_needsToRecomputeCompositingRequirements && !m_compositing) |
361 return; | 360 return; |
362 | 361 |
362 m_pendingUpdateType = std::max(m_pendingUpdateType, updateType); | |
363 | |
363 switch (updateType) { | 364 switch (updateType) { |
365 case CompositingUpdateNone: | |
366 ASSERT_NOT_REACHED(); | |
esprehn
2014/04/01 00:13:15
Lets put this also at the top of the function as A
| |
367 break; | |
364 case CompositingUpdateAfterStyleChange: | 368 case CompositingUpdateAfterStyleChange: |
365 m_needsToRecomputeCompositingRequirements = true; | 369 m_needsToRecomputeCompositingRequirements = true; |
366 break; | 370 break; |
367 case CompositingUpdateAfterLayout: | 371 case CompositingUpdateAfterLayout: |
368 m_needsToRecomputeCompositingRequirements = true; | 372 m_needsToRecomputeCompositingRequirements = true; |
369 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't need a ForceUpdate here. | |
370 m_pendingUpdateType = GraphicsLayerUpdater::ForceUpdate; | |
371 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't need a ForceUpdate here. | |
372 m_pendingPropertyUpdateType = CompositingPropertyUpdater::ForceUpdate; | |
373 break; | 373 break; |
374 case CompositingUpdateOnScroll: | 374 case CompositingUpdateOnScroll: |
375 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. |
376 m_needsToUpdateLayerTreeGeometry = true; | 376 m_needsToUpdateLayerTreeGeometry = true; |
377 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't need a ForceUpdate here. | |
378 m_pendingUpdateType = GraphicsLayerUpdater::ForceUpdate; | |
379 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't need a ForceUpdate here. | |
380 m_pendingPropertyUpdateType = CompositingPropertyUpdater::ForceUpdate; | |
381 break; | 377 break; |
382 case CompositingUpdateOnCompositedScroll: | 378 case CompositingUpdateOnCompositedScroll: |
383 m_needsToUpdateLayerTreeGeometry = true; | 379 m_needsToUpdateLayerTreeGeometry = true; |
384 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't need a ForceUpdate here. | |
385 m_pendingUpdateType = GraphicsLayerUpdater::ForceUpdate; | |
386 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't need a ForceUpdate here. | |
387 m_pendingPropertyUpdateType = CompositingPropertyUpdater::ForceUpdate; | |
388 break; | 380 break; |
389 case CompositingUpdateAfterCanvasContextChange: | 381 case CompositingUpdateAfterCanvasContextChange: |
390 m_needsToUpdateLayerTreeGeometry = true; | 382 m_needsToUpdateLayerTreeGeometry = true; |
391 break; | 383 break; |
392 } | 384 } |
393 | 385 |
394 page()->animator().scheduleVisualUpdate(); | 386 page()->animator().scheduleVisualUpdate(); |
395 } | 387 } |
396 | 388 |
397 static void clearAncestorDependentPropertyCacheRecursive(RenderLayer* layer) | 389 static void clearAncestorDependentPropertyCacheRecursive(RenderLayer* layer) |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
437 if (childCompositor && childCompositor->hasUnresolvedDirtyBits()) { | 429 if (childCompositor && childCompositor->hasUnresolvedDirtyBits()) { |
438 m_renderView.frameView()->scheduleAnimation(); | 430 m_renderView.frameView()->scheduleAnimation(); |
439 return; | 431 return; |
440 } | 432 } |
441 } | 433 } |
442 } | 434 } |
443 } | 435 } |
444 | 436 |
445 bool RenderLayerCompositor::hasUnresolvedDirtyBits() | 437 bool RenderLayerCompositor::hasUnresolvedDirtyBits() |
446 { | 438 { |
447 return m_needsToRecomputeCompositingRequirements || m_compositingLayersNeedR ebuild || m_needsToUpdateLayerTreeGeometry || m_needsUpdateCompositingRequiremen tsState || m_pendingUpdateType != GraphicsLayerUpdater::DoNotForceUpdate; | 439 return m_needsToRecomputeCompositingRequirements || m_compositingLayersNeedR ebuild || m_needsToUpdateLayerTreeGeometry || m_needsUpdateCompositingRequiremen tsState || m_pendingUpdateType > CompositingUpdateNone; |
448 } | 440 } |
449 | 441 |
450 void RenderLayerCompositor::updateCompositingLayersInternal() | 442 void RenderLayerCompositor::updateCompositingLayersInternal() |
451 { | 443 { |
452 if (isMainFrame() && m_renderView.frameView()) | 444 if (isMainFrame() && m_renderView.frameView()) |
453 finishCompositingUpdateForFrameTree(&m_renderView.frameView()->frame()); | 445 finishCompositingUpdateForFrameTree(&m_renderView.frameView()->frame()); |
454 | 446 |
455 if (m_forceCompositingMode && !m_compositing) | 447 if (m_forceCompositingMode && !m_compositing) |
456 enableCompositingMode(true); | 448 enableCompositingMode(true); |
457 | 449 |
458 if (!m_needsToRecomputeCompositingRequirements && !m_compositing) | 450 if (!m_needsToRecomputeCompositingRequirements && !m_compositing) |
459 return; | 451 return; |
460 | 452 |
453 CompositingUpdateType updateType = m_pendingUpdateType; | |
454 | |
461 bool needCompositingRequirementsUpdate = m_needsToRecomputeCompositingRequir ements; | 455 bool needCompositingRequirementsUpdate = m_needsToRecomputeCompositingRequir ements; |
462 bool needHierarchyAndGeometryUpdate = m_compositingLayersNeedRebuild; | 456 bool needHierarchyAndGeometryUpdate = m_compositingLayersNeedRebuild; |
463 bool needGeometryUpdate = m_needsToUpdateLayerTreeGeometry; | 457 bool needGeometryUpdate = m_needsToUpdateLayerTreeGeometry; |
464 bool needsToUpdateScrollingCoordinator = scrollingCoordinator() ? scrollingC oordinator()->needsToUpdateAfterCompositingChange() : false; | 458 bool needsToUpdateScrollingCoordinator = scrollingCoordinator() ? scrollingC oordinator()->needsToUpdateAfterCompositingChange() : false; |
465 | 459 |
466 if (!needCompositingRequirementsUpdate && !needHierarchyAndGeometryUpdate && !needGeometryUpdate && !needsToUpdateScrollingCoordinator) | 460 if (!needCompositingRequirementsUpdate && !needHierarchyAndGeometryUpdate && !needGeometryUpdate && !needsToUpdateScrollingCoordinator) |
467 return; | 461 return; |
468 | 462 |
469 GraphicsLayerUpdater::UpdateType updateType = m_pendingUpdateType; | 463 m_pendingUpdateType = CompositingUpdateNone; |
464 | |
465 GraphicsLayerUpdater::UpdateType graphicsLayerUpdateType = GraphicsLayerUpda ter::DoNotForceUpdate; | |
466 CompositingPropertyUpdater::UpdateType compositingPropertyUpdateType = Compo sitingPropertyUpdater::DoNotForceUpdate; | |
467 | |
468 // FIXME: Teach non-style compositing updates how to do partial tree walks. | |
469 if (updateType >= CompositingUpdateAfterLayout) { | |
470 graphicsLayerUpdateType = GraphicsLayerUpdater::ForceUpdate; | |
471 compositingPropertyUpdateType = CompositingPropertyUpdater::ForceUpdate; | |
472 } | |
470 | 473 |
471 // Only clear the flags if we're updating the entire hierarchy. | 474 // Only clear the flags if we're updating the entire hierarchy. |
472 m_compositingLayersNeedRebuild = false; | 475 m_compositingLayersNeedRebuild = false; |
473 m_needsToUpdateLayerTreeGeometry = false; | 476 m_needsToUpdateLayerTreeGeometry = false; |
474 m_needsToRecomputeCompositingRequirements = false; | 477 m_needsToRecomputeCompositingRequirements = false; |
475 m_pendingUpdateType = GraphicsLayerUpdater::DoNotForceUpdate; | |
476 | 478 |
477 RenderLayer* updateRoot = rootRenderLayer(); | 479 RenderLayer* updateRoot = rootRenderLayer(); |
478 | 480 |
479 if (needCompositingRequirementsUpdate) { | 481 if (needCompositingRequirementsUpdate) { |
480 // Go through the layers in presentation order, so that we can compute w hich RenderLayers need compositing layers. | 482 // Go through the layers in presentation order, so that we can compute w hich RenderLayers need compositing layers. |
481 // FIXME: we could maybe do this and the hierarchy udpate in one pass, b ut the parenting logic would be more complex. | 483 // FIXME: we could maybe do this and the hierarchy udpate in one pass, b ut the parenting logic would be more complex. |
482 CompositingRecursionData recursionData(updateRoot, 0, true); | 484 CompositingRecursionData recursionData(updateRoot, 0, true); |
483 bool layersChanged = false; | 485 bool layersChanged = false; |
484 bool saw3DTransform = false; | 486 bool saw3DTransform = false; |
485 | 487 |
486 { | 488 { |
487 TRACE_EVENT0("blink_rendering", "CompositingPropertyUpdater::updateA ncestorDependentProperties"); | 489 TRACE_EVENT0("blink_rendering", "CompositingPropertyUpdater::updateA ncestorDependentProperties"); |
488 CompositingPropertyUpdater(updateRoot).updateAncestorDependentProper ties(updateRoot, m_pendingPropertyUpdateType, 0); | 490 CompositingPropertyUpdater(updateRoot).updateAncestorDependentProper ties(updateRoot, compositingPropertyUpdateType, 0); |
489 m_pendingPropertyUpdateType = CompositingPropertyUpdater::DoNotForce Update; | |
490 #if !ASSERT_DISABLED | 491 #if !ASSERT_DISABLED |
491 CompositingPropertyUpdater::assertNeedsToUpdateAncestorDependantProp ertiesBitsCleared(updateRoot); | 492 CompositingPropertyUpdater::assertNeedsToUpdateAncestorDependantProp ertiesBitsCleared(updateRoot); |
492 #endif | 493 #endif |
493 } | 494 } |
494 | 495 |
495 { | 496 { |
496 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::computeCompo sitingRequirements"); | 497 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::computeCompo sitingRequirements"); |
497 OverlapMap overlapTestRequestMap; | 498 OverlapMap overlapTestRequestMap; |
498 | 499 |
499 // FIXME: Passing these unclippedDescendants down and keeping track | 500 // FIXME: Passing these unclippedDescendants down and keeping track |
(...skipping 18 matching lines...) Expand all Loading... | |
518 (*it)->updateHasVisibleNonLayerContent(); | 519 (*it)->updateHasVisibleNonLayerContent(); |
519 } | 520 } |
520 } | 521 } |
521 | 522 |
522 if (layersChanged) | 523 if (layersChanged) |
523 needHierarchyAndGeometryUpdate = true; | 524 needHierarchyAndGeometryUpdate = true; |
524 } | 525 } |
525 | 526 |
526 if (needGeometryUpdate || needHierarchyAndGeometryUpdate) { | 527 if (needGeometryUpdate || needHierarchyAndGeometryUpdate) { |
527 TRACE_EVENT0("blink_rendering", "GraphicsLayerUpdater::updateRecursive") ; | 528 TRACE_EVENT0("blink_rendering", "GraphicsLayerUpdater::updateRecursive") ; |
528 GraphicsLayerUpdater().update(*updateRoot, updateType); | 529 GraphicsLayerUpdater().update(*updateRoot, graphicsLayerUpdateType); |
529 #if !ASSERT_DISABLED | 530 #if !ASSERT_DISABLED |
530 // FIXME: Move this check to the end of the compositing update. | 531 // FIXME: Move this check to the end of the compositing update. |
531 GraphicsLayerUpdater::assertNeedsToUpdateGraphicsLayerBitsCleared(*updat eRoot); | 532 GraphicsLayerUpdater::assertNeedsToUpdateGraphicsLayerBitsCleared(*updat eRoot); |
532 #endif | 533 #endif |
533 } | 534 } |
534 | 535 |
535 if (needHierarchyAndGeometryUpdate) { | 536 if (needHierarchyAndGeometryUpdate) { |
536 // Update the hierarchy of the compositing layers. | 537 // Update the hierarchy of the compositing layers. |
537 GraphicsLayerVector childList; | 538 GraphicsLayerVector childList; |
538 { | 539 { |
(...skipping 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2150 } else if (graphicsLayer == m_scrollLayer.get()) { | 2151 } else if (graphicsLayer == m_scrollLayer.get()) { |
2151 name = "LocalFrame Scrolling Layer"; | 2152 name = "LocalFrame Scrolling Layer"; |
2152 } else { | 2153 } else { |
2153 ASSERT_NOT_REACHED(); | 2154 ASSERT_NOT_REACHED(); |
2154 } | 2155 } |
2155 | 2156 |
2156 return name; | 2157 return name; |
2157 } | 2158 } |
2158 | 2159 |
2159 } // namespace WebCore | 2160 } // namespace WebCore |
OLD | NEW |