https://bugs.webkit.org/show_bug.cgi?id=76735
This is to add skipped layers to their RenderSurface's layer list so that they
are considered in the next update. Without this change, m_skipsDraw = false sticks
with the layer for the remainder of its lifetime.
Reviewed by James Robinson.
Tests: Unit test (TiledLayerChromiumTest.cpp)
* platform/graphics/chromium/TiledLayerChromium.cpp:
(WebCore::TiledLayerChromium::drawsContent):
* platform/graphics/chromium/TiledLayerChromium.h:
(WebCore::TiledLayerChromium::skipsDraw):
Source/WebKit/chromium: Adding a test to verify that m_skipsDraw gets reset between frames for
tiled layers.
https://bugs.webkit.org/show_bug.cgi?id=76735
Reviewed by James Robinson.
* WebKit.gypi:
* tests/FakeCCLayerTreeHostClient.h: Added.
(WebCore::FakeCCLayerTreeHostClient::updateAnimations):
(WebCore::FakeCCLayerTreeHostClient::layout):
(WebCore::FakeCCLayerTreeHostClient::applyScrollAndScale):
(WebCore::FakeCCLayerTreeHostClient::createLayerTreeHostContext3D):
(WebCore::FakeCCLayerTreeHostClient::didRecreateGraphicsContext):
(WebCore::FakeCCLayerTreeHostClient::didCommitAndDrawFrame):
(WebCore::FakeCCLayerTreeHostClient::didCompleteSwapBuffers):
(WebCore::FakeCCLayerTreeHostClient::scheduleComposite):
* tests/LayerChromiumTest.cpp:
* tests/TiledLayerChromiumTest.cpp:
(WTF::FakeTiledLayerChromium::skipsDraw):
(WTF::FakeTiledLayerChromium::paintContentsIfDirty):
(WTF::TEST):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105845
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-01-24 Vangelis Kokkevis <vangelis@chromium.org>
+
+ [chromium] Ignore m_skipsDraw in TiledLayerChromium::drawsContent()
+ https://bugs.webkit.org/show_bug.cgi?id=76735
+
+ This is to add skipped layers to their RenderSurface's layer list so that they
+ are considered in the next update. Without this change, m_skipsDraw = false sticks
+ with the layer for the remainder of its lifetime.
+
+ Reviewed by James Robinson.
+
+ Tests: Unit test (TiledLayerChromiumTest.cpp)
+
+ * platform/graphics/chromium/TiledLayerChromium.cpp:
+ (WebCore::TiledLayerChromium::drawsContent):
+ * platform/graphics/chromium/TiledLayerChromium.h:
+ (WebCore::TiledLayerChromium::skipsDraw):
+
2012-01-24 Kentaro Hara <haraken@chromium.org>
Invalidate r105697, r105766, r105809 and r105805
if (m_tilingOption == NeverTile && m_tiler->numTiles() > 1)
return false;
- return !m_skipsDraw;
+ return true;
}
bool TiledLayerChromium::needsContentsScale() const
// After preparing an update, returns true if more pre-painting is needed.
bool needsIdlePaint(const IntRect& layerRect);
+ bool skipsDraw() const { return m_skipsDraw; }
+
virtual void protectVisibleTileTextures();
virtual TextureManager* textureManager() const;
+2012-01-24 Vangelis Kokkevis <vangelis@chromium.org>
+
+ Adding a test to verify that m_skipsDraw gets reset between frames for
+ tiled layers.
+ https://bugs.webkit.org/show_bug.cgi?id=76735
+
+ Reviewed by James Robinson.
+
+ * WebKit.gypi:
+ * tests/FakeCCLayerTreeHostClient.h: Added.
+ (WebCore::FakeCCLayerTreeHostClient::updateAnimations):
+ (WebCore::FakeCCLayerTreeHostClient::layout):
+ (WebCore::FakeCCLayerTreeHostClient::applyScrollAndScale):
+ (WebCore::FakeCCLayerTreeHostClient::createLayerTreeHostContext3D):
+ (WebCore::FakeCCLayerTreeHostClient::didRecreateGraphicsContext):
+ (WebCore::FakeCCLayerTreeHostClient::didCommitAndDrawFrame):
+ (WebCore::FakeCCLayerTreeHostClient::didCompleteSwapBuffers):
+ (WebCore::FakeCCLayerTreeHostClient::scheduleComposite):
+ * tests/LayerChromiumTest.cpp:
+ * tests/TiledLayerChromiumTest.cpp:
+ (WTF::FakeTiledLayerChromium::skipsDraw):
+ (WTF::FakeTiledLayerChromium::paintContentsIfDirty):
+ (WTF::TEST):
+
2012-01-24 Dmitry Lomov <dslomov@google.com>
Unreviewed: removing WebWorker.h again after r105684.
'tests/CCTimerTest.cpp',
'tests/CompositorFakeGraphicsContext3D.h',
'tests/CompositorFakeWebGraphicsContext3D.h',
+ 'tests/FakeCCLayerTreeHostClient.h',
'tests/FakeGraphicsContext3DTest.cpp',
'tests/FakeWebGraphicsContext3D.h',
'tests/FloatQuadTest.cpp',
--- /dev/null
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef FakeCCLayerTreeHostClient_h
+#define FakeCCLayerTreeHostClient_h
+
+#include "config.h"
+
+#include "cc/CCLayerTreeHost.h"
+#include "CompositorFakeGraphicsContext3D.h"
+
+namespace WebCore {
+
+class FakeCCLayerTreeHostClient : public CCLayerTreeHostClient {
+public:
+ virtual void updateAnimations(double frameBeginTime) { }
+ virtual void layout() { }
+ virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) { }
+ virtual PassRefPtr<GraphicsContext3D> createLayerTreeHostContext3D()
+ {
+ GraphicsContext3D::Attributes attrs;
+ return createCompositorMockGraphicsContext3D(attrs);
+ }
+ virtual void didRecreateGraphicsContext(bool success) { }
+ virtual void didCommitAndDrawFrame() { }
+ virtual void didCompleteSwapBuffers() { }
+
+ // Used only in the single-threaded path.
+ virtual void scheduleComposite() { }
+};
+
+}
+#endif // FakeCCLayerTreeHostClient_h
\ No newline at end of file
#include "cc/CCLayerTreeHost.h"
#include "CCLayerTreeTestCommon.h"
+#include "FakeCCLayerTreeHostClient.h"
#include "LayerPainterChromium.h"
#include "NonCompositedContentHost.h"
#include "WebCompositor.h"
namespace {
-class FakeCCLayerTreeHostClient : public CCLayerTreeHostClient {
-public:
- virtual void updateAnimations(double frameBeginTime) { }
- virtual void layout() { }
- virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) { }
- virtual PassRefPtr<GraphicsContext3D> createLayerTreeHostContext3D() { return 0; }
- virtual void didRecreateGraphicsContext(bool success) { }
- virtual void didCommitAndDrawFrame() { }
- virtual void didCompleteSwapBuffers() { }
-
- // Used only in the single-threaded path.
- virtual void scheduleComposite() { }
-};
-
class MockCCLayerTreeHost : public CCLayerTreeHost {
public:
MockCCLayerTreeHost()
#include "TiledLayerChromium.h"
#include "CCLayerTreeTestCommon.h"
+#include "FakeCCLayerTreeHostClient.h"
#include "LayerTextureUpdater.h"
#include "TextureManager.h"
+#include "WebCompositor.h"
#include "cc/CCSingleThreadProxy.h" // For DebugScopedSetImplThread
#include "cc/CCTextureUpdater.h"
#include "cc/CCTiledLayerImpl.h"
return TiledLayerChromium::needsIdlePaint(rect);
}
+ bool skipsDraw() const
+ {
+ return TiledLayerChromium::skipsDraw();
+ }
+
FakeLayerTextureUpdater* fakeLayerTextureUpdater() { return m_fakeTextureUpdater.get(); }
virtual TextureManager* textureManager() const { return m_textureManager; }
+ virtual void paintContentsIfDirty()
+ {
+ prepareToUpdate(visibleLayerRect());
+ }
+
private:
virtual void createTextureUpdater(const CCLayerTreeHost*) { }
EXPECT_FLOAT_RECT_EQ(FloatRect(45, 80, 15, 8), layer->updateRect());
}
+TEST(TiledLayerChromiumTest, skipsDrawGetsReset)
+{
+ // Initialize without threading support.
+ WebKit::WebCompositor::initialize(0);
+ FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient;
+ RefPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, CCSettings());
+
+ // Create two 300 x 300 tiled layers.
+ IntSize contentBounds(300, 300);
+ IntRect contentRect(IntPoint::zero(), contentBounds);
+
+ RefPtr<FakeTiledLayerChromium> rootLayer = adoptRef(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager()));
+ RefPtr<FakeTiledLayerChromium> childLayer = adoptRef(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager()));
+ rootLayer->addChild(childLayer);
+
+ rootLayer->setBounds(contentBounds);
+ rootLayer->setPosition(FloatPoint(150, 150));
+ childLayer->setBounds(contentBounds);
+ childLayer->setPosition(FloatPoint(150, 150));
+ rootLayer->invalidateRect(contentRect);
+ childLayer->invalidateRect(contentRect);
+
+ // We have enough memory for only one of the two layers.
+ int memoryLimit = 4 * 300 * 300; // 4 bytes per pixel.
+
+ FakeTextureAllocator textureAllocator;
+ CCTextureUpdater updater(&textureAllocator);
+
+ ccLayerTreeHost->setRootLayer(rootLayer);
+ ccLayerTreeHost->setViewportSize(IntSize(300, 300));
+ ccLayerTreeHost->contentsTextureManager()->setMaxMemoryLimitBytes(memoryLimit);
+ ccLayerTreeHost->updateLayers();
+ ccLayerTreeHost->updateCompositorResources(ccLayerTreeHost->context(), updater);
+
+ // We'll skip the root layer.
+ EXPECT_TRUE(rootLayer->skipsDraw());
+ EXPECT_FALSE(childLayer->skipsDraw());
+
+ ccLayerTreeHost->commitComplete();
+
+ // Remove the child layer.
+ rootLayer->removeAllChildren();
+
+ // Need to set the max limit again as it gets overwritten by updateLayers().
+ ccLayerTreeHost->contentsTextureManager()->setMaxMemoryLimitBytes(memoryLimit);
+ ccLayerTreeHost->updateLayers();
+ EXPECT_FALSE(rootLayer->skipsDraw());
+
+ ccLayerTreeHost->setRootLayer(0);
+ ccLayerTreeHost.clear();
+ WebKit::WebCompositor::shutdown();
+}
+
} // namespace