Chromium Code Reviews| Index: Source/core/rendering/compositing/CompositedLayerMapping.cpp |
| diff --git a/Source/core/rendering/compositing/CompositedLayerMapping.cpp b/Source/core/rendering/compositing/CompositedLayerMapping.cpp |
| index 6507b1b25cb3aa974c3e452bb08cd770b7864838..ff29959bc8d2e5a4e6ab3c105f4c37a27c0d3836 100644 |
| --- a/Source/core/rendering/compositing/CompositedLayerMapping.cpp |
| +++ b/Source/core/rendering/compositing/CompositedLayerMapping.cpp |
| @@ -1096,20 +1096,9 @@ void CompositedLayerMapping::updateChildrenTransform() |
| if (GraphicsLayer* childTransformLayer = layerForChildrenTransform()) { |
| childTransformLayer->setTransform(owningLayer().perspectiveTransform()); |
| childTransformLayer->setTransformOrigin(FloatPoint3D(childTransformLayer->size().width() * 0.5f, childTransformLayer->size().height() * 0.5f, 0.f)); |
| - bool hasPerspective = false; |
| - if (RenderStyle* style = m_owningLayer.renderer()->style()) |
| - hasPerspective = style->hasPerspective(); |
| - if (hasPerspective) |
| - childTransformLayer->setShouldFlattenTransform(false); |
| - |
| - // Note, if the target is the scrolling layer, we need to ensure that the |
| - // scrolling content layer doesn't flatten the transform. (It would be nice |
| - // if we could apply transform to the scrolling content layer, but that's |
| - // too late, we need the children transform to be applied _before_ the |
| - // scrolling offset.) |
| - if (childTransformLayer == m_scrollingLayer.get()) |
| - m_scrollingContentsLayer->setShouldFlattenTransform(false); |
| } |
| + |
| + updateShouldFlattenTransform(); |
| } |
| // Return true if the layers changed. |
| @@ -1154,7 +1143,6 @@ bool CompositedLayerMapping::updateChildTransformLayer(bool needsChildTransformL |
| if (!m_childTransformLayer) { |
| m_childTransformLayer = createGraphicsLayer(CompositingReasonLayerForPerspective); |
| m_childTransformLayer->setDrawsContent(false); |
| - m_childTransformLayer->setShouldFlattenTransform(false); |
| layersChanged = true; |
| } |
| } else if (m_childTransformLayer) { |
| @@ -1163,6 +1151,7 @@ bool CompositedLayerMapping::updateChildTransformLayer(bool needsChildTransformL |
| layersChanged = true; |
| } |
| + updateShouldFlattenTransform(); |
|
chrishtr
2014/07/17 20:07:32
Is this call needed? Why isn't the other one suffi
Ian Vollick
2014/07/17 20:30:15
Good point! I think you're right that this is redu
|
| return layersChanged; |
| } |
| @@ -1280,6 +1269,8 @@ static void ApplyToGraphicsLayers(const CompositedLayerMapping* mapping, const F |
| f(mapping->clippingLayer()); |
| if ((mode & ApplyToCoreLayers) && mapping->scrollingLayer()) |
| f(mapping->scrollingLayer()); |
| + if ((mode & ApplyToCoreLayers) && mapping->scrollingBlockSelectionLayer()) |
| + f(mapping->scrollingBlockSelectionLayer()); |
|
chrishtr
2014/07/17 20:07:32
Is this an unrelated-ish change?
Ian Vollick
2014/07/17 20:30:15
It isn't, actually. In updateShouldFlattenTransfor
chrishtr
2014/07/17 20:38:40
Great. Thanks for the explanation.
|
| if (((mode & ApplyToCoreLayers) || (mode & ApplyToContentLayers)) && mapping->scrollingContentsLayer()) |
| f(mapping->scrollingContentsLayer()); |
| if (((mode & ApplyToCoreLayers) || (mode & ApplyToContentLayers)) && mapping->foregroundLayer()) |
| @@ -1345,6 +1336,26 @@ void CompositedLayerMapping::updateShouldFlattenTransform() |
| UpdateShouldFlattenTransformFunctor functor = { !m_owningLayer.shouldPreserve3D() }; |
| ApplyToGraphicsLayersMode mode = ApplyToCoreLayers; |
| ApplyToGraphicsLayers(this, functor, mode); |
| + |
| + // Note, if we apply perspective, we have to set should flatten differently |
| + // so that the transform propagates to child layers correctly. |
| + if (GraphicsLayer* childTransformLayer = layerForChildrenTransform()) { |
| + bool hasPerspective = false; |
| + if (RenderStyle* style = m_owningLayer.renderer()->style()) |
| + hasPerspective = style->hasPerspective(); |
| + if (hasPerspective) |
| + childTransformLayer->setShouldFlattenTransform(false); |
| + |
| + // Note, if the target is the scrolling layer, we need to ensure that the |
| + // scrolling content layer doesn't flatten the transform. (It would be nice |
| + // if we could apply transform to the scrolling content layer, but that's |
| + // too late, we need the children transform to be applied _before_ the |
| + // scrolling offset.) |
| + if (childTransformLayer == m_scrollingLayer.get()) { |
| + m_scrollingContentsLayer->setShouldFlattenTransform(false); |
| + m_scrollingBlockSelectionLayer->setShouldFlattenTransform(false); |
| + } |
| + } |
| } |
| bool CompositedLayerMapping::updateForegroundLayer(bool needsForegroundLayer) |