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

Unified Diff: Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp

Issue 10377150: Merge 116587 - [chromium] Don't draw when canDraw() is false (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 | « Source/WebKit/chromium/ChangeLog ('k') | Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp
===================================================================
--- Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp (revision 117086)
+++ Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp (working copy)
@@ -59,6 +59,8 @@
{
CCSettings settings;
m_hostImpl = CCLayerTreeHostImpl::create(settings, this);
+ m_hostImpl->initializeLayerRenderer(createContext());
+ m_hostImpl->setViewportSize(IntSize(10, 10));
}
virtual void didLoseContextOnImplThread() OVERRIDE { }
@@ -254,8 +256,6 @@
TEST_F(CCLayerTreeHostImplTest, nonFastScrollableRegionWithOffset)
{
- m_hostImpl->initializeLayerRenderer(createContext());
-
OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0);
root->setScrollable(true);
root->setScrollPosition(IntPoint(0, 0));
@@ -440,49 +440,51 @@
TEST_F(CCLayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer)
{
- m_hostImpl->initializeLayerRenderer(createContext());
-
- // Ensure visibleLayerRect for root layer is empty
- m_hostImpl->setViewportSize(IntSize(0, 0));
-
+ // The root layer is always drawn, so run this test on a child layer that
+ // will be masked out by the root layer's bounds.
m_hostImpl->setRootLayer(DidDrawCheckLayer::create(0));
DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer());
+ root->setMasksToBounds(true);
+ root->addChild(DidDrawCheckLayer::create(1));
+ DidDrawCheckLayer* layer = static_cast<DidDrawCheckLayer*>(root->children()[0].get());
+ // Ensure visibleLayerRect for layer is empty
+ layer->setPosition(FloatPoint(100, 100));
+ layer->setBounds(IntSize(10, 10));
+ layer->setContentBounds(IntSize(10, 10));
+
CCLayerTreeHostImpl::FrameData frame;
- EXPECT_FALSE(root->willDrawCalled());
- EXPECT_FALSE(root->didDrawCalled());
+ EXPECT_FALSE(layer->willDrawCalled());
+ EXPECT_FALSE(layer->didDrawCalled());
EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
m_hostImpl->drawLayers(frame);
m_hostImpl->didDrawAllLayers(frame);
- EXPECT_FALSE(root->willDrawCalled());
- EXPECT_FALSE(root->didDrawCalled());
+ EXPECT_FALSE(layer->willDrawCalled());
+ EXPECT_FALSE(layer->didDrawCalled());
- EXPECT_TRUE(root->visibleLayerRect().isEmpty());
+ EXPECT_TRUE(layer->visibleLayerRect().isEmpty());
- // Ensure visibleLayerRect for root layer is not empty
- m_hostImpl->setViewportSize(IntSize(10, 10));
+ // Ensure visibleLayerRect for layer layer is not empty
+ layer->setPosition(FloatPoint(0, 0));
- EXPECT_FALSE(root->willDrawCalled());
- EXPECT_FALSE(root->didDrawCalled());
+ EXPECT_FALSE(layer->willDrawCalled());
+ EXPECT_FALSE(layer->didDrawCalled());
EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
m_hostImpl->drawLayers(frame);
m_hostImpl->didDrawAllLayers(frame);
- EXPECT_TRUE(root->willDrawCalled());
- EXPECT_TRUE(root->didDrawCalled());
+ EXPECT_TRUE(layer->willDrawCalled());
+ EXPECT_TRUE(layer->didDrawCalled());
- EXPECT_FALSE(root->visibleLayerRect().isEmpty());
+ EXPECT_FALSE(layer->visibleLayerRect().isEmpty());
}
TEST_F(CCLayerTreeHostImplTest, didDrawCalledOnAllLayers)
{
- m_hostImpl->initializeLayerRenderer(createContext());
- m_hostImpl->setViewportSize(IntSize(10, 10));
-
m_hostImpl->setRootLayer(DidDrawCheckLayer::create(0));
DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer());
@@ -533,9 +535,6 @@
TEST_F(CCLayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard)
{
- m_hostImpl->initializeLayerRenderer(createContext());
- m_hostImpl->setViewportSize(IntSize(10, 10));
-
// When the texture is not missing, we draw as usual.
m_hostImpl->setRootLayer(DidDrawCheckLayer::create(0));
DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer());
@@ -660,9 +659,6 @@
// https://bugs.webkit.org/show_bug.cgi?id=75783
TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers)
{
- m_hostImpl->initializeLayerRenderer(createContext());
- m_hostImpl->setViewportSize(IntSize(10, 10));
-
{
OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0);
root->setAnchorPoint(FloatPoint(0, 0));
@@ -878,7 +874,6 @@
TEST_F(CCLayerTreeHostImplTest, viewportCovered)
{
- m_hostImpl->initializeLayerRenderer(createContext());
m_hostImpl->setBackgroundColor(Color::gray);
IntSize viewportSize(1000, 1000);
@@ -990,7 +985,6 @@
ReshapeTrackerContext* reshapeTracker = new ReshapeTrackerContext();
RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(reshapeTracker), GraphicsContext3D::RenderDirectlyToHostWindow);
m_hostImpl->initializeLayerRenderer(context);
- m_hostImpl->setViewportSize(IntSize(10, 10));
CCLayerImpl* root = new FakeDrawableCCLayerImpl(1);
root->setAnchorPoint(FloatPoint(0, 0));
@@ -1125,9 +1119,6 @@
TEST_F(CCLayerTreeHostImplTest, contextLostAndRestoredNotificationSentToAllLayers)
{
- m_hostImpl->initializeLayerRenderer(createContext());
- m_hostImpl->setViewportSize(IntSize(10, 10));
-
m_hostImpl->setRootLayer(ContextLostNotificationCheckLayer::create(0));
ContextLostNotificationCheckLayer* root = static_cast<ContextLostNotificationCheckLayer*>(m_hostImpl->rootLayer());
@@ -1172,9 +1163,6 @@
TEST_F(CCLayerTreeHostImplTest, scrollbarLayerLostContext)
{
- m_hostImpl->initializeLayerRenderer(createContext());
- m_hostImpl->setViewportSize(IntSize(10, 10));
-
m_hostImpl->setRootLayer(ScrollbarLayerFakePaint::create(0));
ScrollbarLayerFakePaint* scrollbar = static_cast<ScrollbarLayerFakePaint*>(m_hostImpl->rootLayer());
scrollbar->setBounds(IntSize(1, 1));
@@ -1322,9 +1310,6 @@
TEST_F(CCLayerTreeHostImplTest, dontUseOldResourcesAfterLostContext)
{
- m_hostImpl->initializeLayerRenderer(createContext());
- m_hostImpl->setViewportSize(IntSize(10, 10));
-
OwnPtr<CCLayerImpl> rootLayer(CCLayerImpl::create(0));
rootLayer->setBounds(IntSize(10, 10));
rootLayer->setAnchorPoint(FloatPoint(0, 0));
« no previous file with comments | « Source/WebKit/chromium/ChangeLog ('k') | Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698