| 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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 // If a fixed position layer gained/lost a compositedLayerMapping or the rea
son not compositing it changed, | 641 // If a fixed position layer gained/lost a compositedLayerMapping or the rea
son not compositing it changed, |
| 642 // the scrolling coordinator needs to recalculate whether it can do fast scr
olling. | 642 // the scrolling coordinator needs to recalculate whether it can do fast scr
olling. |
| 643 if (compositedLayerMappingChanged || nonCompositedReasonChanged) { | 643 if (compositedLayerMappingChanged || nonCompositedReasonChanged) { |
| 644 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) | 644 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) |
| 645 scrollingCoordinator->frameViewFixedObjectsDidChange(m_renderView.fr
ameView()); | 645 scrollingCoordinator->frameViewFixedObjectsDidChange(m_renderView.fr
ameView()); |
| 646 } | 646 } |
| 647 | 647 |
| 648 return compositedLayerMappingChanged || nonCompositedReasonChanged; | 648 return compositedLayerMappingChanged || nonCompositedReasonChanged; |
| 649 } | 649 } |
| 650 | 650 |
| 651 static IntPoint computeOffsetFromAbsolute(RenderLayer* layer) | 651 static LayoutPoint computeOffsetFromAbsolute(RenderLayer* layer) |
| 652 { | 652 { |
| 653 TransformState transformState(TransformState::ApplyTransformDirection, Float
Point()); | 653 TransformState transformState(TransformState::ApplyTransformDirection, Float
Point()); |
| 654 layer->renderer()->mapLocalToContainer(0, transformState, ApplyContainerFlip
); | 654 layer->renderer()->mapLocalToContainer(0, transformState, ApplyContainerFlip
); |
| 655 transformState.flatten(); | 655 transformState.flatten(); |
| 656 return roundedIntPoint(transformState.lastPlanarPoint()); | 656 return LayoutPoint(transformState.lastPlanarPoint()); |
| 657 } | 657 } |
| 658 | 658 |
| 659 bool RenderLayerCompositor::updateSquashingAssignment(RenderLayer* layer, Squash
ingState& squashingState, const CompositingStateTransitionType compositedLayerUp
date) | 659 bool RenderLayerCompositor::updateSquashingAssignment(RenderLayer* layer, Squash
ingState& squashingState, const CompositingStateTransitionType compositedLayerUp
date) |
| 660 { | 660 { |
| 661 | 661 |
| 662 // NOTE: In the future as we generalize this, the background of this layer m
ay need to be assigned to a different backing than | 662 // NOTE: In the future as we generalize this, the background of this layer m
ay need to be assigned to a different backing than |
| 663 // the squashed RenderLayer's own primary contents. This would happen when w
e have a composited negative z-index element that needs | 663 // the squashed RenderLayer's own primary contents. This would happen when w
e have a composited negative z-index element that needs |
| 664 // to paint on top of the background, but below the layer's main contents. F
or now, because we always composite layers | 664 // to paint on top of the background, but below the layer's main contents. F
or now, because we always composite layers |
| 665 // when they have a composited negative z-index child, such layers will neve
r need squashing so it is not yet an issue. | 665 // when they have a composited negative z-index child, such layers will neve
r need squashing so it is not yet an issue. |
| 666 if (compositedLayerUpdate == PutInSquashingLayer) { | 666 if (compositedLayerUpdate == PutInSquashingLayer) { |
| 667 // A layer that is squashed with other layers cannot have its own Compos
itedLayerMapping. | 667 // A layer that is squashed with other layers cannot have its own Compos
itedLayerMapping. |
| 668 ASSERT(!layer->hasCompositedLayerMapping()); | 668 ASSERT(!layer->hasCompositedLayerMapping()); |
| 669 ASSERT(squashingState.hasMostRecentMapping); | 669 ASSERT(squashingState.hasMostRecentMapping); |
| 670 | 670 |
| 671 IntPoint offsetFromAbsoluteForSquashedLayer = computeOffsetFromAbsolute(
layer); | 671 LayoutPoint offsetFromAbsoluteForSquashedLayer = computeOffsetFromAbsolu
te(layer); |
| 672 | 672 |
| 673 IntSize offsetFromSquashingCLM(offsetFromAbsoluteForSquashedLayer.x() -
squashingState.offsetFromAbsoluteForSquashingCLM.x(), | 673 LayoutSize offsetFromSquashingCLM(offsetFromAbsoluteForSquashedLayer.x()
- squashingState.offsetFromAbsoluteForSquashingCLM.x(), |
| 674 offsetFromAbsoluteForSquashedLayer.y() - squashingState.offsetFromAb
soluteForSquashingCLM.y()); | 674 offsetFromAbsoluteForSquashedLayer.y() - squashingState.offsetFromAb
soluteForSquashingCLM.y()); |
| 675 | 675 |
| 676 bool changedSquashingLayer = | 676 bool changedSquashingLayer = |
| 677 squashingState.mostRecentMapping->updateSquashingLayerAssignment(lay
er, offsetFromSquashingCLM, squashingState.nextSquashedLayerIndex); | 677 squashingState.mostRecentMapping->updateSquashingLayerAssignment(lay
er, offsetFromSquashingCLM, squashingState.nextSquashedLayerIndex); |
| 678 squashingState.nextSquashedLayerIndex++; | 678 squashingState.nextSquashedLayerIndex++; |
| 679 | 679 |
| 680 if (!changedSquashingLayer) | 680 if (!changedSquashingLayer) |
| 681 return true; | 681 return true; |
| 682 | 682 |
| 683 layer->clipper().clearClipRectsIncludingDescendants(); | 683 layer->clipper().clearClipRectsIncludingDescendants(); |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1133 | 1133 |
| 1134 if (!willBeCompositedOrSquashed && layer->parent()) | 1134 if (!willBeCompositedOrSquashed && layer->parent()) |
| 1135 layer->parent()->setHasNonCompositedChild(true); | 1135 layer->parent()->setHasNonCompositedChild(true); |
| 1136 | 1136 |
| 1137 descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DTrans
form(); | 1137 descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DTrans
form(); |
| 1138 | 1138 |
| 1139 if (overlapMap) | 1139 if (overlapMap) |
| 1140 overlapMap->geometryMap().popMappingsToAncestor(ancestorLayer); | 1140 overlapMap->geometryMap().popMappingsToAncestor(ancestorLayer); |
| 1141 } | 1141 } |
| 1142 | 1142 |
| 1143 void RenderLayerCompositor::SquashingState::updateSquashingStateForNewMapping(Co
mpositedLayerMappingPtr newCompositedLayerMapping, bool hasNewCompositedLayerMap
ping, IntPoint newOffsetFromAbsoluteForSquashingCLM, RenderLayer* newClippingAnc
estorForMostRecentMapping) | 1143 void RenderLayerCompositor::SquashingState::updateSquashingStateForNewMapping(Co
mpositedLayerMappingPtr newCompositedLayerMapping, bool hasNewCompositedLayerMap
ping, LayoutPoint newOffsetFromAbsoluteForSquashingCLM, RenderLayer* newClipping
AncestorForMostRecentMapping) |
| 1144 { | 1144 { |
| 1145 // The most recent backing is done accumulating any more squashing layers. | 1145 // The most recent backing is done accumulating any more squashing layers. |
| 1146 if (hasMostRecentMapping) | 1146 if (hasMostRecentMapping) |
| 1147 mostRecentMapping->finishAccumulatingSquashingLayers(nextSquashedLayerIn
dex); | 1147 mostRecentMapping->finishAccumulatingSquashingLayers(nextSquashedLayerIn
dex); |
| 1148 | 1148 |
| 1149 nextSquashedLayerIndex = 0; | 1149 nextSquashedLayerIndex = 0; |
| 1150 mostRecentMapping = newCompositedLayerMapping; | 1150 mostRecentMapping = newCompositedLayerMapping; |
| 1151 hasMostRecentMapping = hasNewCompositedLayerMapping; | 1151 hasMostRecentMapping = hasNewCompositedLayerMapping; |
| 1152 offsetFromAbsoluteForSquashingCLM = newOffsetFromAbsoluteForSquashingCLM; | 1152 offsetFromAbsoluteForSquashingCLM = newOffsetFromAbsoluteForSquashingCLM; |
| 1153 clippingAncestorForMostRecentMapping = newClippingAncestorForMostRecentMappi
ng; | 1153 clippingAncestorForMostRecentMapping = newClippingAncestorForMostRecentMappi
ng; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1200 if (layer->stackingNode()->isStackingContainer()) { | 1200 if (layer->stackingNode()->isStackingContainer()) { |
| 1201 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), Negativ
eZOrderChildren); | 1201 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), Negativ
eZOrderChildren); |
| 1202 while (RenderLayerStackingNode* curNode = iterator.next()) | 1202 while (RenderLayerStackingNode* curNode = iterator.next()) |
| 1203 assignLayersToBackingsInternal(curNode->layer(), squashingState, lay
ersChanged, clippingAncestor); | 1203 assignLayersToBackingsInternal(curNode->layer(), squashingState, lay
ersChanged, clippingAncestor); |
| 1204 } | 1204 } |
| 1205 | 1205 |
| 1206 if (layerSquashingEnabled()) { | 1206 if (layerSquashingEnabled()) { |
| 1207 // At this point, if the layer is to be "separately" composited, then it
s backing becomes the most recent in paint-order. | 1207 // At this point, if the layer is to be "separately" composited, then it
s backing becomes the most recent in paint-order. |
| 1208 if (layer->compositingState() == PaintsIntoOwnBacking || layer->composit
ingState() == HasOwnBackingButPaintsIntoAncestor) { | 1208 if (layer->compositingState() == PaintsIntoOwnBacking || layer->composit
ingState() == HasOwnBackingButPaintsIntoAncestor) { |
| 1209 ASSERT(!requiresSquashing(layer->compositingReasons())); | 1209 ASSERT(!requiresSquashing(layer->compositingReasons())); |
| 1210 IntPoint offsetFromAbsoluteForSquashingCLM = computeOffsetFromAbsolu
te(layer); | 1210 LayoutPoint offsetFromAbsoluteForSquashingCLM = computeOffsetFromAbs
olute(layer); |
| 1211 squashingState.updateSquashingStateForNewMapping(layer->compositedLa
yerMapping(), layer->hasCompositedLayerMapping(), offsetFromAbsoluteForSquashing
CLM, clippingAncestor); | 1211 squashingState.updateSquashingStateForNewMapping(layer->compositedLa
yerMapping(), layer->hasCompositedLayerMapping(), offsetFromAbsoluteForSquashing
CLM, clippingAncestor); |
| 1212 } | 1212 } |
| 1213 } | 1213 } |
| 1214 | 1214 |
| 1215 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowC
hildren | PositiveZOrderChildren); | 1215 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowC
hildren | PositiveZOrderChildren); |
| 1216 while (RenderLayerStackingNode* curNode = iterator.next()) | 1216 while (RenderLayerStackingNode* curNode = iterator.next()) |
| 1217 assignLayersToBackingsInternal(curNode->layer(), squashingState, layersC
hanged, clippingAncestor); | 1217 assignLayersToBackingsInternal(curNode->layer(), squashingState, layersC
hanged, clippingAncestor); |
| 1218 } | 1218 } |
| 1219 | 1219 |
| 1220 void RenderLayerCompositor::setCompositingParent(RenderLayer* childLayer, Render
Layer* parentLayer) | 1220 void RenderLayerCompositor::setCompositingParent(RenderLayer* childLayer, Render
Layer* parentLayer) |
| (...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2243 } else if (graphicsLayer == m_scrollLayer.get()) { | 2243 } else if (graphicsLayer == m_scrollLayer.get()) { |
| 2244 name = "LocalFrame Scrolling Layer"; | 2244 name = "LocalFrame Scrolling Layer"; |
| 2245 } else { | 2245 } else { |
| 2246 ASSERT_NOT_REACHED(); | 2246 ASSERT_NOT_REACHED(); |
| 2247 } | 2247 } |
| 2248 | 2248 |
| 2249 return name; | 2249 return name; |
| 2250 } | 2250 } |
| 2251 | 2251 |
| 2252 } // namespace WebCore | 2252 } // namespace WebCore |
| OLD | NEW |