Modified: trunk/Source/WebCore/ChangeLog (108024 => 108025)
--- trunk/Source/WebCore/ChangeLog 2012-02-17 04:50:52 UTC (rev 108024)
+++ trunk/Source/WebCore/ChangeLog 2012-02-17 05:02:44 UTC (rev 108025)
@@ -1,3 +1,25 @@
+2012-02-16 Sami Kyostila <[email protected]>
+
+ [chromium] LayerChromium::setNeedsDisplay does not apply contents scale correctly
+ https://bugs.webkit.org/show_bug.cgi?id=77464
+
+ Use bounds() instead of contentBounds() to calculate the region to mark
+ as needing painting in LayerChromium::setNeedsDisplay(). contentBounds()
+ includes contents scale, while bounds() does not.
+
+ Since this change also means that TiledLayerChromium::setNeedsDisplayRect() is
+ given an unscaled rectangle, modify that function to scale the rectangle before
+ using it to invalidate the underlying tiles.
+
+ Reviewed by James Robinson.
+
+ Tests: New tests added to LayerChromium and TiledLayerChromium unit tests.
+
+ * platform/graphics/chromium/LayerChromium.h:
+ (WebCore::LayerChromium::setNeedsDisplay):
+ * platform/graphics/chromium/TiledLayerChromium.cpp:
+ (WebCore::TiledLayerChromium::setNeedsDisplayRect):
+
2012-02-16 Raymond Liu <[email protected]>
Lazy init for DefaultAudioDestinationNode and OfflineAudioDestinationNode
Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h (108024 => 108025)
--- trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h 2012-02-17 04:50:52 UTC (rev 108024)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h 2012-02-17 05:02:44 UTC (rev 108025)
@@ -103,7 +103,7 @@
LayerChromium* maskLayer() const { return m_maskLayer.get(); }
virtual void setNeedsDisplayRect(const FloatRect& dirtyRect);
- void setNeedsDisplay() { setNeedsDisplayRect(FloatRect(FloatPoint(), contentBounds())); }
+ void setNeedsDisplay() { setNeedsDisplayRect(FloatRect(FloatPoint(), bounds())); }
virtual bool needsDisplay() const { return m_needsDisplay; }
void setOpacity(float);
Modified: trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp (108024 => 108025)
--- trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp 2012-02-17 04:50:52 UTC (rev 108024)
+++ trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp 2012-02-17 05:02:44 UTC (rev 108025)
@@ -307,7 +307,9 @@
void TiledLayerChromium::setNeedsDisplayRect(const FloatRect& dirtyRect)
{
- IntRect dirty = enclosingIntRect(dirtyRect);
+ FloatRect scaledDirtyRect(dirtyRect);
+ scaledDirtyRect.scale(contentsScale());
+ IntRect dirty = enclosingIntRect(scaledDirtyRect);
invalidateRect(dirty);
LayerChromium::setNeedsDisplayRect(dirtyRect);
}
Modified: trunk/Source/WebKit/chromium/ChangeLog (108024 => 108025)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-02-17 04:50:52 UTC (rev 108024)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-02-17 05:02:44 UTC (rev 108025)
@@ -1,3 +1,22 @@
+2012-02-16 Sami Kyostila <[email protected]>
+
+ [chromium] LayerChromium::setNeedsDisplay does not apply contents scale correctly
+ https://bugs.webkit.org/show_bug.cgi?id=77464
+
+ Added a new unit test for TiledLayerChromium to verify its invalidation behavior when
+ the contents scale changes. Also enhance and existing unit test for LayerChromium to
+ verify the paint rectangle dimensions instead just checking that it is not empty.
+
+ Reviewed by James Robinson.
+
+ * tests/LayerChromiumTest.cpp:
+ * tests/TiledLayerChromiumTest.cpp:
+ (WTF::FakeTiledLayerChromium::setNeedsDisplayRect):
+ (FakeTiledLayerChromium):
+ (WTF::FakeTiledLayerChromium::lastNeedsDisplayRect):
+ (WTF::TEST):
+ (WTF):
+
2012-02-16 MORITA Hajime <[email protected]>
https://bugs.webkit.org/show_bug.cgi?id=78065
Modified: trunk/Source/WebKit/chromium/tests/LayerChromiumTest.cpp (108024 => 108025)
--- trunk/Source/WebKit/chromium/tests/LayerChromiumTest.cpp 2012-02-17 04:50:52 UTC (rev 108024)
+++ trunk/Source/WebKit/chromium/tests/LayerChromiumTest.cpp 2012-02-17 05:02:44 UTC (rev 108025)
@@ -539,10 +539,21 @@
return true;
}
+ virtual void setNeedsDisplayRect(const FloatRect& dirtyRect)
+ {
+ m_lastNeedsDisplayRect = dirtyRect;
+ LayerChromium::setNeedsDisplayRect(dirtyRect);
+ }
+
void resetNeedsDisplay()
{
m_needsDisplay = false;
}
+
+ const FloatRect& lastNeedsDisplayRect() const { return m_lastNeedsDisplayRect; }
+
+private:
+ FloatRect m_lastNeedsDisplayRect;
};
TEST_F(LayerChromiumTest, checkContentsScaleChangeTriggersNeedsDisplay)
@@ -558,6 +569,7 @@
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setContentsScale(testLayer->contentsScale() + 1.f));
EXPECT_TRUE(testLayer->needsDisplay());
+ EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 320, 240), testLayer->lastNeedsDisplayRect());
}
class FakeCCLayerTreeHost : public CCLayerTreeHost {
Modified: trunk/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp (108024 => 108025)
--- trunk/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp 2012-02-17 04:50:52 UTC (rev 108024)
+++ trunk/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp 2012-02-17 05:02:44 UTC (rev 108025)
@@ -162,6 +162,14 @@
return TiledLayerChromium::skipsDraw();
}
+ virtual void setNeedsDisplayRect(const FloatRect& rect)
+ {
+ m_lastNeedsDisplayRect = rect;
+ TiledLayerChromium::setNeedsDisplayRect(rect);
+ }
+
+ const FloatRect& lastNeedsDisplayRect() const { return m_lastNeedsDisplayRect; }
+
FakeLayerTextureUpdater* fakeLayerTextureUpdater() { return m_fakeTextureUpdater.get(); }
virtual TextureManager* textureManager() const { return m_textureManager; }
@@ -181,6 +189,7 @@
RefPtr<FakeLayerTextureUpdater> m_fakeTextureUpdater;
TextureManager* m_textureManager;
+ FloatRect m_lastNeedsDisplayRect;
};
class FakeTiledLayerWithScaledBounds : public FakeTiledLayerChromium {
@@ -434,6 +443,57 @@
EXPECT_FLOAT_RECT_EQ(FloatRect(45, 80, 15, 8), layer->updateRect());
}
+TEST(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges)
+{
+ OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
+ RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
+ DebugScopedSetImplThread implThread;
+ RefPtr<FakeCCTiledLayerImpl> layerImpl = adoptRef(new FakeCCTiledLayerImpl(0));
+
+ FakeTextureAllocator textureAllocator;
+ CCTextureUpdater updater(&textureAllocator);
+
+ // Create a layer with one tile.
+ layer->setBounds(IntSize(100, 100));
+
+ // Invalidate the entire layer.
+ layer->setNeedsDisplay();
+ EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), layer->lastNeedsDisplayRect());
+
+ // Push the tiles to the impl side and check that there is exactly one.
+ layer->prepareToUpdate(IntRect(0, 0, 100, 100));
+ layer->updateCompositorResources(0, updater);
+ layer->pushPropertiesTo(layerImpl.get());
+ EXPECT_TRUE(layerImpl->hasTileAt(0, 0));
+ EXPECT_FALSE(layerImpl->hasTileAt(0, 1));
+ EXPECT_FALSE(layerImpl->hasTileAt(1, 0));
+ EXPECT_FALSE(layerImpl->hasTileAt(1, 1));
+
+ // Change the contents scale and verify that the content rectangle requiring painting
+ // is not scaled.
+ layer->setContentsScale(2);
+ EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), layer->lastNeedsDisplayRect());
+
+ // The impl side should get 2x2 tiles now.
+ layer->prepareToUpdate(IntRect(0, 0, 200, 200));
+ layer->updateCompositorResources(0, updater);
+ layer->pushPropertiesTo(layerImpl.get());
+ EXPECT_TRUE(layerImpl->hasTileAt(0, 0));
+ EXPECT_TRUE(layerImpl->hasTileAt(0, 1));
+ EXPECT_TRUE(layerImpl->hasTileAt(1, 0));
+ EXPECT_TRUE(layerImpl->hasTileAt(1, 1));
+
+ // Invalidate the entire layer again, but do not paint. All tiles should be gone now from the
+ // impl side.
+ layer->setNeedsDisplay();
+ layer->updateCompositorResources(0, updater);
+ layer->pushPropertiesTo(layerImpl.get());
+ EXPECT_FALSE(layerImpl->hasTileAt(0, 0));
+ EXPECT_FALSE(layerImpl->hasTileAt(0, 1));
+ EXPECT_FALSE(layerImpl->hasTileAt(1, 0));
+ EXPECT_FALSE(layerImpl->hasTileAt(1, 1));
+}
+
TEST(TiledLayerChromiumTest, skipsDrawGetsReset)
{
// Initialize without threading support.