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

Unified Diff: Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp

Issue 10383299: Merge 117645 - [chromium] add back-face visibility check for renderSurfaces (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 years, 7 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 | « no previous file | Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp
===================================================================
--- Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp (revision 118118)
+++ Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp (working copy)
@@ -66,6 +66,14 @@
}
template<typename LayerType>
+static inline bool layerIsInExisting3DRenderingContext(LayerType* layer)
+{
+ // According to current W3C spec on CSS transforms, a layer is part of an established
+ // 3d rendering context if its parent has transform-style of preserves-3d.
+ return layer->parent() && layer->parent()->preserves3D();
+}
+
+template<typename LayerType>
static IntRect calculateVisibleLayerRect(LayerType* layer)
{
ASSERT(layer->targetRenderSurface());
@@ -211,7 +219,7 @@
// If the layer flattens its subtree (i.e. the layer doesn't preserve-3d), but it is
// treated as a 3D object by its parent (i.e. parent does preserve-3d).
- if (layer->parent() && layer->parent()->preserves3D() && !layer->preserves3D() && descendantDrawsContent)
+ if (layerIsInExisting3DRenderingContext(layer) && !layer->preserves3D() && descendantDrawsContent)
return true;
// On the main thread side, animating transforms are unknown, and may cause a RenderSurface on the impl side.
@@ -382,6 +390,14 @@
layer->setUsesLayerClipping(false);
if (subtreeShouldRenderToSeparateSurface(layer, isScaleOrTranslation(combinedTransform))) {
+
+ // We need to check back-face visibility before continuing with this surface.
+ // We cannot early exit here, however, if the transform is animating and not known on the main thread.
+ // FIXME: Also compute back-face visibility for surfaces that are not in existing 3D rendering context, using
+ // the layer's local transform. https://bugs.webkit.org/show_bug.cgi?id=84195
+ if (layerIsInExisting3DRenderingContext(layer) && transformToParentIsKnown(layer) && !layer->doubleSided() && combinedTransform.isBackFaceVisible())
+ return false;
+
if (!layer->renderSurface())
layer->createRenderSurface();
« no previous file with comments | « no previous file | Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698