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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 #endif | 252 #endif |
253 | 253 |
254 void RenderLayerCompositor::applyOverlayFullscreenVideoAdjustment() | 254 void RenderLayerCompositor::applyOverlayFullscreenVideoAdjustment() |
255 { | 255 { |
256 m_inOverlayFullscreenVideo = false; | 256 m_inOverlayFullscreenVideo = false; |
257 if (!m_rootContentLayer) | 257 if (!m_rootContentLayer) |
258 return; | 258 return; |
259 | 259 |
260 bool isLocalRoot = m_renderView.frame()->isLocalRoot(); | 260 bool isLocalRoot = m_renderView.frame()->isLocalRoot(); |
261 RenderVideo* video = findFullscreenVideoRenderer(m_renderView.document()); | 261 RenderVideo* video = findFullscreenVideoRenderer(m_renderView.document()); |
262 if (!video || !video->layer()->hasCompositedLayerMapping()) { | 262 CompositedLayerMapping* videoCompositedLayerMapping = nullptr; |
| 263 |
| 264 if (video) |
| 265 videoCompositedLayerMapping = video->layer()->compositedLayerMapping(); |
| 266 |
| 267 if (!videoCompositedLayerMapping) { |
263 if (isLocalRoot) { | 268 if (isLocalRoot) { |
264 GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer(); | 269 GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer(); |
265 if (backgroundLayer && !backgroundLayer->parent()) | 270 if (backgroundLayer && !backgroundLayer->parent()) |
266 rootFixedBackgroundsChanged(); | 271 rootFixedBackgroundsChanged(); |
267 } | 272 } |
268 return; | 273 return; |
269 } | 274 } |
270 | 275 |
271 GraphicsLayer* videoLayer = video->layer()->compositedLayerMapping()->mainGr
aphicsLayer(); | 276 GraphicsLayer* videoLayer = videoCompositedLayerMapping->mainGraphicsLayer()
; |
272 | 277 |
273 // The fullscreen video has layer position equal to its enclosing frame's sc
roll position because fullscreen container is fixed-positioned. | 278 // The fullscreen video has layer position equal to its enclosing frame's sc
roll position because fullscreen container is fixed-positioned. |
274 // We should reset layer position here since we are going to reattach the la
yer at the very top level. | 279 // We should reset layer position here since we are going to reattach the la
yer at the very top level. |
275 videoLayer->setPosition(IntPoint()); | 280 videoLayer->setPosition(IntPoint()); |
276 | 281 |
277 // Only steal fullscreen video layer and clear all other layers if we are th
e main frame. | 282 // Only steal fullscreen video layer and clear all other layers if we are th
e main frame. |
278 if (!isLocalRoot) | 283 if (!isLocalRoot) |
279 return; | 284 return; |
280 | 285 |
281 m_rootContentLayer->removeAllChildren(); | 286 m_rootContentLayer->removeAllChildren(); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 | 408 |
404 bool RenderLayerCompositor::allocateOrClearCompositedLayerMapping(RenderLayer* l
ayer, const CompositingStateTransitionType compositedLayerUpdate) | 409 bool RenderLayerCompositor::allocateOrClearCompositedLayerMapping(RenderLayer* l
ayer, const CompositingStateTransitionType compositedLayerUpdate) |
405 { | 410 { |
406 bool compositedLayerMappingChanged = false; | 411 bool compositedLayerMappingChanged = false; |
407 | 412 |
408 // FIXME: It would be nice to directly use the layer's compositing reason, | 413 // FIXME: It would be nice to directly use the layer's compositing reason, |
409 // but allocateOrClearCompositedLayerMapping also gets called without having
updated compositing | 414 // but allocateOrClearCompositedLayerMapping also gets called without having
updated compositing |
410 // requirements fully. | 415 // requirements fully. |
411 switch (compositedLayerUpdate) { | 416 switch (compositedLayerUpdate) { |
412 case AllocateOwnCompositedLayerMapping: | 417 case AllocateOwnCompositedLayerMapping: |
413 ASSERT(!layer->hasCompositedLayerMapping()); | 418 ASSERT(!layer->compositedLayerMapping()); |
414 setCompositingModeEnabled(true); | 419 setCompositingModeEnabled(true); |
415 | 420 |
416 // If we need to issue paint invalidations, do so before allocating the
compositedLayerMapping and clearing out the groupedMapping. | 421 // If we need to issue paint invalidations, do so before allocating the
compositedLayerMapping and clearing out the groupedMapping. |
417 paintInvalidationOnCompositingChange(layer); | 422 paintInvalidationOnCompositingChange(layer); |
418 | 423 |
419 // If this layer was previously squashed, we need to remove its referenc
e to a groupedMapping right away, so | 424 // If this layer was previously squashed, we need to remove its referenc
e to a groupedMapping right away, so |
420 // that computing paint invalidation rects will know the layer's correct
compositingState. | 425 // that computing paint invalidation rects will know the layer's correct
compositingState. |
421 // FIXME: do we need to also remove the layer from it's location in the
squashing list of its groupedMapping? | 426 // FIXME: do we need to also remove the layer from it's location in the
squashing list of its groupedMapping? |
422 // Need to create a test where a squashed layer pops into compositing. A
nd also to cover all other | 427 // Need to create a test where a squashed layer pops into compositing. A
nd also to cover all other |
423 // sorts of compositingState transitions. | 428 // sorts of compositingState transitions. |
424 layer->setLostGroupedMapping(false); | 429 layer->setLostGroupedMapping(false); |
425 layer->setGroupedMapping(0); | 430 layer->setGroupedMapping(0); |
426 | 431 |
427 layer->ensureCompositedLayerMapping(); | 432 layer->ensureCompositedLayerMapping(); |
428 compositedLayerMappingChanged = true; | 433 compositedLayerMappingChanged = true; |
429 | 434 |
430 // At this time, the ScrollingCooridnator only supports the top-level fr
ame. | 435 // At this time, the ScrollingCooridnator only supports the top-level fr
ame. |
431 if (layer->isRootLayer() && m_renderView.frame()->isLocalRoot()) { | 436 if (layer->isRootLayer() && m_renderView.frame()->isLocalRoot()) { |
432 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoor
dinator()) | 437 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoor
dinator()) |
433 scrollingCoordinator->frameViewRootLayerDidChange(m_renderView.f
rameView()); | 438 scrollingCoordinator->frameViewRootLayerDidChange(m_renderView.f
rameView()); |
434 } | 439 } |
435 break; | 440 break; |
436 case RemoveOwnCompositedLayerMapping: | 441 case RemoveOwnCompositedLayerMapping: |
437 // PutInSquashingLayer means you might have to remove the composited layer m
apping first. | 442 // PutInSquashingLayer means you might have to remove the composited layer m
apping first. |
438 case PutInSquashingLayer: | 443 case PutInSquashingLayer: |
439 if (layer->hasCompositedLayerMapping()) { | 444 if (layer->compositedLayerMapping()) { |
440 // If we're removing the compositedLayerMapping from a reflection, c
lear the source GraphicsLayer's pointer to | 445 // If we're removing the compositedLayerMapping from a reflection, c
lear the source GraphicsLayer's pointer to |
441 // its replica GraphicsLayer. In practice this should never happen b
ecause reflectee and reflection | 446 // its replica GraphicsLayer. In practice this should never happen b
ecause reflectee and reflection |
442 // are both either composited, or not composited. | 447 // are both either composited, or not composited. |
443 if (layer->isReflection()) { | 448 if (layer->isReflection()) { |
444 RenderLayer* sourceLayer = toRenderLayerModelObject(layer->rende
rer()->parent())->layer(); | 449 RenderLayer* sourceLayer = toRenderLayerModelObject(layer->rende
rer()->parent())->layer(); |
445 if (sourceLayer->hasCompositedLayerMapping()) { | 450 if (CompositedLayerMapping* sourceCompositedLayerMapping = sourc
eLayer->compositedLayerMapping()) { |
446 ASSERT(sourceLayer->compositedLayerMapping()->mainGraphicsLa
yer()->replicaLayer() == layer->compositedLayerMapping()->mainGraphicsLayer()); | 451 ASSERT(sourceCompositedLayerMapping->mainGraphicsLayer()->re
plicaLayer() == layer->compositedLayerMapping()->mainGraphicsLayer()); |
447 sourceLayer->compositedLayerMapping()->mainGraphicsLayer()->
setReplicatedByLayer(0); | 452 sourceCompositedLayerMapping->mainGraphicsLayer()->setReplic
atedByLayer(0); |
448 } | 453 } |
449 } | 454 } |
450 | 455 |
451 layer->clearCompositedLayerMapping(); | 456 layer->clearCompositedLayerMapping(); |
452 compositedLayerMappingChanged = true; | 457 compositedLayerMappingChanged = true; |
453 } | 458 } |
454 | 459 |
455 break; | 460 break; |
456 case RemoveFromSquashingLayer: | 461 case RemoveFromSquashingLayer: |
457 case NoCompositingStateChange: | 462 case NoCompositingStateChange: |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 return 0; | 624 return 0; |
620 } | 625 } |
621 | 626 |
622 // FIXME: What does this function do? It needs a clearer name. | 627 // FIXME: What does this function do? It needs a clearer name. |
623 bool RenderLayerCompositor::parentFrameContentLayers(RenderPart* renderer) | 628 bool RenderLayerCompositor::parentFrameContentLayers(RenderPart* renderer) |
624 { | 629 { |
625 RenderLayerCompositor* innerCompositor = frameContentsCompositor(renderer); | 630 RenderLayerCompositor* innerCompositor = frameContentsCompositor(renderer); |
626 if (!innerCompositor || !innerCompositor->staleInCompositingMode() || innerC
ompositor->rootLayerAttachment() != RootLayerAttachedViaEnclosingFrame) | 631 if (!innerCompositor || !innerCompositor->staleInCompositingMode() || innerC
ompositor->rootLayerAttachment() != RootLayerAttachedViaEnclosingFrame) |
627 return false; | 632 return false; |
628 | 633 |
629 RenderLayer* layer = renderer->layer(); | 634 CompositedLayerMapping* compositedLayerMapping = renderer->layer()->composit
edLayerMapping(); |
630 if (!layer->hasCompositedLayerMapping()) | 635 if (!compositedLayerMapping) |
631 return false; | 636 return false; |
632 | 637 |
633 CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMappi
ng(); | |
634 GraphicsLayer* hostingLayer = compositedLayerMapping->parentForSublayers(); | 638 GraphicsLayer* hostingLayer = compositedLayerMapping->parentForSublayers(); |
635 GraphicsLayer* rootLayer = innerCompositor->rootGraphicsLayer(); | 639 GraphicsLayer* rootLayer = innerCompositor->rootGraphicsLayer(); |
636 if (hostingLayer->children().size() != 1 || hostingLayer->children()[0] != r
ootLayer) { | 640 if (hostingLayer->children().size() != 1 || hostingLayer->children()[0] != r
ootLayer) { |
637 hostingLayer->removeAllChildren(); | 641 hostingLayer->removeAllChildren(); |
638 hostingLayer->addChild(rootLayer); | 642 hostingLayer->addChild(rootLayer); |
639 } | 643 } |
640 return true; | 644 return true; |
641 } | 645 } |
642 | 646 |
643 static void fullyInvalidatePaintRecursive(RenderLayer* layer) | 647 static void fullyInvalidatePaintRecursive(RenderLayer* layer) |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1188 } else if (graphicsLayer == m_scrollLayer.get()) { | 1192 } else if (graphicsLayer == m_scrollLayer.get()) { |
1189 name = "LocalFrame Scrolling Layer"; | 1193 name = "LocalFrame Scrolling Layer"; |
1190 } else { | 1194 } else { |
1191 ASSERT_NOT_REACHED(); | 1195 ASSERT_NOT_REACHED(); |
1192 } | 1196 } |
1193 | 1197 |
1194 return name; | 1198 return name; |
1195 } | 1199 } |
1196 | 1200 |
1197 } // namespace blink | 1201 } // namespace blink |
OLD | NEW |