Changeset 132394 in webkit


Ignore:
Timestamp:
Oct 24, 2012 1:36:02 PM (11 years ago)
Author:
Simon Fraser
Message:

Fix CALayer hiearchy when combining tiling with preserve-3d
https://bugs.webkit.org/show_bug.cgi?id=100205

Reviewed by Dean Jackson.

Source/WebCore:

When an element has "transform-style: preserve-3d", its GraphicsLayerCA has a
m_structuralLayer which is a CATransformLayer. The primary CALayer which contains rendered
content becomes a sublayer of the CATransformLayer. If the element has backface-visibility:hidden,
it is the primary layer that is set to be single-sided.

In r131940 we started to use TileCaches in place of CATiledLayer. TileCaches work via
"customSublayers" returned from the PlatformCALayer, where the custom sublayer is
the tile cache container layer. However, the custom sublayers were being added as
children of the structural (CATransformLayer) layer, not of the primary (CALayer) layer,
thus they were not affected by the doubleSided property.

This change cleans up the confusing code in GraphicsLayerCA::updateSublayerList()
by maintaining two vectors of PlatformCALayers, one for sublayers of the structural
layer, and one for sublayers of the primary layer. It adds custom sublayers to
the latter list, so now the tile cache container layer becomes a sublayer of
the primary layer, so is affected by that layer's doubleSided property.

Test: compositing/tiling/backface-preserve-3d-tiled.html

  • platform/graphics/ca/GraphicsLayerCA.cpp:

(WebCore::GraphicsLayerCA::updateSublayerList):

LayoutTests:

Pixel test that tests backface-visibility on a tile cache layer. Mark the test as
failing on Chromium.

  • compositing/tiling/backface-preserve-3d-tiled-expected.png: Added.
  • compositing/tiling/backface-preserve-3d-tiled-expected.txt: Added.
  • compositing/tiling/backface-preserve-3d-tiled.html: Added.
  • platform/chromium/TestExpectations:
Location:
trunk
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r132388 r132394  
     12012-10-24  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Fix CALayer hiearchy when combining tiling with preserve-3d
     4        https://bugs.webkit.org/show_bug.cgi?id=100205
     5
     6        Reviewed by Dean Jackson.
     7
     8        Pixel test that tests backface-visibility on a tile cache layer. Mark the test as
     9        failing on Chromium.
     10
     11        * compositing/tiling/backface-preserve-3d-tiled-expected.png: Added.
     12        * compositing/tiling/backface-preserve-3d-tiled-expected.txt: Added.
     13        * compositing/tiling/backface-preserve-3d-tiled.html: Added.
     14        * platform/chromium/TestExpectations:
     15
    1162012-10-24  Rick Byers  <rbyers@chromium.org>
    217
  • trunk/LayoutTests/platform/chromium/TestExpectations

    r132378 r132394  
    28192819webkit.org/b/98315 css3/compositing/blend-mode-property.html [ Failure ]
    28202820webkit.org/b/98315 css3/compositing/should-have-compositing-layer.html [ Failure ]
     2821webkit.org/b/100205 compositing/tiling/backface-preserve-3d-tiled.html [ Failure ]
    28212822
    28222823# two regions reftests failing on Chromium
  • trunk/Source/WebCore/ChangeLog

    r132393 r132394  
     12012-10-24  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Fix CALayer hiearchy when combining tiling with preserve-3d
     4        https://bugs.webkit.org/show_bug.cgi?id=100205
     5
     6        Reviewed by Dean Jackson.
     7
     8        When an element has "transform-style: preserve-3d", its GraphicsLayerCA has a
     9        m_structuralLayer which is a CATransformLayer. The primary CALayer which contains rendered
     10        content becomes a sublayer of the CATransformLayer. If the element has backface-visibility:hidden,
     11        it is the primary layer that is set to be single-sided.
     12       
     13        In r131940 we started to use TileCaches in place of CATiledLayer. TileCaches work via
     14        "customSublayers" returned from the PlatformCALayer, where the custom sublayer is
     15        the tile cache container layer. However, the custom sublayers were being added as
     16        children of the structural (CATransformLayer) layer, not of the primary (CALayer) layer,
     17        thus they were not affected by the doubleSided property.
     18       
     19        This change cleans up the confusing code in GraphicsLayerCA::updateSublayerList()
     20        by maintaining two vectors of PlatformCALayers, one for sublayers of the structural
     21        layer, and one for sublayers of the primary layer. It adds custom sublayers to
     22        the latter list, so now the tile cache container layer becomes a sublayer of
     23        the primary layer, so is affected by that layer's doubleSided property.
     24
     25        Test: compositing/tiling/backface-preserve-3d-tiled.html
     26
     27        * platform/graphics/ca/GraphicsLayerCA.cpp:
     28        (WebCore::GraphicsLayerCA::updateSublayerList):
     29
    1302012-10-23  Zhenyao Mo  <zmo@google.com>
    231
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

    r132301 r132394  
    11851185void GraphicsLayerCA::updateSublayerList()
    11861186{
    1187     PlatformCALayerList newSublayers;
     1187    const PlatformCALayerList* customSublayers = m_layer->customSublayers();
     1188
     1189    PlatformCALayerList structuralLayerChildren;
     1190    PlatformCALayerList primaryLayerChildren;
     1191
     1192    PlatformCALayerList& childListForSublayers = m_structuralLayer ? structuralLayerChildren : primaryLayerChildren;
     1193
     1194    if (customSublayers)
     1195        primaryLayerChildren.append(*customSublayers);
     1196
     1197    if (m_structuralLayer) {
     1198        if (m_replicaLayer)
     1199            structuralLayerChildren.append(static_cast<GraphicsLayerCA*>(m_replicaLayer)->primaryLayer());
     1200   
     1201        structuralLayerChildren.append(m_layer);
     1202    }
     1203
     1204    if (m_contentsLayer && m_contentsVisible) {
     1205        // FIXME: add the contents layer in the correct order with negative z-order children.
     1206        // This does not cause visible rendering issues because currently contents layers are only used
     1207        // for replaced elements that don't have children.
     1208        primaryLayerChildren.append(m_contentsLayer);
     1209    }
     1210   
    11881211    const Vector<GraphicsLayer*>& childLayers = children();
    1189 
    1190     if (const PlatformCALayerList* customSublayers = m_layer->customSublayers())
    1191         newSublayers.appendRange(customSublayers->begin(), customSublayers->end());
    1192    
    1193     if (m_structuralLayer || m_contentsLayer || childLayers.size() > 0) {
    1194         if (m_structuralLayer) {
    1195             // Add the replica layer first.
    1196             if (m_replicaLayer)
    1197                 newSublayers.append(static_cast<GraphicsLayerCA*>(m_replicaLayer)->primaryLayer());
    1198             // Add the primary layer. Even if we have negative z-order children, the primary layer always comes behind.
    1199             newSublayers.append(m_layer);
    1200         } else if (m_contentsLayer && m_contentsVisible) {
    1201             // FIXME: add the contents layer in the correct order with negative z-order children.
    1202             // This does not cause visible rendering issues because currently contents layers are only used
    1203             // for replaced elements that don't have children.
    1204             newSublayers.append(m_contentsLayer);
    1205         }
    1206        
    1207         size_t numChildren = childLayers.size();
    1208         for (size_t i = 0; i < numChildren; ++i) {
    1209             GraphicsLayerCA* curChild = static_cast<GraphicsLayerCA*>(childLayers[i]);
    1210             PlatformCALayer* childLayer = curChild->layerForSuperlayer();
    1211             newSublayers.append(childLayer);
    1212         }
    1213 
    1214         for (size_t i = 0; i < newSublayers.size(); --i)
    1215             newSublayers[i]->removeFromSuperlayer();
    1216     }
    1217    
     1212    size_t numChildren = childLayers.size();
     1213    for (size_t i = 0; i < numChildren; ++i) {
     1214        GraphicsLayerCA* curChild = static_cast<GraphicsLayerCA*>(childLayers[i]);
     1215        PlatformCALayer* childLayer = curChild->layerForSuperlayer();
     1216        childListForSublayers.append(childLayer);
     1217    }
     1218
    12181219#ifdef VISIBLE_TILE_WASH
    12191220    if (m_visibleTileWashLayer)
    1220         newSublayers.append(m_visibleTileWashLayer);
     1221        childListForSublayers.append(m_visibleTileWashLayer);
    12211222#endif
    12221223
    1223     if (m_structuralLayer) {
    1224         m_structuralLayer->setSublayers(newSublayers);
    1225 
    1226         if (m_contentsLayer) {
    1227             // If we have a transform layer, then the contents layer is parented in the
    1228             // primary layer (which is itself a child of the transform layer).
    1229             m_layer->removeAllSublayers();
    1230             if (m_contentsVisible)
    1231                 m_layer->appendSublayer(m_contentsLayer.get());
    1232         }
    1233     } else
    1234         m_layer->setSublayers(newSublayers);
     1224    if (m_structuralLayer)
     1225        m_structuralLayer->setSublayers(structuralLayerChildren);
     1226   
     1227    m_layer->setSublayers(primaryLayerChildren);
    12351228}
    12361229
Note: See TracChangeset for help on using the changeset viewer.