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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 | 109 |
| 110 RenderLayerCompositor::RenderLayerCompositor(RenderView& renderView) | 110 RenderLayerCompositor::RenderLayerCompositor(RenderView& renderView) |
| 111 : m_renderView(renderView) | 111 : m_renderView(renderView) |
| 112 , m_compositingReasonFinder(renderView) | 112 , m_compositingReasonFinder(renderView) |
| 113 , m_pendingUpdateType(CompositingUpdateNone) | 113 , m_pendingUpdateType(CompositingUpdateNone) |
| 114 , m_hasAcceleratedCompositing(true) | 114 , m_hasAcceleratedCompositing(true) |
| 115 , m_needsToRecomputeCompositingRequirements(false) | 115 , m_needsToRecomputeCompositingRequirements(false) |
| 116 , m_compositing(false) | 116 , m_compositing(false) |
| 117 , m_compositingLayersNeedRebuild(false) | 117 , m_compositingLayersNeedRebuild(false) |
| 118 , m_rootShouldAlwaysCompositeDirty(true) | 118 , m_rootShouldAlwaysCompositeDirty(true) |
| 119 , m_needsUpdateCompositingRequirementsState(false) | |
| 120 , m_needsUpdateFixedBackground(false) | 119 , m_needsUpdateFixedBackground(false) |
| 121 , m_isTrackingRepaints(false) | 120 , m_isTrackingRepaints(false) |
| 122 , m_rootLayerAttachment(RootLayerUnattached) | 121 , m_rootLayerAttachment(RootLayerUnattached) |
| 123 { | 122 { |
| 124 updateAcceleratedCompositingSettings(); | 123 updateAcceleratedCompositingSettings(); |
| 125 } | 124 } |
| 126 | 125 |
| 127 RenderLayerCompositor::~RenderLayerCompositor() | 126 RenderLayerCompositor::~RenderLayerCompositor() |
| 128 { | 127 { |
| 129 ASSERT(m_rootLayerAttachment == RootLayerUnattached); | 128 ASSERT(m_rootLayerAttachment == RootLayerUnattached); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 { | 220 { |
| 222 // FIXME: crbug.com/332248 ideally this could be merged with setNeedsComposi tingUpdate(). | 221 // FIXME: crbug.com/332248 ideally this could be merged with setNeedsComposi tingUpdate(). |
| 223 // FIXME: We can remove the staleInCompositingMode check once we get rid of the | 222 // FIXME: We can remove the staleInCompositingMode check once we get rid of the |
| 224 // forceCompositingMode setting. | 223 // forceCompositingMode setting. |
| 225 if (staleInCompositingMode()) | 224 if (staleInCompositingMode()) |
| 226 m_compositingLayersNeedRebuild = true; | 225 m_compositingLayersNeedRebuild = true; |
| 227 page()->animator().scheduleVisualUpdate(); | 226 page()->animator().scheduleVisualUpdate(); |
| 228 lifecycle().ensureStateAtMost(DocumentLifecycle::LayoutClean); | 227 lifecycle().ensureStateAtMost(DocumentLifecycle::LayoutClean); |
| 229 } | 228 } |
| 230 | 229 |
| 231 void RenderLayerCompositor::updateCompositingRequirementsState() | |
| 232 { | |
| 233 if (!m_needsUpdateCompositingRequirementsState) | |
| 234 return; | |
| 235 | |
| 236 TRACE_EVENT0("blink_rendering,comp-scroll", "RenderLayerCompositor::updateCo mpositingRequirementsState"); | |
| 237 | |
| 238 m_needsUpdateCompositingRequirementsState = false; | |
| 239 if (!rootRenderLayer() || !acceleratedCompositingForOverflowScrollEnabled()) | |
| 240 return; | |
| 241 | |
| 242 for (HashSet<RenderLayer*>::iterator it = m_outOfFlowPositionedLayers.begin( ); it != m_outOfFlowPositionedLayers.end(); ++it) | |
| 243 (*it)->updateIsUnclippedDescendant(); | |
| 244 } | |
| 245 | |
| 246 static RenderVideo* findFullscreenVideoRenderer(Document& document) | 230 static RenderVideo* findFullscreenVideoRenderer(Document& document) |
| 247 { | 231 { |
| 248 Element* fullscreenElement = FullscreenElementStack::fullscreenElementFrom(d ocument); | 232 Element* fullscreenElement = FullscreenElementStack::fullscreenElementFrom(d ocument); |
| 249 while (fullscreenElement && fullscreenElement->isFrameOwnerElement()) { | 233 while (fullscreenElement && fullscreenElement->isFrameOwnerElement()) { |
| 250 Document* contentDocument = toHTMLFrameOwnerElement(fullscreenElement)-> contentDocument(); | 234 Document* contentDocument = toHTMLFrameOwnerElement(fullscreenElement)-> contentDocument(); |
| 251 if (!contentDocument) | 235 if (!contentDocument) |
| 252 return 0; | 236 return 0; |
| 253 fullscreenElement = FullscreenElementStack::fullscreenElementFrom(*conte ntDocument); | 237 fullscreenElement = FullscreenElementStack::fullscreenElementFrom(*conte ntDocument); |
| 254 } | 238 } |
| 255 if (!isHTMLVideoElement(fullscreenElement)) | 239 if (!isHTMLVideoElement(fullscreenElement)) |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 304 | 288 |
| 305 m_pendingUpdateType = std::max(m_pendingUpdateType, updateType); | 289 m_pendingUpdateType = std::max(m_pendingUpdateType, updateType); |
| 306 | 290 |
| 307 page()->animator().scheduleVisualUpdate(); | 291 page()->animator().scheduleVisualUpdate(); |
| 308 lifecycle().ensureStateAtMost(DocumentLifecycle::LayoutClean); | 292 lifecycle().ensureStateAtMost(DocumentLifecycle::LayoutClean); |
| 309 } | 293 } |
| 310 | 294 |
| 311 void RenderLayerCompositor::assertNoUnresolvedDirtyBits() | 295 void RenderLayerCompositor::assertNoUnresolvedDirtyBits() |
| 312 { | 296 { |
| 313 ASSERT(!compositingLayersNeedRebuild()); | 297 ASSERT(!compositingLayersNeedRebuild()); |
| 314 ASSERT(!m_needsUpdateCompositingRequirementsState); | |
| 315 ASSERT(m_pendingUpdateType == CompositingUpdateNone); | 298 ASSERT(m_pendingUpdateType == CompositingUpdateNone); |
| 316 ASSERT(!m_rootShouldAlwaysCompositeDirty); | 299 ASSERT(!m_rootShouldAlwaysCompositeDirty); |
| 317 ASSERT(!m_needsToRecomputeCompositingRequirements); | 300 ASSERT(!m_needsToRecomputeCompositingRequirements); |
| 318 } | 301 } |
| 319 | 302 |
| 320 void RenderLayerCompositor::applyOverlayFullscreenVideoAdjustment() | 303 void RenderLayerCompositor::applyOverlayFullscreenVideoAdjustment() |
| 321 { | 304 { |
| 322 if (!m_rootContentLayer) | 305 if (!m_rootContentLayer) |
| 323 return; | 306 return; |
| 324 | 307 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 347 m_overflowControlsHostLayer->addChild(videoLayer); | 330 m_overflowControlsHostLayer->addChild(videoLayer); |
| 348 if (GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer()) | 331 if (GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer()) |
| 349 backgroundLayer->removeFromParent(); | 332 backgroundLayer->removeFromParent(); |
| 350 } | 333 } |
| 351 | 334 |
| 352 void RenderLayerCompositor::updateIfNeeded() | 335 void RenderLayerCompositor::updateIfNeeded() |
| 353 { | 336 { |
| 354 { | 337 { |
| 355 // FIXME: Notice that we call this function before checking the dirty bi ts below. | 338 // FIXME: Notice that we call this function before checking the dirty bi ts below. |
| 356 // We'll need to remove DeprecatedDirtyCompositingDuringCompositingUpdat e | 339 // We'll need to remove DeprecatedDirtyCompositingDuringCompositingUpdat e |
| 357 // before moving this function after checking the dirty bits. | 340 // before moving this function after checking the dirty bits. |
|
ojan
2014/06/01 23:29:20
This comment doesn't seem accurate anymore. I mean
| |
| 358 DeprecatedDirtyCompositingDuringCompositingUpdate marker(lifecycle()); | 341 DeprecatedDirtyCompositingDuringCompositingUpdate marker(lifecycle()); |
| 359 updateCompositingRequirementsState(); | |
|
ojan
2014/06/01 23:29:20
Amazing.
| |
| 360 | 342 |
| 361 // FIXME: enableCompositingModeIfNeeded can call setCompositingLayersNee dRebuild, | 343 // FIXME: enableCompositingModeIfNeeded can call setCompositingLayersNee dRebuild, |
| 362 // which asserts that it's not InCompositingUpdate. | 344 // which asserts that it's not InCompositingUpdate. |
| 363 enableCompositingModeIfNeeded(); | 345 enableCompositingModeIfNeeded(); |
| 364 } | 346 } |
| 365 | 347 |
| 366 CompositingUpdateType updateType = m_pendingUpdateType; | 348 CompositingUpdateType updateType = m_pendingUpdateType; |
| 367 bool needCompositingRequirementsUpdate = m_needsToRecomputeCompositingRequir ements; | 349 bool needCompositingRequirementsUpdate = m_needsToRecomputeCompositingRequir ements; |
| 368 bool needHierarchyAndGeometryUpdate = compositingLayersNeedRebuild(); | 350 bool needHierarchyAndGeometryUpdate = compositingLayersNeedRebuild(); |
| 369 | 351 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 387 compositingPropertyUpdateType = CompositingPropertyUpdater::ForceUpdate; | 369 compositingPropertyUpdateType = CompositingPropertyUpdater::ForceUpdate; |
| 388 } | 370 } |
| 389 | 371 |
| 390 RenderLayer* updateRoot = rootRenderLayer(); | 372 RenderLayer* updateRoot = rootRenderLayer(); |
| 391 | 373 |
| 392 if (needCompositingRequirementsUpdate || updateType >= CompositingUpdateAfte rCompositingInputChange) { | 374 if (needCompositingRequirementsUpdate || updateType >= CompositingUpdateAfte rCompositingInputChange) { |
| 393 bool layersChanged = false; | 375 bool layersChanged = false; |
| 394 | 376 |
| 395 { | 377 { |
| 396 TRACE_EVENT0("blink_rendering", "CompositingPropertyUpdater::updateA ncestorDependentProperties"); | 378 TRACE_EVENT0("blink_rendering", "CompositingPropertyUpdater::updateA ncestorDependentProperties"); |
| 397 CompositingPropertyUpdater(updateRoot).updateAncestorDependentProper ties(updateRoot, compositingPropertyUpdateType, 0); | 379 CompositingPropertyUpdater(updateRoot).updateAncestorDependentProper ties(updateRoot, compositingPropertyUpdateType); |
| 398 #if ASSERT_ENABLED | 380 #if ASSERT_ENABLED |
| 399 CompositingPropertyUpdater::assertNeedsToUpdateAncestorDependantProp ertiesBitsCleared(updateRoot); | 381 CompositingPropertyUpdater::assertNeedsToUpdateAncestorDependantProp ertiesBitsCleared(updateRoot); |
| 400 #endif | 382 #endif |
| 401 } | 383 } |
| 402 | 384 |
| 403 CompositingRequirementsUpdater(m_renderView, m_compositingReasonFinder). update(updateRoot); | 385 CompositingRequirementsUpdater(m_renderView, m_compositingReasonFinder). update(updateRoot); |
| 404 | 386 |
| 405 { | 387 { |
| 406 TRACE_EVENT0("blink_rendering", "CompositingLayerAssigner::assign"); | 388 TRACE_EVENT0("blink_rendering", "CompositingLayerAssigner::assign"); |
| 407 CompositingLayerAssigner(this).assign(updateRoot, layersChanged); | 389 CompositingLayerAssigner(this).assign(updateRoot, layersChanged); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 461 // The scrolling coordinator may realize that it needs updating while compos iting was being updated in this function. | 443 // The scrolling coordinator may realize that it needs updating while compos iting was being updated in this function. |
| 462 needsToUpdateScrollingCoordinator |= scrollingCoordinator() && scrollingCoor dinator()->needsToUpdateAfterCompositingChange(); | 444 needsToUpdateScrollingCoordinator |= scrollingCoordinator() && scrollingCoor dinator()->needsToUpdateAfterCompositingChange(); |
| 463 if (needsToUpdateScrollingCoordinator && m_renderView.frame()->isMainFrame() && scrollingCoordinator() && inCompositingMode()) | 445 if (needsToUpdateScrollingCoordinator && m_renderView.frame()->isMainFrame() && scrollingCoordinator() && inCompositingMode()) |
| 464 scrollingCoordinator()->updateAfterCompositingChange(); | 446 scrollingCoordinator()->updateAfterCompositingChange(); |
| 465 | 447 |
| 466 // Inform the inspector that the layer tree has changed. | 448 // Inform the inspector that the layer tree has changed. |
| 467 if (m_renderView.frame()->isMainFrame()) | 449 if (m_renderView.frame()->isMainFrame()) |
| 468 InspectorInstrumentation::layerTreeDidChange(m_renderView.frame()); | 450 InspectorInstrumentation::layerTreeDidChange(m_renderView.frame()); |
| 469 } | 451 } |
| 470 | 452 |
| 471 void RenderLayerCompositor::addOutOfFlowPositionedLayer(RenderLayer* layer) | |
| 472 { | |
| 473 m_outOfFlowPositionedLayers.add(layer); | |
| 474 } | |
| 475 | |
| 476 void RenderLayerCompositor::removeOutOfFlowPositionedLayer(RenderLayer* layer) | |
| 477 { | |
| 478 m_outOfFlowPositionedLayers.remove(layer); | |
| 479 } | |
| 480 | |
| 481 bool RenderLayerCompositor::allocateOrClearCompositedLayerMapping(RenderLayer* l ayer, const CompositingStateTransitionType compositedLayerUpdate) | 453 bool RenderLayerCompositor::allocateOrClearCompositedLayerMapping(RenderLayer* l ayer, const CompositingStateTransitionType compositedLayerUpdate) |
| 482 { | 454 { |
| 483 bool compositedLayerMappingChanged = false; | 455 bool compositedLayerMappingChanged = false; |
| 484 bool nonCompositedReasonChanged = updateLayerIfViewportConstrained(layer); | 456 bool nonCompositedReasonChanged = updateLayerIfViewportConstrained(layer); |
| 485 | 457 |
| 486 // FIXME: It would be nice to directly use the layer's compositing reason, | 458 // FIXME: It would be nice to directly use the layer's compositing reason, |
| 487 // but allocateOrClearCompositedLayerMapping also gets called without having updated compositing | 459 // but allocateOrClearCompositedLayerMapping also gets called without having updated compositing |
| 488 // requirements fully. | 460 // requirements fully. |
| 489 switch (compositedLayerUpdate) { | 461 switch (compositedLayerUpdate) { |
| 490 case AllocateOwnCompositedLayerMapping: | 462 case AllocateOwnCompositedLayerMapping: |
| (...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1418 } else if (graphicsLayer == m_scrollLayer.get()) { | 1390 } else if (graphicsLayer == m_scrollLayer.get()) { |
| 1419 name = "LocalFrame Scrolling Layer"; | 1391 name = "LocalFrame Scrolling Layer"; |
| 1420 } else { | 1392 } else { |
| 1421 ASSERT_NOT_REACHED(); | 1393 ASSERT_NOT_REACHED(); |
| 1422 } | 1394 } |
| 1423 | 1395 |
| 1424 return name; | 1396 return name; |
| 1425 } | 1397 } |
| 1426 | 1398 |
| 1427 } // namespace WebCore | 1399 } // namespace WebCore |
| OLD | NEW |