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

Unified Diff: cc/layer_tree_host_impl_unittest.cc

Issue 11276060: Pass accurate contentsScale to LayerImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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
Index: cc/layer_tree_host_impl_unittest.cc
diff --git a/cc/layer_tree_host_impl_unittest.cc b/cc/layer_tree_host_impl_unittest.cc
index 106a702ef52ee53cd0125a18cb5000c380ed2d78..8d9677d877114d3a797dfc3cd63a0f74db63215d 100644
--- a/cc/layer_tree_host_impl_unittest.cc
+++ b/cc/layer_tree_host_impl_unittest.cc
@@ -107,7 +107,6 @@ public:
root->setAnchorPoint(FloatPoint(0, 0));
root->setPosition(FloatPoint(0, 0));
root->setBounds(IntSize(10, 10));
- root->setContentBounds(IntSize(10, 10));
root->setVisibleContentRect(IntRect(0, 0, 10, 10));
root->setDrawsContent(true);
myHostImpl->setRootLayer(root.Pass());
@@ -143,14 +142,12 @@ public:
root->setScrollPosition(IntPoint(0, 0));
root->setMaxScrollPosition(contentSize);
root->setBounds(contentSize);
- root->setContentBounds(contentSize);
root->setPosition(FloatPoint(0, 0));
root->setAnchorPoint(FloatPoint(0, 0));
scoped_ptr<LayerImpl> contents = LayerImpl::create(2);
contents->setDrawsContent(true);
contents->setBounds(contentSize);
- contents->setContentBounds(contentSize);
contents->setPosition(FloatPoint(0, 0));
contents->setAnchorPoint(FloatPoint(0, 0));
root->addChild(contents.Pass());
@@ -163,7 +160,6 @@ public:
layer->setScrollable(true);
layer->setDrawsContent(true);
layer->setBounds(size);
- layer->setContentBounds(size);
layer->setMaxScrollPosition(IntSize(size.width() * 2, size.height() * 2));
return layer.Pass();
}
@@ -824,7 +820,6 @@ protected:
{
setAnchorPoint(FloatPoint(0, 0));
setBounds(IntSize(10, 10));
- setContentBounds(IntSize(10, 10));
setDrawsContent(true);
setSkipsDraw(false);
setVisibleContentRect(IntRect(0, 0, 10, 10));
@@ -852,7 +847,6 @@ TEST_P(LayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer)
// Ensure visibleContentRect for layer is empty
layer->setPosition(FloatPoint(100, 100));
layer->setBounds(IntSize(10, 10));
- layer->setContentBounds(IntSize(10, 10));
LayerTreeHostImpl::FrameData frame;
@@ -899,7 +893,6 @@ TEST_P(LayerTreeHostImplTest, willDrawNotCalledOnOccludedLayer)
DidDrawCheckLayer* topLayer = static_cast<DidDrawCheckLayer*>(root->children()[1]);
// This layer covers the occludedLayer above. Make this layer large so it can occlude.
topLayer->setBounds(bigSize);
- topLayer->setContentBounds(bigSize);
topLayer->setContentsOpaque(true);
LayerTreeHostImpl::FrameData frame;
@@ -1040,13 +1033,12 @@ TEST_P(LayerTreeHostImplTest, scrollNonCompositedRoot)
contentLayer->setPosition(FloatPoint(0, 0));
contentLayer->setAnchorPoint(FloatPoint(0, 0));
contentLayer->setBounds(surfaceSize);
- contentLayer->setContentBounds(IntSize(surfaceSize.width() * 2, surfaceSize.height() * 2));
+ contentLayer->setContentsScale(2, 2);
scoped_ptr<LayerImpl> scrollLayer = LayerImpl::create(2);
scrollLayer->setScrollable(true);
scrollLayer->setMaxScrollPosition(surfaceSize);
scrollLayer->setBounds(surfaceSize);
- scrollLayer->setContentBounds(surfaceSize);
scrollLayer->setPosition(FloatPoint(0, 0));
scrollLayer->setAnchorPoint(FloatPoint(0, 0));
scrollLayer->addChild(contentLayer.Pass());
@@ -1067,7 +1059,6 @@ TEST_P(LayerTreeHostImplTest, scrollChildCallsCommitAndRedraw)
IntSize surfaceSize(10, 10);
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
root->setBounds(surfaceSize);
- root->setContentBounds(surfaceSize);
root->addChild(createScrollableLayer(2, surfaceSize));
m_hostImpl->setRootLayer(root.Pass());
m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
@@ -1255,7 +1246,6 @@ TEST_P(LayerTreeHostImplTest, scrollChildAndChangePageScaleOnMainThread)
IntSize surfaceSize(10, 10);
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
root->setBounds(surfaceSize);
- root->setContentBounds(surfaceSize);
// Also mark the root scrollable so it becomes the root scroll layer.
root->setScrollable(true);
int scrollLayerId = 2;
@@ -1574,7 +1564,6 @@ private:
{
setAnchorPoint(FloatPoint(0, 0));
setBounds(IntSize(10, 10));
- setContentBounds(IntSize(10, 10));
setDrawsContent(true);
}
@@ -1593,7 +1582,6 @@ TEST_P(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers)
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
root->setAnchorPoint(FloatPoint(0, 0));
root->setBounds(IntSize(10, 10));
- root->setContentBounds(root->bounds());
root->setDrawsContent(false);
m_hostImpl->setRootLayer(root.Pass());
}
@@ -1797,7 +1785,6 @@ TEST_P(LayerTreeHostImplTest, viewportCovered)
IntRect layerRect(0, 0, 1000, 1000);
root->setPosition(layerRect.location());
root->setBounds(layerRect.size());
- root->setContentBounds(layerRect.size());
root->setQuadRect(IntRect(IntPoint(), layerRect.size()));
root->setQuadVisibleRect(IntRect(IntPoint(), layerRect.size()));
@@ -1820,7 +1807,6 @@ TEST_P(LayerTreeHostImplTest, viewportCovered)
IntRect layerRect(0, 0, 0, 0);
root->setPosition(layerRect.location());
root->setBounds(layerRect.size());
- root->setContentBounds(layerRect.size());
root->setQuadRect(IntRect(IntPoint(), layerRect.size()));
root->setQuadVisibleRect(IntRect(IntPoint(), layerRect.size()));
@@ -1844,7 +1830,6 @@ TEST_P(LayerTreeHostImplTest, viewportCovered)
IntRect layerRect(500, 500, 200, 200);
root->setPosition(layerRect.location());
root->setBounds(layerRect.size());
- root->setContentBounds(layerRect.size());
root->setQuadRect(IntRect(IntPoint(), layerRect.size()));
root->setQuadVisibleRect(IntRect(IntPoint(), layerRect.size()));
@@ -1951,11 +1936,9 @@ TEST_P(LayerTreeHostImplTest, partialSwapReceivesDamageRect)
child->setPosition(FloatPoint(12, 13));
child->setAnchorPoint(FloatPoint(0, 0));
child->setBounds(IntSize(14, 15));
- child->setContentBounds(IntSize(14, 15));
child->setDrawsContent(true);
root->setAnchorPoint(FloatPoint(0, 0));
root->setBounds(IntSize(500, 500));
- root->setContentBounds(IntSize(500, 500));
root->setDrawsContent(true);
root->addChild(child.Pass());
layerTreeHostImpl->setRootLayer(root.Pass());
@@ -2013,11 +1996,9 @@ TEST_P(LayerTreeHostImplTest, rootLayerDoesntCreateExtraSurface)
scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::create(2);
child->setAnchorPoint(FloatPoint(0, 0));
child->setBounds(IntSize(10, 10));
- child->setContentBounds(IntSize(10, 10));
child->setDrawsContent(true);
root->setAnchorPoint(FloatPoint(0, 0));
root->setBounds(IntSize(10, 10));
- root->setContentBounds(IntSize(10, 10));
root->setDrawsContent(true);
root->setOpacity(0.7f);
root->addChild(child.Pass());
@@ -2263,7 +2244,6 @@ static scoped_ptr<LayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, Lay
root->setAnchorPoint(FloatPoint(0, 0));
root->setPosition(FloatPoint(rootRect.x(), rootRect.y()));
root->setBounds(IntSize(rootRect.width(), rootRect.height()));
- root->setContentBounds(root->bounds());
root->setVisibleContentRect(rootRect);
root->setDrawsContent(false);
root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(rootRect.width(), rootRect.height())));
@@ -2272,14 +2252,12 @@ static scoped_ptr<LayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, Lay
child->setPosition(FloatPoint(childRect.x(), childRect.y()));
child->setOpacity(0.5f);
child->setBounds(IntSize(childRect.width(), childRect.height()));
- child->setContentBounds(child->bounds());
child->setVisibleContentRect(childRect);
child->setDrawsContent(false);
grandChild->setAnchorPoint(FloatPoint(0, 0));
grandChild->setPosition(IntPoint(grandChildRect.x(), grandChildRect.y()));
grandChild->setBounds(IntSize(grandChildRect.width(), grandChildRect.height()));
- grandChild->setContentBounds(grandChild->bounds());
grandChild->setVisibleContentRect(grandChildRect);
grandChild->setDrawsContent(true);
@@ -2661,7 +2639,6 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext)
scoped_ptr<TiledLayerImpl> tileLayer = TiledLayerImpl::create(layerId++);
tileLayer->setBounds(IntSize(10, 10));
tileLayer->setAnchorPoint(FloatPoint(0, 0));
- tileLayer->setContentBounds(IntSize(10, 10));
tileLayer->setDrawsContent(true);
tileLayer->setSkipsDraw(false);
scoped_ptr<LayerTilingData> tilingData(LayerTilingData::create(IntSize(10, 10), LayerTilingData::NoBorderTexels));
@@ -2673,7 +2650,6 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext)
scoped_ptr<TextureLayerImpl> textureLayer = TextureLayerImpl::create(layerId++);
textureLayer->setBounds(IntSize(10, 10));
textureLayer->setAnchorPoint(FloatPoint(0, 0));
- textureLayer->setContentBounds(IntSize(10, 10));
textureLayer->setDrawsContent(true);
textureLayer->setTextureId(1);
rootLayer->addChild(textureLayer.PassAs<LayerImpl>());
@@ -2681,7 +2657,6 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext)
scoped_ptr<TiledLayerImpl> maskLayer = TiledLayerImpl::create(layerId++);
maskLayer->setBounds(IntSize(10, 10));
maskLayer->setAnchorPoint(FloatPoint(0, 0));
- maskLayer->setContentBounds(IntSize(10, 10));
maskLayer->setDrawsContent(true);
maskLayer->setSkipsDraw(false);
maskLayer->setTilingData(*tilingData);
@@ -2690,7 +2665,6 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext)
scoped_ptr<TextureLayerImpl> textureLayerWithMask = TextureLayerImpl::create(layerId++);
textureLayerWithMask->setBounds(IntSize(10, 10));
textureLayerWithMask->setAnchorPoint(FloatPoint(0, 0));
- textureLayerWithMask->setContentBounds(IntSize(10, 10));
textureLayerWithMask->setDrawsContent(true);
textureLayerWithMask->setTextureId(1);
textureLayerWithMask->setMaskLayer(maskLayer.PassAs<LayerImpl>());
@@ -2702,7 +2676,6 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext)
scoped_ptr<VideoLayerImpl> videoLayer = VideoLayerImpl::create(layerId++, &provider);
videoLayer->setBounds(IntSize(10, 10));
videoLayer->setAnchorPoint(FloatPoint(0, 0));
- videoLayer->setContentBounds(IntSize(10, 10));
videoLayer->setDrawsContent(true);
videoLayer->setLayerTreeHostImpl(m_hostImpl.get());
rootLayer->addChild(videoLayer.PassAs<LayerImpl>());
@@ -2713,7 +2686,6 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext)
scoped_ptr<VideoLayerImpl> hwVideoLayer = VideoLayerImpl::create(layerId++, &hwProvider);
hwVideoLayer->setBounds(IntSize(10, 10));
hwVideoLayer->setAnchorPoint(FloatPoint(0, 0));
- hwVideoLayer->setContentBounds(IntSize(10, 10));
hwVideoLayer->setDrawsContent(true);
hwVideoLayer->setLayerTreeHostImpl(m_hostImpl.get());
rootLayer->addChild(hwVideoLayer.PassAs<LayerImpl>());
@@ -2721,7 +2693,6 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext)
scoped_ptr<IOSurfaceLayerImpl> ioSurfaceLayer = IOSurfaceLayerImpl::create(layerId++);
ioSurfaceLayer->setBounds(IntSize(10, 10));
ioSurfaceLayer->setAnchorPoint(FloatPoint(0, 0));
- ioSurfaceLayer->setContentBounds(IntSize(10, 10));
ioSurfaceLayer->setDrawsContent(true);
ioSurfaceLayer->setIOSurfaceProperties(1, IntSize(10, 10));
ioSurfaceLayer->setLayerTreeHostImpl(m_hostImpl.get());
@@ -2730,14 +2701,12 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext)
scoped_ptr<HeadsUpDisplayLayerImpl> hudLayer = HeadsUpDisplayLayerImpl::create(layerId++);
hudLayer->setBounds(IntSize(10, 10));
hudLayer->setAnchorPoint(FloatPoint(0, 0));
- hudLayer->setContentBounds(IntSize(10, 10));
hudLayer->setDrawsContent(true);
hudLayer->setLayerTreeHostImpl(m_hostImpl.get());
rootLayer->addChild(hudLayer.PassAs<LayerImpl>());
scoped_ptr<FakeScrollbarLayerImpl> scrollbarLayer(FakeScrollbarLayerImpl::create(layerId++));
scrollbarLayer->setBounds(IntSize(10, 10));
- scrollbarLayer->setContentBounds(IntSize(10, 10));
scrollbarLayer->setDrawsContent(true);
scrollbarLayer->setLayerTreeHostImpl(m_hostImpl.get());
scrollbarLayer->createResources(m_hostImpl->resourceProvider());
@@ -2745,7 +2714,6 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext)
scoped_ptr<DelegatedRendererLayerImpl> delegatedRendererLayer(DelegatedRendererLayerImpl::create(layerId++));
delegatedRendererLayer->setBounds(IntSize(10, 10));
- delegatedRendererLayer->setContentBounds(IntSize(10, 10));
delegatedRendererLayer->setDrawsContent(true);
delegatedRendererLayer->setLayerTreeHostImpl(m_hostImpl.get());
ScopedPtrVector<RenderPass> passList;
@@ -2846,7 +2814,6 @@ TEST_P(LayerTreeHostImplTest, layersFreeTextures)
scoped_ptr<TiledLayerImpl> tileLayer = TiledLayerImpl::create(2);
tileLayer->setBounds(IntSize(10, 10));
tileLayer->setAnchorPoint(FloatPoint(0, 0));
- tileLayer->setContentBounds(IntSize(10, 10));
tileLayer->setDrawsContent(true);
tileLayer->setSkipsDraw(false);
scoped_ptr<LayerTilingData> tilingData(LayerTilingData::create(IntSize(10, 10), LayerTilingData::NoBorderTexels));
@@ -2858,7 +2825,6 @@ TEST_P(LayerTreeHostImplTest, layersFreeTextures)
scoped_ptr<TextureLayerImpl> textureLayer = TextureLayerImpl::create(3);
textureLayer->setBounds(IntSize(10, 10));
textureLayer->setAnchorPoint(FloatPoint(0, 0));
- textureLayer->setContentBounds(IntSize(10, 10));
textureLayer->setDrawsContent(true);
textureLayer->setTextureId(1);
rootLayer->addChild(textureLayer.PassAs<LayerImpl>());
@@ -2867,7 +2833,6 @@ TEST_P(LayerTreeHostImplTest, layersFreeTextures)
scoped_ptr<VideoLayerImpl> videoLayer = VideoLayerImpl::create(4, &provider);
videoLayer->setBounds(IntSize(10, 10));
videoLayer->setAnchorPoint(FloatPoint(0, 0));
- videoLayer->setContentBounds(IntSize(10, 10));
videoLayer->setDrawsContent(true);
videoLayer->setLayerTreeHostImpl(m_hostImpl.get());
rootLayer->addChild(videoLayer.PassAs<LayerImpl>());
@@ -2875,7 +2840,6 @@ TEST_P(LayerTreeHostImplTest, layersFreeTextures)
scoped_ptr<IOSurfaceLayerImpl> ioSurfaceLayer = IOSurfaceLayerImpl::create(5);
ioSurfaceLayer->setBounds(IntSize(10, 10));
ioSurfaceLayer->setAnchorPoint(FloatPoint(0, 0));
- ioSurfaceLayer->setContentBounds(IntSize(10, 10));
ioSurfaceLayer->setDrawsContent(true);
ioSurfaceLayer->setIOSurfaceProperties(1, IntSize(10, 10));
ioSurfaceLayer->setLayerTreeHostImpl(m_hostImpl.get());
@@ -2944,7 +2908,6 @@ static void addDrawingLayerTo(LayerImpl* parent, int id, const IntRect& layerRec
layerPtr->setAnchorPoint(FloatPoint(0, 0));
layerPtr->setPosition(FloatPoint(layerRect.location()));
layerPtr->setBounds(layerRect.size());
- layerPtr->setContentBounds(layerRect.size());
layerPtr->setDrawsContent(true); // only children draw content
layerPtr->setContentsOpaque(true);
parent->addChild(layer.Pass());
@@ -2965,7 +2928,6 @@ static void setupLayersForTextureCaching(LayerTreeHostImpl* layerTreeHostImpl, L
root->setAnchorPoint(FloatPoint(0, 0));
root->setPosition(FloatPoint(0, 0));
root->setBounds(rootSize);
- root->setContentBounds(rootSize);
root->setDrawsContent(true);
layerTreeHostImpl->setRootLayer(root.Pass());
@@ -3011,7 +2973,6 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithClipping)
root->setAnchorPoint(FloatPoint(0, 0));
root->setPosition(FloatPoint(0, 0));
root->setBounds(rootSize);
- root->setContentBounds(rootSize);
root->setDrawsContent(true);
root->setMasksToBounds(true);
myHostImpl->setRootLayer(root.Pass());
@@ -3123,7 +3084,6 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusion)
root->setAnchorPoint(FloatPoint(0, 0));
root->setPosition(FloatPoint(0, 0));
root->setBounds(rootSize);
- root->setContentBounds(rootSize);
root->setDrawsContent(true);
root->setMasksToBounds(true);
myHostImpl->setRootLayer(root.Pass());
@@ -3236,7 +3196,6 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut)
root->setAnchorPoint(FloatPoint(0, 0));
root->setPosition(FloatPoint(0, 0));
root->setBounds(rootSize);
- root->setContentBounds(rootSize);
root->setDrawsContent(true);
root->setMasksToBounds(true);
myHostImpl->setRootLayer(root.Pass());
@@ -3350,7 +3309,6 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal)
root->setAnchorPoint(FloatPoint(0, 0));
root->setPosition(FloatPoint(0, 0));
root->setBounds(rootSize);
- root->setContentBounds(rootSize);
root->setDrawsContent(true);
root->setMasksToBounds(true);
myHostImpl->setRootLayer(root.Pass());
@@ -3433,7 +3391,6 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned)
root->setAnchorPoint(FloatPoint(0, 0));
root->setPosition(FloatPoint(0, 0));
root->setBounds(rootSize);
- root->setContentBounds(rootSize);
root->setDrawsContent(true);
root->setMasksToBounds(true);
myHostImpl->setRootLayer(root.Pass());
@@ -3518,7 +3475,6 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap)
root->setAnchorPoint(FloatPoint(0, 0));
root->setPosition(FloatPoint(0, 0));
root->setBounds(rootSize);
- root->setContentBounds(rootSize);
root->setDrawsContent(true);
root->setMasksToBounds(true);
myHostImpl->setRootLayer(root.Pass());
@@ -3632,7 +3588,6 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithScissor)
root->setAnchorPoint(FloatPoint(0, 0));
root->setPosition(FloatPoint(rootRect.x(), rootRect.y()));
root->setBounds(IntSize(rootRect.width(), rootRect.height()));
- root->setContentBounds(root->bounds());
root->setDrawsContent(true);
root->setMasksToBounds(true);
@@ -3640,7 +3595,6 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithScissor)
child->setPosition(FloatPoint(childRect.x(), childRect.y()));
child->setOpacity(0.5);
child->setBounds(IntSize(childRect.width(), childRect.height()));
- child->setContentBounds(child->bounds());
child->setDrawsContent(true);
child->setSkipsDraw(false);
@@ -3652,7 +3606,6 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithScissor)
grandChild->setAnchorPoint(FloatPoint(0, 0));
grandChild->setPosition(IntPoint(grandChildRect.x(), grandChildRect.y()));
grandChild->setBounds(IntSize(grandChildRect.width(), grandChildRect.height()));
- grandChild->setContentBounds(grandChild->bounds());
grandChild->setDrawsContent(true);
TiledLayerImpl* childPtr = child.get();

Powered by Google App Engine
This is Rietveld 408576698