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

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

Issue 195893026: Fix restrictions on squashing with incompatible scroll. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix typo 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 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 720
721 layer->setViewportConstrainedNotCompositedReason(viewportConstrainedNotC ompositedReason); 721 layer->setViewportConstrainedNotCompositedReason(viewportConstrainedNotC ompositedReason);
722 return true; 722 return true;
723 } 723 }
724 return false; 724 return false;
725 } 725 }
726 726
727 bool RenderLayerCompositor::canSquashIntoCurrentSquashingOwner(const RenderLayer * layer, const RenderLayerCompositor::SquashingState& squashingState, const Rend erLayer* clippingAncestor) 727 bool RenderLayerCompositor::canSquashIntoCurrentSquashingOwner(const RenderLayer * layer, const RenderLayerCompositor::SquashingState& squashingState, const Rend erLayer* clippingAncestor)
728 { 728 {
729 ASSERT(clippingAncestor); 729 ASSERT(clippingAncestor);
730 return clippingAncestor == squashingState.clippingAncestorForMostRecentMappi ng; 730 if (clippingAncestor != squashingState.clippingAncestorForMostRecentMapping)
731 return false;
732
733 ASSERT(squashingState.hasMostRecentMapping);
734 if (layer->scrollsWithRespectTo(&squashingState.mostRecentMapping->owningLay er()))
735 return false;
736
737 return true;
731 } 738 }
732 739
733 RenderLayerCompositor::CompositingStateTransitionType RenderLayerCompositor::com puteCompositedLayerUpdate(RenderLayer* layer) 740 RenderLayerCompositor::CompositingStateTransitionType RenderLayerCompositor::com puteCompositedLayerUpdate(RenderLayer* layer)
734 { 741 {
735 CompositingStateTransitionType update = NoCompositingStateChange; 742 CompositingStateTransitionType update = NoCompositingStateChange;
736 if (needsOwnBacking(layer)) { 743 if (needsOwnBacking(layer)) {
737 if (!layer->hasCompositedLayerMapping()) { 744 if (!layer->hasCompositedLayerMapping()) {
738 update = AllocateOwnCompositedLayerMapping; 745 update = AllocateOwnCompositedLayerMapping;
739 } 746 }
740 } else { 747 } else {
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 if (absBounds.isEmpty()) 947 if (absBounds.isEmpty())
941 absBounds.setSize(IntSize(1, 1)); 948 absBounds.setSize(IntSize(1, 1));
942 } 949 }
943 absoluteDecendantBoundingBox = absBounds; 950 absoluteDecendantBoundingBox = absBounds;
944 951
945 if (overlapMap && currentRecursionData.m_testingOverlap && !requiresComposit ingOrSquashing(directReasons)) 952 if (overlapMap && currentRecursionData.m_testingOverlap && !requiresComposit ingOrSquashing(directReasons))
946 overlapCompositingReason = overlapMap->overlapsLayers(absBounds) ? Compo sitingReasonOverlap : CompositingReasonNone; 953 overlapCompositingReason = overlapMap->overlapsLayers(absBounds) ? Compo sitingReasonOverlap : CompositingReasonNone;
947 954
948 reasonsToComposite |= overlapCompositingReason; 955 reasonsToComposite |= overlapCompositingReason;
949 956
950 // If the layer is squashable, but would scroll differently than the
951 // most recent backing that it would squash onto, then don't squash it.
952 // Note that this happens before we know all possible compositing reasons
953 // for this layer, but it's OK because we're just forcing the layer conserva tively
954 // to be separately composited rather than squashed, anyway.
955 if (currentRecursionData.m_mostRecentCompositedLayer && requiresSquashing(re asonsToComposite)
956 && layer->scrollsWithRespectTo(currentRecursionData.m_mostRecentComposit edLayer))
957 reasonsToComposite |= CompositingReasonOverlapsWithoutSquashingTarget;
958
959 // The children of this layer don't need to composite, unless there is 957 // The children of this layer don't need to composite, unless there is
960 // a compositing layer among them, so start by inheriting the compositing 958 // a compositing layer among them, so start by inheriting the compositing
961 // ancestor with m_subtreeIsCompositing set to false. 959 // ancestor with m_subtreeIsCompositing set to false.
962 CompositingRecursionData childRecursionData(currentRecursionData); 960 CompositingRecursionData childRecursionData(currentRecursionData);
963 childRecursionData.m_subtreeIsCompositing = false; 961 childRecursionData.m_subtreeIsCompositing = false;
964 962
965 bool willBeCompositedOrSquashed = canBeComposited(layer) && requiresComposit ingOrSquashing(reasonsToComposite); 963 bool willBeCompositedOrSquashed = canBeComposited(layer) && requiresComposit ingOrSquashing(reasonsToComposite);
966 if (willBeCompositedOrSquashed) { 964 if (willBeCompositedOrSquashed) {
967 // Tell the parent it has compositing descendants. 965 // Tell the parent it has compositing descendants.
968 currentRecursionData.m_subtreeIsCompositing = true; 966 currentRecursionData.m_subtreeIsCompositing = true;
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 if (reflectionLayer->hasCompositedLayerMapping()) 1170 if (reflectionLayer->hasCompositedLayerMapping())
1173 reflectionLayer->compositedLayerMapping()->updateGraphicsLayerConfigurat ion(); 1171 reflectionLayer->compositedLayerMapping()->updateGraphicsLayerConfigurat ion();
1174 } 1172 }
1175 1173
1176 void RenderLayerCompositor::assignLayersToBackingsInternal(RenderLayer* layer, S quashingState& squashingState, bool& layersChanged, RenderLayer* clippingAncesto r) 1174 void RenderLayerCompositor::assignLayersToBackingsInternal(RenderLayer* layer, S quashingState& squashingState, bool& layersChanged, RenderLayer* clippingAncesto r)
1177 { 1175 {
1178 if (layer->renderer()->hasClipOrOverflowClip()) 1176 if (layer->renderer()->hasClipOrOverflowClip())
1179 clippingAncestor = layer; 1177 clippingAncestor = layer;
1180 1178
1181 if (layerSquashingEnabled() && requiresSquashing(layer->compositingReasons() ) && !canSquashIntoCurrentSquashingOwner(layer, squashingState, clippingAncestor )) 1179 if (layerSquashingEnabled() && requiresSquashing(layer->compositingReasons() ) && !canSquashIntoCurrentSquashingOwner(layer, squashingState, clippingAncestor ))
1182 layer->setCompositingReasons(layer->compositingReasons() | CompositingRe asonOverlapsWithoutSquashingTarget); 1180 layer->setCompositingReasons(layer->compositingReasons() | CompositingRe asonNoSquashingTargetFound);
1183 1181
1184 CompositingStateTransitionType compositedLayerUpdate = computeCompositedLaye rUpdate(layer); 1182 CompositingStateTransitionType compositedLayerUpdate = computeCompositedLaye rUpdate(layer);
1185 1183
1186 if (allocateOrClearCompositedLayerMapping(layer, compositedLayerUpdate)) 1184 if (allocateOrClearCompositedLayerMapping(layer, compositedLayerUpdate))
1187 layersChanged = true; 1185 layersChanged = true;
1188 1186
1189 // FIXME: special-casing reflection layers here is not right. 1187 // FIXME: special-casing reflection layers here is not right.
1190 if (layer->reflectionInfo()) 1188 if (layer->reflectionInfo())
1191 assignLayersToBackingsForReflectionLayer(layer->reflectionInfo()->reflec tionLayer(), layersChanged); 1189 assignLayersToBackingsForReflectionLayer(layer->reflectionInfo()->reflec tionLayer(), layersChanged);
1192 1190
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
2243 } else if (graphicsLayer == m_scrollLayer.get()) { 2241 } else if (graphicsLayer == m_scrollLayer.get()) {
2244 name = "LocalFrame Scrolling Layer"; 2242 name = "LocalFrame Scrolling Layer";
2245 } else { 2243 } else {
2246 ASSERT_NOT_REACHED(); 2244 ASSERT_NOT_REACHED();
2247 } 2245 }
2248 2246
2249 return name; 2247 return name;
2250 } 2248 }
2251 2249
2252 } // namespace WebCore 2250 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/compositing/squashing/squash-above-fixed-2-expected.txt ('k') | Source/platform/graphics/CompositingReasons.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698