| Index: cc/CCLayerTreeHostCommonTest.cpp
|
| diff --git a/cc/CCLayerTreeHostCommonTest.cpp b/cc/CCLayerTreeHostCommonTest.cpp
|
| index b0699d509696c9cac2177c5d8026041c9dee8ca1..2634bd63a8b3747114beb52c0a5a1e228bb2f5e0 100644
|
| --- a/cc/CCLayerTreeHostCommonTest.cpp
|
| +++ b/cc/CCLayerTreeHostCommonTest.cpp
|
| @@ -59,7 +59,7 @@ void executeCalculateDrawTransformsAndVisibility(LayerChromium* rootLayer)
|
|
|
| // We are probably not testing what is intended if the rootLayer bounds are empty.
|
| ASSERT(!rootLayer->bounds().isEmpty());
|
| - CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, rootLayer->bounds(), 1, dummyMaxTextureSize, dummyRenderSurfaceLayerList);
|
| + CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, rootLayer->bounds(), 1, 1, dummyMaxTextureSize, dummyRenderSurfaceLayerList);
|
| CCLayerTreeHostCommon::calculateVisibleRects(dummyRenderSurfaceLayerList);
|
| }
|
|
|
| @@ -73,7 +73,7 @@ void executeCalculateDrawTransformsAndVisibility(CCLayerImpl* rootLayer)
|
|
|
| // We are probably not testing what is intended if the rootLayer bounds are empty.
|
| ASSERT(!rootLayer->bounds().isEmpty());
|
| - CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, rootLayer->bounds(), 1, 0, dummyMaxTextureSize, dummyRenderSurfaceLayerList);
|
| + CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, rootLayer->bounds(), 1, 1, 0, dummyMaxTextureSize, dummyRenderSurfaceLayerList);
|
| CCLayerTreeHostCommon::calculateVisibleRects(dummyRenderSurfaceLayerList);
|
| }
|
|
|
| @@ -638,7 +638,7 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForRenderSurfaceWithClipp
|
|
|
| Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
|
| int dummyMaxTextureSize = 512;
|
| - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList);
|
| + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
|
| CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
|
|
|
| // The child layer's content is entirely outside the parent's clip rect, so the intermediate
|
| @@ -666,7 +666,7 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild)
|
|
|
| Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
|
| int dummyMaxTextureSize = 512;
|
| - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList);
|
| + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
|
| CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
|
|
|
| // Since the layer is transparent, renderSurface1->renderSurface() should not have gotten added anywhere.
|
| @@ -699,7 +699,7 @@ TEST(CCLayerTreeHostCommonTest, verifyForceRenderSurface)
|
|
|
| Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
|
| int dummyMaxTextureSize = 512;
|
| - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList);
|
| + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
|
|
|
| // The root layer always creates a renderSurface
|
| EXPECT_TRUE(parent->renderSurface());
|
| @@ -708,7 +708,7 @@ TEST(CCLayerTreeHostCommonTest, verifyForceRenderSurface)
|
|
|
| renderSurfaceLayerList.clear();
|
| renderSurface1->setForceRenderSurface(false);
|
| - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList);
|
| + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
|
| EXPECT_TRUE(parent->renderSurface());
|
| EXPECT_FALSE(renderSurface1->renderSurface());
|
| EXPECT_EQ(1U, renderSurfaceLayerList.size());
|
| @@ -1322,7 +1322,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces)
|
|
|
| Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
|
| int dummyMaxTextureSize = 512;
|
| - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList);
|
| + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
|
| CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
|
|
|
|
|
| @@ -1369,7 +1369,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent)
|
|
|
| Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
|
| int dummyMaxTextureSize = 512;
|
| - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList);
|
| + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
|
|
|
| // Without an animation, we should cull child and grandChild from the renderSurfaceLayerList.
|
| ASSERT_EQ(1U, renderSurfaceLayerList.size());
|
| @@ -1383,7 +1383,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent)
|
| grandChild->clearRenderSurface();
|
| renderSurfaceLayerList.clear();
|
|
|
| - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList);
|
| + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
|
|
|
| // With an animating transform, we should keep child and grandChild in the renderSurfaceLayerList.
|
| ASSERT_EQ(3U, renderSurfaceLayerList.size());
|
| @@ -1435,7 +1435,7 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableContentRectForLayers)
|
|
|
| Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
|
| int dummyMaxTextureSize = 512;
|
| - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList);
|
| + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
|
| CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
|
|
|
| EXPECT_RECT_EQ(IntRect(IntPoint(5, 5), IntSize(10, 10)), grandChild1->drawableContentRect());
|
| @@ -1501,7 +1501,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces)
|
|
|
| Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
|
| int dummyMaxTextureSize = 512;
|
| - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList);
|
| + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
|
| CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
|
|
|
| ASSERT_TRUE(grandChild1->renderSurface());
|
| @@ -2279,7 +2279,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithoutPreserves3d)
|
|
|
| Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
|
| int dummyMaxTextureSize = 512;
|
| - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList);
|
| + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
|
|
|
| // Verify which renderSurfaces were created.
|
| EXPECT_FALSE(frontFacingChild->renderSurface());
|
| @@ -2378,7 +2378,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3d)
|
|
|
| Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
|
| int dummyMaxTextureSize = 512;
|
| - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList);
|
| + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
|
|
|
| // Verify which renderSurfaces were created.
|
| EXPECT_FALSE(frontFacingChild->renderSurface());
|
| @@ -2458,7 +2458,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms)
|
|
|
| Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
|
| int dummyMaxTextureSize = 512;
|
| - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList);
|
| + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
|
| CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
|
|
|
| EXPECT_FALSE(child->renderSurface());
|
| @@ -2525,7 +2525,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlattenin
|
|
|
| Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
|
| int dummyMaxTextureSize = 512;
|
| - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList);
|
| + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
|
|
|
| // Verify which renderSurfaces were created.
|
| EXPECT_TRUE(frontFacingSurface->renderSurface());
|
| @@ -2579,7 +2579,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayer)
|
|
|
| Vector<CCLayerImpl*> renderSurfaceLayerList;
|
| int dummyMaxTextureSize = 512;
|
| - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
|
| + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
|
| CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
|
|
|
| // Sanity check the scenario we just created.
|
| @@ -2629,7 +2629,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForUninvertibleTransform)
|
|
|
| Vector<CCLayerImpl*> renderSurfaceLayerList;
|
| int dummyMaxTextureSize = 512;
|
| - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
|
| + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
|
| CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
|
|
|
| // Sanity check the scenario we just created.
|
| @@ -2684,7 +2684,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePositionedLayer)
|
|
|
| Vector<CCLayerImpl*> renderSurfaceLayerList;
|
| int dummyMaxTextureSize = 512;
|
| - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
|
| + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
|
| CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
|
|
|
| // Sanity check the scenario we just created.
|
| @@ -2732,7 +2732,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleRotatedLayer)
|
|
|
| Vector<CCLayerImpl*> renderSurfaceLayerList;
|
| int dummyMaxTextureSize = 512;
|
| - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
|
| + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
|
| CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
|
|
|
| // Sanity check the scenario we just created.
|
| @@ -2789,7 +2789,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer)
|
|
|
| Vector<CCLayerImpl*> renderSurfaceLayerList;
|
| int dummyMaxTextureSize = 512;
|
| - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
|
| + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
|
| CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
|
|
|
| // Sanity check the scenario we just created.
|
| @@ -2854,7 +2854,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents
|
|
|
| Vector<CCLayerImpl*> renderSurfaceLayerList;
|
| int dummyMaxTextureSize = 512;
|
| - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
|
| + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
|
| CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
|
|
|
| // Sanity check the scenario we just created.
|
| @@ -2919,7 +2919,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSimpleClippedLayer)
|
|
|
| Vector<CCLayerImpl*> renderSurfaceLayerList;
|
| int dummyMaxTextureSize = 512;
|
| - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
|
| + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
|
| CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
|
|
|
| // Sanity check the scenario we just created.
|
| @@ -3010,7 +3010,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer)
|
|
|
| Vector<CCLayerImpl*> renderSurfaceLayerList;
|
| int dummyMaxTextureSize = 512;
|
| - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
|
| + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
|
| CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
|
|
|
| // Sanity check the scenario we just created.
|
| @@ -3093,7 +3093,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer)
|
|
|
| Vector<CCLayerImpl*> renderSurfaceLayerList;
|
| int dummyMaxTextureSize = 512;
|
| - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
|
| + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
|
| CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
|
|
|
| // Sanity check the scenario we just created.
|
| @@ -3174,7 +3174,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayers)
|
|
|
| Vector<CCLayerImpl*> renderSurfaceLayerList;
|
| int dummyMaxTextureSize = 512;
|
| - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
|
| + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
|
| CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
|
|
|
| // Sanity check the scenario we just created.
|
| @@ -3283,7 +3283,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists)
|
|
|
| Vector<CCLayerImpl*> renderSurfaceLayerList;
|
| int dummyMaxTextureSize = 512;
|
| - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
|
| + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
|
| CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
|
|
|
| // Sanity check the scenario we just created.
|
| @@ -3354,6 +3354,25 @@ PassRefPtr<ContentLayerChromium> createDrawableContentLayerChromium(ContentLayer
|
| return toReturn.release();
|
| }
|
|
|
| +class NoScaleContentLayerChromium : public ContentLayerChromium
|
| +{
|
| +public:
|
| + static PassRefPtr<NoScaleContentLayerChromium> create(ContentLayerChromiumClient* client) { return adoptRef(new NoScaleContentLayerChromium(client)); }
|
| + virtual ~NoScaleContentLayerChromium() { }
|
| +
|
| + virtual bool needsContentsScale() const OVERRIDE { return false; }
|
| +
|
| +protected:
|
| + explicit NoScaleContentLayerChromium(ContentLayerChromiumClient* client) : ContentLayerChromium(client) { }
|
| +};
|
| +
|
| +PassRefPtr<NoScaleContentLayerChromium> createNoScaleDrawableContentLayerChromium(ContentLayerChromiumClient* delegate)
|
| +{
|
| + RefPtr<NoScaleContentLayerChromium> toReturn = NoScaleContentLayerChromium::create(delegate);
|
| + toReturn->setIsDrawable(true);
|
| + return toReturn.release();
|
| +}
|
| +
|
| TEST(CCLayerTreeHostCommonTest, verifyLayerTransformsInHighDPI)
|
| {
|
| // Verify draw and screen space transforms of layers not in a surface.
|
| @@ -3366,7 +3385,7 @@ TEST(CCLayerTreeHostCommonTest, verifyLayerTransformsInHighDPI)
|
| RefPtr<ContentLayerChromium> child = createDrawableContentLayerChromium(&delegate);
|
| setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true);
|
|
|
| - RefPtr<ContentLayerChromium> childNoScale = createDrawableContentLayerChromium(&delegate);
|
| + RefPtr<NoScaleContentLayerChromium> childNoScale = createNoScaleDrawableContentLayerChromium(&delegate);
|
| setLayerPropertiesForTesting(childNoScale.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true);
|
|
|
| parent->addChild(child);
|
| @@ -3376,11 +3395,13 @@ TEST(CCLayerTreeHostCommonTest, verifyLayerTransformsInHighDPI)
|
| int dummyMaxTextureSize = 512;
|
|
|
| const double deviceScaleFactor = 2.5;
|
| - parent->setContentsScale(deviceScaleFactor);
|
| - child->setContentsScale(deviceScaleFactor);
|
| - EXPECT_EQ(childNoScale->contentsScale(), 1);
|
| + const double pageScaleFactor = 1;
|
|
|
| - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), deviceScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList);
|
| + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList);
|
| +
|
| + EXPECT_EQ(deviceScaleFactor * pageScaleFactor, parent->contentsScale());
|
| + EXPECT_EQ(deviceScaleFactor * pageScaleFactor, child->contentsScale());
|
| + EXPECT_EQ(1, childNoScale->contentsScale());
|
|
|
| EXPECT_EQ(1u, renderSurfaceLayerList.size());
|
|
|
| @@ -3427,6 +3448,39 @@ TEST(CCLayerTreeHostCommonTest, verifyLayerTransformsInHighDPI)
|
| EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildNoScaleTransform, childNoScale->screenSpaceTransform());
|
| }
|
|
|
| +TEST(CCLayerTreeHostCommonTest, verifyContentsScale)
|
| +{
|
| + MockContentLayerChromiumClient delegate;
|
| + WebTransformationMatrix identityMatrix;
|
| +
|
| + RefPtr<ContentLayerChromium> parent = createDrawableContentLayerChromium(&delegate);
|
| + setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
|
| +
|
| + RefPtr<ContentLayerChromium> child = createDrawableContentLayerChromium(&delegate);
|
| + setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true);
|
| +
|
| + RefPtr<NoScaleContentLayerChromium> childNoScale = createNoScaleDrawableContentLayerChromium(&delegate);
|
| + setLayerPropertiesForTesting(childNoScale.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true);
|
| +
|
| + // Page scale should not apply to the parent.
|
| + parent->setBoundsContainPageScale(true);
|
| +
|
| + parent->addChild(child);
|
| + parent->addChild(childNoScale);
|
| +
|
| + Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
|
| + int dummyMaxTextureSize = 512;
|
| +
|
| + const double deviceScaleFactor = 2.5;
|
| + const double pageScaleFactor = 1.5;
|
| +
|
| + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList);
|
| +
|
| + EXPECT_EQ(deviceScaleFactor, parent->contentsScale());
|
| + EXPECT_EQ(deviceScaleFactor * pageScaleFactor, child->contentsScale());
|
| + EXPECT_EQ(1, childNoScale->contentsScale());
|
| +}
|
| +
|
| TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI)
|
| {
|
| MockContentLayerChromiumClient delegate;
|
| @@ -3461,7 +3515,7 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI)
|
| duplicateChildNonOwner->setContentsScale(deviceScaleFactor);
|
| replica->setContentsScale(deviceScaleFactor);
|
|
|
| - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), deviceScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList);
|
| + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), deviceScaleFactor, 1, dummyMaxTextureSize, renderSurfaceLayerList);
|
|
|
| // We should have two render surfaces. The root's render surface and child's
|
| // render surface (it needs one because it has a replica layer).
|
|
|