Index: cc/layer_tree_host_common.cc |
diff --git a/cc/layer_tree_host_common.cc b/cc/layer_tree_host_common.cc |
index 3d06aa4a12b98233ed420ff14677606e16c3c93e..6cc34c35a58b18c807ba52c51b046af9e913980c 100644 |
--- a/cc/layer_tree_host_common.cc |
+++ b/cc/layer_tree_host_common.cc |
@@ -407,6 +407,18 @@ gfx::Transform computeScrollCompensationMatrixForChildren(LayerImpl* layer, cons |
return nextScrollCompensationMatrix; |
} |
+static gfx::Vector2dF computeFixedContainerSizeDeltaForChildren(Layer*, const gfx::Vector2dF&) |
+{ |
+ return gfx::Vector2dF(); |
+} |
+ |
+static gfx::Vector2dF computeFixedContainerSizeDeltaForChildren(LayerImpl* layer, const gfx::Vector2dF& currentFixedContainerSizeDelta) |
+{ |
+ if (layer->isContainerForFixedPositionLayers()) |
+ return layer->fixedContainerSizeDelta(); |
+ return currentFixedContainerSizeDelta; |
+} |
+ |
template<typename LayerType> |
static inline void calculateContentsScale(LayerType* layer, float contentsScale, bool animatingTransformToScreen) |
{ |
@@ -544,7 +556,7 @@ static void preCalculateMetaInformation(LayerType* layer) |
// necessary transformations, clipRects, render surfaces, etc. |
template<typename LayerType, typename LayerList, typename RenderSurfaceType> |
static void calculateDrawPropertiesInternal(LayerType* layer, const gfx::Transform& parentMatrix, |
- const gfx::Transform& fullHierarchyMatrix, const gfx::Transform& currentScrollCompensationMatrix, |
+ const gfx::Transform& fullHierarchyMatrix, const gfx::Transform& currentScrollCompensationMatrix, const gfx::Vector2dF& currentFixedContainerSizeDelta, |
const gfx::Rect& clipRectFromAncestor, const gfx::Rect& clipRectFromAncestorInDescendantSpace, bool ancestorClipsSubtree, |
RenderSurfaceType* nearestAncestorThatMovesPixels, LayerList& renderSurfaceLayerList, LayerList& layerList, |
LayerSorter* layerSorter, int maxTextureSize, float deviceScaleFactor, float pageScaleFactor, bool subtreeCanUseLCDText, |
@@ -700,6 +712,12 @@ static void calculateDrawPropertiesInternal(LayerType* layer, const gfx::Transfo |
// fixed correctly. |
// Note carefully: this is Concat, not Preconcat (currentScrollCompensation * combinedTransform). |
combinedTransform.ConcatTransform(currentScrollCompensationMatrix); |
+ |
+ gfx::Transform bottomRightAnchorCompensation; |
+ bottomRightAnchorCompensation.Translate( |
+ layer->fixedToRightEdge() ? currentFixedContainerSizeDelta.x() : 0, |
+ layer->fixedToBottomEdge() ? currentFixedContainerSizeDelta.y() : 0); |
+ combinedTransform.PreconcatTransform(bottomRightAnchorCompensation); |
shawnsingh
2013/03/07 09:57:06
Chances are, once we do this correctly, that this
|
} |
// The drawTransform that gets computed below is effectively the layer's drawTransform, unless |
@@ -883,12 +901,13 @@ static void calculateDrawPropertiesInternal(LayerType* layer, const gfx::Transfo |
descendants.push_back(layer); |
gfx::Transform nextScrollCompensationMatrix = computeScrollCompensationMatrixForChildren(layer, parentMatrix, currentScrollCompensationMatrix);; |
+ gfx::Vector2dF nextFixedContainerSizeDelta = computeFixedContainerSizeDeltaForChildren(layer, currentFixedContainerSizeDelta); |
gfx::Rect accumulatedDrawableContentRectOfChildren; |
for (size_t i = 0; i < layer->children().size(); ++i) { |
LayerType* child = LayerTreeHostCommon::getChildAsRawPtr(layer->children(), i); |
gfx::Rect drawableContentRectOfChildSubtree; |
- calculateDrawPropertiesInternal<LayerType, LayerList, RenderSurfaceType>(child, sublayerMatrix, nextHierarchyMatrix, nextScrollCompensationMatrix, |
+ calculateDrawPropertiesInternal<LayerType, LayerList, RenderSurfaceType>(child, sublayerMatrix, nextHierarchyMatrix, nextScrollCompensationMatrix, nextFixedContainerSizeDelta, |
clipRectForSubtree, clipRectForSubtreeInDescendantSpace, subtreeShouldBeClipped, nearestAncestorThatMovesPixels, |
renderSurfaceLayerList, descendants, layerSorter, maxTextureSize, deviceScaleFactor, pageScaleFactor, |
subtreeCanUseLCDText, drawableContentRectOfChildSubtree, updateTilePriorities); |
@@ -1031,7 +1050,7 @@ void LayerTreeHostCommon::calculateDrawProperties(Layer* rootLayer, const gfx::S |
preCalculateMetaInformation<Layer>(rootLayer); |
calculateDrawPropertiesInternal<Layer, std::vector<scoped_refptr<Layer> >, RenderSurface>( |
- rootLayer, deviceScaleTransform, identityMatrix, identityMatrix, |
+ rootLayer, deviceScaleTransform, identityMatrix, identityMatrix, gfx::Vector2dF(), |
deviceViewportRect, deviceViewportRect, subtreeShouldBeClipped, 0, renderSurfaceLayerList, |
dummyLayerList, 0, maxTextureSize, |
deviceScaleFactor, pageScaleFactor, canUseLCDText, totalDrawableContentRect, |
@@ -1061,7 +1080,7 @@ void LayerTreeHostCommon::calculateDrawProperties(LayerImpl* rootLayer, const gf |
preCalculateMetaInformation<LayerImpl>(rootLayer); |
calculateDrawPropertiesInternal<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl>( |
- rootLayer, deviceScaleTransform, identityMatrix, identityMatrix, |
+ rootLayer, deviceScaleTransform, identityMatrix, identityMatrix, gfx::Vector2dF(), |
deviceViewportRect, deviceViewportRect, subtreeShouldBeClipped, 0, renderSurfaceLayerList, |
dummyLayerList, &layerSorter, maxTextureSize, |
deviceScaleFactor, pageScaleFactor, canUseLCDText, totalDrawableContentRect, |