| 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 RenderLayer* m_compositingAncestor; | 190 RenderLayer* m_compositingAncestor; |
| 191 RenderLayer* m_mostRecentCompositedLayer; // in paint order regardless of hi
erarchy. | 191 RenderLayer* m_mostRecentCompositedLayer; // in paint order regardless of hi
erarchy. |
| 192 bool m_subtreeIsCompositing; | 192 bool m_subtreeIsCompositing; |
| 193 bool m_hasUnisolatedCompositedBlendingDescendant; | 193 bool m_hasUnisolatedCompositedBlendingDescendant; |
| 194 bool m_testingOverlap; | 194 bool m_testingOverlap; |
| 195 #ifndef NDEBUG | 195 #ifndef NDEBUG |
| 196 int m_depth; | 196 int m_depth; |
| 197 #endif | 197 #endif |
| 198 }; | 198 }; |
| 199 | 199 |
| 200 RenderLayerCompositor::RenderLayerCompositor(RenderView* renderView) | 200 RenderLayerCompositor::RenderLayerCompositor(RenderView& renderView) |
| 201 : m_renderView(renderView) | 201 : m_renderView(renderView) |
| 202 , m_compositingReasonFinder(*renderView) | 202 , m_compositingReasonFinder(renderView) |
| 203 , m_hasAcceleratedCompositing(true) | 203 , m_hasAcceleratedCompositing(true) |
| 204 , m_showRepaintCounter(false) | 204 , m_showRepaintCounter(false) |
| 205 , m_needsToRecomputeCompositingRequirements(false) | 205 , m_needsToRecomputeCompositingRequirements(false) |
| 206 , m_needsToUpdateLayerTreeGeometry(false) | 206 , m_needsToUpdateLayerTreeGeometry(false) |
| 207 , m_pendingUpdateType(GraphicsLayerUpdater::DoNotForceUpdate) | 207 , m_pendingUpdateType(GraphicsLayerUpdater::DoNotForceUpdate) |
| 208 , m_compositing(false) | 208 , m_compositing(false) |
| 209 , m_compositingLayersNeedRebuild(false) | 209 , m_compositingLayersNeedRebuild(false) |
| 210 , m_forceCompositingMode(false) | 210 , m_forceCompositingMode(false) |
| 211 , m_needsUpdateCompositingRequirementsState(false) | 211 , m_needsUpdateCompositingRequirementsState(false) |
| 212 , m_isTrackingRepaints(false) | 212 , m_isTrackingRepaints(false) |
| 213 , m_rootLayerAttachment(RootLayerUnattached) | 213 , m_rootLayerAttachment(RootLayerUnattached) |
| 214 { | 214 { |
| 215 ASSERT(renderView); | |
| 216 } | 215 } |
| 217 | 216 |
| 218 RenderLayerCompositor::~RenderLayerCompositor() | 217 RenderLayerCompositor::~RenderLayerCompositor() |
| 219 { | 218 { |
| 220 ASSERT(m_rootLayerAttachment == RootLayerUnattached); | 219 ASSERT(m_rootLayerAttachment == RootLayerUnattached); |
| 221 } | 220 } |
| 222 | 221 |
| 223 void RenderLayerCompositor::enableCompositingMode(bool enable /* = true */) | 222 void RenderLayerCompositor::enableCompositingMode(bool enable /* = true */) |
| 224 { | 223 { |
| 225 if (enable != m_compositing) { | 224 if (enable != m_compositing) { |
| 226 m_compositing = enable; | 225 m_compositing = enable; |
| 227 | 226 |
| 228 if (m_compositing) { | 227 if (m_compositing) { |
| 229 ensureRootLayer(); | 228 ensureRootLayer(); |
| 230 notifyIFramesOfCompositingChange(); | 229 notifyIFramesOfCompositingChange(); |
| 231 } else | 230 } else |
| 232 destroyRootLayer(); | 231 destroyRootLayer(); |
| 233 } | 232 } |
| 234 } | 233 } |
| 235 | 234 |
| 236 void RenderLayerCompositor::cacheAcceleratedCompositingFlags() | 235 void RenderLayerCompositor::cacheAcceleratedCompositingFlags() |
| 237 { | 236 { |
| 238 bool hasAcceleratedCompositing = false; | 237 bool hasAcceleratedCompositing = false; |
| 239 bool showRepaintCounter = false; | 238 bool showRepaintCounter = false; |
| 240 bool forceCompositingMode = false; | 239 bool forceCompositingMode = false; |
| 241 | 240 |
| 242 if (Settings* settings = m_renderView->document().settings()) { | 241 if (Settings* settings = m_renderView.document().settings()) { |
| 243 hasAcceleratedCompositing = settings->acceleratedCompositingEnabled(); | 242 hasAcceleratedCompositing = settings->acceleratedCompositingEnabled(); |
| 244 | 243 |
| 245 // We allow the chrome to override the settings, in case the page is ren
dered | 244 // We allow the chrome to override the settings, in case the page is ren
dered |
| 246 // on a chrome that doesn't allow accelerated compositing. | 245 // on a chrome that doesn't allow accelerated compositing. |
| 247 if (hasAcceleratedCompositing) { | 246 if (hasAcceleratedCompositing) { |
| 248 if (page()) { | 247 if (page()) { |
| 249 m_compositingReasonFinder.updateTriggers(); | 248 m_compositingReasonFinder.updateTriggers(); |
| 250 hasAcceleratedCompositing = m_compositingReasonFinder.hasTrigger
s(); | 249 hasAcceleratedCompositing = m_compositingReasonFinder.hasTrigger
s(); |
| 251 } | 250 } |
| 252 } | 251 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 263 | 262 |
| 264 m_hasAcceleratedCompositing = hasAcceleratedCompositing; | 263 m_hasAcceleratedCompositing = hasAcceleratedCompositing; |
| 265 m_showRepaintCounter = showRepaintCounter; | 264 m_showRepaintCounter = showRepaintCounter; |
| 266 m_forceCompositingMode = forceCompositingMode; | 265 m_forceCompositingMode = forceCompositingMode; |
| 267 } | 266 } |
| 268 | 267 |
| 269 bool RenderLayerCompositor::layerSquashingEnabled() const | 268 bool RenderLayerCompositor::layerSquashingEnabled() const |
| 270 { | 269 { |
| 271 if (RuntimeEnabledFeatures::bleedingEdgeFastPathsEnabled()) | 270 if (RuntimeEnabledFeatures::bleedingEdgeFastPathsEnabled()) |
| 272 return true; | 271 return true; |
| 273 if (Settings* settings = m_renderView->document().settings()) | 272 if (Settings* settings = m_renderView.document().settings()) |
| 274 return settings->layerSquashingEnabled(); | 273 return settings->layerSquashingEnabled(); |
| 275 | 274 |
| 276 return false; | 275 return false; |
| 277 } | 276 } |
| 278 | 277 |
| 279 bool RenderLayerCompositor::canRender3DTransforms() const | 278 bool RenderLayerCompositor::canRender3DTransforms() const |
| 280 { | 279 { |
| 281 return hasAcceleratedCompositing() && m_compositingReasonFinder.has3DTransfo
rmTrigger(); | 280 return hasAcceleratedCompositing() && m_compositingReasonFinder.has3DTransfo
rmTrigger(); |
| 282 } | 281 } |
| 283 | 282 |
| 284 void RenderLayerCompositor::setCompositingLayersNeedRebuild() | 283 void RenderLayerCompositor::setCompositingLayersNeedRebuild() |
| 285 { | 284 { |
| 286 // FIXME: crbug,com/332248 ideally this could be merged with setNeedsComposi
tingUpdate(). | 285 // FIXME: crbug,com/332248 ideally this could be merged with setNeedsComposi
tingUpdate(). |
| 287 if (inCompositingMode()) | 286 if (inCompositingMode()) |
| 288 m_compositingLayersNeedRebuild = true; | 287 m_compositingLayersNeedRebuild = true; |
| 289 | 288 |
| 290 m_renderView->frameView()->scheduleAnimation(); | 289 m_renderView.frameView()->scheduleAnimation(); |
| 291 } | 290 } |
| 292 | 291 |
| 293 void RenderLayerCompositor::updateCompositingRequirementsState() | 292 void RenderLayerCompositor::updateCompositingRequirementsState() |
| 294 { | 293 { |
| 295 if (!m_needsUpdateCompositingRequirementsState) | 294 if (!m_needsUpdateCompositingRequirementsState) |
| 296 return; | 295 return; |
| 297 | 296 |
| 298 TRACE_EVENT0("blink_rendering,comp-scroll", "RenderLayerCompositor::updateCo
mpositingRequirementsState"); | 297 TRACE_EVENT0("blink_rendering,comp-scroll", "RenderLayerCompositor::updateCo
mpositingRequirementsState"); |
| 299 | 298 |
| 300 m_needsUpdateCompositingRequirementsState = false; | 299 m_needsUpdateCompositingRequirementsState = false; |
| 301 | 300 |
| 302 if (!rootRenderLayer() || !m_renderView->acceleratedCompositingForOverflowSc
rollEnabled()) | 301 if (!rootRenderLayer() || !m_renderView.acceleratedCompositingForOverflowScr
ollEnabled()) |
| 303 return; | 302 return; |
| 304 | 303 |
| 305 for (HashSet<RenderLayer*>::iterator it = m_outOfFlowPositionedLayers.begin(
); it != m_outOfFlowPositionedLayers.end(); ++it) | 304 for (HashSet<RenderLayer*>::iterator it = m_outOfFlowPositionedLayers.begin(
); it != m_outOfFlowPositionedLayers.end(); ++it) |
| 306 (*it)->updateHasUnclippedDescendant(); | 305 (*it)->updateHasUnclippedDescendant(); |
| 307 | 306 |
| 308 const FrameView::ScrollableAreaSet* scrollableAreas = m_renderView->frameVie
w()->scrollableAreas(); | 307 const FrameView::ScrollableAreaSet* scrollableAreas = m_renderView.frameView
()->scrollableAreas(); |
| 309 if (!scrollableAreas) | 308 if (!scrollableAreas) |
| 310 return; | 309 return; |
| 311 | 310 |
| 312 for (FrameView::ScrollableAreaSet::iterator it = scrollableAreas->begin(); i
t != scrollableAreas->end(); ++it) | 311 for (FrameView::ScrollableAreaSet::iterator it = scrollableAreas->begin(); i
t != scrollableAreas->end(); ++it) |
| 313 (*it)->updateNeedsCompositedScrolling(); | 312 (*it)->updateNeedsCompositedScrolling(); |
| 314 } | 313 } |
| 315 | 314 |
| 316 static RenderVideo* findFullscreenVideoRenderer(Document& document) | 315 static RenderVideo* findFullscreenVideoRenderer(Document& document) |
| 317 { | 316 { |
| 318 Element* fullscreenElement = FullscreenElementStack::fullscreenElementFrom(d
ocument); | 317 Element* fullscreenElement = FullscreenElementStack::fullscreenElementFrom(d
ocument); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 345 | 344 |
| 346 void RenderLayerCompositor::setNeedsCompositingUpdate(CompositingUpdateType upda
teType) | 345 void RenderLayerCompositor::setNeedsCompositingUpdate(CompositingUpdateType upda
teType) |
| 347 { | 346 { |
| 348 // FIXME: this code was historically part of updateCompositingLayers, and | 347 // FIXME: this code was historically part of updateCompositingLayers, and |
| 349 // for now is kept totally equivalent to the previous implementation. We | 348 // for now is kept totally equivalent to the previous implementation. We |
| 350 // should carefully clean up the awkward early-exit semantics, balancing bet
ween | 349 // should carefully clean up the awkward early-exit semantics, balancing bet
ween |
| 351 // skipping unnecessary compositing updates and not incorrectly skipping | 350 // skipping unnecessary compositing updates and not incorrectly skipping |
| 352 // necessary updates. | 351 // necessary updates. |
| 353 | 352 |
| 354 // Avoid updating the layers with old values. Compositing layers will be upd
ated after the layout is finished. | 353 // Avoid updating the layers with old values. Compositing layers will be upd
ated after the layout is finished. |
| 355 if (m_renderView->needsLayout()) | 354 if (m_renderView.needsLayout()) |
| 356 return; | 355 return; |
| 357 | 356 |
| 358 if (m_forceCompositingMode && !m_compositing) | 357 if (m_forceCompositingMode && !m_compositing) |
| 359 enableCompositingMode(true); | 358 enableCompositingMode(true); |
| 360 | 359 |
| 361 if (!m_needsToRecomputeCompositingRequirements && !m_compositing) | 360 if (!m_needsToRecomputeCompositingRequirements && !m_compositing) |
| 362 return; | 361 return; |
| 363 | 362 |
| 364 switch (updateType) { | 363 switch (updateType) { |
| 365 case CompositingUpdateAfterStyleChange: | 364 case CompositingUpdateAfterStyleChange: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 376 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't
need a ForceUpdate here. | 375 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't
need a ForceUpdate here. |
| 377 m_pendingUpdateType = GraphicsLayerUpdater::ForceUpdate; | 376 m_pendingUpdateType = GraphicsLayerUpdater::ForceUpdate; |
| 378 break; | 377 break; |
| 379 case CompositingUpdateOnCompositedScroll: | 378 case CompositingUpdateOnCompositedScroll: |
| 380 m_needsToUpdateLayerTreeGeometry = true; | 379 m_needsToUpdateLayerTreeGeometry = true; |
| 381 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't
need a ForceUpdate here. | 380 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't
need a ForceUpdate here. |
| 382 m_pendingUpdateType = GraphicsLayerUpdater::ForceUpdate; | 381 m_pendingUpdateType = GraphicsLayerUpdater::ForceUpdate; |
| 383 break; | 382 break; |
| 384 } | 383 } |
| 385 | 384 |
| 386 m_renderView->frameView()->scheduleAnimation(); | 385 m_renderView.frameView()->scheduleAnimation(); |
| 387 } | 386 } |
| 388 | 387 |
| 389 void RenderLayerCompositor::updateCompositingLayers() | 388 void RenderLayerCompositor::updateCompositingLayers() |
| 390 { | 389 { |
| 391 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::updateCompositingLay
ers"); | 390 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::updateCompositingLay
ers"); |
| 392 | 391 |
| 393 // FIXME: We should carefully clean up the awkward early-exit semantics, bal
ancing | 392 // FIXME: We should carefully clean up the awkward early-exit semantics, bal
ancing |
| 394 // between skipping unnecessary compositing updates and not incorrectly skip
ping | 393 // between skipping unnecessary compositing updates and not incorrectly skip
ping |
| 395 // necessary updates. | 394 // necessary updates. |
| 396 | 395 |
| 397 // Avoid updating the layers with old values. Compositing layers will be upd
ated after the layout is finished. | 396 // Avoid updating the layers with old values. Compositing layers will be upd
ated after the layout is finished. |
| 398 // FIXME: Can we assert that we never return here? | 397 // FIXME: Can we assert that we never return here? |
| 399 if (m_renderView->needsLayout()) | 398 if (m_renderView.needsLayout()) |
| 400 return; | 399 return; |
| 401 | 400 |
| 402 lifecycle().advanceTo(DocumentLifecycle::InCompositingUpdate); | 401 lifecycle().advanceTo(DocumentLifecycle::InCompositingUpdate); |
| 403 | 402 |
| 404 updateCompositingLayersInternal(); | 403 updateCompositingLayersInternal(); |
| 405 | 404 |
| 406 lifecycle().advanceTo(DocumentLifecycle::CompositingClean); | 405 lifecycle().advanceTo(DocumentLifecycle::CompositingClean); |
| 407 | 406 |
| 408 DocumentAnimations::startPendingAnimations(m_renderView->document()); | 407 DocumentAnimations::startPendingAnimations(m_renderView.document()); |
| 409 ASSERT(m_renderView->document().lifecycle().state() == DocumentLifecycle::Co
mpositingClean); | 408 ASSERT(m_renderView.document().lifecycle().state() == DocumentLifecycle::Com
positingClean); |
| 410 } | 409 } |
| 411 | 410 |
| 412 void RenderLayerCompositor::updateCompositingLayersInternal() | 411 void RenderLayerCompositor::updateCompositingLayersInternal() |
| 413 { | 412 { |
| 414 if (isMainFrame() && m_renderView->frameView()) | 413 if (isMainFrame() && m_renderView.frameView()) |
| 415 finishCompositingUpdateForFrameTree(&m_renderView->frameView()->frame())
; | 414 finishCompositingUpdateForFrameTree(&m_renderView.frameView()->frame()); |
| 416 | 415 |
| 417 if (m_forceCompositingMode && !m_compositing) | 416 if (m_forceCompositingMode && !m_compositing) |
| 418 enableCompositingMode(true); | 417 enableCompositingMode(true); |
| 419 | 418 |
| 420 if (!m_needsToRecomputeCompositingRequirements && !m_compositing) | 419 if (!m_needsToRecomputeCompositingRequirements && !m_compositing) |
| 421 return; | 420 return; |
| 422 | 421 |
| 423 bool needCompositingRequirementsUpdate = m_needsToRecomputeCompositingRequir
ements; | 422 bool needCompositingRequirementsUpdate = m_needsToRecomputeCompositingRequir
ements; |
| 424 bool needHierarchyAndGeometryUpdate = m_compositingLayersNeedRebuild; | 423 bool needHierarchyAndGeometryUpdate = m_compositingLayersNeedRebuild; |
| 425 bool needGeometryUpdate = m_needsToUpdateLayerTreeGeometry; | 424 bool needGeometryUpdate = m_needsToUpdateLayerTreeGeometry; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 computeCompositingRequirements(0, updateRoot, overlapMap, recursionD
ata, saw3DTransform, unclippedDescendants, absoluteDecendantBoundingBox); | 460 computeCompositingRequirements(0, updateRoot, overlapMap, recursionD
ata, saw3DTransform, unclippedDescendants, absoluteDecendantBoundingBox); |
| 462 } | 461 } |
| 463 | 462 |
| 464 { | 463 { |
| 465 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::assignLayers
ToBackings"); | 464 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::assignLayers
ToBackings"); |
| 466 assignLayersToBackings(updateRoot, layersChanged); | 465 assignLayersToBackings(updateRoot, layersChanged); |
| 467 } | 466 } |
| 468 | 467 |
| 469 { | 468 { |
| 470 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::updateHasVis
ibleNonLayerContentLoop"); | 469 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::updateHasVis
ibleNonLayerContentLoop"); |
| 471 const FrameView::ScrollableAreaSet* scrollableAreas = m_renderView->
frameView()->scrollableAreas(); | 470 const FrameView::ScrollableAreaSet* scrollableAreas = m_renderView.f
rameView()->scrollableAreas(); |
| 472 if (scrollableAreas) { | 471 if (scrollableAreas) { |
| 473 for (FrameView::ScrollableAreaSet::iterator it = scrollableAreas
->begin(); it != scrollableAreas->end(); ++it) | 472 for (FrameView::ScrollableAreaSet::iterator it = scrollableAreas
->begin(); it != scrollableAreas->end(); ++it) |
| 474 (*it)->updateHasVisibleNonLayerContent(); | 473 (*it)->updateHasVisibleNonLayerContent(); |
| 475 } | 474 } |
| 476 } | 475 } |
| 477 | 476 |
| 478 if (layersChanged) | 477 if (layersChanged) |
| 479 needHierarchyAndGeometryUpdate = true; | 478 needHierarchyAndGeometryUpdate = true; |
| 480 } | 479 } |
| 481 | 480 |
| 482 if (needHierarchyAndGeometryUpdate) { | 481 if (needHierarchyAndGeometryUpdate) { |
| 483 // Update the hierarchy of the compositing layers. | 482 // Update the hierarchy of the compositing layers. |
| 484 GraphicsLayerVector childList; | 483 GraphicsLayerVector childList; |
| 485 { | 484 { |
| 486 TRACE_EVENT0("blink_rendering", "GraphicsLayerUpdater::rebuildTree")
; | 485 TRACE_EVENT0("blink_rendering", "GraphicsLayerUpdater::rebuildTree")
; |
| 487 GraphicsLayerUpdater(*m_renderView).rebuildTree(*updateRoot, updateT
ype, childList, 0); | 486 GraphicsLayerUpdater(m_renderView).rebuildTree(*updateRoot, updateTy
pe, childList, 0); |
| 488 } | 487 } |
| 489 | 488 |
| 490 // Host the document layer in the RenderView's root layer. | 489 // Host the document layer in the RenderView's root layer. |
| 491 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && isMainFra
me()) { | 490 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && isMainFra
me()) { |
| 492 RenderVideo* video = findFullscreenVideoRenderer(m_renderView->docum
ent()); | 491 RenderVideo* video = findFullscreenVideoRenderer(m_renderView.docume
nt()); |
| 493 if (video && video->hasCompositedLayerMapping()) { | 492 if (video && video->hasCompositedLayerMapping()) { |
| 494 childList.clear(); | 493 childList.clear(); |
| 495 childList.append(video->compositedLayerMapping()->mainGraphicsLa
yer()); | 494 childList.append(video->compositedLayerMapping()->mainGraphicsLa
yer()); |
| 496 } | 495 } |
| 497 } | 496 } |
| 498 | 497 |
| 499 if (childList.isEmpty()) | 498 if (childList.isEmpty()) |
| 500 destroyRootLayer(); | 499 destroyRootLayer(); |
| 501 else | 500 else |
| 502 m_rootContentLayer->setChildren(childList); | 501 m_rootContentLayer->setChildren(childList); |
| 503 } else if (needGeometryUpdate) { | 502 } else if (needGeometryUpdate) { |
| 504 // We just need to do a geometry update. This is only used for position:
fixed scrolling; | 503 // We just need to do a geometry update. This is only used for position:
fixed scrolling; |
| 505 // most of the time, geometry is updated via RenderLayer::styleChanged()
. | 504 // most of the time, geometry is updated via RenderLayer::styleChanged()
. |
| 506 TRACE_EVENT0("blink_rendering", "GraphicsLayerUpdater::updateRecursive")
; | 505 TRACE_EVENT0("blink_rendering", "GraphicsLayerUpdater::updateRecursive")
; |
| 507 GraphicsLayerUpdater(*m_renderView).updateRecursive(*updateRoot, updateT
ype); | 506 GraphicsLayerUpdater(m_renderView).updateRecursive(*updateRoot, updateTy
pe); |
| 508 } | 507 } |
| 509 | 508 |
| 510 ASSERT(updateRoot || !m_compositingLayersNeedRebuild); | 509 ASSERT(updateRoot || !m_compositingLayersNeedRebuild); |
| 511 | 510 |
| 512 if (!hasAcceleratedCompositing()) | 511 if (!hasAcceleratedCompositing()) |
| 513 enableCompositingMode(false); | 512 enableCompositingMode(false); |
| 514 | 513 |
| 515 // The scrolling coordinator may realize that it needs updating while compos
iting was being updated in this function. | 514 // The scrolling coordinator may realize that it needs updating while compos
iting was being updated in this function. |
| 516 needsToUpdateScrollingCoordinator |= scrollingCoordinator() ? scrollingCoord
inator()->needsToUpdateAfterCompositingChange() : false; | 515 needsToUpdateScrollingCoordinator |= scrollingCoordinator() ? scrollingCoord
inator()->needsToUpdateAfterCompositingChange() : false; |
| 517 if (needsToUpdateScrollingCoordinator && isMainFrame() && scrollingCoordinat
or() && inCompositingMode()) | 516 if (needsToUpdateScrollingCoordinator && isMainFrame() && scrollingCoordinat
or() && inCompositingMode()) |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 enableCompositingMode(); | 568 enableCompositingMode(); |
| 570 | 569 |
| 571 // If we need to repaint, do so before allocating the compositedLayerMap
ping | 570 // If we need to repaint, do so before allocating the compositedLayerMap
ping |
| 572 repaintOnCompositingChange(layer); | 571 repaintOnCompositingChange(layer); |
| 573 layer->ensureCompositedLayerMapping(); | 572 layer->ensureCompositedLayerMapping(); |
| 574 compositedLayerMappingChanged = true; | 573 compositedLayerMappingChanged = true; |
| 575 | 574 |
| 576 // At this time, the ScrollingCooridnator only supports the top-level fr
ame. | 575 // At this time, the ScrollingCooridnator only supports the top-level fr
ame. |
| 577 if (layer->isRootLayer() && isMainFrame()) { | 576 if (layer->isRootLayer() && isMainFrame()) { |
| 578 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoor
dinator()) | 577 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoor
dinator()) |
| 579 scrollingCoordinator->frameViewRootLayerDidChange(m_renderView->
frameView()); | 578 scrollingCoordinator->frameViewRootLayerDidChange(m_renderView.f
rameView()); |
| 580 } | 579 } |
| 581 | 580 |
| 582 // If this layer was previously squashed, we need to remove its referenc
e to a groupedMapping right away, so | 581 // If this layer was previously squashed, we need to remove its referenc
e to a groupedMapping right away, so |
| 583 // that computing repaint rects will know the layer's correct compositin
gState. | 582 // that computing repaint rects will know the layer's correct compositin
gState. |
| 584 // FIXME: do we need to also remove the layer from it's location in the
squashing list of its groupedMapping? | 583 // FIXME: do we need to also remove the layer from it's location in the
squashing list of its groupedMapping? |
| 585 // Need to create a test where a squashed layer pops into compositing. A
nd also to cover all other | 584 // Need to create a test where a squashed layer pops into compositing. A
nd also to cover all other |
| 586 // sorts of compositingState transitions. | 585 // sorts of compositingState transitions. |
| 587 layer->setLostGroupedMapping(false); | 586 layer->setLostGroupedMapping(false); |
| 588 layer->setGroupedMapping(0); | 587 layer->setGroupedMapping(0); |
| 589 | 588 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 innerCompositor->updateRootLayerAttachment(); | 637 innerCompositor->updateRootLayerAttachment(); |
| 639 } | 638 } |
| 640 | 639 |
| 641 if (compositedLayerMappingChanged) | 640 if (compositedLayerMappingChanged) |
| 642 layer->clipper().clearClipRectsIncludingDescendants(PaintingClipRects); | 641 layer->clipper().clearClipRectsIncludingDescendants(PaintingClipRects); |
| 643 | 642 |
| 644 // If a fixed position layer gained/lost a compositedLayerMapping or the rea
son not compositing it changed, | 643 // If a fixed position layer gained/lost a compositedLayerMapping or the rea
son not compositing it changed, |
| 645 // the scrolling coordinator needs to recalculate whether it can do fast scr
olling. | 644 // the scrolling coordinator needs to recalculate whether it can do fast scr
olling. |
| 646 if (compositedLayerMappingChanged || nonCompositedReasonChanged) { | 645 if (compositedLayerMappingChanged || nonCompositedReasonChanged) { |
| 647 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) | 646 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) |
| 648 scrollingCoordinator->frameViewFixedObjectsDidChange(m_renderView->f
rameView()); | 647 scrollingCoordinator->frameViewFixedObjectsDidChange(m_renderView.fr
ameView()); |
| 649 } | 648 } |
| 650 | 649 |
| 651 return compositedLayerMappingChanged || nonCompositedReasonChanged; | 650 return compositedLayerMappingChanged || nonCompositedReasonChanged; |
| 652 } | 651 } |
| 653 | 652 |
| 654 static IntPoint computeOffsetFromAbsolute(RenderLayer* layer) | 653 static IntPoint computeOffsetFromAbsolute(RenderLayer* layer) |
| 655 { | 654 { |
| 656 TransformState transformState(TransformState::ApplyTransformDirection, Float
Point()); | 655 TransformState transformState(TransformState::ApplyTransformDirection, Float
Point()); |
| 657 layer->renderer()->mapLocalToContainer(0, transformState, ApplyContainerFlip
); | 656 layer->renderer()->mapLocalToContainer(0, transformState, ApplyContainerFlip
); |
| 658 transformState.flatten(); | 657 transformState.flatten(); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 setNeedsToRecomputeCompositingRequirements(); | 778 setNeedsToRecomputeCompositingRequirements(); |
| 780 } | 779 } |
| 781 | 780 |
| 782 if (options == UseChickenEggHacks) | 781 if (options == UseChickenEggHacks) |
| 783 applyUpdateLayerCompositingStateChickenEggHacks(layer, compositedLayerUp
date); | 782 applyUpdateLayerCompositingStateChickenEggHacks(layer, compositedLayerUp
date); |
| 784 } | 783 } |
| 785 | 784 |
| 786 void RenderLayerCompositor::repaintOnCompositingChange(RenderLayer* layer) | 785 void RenderLayerCompositor::repaintOnCompositingChange(RenderLayer* layer) |
| 787 { | 786 { |
| 788 // If the renderer is not attached yet, no need to repaint. | 787 // If the renderer is not attached yet, no need to repaint. |
| 789 if (layer->renderer() != m_renderView && !layer->renderer()->parent()) | 788 if (layer->renderer() != &m_renderView && !layer->renderer()->parent()) |
| 790 return; | 789 return; |
| 791 | 790 |
| 792 RenderLayerModelObject* repaintContainer = layer->renderer()->containerForRe
paint(); | 791 RenderLayerModelObject* repaintContainer = layer->renderer()->containerForRe
paint(); |
| 793 if (!repaintContainer) | 792 if (!repaintContainer) |
| 794 repaintContainer = m_renderView; | 793 repaintContainer = &m_renderView; |
| 795 | 794 |
| 796 layer->repainter().repaintIncludingNonCompositingDescendants(repaintContaine
r); | 795 layer->repainter().repaintIncludingNonCompositingDescendants(repaintContaine
r); |
| 797 } | 796 } |
| 798 | 797 |
| 799 // This method assumes that layout is up-to-date, unlike repaintOnCompositingCha
nge(). | 798 // This method assumes that layout is up-to-date, unlike repaintOnCompositingCha
nge(). |
| 800 void RenderLayerCompositor::repaintInCompositedAncestor(RenderLayer* layer, cons
t LayoutRect& rect) | 799 void RenderLayerCompositor::repaintInCompositedAncestor(RenderLayer* layer, cons
t LayoutRect& rect) |
| 801 { | 800 { |
| 802 RenderLayer* compositedAncestor = layer->enclosingCompositingLayerForRepaint
(ExcludeSelf); | 801 RenderLayer* compositedAncestor = layer->enclosingCompositingLayerForRepaint
(ExcludeSelf); |
| 803 if (compositedAncestor) { | 802 if (compositedAncestor) { |
| 804 // FIXME: make sure repaintRect is computed correctly for squashed scena
rio | 803 // FIXME: make sure repaintRect is computed correctly for squashed scena
rio |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 directReasons |= CompositingReasonVideoOverlay; | 913 directReasons |= CompositingReasonVideoOverlay; |
| 915 | 914 |
| 916 if (canBeComposited(layer)) | 915 if (canBeComposited(layer)) |
| 917 reasonsToComposite |= directReasons; | 916 reasonsToComposite |= directReasons; |
| 918 | 917 |
| 919 // Next, accumulate reasons related to overlap. | 918 // Next, accumulate reasons related to overlap. |
| 920 // If overlap testing is used, this reason will be overridden. If overlap te
sting is not | 919 // If overlap testing is used, this reason will be overridden. If overlap te
sting is not |
| 921 // used, we must assume we overlap if there is anything composited behind us
in paint-order. | 920 // used, we must assume we overlap if there is anything composited behind us
in paint-order. |
| 922 CompositingReasons overlapCompositingReason = currentRecursionData.m_subtree
IsCompositing ? CompositingReasonAssumedOverlap : CompositingReasonNone; | 921 CompositingReasons overlapCompositingReason = currentRecursionData.m_subtree
IsCompositing ? CompositingReasonAssumedOverlap : CompositingReasonNone; |
| 923 | 922 |
| 924 if (m_renderView->compositorDrivenAcceleratedScrollingEnabled()) { | 923 if (m_renderView.compositorDrivenAcceleratedScrollingEnabled()) { |
| 925 Vector<size_t> unclippedDescendantsToRemove; | 924 Vector<size_t> unclippedDescendantsToRemove; |
| 926 for (size_t i = 0; i < unclippedDescendants.size(); i++) { | 925 for (size_t i = 0; i < unclippedDescendants.size(); i++) { |
| 927 RenderLayer* unclippedDescendant = unclippedDescendants.at(i); | 926 RenderLayer* unclippedDescendant = unclippedDescendants.at(i); |
| 928 // If we've reached the containing block of one of the unclipped | 927 // If we've reached the containing block of one of the unclipped |
| 929 // descendants, that element is no longer relevant to whether or not
we | 928 // descendants, that element is no longer relevant to whether or not
we |
| 930 // should opt in. Unfortunately we can't easily remove from the list | 929 // should opt in. Unfortunately we can't easily remove from the list |
| 931 // while we're iterating, so we have to store it for later removal. | 930 // while we're iterating, so we have to store it for later removal. |
| 932 if (unclippedDescendant->renderer()->containingBlock() == layer->ren
derer()) { | 931 if (unclippedDescendant->renderer()->containingBlock() == layer->ren
derer()) { |
| 933 unclippedDescendantsToRemove.append(i); | 932 unclippedDescendantsToRemove.append(i); |
| 934 continue; | 933 continue; |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1252 | 1251 |
| 1253 void RenderLayerCompositor::frameViewDidChangeLocation(const IntPoint& contentsO
ffset) | 1252 void RenderLayerCompositor::frameViewDidChangeLocation(const IntPoint& contentsO
ffset) |
| 1254 { | 1253 { |
| 1255 if (m_overflowControlsHostLayer) | 1254 if (m_overflowControlsHostLayer) |
| 1256 m_overflowControlsHostLayer->setPosition(contentsOffset); | 1255 m_overflowControlsHostLayer->setPosition(contentsOffset); |
| 1257 } | 1256 } |
| 1258 | 1257 |
| 1259 void RenderLayerCompositor::frameViewDidChangeSize() | 1258 void RenderLayerCompositor::frameViewDidChangeSize() |
| 1260 { | 1259 { |
| 1261 if (m_containerLayer) { | 1260 if (m_containerLayer) { |
| 1262 FrameView* frameView = m_renderView->frameView(); | 1261 FrameView* frameView = m_renderView.frameView(); |
| 1263 m_containerLayer->setSize(frameView->unscaledVisibleContentSize()); | 1262 m_containerLayer->setSize(frameView->unscaledVisibleContentSize()); |
| 1264 | 1263 |
| 1265 frameViewDidScroll(); | 1264 frameViewDidScroll(); |
| 1266 updateOverflowControlsLayers(); | 1265 updateOverflowControlsLayers(); |
| 1267 } | 1266 } |
| 1268 } | 1267 } |
| 1269 | 1268 |
| 1270 enum AcceleratedFixedRootBackgroundHistogramBuckets { | 1269 enum AcceleratedFixedRootBackgroundHistogramBuckets { |
| 1271 ScrolledMainFrameBucket = 0, | 1270 ScrolledMainFrameBucket = 0, |
| 1272 ScrolledMainFrameWithAcceleratedFixedRootBackground = 1, | 1271 ScrolledMainFrameWithAcceleratedFixedRootBackground = 1, |
| 1273 ScrolledMainFrameWithUnacceleratedFixedRootBackground = 2, | 1272 ScrolledMainFrameWithUnacceleratedFixedRootBackground = 2, |
| 1274 AcceleratedFixedRootBackgroundHistogramMax = 3 | 1273 AcceleratedFixedRootBackgroundHistogramMax = 3 |
| 1275 }; | 1274 }; |
| 1276 | 1275 |
| 1277 void RenderLayerCompositor::frameViewDidScroll() | 1276 void RenderLayerCompositor::frameViewDidScroll() |
| 1278 { | 1277 { |
| 1279 FrameView* frameView = m_renderView->frameView(); | 1278 FrameView* frameView = m_renderView.frameView(); |
| 1280 IntPoint scrollPosition = frameView->scrollPosition(); | 1279 IntPoint scrollPosition = frameView->scrollPosition(); |
| 1281 | 1280 |
| 1282 if (!m_scrollLayer) | 1281 if (!m_scrollLayer) |
| 1283 return; | 1282 return; |
| 1284 | 1283 |
| 1285 bool scrollingCoordinatorHandlesOffset = false; | 1284 bool scrollingCoordinatorHandlesOffset = false; |
| 1286 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(
)) { | 1285 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(
)) { |
| 1287 if (Settings* settings = m_renderView->document().settings()) { | 1286 if (Settings* settings = m_renderView.document().settings()) { |
| 1288 if (isMainFrame() || settings->compositedScrollingForFramesEnabled()
) | 1287 if (isMainFrame() || settings->compositedScrollingForFramesEnabled()
) |
| 1289 scrollingCoordinatorHandlesOffset = scrollingCoordinator->scroll
ableAreaScrollLayerDidChange(frameView); | 1288 scrollingCoordinatorHandlesOffset = scrollingCoordinator->scroll
ableAreaScrollLayerDidChange(frameView); |
| 1290 } | 1289 } |
| 1291 } | 1290 } |
| 1292 | 1291 |
| 1293 // Scroll position = scroll minimum + scroll offset. Adjust the layer's | 1292 // Scroll position = scroll minimum + scroll offset. Adjust the layer's |
| 1294 // position to handle whatever the scroll coordinator isn't handling. | 1293 // position to handle whatever the scroll coordinator isn't handling. |
| 1295 // The minimum scroll position is non-zero for RTL pages with overflow. | 1294 // The minimum scroll position is non-zero for RTL pages with overflow. |
| 1296 if (scrollingCoordinatorHandlesOffset) | 1295 if (scrollingCoordinatorHandlesOffset) |
| 1297 m_scrollLayer->setPosition(-frameView->minimumScrollPosition()); | 1296 m_scrollLayer->setPosition(-frameView->minimumScrollPosition()); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1355 // root. | 1354 // root. |
| 1356 GraphicsLayer* rootLayer = m_rootContentLayer.get(); | 1355 GraphicsLayer* rootLayer = m_rootContentLayer.get(); |
| 1357 if (flags & LayerTreeIncludesRootLayer) | 1356 if (flags & LayerTreeIncludesRootLayer) |
| 1358 rootLayer = rootGraphicsLayer(); | 1357 rootLayer = rootGraphicsLayer(); |
| 1359 | 1358 |
| 1360 String layerTreeText = rootLayer->layerTreeAsText(flags); | 1359 String layerTreeText = rootLayer->layerTreeAsText(flags); |
| 1361 | 1360 |
| 1362 // The true root layer is not included in the dump, so if we want to report | 1361 // The true root layer is not included in the dump, so if we want to report |
| 1363 // its repaint rects, they must be included here. | 1362 // its repaint rects, they must be included here. |
| 1364 if (flags & LayerTreeIncludesRepaintRects) | 1363 if (flags & LayerTreeIncludesRepaintRects) |
| 1365 return m_renderView->frameView()->trackedRepaintRectsAsText() + layerTre
eText; | 1364 return m_renderView.frameView()->trackedRepaintRectsAsText() + layerTree
Text; |
| 1366 | 1365 |
| 1367 return layerTreeText; | 1366 return layerTreeText; |
| 1368 } | 1367 } |
| 1369 | 1368 |
| 1370 RenderLayerCompositor* RenderLayerCompositor::frameContentsCompositor(RenderPart
* renderer) | 1369 RenderLayerCompositor* RenderLayerCompositor::frameContentsCompositor(RenderPart
* renderer) |
| 1371 { | 1370 { |
| 1372 if (!renderer->node()->isFrameOwnerElement()) | 1371 if (!renderer->node()->isFrameOwnerElement()) |
| 1373 return 0; | 1372 return 0; |
| 1374 | 1373 |
| 1375 HTMLFrameOwnerElement* element = toHTMLFrameOwnerElement(renderer->node()); | 1374 HTMLFrameOwnerElement* element = toHTMLFrameOwnerElement(renderer->node()); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1455 unsigned childrenToVisit = NormalFlowChildren; | 1454 unsigned childrenToVisit = NormalFlowChildren; |
| 1456 if (layer->hasCompositingDescendant()) | 1455 if (layer->hasCompositingDescendant()) |
| 1457 childrenToVisit |= PositiveZOrderChildren | NegativeZOrderChildren; | 1456 childrenToVisit |= PositiveZOrderChildren | NegativeZOrderChildren; |
| 1458 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), childrenToV
isit); | 1457 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), childrenToV
isit); |
| 1459 while (RenderLayerStackingNode* curNode = iterator.next()) | 1458 while (RenderLayerStackingNode* curNode = iterator.next()) |
| 1460 recursiveRepaintLayer(curNode->layer()); | 1459 recursiveRepaintLayer(curNode->layer()); |
| 1461 } | 1460 } |
| 1462 | 1461 |
| 1463 RenderLayer* RenderLayerCompositor::rootRenderLayer() const | 1462 RenderLayer* RenderLayerCompositor::rootRenderLayer() const |
| 1464 { | 1463 { |
| 1465 return m_renderView->layer(); | 1464 return m_renderView.layer(); |
| 1466 } | 1465 } |
| 1467 | 1466 |
| 1468 GraphicsLayer* RenderLayerCompositor::rootGraphicsLayer() const | 1467 GraphicsLayer* RenderLayerCompositor::rootGraphicsLayer() const |
| 1469 { | 1468 { |
| 1470 if (m_overflowControlsHostLayer) | 1469 if (m_overflowControlsHostLayer) |
| 1471 return m_overflowControlsHostLayer.get(); | 1470 return m_overflowControlsHostLayer.get(); |
| 1472 return m_rootContentLayer.get(); | 1471 return m_rootContentLayer.get(); |
| 1473 } | 1472 } |
| 1474 | 1473 |
| 1475 GraphicsLayer* RenderLayerCompositor::scrollLayer() const | 1474 GraphicsLayer* RenderLayerCompositor::scrollLayer() const |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1524 removeViewportConstrainedLayer(layer); | 1523 removeViewportConstrainedLayer(layer); |
| 1525 layer->clearCompositedLayerMapping(); | 1524 layer->clearCompositedLayerMapping(); |
| 1526 } | 1525 } |
| 1527 | 1526 |
| 1528 for (RenderLayer* currLayer = layer->firstChild(); currLayer; currLayer = cu
rrLayer->nextSibling()) | 1527 for (RenderLayer* currLayer = layer->firstChild(); currLayer; currLayer = cu
rrLayer->nextSibling()) |
| 1529 clearMappingForRenderLayerIncludingDescendants(currLayer); | 1528 clearMappingForRenderLayerIncludingDescendants(currLayer); |
| 1530 } | 1529 } |
| 1531 | 1530 |
| 1532 void RenderLayerCompositor::clearMappingForAllRenderLayers() | 1531 void RenderLayerCompositor::clearMappingForAllRenderLayers() |
| 1533 { | 1532 { |
| 1534 clearMappingForRenderLayerIncludingDescendants(m_renderView->layer()); | 1533 clearMappingForRenderLayerIncludingDescendants(m_renderView.layer()); |
| 1535 } | 1534 } |
| 1536 | 1535 |
| 1537 void RenderLayerCompositor::updateRootLayerPosition() | 1536 void RenderLayerCompositor::updateRootLayerPosition() |
| 1538 { | 1537 { |
| 1539 if (m_rootContentLayer) { | 1538 if (m_rootContentLayer) { |
| 1540 const IntRect& documentRect = m_renderView->documentRect(); | 1539 const IntRect& documentRect = m_renderView.documentRect(); |
| 1541 m_rootContentLayer->setSize(documentRect.size()); | 1540 m_rootContentLayer->setSize(documentRect.size()); |
| 1542 m_rootContentLayer->setPosition(documentRect.location()); | 1541 m_rootContentLayer->setPosition(documentRect.location()); |
| 1543 #if USE(RUBBER_BANDING) | 1542 #if USE(RUBBER_BANDING) |
| 1544 if (m_layerForOverhangShadow) | 1543 if (m_layerForOverhangShadow) |
| 1545 OverscrollTheme::theme()->updateOverhangShadowLayer(m_layerForOverha
ngShadow.get(), m_rootContentLayer.get()); | 1544 OverscrollTheme::theme()->updateOverhangShadowLayer(m_layerForOverha
ngShadow.get(), m_rootContentLayer.get()); |
| 1546 #endif | 1545 #endif |
| 1547 } | 1546 } |
| 1548 if (m_containerLayer) { | 1547 if (m_containerLayer) { |
| 1549 FrameView* frameView = m_renderView->frameView(); | 1548 FrameView* frameView = m_renderView.frameView(); |
| 1550 m_containerLayer->setSize(frameView->unscaledVisibleContentSize()); | 1549 m_containerLayer->setSize(frameView->unscaledVisibleContentSize()); |
| 1551 } | 1550 } |
| 1552 } | 1551 } |
| 1553 | 1552 |
| 1554 bool RenderLayerCompositor::has3DContent() const | 1553 bool RenderLayerCompositor::has3DContent() const |
| 1555 { | 1554 { |
| 1556 return layerHas3DContent(rootRenderLayer()); | 1555 return layerHas3DContent(rootRenderLayer()); |
| 1557 } | 1556 } |
| 1558 | 1557 |
| 1559 void RenderLayerCompositor::updateDirectCompositingReasons(RenderLayer* layer) | 1558 void RenderLayerCompositor::updateDirectCompositingReasons(RenderLayer* layer) |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1690 context.translate(-scrollbarRect.x(), -scrollbarRect.y()); | 1689 context.translate(-scrollbarRect.x(), -scrollbarRect.y()); |
| 1691 IntRect transformedClip = clip; | 1690 IntRect transformedClip = clip; |
| 1692 transformedClip.moveBy(scrollbarRect.location()); | 1691 transformedClip.moveBy(scrollbarRect.location()); |
| 1693 scrollbar->paint(&context, transformedClip); | 1692 scrollbar->paint(&context, transformedClip); |
| 1694 context.restore(); | 1693 context.restore(); |
| 1695 } | 1694 } |
| 1696 | 1695 |
| 1697 void RenderLayerCompositor::paintContents(const GraphicsLayer* graphicsLayer, Gr
aphicsContext& context, GraphicsLayerPaintingPhase, const IntRect& clip) | 1696 void RenderLayerCompositor::paintContents(const GraphicsLayer* graphicsLayer, Gr
aphicsContext& context, GraphicsLayerPaintingPhase, const IntRect& clip) |
| 1698 { | 1697 { |
| 1699 if (graphicsLayer == layerForHorizontalScrollbar()) | 1698 if (graphicsLayer == layerForHorizontalScrollbar()) |
| 1700 paintScrollbar(m_renderView->frameView()->horizontalScrollbar(), context
, clip); | 1699 paintScrollbar(m_renderView.frameView()->horizontalScrollbar(), context,
clip); |
| 1701 else if (graphicsLayer == layerForVerticalScrollbar()) | 1700 else if (graphicsLayer == layerForVerticalScrollbar()) |
| 1702 paintScrollbar(m_renderView->frameView()->verticalScrollbar(), context,
clip); | 1701 paintScrollbar(m_renderView.frameView()->verticalScrollbar(), context, c
lip); |
| 1703 else if (graphicsLayer == layerForScrollCorner()) { | 1702 else if (graphicsLayer == layerForScrollCorner()) { |
| 1704 const IntRect& scrollCorner = m_renderView->frameView()->scrollCornerRec
t(); | 1703 const IntRect& scrollCorner = m_renderView.frameView()->scrollCornerRect
(); |
| 1705 context.save(); | 1704 context.save(); |
| 1706 context.translate(-scrollCorner.x(), -scrollCorner.y()); | 1705 context.translate(-scrollCorner.x(), -scrollCorner.y()); |
| 1707 IntRect transformedClip = clip; | 1706 IntRect transformedClip = clip; |
| 1708 transformedClip.moveBy(scrollCorner.location()); | 1707 transformedClip.moveBy(scrollCorner.location()); |
| 1709 m_renderView->frameView()->paintScrollCorner(&context, transformedClip); | 1708 m_renderView.frameView()->paintScrollCorner(&context, transformedClip); |
| 1710 context.restore(); | 1709 context.restore(); |
| 1711 } | 1710 } |
| 1712 } | 1711 } |
| 1713 | 1712 |
| 1714 bool RenderLayerCompositor::supportsFixedRootBackgroundCompositing() const | 1713 bool RenderLayerCompositor::supportsFixedRootBackgroundCompositing() const |
| 1715 { | 1714 { |
| 1716 if (Settings* settings = m_renderView->document().settings()) { | 1715 if (Settings* settings = m_renderView.document().settings()) { |
| 1717 if (settings->acceleratedCompositingForFixedRootBackgroundEnabled()) | 1716 if (settings->acceleratedCompositingForFixedRootBackgroundEnabled()) |
| 1718 return true; | 1717 return true; |
| 1719 } | 1718 } |
| 1720 return false; | 1719 return false; |
| 1721 } | 1720 } |
| 1722 | 1721 |
| 1723 bool RenderLayerCompositor::needsFixedRootBackgroundLayer(const RenderLayer* lay
er) const | 1722 bool RenderLayerCompositor::needsFixedRootBackgroundLayer(const RenderLayer* lay
er) const |
| 1724 { | 1723 { |
| 1725 if (layer != m_renderView->layer()) | 1724 if (layer != m_renderView.layer()) |
| 1726 return false; | 1725 return false; |
| 1727 | 1726 |
| 1728 return supportsFixedRootBackgroundCompositing() && m_renderView->rootBackgro
undIsEntirelyFixed(); | 1727 return supportsFixedRootBackgroundCompositing() && m_renderView.rootBackgrou
ndIsEntirelyFixed(); |
| 1729 } | 1728 } |
| 1730 | 1729 |
| 1731 GraphicsLayer* RenderLayerCompositor::fixedRootBackgroundLayer() const | 1730 GraphicsLayer* RenderLayerCompositor::fixedRootBackgroundLayer() const |
| 1732 { | 1731 { |
| 1733 // Get the fixed root background from the RenderView layer's compositedLayer
Mapping. | 1732 // Get the fixed root background from the RenderView layer's compositedLayer
Mapping. |
| 1734 RenderLayer* viewLayer = m_renderView->layer(); | 1733 RenderLayer* viewLayer = m_renderView.layer(); |
| 1735 if (!viewLayer) | 1734 if (!viewLayer) |
| 1736 return 0; | 1735 return 0; |
| 1737 | 1736 |
| 1738 if (viewLayer->compositingState() == PaintsIntoOwnBacking && viewLayer->comp
ositedLayerMapping()->backgroundLayerPaintsFixedRootBackground()) | 1737 if (viewLayer->compositingState() == PaintsIntoOwnBacking && viewLayer->comp
ositedLayerMapping()->backgroundLayerPaintsFixedRootBackground()) |
| 1739 return viewLayer->compositedLayerMapping()->backgroundLayer(); | 1738 return viewLayer->compositedLayerMapping()->backgroundLayer(); |
| 1740 | 1739 |
| 1741 return 0; | 1740 return 0; |
| 1742 } | 1741 } |
| 1743 | 1742 |
| 1744 static void resetTrackedRepaintRectsRecursive(GraphicsLayer* graphicsLayer) | 1743 static void resetTrackedRepaintRectsRecursive(GraphicsLayer* graphicsLayer) |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1784 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina
tor()) | 1783 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina
tor()) |
| 1785 if (scrollingCoordinator->coordinatesScrollingForFrameView(view)) | 1784 if (scrollingCoordinator->coordinatesScrollingForFrameView(view)) |
| 1786 return true; | 1785 return true; |
| 1787 } | 1786 } |
| 1788 | 1787 |
| 1789 return true; | 1788 return true; |
| 1790 } | 1789 } |
| 1791 | 1790 |
| 1792 bool RenderLayerCompositor::requiresHorizontalScrollbarLayer() const | 1791 bool RenderLayerCompositor::requiresHorizontalScrollbarLayer() const |
| 1793 { | 1792 { |
| 1794 FrameView* view = m_renderView->frameView(); | 1793 FrameView* view = m_renderView.frameView(); |
| 1795 return shouldCompositeOverflowControls(view) && view->horizontalScrollbar(); | 1794 return shouldCompositeOverflowControls(view) && view->horizontalScrollbar(); |
| 1796 } | 1795 } |
| 1797 | 1796 |
| 1798 bool RenderLayerCompositor::requiresVerticalScrollbarLayer() const | 1797 bool RenderLayerCompositor::requiresVerticalScrollbarLayer() const |
| 1799 { | 1798 { |
| 1800 FrameView* view = m_renderView->frameView(); | 1799 FrameView* view = m_renderView.frameView(); |
| 1801 return shouldCompositeOverflowControls(view) && view->verticalScrollbar(); | 1800 return shouldCompositeOverflowControls(view) && view->verticalScrollbar(); |
| 1802 } | 1801 } |
| 1803 | 1802 |
| 1804 bool RenderLayerCompositor::requiresScrollCornerLayer() const | 1803 bool RenderLayerCompositor::requiresScrollCornerLayer() const |
| 1805 { | 1804 { |
| 1806 FrameView* view = m_renderView->frameView(); | 1805 FrameView* view = m_renderView.frameView(); |
| 1807 return shouldCompositeOverflowControls(view) && view->isScrollCornerVisible(
); | 1806 return shouldCompositeOverflowControls(view) && view->isScrollCornerVisible(
); |
| 1808 } | 1807 } |
| 1809 | 1808 |
| 1810 #if USE(RUBBER_BANDING) | 1809 #if USE(RUBBER_BANDING) |
| 1811 bool RenderLayerCompositor::requiresOverhangLayers() const | 1810 bool RenderLayerCompositor::requiresOverhangLayers() const |
| 1812 { | 1811 { |
| 1813 // We don't want a layer if this is a subframe. | 1812 // We don't want a layer if this is a subframe. |
| 1814 if (!isMainFrame()) | 1813 if (!isMainFrame()) |
| 1815 return false; | 1814 return false; |
| 1816 | 1815 |
| 1817 // We do want a layer if we have a scrolling coordinator and can scroll. | 1816 // We do want a layer if we have a scrolling coordinator and can scroll. |
| 1818 if (scrollingCoordinator() && m_renderView->frameView()->hasOpaqueBackground
()) | 1817 if (scrollingCoordinator() && m_renderView.frameView()->hasOpaqueBackground(
)) |
| 1819 return true; | 1818 return true; |
| 1820 | 1819 |
| 1821 // Chromium always wants a layer. | 1820 // Chromium always wants a layer. |
| 1822 return true; | 1821 return true; |
| 1823 } | 1822 } |
| 1824 #endif | 1823 #endif |
| 1825 | 1824 |
| 1826 void RenderLayerCompositor::updateOverflowControlsLayers() | 1825 void RenderLayerCompositor::updateOverflowControlsLayers() |
| 1827 { | 1826 { |
| 1828 #if USE(RUBBER_BANDING) | 1827 #if USE(RUBBER_BANDING) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1841 } | 1840 } |
| 1842 #endif | 1841 #endif |
| 1843 GraphicsLayer* controlsParent = m_rootTransformLayer.get() ? m_rootTransform
Layer.get() : m_overflowControlsHostLayer.get(); | 1842 GraphicsLayer* controlsParent = m_rootTransformLayer.get() ? m_rootTransform
Layer.get() : m_overflowControlsHostLayer.get(); |
| 1844 | 1843 |
| 1845 if (requiresHorizontalScrollbarLayer()) { | 1844 if (requiresHorizontalScrollbarLayer()) { |
| 1846 if (!m_layerForHorizontalScrollbar) { | 1845 if (!m_layerForHorizontalScrollbar) { |
| 1847 m_layerForHorizontalScrollbar = GraphicsLayer::create(graphicsLayerF
actory(), this); | 1846 m_layerForHorizontalScrollbar = GraphicsLayer::create(graphicsLayerF
actory(), this); |
| 1848 controlsParent->addChild(m_layerForHorizontalScrollbar.get()); | 1847 controlsParent->addChild(m_layerForHorizontalScrollbar.get()); |
| 1849 | 1848 |
| 1850 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoor
dinator()) | 1849 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoor
dinator()) |
| 1851 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_re
nderView->frameView(), HorizontalScrollbar); | 1850 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_re
nderView.frameView(), HorizontalScrollbar); |
| 1852 } | 1851 } |
| 1853 } else if (m_layerForHorizontalScrollbar) { | 1852 } else if (m_layerForHorizontalScrollbar) { |
| 1854 m_layerForHorizontalScrollbar->removeFromParent(); | 1853 m_layerForHorizontalScrollbar->removeFromParent(); |
| 1855 m_layerForHorizontalScrollbar = nullptr; | 1854 m_layerForHorizontalScrollbar = nullptr; |
| 1856 | 1855 |
| 1857 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) | 1856 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) |
| 1858 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_render
View->frameView(), HorizontalScrollbar); | 1857 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_render
View.frameView(), HorizontalScrollbar); |
| 1859 } | 1858 } |
| 1860 | 1859 |
| 1861 if (requiresVerticalScrollbarLayer()) { | 1860 if (requiresVerticalScrollbarLayer()) { |
| 1862 if (!m_layerForVerticalScrollbar) { | 1861 if (!m_layerForVerticalScrollbar) { |
| 1863 m_layerForVerticalScrollbar = GraphicsLayer::create(graphicsLayerFac
tory(), this); | 1862 m_layerForVerticalScrollbar = GraphicsLayer::create(graphicsLayerFac
tory(), this); |
| 1864 controlsParent->addChild(m_layerForVerticalScrollbar.get()); | 1863 controlsParent->addChild(m_layerForVerticalScrollbar.get()); |
| 1865 | 1864 |
| 1866 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoor
dinator()) | 1865 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoor
dinator()) |
| 1867 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_re
nderView->frameView(), VerticalScrollbar); | 1866 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_re
nderView.frameView(), VerticalScrollbar); |
| 1868 } | 1867 } |
| 1869 } else if (m_layerForVerticalScrollbar) { | 1868 } else if (m_layerForVerticalScrollbar) { |
| 1870 m_layerForVerticalScrollbar->removeFromParent(); | 1869 m_layerForVerticalScrollbar->removeFromParent(); |
| 1871 m_layerForVerticalScrollbar = nullptr; | 1870 m_layerForVerticalScrollbar = nullptr; |
| 1872 | 1871 |
| 1873 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) | 1872 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) |
| 1874 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_render
View->frameView(), VerticalScrollbar); | 1873 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_render
View.frameView(), VerticalScrollbar); |
| 1875 } | 1874 } |
| 1876 | 1875 |
| 1877 if (requiresScrollCornerLayer()) { | 1876 if (requiresScrollCornerLayer()) { |
| 1878 if (!m_layerForScrollCorner) { | 1877 if (!m_layerForScrollCorner) { |
| 1879 m_layerForScrollCorner = GraphicsLayer::create(graphicsLayerFactory(
), this); | 1878 m_layerForScrollCorner = GraphicsLayer::create(graphicsLayerFactory(
), this); |
| 1880 controlsParent->addChild(m_layerForScrollCorner.get()); | 1879 controlsParent->addChild(m_layerForScrollCorner.get()); |
| 1881 } | 1880 } |
| 1882 } else if (m_layerForScrollCorner) { | 1881 } else if (m_layerForScrollCorner) { |
| 1883 m_layerForScrollCorner->removeFromParent(); | 1882 m_layerForScrollCorner->removeFromParent(); |
| 1884 m_layerForScrollCorner = nullptr; | 1883 m_layerForScrollCorner = nullptr; |
| 1885 } | 1884 } |
| 1886 | 1885 |
| 1887 m_renderView->frameView()->positionScrollbarLayers(); | 1886 m_renderView.frameView()->positionScrollbarLayers(); |
| 1888 } | 1887 } |
| 1889 | 1888 |
| 1890 void RenderLayerCompositor::ensureRootLayer() | 1889 void RenderLayerCompositor::ensureRootLayer() |
| 1891 { | 1890 { |
| 1892 RootLayerAttachment expectedAttachment = isMainFrame() ? RootLayerAttachedVi
aChromeClient : RootLayerAttachedViaEnclosingFrame; | 1891 RootLayerAttachment expectedAttachment = isMainFrame() ? RootLayerAttachedVi
aChromeClient : RootLayerAttachedViaEnclosingFrame; |
| 1893 if (expectedAttachment == m_rootLayerAttachment) | 1892 if (expectedAttachment == m_rootLayerAttachment) |
| 1894 return; | 1893 return; |
| 1895 | 1894 |
| 1896 if (!m_rootContentLayer) { | 1895 if (!m_rootContentLayer) { |
| 1897 m_rootContentLayer = GraphicsLayer::create(graphicsLayerFactory(), this)
; | 1896 m_rootContentLayer = GraphicsLayer::create(graphicsLayerFactory(), this)
; |
| 1898 IntRect overflowRect = m_renderView->pixelSnappedLayoutOverflowRect(); | 1897 IntRect overflowRect = m_renderView.pixelSnappedLayoutOverflowRect(); |
| 1899 m_rootContentLayer->setSize(FloatSize(overflowRect.maxX(), overflowRect.
maxY())); | 1898 m_rootContentLayer->setSize(FloatSize(overflowRect.maxX(), overflowRect.
maxY())); |
| 1900 m_rootContentLayer->setPosition(FloatPoint()); | 1899 m_rootContentLayer->setPosition(FloatPoint()); |
| 1901 | 1900 |
| 1902 // Need to clip to prevent transformed content showing outside this fram
e | 1901 // Need to clip to prevent transformed content showing outside this fram
e |
| 1903 m_rootContentLayer->setMasksToBounds(true); | 1902 m_rootContentLayer->setMasksToBounds(true); |
| 1904 } | 1903 } |
| 1905 | 1904 |
| 1906 if (!m_overflowControlsHostLayer) { | 1905 if (!m_overflowControlsHostLayer) { |
| 1907 ASSERT(!m_scrollLayer); | 1906 ASSERT(!m_scrollLayer); |
| 1908 ASSERT(!m_containerLayer); | 1907 ASSERT(!m_containerLayer); |
| 1909 | 1908 |
| 1910 // Create a layer to host the clipping layer and the overflow controls l
ayers. | 1909 // Create a layer to host the clipping layer and the overflow controls l
ayers. |
| 1911 m_overflowControlsHostLayer = GraphicsLayer::create(graphicsLayerFactory
(), this); | 1910 m_overflowControlsHostLayer = GraphicsLayer::create(graphicsLayerFactory
(), this); |
| 1912 | 1911 |
| 1913 // Create a clipping layer if this is an iframe or settings require to c
lip. | 1912 // Create a clipping layer if this is an iframe or settings require to c
lip. |
| 1914 m_containerLayer = GraphicsLayer::create(graphicsLayerFactory(), this); | 1913 m_containerLayer = GraphicsLayer::create(graphicsLayerFactory(), this); |
| 1915 bool containerMasksToBounds = !isMainFrame(); | 1914 bool containerMasksToBounds = !isMainFrame(); |
| 1916 if (Settings* settings = m_renderView->document().settings()) { | 1915 if (Settings* settings = m_renderView.document().settings()) { |
| 1917 if (settings->mainFrameClipsContent()) | 1916 if (settings->mainFrameClipsContent()) |
| 1918 containerMasksToBounds = true; | 1917 containerMasksToBounds = true; |
| 1919 } | 1918 } |
| 1920 m_containerLayer->setMasksToBounds(containerMasksToBounds); | 1919 m_containerLayer->setMasksToBounds(containerMasksToBounds); |
| 1921 | 1920 |
| 1922 m_scrollLayer = GraphicsLayer::create(graphicsLayerFactory(), this); | 1921 m_scrollLayer = GraphicsLayer::create(graphicsLayerFactory(), this); |
| 1923 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) | 1922 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) |
| 1924 scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(m_sc
rollLayer.get(), true); | 1923 scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(m_sc
rollLayer.get(), true); |
| 1925 | 1924 |
| 1926 // Hook them up | 1925 // Hook them up |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1950 if (m_layerForOverhangShadow) { | 1949 if (m_layerForOverhangShadow) { |
| 1951 m_layerForOverhangShadow->removeFromParent(); | 1950 m_layerForOverhangShadow->removeFromParent(); |
| 1952 m_layerForOverhangShadow = nullptr; | 1951 m_layerForOverhangShadow = nullptr; |
| 1953 } | 1952 } |
| 1954 #endif | 1953 #endif |
| 1955 | 1954 |
| 1956 if (m_layerForHorizontalScrollbar) { | 1955 if (m_layerForHorizontalScrollbar) { |
| 1957 m_layerForHorizontalScrollbar->removeFromParent(); | 1956 m_layerForHorizontalScrollbar->removeFromParent(); |
| 1958 m_layerForHorizontalScrollbar = nullptr; | 1957 m_layerForHorizontalScrollbar = nullptr; |
| 1959 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) | 1958 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) |
| 1960 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_render
View->frameView(), HorizontalScrollbar); | 1959 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_render
View.frameView(), HorizontalScrollbar); |
| 1961 if (Scrollbar* horizontalScrollbar = m_renderView->frameView()->vertical
Scrollbar()) | 1960 if (Scrollbar* horizontalScrollbar = m_renderView.frameView()->verticalS
crollbar()) |
| 1962 m_renderView->frameView()->invalidateScrollbar(horizontalScrollbar,
IntRect(IntPoint(0, 0), horizontalScrollbar->frameRect().size())); | 1961 m_renderView.frameView()->invalidateScrollbar(horizontalScrollbar, I
ntRect(IntPoint(0, 0), horizontalScrollbar->frameRect().size())); |
| 1963 } | 1962 } |
| 1964 | 1963 |
| 1965 if (m_layerForVerticalScrollbar) { | 1964 if (m_layerForVerticalScrollbar) { |
| 1966 m_layerForVerticalScrollbar->removeFromParent(); | 1965 m_layerForVerticalScrollbar->removeFromParent(); |
| 1967 m_layerForVerticalScrollbar = nullptr; | 1966 m_layerForVerticalScrollbar = nullptr; |
| 1968 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) | 1967 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) |
| 1969 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_render
View->frameView(), VerticalScrollbar); | 1968 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_render
View.frameView(), VerticalScrollbar); |
| 1970 if (Scrollbar* verticalScrollbar = m_renderView->frameView()->verticalSc
rollbar()) | 1969 if (Scrollbar* verticalScrollbar = m_renderView.frameView()->verticalScr
ollbar()) |
| 1971 m_renderView->frameView()->invalidateScrollbar(verticalScrollbar, In
tRect(IntPoint(0, 0), verticalScrollbar->frameRect().size())); | 1970 m_renderView.frameView()->invalidateScrollbar(verticalScrollbar, Int
Rect(IntPoint(0, 0), verticalScrollbar->frameRect().size())); |
| 1972 } | 1971 } |
| 1973 | 1972 |
| 1974 if (m_layerForScrollCorner) { | 1973 if (m_layerForScrollCorner) { |
| 1975 m_layerForScrollCorner = nullptr; | 1974 m_layerForScrollCorner = nullptr; |
| 1976 m_renderView->frameView()->invalidateScrollCorner(m_renderView->frameVie
w()->scrollCornerRect()); | 1975 m_renderView.frameView()->invalidateScrollCorner(m_renderView.frameView(
)->scrollCornerRect()); |
| 1977 } | 1976 } |
| 1978 | 1977 |
| 1979 if (m_overflowControlsHostLayer) { | 1978 if (m_overflowControlsHostLayer) { |
| 1980 m_overflowControlsHostLayer = nullptr; | 1979 m_overflowControlsHostLayer = nullptr; |
| 1981 m_containerLayer = nullptr; | 1980 m_containerLayer = nullptr; |
| 1982 m_scrollLayer = nullptr; | 1981 m_scrollLayer = nullptr; |
| 1983 } | 1982 } |
| 1984 ASSERT(!m_scrollLayer); | 1983 ASSERT(!m_scrollLayer); |
| 1985 m_rootContentLayer = nullptr; | 1984 m_rootContentLayer = nullptr; |
| 1986 m_rootTransformLayer = nullptr; | 1985 m_rootTransformLayer = nullptr; |
| 1987 } | 1986 } |
| 1988 | 1987 |
| 1989 void RenderLayerCompositor::attachRootLayer(RootLayerAttachment attachment) | 1988 void RenderLayerCompositor::attachRootLayer(RootLayerAttachment attachment) |
| 1990 { | 1989 { |
| 1991 if (!m_rootContentLayer) | 1990 if (!m_rootContentLayer) |
| 1992 return; | 1991 return; |
| 1993 | 1992 |
| 1994 switch (attachment) { | 1993 switch (attachment) { |
| 1995 case RootLayerUnattached: | 1994 case RootLayerUnattached: |
| 1996 ASSERT_NOT_REACHED(); | 1995 ASSERT_NOT_REACHED(); |
| 1997 break; | 1996 break; |
| 1998 case RootLayerAttachedViaChromeClient: { | 1997 case RootLayerAttachedViaChromeClient: { |
| 1999 LocalFrame& frame = m_renderView->frameView()->frame(); | 1998 LocalFrame& frame = m_renderView.frameView()->frame(); |
| 2000 Page* page = frame.page(); | 1999 Page* page = frame.page(); |
| 2001 if (!page) | 2000 if (!page) |
| 2002 return; | 2001 return; |
| 2003 page->chrome().client().attachRootGraphicsLayer(rootGraphicsLayer())
; | 2002 page->chrome().client().attachRootGraphicsLayer(rootGraphicsLayer())
; |
| 2004 break; | 2003 break; |
| 2005 } | 2004 } |
| 2006 case RootLayerAttachedViaEnclosingFrame: { | 2005 case RootLayerAttachedViaEnclosingFrame: { |
| 2007 HTMLFrameOwnerElement* ownerElement = m_renderView->document().owner
Element(); | 2006 HTMLFrameOwnerElement* ownerElement = m_renderView.document().ownerE
lement(); |
| 2008 ASSERT(ownerElement); | 2007 ASSERT(ownerElement); |
| 2009 DeprecatedScheduleStyleRecalcDuringCompositingUpdate marker(ownerEle
ment->document().lifecycle()); | 2008 DeprecatedScheduleStyleRecalcDuringCompositingUpdate marker(ownerEle
ment->document().lifecycle()); |
| 2010 // The layer will get hooked up via CompositedLayerMapping::updateGr
aphicsLayerConfiguration() | 2009 // The layer will get hooked up via CompositedLayerMapping::updateGr
aphicsLayerConfiguration() |
| 2011 // for the frame's renderer in the parent document. | 2010 // for the frame's renderer in the parent document. |
| 2012 ownerElement->scheduleLayerUpdate(); | 2011 ownerElement->scheduleLayerUpdate(); |
| 2013 break; | 2012 break; |
| 2014 } | 2013 } |
| 2015 } | 2014 } |
| 2016 | 2015 |
| 2017 m_rootLayerAttachment = attachment; | 2016 m_rootLayerAttachment = attachment; |
| 2018 } | 2017 } |
| 2019 | 2018 |
| 2020 void RenderLayerCompositor::detachRootLayer() | 2019 void RenderLayerCompositor::detachRootLayer() |
| 2021 { | 2020 { |
| 2022 if (!m_rootContentLayer || m_rootLayerAttachment == RootLayerUnattached) | 2021 if (!m_rootContentLayer || m_rootLayerAttachment == RootLayerUnattached) |
| 2023 return; | 2022 return; |
| 2024 | 2023 |
| 2025 switch (m_rootLayerAttachment) { | 2024 switch (m_rootLayerAttachment) { |
| 2026 case RootLayerAttachedViaEnclosingFrame: { | 2025 case RootLayerAttachedViaEnclosingFrame: { |
| 2027 // The layer will get unhooked up via CompositedLayerMapping::updateGrap
hicsLayerConfiguration() | 2026 // The layer will get unhooked up via CompositedLayerMapping::updateGrap
hicsLayerConfiguration() |
| 2028 // for the frame's renderer in the parent document. | 2027 // for the frame's renderer in the parent document. |
| 2029 if (m_overflowControlsHostLayer) | 2028 if (m_overflowControlsHostLayer) |
| 2030 m_overflowControlsHostLayer->removeFromParent(); | 2029 m_overflowControlsHostLayer->removeFromParent(); |
| 2031 else | 2030 else |
| 2032 m_rootContentLayer->removeFromParent(); | 2031 m_rootContentLayer->removeFromParent(); |
| 2033 | 2032 |
| 2034 if (HTMLFrameOwnerElement* ownerElement = m_renderView->document().owner
Element()) { | 2033 if (HTMLFrameOwnerElement* ownerElement = m_renderView.document().ownerE
lement()) { |
| 2035 DeprecatedScheduleStyleRecalcDuringCompositingUpdate marker(ownerEle
ment->document().lifecycle()); | 2034 DeprecatedScheduleStyleRecalcDuringCompositingUpdate marker(ownerEle
ment->document().lifecycle()); |
| 2036 ownerElement->scheduleLayerUpdate(); | 2035 ownerElement->scheduleLayerUpdate(); |
| 2037 } | 2036 } |
| 2038 break; | 2037 break; |
| 2039 } | 2038 } |
| 2040 case RootLayerAttachedViaChromeClient: { | 2039 case RootLayerAttachedViaChromeClient: { |
| 2041 LocalFrame& frame = m_renderView->frameView()->frame(); | 2040 LocalFrame& frame = m_renderView.frameView()->frame(); |
| 2042 Page* page = frame.page(); | 2041 Page* page = frame.page(); |
| 2043 if (!page) | 2042 if (!page) |
| 2044 return; | 2043 return; |
| 2045 page->chrome().client().attachRootGraphicsLayer(0); | 2044 page->chrome().client().attachRootGraphicsLayer(0); |
| 2046 } | 2045 } |
| 2047 break; | 2046 break; |
| 2048 case RootLayerUnattached: | 2047 case RootLayerUnattached: |
| 2049 break; | 2048 break; |
| 2050 } | 2049 } |
| 2051 | 2050 |
| 2052 m_rootLayerAttachment = RootLayerUnattached; | 2051 m_rootLayerAttachment = RootLayerUnattached; |
| 2053 } | 2052 } |
| 2054 | 2053 |
| 2055 void RenderLayerCompositor::updateRootLayerAttachment() | 2054 void RenderLayerCompositor::updateRootLayerAttachment() |
| 2056 { | 2055 { |
| 2057 ensureRootLayer(); | 2056 ensureRootLayer(); |
| 2058 } | 2057 } |
| 2059 | 2058 |
| 2060 bool RenderLayerCompositor::isMainFrame() const | 2059 bool RenderLayerCompositor::isMainFrame() const |
| 2061 { | 2060 { |
| 2062 // FIXME: LocalFrame::isMainFrame() is probably better. | 2061 // FIXME: LocalFrame::isMainFrame() is probably better. |
| 2063 return !m_renderView->document().ownerElement(); | 2062 return !m_renderView.document().ownerElement(); |
| 2064 } | 2063 } |
| 2065 | 2064 |
| 2066 // IFrames are special, because we hook compositing layers together across ifram
e boundaries | 2065 // IFrames are special, because we hook compositing layers together across ifram
e boundaries |
| 2067 // when both parent and iframe content are composited. So when this frame become
s composited, we have | 2066 // when both parent and iframe content are composited. So when this frame become
s composited, we have |
| 2068 // to use a synthetic style change to get the iframes into RenderLayers in order
to allow them to composite. | 2067 // to use a synthetic style change to get the iframes into RenderLayers in order
to allow them to composite. |
| 2069 void RenderLayerCompositor::notifyIFramesOfCompositingChange() | 2068 void RenderLayerCompositor::notifyIFramesOfCompositingChange() |
| 2070 { | 2069 { |
| 2071 if (!m_renderView->frameView()) | 2070 if (!m_renderView.frameView()) |
| 2072 return; | 2071 return; |
| 2073 LocalFrame& frame = m_renderView->frameView()->frame(); | 2072 LocalFrame& frame = m_renderView.frameView()->frame(); |
| 2074 | 2073 |
| 2075 for (LocalFrame* child = frame.tree().firstChild(); child; child = child->tr
ee().traverseNext(&frame)) { | 2074 for (LocalFrame* child = frame.tree().firstChild(); child; child = child->tr
ee().traverseNext(&frame)) { |
| 2076 if (!child->document()) | 2075 if (!child->document()) |
| 2077 continue; // FIXME: Can this happen? | 2076 continue; // FIXME: Can this happen? |
| 2078 if (HTMLFrameOwnerElement* ownerElement = child->document()->ownerElemen
t()) { | 2077 if (HTMLFrameOwnerElement* ownerElement = child->document()->ownerElemen
t()) { |
| 2079 DeprecatedScheduleStyleRecalcDuringCompositingUpdate marker(ownerEle
ment->document().lifecycle()); | 2078 DeprecatedScheduleStyleRecalcDuringCompositingUpdate marker(ownerEle
ment->document().lifecycle()); |
| 2080 ownerElement->scheduleLayerUpdate(); | 2079 ownerElement->scheduleLayerUpdate(); |
| 2081 } | 2080 } |
| 2082 } | 2081 } |
| 2083 | 2082 |
| 2084 // Compositing also affects the answer to RenderIFrame::requiresAcceleratedC
ompositing(), so | 2083 // Compositing also affects the answer to RenderIFrame::requiresAcceleratedC
ompositing(), so |
| 2085 // we need to schedule a style recalc in our parent document. | 2084 // we need to schedule a style recalc in our parent document. |
| 2086 if (HTMLFrameOwnerElement* ownerElement = m_renderView->document().ownerElem
ent()) { | 2085 if (HTMLFrameOwnerElement* ownerElement = m_renderView.document().ownerEleme
nt()) { |
| 2087 ownerElement->document().renderView()->compositor()->setNeedsToRecompute
CompositingRequirements(); | 2086 ownerElement->document().renderView()->compositor()->setNeedsToRecompute
CompositingRequirements(); |
| 2088 DeprecatedScheduleStyleRecalcDuringCompositingUpdate marker(ownerElement
->document().lifecycle()); | 2087 DeprecatedScheduleStyleRecalcDuringCompositingUpdate marker(ownerElement
->document().lifecycle()); |
| 2089 ownerElement->scheduleLayerUpdate(); | 2088 ownerElement->scheduleLayerUpdate(); |
| 2090 } | 2089 } |
| 2091 } | 2090 } |
| 2092 | 2091 |
| 2093 bool RenderLayerCompositor::layerHas3DContent(const RenderLayer* layer) const | 2092 bool RenderLayerCompositor::layerHas3DContent(const RenderLayer* layer) const |
| 2094 { | 2093 { |
| 2095 const RenderStyle* style = layer->renderer()->style(); | 2094 const RenderStyle* style = layer->renderer()->style(); |
| 2096 RenderLayerStackingNode* stackingNode = const_cast<RenderLayer*>(layer)->sta
ckingNode(); | 2095 RenderLayerStackingNode* stackingNode = const_cast<RenderLayer*>(layer)->sta
ckingNode(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2134 if (!m_viewportConstrainedLayers.contains(layer)) | 2133 if (!m_viewportConstrainedLayers.contains(layer)) |
| 2135 return; | 2134 return; |
| 2136 | 2135 |
| 2137 m_viewportConstrainedLayers.remove(layer); | 2136 m_viewportConstrainedLayers.remove(layer); |
| 2138 } | 2137 } |
| 2139 | 2138 |
| 2140 FixedPositionViewportConstraints RenderLayerCompositor::computeFixedViewportCons
traints(RenderLayer* layer) const | 2139 FixedPositionViewportConstraints RenderLayerCompositor::computeFixedViewportCons
traints(RenderLayer* layer) const |
| 2141 { | 2140 { |
| 2142 ASSERT(layer->hasCompositedLayerMapping()); | 2141 ASSERT(layer->hasCompositedLayerMapping()); |
| 2143 | 2142 |
| 2144 FrameView* frameView = m_renderView->frameView(); | 2143 FrameView* frameView = m_renderView.frameView(); |
| 2145 LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect()
; | 2144 LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect()
; |
| 2146 | 2145 |
| 2147 FixedPositionViewportConstraints constraints; | 2146 FixedPositionViewportConstraints constraints; |
| 2148 | 2147 |
| 2149 GraphicsLayer* graphicsLayer = layer->compositedLayerMapping()->mainGraphics
Layer(); | 2148 GraphicsLayer* graphicsLayer = layer->compositedLayerMapping()->mainGraphics
Layer(); |
| 2150 | 2149 |
| 2151 constraints.setLayerPositionAtLastLayout(graphicsLayer->position()); | 2150 constraints.setLayerPositionAtLastLayout(graphicsLayer->position()); |
| 2152 constraints.setViewportRectAtLastLayout(viewportRect); | 2151 constraints.setViewportRectAtLastLayout(viewportRect); |
| 2153 | 2152 |
| 2154 RenderStyle* style = layer->renderer()->style(); | 2153 RenderStyle* style = layer->renderer()->style(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2174 | 2173 |
| 2175 return constraints; | 2174 return constraints; |
| 2176 } | 2175 } |
| 2177 | 2176 |
| 2178 StickyPositionViewportConstraints RenderLayerCompositor::computeStickyViewportCo
nstraints(RenderLayer* layer) const | 2177 StickyPositionViewportConstraints RenderLayerCompositor::computeStickyViewportCo
nstraints(RenderLayer* layer) const |
| 2179 { | 2178 { |
| 2180 ASSERT(layer->hasCompositedLayerMapping()); | 2179 ASSERT(layer->hasCompositedLayerMapping()); |
| 2181 // We should never get here for stickies constrained by an enclosing clippin
g layer. | 2180 // We should never get here for stickies constrained by an enclosing clippin
g layer. |
| 2182 ASSERT(!layer->enclosingOverflowClipLayer(ExcludeSelf)); | 2181 ASSERT(!layer->enclosingOverflowClipLayer(ExcludeSelf)); |
| 2183 | 2182 |
| 2184 FrameView* frameView = m_renderView->frameView(); | 2183 FrameView* frameView = m_renderView.frameView(); |
| 2185 LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect()
; | 2184 LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect()
; |
| 2186 | 2185 |
| 2187 StickyPositionViewportConstraints constraints; | 2186 StickyPositionViewportConstraints constraints; |
| 2188 | 2187 |
| 2189 RenderBoxModelObject* renderer = toRenderBoxModelObject(layer->renderer()); | 2188 RenderBoxModelObject* renderer = toRenderBoxModelObject(layer->renderer()); |
| 2190 | 2189 |
| 2191 renderer->computeStickyPositionConstraints(constraints, viewportRect); | 2190 renderer->computeStickyPositionConstraints(constraints, viewportRect); |
| 2192 | 2191 |
| 2193 GraphicsLayer* graphicsLayer = layer->compositedLayerMapping()->mainGraphics
Layer(); | 2192 GraphicsLayer* graphicsLayer = layer->compositedLayerMapping()->mainGraphics
Layer(); |
| 2194 | 2193 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2208 | 2207 |
| 2209 GraphicsLayerFactory* RenderLayerCompositor::graphicsLayerFactory() const | 2208 GraphicsLayerFactory* RenderLayerCompositor::graphicsLayerFactory() const |
| 2210 { | 2209 { |
| 2211 if (Page* page = this->page()) | 2210 if (Page* page = this->page()) |
| 2212 return page->chrome().client().graphicsLayerFactory(); | 2211 return page->chrome().client().graphicsLayerFactory(); |
| 2213 return 0; | 2212 return 0; |
| 2214 } | 2213 } |
| 2215 | 2214 |
| 2216 Page* RenderLayerCompositor::page() const | 2215 Page* RenderLayerCompositor::page() const |
| 2217 { | 2216 { |
| 2218 return m_renderView->frameView()->frame().page(); | 2217 return m_renderView.frameView()->frame().page(); |
| 2219 } | 2218 } |
| 2220 | 2219 |
| 2221 DocumentLifecycle& RenderLayerCompositor::lifecycle() const | 2220 DocumentLifecycle& RenderLayerCompositor::lifecycle() const |
| 2222 { | 2221 { |
| 2223 return m_renderView->document().lifecycle(); | 2222 return m_renderView.document().lifecycle(); |
| 2224 } | 2223 } |
| 2225 | 2224 |
| 2226 String RenderLayerCompositor::debugName(const GraphicsLayer* graphicsLayer) | 2225 String RenderLayerCompositor::debugName(const GraphicsLayer* graphicsLayer) |
| 2227 { | 2226 { |
| 2228 String name; | 2227 String name; |
| 2229 if (graphicsLayer == m_rootContentLayer.get()) { | 2228 if (graphicsLayer == m_rootContentLayer.get()) { |
| 2230 name = "Content Root Layer"; | 2229 name = "Content Root Layer"; |
| 2231 } else if (graphicsLayer == m_rootTransformLayer.get()) { | 2230 } else if (graphicsLayer == m_rootTransformLayer.get()) { |
| 2232 name = "Root Transform Layer"; | 2231 name = "Root Transform Layer"; |
| 2233 #if USE(RUBBER_BANDING) | 2232 #if USE(RUBBER_BANDING) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2247 } else if (graphicsLayer == m_scrollLayer.get()) { | 2246 } else if (graphicsLayer == m_scrollLayer.get()) { |
| 2248 name = "LocalFrame Scrolling Layer"; | 2247 name = "LocalFrame Scrolling Layer"; |
| 2249 } else { | 2248 } else { |
| 2250 ASSERT_NOT_REACHED(); | 2249 ASSERT_NOT_REACHED(); |
| 2251 } | 2250 } |
| 2252 | 2251 |
| 2253 return name; | 2252 return name; |
| 2254 } | 2253 } |
| 2255 | 2254 |
| 2256 } // namespace WebCore | 2255 } // namespace WebCore |
| OLD | NEW |