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

Unified Diff: Source/core/rendering/compositing/CompositedLayerMapping.cpp

Issue 399733002: Make sure we set "should flatten transform" correctly. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove redundant call to updateShouldFlattenTransform Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/platform/linux/virtual/softwarecompositing/update-paint-phases-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f378b826a56838d8ab8d7bcc76337c34bb47b689 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) {
@@ -1280,6 +1268,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());
if (((mode & ApplyToCoreLayers) || (mode & ApplyToContentLayers)) && mapping->scrollingContentsLayer())
f(mapping->scrollingContentsLayer());
if (((mode & ApplyToCoreLayers) || (mode & ApplyToContentLayers)) && mapping->foregroundLayer())
@@ -1345,6 +1335,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)
« no previous file with comments | « LayoutTests/platform/linux/virtual/softwarecompositing/update-paint-phases-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698