Chromium Code Reviews| 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 217 return false; | 217 return false; |
| 218 #endif | 218 #endif |
| 219 } | 219 } |
| 220 | 220 |
| 221 RenderLayerCompositor::RenderLayerCompositor(RenderView* renderView) | 221 RenderLayerCompositor::RenderLayerCompositor(RenderView* renderView) |
| 222 : m_renderView(renderView) | 222 : m_renderView(renderView) |
| 223 , m_hasAcceleratedCompositing(true) | 223 , m_hasAcceleratedCompositing(true) |
| 224 , m_compositingTriggers(static_cast<ChromeClient::CompositingTriggerFlags>(C hromeClient::AllTriggers)) | 224 , m_compositingTriggers(static_cast<ChromeClient::CompositingTriggerFlags>(C hromeClient::AllTriggers)) |
| 225 , m_compositedLayerCount(0) | 225 , m_compositedLayerCount(0) |
| 226 , m_showRepaintCounter(false) | 226 , m_showRepaintCounter(false) |
| 227 , m_reevaluateCompositingAfterLayout(false) | 227 , m_needsToRecomputeCompositingRequirements(false) |
| 228 , m_needsToUpdateLayerTreeGeometry(false) | |
| 228 , m_compositing(false) | 229 , m_compositing(false) |
| 229 , m_compositingLayersNeedRebuild(false) | 230 , m_compositingLayersNeedRebuild(false) |
| 230 , m_forceCompositingMode(false) | 231 , m_forceCompositingMode(false) |
| 231 , m_inPostLayoutUpdate(false) | 232 , m_inPostLayoutUpdate(false) |
| 232 , m_needsUpdateCompositingRequirementsState(false) | 233 , m_needsUpdateCompositingRequirementsState(false) |
| 233 , m_isTrackingRepaints(false) | 234 , m_isTrackingRepaints(false) |
| 234 , m_rootLayerAttachment(RootLayerUnattached) | 235 , m_rootLayerAttachment(RootLayerUnattached) |
| 235 #if !LOG_DISABLED | 236 #if !LOG_DISABLED |
| 236 , m_rootLayerUpdateCount(0) | 237 , m_rootLayerUpdateCount(0) |
| 237 , m_obligateCompositedLayerCount(0) | 238 , m_obligateCompositedLayerCount(0) |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 363 fullscreenElement = FullscreenElementStack::currentFullScreenElementFrom (document); | 364 fullscreenElement = FullscreenElementStack::currentFullScreenElementFrom (document); |
| 364 } | 365 } |
| 365 if (!fullscreenElement || !isHTMLVideoElement(fullscreenElement)) | 366 if (!fullscreenElement || !isHTMLVideoElement(fullscreenElement)) |
| 366 return 0; | 367 return 0; |
| 367 RenderObject* renderer = fullscreenElement->renderer(); | 368 RenderObject* renderer = fullscreenElement->renderer(); |
| 368 if (!renderer) | 369 if (!renderer) |
| 369 return 0; | 370 return 0; |
| 370 return toRenderVideo(renderer); | 371 return toRenderVideo(renderer); |
| 371 } | 372 } |
| 372 | 373 |
| 374 void RenderLayerCompositor::finishCompositingUpdateForFrameTree(Frame* frame) | |
| 375 { | |
| 376 for (Frame* child = frame->tree()->firstChild(); child; child = child->tree( )->nextSibling()) | |
| 377 finishCompositingUpdateForFrameTree(child); | |
| 378 | |
| 379 // Update compositing for current frame after all descedant frames are updat ed. | |
| 380 if (!isMainFrame() && frame && frame->contentRenderer() && frame->contentRen derer()->compositor()) | |
|
shawnsingh
2013/10/16 06:52:19
checking !isMainFrame() is incorrect here. The wa
| |
| 381 frame->contentRenderer()->compositor()->updateCompositingLayers(Composit ingUpdateFinishAllDeferredWork); | |
| 382 } | |
| 383 | |
| 373 void RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType update Type, RenderLayer* updateRoot) | 384 void RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType update Type, RenderLayer* updateRoot) |
| 374 { | 385 { |
| 375 // Avoid updating the layers with old values. Compositing layers will be upd ated after the layout is finished. | 386 // Avoid updating the layers with old values. Compositing layers will be upd ated after the layout is finished. |
| 376 if (m_renderView->needsLayout()) | 387 if (m_renderView->needsLayout()) |
| 377 return; | 388 return; |
| 378 | 389 |
| 379 if (m_forceCompositingMode && !m_compositing) | 390 if (m_forceCompositingMode && !m_compositing) |
| 380 enableCompositingMode(true); | 391 enableCompositingMode(true); |
| 381 | 392 |
| 382 if (!m_reevaluateCompositingAfterLayout && !m_compositing) | 393 if (!m_needsToRecomputeCompositingRequirements && !m_compositing) |
| 383 return; | 394 return; |
| 384 | 395 |
| 385 AnimationUpdateBlock animationUpdateBlock(m_renderView->frameView()->frame() .animation()); | 396 AnimationUpdateBlock animationUpdateBlock(m_renderView->frameView()->frame() .animation()); |
| 386 | 397 |
| 387 TemporaryChange<bool> postLayoutChange(m_inPostLayoutUpdate, true); | 398 TemporaryChange<bool> postLayoutChange(m_inPostLayoutUpdate, true); |
| 388 | 399 |
| 389 bool checkForHierarchyUpdate = m_reevaluateCompositingAfterLayout; | 400 bool needCompositingRequirementsUpdate = false; |
| 401 bool needHierarchyAndGeometryUpdate = false; | |
| 390 bool needGeometryUpdate = false; | 402 bool needGeometryUpdate = false; |
| 391 | 403 |
| 404 // CompositingUpdateFinishAllDeferredWork is the only updateType that will a ctually do any work in this | |
| 405 // function. All other updateTypes will simply mark that something needed up dating, and defer the actual | |
| 406 // update. This way we only need to compute all compositing state once for e very frame drawn (if needed). | |
| 392 switch (updateType) { | 407 switch (updateType) { |
| 393 case CompositingUpdateAfterStyleChange: | 408 case CompositingUpdateAfterStyleChange: |
| 394 case CompositingUpdateAfterLayout: | 409 case CompositingUpdateAfterLayout: |
| 395 checkForHierarchyUpdate = true; | 410 m_needsToRecomputeCompositingRequirements = true; |
| 396 break; | 411 break; |
| 397 case CompositingUpdateOnScroll: | 412 case CompositingUpdateOnScroll: |
| 398 checkForHierarchyUpdate = true; // Overlap can change with scrolling, so need to check for hierarchy updates. | 413 m_needsToRecomputeCompositingRequirements = true; // Overlap can change with scrolling, so need to check for hierarchy updates. |
| 399 needGeometryUpdate = true; | 414 m_needsToUpdateLayerTreeGeometry = true; |
| 400 break; | 415 break; |
| 401 case CompositingUpdateOnCompositedScroll: | 416 case CompositingUpdateOnCompositedScroll: |
| 402 needGeometryUpdate = true; | 417 m_needsToUpdateLayerTreeGeometry = true; |
| 418 break; | |
| 419 case CompositingUpdateFinishAllDeferredWork: | |
| 420 needCompositingRequirementsUpdate = m_needsToRecomputeCompositingRequire ments; | |
| 421 needHierarchyAndGeometryUpdate = m_compositingLayersNeedRebuild; | |
| 422 needGeometryUpdate = m_needsToUpdateLayerTreeGeometry; | |
| 403 break; | 423 break; |
| 404 } | 424 } |
| 405 | 425 |
| 406 if (!checkForHierarchyUpdate && !needGeometryUpdate) | 426 if (!needCompositingRequirementsUpdate && !needHierarchyAndGeometryUpdate && !needGeometryUpdate) |
| 407 return; | 427 return; |
| 408 | 428 |
| 409 bool needHierarchyUpdate = m_compositingLayersNeedRebuild; | 429 ASSERT(updateType == CompositingUpdateFinishAllDeferredWork); |
| 430 | |
| 431 if (isMainFrame() && m_renderView->frameView()) | |
| 432 finishCompositingUpdateForFrameTree(&m_renderView->frameView()->frame()) ; | |
| 433 | |
| 410 bool isFullUpdate = !updateRoot; | 434 bool isFullUpdate = !updateRoot; |
| 411 | 435 |
| 412 // Only clear the flag if we're updating the entire hierarchy. | 436 // Only clear the flags if we're updating the entire hierarchy. |
| 413 m_compositingLayersNeedRebuild = false; | 437 m_compositingLayersNeedRebuild = false; |
| 438 m_needsToUpdateLayerTreeGeometry = false; | |
| 414 updateRoot = rootRenderLayer(); | 439 updateRoot = rootRenderLayer(); |
| 415 | 440 |
| 416 if (isFullUpdate && updateType == CompositingUpdateAfterLayout) | 441 if (isFullUpdate) |
| 417 m_reevaluateCompositingAfterLayout = false; | 442 m_needsToRecomputeCompositingRequirements = false; |
| 418 | 443 |
| 419 #if !LOG_DISABLED | 444 #if !LOG_DISABLED |
| 420 double startTime = 0; | 445 double startTime = 0; |
| 421 if (compositingLogEnabled()) { | 446 if (compositingLogEnabled()) { |
| 422 ++m_rootLayerUpdateCount; | 447 ++m_rootLayerUpdateCount; |
| 423 startTime = currentTime(); | 448 startTime = currentTime(); |
| 424 } | 449 } |
| 425 #endif | 450 #endif |
| 426 | 451 |
| 427 if (checkForHierarchyUpdate) { | 452 if (needCompositingRequirementsUpdate) { |
| 428 // Go through the layers in presentation order, so that we can compute w hich RenderLayers need compositing layers. | 453 // Go through the layers in presentation order, so that we can compute w hich RenderLayers need compositing layers. |
| 429 // FIXME: we could maybe do this and the hierarchy udpate in one pass, b ut the parenting logic would be more complex. | 454 // FIXME: we could maybe do this and the hierarchy udpate in one pass, b ut the parenting logic would be more complex. |
| 430 CompositingRecursionData recursionData(updateRoot, true); | 455 CompositingRecursionData recursionData(updateRoot, true); |
| 431 bool layersChanged = false; | 456 bool layersChanged = false; |
| 432 bool saw3DTransform = false; | 457 bool saw3DTransform = false; |
| 433 { | 458 { |
| 434 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::computeCompo sitingRequirements"); | 459 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::computeCompo sitingRequirements"); |
| 435 OverlapMap overlapTestRequestMap; | 460 OverlapMap overlapTestRequestMap; |
| 436 | 461 |
| 437 // FIXME: Passing these unclippedDescendants down and keeping track | 462 // FIXME: Passing these unclippedDescendants down and keeping track |
| 438 // of them dynamically, we are requiring a full tree walk. This | 463 // of them dynamically, we are requiring a full tree walk. This |
| 439 // should be removed as soon as proper overlap testing based on | 464 // should be removed as soon as proper overlap testing based on |
| 440 // scrolling and animation bounds is implemented (crbug.com/252472). | 465 // scrolling and animation bounds is implemented (crbug.com/252472). |
| 441 Vector<RenderLayer*> unclippedDescendants; | 466 Vector<RenderLayer*> unclippedDescendants; |
| 442 computeCompositingRequirements(0, updateRoot, &overlapTestRequestMap , recursionData, layersChanged, saw3DTransform, unclippedDescendants); | 467 computeCompositingRequirements(0, updateRoot, &overlapTestRequestMap , recursionData, layersChanged, saw3DTransform, unclippedDescendants); |
| 443 } | 468 } |
| 444 needHierarchyUpdate |= layersChanged; | 469 needHierarchyAndGeometryUpdate |= layersChanged; |
| 445 } | 470 } |
| 446 | 471 |
| 447 #if !LOG_DISABLED | 472 #if !LOG_DISABLED |
| 448 if (compositingLogEnabled() && isFullUpdate && (needHierarchyUpdate || needG eometryUpdate)) { | 473 if (compositingLogEnabled() && isFullUpdate && (needHierarchyAndGeometryUpda te || needGeometryUpdate)) { |
| 449 m_obligateCompositedLayerCount = 0; | 474 m_obligateCompositedLayerCount = 0; |
| 450 m_secondaryCompositedLayerCount = 0; | 475 m_secondaryCompositedLayerCount = 0; |
| 451 m_obligatoryBackingStoreBytes = 0; | 476 m_obligatoryBackingStoreBytes = 0; |
| 452 m_secondaryBackingStoreBytes = 0; | 477 m_secondaryBackingStoreBytes = 0; |
| 453 | 478 |
| 454 Frame& frame = m_renderView->frameView()->frame(); | 479 Frame& frame = m_renderView->frameView()->frame(); |
| 455 LOG(Compositing, "\nUpdate %d of %s.\n", m_rootLayerUpdateCount, isMainF rame() ? "main frame" : frame.tree()->uniqueName().string().utf8().data()); | 480 LOG(Compositing, "\nUpdate %d of %s.\n", m_rootLayerUpdateCount, isMainF rame() ? "main frame" : frame.tree()->uniqueName().string().utf8().data()); |
| 456 } | 481 } |
| 457 #endif | 482 #endif |
| 458 | 483 |
| 459 if (needHierarchyUpdate) { | 484 if (needHierarchyAndGeometryUpdate) { |
| 460 // Update the hierarchy of the compositing layers. | 485 // Update the hierarchy of the compositing layers. |
| 461 Vector<GraphicsLayer*> childList; | 486 Vector<GraphicsLayer*> childList; |
| 462 { | 487 { |
| 463 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::rebuildCompo sitingLayerTree"); | 488 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::rebuildCompo sitingLayerTree"); |
| 464 rebuildCompositingLayerTree(updateRoot, childList, 0); | 489 rebuildCompositingLayerTree(updateRoot, childList, 0); |
| 465 } | 490 } |
| 466 | 491 |
| 467 // Host the document layer in the RenderView's root layer. | 492 // Host the document layer in the RenderView's root layer. |
| 468 if (isFullUpdate) { | 493 if (isFullUpdate) { |
| 469 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && isMai nFrame()) { | 494 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && isMai nFrame()) { |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 483 else | 508 else |
| 484 m_rootContentLayer->setChildren(childList); | 509 m_rootContentLayer->setChildren(childList); |
| 485 } | 510 } |
| 486 } else if (needGeometryUpdate) { | 511 } else if (needGeometryUpdate) { |
| 487 // We just need to do a geometry update. This is only used for position: fixed scrolling; | 512 // We just need to do a geometry update. This is only used for position: fixed scrolling; |
| 488 // most of the time, geometry is updated via RenderLayer::styleChanged() . | 513 // most of the time, geometry is updated via RenderLayer::styleChanged() . |
| 489 updateLayerTreeGeometry(updateRoot, 0); | 514 updateLayerTreeGeometry(updateRoot, 0); |
| 490 } | 515 } |
| 491 | 516 |
| 492 #if !LOG_DISABLED | 517 #if !LOG_DISABLED |
| 493 if (compositingLogEnabled() && isFullUpdate && (needHierarchyUpdate || needG eometryUpdate)) { | 518 if (compositingLogEnabled() && isFullUpdate && (needHierarchyAndGeometryUpda te || needGeometryUpdate)) { |
| 494 double endTime = currentTime(); | 519 double endTime = currentTime(); |
| 495 LOG(Compositing, "Total layers primary secondary obligatory backin g (KB) secondary backing(KB) total backing (KB) update time (ms)\n"); | 520 LOG(Compositing, "Total layers primary secondary obligatory backin g (KB) secondary backing(KB) total backing (KB) update time (ms)\n"); |
| 496 | 521 |
| 497 LOG(Compositing, "%8d %11d %9d %20.2f %22.2f %22.2f %18.2f\n", | 522 LOG(Compositing, "%8d %11d %9d %20.2f %22.2f %22.2f %18.2f\n", |
| 498 m_obligateCompositedLayerCount + m_secondaryCompositedLayerCount, m_ obligateCompositedLayerCount, | 523 m_obligateCompositedLayerCount + m_secondaryCompositedLayerCount, m_ obligateCompositedLayerCount, |
| 499 m_secondaryCompositedLayerCount, m_obligatoryBackingStoreBytes / 102 4, m_secondaryBackingStoreBytes / 1024, (m_obligatoryBackingStoreBytes + m_secon daryBackingStoreBytes) / 1024, 1000.0 * (endTime - startTime)); | 524 m_secondaryCompositedLayerCount, m_obligatoryBackingStoreBytes / 102 4, m_secondaryBackingStoreBytes / 1024, (m_obligatoryBackingStoreBytes + m_secon daryBackingStoreBytes) / 1024, 1000.0 * (endTime - startTime)); |
| 500 } | 525 } |
| 501 #endif | 526 #endif |
| 502 ASSERT(updateRoot || !m_compositingLayersNeedRebuild); | 527 ASSERT(updateRoot || !m_compositingLayersNeedRebuild); |
| 503 | 528 |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1126 | 1151 |
| 1127 if (!layer->parent()) | 1152 if (!layer->parent()) |
| 1128 updateRootLayerPosition(); | 1153 updateRootLayerPosition(); |
| 1129 | 1154 |
| 1130 #if !LOG_DISABLED | 1155 #if !LOG_DISABLED |
| 1131 logLayerInfo(layer, depth); | 1156 logLayerInfo(layer, depth); |
| 1132 #else | 1157 #else |
| 1133 UNUSED_PARAM(depth); | 1158 UNUSED_PARAM(depth); |
| 1134 #endif | 1159 #endif |
| 1135 if (currentCompositedLayerMapping->hasUnpositionedOverflowControlsLayers ()) | 1160 if (currentCompositedLayerMapping->hasUnpositionedOverflowControlsLayers ()) |
| 1136 layer->positionNewlyCreatedOverflowControls(); | 1161 layer->positionOverflowControls(); |
| 1137 | 1162 |
| 1138 pixelsWithoutPromotingAllTransitions += layer->size().height() * layer-> size().width(); | 1163 pixelsWithoutPromotingAllTransitions += layer->size().height() * layer-> size().width(); |
| 1139 } else { | 1164 } else { |
| 1140 if ((layer->renderer()->style()->transitionForProperty(CSSPropertyOpacit y) || | 1165 if ((layer->renderer()->style()->transitionForProperty(CSSPropertyOpacit y) || |
| 1141 layer->renderer()->style()->transitionForProperty(CSSPropertyWebkit Transform)) && | 1166 layer->renderer()->style()->transitionForProperty(CSSPropertyWebkit Transform)) && |
| 1142 m_renderView->viewRect().intersects(layer->absoluteBoundingBox())) | 1167 m_renderView->viewRect().intersects(layer->absoluteBoundingBox())) |
| 1143 pixelsAddedByPromotingAllTransitions += layer->size().height() * lay er->size().width(); | 1168 pixelsAddedByPromotingAllTransitions += layer->size().height() * lay er->size().width(); |
| 1144 } | 1169 } |
| 1145 | 1170 |
| 1146 // If this layer has a compositedLayerMapping, then that is where we place s ubsequent children GraphicsLayers. | 1171 // If this layer has a compositedLayerMapping, then that is where we place s ubsequent children GraphicsLayers. |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1322 | 1347 |
| 1323 bool RenderLayerCompositor::scrollingLayerDidChange(RenderLayer* layer) | 1348 bool RenderLayerCompositor::scrollingLayerDidChange(RenderLayer* layer) |
| 1324 { | 1349 { |
| 1325 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( )) | 1350 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( )) |
| 1326 return scrollingCoordinator->scrollableAreaScrollLayerDidChange(layer->s crollableArea()); | 1351 return scrollingCoordinator->scrollableAreaScrollLayerDidChange(layer->s crollableArea()); |
| 1327 return false; | 1352 return false; |
| 1328 } | 1353 } |
| 1329 | 1354 |
| 1330 String RenderLayerCompositor::layerTreeAsText(LayerTreeFlags flags) | 1355 String RenderLayerCompositor::layerTreeAsText(LayerTreeFlags flags) |
| 1331 { | 1356 { |
| 1332 updateCompositingLayers(CompositingUpdateAfterLayout); | 1357 // Before dumping the layer tree, finish any pending compositing update. |
| 1358 updateCompositingLayers(CompositingUpdateFinishAllDeferredWork); | |
| 1333 | 1359 |
| 1334 if (!m_rootContentLayer) | 1360 if (!m_rootContentLayer) |
| 1335 return String(); | 1361 return String(); |
| 1336 | 1362 |
| 1337 // We skip dumping the scroll and clip layers to keep layerTreeAsText output | 1363 // We skip dumping the scroll and clip layers to keep layerTreeAsText output |
| 1338 // similar between platforms (unless we explicitly request dumping from the | 1364 // similar between platforms (unless we explicitly request dumping from the |
| 1339 // root. | 1365 // root. |
| 1340 GraphicsLayer* rootLayer = m_rootContentLayer.get(); | 1366 GraphicsLayer* rootLayer = m_rootContentLayer.get(); |
| 1341 if (flags & LayerTreeIncludesRootLayer) | 1367 if (flags & LayerTreeIncludesRootLayer) |
| 1342 rootLayer = rootGraphicsLayer(); | 1368 rootLayer = rootGraphicsLayer(); |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1922 | 1948 |
| 1923 bool RenderLayerCompositor::requiresCompositingForPlugin(RenderObject* renderer) const | 1949 bool RenderLayerCompositor::requiresCompositingForPlugin(RenderObject* renderer) const |
| 1924 { | 1950 { |
| 1925 if (!(m_compositingTriggers & ChromeClient::PluginTrigger)) | 1951 if (!(m_compositingTriggers & ChromeClient::PluginTrigger)) |
| 1926 return false; | 1952 return false; |
| 1927 | 1953 |
| 1928 bool composite = renderer->isEmbeddedObject() && toRenderEmbeddedObject(rend erer)->allowsAcceleratedCompositing(); | 1954 bool composite = renderer->isEmbeddedObject() && toRenderEmbeddedObject(rend erer)->allowsAcceleratedCompositing(); |
| 1929 if (!composite) | 1955 if (!composite) |
| 1930 return false; | 1956 return false; |
| 1931 | 1957 |
| 1932 m_reevaluateCompositingAfterLayout = true; | 1958 // FIXME: this seems bogus. If we don't know the layout position/size of the plugin yet, would't that be handled elsewhere? |
| 1959 m_needsToRecomputeCompositingRequirements = true; | |
| 1933 | 1960 |
| 1934 RenderWidget* pluginRenderer = toRenderWidget(renderer); | 1961 RenderWidget* pluginRenderer = toRenderWidget(renderer); |
| 1935 // If we can't reliably know the size of the plugin yet, don't change compos iting state. | 1962 // If we can't reliably know the size of the plugin yet, don't change compos iting state. |
| 1936 if (pluginRenderer->needsLayout()) | 1963 if (pluginRenderer->needsLayout()) |
| 1937 return pluginRenderer->hasLayer() && pluginRenderer->layer()->isComposit ed(); | 1964 return pluginRenderer->hasLayer() && pluginRenderer->layer()->isComposit ed(); |
| 1938 | 1965 |
| 1939 // Don't go into compositing mode if height or width are zero, or size is 1x 1. | 1966 // Don't go into compositing mode if height or width are zero, or size is 1x 1. |
| 1940 IntRect contentBox = pixelSnappedIntRect(pluginRenderer->contentBoxRect()); | 1967 IntRect contentBox = pixelSnappedIntRect(pluginRenderer->contentBoxRect()); |
| 1941 return contentBox.height() * contentBox.width() > 1; | 1968 return contentBox.height() * contentBox.width() > 1; |
| 1942 } | 1969 } |
| 1943 | 1970 |
| 1944 bool RenderLayerCompositor::requiresCompositingForFrame(RenderObject* renderer) const | 1971 bool RenderLayerCompositor::requiresCompositingForFrame(RenderObject* renderer) const |
| 1945 { | 1972 { |
| 1946 if (!renderer->isRenderPart()) | 1973 if (!renderer->isRenderPart()) |
| 1947 return false; | 1974 return false; |
| 1948 | 1975 |
| 1949 RenderPart* frameRenderer = toRenderPart(renderer); | 1976 RenderPart* frameRenderer = toRenderPart(renderer); |
| 1950 | 1977 |
| 1951 if (!frameRenderer->requiresAcceleratedCompositing()) | 1978 if (!frameRenderer->requiresAcceleratedCompositing()) |
| 1952 return false; | 1979 return false; |
| 1953 | 1980 |
| 1954 m_reevaluateCompositingAfterLayout = true; | 1981 // FIXME: this seems bogus. If we don't know the layout position/size of the frame yet, wouldn't that be handled elsehwere? |
| 1982 m_needsToRecomputeCompositingRequirements = true; | |
| 1955 | 1983 |
| 1956 RenderLayerCompositor* innerCompositor = frameContentsCompositor(frameRender er); | 1984 RenderLayerCompositor* innerCompositor = frameContentsCompositor(frameRender er); |
| 1957 if (!innerCompositor) | 1985 if (!innerCompositor) |
| 1958 return false; | 1986 return false; |
| 1959 | 1987 |
| 1960 // If we can't reliably know the size of the iframe yet, don't change compos iting state. | 1988 // If we can't reliably know the size of the iframe yet, don't change compos iting state. |
| 1961 if (renderer->needsLayout()) | 1989 if (renderer->needsLayout()) |
| 1962 return frameRenderer->hasLayer() && frameRenderer->layer()->isComposited (); | 1990 return frameRenderer->hasLayer() && frameRenderer->layer()->isComposited (); |
| 1963 | 1991 |
| 1964 // Don't go into compositing mode if height or width are zero. | 1992 // Don't go into compositing mode if height or width are zero. |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2086 if (!settings->acceleratedCompositingForFixedPositionEnabled()) | 2114 if (!settings->acceleratedCompositingForFixedPositionEnabled()) |
| 2087 return false; | 2115 return false; |
| 2088 } | 2116 } |
| 2089 | 2117 |
| 2090 if (isSticky) | 2118 if (isSticky) |
| 2091 return true; | 2119 return true; |
| 2092 | 2120 |
| 2093 RenderObject* container = renderer->container(); | 2121 RenderObject* container = renderer->container(); |
| 2094 // If the renderer is not hooked up yet then we have to wait until it is. | 2122 // If the renderer is not hooked up yet then we have to wait until it is. |
| 2095 if (!container) { | 2123 if (!container) { |
| 2096 m_reevaluateCompositingAfterLayout = true; | 2124 m_needsToRecomputeCompositingRequirements = true; |
| 2097 return false; | 2125 return false; |
| 2098 } | 2126 } |
| 2099 | 2127 |
| 2100 // Don't promote fixed position elements that are descendants of a non-view container, e.g. transformed elements. | 2128 // Don't promote fixed position elements that are descendants of a non-view container, e.g. transformed elements. |
| 2101 // They will stay fixed wrt the container rather than the enclosing frame. | 2129 // They will stay fixed wrt the container rather than the enclosing frame. |
| 2102 if (container != m_renderView) { | 2130 if (container != m_renderView) { |
| 2103 if (viewportConstrainedNotCompositedReason) | 2131 if (viewportConstrainedNotCompositedReason) |
| 2104 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForNonViewContainer; | 2132 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForNonViewContainer; |
| 2105 return false; | 2133 return false; |
| 2106 } | 2134 } |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 2126 } | 2154 } |
| 2127 | 2155 |
| 2128 if (!hasScrollableAncestor) { | 2156 if (!hasScrollableAncestor) { |
| 2129 if (viewportConstrainedNotCompositedReason) | 2157 if (viewportConstrainedNotCompositedReason) |
| 2130 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForUnscrollableAncestors; | 2158 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForUnscrollableAncestors; |
| 2131 return false; | 2159 return false; |
| 2132 } | 2160 } |
| 2133 | 2161 |
| 2134 // Subsequent tests depend on layout. If we can't tell now, just keep things the way they are until layout is done. | 2162 // Subsequent tests depend on layout. If we can't tell now, just keep things the way they are until layout is done. |
| 2135 if (!m_inPostLayoutUpdate) { | 2163 if (!m_inPostLayoutUpdate) { |
| 2136 m_reevaluateCompositingAfterLayout = true; | 2164 m_needsToRecomputeCompositingRequirements = true; |
| 2137 return layer->isComposited(); | 2165 return layer->isComposited(); |
| 2138 } | 2166 } |
| 2139 | 2167 |
| 2140 bool paintsContent = layer->isVisuallyNonEmpty() || layer->hasVisibleDescend ant(); | 2168 bool paintsContent = layer->isVisuallyNonEmpty() || layer->hasVisibleDescend ant(); |
| 2141 if (!paintsContent) { | 2169 if (!paintsContent) { |
| 2142 if (viewportConstrainedNotCompositedReason) | 2170 if (viewportConstrainedNotCompositedReason) |
| 2143 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForNoVisibleContent; | 2171 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForNoVisibleContent; |
| 2144 return false; | 2172 return false; |
| 2145 } | 2173 } |
| 2146 | 2174 |
| 2147 // Fixed position elements that are invisible in the current view don't get their own layer. | 2175 // Fixed position elements that are invisible in the current view don't get their own layer. |
| 2148 if (FrameView* frameView = m_renderView->frameView()) { | 2176 if (FrameView* frameView = m_renderView->frameView()) { |
| 2149 LayoutRect viewBounds = frameView->viewportConstrainedVisibleContentRect (); | 2177 LayoutRect viewBounds = frameView->viewportConstrainedVisibleContentRect (); |
| 2150 LayoutRect layerBounds = layer->calculateLayerBounds(rootRenderLayer(), 0, RenderLayer::DefaultCalculateLayerBoundsFlags | 2178 LayoutRect layerBounds = layer->calculateLayerBounds(rootRenderLayer(), 0, RenderLayer::DefaultCalculateLayerBoundsFlags |
| 2151 | RenderLayer::ExcludeHiddenDescendants | RenderLayer::DontConstrain ForMask | RenderLayer::IncludeCompositedDescendants); | 2179 | RenderLayer::ExcludeHiddenDescendants | RenderLayer::DontConstrain ForMask | RenderLayer::IncludeCompositedDescendants); |
| 2152 if (!viewBounds.intersects(enclosingIntRect(layerBounds))) { | 2180 if (!viewBounds.intersects(enclosingIntRect(layerBounds))) { |
| 2153 if (viewportConstrainedNotCompositedReason) { | 2181 if (viewportConstrainedNotCompositedReason) { |
| 2154 *viewportConstrainedNotCompositedReason = RenderLayer::NotCompos itedForBoundsOutOfView; | 2182 *viewportConstrainedNotCompositedReason = RenderLayer::NotCompos itedForBoundsOutOfView; |
| 2155 m_reevaluateCompositingAfterLayout = true; | 2183 m_needsToRecomputeCompositingRequirements = true; |
| 2156 } | 2184 } |
| 2157 return false; | 2185 return false; |
| 2158 } | 2186 } |
| 2159 } | 2187 } |
| 2160 | 2188 |
| 2161 return true; | 2189 return true; |
| 2162 } | 2190 } |
| 2163 | 2191 |
| 2164 bool RenderLayerCompositor::requiresCompositingForOverflowScrolling(const Render Layer* layer) const | 2192 bool RenderLayerCompositor::requiresCompositingForOverflowScrolling(const Render Layer* layer) const |
| 2165 { | 2193 { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2272 } | 2300 } |
| 2273 | 2301 |
| 2274 void RenderLayerCompositor::resetTrackedRepaintRects() | 2302 void RenderLayerCompositor::resetTrackedRepaintRects() |
| 2275 { | 2303 { |
| 2276 if (GraphicsLayer* rootLayer = rootGraphicsLayer()) | 2304 if (GraphicsLayer* rootLayer = rootGraphicsLayer()) |
| 2277 resetTrackedRepaintRectsRecursive(rootLayer); | 2305 resetTrackedRepaintRectsRecursive(rootLayer); |
| 2278 } | 2306 } |
| 2279 | 2307 |
| 2280 void RenderLayerCompositor::setTracksRepaints(bool tracksRepaints) | 2308 void RenderLayerCompositor::setTracksRepaints(bool tracksRepaints) |
| 2281 { | 2309 { |
| 2310 updateCompositingLayers(CompositingUpdateFinishAllDeferredWork); | |
| 2282 m_isTrackingRepaints = tracksRepaints; | 2311 m_isTrackingRepaints = tracksRepaints; |
| 2283 } | 2312 } |
| 2284 | 2313 |
| 2285 bool RenderLayerCompositor::isTrackingRepaints() const | 2314 bool RenderLayerCompositor::isTrackingRepaints() const |
| 2286 { | 2315 { |
| 2287 return m_isTrackingRepaints; | 2316 return m_isTrackingRepaints; |
| 2288 } | 2317 } |
| 2289 | 2318 |
| 2290 void RenderLayerCompositor::didCommitChangesForLayer(const GraphicsLayer*) const | 2319 void RenderLayerCompositor::didCommitChangesForLayer(const GraphicsLayer*) const |
| 2291 { | 2320 { |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2793 } else if (graphicsLayer == m_scrollLayer.get()) { | 2822 } else if (graphicsLayer == m_scrollLayer.get()) { |
| 2794 name = "Frame Scrolling Layer"; | 2823 name = "Frame Scrolling Layer"; |
| 2795 } else { | 2824 } else { |
| 2796 ASSERT_NOT_REACHED(); | 2825 ASSERT_NOT_REACHED(); |
| 2797 } | 2826 } |
| 2798 | 2827 |
| 2799 return name; | 2828 return name; |
| 2800 } | 2829 } |
| 2801 | 2830 |
| 2802 } // namespace WebCore | 2831 } // namespace WebCore |
| OLD | NEW |