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

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

Issue 143283011: Make squashing work with subpixel layout (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 1036
1037 if (!willBeCompositedOrSquashed && layer->parent()) 1037 if (!willBeCompositedOrSquashed && layer->parent())
1038 layer->parent()->setHasNonCompositedChild(true); 1038 layer->parent()->setHasNonCompositedChild(true);
1039 1039
1040 descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DTrans form(); 1040 descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DTrans form();
1041 1041
1042 if (overlapMap) 1042 if (overlapMap)
1043 overlapMap->geometryMap().popMappingsToAncestor(ancestorLayer); 1043 overlapMap->geometryMap().popMappingsToAncestor(ancestorLayer);
1044 } 1044 }
1045 1045
1046 void RenderLayerCompositor::SquashingState::updateSquashingStateForNewMapping(Co mpositedLayerMappingPtr newCompositedLayerMapping, bool hasNewCompositedLayerMap ping, IntPoint newOffsetFromAbsoluteForSquashingCLM) 1046 void RenderLayerCompositor::SquashingState::updateSquashingStateForNewMapping(Co mpositedLayerMappingPtr newCompositedLayerMapping, bool hasNewCompositedLayerMap ping, LayoutPoint newOffsetFromAbsoluteForSquashingCLM)
1047 { 1047 {
1048 // The most recent backing is done accumulating any more squashing layers. 1048 // The most recent backing is done accumulating any more squashing layers.
1049 if (hasMostRecentMapping) 1049 if (hasMostRecentMapping)
1050 mostRecentMapping->finishAccumulatingSquashingLayers(nextSquashedLayerIn dex); 1050 mostRecentMapping->finishAccumulatingSquashingLayers(nextSquashedLayerIn dex);
1051 1051
1052 nextSquashedLayerIndex = 0; 1052 nextSquashedLayerIndex = 0;
1053 mostRecentMapping = newCompositedLayerMapping; 1053 mostRecentMapping = newCompositedLayerMapping;
1054 hasMostRecentMapping = hasNewCompositedLayerMapping; 1054 hasMostRecentMapping = hasNewCompositedLayerMapping;
1055 offsetFromAbsoluteForSquashingCLM = newOffsetFromAbsoluteForSquashingCLM; 1055 offsetFromAbsoluteForSquashingCLM = newOffsetFromAbsoluteForSquashingCLM;
1056 } 1056 }
1057 1057
1058 static IntPoint computeOffsetFromAbsolute(RenderLayer* layer) 1058 static LayoutPoint computeOffsetFromAbsolute(RenderLayer* layer)
1059 { 1059 {
1060 TransformState transformState(TransformState::ApplyTransformDirection, Float Point()); 1060 TransformState transformState(TransformState::ApplyTransformDirection, Float Point());
1061 layer->renderer()->mapLocalToContainer(0, transformState, ApplyContainerFlip ); 1061 layer->renderer()->mapLocalToContainer(0, transformState, ApplyContainerFlip );
1062 transformState.flatten(); 1062 transformState.flatten();
1063 return roundedIntPoint(transformState.lastPlanarPoint()); 1063 return roundedLayoutPoint(transformState.lastPlanarPoint());
1064 } 1064 }
1065 1065
1066 void RenderLayerCompositor::assignLayersToBackings(RenderLayer* updateRoot, bool & layersChanged) 1066 void RenderLayerCompositor::assignLayersToBackings(RenderLayer* updateRoot, bool & layersChanged)
1067 { 1067 {
1068 SquashingState squashingState; 1068 SquashingState squashingState;
1069 assignLayersToBackingsInternal(updateRoot, squashingState, layersChanged); 1069 assignLayersToBackingsInternal(updateRoot, squashingState, layersChanged);
1070 if (squashingState.hasMostRecentMapping) 1070 if (squashingState.hasMostRecentMapping)
1071 squashingState.mostRecentMapping->finishAccumulatingSquashingLayers(squa shingState.nextSquashedLayerIndex); 1071 squashingState.mostRecentMapping->finishAccumulatingSquashingLayers(squa shingState.nextSquashedLayerIndex);
1072 } 1072 }
1073 1073
1074 void RenderLayerCompositor::assignLayersToBackingsInternal(RenderLayer* layer, S quashingState& squashingState, bool& layersChanged) 1074 void RenderLayerCompositor::assignLayersToBackingsInternal(RenderLayer* layer, S quashingState& squashingState, bool& layersChanged)
1075 { 1075 {
1076 if (allocateOrClearCompositedLayerMapping(layer)) 1076 if (allocateOrClearCompositedLayerMapping(layer))
1077 layersChanged = true; 1077 layersChanged = true;
1078 1078
1079 if (layer->reflectionInfo() && updateLayerCompositingState(layer->reflection Info()->reflectionLayer())) 1079 if (layer->reflectionInfo() && updateLayerCompositingState(layer->reflection Info()->reflectionLayer()))
1080 layersChanged = true; 1080 layersChanged = true;
1081 1081
1082 // Add this layer to a squashing backing if needed. 1082 // Add this layer to a squashing backing if needed.
1083 if (layerSquashingEnabled()) { 1083 if (layerSquashingEnabled()) {
1084 // NOTE: In the future as we generalize this, the background of this lay er may need to be assigned to a different backing than 1084 // NOTE: In the future as we generalize this, the background of this lay er may need to be assigned to a different backing than
1085 // the squashed RenderLayer's own primary contents. This would happen wh en we have a composited negative z-index element that needs 1085 // the squashed RenderLayer's own primary contents. This would happen wh en we have a composited negative z-index element that needs
1086 // to paint on top of the background, but below the layer's main content s. For now, because we always composite layers 1086 // to paint on top of the background, but below the layer's main content s. For now, because we always composite layers
1087 // when they have a composited negative z-index child, such layers will never need squashing so it is not yet an issue. 1087 // when they have a composited negative z-index child, such layers will never need squashing so it is not yet an issue.
1088 if (requiresSquashing(layer->compositingReasons())) { 1088 if (requiresSquashing(layer->compositingReasons())) {
1089 // A layer that is squashed with other layers cannot have its own Co mpositedLayerMapping. 1089 // A layer that is squashed with other layers cannot have its own Co mpositedLayerMapping.
1090 ASSERT(!layer->hasCompositedLayerMapping()); 1090 ASSERT(!layer->hasCompositedLayerMapping());
1091 ASSERT(squashingState.hasMostRecentMapping); 1091 ASSERT(squashingState.hasMostRecentMapping);
1092 1092
1093 IntPoint offsetFromAbsoluteForSquashedLayer = computeOffsetFromAbsol ute(layer); 1093 LayoutPoint offsetFromAbsoluteForSquashedLayer = computeOffsetFromAb solute(layer);
1094 1094
1095 IntSize offsetFromSquashingCLM(offsetFromAbsoluteForSquashedLayer.x( ) - squashingState.offsetFromAbsoluteForSquashingCLM.x(), 1095 LayoutSize offsetFromSquashingCLM(offsetFromAbsoluteForSquashedLayer .x() - squashingState.offsetFromAbsoluteForSquashingCLM.x(),
1096 offsetFromAbsoluteForSquashedLayer.y() - squashingState.offsetFr omAbsoluteForSquashingCLM.y()); 1096 offsetFromAbsoluteForSquashedLayer.y() - squashingState.offsetFr omAbsoluteForSquashingCLM.y());
1097 1097
1098 squashingState.mostRecentMapping->addRenderLayerToSquashingGraphicsL ayer(layer, offsetFromSquashingCLM, squashingState.nextSquashedLayerIndex); 1098 squashingState.mostRecentMapping->addRenderLayerToSquashingGraphicsL ayer(layer, offsetFromSquashingCLM, squashingState.nextSquashedLayerIndex);
1099 squashingState.nextSquashedLayerIndex++; 1099 squashingState.nextSquashedLayerIndex++;
1100 1100
1101 // FIXME: this can be false sometimes depending on what happens in a ddRenderLayerToSquashingGraphicsLayer, which should return a bool. 1101 // FIXME: this can be false sometimes depending on what happens in a ddRenderLayerToSquashingGraphicsLayer, which should return a bool.
1102 layersChanged = true; 1102 layersChanged = true;
1103 1103
1104 // FIXME: this should be conditioned on whether this layer actually changed status 1104 // FIXME: this should be conditioned on whether this layer actually changed status
1105 layer->clipper().clearClipRectsIncludingDescendants(); 1105 layer->clipper().clearClipRectsIncludingDescendants();
(...skipping 25 matching lines...) Expand all
1131 if (layer->stackingNode()->isStackingContainer()) { 1131 if (layer->stackingNode()->isStackingContainer()) {
1132 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), Negativ eZOrderChildren); 1132 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), Negativ eZOrderChildren);
1133 while (RenderLayerStackingNode* curNode = iterator.next()) 1133 while (RenderLayerStackingNode* curNode = iterator.next())
1134 assignLayersToBackingsInternal(curNode->layer(), squashingState, lay ersChanged); 1134 assignLayersToBackingsInternal(curNode->layer(), squashingState, lay ersChanged);
1135 } 1135 }
1136 1136
1137 if (layerSquashingEnabled()) { 1137 if (layerSquashingEnabled()) {
1138 // At this point, if the layer is to be "separately" composited, then it s backing becomes the most recent in paint-order. 1138 // At this point, if the layer is to be "separately" composited, then it s backing becomes the most recent in paint-order.
1139 if (layer->compositingState() == PaintsIntoOwnBacking || layer->composit ingState() == HasOwnBackingButPaintsIntoAncestor) { 1139 if (layer->compositingState() == PaintsIntoOwnBacking || layer->composit ingState() == HasOwnBackingButPaintsIntoAncestor) {
1140 ASSERT(!requiresSquashing(layer->compositingReasons())); 1140 ASSERT(!requiresSquashing(layer->compositingReasons()));
1141 IntPoint offsetFromAbsoluteForSquashingCLM = computeOffsetFromAbsolu te(layer); 1141 LayoutPoint offsetFromAbsoluteForSquashingCLM = computeOffsetFromAbs olute(layer);
1142 squashingState.updateSquashingStateForNewMapping(layer->compositedLa yerMapping(), layer->hasCompositedLayerMapping(), offsetFromAbsoluteForSquashing CLM); 1142 squashingState.updateSquashingStateForNewMapping(layer->compositedLa yerMapping(), layer->hasCompositedLayerMapping(), offsetFromAbsoluteForSquashing CLM);
1143 } 1143 }
1144 } 1144 }
1145 1145
1146 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowC hildren | PositiveZOrderChildren); 1146 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowC hildren | PositiveZOrderChildren);
1147 while (RenderLayerStackingNode* curNode = iterator.next()) 1147 while (RenderLayerStackingNode* curNode = iterator.next())
1148 assignLayersToBackingsInternal(curNode->layer(), squashingState, layersC hanged); 1148 assignLayersToBackingsInternal(curNode->layer(), squashingState, layersC hanged);
1149 } 1149 }
1150 1150
1151 void RenderLayerCompositor::setCompositingParent(RenderLayer* childLayer, Render Layer* parentLayer) 1151 void RenderLayerCompositor::setCompositingParent(RenderLayer* childLayer, Render Layer* parentLayer)
(...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after
2604 } else if (graphicsLayer == m_scrollLayer.get()) { 2604 } else if (graphicsLayer == m_scrollLayer.get()) {
2605 name = "Frame Scrolling Layer"; 2605 name = "Frame Scrolling Layer";
2606 } else { 2606 } else {
2607 ASSERT_NOT_REACHED(); 2607 ASSERT_NOT_REACHED();
2608 } 2608 }
2609 2609
2610 return name; 2610 return name;
2611 } 2611 }
2612 2612
2613 } // namespace WebCore 2613 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698