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