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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 while (fullscreenElement && fullscreenElement->isFrameOwnerElement()) { | 170 while (fullscreenElement && fullscreenElement->isFrameOwnerElement()) { |
171 contentDocument = toHTMLFrameOwnerElement(fullscreenElement)->contentDoc
ument(); | 171 contentDocument = toHTMLFrameOwnerElement(fullscreenElement)->contentDoc
ument(); |
172 if (!contentDocument) | 172 if (!contentDocument) |
173 return 0; | 173 return 0; |
174 fullscreenElement = Fullscreen::fullscreenElementFrom(*contentDocument); | 174 fullscreenElement = Fullscreen::fullscreenElementFrom(*contentDocument); |
175 } | 175 } |
176 // Get the current fullscreen element from the document. | 176 // Get the current fullscreen element from the document. |
177 fullscreenElement = Fullscreen::currentFullScreenElementFrom(*contentDocumen
t); | 177 fullscreenElement = Fullscreen::currentFullScreenElementFrom(*contentDocumen
t); |
178 if (!isHTMLVideoElement(fullscreenElement)) | 178 if (!isHTMLVideoElement(fullscreenElement)) |
179 return 0; | 179 return 0; |
180 LayoutObject* renderer = fullscreenElement->renderer(); | 180 LayoutObject* renderer = fullscreenElement->layoutObject(); |
181 if (!renderer) | 181 if (!renderer) |
182 return 0; | 182 return 0; |
183 return toLayoutVideo(renderer); | 183 return toLayoutVideo(renderer); |
184 } | 184 } |
185 | 185 |
186 void LayerCompositor::updateIfNeededRecursive() | 186 void LayerCompositor::updateIfNeededRecursive() |
187 { | 187 { |
188 for (Frame* child = m_layoutView.frameView()->frame().tree().firstChild(); c
hild; child = child->tree().nextSibling()) { | 188 for (Frame* child = m_layoutView.frameView()->frame().tree().firstChild(); c
hild; child = child->tree().nextSibling()) { |
189 if (child->isLocalFrame()) | 189 if (child->isLocalFrame()) |
190 toLocalFrame(child)->contentRenderer()->compositor()->updateIfNeeded
Recursive(); | 190 toLocalFrame(child)->contentRenderer()->compositor()->updateIfNeeded
Recursive(); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled()) | 392 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled()) |
393 applyOverlayFullscreenVideoAdjustment(); | 393 applyOverlayFullscreenVideoAdjustment(); |
394 } | 394 } |
395 | 395 |
396 if (m_needsUpdateFixedBackground) { | 396 if (m_needsUpdateFixedBackground) { |
397 rootFixedBackgroundsChanged(); | 397 rootFixedBackgroundsChanged(); |
398 m_needsUpdateFixedBackground = false; | 398 m_needsUpdateFixedBackground = false; |
399 } | 399 } |
400 | 400 |
401 for (unsigned i = 0; i < layersNeedingPaintInvalidation.size(); i++) | 401 for (unsigned i = 0; i < layersNeedingPaintInvalidation.size(); i++) |
402 forceRecomputePaintInvalidationRectsIncludingNonCompositingDescendants(l
ayersNeedingPaintInvalidation[i]->renderer()); | 402 forceRecomputePaintInvalidationRectsIncludingNonCompositingDescendants(l
ayersNeedingPaintInvalidation[i]->layoutObject()); |
403 | 403 |
404 // Inform the inspector that the layer tree has changed. | 404 // Inform the inspector that the layer tree has changed. |
405 if (m_layoutView.frame()->isMainFrame()) | 405 if (m_layoutView.frame()->isMainFrame()) |
406 InspectorInstrumentation::layerTreeDidChange(m_layoutView.frame()); | 406 InspectorInstrumentation::layerTreeDidChange(m_layoutView.frame()); |
407 } | 407 } |
408 | 408 |
409 bool LayerCompositor::allocateOrClearCompositedLayerMapping(Layer* layer, const
CompositingStateTransitionType compositedLayerUpdate) | 409 bool LayerCompositor::allocateOrClearCompositedLayerMapping(Layer* layer, const
CompositingStateTransitionType compositedLayerUpdate) |
410 { | 410 { |
411 bool compositedLayerMappingChanged = false; | 411 bool compositedLayerMappingChanged = false; |
412 | 412 |
(...skipping 26 matching lines...) Expand all Loading... |
439 } | 439 } |
440 break; | 440 break; |
441 case RemoveOwnCompositedLayerMapping: | 441 case RemoveOwnCompositedLayerMapping: |
442 // 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. |
443 case PutInSquashingLayer: | 443 case PutInSquashingLayer: |
444 if (layer->hasCompositedLayerMapping()) { | 444 if (layer->hasCompositedLayerMapping()) { |
445 // 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 |
446 // 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 |
447 // are both either composited, or not composited. | 447 // are both either composited, or not composited. |
448 if (layer->isReflection()) { | 448 if (layer->isReflection()) { |
449 Layer* sourceLayer = toLayoutBoxModelObject(layer->renderer()->p
arent())->layer(); | 449 Layer* sourceLayer = toLayoutBoxModelObject(layer->layoutObject(
)->parent())->layer(); |
450 if (sourceLayer->hasCompositedLayerMapping()) { | 450 if (sourceLayer->hasCompositedLayerMapping()) { |
451 ASSERT(sourceLayer->compositedLayerMapping()->mainGraphicsLa
yer()->replicaLayer() == layer->compositedLayerMapping()->mainGraphicsLayer()); | 451 ASSERT(sourceLayer->compositedLayerMapping()->mainGraphicsLa
yer()->replicaLayer() == layer->compositedLayerMapping()->mainGraphicsLayer()); |
452 sourceLayer->compositedLayerMapping()->mainGraphicsLayer()->
setReplicatedByLayer(0); | 452 sourceLayer->compositedLayerMapping()->mainGraphicsLayer()->
setReplicatedByLayer(0); |
453 } | 453 } |
454 } | 454 } |
455 | 455 |
456 layer->clearCompositedLayerMapping(); | 456 layer->clearCompositedLayerMapping(); |
457 compositedLayerMappingChanged = true; | 457 compositedLayerMappingChanged = true; |
458 } | 458 } |
459 | 459 |
460 break; | 460 break; |
461 case RemoveFromSquashingLayer: | 461 case RemoveFromSquashingLayer: |
462 case NoCompositingStateChange: | 462 case NoCompositingStateChange: |
463 // Do nothing. | 463 // Do nothing. |
464 break; | 464 break; |
465 } | 465 } |
466 | 466 |
467 if (compositedLayerMappingChanged && layer->renderer()->isLayoutPart()) { | 467 if (compositedLayerMappingChanged && layer->layoutObject()->isLayoutPart())
{ |
468 LayerCompositor* innerCompositor = frameContentsCompositor(toLayoutPart(
layer->renderer())); | 468 LayerCompositor* innerCompositor = frameContentsCompositor(toLayoutPart(
layer->layoutObject())); |
469 if (innerCompositor && innerCompositor->staleInCompositingMode()) | 469 if (innerCompositor && innerCompositor->staleInCompositingMode()) |
470 innerCompositor->updateRootLayerAttachment(); | 470 innerCompositor->updateRootLayerAttachment(); |
471 } | 471 } |
472 | 472 |
473 if (compositedLayerMappingChanged) | 473 if (compositedLayerMappingChanged) |
474 layer->clipper().clearClipRectsIncludingDescendants(PaintingClipRects); | 474 layer->clipper().clearClipRectsIncludingDescendants(PaintingClipRects); |
475 | 475 |
476 // If a fixed position layer gained/lost a compositedLayerMapping or the rea
son not compositing it changed, | 476 // If a fixed position layer gained/lost a compositedLayerMapping or the rea
son not compositing it changed, |
477 // the scrolling coordinator needs to recalculate whether it can do fast scr
olling. | 477 // the scrolling coordinator needs to recalculate whether it can do fast scr
olling. |
478 if (compositedLayerMappingChanged) { | 478 if (compositedLayerMappingChanged) { |
479 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) | 479 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) |
480 scrollingCoordinator->frameViewFixedObjectsDidChange(m_layoutView.fr
ameView()); | 480 scrollingCoordinator->frameViewFixedObjectsDidChange(m_layoutView.fr
ameView()); |
481 } | 481 } |
482 | 482 |
483 return compositedLayerMappingChanged; | 483 return compositedLayerMappingChanged; |
484 } | 484 } |
485 | 485 |
486 void LayerCompositor::paintInvalidationOnCompositingChange(Layer* layer) | 486 void LayerCompositor::paintInvalidationOnCompositingChange(Layer* layer) |
487 { | 487 { |
488 // If the renderer is not attached yet, no need to issue paint invalidations
. | 488 // If the renderer is not attached yet, no need to issue paint invalidations
. |
489 if (layer->renderer() != &m_layoutView && !layer->renderer()->parent()) | 489 if (layer->layoutObject() != &m_layoutView && !layer->layoutObject()->parent
()) |
490 return; | 490 return; |
491 | 491 |
492 // For querying Layer::compositingState() | 492 // For querying Layer::compositingState() |
493 // Eager invalidation here is correct, since we are invalidating with respec
t to the previous frame's | 493 // Eager invalidation here is correct, since we are invalidating with respec
t to the previous frame's |
494 // compositing state when changing the compositing backing of the layer. | 494 // compositing state when changing the compositing backing of the layer. |
495 DisableCompositingQueryAsserts disabler; | 495 DisableCompositingQueryAsserts disabler; |
496 // FIXME: We should not allow paint invalidation out of paint invalidation s
tate. crbug.com/457415 | 496 // FIXME: We should not allow paint invalidation out of paint invalidation s
tate. crbug.com/457415 |
497 DisablePaintInvalidationStateAsserts paintInvalidationAssertisabler; | 497 DisablePaintInvalidationStateAsserts paintInvalidationAssertisabler; |
498 | 498 |
499 layer->renderer()->invalidatePaintIncludingNonCompositingDescendants(); | 499 layer->layoutObject()->invalidatePaintIncludingNonCompositingDescendants(); |
500 } | 500 } |
501 | 501 |
502 void LayerCompositor::frameViewDidChangeLocation(const IntPoint& contentsOffset) | 502 void LayerCompositor::frameViewDidChangeLocation(const IntPoint& contentsOffset) |
503 { | 503 { |
504 if (m_overflowControlsHostLayer) | 504 if (m_overflowControlsHostLayer) |
505 m_overflowControlsHostLayer->setPosition(contentsOffset); | 505 m_overflowControlsHostLayer->setPosition(contentsOffset); |
506 } | 506 } |
507 | 507 |
508 void LayerCompositor::frameViewDidChangeSize() | 508 void LayerCompositor::frameViewDidChangeSize() |
509 { | 509 { |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 } | 737 } |
738 if (m_containerLayer) { | 738 if (m_containerLayer) { |
739 FrameView* frameView = m_layoutView.frameView(); | 739 FrameView* frameView = m_layoutView.frameView(); |
740 m_containerLayer->setSize(frameView->unscaledVisibleContentSize()); | 740 m_containerLayer->setSize(frameView->unscaledVisibleContentSize()); |
741 m_overflowControlsHostLayer->setSize(frameView->unscaledVisibleContentSi
ze(IncludeScrollbars)); | 741 m_overflowControlsHostLayer->setSize(frameView->unscaledVisibleContentSi
ze(IncludeScrollbars)); |
742 } | 742 } |
743 } | 743 } |
744 | 744 |
745 void LayerCompositor::updatePotentialCompositingReasonsFromStyle(Layer* layer) | 745 void LayerCompositor::updatePotentialCompositingReasonsFromStyle(Layer* layer) |
746 { | 746 { |
747 layer->setPotentialCompositingReasonsFromStyle(m_compositingReasonFinder.pot
entialCompositingReasonsFromStyle(layer->renderer())); | 747 layer->setPotentialCompositingReasonsFromStyle(m_compositingReasonFinder.pot
entialCompositingReasonsFromStyle(layer->layoutObject())); |
748 } | 748 } |
749 | 749 |
750 void LayerCompositor::updateDirectCompositingReasons(Layer* layer) | 750 void LayerCompositor::updateDirectCompositingReasons(Layer* layer) |
751 { | 751 { |
752 layer->setCompositingReasons(m_compositingReasonFinder.directReasons(layer),
CompositingReasonComboAllDirectReasons); | 752 layer->setCompositingReasons(m_compositingReasonFinder.directReasons(layer),
CompositingReasonComboAllDirectReasons); |
753 } | 753 } |
754 | 754 |
755 void LayerCompositor::setOverlayLayer(GraphicsLayer* layer) | 755 void LayerCompositor::setOverlayLayer(GraphicsLayer* layer) |
756 { | 756 { |
757 ASSERT(rootGraphicsLayer()); | 757 ASSERT(rootGraphicsLayer()); |
758 | 758 |
759 if (layer->parent() != m_overflowControlsHostLayer.get()) | 759 if (layer->parent() != m_overflowControlsHostLayer.get()) |
760 m_overflowControlsHostLayer->addChild(layer); | 760 m_overflowControlsHostLayer->addChild(layer); |
761 } | 761 } |
762 | 762 |
763 bool LayerCompositor::canBeComposited(const Layer* layer) const | 763 bool LayerCompositor::canBeComposited(const Layer* layer) const |
764 { | 764 { |
765 return m_hasAcceleratedCompositing && layer->isSelfPaintingLayer() && !layer
->subtreeIsInvisible(); | 765 return m_hasAcceleratedCompositing && layer->isSelfPaintingLayer() && !layer
->subtreeIsInvisible(); |
766 } | 766 } |
767 | 767 |
768 // Return true if the given layer is a stacking context and has compositing chil
d | 768 // Return true if the given layer is a stacking context and has compositing chil
d |
769 // layers that it needs to clip. In this case we insert a clipping GraphicsLayer | 769 // layers that it needs to clip. In this case we insert a clipping GraphicsLayer |
770 // into the hierarchy between this layer and its children in the z-order hierarc
hy. | 770 // into the hierarchy between this layer and its children in the z-order hierarc
hy. |
771 bool LayerCompositor::clipsCompositingDescendants(const Layer* layer) const | 771 bool LayerCompositor::clipsCompositingDescendants(const Layer* layer) const |
772 { | 772 { |
773 return layer->hasCompositingDescendant() && layer->renderer()->hasClipOrOver
flowClip(); | 773 return layer->hasCompositingDescendant() && layer->layoutObject()->hasClipOr
OverflowClip(); |
774 } | 774 } |
775 | 775 |
776 // If an element has composited negative z-index children, those children render
in front of the | 776 // If an element has composited negative z-index children, those children render
in front of the |
777 // layer background, so we need an extra 'contents' layer for the foreground of
the layer | 777 // layer background, so we need an extra 'contents' layer for the foreground of
the layer |
778 // object. | 778 // object. |
779 bool LayerCompositor::needsContentsCompositingLayer(const Layer* layer) const | 779 bool LayerCompositor::needsContentsCompositingLayer(const Layer* layer) const |
780 { | 780 { |
781 if (!layer->hasCompositingDescendant()) | 781 if (!layer->hasCompositingDescendant()) |
782 return false; | 782 return false; |
783 return layer->stackingNode()->hasNegativeZOrderList(); | 783 return layer->stackingNode()->hasNegativeZOrderList(); |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1161 } else if (graphicsLayer == m_scrollLayer.get()) { | 1161 } else if (graphicsLayer == m_scrollLayer.get()) { |
1162 name = "LocalFrame Scrolling Layer"; | 1162 name = "LocalFrame Scrolling Layer"; |
1163 } else { | 1163 } else { |
1164 ASSERT_NOT_REACHED(); | 1164 ASSERT_NOT_REACHED(); |
1165 } | 1165 } |
1166 | 1166 |
1167 return name; | 1167 return name; |
1168 } | 1168 } |
1169 | 1169 |
1170 } // namespace blink | 1170 } // namespace blink |
OLD | NEW |