| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 return false; | 222 return false; |
| 223 #endif | 223 #endif |
| 224 } | 224 } |
| 225 | 225 |
| 226 RenderLayerCompositor::RenderLayerCompositor(RenderView* renderView) | 226 RenderLayerCompositor::RenderLayerCompositor(RenderView* renderView) |
| 227 : m_renderView(renderView) | 227 : m_renderView(renderView) |
| 228 , m_hasAcceleratedCompositing(true) | 228 , m_hasAcceleratedCompositing(true) |
| 229 , m_compositingTriggers(static_cast<ChromeClient::CompositingTriggerFlags>(C
hromeClient::AllTriggers)) | 229 , m_compositingTriggers(static_cast<ChromeClient::CompositingTriggerFlags>(C
hromeClient::AllTriggers)) |
| 230 , m_compositedLayerCount(0) | 230 , m_compositedLayerCount(0) |
| 231 , m_showRepaintCounter(false) | 231 , m_showRepaintCounter(false) |
| 232 , m_needsToRecomputeCompositingRequirements(false) | 232 , m_reevaluateCompositingAfterLayout(false) |
| 233 , m_needsToUpdateLayerTreeGeometry(false) | |
| 234 , m_compositing(false) | 233 , m_compositing(false) |
| 235 , m_compositingLayersNeedRebuild(false) | 234 , m_compositingLayersNeedRebuild(false) |
| 236 , m_forceCompositingMode(false) | 235 , m_forceCompositingMode(false) |
| 237 , m_inPostLayoutUpdate(false) | 236 , m_inPostLayoutUpdate(false) |
| 238 , m_needsUpdateCompositingRequirementsState(false) | 237 , m_needsUpdateCompositingRequirementsState(false) |
| 239 , m_isTrackingRepaints(false) | 238 , m_isTrackingRepaints(false) |
| 240 , m_rootLayerAttachment(RootLayerUnattached) | 239 , m_rootLayerAttachment(RootLayerUnattached) |
| 241 #if !LOG_DISABLED | 240 #if !LOG_DISABLED |
| 242 , m_rootLayerUpdateCount(0) | 241 , m_rootLayerUpdateCount(0) |
| 243 , m_obligateCompositedLayerCount(0) | 242 , m_obligateCompositedLayerCount(0) |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 fullscreenElement = FullscreenElementStack::currentFullScreenElementFrom
(document); | 364 fullscreenElement = FullscreenElementStack::currentFullScreenElementFrom
(document); |
| 366 } | 365 } |
| 367 if (!fullscreenElement || !isHTMLVideoElement(fullscreenElement)) | 366 if (!fullscreenElement || !isHTMLVideoElement(fullscreenElement)) |
| 368 return 0; | 367 return 0; |
| 369 RenderObject* renderer = fullscreenElement->renderer(); | 368 RenderObject* renderer = fullscreenElement->renderer(); |
| 370 if (!renderer) | 369 if (!renderer) |
| 371 return 0; | 370 return 0; |
| 372 return toRenderVideo(renderer); | 371 return toRenderVideo(renderer); |
| 373 } | 372 } |
| 374 | 373 |
| 375 void RenderLayerCompositor::finishCompositingUpdateForFrameTree(Frame* frame) | |
| 376 { | |
| 377 for (Frame* child = frame->tree().firstChild(); child; child = child->tree()
.nextSibling()) | |
| 378 finishCompositingUpdateForFrameTree(child); | |
| 379 | |
| 380 // Update compositing for current frame after all descendant frames are upda
ted. | |
| 381 if (frame && frame->contentRenderer()) { | |
| 382 RenderLayerCompositor* frameCompositor = frame->contentRenderer()->compo
sitor(); | |
| 383 if (frameCompositor && !frameCompositor->isMainFrame()) | |
| 384 frame->contentRenderer()->compositor()->updateCompositingLayers(Comp
ositingUpdateFinishAllDeferredWork); | |
| 385 } | |
| 386 } | |
| 387 | |
| 388 void RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType update
Type, RenderLayer* updateRoot) | 374 void RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType update
Type, RenderLayer* updateRoot) |
| 389 { | 375 { |
| 390 // Avoid updating the layers with old values. Compositing layers will be upd
ated after the layout is finished. | 376 // Avoid updating the layers with old values. Compositing layers will be upd
ated after the layout is finished. |
| 391 if (m_renderView->needsLayout()) | 377 if (m_renderView->needsLayout()) |
| 392 return; | 378 return; |
| 393 | 379 |
| 394 if (updateType == CompositingUpdateFinishAllDeferredWork && isMainFrame() &&
m_renderView->frameView()) | |
| 395 finishCompositingUpdateForFrameTree(&m_renderView->frameView()->frame())
; | |
| 396 | |
| 397 if (m_forceCompositingMode && !m_compositing) | 380 if (m_forceCompositingMode && !m_compositing) |
| 398 enableCompositingMode(true); | 381 enableCompositingMode(true); |
| 399 | 382 |
| 400 if (!m_needsToRecomputeCompositingRequirements && !m_compositing) | 383 if (!m_reevaluateCompositingAfterLayout && !m_compositing) |
| 401 return; | 384 return; |
| 402 | 385 |
| 403 AnimationUpdateBlock animationUpdateBlock(m_renderView->frameView()->frame()
.animation()); | 386 AnimationUpdateBlock animationUpdateBlock(m_renderView->frameView()->frame()
.animation()); |
| 404 | 387 |
| 405 TemporaryChange<bool> postLayoutChange(m_inPostLayoutUpdate, true); | 388 TemporaryChange<bool> postLayoutChange(m_inPostLayoutUpdate, true); |
| 406 | 389 |
| 407 bool needCompositingRequirementsUpdate = false; | 390 bool checkForHierarchyUpdate = m_reevaluateCompositingAfterLayout; |
| 408 bool needHierarchyAndGeometryUpdate = false; | |
| 409 bool needGeometryUpdate = false; | 391 bool needGeometryUpdate = false; |
| 410 bool needsToUpdateScrollingCoordinator = false; | |
| 411 | 392 |
| 412 // CompositingUpdateFinishAllDeferredWork is the only updateType that will a
ctually do any work in this | |
| 413 // function. All other updateTypes will simply mark that something needed up
dating, and defer the actual | |
| 414 // update. This way we only need to compute all compositing state once for e
very frame drawn (if needed). | |
| 415 switch (updateType) { | 393 switch (updateType) { |
| 416 case CompositingUpdateAfterStyleChange: | 394 case CompositingUpdateAfterStyleChange: |
| 417 case CompositingUpdateAfterLayout: | 395 case CompositingUpdateAfterLayout: |
| 418 m_needsToRecomputeCompositingRequirements = true; | 396 checkForHierarchyUpdate = true; |
| 419 break; | 397 break; |
| 420 case CompositingUpdateOnScroll: | 398 case CompositingUpdateOnScroll: |
| 421 m_needsToRecomputeCompositingRequirements = true; // Overlap can change
with scrolling, so need to check for hierarchy updates. | 399 checkForHierarchyUpdate = true; // Overlap can change with scrolling, so
need to check for hierarchy updates. |
| 422 m_needsToUpdateLayerTreeGeometry = true; | 400 needGeometryUpdate = true; |
| 423 break; | 401 break; |
| 424 case CompositingUpdateOnCompositedScroll: | 402 case CompositingUpdateOnCompositedScroll: |
| 425 m_needsToUpdateLayerTreeGeometry = true; | 403 needGeometryUpdate = true; |
| 426 break; | |
| 427 case CompositingUpdateFinishAllDeferredWork: | |
| 428 needCompositingRequirementsUpdate = m_needsToRecomputeCompositingRequire
ments; | |
| 429 needHierarchyAndGeometryUpdate = m_compositingLayersNeedRebuild; | |
| 430 needGeometryUpdate = m_needsToUpdateLayerTreeGeometry; | |
| 431 needsToUpdateScrollingCoordinator = scrollingCoordinator() ? scrollingCo
ordinator()->needsToUpdateAfterCompositingChange() : false; | |
| 432 break; | 404 break; |
| 433 } | 405 } |
| 434 | 406 |
| 435 if (!needCompositingRequirementsUpdate && !needHierarchyAndGeometryUpdate &&
!needGeometryUpdate && !needsToUpdateScrollingCoordinator) | 407 if (!checkForHierarchyUpdate && !needGeometryUpdate) |
| 436 return; | 408 return; |
| 437 | 409 |
| 438 ASSERT(updateType == CompositingUpdateFinishAllDeferredWork); | 410 bool needHierarchyUpdate = m_compositingLayersNeedRebuild; |
| 439 | |
| 440 bool isFullUpdate = !updateRoot; | 411 bool isFullUpdate = !updateRoot; |
| 441 | 412 |
| 442 // Only clear the flags if we're updating the entire hierarchy. | 413 // Only clear the flag if we're updating the entire hierarchy. |
| 443 m_compositingLayersNeedRebuild = false; | 414 m_compositingLayersNeedRebuild = false; |
| 444 m_needsToUpdateLayerTreeGeometry = false; | |
| 445 updateRoot = rootRenderLayer(); | 415 updateRoot = rootRenderLayer(); |
| 446 | 416 |
| 447 if (isFullUpdate) | 417 if (isFullUpdate && updateType == CompositingUpdateAfterLayout) |
| 448 m_needsToRecomputeCompositingRequirements = false; | 418 m_reevaluateCompositingAfterLayout = false; |
| 449 | 419 |
| 450 #if !LOG_DISABLED | 420 #if !LOG_DISABLED |
| 451 double startTime = 0; | 421 double startTime = 0; |
| 452 if (compositingLogEnabled()) { | 422 if (compositingLogEnabled()) { |
| 453 ++m_rootLayerUpdateCount; | 423 ++m_rootLayerUpdateCount; |
| 454 startTime = currentTime(); | 424 startTime = currentTime(); |
| 455 } | 425 } |
| 456 #endif | 426 #endif |
| 457 | 427 |
| 458 if (needCompositingRequirementsUpdate) { | 428 if (checkForHierarchyUpdate) { |
| 459 // 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. |
| 460 // 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. |
| 461 CompositingRecursionData recursionData(updateRoot, true); | 431 CompositingRecursionData recursionData(updateRoot, true); |
| 462 bool layersChanged = false; | 432 bool layersChanged = false; |
| 463 bool saw3DTransform = false; | 433 bool saw3DTransform = false; |
| 464 { | 434 { |
| 465 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::computeCompo
sitingRequirements"); | 435 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::computeCompo
sitingRequirements"); |
| 466 OverlapMap overlapTestRequestMap; | 436 OverlapMap overlapTestRequestMap; |
| 467 | 437 |
| 468 // FIXME: Passing these unclippedDescendants down and keeping track | 438 // FIXME: Passing these unclippedDescendants down and keeping track |
| 469 // of them dynamically, we are requiring a full tree walk. This | 439 // of them dynamically, we are requiring a full tree walk. This |
| 470 // should be removed as soon as proper overlap testing based on | 440 // should be removed as soon as proper overlap testing based on |
| 471 // scrolling and animation bounds is implemented (crbug.com/252472). | 441 // scrolling and animation bounds is implemented (crbug.com/252472). |
| 472 Vector<RenderLayer*> unclippedDescendants; | 442 Vector<RenderLayer*> unclippedDescendants; |
| 473 computeCompositingRequirements(0, updateRoot, &overlapTestRequestMap
, recursionData, layersChanged, saw3DTransform, unclippedDescendants); | 443 computeCompositingRequirements(0, updateRoot, &overlapTestRequestMap
, recursionData, layersChanged, saw3DTransform, unclippedDescendants); |
| 474 | 444 |
| 475 const FrameView::ScrollableAreaSet* scrollableAreas = m_renderView->
frameView()->scrollableAreas(); | 445 const FrameView::ScrollableAreaSet* scrollableAreas = m_renderView->
frameView()->scrollableAreas(); |
| 476 if (scrollableAreas) { | 446 if (scrollableAreas) { |
| 477 for (FrameView::ScrollableAreaSet::iterator it = scrollableAreas
->begin(); it != scrollableAreas->end(); ++it) | 447 for (FrameView::ScrollableAreaSet::iterator it = scrollableAreas
->begin(); it != scrollableAreas->end(); ++it) |
| 478 (*it)->updateHasVisibleNonLayerContent(); | 448 (*it)->updateHasVisibleNonLayerContent(); |
| 479 } | 449 } |
| 480 } | 450 } |
| 481 needHierarchyAndGeometryUpdate |= layersChanged; | 451 needHierarchyUpdate |= layersChanged; |
| 482 } | 452 } |
| 483 | 453 |
| 484 #if !LOG_DISABLED | 454 #if !LOG_DISABLED |
| 485 if (compositingLogEnabled() && isFullUpdate && (needHierarchyAndGeometryUpda
te || needGeometryUpdate)) { | 455 if (compositingLogEnabled() && isFullUpdate && (needHierarchyUpdate || needG
eometryUpdate)) { |
| 486 m_obligateCompositedLayerCount = 0; | 456 m_obligateCompositedLayerCount = 0; |
| 487 m_secondaryCompositedLayerCount = 0; | 457 m_secondaryCompositedLayerCount = 0; |
| 488 m_obligatoryBackingStoreBytes = 0; | 458 m_obligatoryBackingStoreBytes = 0; |
| 489 m_secondaryBackingStoreBytes = 0; | 459 m_secondaryBackingStoreBytes = 0; |
| 490 | 460 |
| 491 Frame& frame = m_renderView->frameView()->frame(); | 461 Frame& frame = m_renderView->frameView()->frame(); |
| 492 LOG(Compositing, "\nUpdate %d of %s.\n", m_rootLayerUpdateCount, isMainF
rame() ? "main frame" : frame.tree().uniqueName().string().utf8().data()); | 462 LOG(Compositing, "\nUpdate %d of %s.\n", m_rootLayerUpdateCount, isMainF
rame() ? "main frame" : frame.tree().uniqueName().string().utf8().data()); |
| 493 } | 463 } |
| 494 #endif | 464 #endif |
| 495 | 465 |
| 496 if (needHierarchyAndGeometryUpdate) { | 466 if (needHierarchyUpdate) { |
| 497 // Update the hierarchy of the compositing layers. | 467 // Update the hierarchy of the compositing layers. |
| 498 Vector<GraphicsLayer*> childList; | 468 Vector<GraphicsLayer*> childList; |
| 499 { | 469 { |
| 500 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::rebuildCompo
sitingLayerTree"); | 470 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::rebuildCompo
sitingLayerTree"); |
| 501 rebuildCompositingLayerTree(updateRoot, childList, 0); | 471 rebuildCompositingLayerTree(updateRoot, childList, 0); |
| 502 } | 472 } |
| 503 | 473 |
| 504 // Host the document layer in the RenderView's root layer. | 474 // Host the document layer in the RenderView's root layer. |
| 505 if (isFullUpdate) { | 475 if (isFullUpdate) { |
| 506 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && isMai
nFrame()) { | 476 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && isMai
nFrame()) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 520 else | 490 else |
| 521 m_rootContentLayer->setChildren(childList); | 491 m_rootContentLayer->setChildren(childList); |
| 522 } | 492 } |
| 523 } else if (needGeometryUpdate) { | 493 } else if (needGeometryUpdate) { |
| 524 // We just need to do a geometry update. This is only used for position:
fixed scrolling; | 494 // We just need to do a geometry update. This is only used for position:
fixed scrolling; |
| 525 // most of the time, geometry is updated via RenderLayer::styleChanged()
. | 495 // most of the time, geometry is updated via RenderLayer::styleChanged()
. |
| 526 updateLayerTreeGeometry(updateRoot, 0); | 496 updateLayerTreeGeometry(updateRoot, 0); |
| 527 } | 497 } |
| 528 | 498 |
| 529 #if !LOG_DISABLED | 499 #if !LOG_DISABLED |
| 530 if (compositingLogEnabled() && isFullUpdate && (needHierarchyAndGeometryUpda
te || needGeometryUpdate)) { | 500 if (compositingLogEnabled() && isFullUpdate && (needHierarchyUpdate || needG
eometryUpdate)) { |
| 531 double endTime = currentTime(); | 501 double endTime = currentTime(); |
| 532 LOG(Compositing, "Total layers primary secondary obligatory backin
g (KB) secondary backing(KB) total backing (KB) update time (ms)\n"); | 502 LOG(Compositing, "Total layers primary secondary obligatory backin
g (KB) secondary backing(KB) total backing (KB) update time (ms)\n"); |
| 533 | 503 |
| 534 LOG(Compositing, "%8d %11d %9d %20.2f %22.2f %22.2f %18.2f\n", | 504 LOG(Compositing, "%8d %11d %9d %20.2f %22.2f %22.2f %18.2f\n", |
| 535 m_obligateCompositedLayerCount + m_secondaryCompositedLayerCount, m_
obligateCompositedLayerCount, | 505 m_obligateCompositedLayerCount + m_secondaryCompositedLayerCount, m_
obligateCompositedLayerCount, |
| 536 m_secondaryCompositedLayerCount, m_obligatoryBackingStoreBytes / 102
4, m_secondaryBackingStoreBytes / 1024, (m_obligatoryBackingStoreBytes + m_secon
daryBackingStoreBytes) / 1024, 1000.0 * (endTime - startTime)); | 506 m_secondaryCompositedLayerCount, m_obligatoryBackingStoreBytes / 102
4, m_secondaryBackingStoreBytes / 1024, (m_obligatoryBackingStoreBytes + m_secon
daryBackingStoreBytes) / 1024, 1000.0 * (endTime - startTime)); |
| 537 } | 507 } |
| 538 #endif | 508 #endif |
| 539 ASSERT(updateRoot || !m_compositingLayersNeedRebuild); | 509 ASSERT(updateRoot || !m_compositingLayersNeedRebuild); |
| 540 | 510 |
| 541 if (!hasAcceleratedCompositing()) | 511 if (!hasAcceleratedCompositing()) |
| 542 enableCompositingMode(false); | 512 enableCompositingMode(false); |
| 543 | 513 |
| 544 // The scrolling coordinator may realize that it needs updating while compos
iting was being updated in this function. | |
| 545 needsToUpdateScrollingCoordinator |= scrollingCoordinator() ? scrollingCoord
inator()->needsToUpdateAfterCompositingChange() : false; | |
| 546 if (needsToUpdateScrollingCoordinator && isMainFrame() && scrollingCoordinat
or() && inCompositingMode()) | |
| 547 scrollingCoordinator()->updateAfterCompositingChange(); | |
| 548 | |
| 549 // Inform the inspector that the layer tree has changed. | 514 // Inform the inspector that the layer tree has changed. |
| 550 if (isMainFrame()) | 515 InspectorInstrumentation::layerTreeDidChange(page()); |
| 551 InspectorInstrumentation::layerTreeDidChange(page()); | |
| 552 } | 516 } |
| 553 | 517 |
| 554 void RenderLayerCompositor::layerBecameNonComposited(const RenderLayer* renderLa
yer) | 518 void RenderLayerCompositor::layerBecameNonComposited(const RenderLayer* renderLa
yer) |
| 555 { | 519 { |
| 556 ASSERT(m_compositedLayerCount > 0); | 520 ASSERT(m_compositedLayerCount > 0); |
| 557 --m_compositedLayerCount; | 521 --m_compositedLayerCount; |
| 558 } | 522 } |
| 559 | 523 |
| 560 static bool requiresCompositing(CompositingReasons reasons) | 524 static bool requiresCompositing(CompositingReasons reasons) |
| 561 { | 525 { |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 | 1096 |
| 1133 if (!layer->parent()) | 1097 if (!layer->parent()) |
| 1134 updateRootLayerPosition(); | 1098 updateRootLayerPosition(); |
| 1135 | 1099 |
| 1136 #if !LOG_DISABLED | 1100 #if !LOG_DISABLED |
| 1137 logLayerInfo(layer, depth); | 1101 logLayerInfo(layer, depth); |
| 1138 #else | 1102 #else |
| 1139 UNUSED_PARAM(depth); | 1103 UNUSED_PARAM(depth); |
| 1140 #endif | 1104 #endif |
| 1141 if (currentCompositedLayerMapping->hasUnpositionedOverflowControlsLayers
()) | 1105 if (currentCompositedLayerMapping->hasUnpositionedOverflowControlsLayers
()) |
| 1142 layer->scrollableArea()->positionOverflowControls(); | 1106 layer->scrollableArea()->positionNewlyCreatedOverflowControls(); |
| 1143 | 1107 |
| 1144 pixelsWithoutPromotingAllTransitions += layer->size().height() * layer->
size().width(); | 1108 pixelsWithoutPromotingAllTransitions += layer->size().height() * layer->
size().width(); |
| 1145 } else { | 1109 } else { |
| 1146 if ((layer->renderer()->style()->transitionForProperty(CSSPropertyOpacit
y) || | 1110 if ((layer->renderer()->style()->transitionForProperty(CSSPropertyOpacit
y) || |
| 1147 layer->renderer()->style()->transitionForProperty(CSSPropertyWebkit
Transform)) && | 1111 layer->renderer()->style()->transitionForProperty(CSSPropertyWebkit
Transform)) && |
| 1148 m_renderView->viewRect().intersects(layer->absoluteBoundingBox())) | 1112 m_renderView->viewRect().intersects(layer->absoluteBoundingBox())) |
| 1149 pixelsAddedByPromotingAllTransitions += layer->size().height() * lay
er->size().width(); | 1113 pixelsAddedByPromotingAllTransitions += layer->size().height() * lay
er->size().width(); |
| 1150 } | 1114 } |
| 1151 | 1115 |
| 1152 // If this layer has a compositedLayerMapping, then that is where we place s
ubsequent children GraphicsLayers. | 1116 // If this layer has a compositedLayerMapping, then that is where we place s
ubsequent children GraphicsLayers. |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1305 | 1269 |
| 1306 bool RenderLayerCompositor::scrollingLayerDidChange(RenderLayer* layer) | 1270 bool RenderLayerCompositor::scrollingLayerDidChange(RenderLayer* layer) |
| 1307 { | 1271 { |
| 1308 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(
)) | 1272 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(
)) |
| 1309 return scrollingCoordinator->scrollableAreaScrollLayerDidChange(layer->s
crollableArea()); | 1273 return scrollingCoordinator->scrollableAreaScrollLayerDidChange(layer->s
crollableArea()); |
| 1310 return false; | 1274 return false; |
| 1311 } | 1275 } |
| 1312 | 1276 |
| 1313 String RenderLayerCompositor::layerTreeAsText(LayerTreeFlags flags) | 1277 String RenderLayerCompositor::layerTreeAsText(LayerTreeFlags flags) |
| 1314 { | 1278 { |
| 1315 // Before dumping the layer tree, finish any pending compositing update. | 1279 updateCompositingLayers(CompositingUpdateAfterLayout); |
| 1316 updateCompositingLayers(CompositingUpdateFinishAllDeferredWork); | |
| 1317 | 1280 |
| 1318 if (!m_rootContentLayer) | 1281 if (!m_rootContentLayer) |
| 1319 return String(); | 1282 return String(); |
| 1320 | 1283 |
| 1321 // We skip dumping the scroll and clip layers to keep layerTreeAsText output | 1284 // We skip dumping the scroll and clip layers to keep layerTreeAsText output |
| 1322 // similar between platforms (unless we explicitly request dumping from the | 1285 // similar between platforms (unless we explicitly request dumping from the |
| 1323 // root. | 1286 // root. |
| 1324 GraphicsLayer* rootLayer = m_rootContentLayer.get(); | 1287 GraphicsLayer* rootLayer = m_rootContentLayer.get(); |
| 1325 if (flags & LayerTreeIncludesRootLayer) | 1288 if (flags & LayerTreeIncludesRootLayer) |
| 1326 rootLayer = rootGraphicsLayer(); | 1289 rootLayer = rootGraphicsLayer(); |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1844 | 1807 |
| 1845 bool RenderLayerCompositor::requiresCompositingForPlugin(RenderObject* renderer)
const | 1808 bool RenderLayerCompositor::requiresCompositingForPlugin(RenderObject* renderer)
const |
| 1846 { | 1809 { |
| 1847 if (!(m_compositingTriggers & ChromeClient::PluginTrigger)) | 1810 if (!(m_compositingTriggers & ChromeClient::PluginTrigger)) |
| 1848 return false; | 1811 return false; |
| 1849 | 1812 |
| 1850 bool composite = renderer->isEmbeddedObject() && toRenderEmbeddedObject(rend
erer)->allowsAcceleratedCompositing(); | 1813 bool composite = renderer->isEmbeddedObject() && toRenderEmbeddedObject(rend
erer)->allowsAcceleratedCompositing(); |
| 1851 if (!composite) | 1814 if (!composite) |
| 1852 return false; | 1815 return false; |
| 1853 | 1816 |
| 1854 // FIXME: this seems bogus. If we don't know the layout position/size of the
plugin yet, would't that be handled elsewhere? | 1817 m_reevaluateCompositingAfterLayout = true; |
| 1855 m_needsToRecomputeCompositingRequirements = true; | |
| 1856 | 1818 |
| 1857 RenderWidget* pluginRenderer = toRenderWidget(renderer); | 1819 RenderWidget* pluginRenderer = toRenderWidget(renderer); |
| 1858 // If we can't reliably know the size of the plugin yet, don't change compos
iting state. | 1820 // If we can't reliably know the size of the plugin yet, don't change compos
iting state. |
| 1859 if (pluginRenderer->needsLayout()) | 1821 if (pluginRenderer->needsLayout()) |
| 1860 return pluginRenderer->hasLayer() && pluginRenderer->layer()->composited
LayerMapping(); | 1822 return pluginRenderer->hasLayer() && pluginRenderer->layer()->composited
LayerMapping(); |
| 1861 | 1823 |
| 1862 // Don't go into compositing mode if height or width are zero, or size is 1x
1. | 1824 // Don't go into compositing mode if height or width are zero, or size is 1x
1. |
| 1863 IntRect contentBox = pixelSnappedIntRect(pluginRenderer->contentBoxRect()); | 1825 IntRect contentBox = pixelSnappedIntRect(pluginRenderer->contentBoxRect()); |
| 1864 return contentBox.height() * contentBox.width() > 1; | 1826 return contentBox.height() * contentBox.width() > 1; |
| 1865 } | 1827 } |
| 1866 | 1828 |
| 1867 bool RenderLayerCompositor::requiresCompositingForFrame(RenderObject* renderer)
const | 1829 bool RenderLayerCompositor::requiresCompositingForFrame(RenderObject* renderer)
const |
| 1868 { | 1830 { |
| 1869 if (!renderer->isRenderPart()) | 1831 if (!renderer->isRenderPart()) |
| 1870 return false; | 1832 return false; |
| 1871 | 1833 |
| 1872 RenderPart* frameRenderer = toRenderPart(renderer); | 1834 RenderPart* frameRenderer = toRenderPart(renderer); |
| 1873 | 1835 |
| 1874 if (!frameRenderer->requiresAcceleratedCompositing()) | 1836 if (!frameRenderer->requiresAcceleratedCompositing()) |
| 1875 return false; | 1837 return false; |
| 1876 | 1838 |
| 1877 // FIXME: this seems bogus. If we don't know the layout position/size of the
frame yet, wouldn't that be handled elsehwere? | 1839 m_reevaluateCompositingAfterLayout = true; |
| 1878 m_needsToRecomputeCompositingRequirements = true; | |
| 1879 | 1840 |
| 1880 RenderLayerCompositor* innerCompositor = frameContentsCompositor(frameRender
er); | 1841 RenderLayerCompositor* innerCompositor = frameContentsCompositor(frameRender
er); |
| 1881 if (!innerCompositor) | 1842 if (!innerCompositor) |
| 1882 return false; | 1843 return false; |
| 1883 | 1844 |
| 1884 // If we can't reliably know the size of the iframe yet, don't change compos
iting state. | 1845 // If we can't reliably know the size of the iframe yet, don't change compos
iting state. |
| 1885 if (renderer->needsLayout()) | 1846 if (renderer->needsLayout()) |
| 1886 return frameRenderer->hasLayer() && frameRenderer->layer()->compositedLa
yerMapping(); | 1847 return frameRenderer->hasLayer() && frameRenderer->layer()->compositedLa
yerMapping(); |
| 1887 | 1848 |
| 1888 // Don't go into compositing mode if height or width are zero. | 1849 // Don't go into compositing mode if height or width are zero. |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2005 if (!settings->acceleratedCompositingForFixedPositionEnabled()) | 1966 if (!settings->acceleratedCompositingForFixedPositionEnabled()) |
| 2006 return false; | 1967 return false; |
| 2007 } | 1968 } |
| 2008 | 1969 |
| 2009 if (isSticky) | 1970 if (isSticky) |
| 2010 return true; | 1971 return true; |
| 2011 | 1972 |
| 2012 RenderObject* container = renderer->container(); | 1973 RenderObject* container = renderer->container(); |
| 2013 // If the renderer is not hooked up yet then we have to wait until it is. | 1974 // If the renderer is not hooked up yet then we have to wait until it is. |
| 2014 if (!container) { | 1975 if (!container) { |
| 2015 m_needsToRecomputeCompositingRequirements = true; | 1976 m_reevaluateCompositingAfterLayout = true; |
| 2016 return false; | 1977 return false; |
| 2017 } | 1978 } |
| 2018 | 1979 |
| 2019 // Don't promote fixed position elements that are descendants of a non-view
container, e.g. transformed elements. | 1980 // Don't promote fixed position elements that are descendants of a non-view
container, e.g. transformed elements. |
| 2020 // They will stay fixed wrt the container rather than the enclosing frame. | 1981 // They will stay fixed wrt the container rather than the enclosing frame. |
| 2021 if (container != m_renderView) { | 1982 if (container != m_renderView) { |
| 2022 if (viewportConstrainedNotCompositedReason) | 1983 if (viewportConstrainedNotCompositedReason) |
| 2023 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited
ForNonViewContainer; | 1984 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited
ForNonViewContainer; |
| 2024 return false; | 1985 return false; |
| 2025 } | 1986 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2045 } | 2006 } |
| 2046 | 2007 |
| 2047 if (!hasScrollableAncestor) { | 2008 if (!hasScrollableAncestor) { |
| 2048 if (viewportConstrainedNotCompositedReason) | 2009 if (viewportConstrainedNotCompositedReason) |
| 2049 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited
ForUnscrollableAncestors; | 2010 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited
ForUnscrollableAncestors; |
| 2050 return false; | 2011 return false; |
| 2051 } | 2012 } |
| 2052 | 2013 |
| 2053 // Subsequent tests depend on layout. If we can't tell now, just keep things
the way they are until layout is done. | 2014 // Subsequent tests depend on layout. If we can't tell now, just keep things
the way they are until layout is done. |
| 2054 if (!m_inPostLayoutUpdate) { | 2015 if (!m_inPostLayoutUpdate) { |
| 2055 m_needsToRecomputeCompositingRequirements = true; | 2016 m_reevaluateCompositingAfterLayout = true; |
| 2056 return layer->compositedLayerMapping(); | 2017 return layer->compositedLayerMapping(); |
| 2057 } | 2018 } |
| 2058 | 2019 |
| 2059 bool paintsContent = layer->isVisuallyNonEmpty() || layer->hasVisibleDescend
ant(); | 2020 bool paintsContent = layer->isVisuallyNonEmpty() || layer->hasVisibleDescend
ant(); |
| 2060 if (!paintsContent) { | 2021 if (!paintsContent) { |
| 2061 if (viewportConstrainedNotCompositedReason) | 2022 if (viewportConstrainedNotCompositedReason) |
| 2062 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited
ForNoVisibleContent; | 2023 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited
ForNoVisibleContent; |
| 2063 return false; | 2024 return false; |
| 2064 } | 2025 } |
| 2065 | 2026 |
| 2066 // Fixed position elements that are invisible in the current view don't get
their own layer. | 2027 // Fixed position elements that are invisible in the current view don't get
their own layer. |
| 2067 if (FrameView* frameView = m_renderView->frameView()) { | 2028 if (FrameView* frameView = m_renderView->frameView()) { |
| 2068 LayoutRect viewBounds = frameView->viewportConstrainedVisibleContentRect
(); | 2029 LayoutRect viewBounds = frameView->viewportConstrainedVisibleContentRect
(); |
| 2069 LayoutRect layerBounds = layer->calculateLayerBounds(rootRenderLayer(),
0, | 2030 LayoutRect layerBounds = layer->calculateLayerBounds(rootRenderLayer(),
0, |
| 2070 RenderLayer::DefaultCalculateLayerBoundsFlags | 2031 RenderLayer::DefaultCalculateLayerBoundsFlags |
| 2071 | RenderLayer::ExcludeHiddenDescendants | 2032 | RenderLayer::ExcludeHiddenDescendants |
| 2072 | RenderLayer::DontConstrainForMask | 2033 | RenderLayer::DontConstrainForMask |
| 2073 | RenderLayer::IncludeCompositedDescendants | 2034 | RenderLayer::IncludeCompositedDescendants |
| 2074 | RenderLayer::PretendLayerHasOwnBacking); | 2035 | RenderLayer::PretendLayerHasOwnBacking); |
| 2075 if (!viewBounds.intersects(enclosingIntRect(layerBounds))) { | 2036 if (!viewBounds.intersects(enclosingIntRect(layerBounds))) { |
| 2076 if (viewportConstrainedNotCompositedReason) { | 2037 if (viewportConstrainedNotCompositedReason) { |
| 2077 *viewportConstrainedNotCompositedReason = RenderLayer::NotCompos
itedForBoundsOutOfView; | 2038 *viewportConstrainedNotCompositedReason = RenderLayer::NotCompos
itedForBoundsOutOfView; |
| 2078 m_needsToRecomputeCompositingRequirements = true; | 2039 m_reevaluateCompositingAfterLayout = true; |
| 2079 } | 2040 } |
| 2080 return false; | 2041 return false; |
| 2081 } | 2042 } |
| 2082 } | 2043 } |
| 2083 | 2044 |
| 2084 return true; | 2045 return true; |
| 2085 } | 2046 } |
| 2086 | 2047 |
| 2087 bool RenderLayerCompositor::requiresCompositingForOverflowScrolling(const Render
Layer* layer) const | 2048 bool RenderLayerCompositor::requiresCompositingForOverflowScrolling(const Render
Layer* layer) const |
| 2088 { | 2049 { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2186 } | 2147 } |
| 2187 | 2148 |
| 2188 void RenderLayerCompositor::resetTrackedRepaintRects() | 2149 void RenderLayerCompositor::resetTrackedRepaintRects() |
| 2189 { | 2150 { |
| 2190 if (GraphicsLayer* rootLayer = rootGraphicsLayer()) | 2151 if (GraphicsLayer* rootLayer = rootGraphicsLayer()) |
| 2191 resetTrackedRepaintRectsRecursive(rootLayer); | 2152 resetTrackedRepaintRectsRecursive(rootLayer); |
| 2192 } | 2153 } |
| 2193 | 2154 |
| 2194 void RenderLayerCompositor::setTracksRepaints(bool tracksRepaints) | 2155 void RenderLayerCompositor::setTracksRepaints(bool tracksRepaints) |
| 2195 { | 2156 { |
| 2196 updateCompositingLayers(CompositingUpdateFinishAllDeferredWork); | |
| 2197 m_isTrackingRepaints = tracksRepaints; | 2157 m_isTrackingRepaints = tracksRepaints; |
| 2198 } | 2158 } |
| 2199 | 2159 |
| 2200 bool RenderLayerCompositor::isTrackingRepaints() const | 2160 bool RenderLayerCompositor::isTrackingRepaints() const |
| 2201 { | 2161 { |
| 2202 return m_isTrackingRepaints; | 2162 return m_isTrackingRepaints; |
| 2203 } | 2163 } |
| 2204 | 2164 |
| 2205 void RenderLayerCompositor::didCommitChangesForLayer(const GraphicsLayer*) const | 2165 void RenderLayerCompositor::didCommitChangesForLayer(const GraphicsLayer*) const |
| 2206 { | 2166 { |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2668 } else if (graphicsLayer == m_scrollLayer.get()) { | 2628 } else if (graphicsLayer == m_scrollLayer.get()) { |
| 2669 name = "Frame Scrolling Layer"; | 2629 name = "Frame Scrolling Layer"; |
| 2670 } else { | 2630 } else { |
| 2671 ASSERT_NOT_REACHED(); | 2631 ASSERT_NOT_REACHED(); |
| 2672 } | 2632 } |
| 2673 | 2633 |
| 2674 return name; | 2634 return name; |
| 2675 } | 2635 } |
| 2676 | 2636 |
| 2677 } // namespace WebCore | 2637 } // namespace WebCore |
| OLD | NEW |