| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 } | 162 } |
| 163 | 163 |
| 164 static LayoutVideo* findFullscreenVideoLayoutObject(Document& document) | 164 static LayoutVideo* findFullscreenVideoLayoutObject(Document& document) |
| 165 { | 165 { |
| 166 // Recursively find the document that is in fullscreen. | 166 // Recursively find the document that is in fullscreen. |
| 167 Element* fullscreenElement = Fullscreen::fullscreenElementFrom(document); | 167 Element* fullscreenElement = Fullscreen::fullscreenElementFrom(document); |
| 168 Document* contentDocument = &document; | 168 Document* contentDocument = &document; |
| 169 while (fullscreenElement && fullscreenElement->isFrameOwnerElement()) { | 169 while (fullscreenElement && fullscreenElement->isFrameOwnerElement()) { |
| 170 contentDocument = toHTMLFrameOwnerElement(fullscreenElement)->contentDoc
ument(); | 170 contentDocument = toHTMLFrameOwnerElement(fullscreenElement)->contentDoc
ument(); |
| 171 if (!contentDocument) | 171 if (!contentDocument) |
| 172 return 0; | 172 return nullptr; |
| 173 fullscreenElement = Fullscreen::fullscreenElementFrom(*contentDocument); | 173 fullscreenElement = Fullscreen::fullscreenElementFrom(*contentDocument); |
| 174 } | 174 } |
| 175 // Get the current fullscreen element from the document. | 175 // Get the current fullscreen element from the document. |
| 176 fullscreenElement = Fullscreen::currentFullScreenElementFrom(*contentDocumen
t); | 176 fullscreenElement = Fullscreen::currentFullScreenElementFrom(*contentDocumen
t); |
| 177 if (!isHTMLVideoElement(fullscreenElement)) | 177 if (!isHTMLVideoElement(fullscreenElement)) |
| 178 return 0; | 178 return nullptr; |
| 179 LayoutObject* layoutObject = fullscreenElement->layoutObject(); | 179 LayoutObject* layoutObject = fullscreenElement->layoutObject(); |
| 180 if (!layoutObject) | 180 if (!layoutObject) |
| 181 return 0; | 181 return nullptr; |
| 182 return toLayoutVideo(layoutObject); | 182 return toLayoutVideo(layoutObject); |
| 183 } | 183 } |
| 184 | 184 |
| 185 // The descendant-dependent flags system is badly broken because we clean dirty | 185 // The descendant-dependent flags system is badly broken because we clean dirty |
| 186 // bits in upward tree walks, which means we need to call updateDescendantDepend
entFlags | 186 // bits in upward tree walks, which means we need to call updateDescendantDepend
entFlags |
| 187 // at every node in the tree to fully clean all the dirty bits. While we'll in | 187 // at every node in the tree to fully clean all the dirty bits. While we'll in |
| 188 // the process of fixing this issue, updateDescendantDependentFlagsForEntireSubt
ree | 188 // the process of fixing this issue, updateDescendantDependentFlagsForEntireSubt
ree |
| 189 // provides a big hammer for actually cleaning all the dirty bits in a subtree. | 189 // provides a big hammer for actually cleaning all the dirty bits in a subtree. |
| 190 // | 190 // |
| 191 // FIXME: Remove this function once the descendant-dependent flags system keeps | 191 // FIXME: Remove this function once the descendant-dependent flags system keeps |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 | 445 |
| 446 // If we need to issue paint invalidations, do so before allocating the
compositedDeprecatedPaintLayerMapping and clearing out the groupedMapping. | 446 // If we need to issue paint invalidations, do so before allocating the
compositedDeprecatedPaintLayerMapping and clearing out the groupedMapping. |
| 447 paintInvalidationOnCompositingChange(layer); | 447 paintInvalidationOnCompositingChange(layer); |
| 448 | 448 |
| 449 // If this layer was previously squashed, we need to remove its referenc
e to a groupedMapping right away, so | 449 // If this layer was previously squashed, we need to remove its referenc
e to a groupedMapping right away, so |
| 450 // that computing paint invalidation rects will know the layer's correct
compositingState. | 450 // that computing paint invalidation rects will know the layer's correct
compositingState. |
| 451 // FIXME: do we need to also remove the layer from it's location in the
squashing list of its groupedMapping? | 451 // FIXME: do we need to also remove the layer from it's location in the
squashing list of its groupedMapping? |
| 452 // Need to create a test where a squashed layer pops into compositing. A
nd also to cover all other | 452 // Need to create a test where a squashed layer pops into compositing. A
nd also to cover all other |
| 453 // sorts of compositingState transitions. | 453 // sorts of compositingState transitions. |
| 454 layer->setLostGroupedMapping(false); | 454 layer->setLostGroupedMapping(false); |
| 455 layer->setGroupedMapping(0); | 455 layer->setGroupedMapping(nullptr); |
| 456 | 456 |
| 457 layer->ensureCompositedDeprecatedPaintLayerMapping(); | 457 layer->ensureCompositedDeprecatedPaintLayerMapping(); |
| 458 compositedDeprecatedPaintLayerMappingChanged = true; | 458 compositedDeprecatedPaintLayerMappingChanged = true; |
| 459 | 459 |
| 460 // At this time, the ScrollingCooridnator only supports the top-level fr
ame. | 460 // At this time, the ScrollingCooridnator only supports the top-level fr
ame. |
| 461 if (layer->isRootLayer() && m_layoutView.frame()->isLocalRoot()) { | 461 if (layer->isRootLayer() && m_layoutView.frame()->isLocalRoot()) { |
| 462 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoor
dinator()) | 462 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoor
dinator()) |
| 463 scrollingCoordinator->frameViewRootLayerDidChange(m_layoutView.f
rameView()); | 463 scrollingCoordinator->frameViewRootLayerDidChange(m_layoutView.f
rameView()); |
| 464 } | 464 } |
| 465 break; | 465 break; |
| 466 case RemoveOwnCompositedDeprecatedPaintLayerMapping: | 466 case RemoveOwnCompositedDeprecatedPaintLayerMapping: |
| 467 // PutInSquashingLayer means you might have to remove the composited layer m
apping first. | 467 // PutInSquashingLayer means you might have to remove the composited layer m
apping first. |
| 468 case PutInSquashingLayer: | 468 case PutInSquashingLayer: |
| 469 if (layer->hasCompositedDeprecatedPaintLayerMapping()) { | 469 if (layer->hasCompositedDeprecatedPaintLayerMapping()) { |
| 470 // If we're removing the compositedDeprecatedPaintLayerMapping from
a reflection, clear the source GraphicsLayer's pointer to | 470 // If we're removing the compositedDeprecatedPaintLayerMapping from
a reflection, clear the source GraphicsLayer's pointer to |
| 471 // its replica GraphicsLayer. In practice this should never happen b
ecause reflectee and reflection | 471 // its replica GraphicsLayer. In practice this should never happen b
ecause reflectee and reflection |
| 472 // are both either composited, or not composited. | 472 // are both either composited, or not composited. |
| 473 if (layer->isReflection()) { | 473 if (layer->isReflection()) { |
| 474 DeprecatedPaintLayer* sourceLayer = toLayoutBoxModelObject(layer
->layoutObject()->parent())->layer(); | 474 DeprecatedPaintLayer* sourceLayer = toLayoutBoxModelObject(layer
->layoutObject()->parent())->layer(); |
| 475 if (sourceLayer->hasCompositedDeprecatedPaintLayerMapping()) { | 475 if (sourceLayer->hasCompositedDeprecatedPaintLayerMapping()) { |
| 476 ASSERT(sourceLayer->compositedDeprecatedPaintLayerMapping()-
>mainGraphicsLayer()->replicaLayer() == layer->compositedDeprecatedPaintLayerMap
ping()->mainGraphicsLayer()); | 476 ASSERT(sourceLayer->compositedDeprecatedPaintLayerMapping()-
>mainGraphicsLayer()->replicaLayer() == layer->compositedDeprecatedPaintLayerMap
ping()->mainGraphicsLayer()); |
| 477 sourceLayer->compositedDeprecatedPaintLayerMapping()->mainGr
aphicsLayer()->setReplicatedByLayer(0); | 477 sourceLayer->compositedDeprecatedPaintLayerMapping()->mainGr
aphicsLayer()->setReplicatedByLayer(nullptr); |
| 478 } | 478 } |
| 479 } | 479 } |
| 480 | 480 |
| 481 layer->clearCompositedDeprecatedPaintLayerMapping(); | 481 layer->clearCompositedDeprecatedPaintLayerMapping(); |
| 482 compositedDeprecatedPaintLayerMappingChanged = true; | 482 compositedDeprecatedPaintLayerMappingChanged = true; |
| 483 } | 483 } |
| 484 | 484 |
| 485 break; | 485 break; |
| 486 case RemoveFromSquashingLayer: | 486 case RemoveFromSquashingLayer: |
| 487 case NoCompositingStateChange: | 487 case NoCompositingStateChange: |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 // its paint invalidation rects, they must be included here. | 631 // its paint invalidation rects, they must be included here. |
| 632 if (flags & LayerTreeIncludesPaintInvalidationRects) | 632 if (flags & LayerTreeIncludesPaintInvalidationRects) |
| 633 return m_layoutView.frameView()->trackedPaintInvalidationRectsAsText() +
layerTreeText; | 633 return m_layoutView.frameView()->trackedPaintInvalidationRectsAsText() +
layerTreeText; |
| 634 | 634 |
| 635 return layerTreeText; | 635 return layerTreeText; |
| 636 } | 636 } |
| 637 | 637 |
| 638 DeprecatedPaintLayerCompositor* DeprecatedPaintLayerCompositor::frameContentsCom
positor(LayoutPart* layoutObject) | 638 DeprecatedPaintLayerCompositor* DeprecatedPaintLayerCompositor::frameContentsCom
positor(LayoutPart* layoutObject) |
| 639 { | 639 { |
| 640 if (!layoutObject->node()->isFrameOwnerElement()) | 640 if (!layoutObject->node()->isFrameOwnerElement()) |
| 641 return 0; | 641 return nullptr; |
| 642 | 642 |
| 643 HTMLFrameOwnerElement* element = toHTMLFrameOwnerElement(layoutObject->node(
)); | 643 HTMLFrameOwnerElement* element = toHTMLFrameOwnerElement(layoutObject->node(
)); |
| 644 if (Document* contentDocument = element->contentDocument()) { | 644 if (Document* contentDocument = element->contentDocument()) { |
| 645 if (LayoutView* view = contentDocument->layoutView()) | 645 if (LayoutView* view = contentDocument->layoutView()) |
| 646 return view->compositor(); | 646 return view->compositor(); |
| 647 } | 647 } |
| 648 return 0; | 648 return nullptr; |
| 649 } | 649 } |
| 650 | 650 |
| 651 // FIXME: What does this function do? It needs a clearer name. | 651 // FIXME: What does this function do? It needs a clearer name. |
| 652 bool DeprecatedPaintLayerCompositor::parentFrameContentLayers(LayoutPart* layout
Object) | 652 bool DeprecatedPaintLayerCompositor::parentFrameContentLayers(LayoutPart* layout
Object) |
| 653 { | 653 { |
| 654 DeprecatedPaintLayerCompositor* innerCompositor = frameContentsCompositor(la
youtObject); | 654 DeprecatedPaintLayerCompositor* innerCompositor = frameContentsCompositor(la
youtObject); |
| 655 if (!innerCompositor || !innerCompositor->staleInCompositingMode() || innerC
ompositor->rootLayerAttachment() != RootLayerAttachedViaEnclosingFrame) | 655 if (!innerCompositor || !innerCompositor->staleInCompositingMode() || innerC
ompositor->rootLayerAttachment() != RootLayerAttachedViaEnclosingFrame) |
| 656 return false; | 656 return false; |
| 657 | 657 |
| 658 DeprecatedPaintLayer* layer = layoutObject->layer(); | 658 DeprecatedPaintLayer* layer = layoutObject->layer(); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 return false; | 840 return false; |
| 841 | 841 |
| 842 return supportsFixedRootBackgroundCompositing() && m_layoutView.rootBackgrou
ndIsEntirelyFixed(); | 842 return supportsFixedRootBackgroundCompositing() && m_layoutView.rootBackgrou
ndIsEntirelyFixed(); |
| 843 } | 843 } |
| 844 | 844 |
| 845 GraphicsLayer* DeprecatedPaintLayerCompositor::fixedRootBackgroundLayer() const | 845 GraphicsLayer* DeprecatedPaintLayerCompositor::fixedRootBackgroundLayer() const |
| 846 { | 846 { |
| 847 // Get the fixed root background from the LayoutView layer's compositedDepre
catedPaintLayerMapping. | 847 // Get the fixed root background from the LayoutView layer's compositedDepre
catedPaintLayerMapping. |
| 848 DeprecatedPaintLayer* viewLayer = m_layoutView.layer(); | 848 DeprecatedPaintLayer* viewLayer = m_layoutView.layer(); |
| 849 if (!viewLayer) | 849 if (!viewLayer) |
| 850 return 0; | 850 return nullptr; |
| 851 | 851 |
| 852 if (viewLayer->compositingState() == PaintsIntoOwnBacking && viewLayer->comp
ositedDeprecatedPaintLayerMapping()->backgroundLayerPaintsFixedRootBackground()) | 852 if (viewLayer->compositingState() == PaintsIntoOwnBacking && viewLayer->comp
ositedDeprecatedPaintLayerMapping()->backgroundLayerPaintsFixedRootBackground()) |
| 853 return viewLayer->compositedDeprecatedPaintLayerMapping()->backgroundLay
er(); | 853 return viewLayer->compositedDeprecatedPaintLayerMapping()->backgroundLay
er(); |
| 854 | 854 |
| 855 return 0; | 855 return nullptr; |
| 856 } | 856 } |
| 857 | 857 |
| 858 static void resetTrackedPaintInvalidationRectsRecursive(GraphicsLayer* graphicsL
ayer) | 858 static void resetTrackedPaintInvalidationRectsRecursive(GraphicsLayer* graphicsL
ayer) |
| 859 { | 859 { |
| 860 if (!graphicsLayer) | 860 if (!graphicsLayer) |
| 861 return; | 861 return; |
| 862 | 862 |
| 863 graphicsLayer->resetTrackedPaintInvalidations(); | 863 graphicsLayer->resetTrackedPaintInvalidations(); |
| 864 | 864 |
| 865 for (size_t i = 0; i < graphicsLayer->children().size(); ++i) | 865 for (size_t i = 0; i < graphicsLayer->children().size(); ++i) |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1159 WebCompositorAnimationTimeline* compositorTimeline = frame.document() ? fram
e.document()->timeline().compositorTimeline() : nullptr; | 1159 WebCompositorAnimationTimeline* compositorTimeline = frame.document() ? fram
e.document()->timeline().compositorTimeline() : nullptr; |
| 1160 if (compositorTimeline) | 1160 if (compositorTimeline) |
| 1161 page->chromeClient().detachCompositorAnimationTimeline(compositorTimelin
e, &frame); | 1161 page->chromeClient().detachCompositorAnimationTimeline(compositorTimelin
e, &frame); |
| 1162 } | 1162 } |
| 1163 | 1163 |
| 1164 ScrollingCoordinator* DeprecatedPaintLayerCompositor::scrollingCoordinator() con
st | 1164 ScrollingCoordinator* DeprecatedPaintLayerCompositor::scrollingCoordinator() con
st |
| 1165 { | 1165 { |
| 1166 if (Page* page = this->page()) | 1166 if (Page* page = this->page()) |
| 1167 return page->scrollingCoordinator(); | 1167 return page->scrollingCoordinator(); |
| 1168 | 1168 |
| 1169 return 0; | 1169 return nullptr; |
| 1170 } | 1170 } |
| 1171 | 1171 |
| 1172 GraphicsLayerFactory* DeprecatedPaintLayerCompositor::graphicsLayerFactory() con
st | 1172 GraphicsLayerFactory* DeprecatedPaintLayerCompositor::graphicsLayerFactory() con
st |
| 1173 { | 1173 { |
| 1174 if (Page* page = this->page()) | 1174 if (Page* page = this->page()) |
| 1175 return page->chromeClient().graphicsLayerFactory(); | 1175 return page->chromeClient().graphicsLayerFactory(); |
| 1176 return 0; | 1176 return nullptr; |
| 1177 } | 1177 } |
| 1178 | 1178 |
| 1179 Page* DeprecatedPaintLayerCompositor::page() const | 1179 Page* DeprecatedPaintLayerCompositor::page() const |
| 1180 { | 1180 { |
| 1181 return m_layoutView.frameView()->frame().page(); | 1181 return m_layoutView.frameView()->frame().page(); |
| 1182 } | 1182 } |
| 1183 | 1183 |
| 1184 DocumentLifecycle& DeprecatedPaintLayerCompositor::lifecycle() const | 1184 DocumentLifecycle& DeprecatedPaintLayerCompositor::lifecycle() const |
| 1185 { | 1185 { |
| 1186 return m_layoutView.document().lifecycle(); | 1186 return m_layoutView.document().lifecycle(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1206 } else if (graphicsLayer == m_scrollLayer.get()) { | 1206 } else if (graphicsLayer == m_scrollLayer.get()) { |
| 1207 name = "LocalFrame Scrolling Layer"; | 1207 name = "LocalFrame Scrolling Layer"; |
| 1208 } else { | 1208 } else { |
| 1209 ASSERT_NOT_REACHED(); | 1209 ASSERT_NOT_REACHED(); |
| 1210 } | 1210 } |
| 1211 | 1211 |
| 1212 return name; | 1212 return name; |
| 1213 } | 1213 } |
| 1214 | 1214 |
| 1215 } // namespace blink | 1215 } // namespace blink |
| OLD | NEW |