Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1450)

Side by Side Diff: Source/core/rendering/compositing/RenderLayerCompositor.cpp

Issue 143283011: Make squashing work with subpixel layout (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Track and use subpixel accumulation for each squashed RenderLayer Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 roundedLayoutPoint(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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 1138
1139 if (!willBeCompositedOrSquashed && layer->parent()) 1139 if (!willBeCompositedOrSquashed && layer->parent())
1140 layer->parent()->setHasNonCompositedChild(true); 1140 layer->parent()->setHasNonCompositedChild(true);
1141 1141
1142 descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DTrans form(); 1142 descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DTrans form();
1143 1143
1144 if (overlapMap) 1144 if (overlapMap)
1145 overlapMap->geometryMap().popMappingsToAncestor(ancestorLayer); 1145 overlapMap->geometryMap().popMappingsToAncestor(ancestorLayer);
1146 } 1146 }
1147 1147
1148 void RenderLayerCompositor::SquashingState::updateSquashingStateForNewMapping(Co mpositedLayerMappingPtr newCompositedLayerMapping, bool hasNewCompositedLayerMap ping, IntPoint newOffsetFromAbsoluteForSquashingCLM, RenderLayer* newClippingAnc estorForMostRecentMapping) 1148 void RenderLayerCompositor::SquashingState::updateSquashingStateForNewMapping(Co mpositedLayerMappingPtr newCompositedLayerMapping, bool hasNewCompositedLayerMap ping, LayoutPoint newOffsetFromAbsoluteForSquashingCLM, RenderLayer* newClipping AncestorForMostRecentMapping)
1149 { 1149 {
1150 // The most recent backing is done accumulating any more squashing layers. 1150 // The most recent backing is done accumulating any more squashing layers.
1151 if (hasMostRecentMapping) 1151 if (hasMostRecentMapping)
1152 mostRecentMapping->finishAccumulatingSquashingLayers(nextSquashedLayerIn dex); 1152 mostRecentMapping->finishAccumulatingSquashingLayers(nextSquashedLayerIn dex);
1153 1153
1154 nextSquashedLayerIndex = 0; 1154 nextSquashedLayerIndex = 0;
1155 mostRecentMapping = newCompositedLayerMapping; 1155 mostRecentMapping = newCompositedLayerMapping;
1156 hasMostRecentMapping = hasNewCompositedLayerMapping; 1156 hasMostRecentMapping = hasNewCompositedLayerMapping;
1157 offsetFromAbsoluteForSquashingCLM = newOffsetFromAbsoluteForSquashingCLM; 1157 offsetFromAbsoluteForSquashingCLM = newOffsetFromAbsoluteForSquashingCLM;
1158 clippingAncestorForMostRecentMapping = newClippingAncestorForMostRecentMappi ng; 1158 clippingAncestorForMostRecentMapping = newClippingAncestorForMostRecentMappi ng;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1205 if (layer->stackingNode()->isStackingContainer()) { 1205 if (layer->stackingNode()->isStackingContainer()) {
1206 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), Negativ eZOrderChildren); 1206 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), Negativ eZOrderChildren);
1207 while (RenderLayerStackingNode* curNode = iterator.next()) 1207 while (RenderLayerStackingNode* curNode = iterator.next())
1208 assignLayersToBackingsInternal(curNode->layer(), squashingState, lay ersChanged, clippingAncestor); 1208 assignLayersToBackingsInternal(curNode->layer(), squashingState, lay ersChanged, clippingAncestor);
1209 } 1209 }
1210 1210
1211 if (layerSquashingEnabled()) { 1211 if (layerSquashingEnabled()) {
1212 // At this point, if the layer is to be "separately" composited, then it s backing becomes the most recent in paint-order. 1212 // At this point, if the layer is to be "separately" composited, then it s backing becomes the most recent in paint-order.
1213 if (layer->compositingState() == PaintsIntoOwnBacking || layer->composit ingState() == HasOwnBackingButPaintsIntoAncestor) { 1213 if (layer->compositingState() == PaintsIntoOwnBacking || layer->composit ingState() == HasOwnBackingButPaintsIntoAncestor) {
1214 ASSERT(!requiresSquashing(layer->compositingReasons())); 1214 ASSERT(!requiresSquashing(layer->compositingReasons()));
1215 IntPoint offsetFromAbsoluteForSquashingCLM = computeOffsetFromAbsolu te(layer); 1215 LayoutPoint offsetFromAbsoluteForSquashingCLM = computeOffsetFromAbs olute(layer);
1216 squashingState.updateSquashingStateForNewMapping(layer->compositedLa yerMapping(), layer->hasCompositedLayerMapping(), offsetFromAbsoluteForSquashing CLM, clippingAncestor); 1216 squashingState.updateSquashingStateForNewMapping(layer->compositedLa yerMapping(), layer->hasCompositedLayerMapping(), offsetFromAbsoluteForSquashing CLM, clippingAncestor);
1217 } 1217 }
1218 } 1218 }
1219 1219
1220 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowC hildren | PositiveZOrderChildren); 1220 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowC hildren | PositiveZOrderChildren);
1221 while (RenderLayerStackingNode* curNode = iterator.next()) 1221 while (RenderLayerStackingNode* curNode = iterator.next())
1222 assignLayersToBackingsInternal(curNode->layer(), squashingState, layersC hanged, clippingAncestor); 1222 assignLayersToBackingsInternal(curNode->layer(), squashingState, layersC hanged, clippingAncestor);
1223 } 1223 }
1224 1224
1225 void RenderLayerCompositor::setCompositingParent(RenderLayer* childLayer, Render Layer* parentLayer) 1225 void RenderLayerCompositor::setCompositingParent(RenderLayer* childLayer, Render Layer* parentLayer)
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after
2248 } else if (graphicsLayer == m_scrollLayer.get()) { 2248 } else if (graphicsLayer == m_scrollLayer.get()) {
2249 name = "LocalFrame Scrolling Layer"; 2249 name = "LocalFrame Scrolling Layer";
2250 } else { 2250 } else {
2251 ASSERT_NOT_REACHED(); 2251 ASSERT_NOT_REACHED();
2252 } 2252 }
2253 2253
2254 return name; 2254 return name;
2255 } 2255 }
2256 2256
2257 } // namespace WebCore 2257 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698