+2012-01-23 Shawn Singh <shawnsingh@chromium.org>
+
+ [chromium] updateRect is incorrect when contentBounds != bounds
+ https://bugs.webkit.org/show_bug.cgi?id=72919
+
+ Reviewed by James Robinson.
+
+ Unit test added to TiledLayerChromiumTest.cpp
+
+ The m_updateRect member in LayerChromium types is used to track
+ what was painted for that layer. For tiled layers (especially
+ image layers), the updateRect was being given with respect to the
+ size of the content, rather than the size of the layer. This patch
+ adds a conversion so that updateRect is always with respect to the
+ layer size, so that damage tracking will work correctly in those
+ cases.
+
+ * platform/graphics/chromium/LayerChromium.h:
+ * platform/graphics/chromium/TiledLayerChromium.cpp:
+ (WebCore::TiledLayerChromium::updateCompositorResources):
+
2012-01-23 Konrad Piascik <kpiascik@rim.com>
Web Inspector: Make "Copy as HTML" use the same copy functions as other copy methods.
+2012-01-23 Shawn Singh <shawnsingh@chromium.org>
+
+ [chromium] updateRect is incorrect when contentBounds != bounds
+ https://bugs.webkit.org/show_bug.cgi?id=72919
+
+ Reviewed by James Robinson.
+
+ * tests/TiledLayerChromiumTest.cpp:
+ (WTF::FakeTiledLayerWithScaledBounds::FakeTiledLayerWithScaledBounds):
+ (WTF::FakeTiledLayerWithScaledBounds::setContentBounds):
+ (WTF::FakeTiledLayerWithScaledBounds::contentBounds):
+ (WTF::FakeTiledLayerWithScaledBounds::updateRect):
+ (WTF::TEST):
+
2012-01-23 Takashi Toyoshima <toyoshim@chromium.org>
[Chromium][WebSocket] Remove binary communication using WebData in WebKit API
#include "TiledLayerChromium.h"
+#include "CCLayerTreeTestCommon.h"
#include "LayerTextureUpdater.h"
#include "TextureManager.h"
#include "cc/CCSingleThreadProxy.h" // For DebugScopedSetImplThread
TextureManager* m_textureManager;
};
+class FakeTiledLayerWithScaledBounds : public FakeTiledLayerChromium {
+public:
+ explicit FakeTiledLayerWithScaledBounds(TextureManager* textureManager)
+ : FakeTiledLayerChromium(textureManager)
+ {
+ }
+
+ void setContentBounds(const IntSize& contentBounds) { m_forcedContentBounds = contentBounds; }
+ virtual IntSize contentBounds() const { return m_forcedContentBounds; }
+
+ FloatRect updateRect() { return m_updateRect; }
+
+protected:
+ IntSize m_forcedContentBounds;
+};
+
void FakeLayerTextureUpdater::setRectToInvalidate(const IntRect& rect, FakeTiledLayerChromium* layer)
{
m_rectToInvalidate = rect;
EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount());
}
+TEST(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled)
+{
+ // The updateRect (that indicates what was actually painted) should be in
+ // layer space, not the content space.
+
+ OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
+ RefPtr<FakeTiledLayerWithScaledBounds> layer = adoptRef(new FakeTiledLayerWithScaledBounds(textureManager.get()));
+
+ FakeTextureAllocator textureAllocator;
+ CCTextureUpdater updater(&textureAllocator);
+
+ IntRect layerBounds(0, 0, 300, 200);
+ IntRect contentBounds(0, 0, 200, 250);
+
+ layer->setBounds(layerBounds.size());
+ layer->setContentBounds(contentBounds.size());
+ layer->setVisibleLayerRect(contentBounds);
+
+ // On first update, the updateRect includes all tiles, even beyond the boundaries of the layer.
+ // However, it should still be in layer space, not content space.
+ layer->invalidateRect(contentBounds);
+ layer->prepareToUpdate(contentBounds);
+ layer->updateCompositorResources(0, updater);
+ EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 300, 300 * 0.8), layer->updateRect());
+
+ // After the tiles are updated once, another invalidate only needs to update the bounds of the layer.
+ layer->invalidateRect(contentBounds);
+ layer->prepareToUpdate(contentBounds);
+ layer->updateCompositorResources(0, updater);
+ EXPECT_FLOAT_RECT_EQ(FloatRect(layerBounds), layer->updateRect());
+
+ // Partial re-paint should also be represented by the updateRect in layer space, not content space.
+ IntRect partialDamage(30, 100, 10, 10);
+ layer->invalidateRect(partialDamage);
+ layer->prepareToUpdate(contentBounds);
+ layer->updateCompositorResources(0, updater);
+ EXPECT_FLOAT_RECT_EQ(FloatRect(45, 80, 15, 8), layer->updateRect());
+}
+
} // namespace