Changeset 118117 in webkit
- Timestamp:
- May 22, 2012 9:24:42 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 1 deleted
- 6 edited
- 2 copied
- 5 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r118116 r118117 1 2012-05-21 Shawn Singh <shawnsingh@chromium.org> 2 3 Improve W3C conformance of backface-visibility 4 https://bugs.webkit.org/show_bug.cgi?id=84195 5 6 Reviewed by Adrienne Walker. 7 8 * compositing/backface-visibility-hierarchical-transform-expected.png: Removed. 9 * compositing/backface-visibility/backface-visibility-3d-expected.png: Added. 10 * compositing/backface-visibility/backface-visibility-3d-expected.txt: Copied from LayoutTests/compositing/backface-visibility-expected.txt. 11 * compositing/backface-visibility/backface-visibility-3d.html: Added. 12 * compositing/backface-visibility/backface-visibility-hierarchical-transform-expected.png: Added. 13 * compositing/backface-visibility/backface-visibility-hierarchical-transform-expected.txt: Renamed from LayoutTests/compositing/backface-visibility-hierarchical-transform-expected.txt. 14 * compositing/backface-visibility/backface-visibility-hierarchical-transform.html: Renamed from LayoutTests/compositing/backface-visibility-hierarchical-transform.html. 15 * compositing/backface-visibility/backface-visibility-non3d-expected.png: Added. 16 * compositing/backface-visibility/backface-visibility-non3d-expected.txt: Copied from LayoutTests/compositing/backface-visibility-expected.txt. 17 * compositing/backface-visibility/backface-visibility-non3d.html: Added. 18 * compositing/backface-visibility/backface-visibility-simple-expected.png: Renamed from LayoutTests/compositing/backface-visibility-expected.png. 19 * compositing/backface-visibility/backface-visibility-simple-expected.txt: Renamed from LayoutTests/compositing/backface-visibility-expected.txt. 20 * compositing/backface-visibility/backface-visibility-simple.html: Renamed from LayoutTests/compositing/backface-visibility.html. 21 * platform/mac/test_expectations.txt: 22 1 23 2012-05-22 Sheriff Bot <webkit.review.bot@gmail.com> 2 24 -
trunk/LayoutTests/compositing/backface-visibility/backface-visibility-hierarchical-transform.html
- Property svn:executable deleted
r118116 r118117 28 28 } 29 29 30 .test3location { 31 position: absolute; 32 top: 230px; 33 left: 10px; 34 } 35 30 36 .preserves3d { 31 37 -webkit-transform-style: preserve-3d; 32 38 } 33 39 34 .firstRenderSurface { 35 -webkit-transform: rotateY(180deg); 40 .flat { 36 41 -webkit-transform-style: flat; 37 42 } 38 43 39 .secondRenderSurface { 40 -webkit-transform: rotateY(0deg); 41 -webkit-transform-style: flat; 44 .rotated180 { 45 -webkit-transform: rotateY(180deg); 42 46 } 43 47 … … 53 57 <body> 54 58 55 <!-- In the pixel results, two green squares should be visible. --> 56 <!-- This tests whether backface culling is accounting for the hierarchy of transforms --> 59 <!-- In the pixel results, two green squares should be visible. This tests whether 60 backface culling is accounting for the hierarchy of transforms. 61 http://dev.w3.org/csswg/css3-transforms/#backface-visibility-property 62 --> 57 63 64 65 <!-- Case 1: the inner-most div remains 3d, and inherits a 180-degree rotation from 66 higher up the hierarchy. The inner-most div should remain visible. 67 --> 58 68 <div class="test1location red"> 59 69 </div> 60 70 <div class="test1location"> 61 71 <div class="preserves3d"> 62 <div class=" firstRenderSurface">72 <div class="preserves3d rotated180"> 63 73 <div class="preserves3d"> 64 <div class="secondRenderSurface"> 65 <div class="preserves3d backfaceVisible green"> 66 </div> 74 <div class="backfaceVisible green"> 67 75 </div> 68 76 </div> … … 71 79 </div> 72 80 81 82 <!-- Case 2: same as Case 1, except now the inner-most div has backface-visibility: hidden. --> 73 83 <div class="test2location green"> 74 84 </div> 75 85 <div class="test2location"> 76 86 <div class="preserves3d"> 77 <div class=" firstRenderSurface">87 <div class="preserves3d rotated180"> 78 88 <div class="preserves3d"> 79 <div class="secondRenderSurface"> 80 <div class="preserves3d backfaceHidden red"> 89 <div class="backfaceHidden red"> 90 </div> 91 </div> 92 </div> 93 </div> 94 </div> 95 96 97 <!-- Case 3: the inner-most div flattens to its container div, with its front face 98 showing. Then higher in the hierarchy, that flattened container gets rotated so its 99 back face is showing. However, because it was already flattened, the inner-most div 100 should also remain visible, because the flattened layer is implicitly backface visible. --> 101 <div class="test3location red"> 102 </div> 103 <div class="test3location"> 104 <div class="preserves3d"> 105 <div class="flat rotated180"> 106 <div class="preserves3d"> 107 <div class="flat"> 108 <div class="backfaceHidden green"> 81 109 </div> 82 110 </div> -
trunk/LayoutTests/compositing/backface-visibility/backface-visibility-simple.html
r118116 r118117 14 14 width: 100px; 15 15 } 16 16 17 17 .backfaceVisible { 18 18 -webkit-transform: rotateY(180deg); -
trunk/LayoutTests/platform/mac/test_expectations.txt
r117639 r118117 240 240 // Requires rebaseline after https://bugs.webkit.org/show_bug.cgi?id=85405 241 241 BUGWK85405 : tables/mozilla/bugs/bug10296-1.html = TEXT 242 243 // Safari needs to be fixed after bug 84195 updated the layout tests 244 BUGWK85918 : compositing/backface-visibility/backface-visibility-3d.html = IMAGE 245 BUGWK85918 : compositing/backface-visibility/backface-visibility-hierarchical-transform.html = IMAGE 246 BUGWK85918 : compositing/backface-visibility/backface-visibility-non3d.html = IMAGE -
trunk/Source/WebCore/ChangeLog
r118116 r118117 1 2012-05-21 Shawn Singh <shawnsingh@chromium.org> 2 3 Improve W3C conformance of backface-visibility 4 https://bugs.webkit.org/show_bug.cgi?id=84195 5 6 Reviewed by Adrienne Walker. 7 8 Tests: compositing/backface-visibility/backface-visibility-3d.html 9 compositing/backface-visibility/backface-visibility-hierarchical-transform.html 10 compositing/backface-visibility/backface-visibility-non3d.html 11 compositing/backface-visibility/backface-visibility-simple.html 12 13 Unit Tests: CCLayerTreeHostCommonTest::verifyBackFaceCullingWithoutPreserves3d 14 CCLayerTreeHostCommonTest::verifyBackFaceCullingWithPreserves3d 15 16 Also updated a few other layout and unit tests. 17 18 This patch updates chromium to conform to the W3C spec on CSS 19 transforms, Section 12 about backface visibility. This patch also 20 updates layout tests to reflect the latest W3C spec. In 21 particular, rule #1 on section 12, http://dev.w3.org/csswg/css3-transforms/#backface-visibility-property 22 states which transforms should be used to determine backface-visibility. 23 24 Because chromium has an additional quirk of the concept of render 25 surfaces, unit tests needed to be updated as well. 26 27 * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp: 28 (WebCore::layerIsRootOfNewRenderingContext): 29 (WebCore): 30 (WebCore::isLayerBackFaceVisible): 31 (WebCore::isSurfaceBackFaceVisible): 32 (WebCore::calculateVisibleLayerRect): 33 (WebCore::layerShouldBeSkipped): 34 (WebCore::calculateDrawTransformsAndVisibilityInternal): 35 1 36 2012-05-22 Sheriff Bot <webkit.review.bot@gmail.com> 2 37 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp
r118104 r118117 75 75 76 76 template<typename LayerType> 77 static bool layerIsRootOfNewRenderingContext(LayerType* layer) 78 { 79 // According to current W3C spec on CSS transforms (Section 6.1), a layer is the 80 // beginning of 3d rendering context if its parent does not have transform-style: 81 // preserve-3d, but this layer itself does. 82 if (layer->parent()) 83 return !layer->parent()->preserves3D() && layer->preserves3D(); 84 85 return layer->preserves3D(); 86 } 87 88 template<typename LayerType> 89 static bool isLayerBackFaceVisible(LayerType* layer) 90 { 91 // The current W3C spec on CSS transforms says that backface visibility should be 92 // determined differently depending on whether the layer is in a "3d rendering 93 // context" or not. For Chromium code, we can determine whether we are in a 3d 94 // rendering context by checking if the parent preserves 3d. 95 96 if (layerIsInExisting3DRenderingContext(layer)) 97 return layer->drawTransform().isBackFaceVisible(); 98 99 // In this case, either the layer establishes a new 3d rendering context, or is not in 100 // a 3d rendering context at all. 101 return layer->transform().isBackFaceVisible(); 102 } 103 104 template<typename LayerType> 105 static bool isSurfaceBackFaceVisible(LayerType* layer, const TransformationMatrix& drawTransform) 106 { 107 if (layerIsInExisting3DRenderingContext(layer)) 108 return drawTransform.isBackFaceVisible(); 109 110 if (layerIsRootOfNewRenderingContext(layer)) 111 return layer->transform().isBackFaceVisible(); 112 113 // If the renderSurface is not part of a new or existing rendering context, then the 114 // layers that contribute to this surface will decide back-face visibility for themselves. 115 return false; 116 } 117 118 template<typename LayerType> 77 119 static IntRect calculateVisibleLayerRect(LayerType* layer) 78 120 { … … 164 206 165 207 // The layer should not be drawn if (1) it is not double-sided and (2) the back of the layer is known to be facing the screen. 166 if (!layer->doubleSided() && transformToScreenIsKnown(layer) && layer->screenSpaceTransform().isBackFaceVisible())208 if (!layer->doubleSided() && transformToScreenIsKnown(layer) && isLayerBackFaceVisible(layer)) 167 209 return true; 168 210 … … 386 428 387 429 if (subtreeShouldRenderToSeparateSurface(layer, isScaleOrTranslation(combinedTransform))) { 388 389 // We need to check back-face visibility before continuing with this surface. 390 // We cannot early exit here, however, if the transform is animating and not known on the main thread. 391 // FIXME: Also compute back-face visibility for surfaces that are not in existing 3D rendering context, using 392 // the layer's local transform. https://bugs.webkit.org/show_bug.cgi?id=84195 393 if (layerIsInExisting3DRenderingContext(layer) && transformToParentIsKnown(layer) && !layer->doubleSided() && combinedTransform.isBackFaceVisible()) 430 // Check back-face visibility before continuing with this surface and its subtree 431 if (!layer->doubleSided() && transformToParentIsKnown(layer) && isSurfaceBackFaceVisible(layer, combinedTransform)) 394 432 return false; 395 433 -
trunk/Source/WebKit/chromium/ChangeLog
r118116 r118117 1 2012-05-21 Shawn Singh <shawnsingh@chromium.org> 2 3 Improve W3C conformance of backface-visibility 4 https://bugs.webkit.org/show_bug.cgi?id=84195 5 6 Reviewed by Adrienne Walker. 7 8 * tests/CCLayerTreeHostCommonTest.cpp: 9 (WebKitTests::TEST): 10 (WebKitTests): 11 1 12 2012-05-22 Sheriff Bot <webkit.review.bot@gmail.com> 2 13 -
trunk/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp
r118104 r118117 1311 1311 } 1312 1312 1313 TEST(CCLayerTreeHostCommonTest, verifyBackFaceCulling) 1314 { 1315 // Verify that layers are appropriately culled when their back face is showing and they are not double sided. 1313 TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithoutPreserves3d) 1314 { 1315 // Verify the behavior of back-face culling when there are no preserve-3d layers. Note 1316 // that 3d transforms still apply in this case, but they are "flattened" to each 1317 // parent layer according to current W3C spec. 1318 1319 const TransformationMatrix identityMatrix; 1320 RefPtr<LayerChromium> parent = LayerChromium::create(); 1321 RefPtr<LayerChromiumWithForcedDrawsContent> frontFacingChild = adoptRef(new LayerChromiumWithForcedDrawsContent()); 1322 RefPtr<LayerChromiumWithForcedDrawsContent> backFacingChild = adoptRef(new LayerChromiumWithForcedDrawsContent()); 1323 RefPtr<LayerChromiumWithForcedDrawsContent> frontFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent()); 1324 RefPtr<LayerChromiumWithForcedDrawsContent> backFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent()); 1325 RefPtr<LayerChromiumWithForcedDrawsContent> frontFacingChildOfFrontFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent()); 1326 RefPtr<LayerChromiumWithForcedDrawsContent> backFacingChildOfFrontFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent()); 1327 RefPtr<LayerChromiumWithForcedDrawsContent> frontFacingChildOfBackFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent()); 1328 RefPtr<LayerChromiumWithForcedDrawsContent> backFacingChildOfBackFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent()); 1329 1330 parent->createRenderSurface(); 1331 parent->addChild(frontFacingChild); 1332 parent->addChild(backFacingChild); 1333 parent->addChild(frontFacingSurface); 1334 parent->addChild(backFacingSurface); 1335 frontFacingSurface->addChild(frontFacingChildOfFrontFacingSurface); 1336 frontFacingSurface->addChild(backFacingChildOfFrontFacingSurface); 1337 backFacingSurface->addChild(frontFacingChildOfBackFacingSurface); 1338 backFacingSurface->addChild(backFacingChildOfBackFacingSurface); 1339 1340 // Nothing is double-sided 1341 frontFacingChild->setDoubleSided(false); 1342 backFacingChild->setDoubleSided(false); 1343 frontFacingSurface->setDoubleSided(false); 1344 backFacingSurface->setDoubleSided(false); 1345 frontFacingChildOfFrontFacingSurface->setDoubleSided(false); 1346 backFacingChildOfFrontFacingSurface->setDoubleSided(false); 1347 frontFacingChildOfBackFacingSurface->setDoubleSided(false); 1348 backFacingChildOfBackFacingSurface->setDoubleSided(false); 1349 1350 TransformationMatrix backfaceMatrix; 1351 backfaceMatrix.translate(50, 50); 1352 backfaceMatrix.rotate3d(0, 1, 0, 180); 1353 backfaceMatrix.translate(-50, -50); 1354 1355 // Having a descendant and opacity will force these to have render surfaces. 1356 frontFacingSurface->setOpacity(0.5f); 1357 backFacingSurface->setOpacity(0.5f); 1358 1359 // Nothing preserves 3d. According to current W3C CSS Transforms spec, these layers 1360 // should blindly use their own local transforms to determine back-face culling. 1361 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); 1362 setLayerPropertiesForTesting(frontFacingChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); 1363 setLayerPropertiesForTesting(backFacingChild.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); 1364 setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); 1365 setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); 1366 setLayerPropertiesForTesting(frontFacingChildOfFrontFacingSurface.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); 1367 setLayerPropertiesForTesting(backFacingChildOfFrontFacingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); 1368 setLayerPropertiesForTesting(frontFacingChildOfBackFacingSurface.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); 1369 setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); 1370 1371 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; 1372 Vector<RefPtr<LayerChromium> > dummyLayerList; 1373 int dummyMaxTextureSize = 512; 1374 parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); 1375 parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); 1376 renderSurfaceLayerList.append(parent.get()); 1377 1378 CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); 1379 1380 // Verify which renderSurfaces were created. 1381 EXPECT_FALSE(frontFacingChild->renderSurface()); 1382 EXPECT_FALSE(backFacingChild->renderSurface()); 1383 EXPECT_TRUE(frontFacingSurface->renderSurface()); 1384 EXPECT_TRUE(backFacingSurface->renderSurface()); 1385 EXPECT_FALSE(frontFacingChildOfFrontFacingSurface->renderSurface()); 1386 EXPECT_FALSE(backFacingChildOfFrontFacingSurface->renderSurface()); 1387 EXPECT_FALSE(frontFacingChildOfBackFacingSurface->renderSurface()); 1388 EXPECT_FALSE(backFacingChildOfBackFacingSurface->renderSurface()); 1389 1390 // Verify the renderSurfaceLayerList. 1391 ASSERT_EQ(3u, renderSurfaceLayerList.size()); 1392 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); 1393 EXPECT_EQ(frontFacingSurface->id(), renderSurfaceLayerList[1]->id()); 1394 // Even though the back facing surface LAYER gets culled, the other descendants should still be added, so the SURFACE should not be culled. 1395 EXPECT_EQ(backFacingSurface->id(), renderSurfaceLayerList[2]->id()); 1396 1397 // Verify root surface's layerList. 1398 ASSERT_EQ(3u, renderSurfaceLayerList[0]->renderSurface()->layerList().size()); 1399 EXPECT_EQ(frontFacingChild->id(), renderSurfaceLayerList[0]->renderSurface()->layerList()[0]->id()); 1400 EXPECT_EQ(frontFacingSurface->id(), renderSurfaceLayerList[0]->renderSurface()->layerList()[1]->id()); 1401 EXPECT_EQ(backFacingSurface->id(), renderSurfaceLayerList[0]->renderSurface()->layerList()[2]->id()); 1402 1403 // Verify frontFacingSurface's layerList. 1404 ASSERT_EQ(2u, renderSurfaceLayerList[1]->renderSurface()->layerList().size()); 1405 EXPECT_EQ(frontFacingSurface->id(), renderSurfaceLayerList[1]->renderSurface()->layerList()[0]->id()); 1406 EXPECT_EQ(frontFacingChildOfFrontFacingSurface->id(), renderSurfaceLayerList[1]->renderSurface()->layerList()[1]->id()); 1407 1408 // Verify backFacingSurface's layerList; its own layer should be culled from the surface list. 1409 ASSERT_EQ(1u, renderSurfaceLayerList[2]->renderSurface()->layerList().size()); 1410 EXPECT_EQ(frontFacingChildOfBackFacingSurface->id(), renderSurfaceLayerList[2]->renderSurface()->layerList()[0]->id()); 1411 } 1412 1413 TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3d) 1414 { 1415 // Verify the behavior of back-face culling when preserves-3d transform style is used. 1416 1417 const TransformationMatrix identityMatrix; 1418 RefPtr<LayerChromium> parent = LayerChromium::create(); 1419 RefPtr<LayerChromiumWithForcedDrawsContent> frontFacingChild = adoptRef(new LayerChromiumWithForcedDrawsContent()); 1420 RefPtr<LayerChromiumWithForcedDrawsContent> backFacingChild = adoptRef(new LayerChromiumWithForcedDrawsContent()); 1421 RefPtr<LayerChromiumWithForcedDrawsContent> frontFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent()); 1422 RefPtr<LayerChromiumWithForcedDrawsContent> backFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent()); 1423 RefPtr<LayerChromiumWithForcedDrawsContent> frontFacingChildOfFrontFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent()); 1424 RefPtr<LayerChromiumWithForcedDrawsContent> backFacingChildOfFrontFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent()); 1425 RefPtr<LayerChromiumWithForcedDrawsContent> frontFacingChildOfBackFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent()); 1426 RefPtr<LayerChromiumWithForcedDrawsContent> backFacingChildOfBackFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent()); 1427 RefPtr<LayerChromiumWithForcedDrawsContent> dummyReplicaLayer1 = adoptRef(new LayerChromiumWithForcedDrawsContent()); 1428 RefPtr<LayerChromiumWithForcedDrawsContent> dummyReplicaLayer2 = adoptRef(new LayerChromiumWithForcedDrawsContent()); 1429 1430 parent->createRenderSurface(); 1431 parent->addChild(frontFacingChild); 1432 parent->addChild(backFacingChild); 1433 parent->addChild(frontFacingSurface); 1434 parent->addChild(backFacingSurface); 1435 frontFacingSurface->addChild(frontFacingChildOfFrontFacingSurface); 1436 frontFacingSurface->addChild(backFacingChildOfFrontFacingSurface); 1437 backFacingSurface->addChild(frontFacingChildOfBackFacingSurface); 1438 backFacingSurface->addChild(backFacingChildOfBackFacingSurface); 1439 1440 // Nothing is double-sided 1441 frontFacingChild->setDoubleSided(false); 1442 backFacingChild->setDoubleSided(false); 1443 frontFacingSurface->setDoubleSided(false); 1444 backFacingSurface->setDoubleSided(false); 1445 frontFacingChildOfFrontFacingSurface->setDoubleSided(false); 1446 backFacingChildOfFrontFacingSurface->setDoubleSided(false); 1447 frontFacingChildOfBackFacingSurface->setDoubleSided(false); 1448 backFacingChildOfBackFacingSurface->setDoubleSided(false); 1449 1450 TransformationMatrix backfaceMatrix; 1451 backfaceMatrix.translate(50, 50); 1452 backfaceMatrix.rotate3d(0, 1, 0, 180); 1453 backfaceMatrix.translate(-50, -50); 1454 1455 // Opacity will not force creation of renderSurfaces in this case because of the 1456 // preserve-3d transform style. Instead, an example of when a surface would be 1457 // created with preserve-3d is when there is a replica layer. 1458 frontFacingSurface->setReplicaLayer(dummyReplicaLayer1.get()); 1459 backFacingSurface->setReplicaLayer(dummyReplicaLayer2.get()); 1460 1461 // Each surface creates its own new 3d rendering context (as defined by W3C spec). 1462 // According to current W3C CSS Transforms spec, layers in a 3d rendering context 1463 // should use the transform with respect to that context. This 3d rendering context 1464 // occurs when (a) parent's transform style is flat and (b) the layer's transform 1465 // style is preserve-3d. 1466 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); // parent transform style is flat. 1467 setLayerPropertiesForTesting(frontFacingChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); 1468 setLayerPropertiesForTesting(backFacingChild.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); 1469 setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); // surface transform style is preserve-3d. 1470 setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); // surface transform style is preserve-3d. 1471 setLayerPropertiesForTesting(frontFacingChildOfFrontFacingSurface.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); 1472 setLayerPropertiesForTesting(backFacingChildOfFrontFacingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); 1473 setLayerPropertiesForTesting(frontFacingChildOfBackFacingSurface.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); 1474 setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); 1475 1476 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; 1477 Vector<RefPtr<LayerChromium> > dummyLayerList; 1478 int dummyMaxTextureSize = 512; 1479 parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); 1480 parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); 1481 renderSurfaceLayerList.append(parent.get()); 1482 1483 CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); 1484 1485 // Verify which renderSurfaces were created. 1486 EXPECT_FALSE(frontFacingChild->renderSurface()); 1487 EXPECT_FALSE(backFacingChild->renderSurface()); 1488 EXPECT_TRUE(frontFacingSurface->renderSurface()); 1489 EXPECT_FALSE(backFacingSurface->renderSurface()); 1490 EXPECT_FALSE(frontFacingChildOfFrontFacingSurface->renderSurface()); 1491 EXPECT_FALSE(backFacingChildOfFrontFacingSurface->renderSurface()); 1492 EXPECT_FALSE(frontFacingChildOfBackFacingSurface->renderSurface()); 1493 EXPECT_FALSE(backFacingChildOfBackFacingSurface->renderSurface()); 1494 1495 // Verify the renderSurfaceLayerList. The back-facing surface should be culled. 1496 ASSERT_EQ(2u, renderSurfaceLayerList.size()); 1497 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); 1498 EXPECT_EQ(frontFacingSurface->id(), renderSurfaceLayerList[1]->id()); 1499 1500 // Verify root surface's layerList. 1501 ASSERT_EQ(2u, renderSurfaceLayerList[0]->renderSurface()->layerList().size()); 1502 EXPECT_EQ(frontFacingChild->id(), renderSurfaceLayerList[0]->renderSurface()->layerList()[0]->id()); 1503 EXPECT_EQ(frontFacingSurface->id(), renderSurfaceLayerList[0]->renderSurface()->layerList()[1]->id()); 1504 1505 // Verify frontFacingSurface's layerList. 1506 ASSERT_EQ(2u, renderSurfaceLayerList[1]->renderSurface()->layerList().size()); 1507 EXPECT_EQ(frontFacingSurface->id(), renderSurfaceLayerList[1]->renderSurface()->layerList()[0]->id()); 1508 EXPECT_EQ(frontFacingChildOfFrontFacingSurface->id(), renderSurfaceLayerList[1]->renderSurface()->layerList()[1]->id()); 1509 } 1510 1511 TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms) 1512 { 1513 // Verify that layers are appropriately culled when their back face is showing and 1514 // they are not double sided, while animations are going on. 1316 1515 // 1317 1516 // Layers that are animating do not get culled on the main thread, as their transforms should be … … 1346 1545 backfaceMatrix.translate(-50, -50); 1347 1546 1348 // Having a descend ent, and animating transforms, will make the animatingSurface own a render surface.1547 // Having a descendant, and animating transforms, will make the animatingSurface own a render surface. 1349 1548 addAnimatedTransformToController(*animatingSurface->layerAnimationController(), 10, 30, 0); 1350 1549 // This is just an animating layer, not a surface. 1351 1550 addAnimatedTransformToController(*animatingChild->layerAnimationController(), 10, 30, 0); 1352 1551 1353 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);1552 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); 1354 1553 setLayerPropertiesForTesting(child.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); 1355 1554 setLayerPropertiesForTesting(animatingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); 1356 setLayerPropertiesForTesting(childOfAnimatingSurface.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);1555 setLayerPropertiesForTesting(childOfAnimatingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); 1357 1556 setLayerPropertiesForTesting(animatingChild.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); 1358 1557 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
Note: See TracChangeset
for help on using the changeset viewer.