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