Title: [102395] trunk/Source
Revision
102395
Author
[email protected]
Date
2011-12-08 16:37:47 -0800 (Thu, 08 Dec 2011)

Log Message

[chromium] Layer contents scale change should trigger invalidation

https://bugs.webkit.org/show_bug.cgi?id=74086

When the contents scale of a layer is changed, the entire contents of
the layer should be marked dirty.

Patch by Sami Kyostila <[email protected]> on 2011-12-08
Reviewed by James Robinson.

Source/WebCore:

* platform/graphics/chromium/LayerChromium.cpp:
(WebCore::LayerChromium::setContentsScale):

Source/WebKit/chromium:

* tests/LayerChromiumTest.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (102394 => 102395)


--- trunk/Source/WebCore/ChangeLog	2011-12-09 00:22:08 UTC (rev 102394)
+++ trunk/Source/WebCore/ChangeLog	2011-12-09 00:37:47 UTC (rev 102395)
@@ -1,3 +1,17 @@
+2011-12-08  Sami Kyostila  <[email protected]>
+
+        [chromium] Layer contents scale change should trigger invalidation
+
+        https://bugs.webkit.org/show_bug.cgi?id=74086
+
+        When the contents scale of a layer is changed, the entire contents of
+        the layer should be marked dirty.
+
+        Reviewed by James Robinson.
+
+        * platform/graphics/chromium/LayerChromium.cpp:
+        (WebCore::LayerChromium::setContentsScale):
+
 2011-12-08  Stephen White  <[email protected]>
 
         [chromium] Add CSS_FILTERS custom binding file to WebCore.gypi.

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp (102394 => 102395)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp	2011-12-09 00:22:08 UTC (rev 102394)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp	2011-12-09 00:37:47 UTC (rev 102395)
@@ -425,9 +425,10 @@
 
 void LayerChromium::setContentsScale(float contentsScale)
 {
-    if (!needsContentsScale())
+    if (!needsContentsScale() || m_contentsScale == contentsScale)
         return;
     m_contentsScale = contentsScale;
+    setNeedsDisplay();
 }
 
 void LayerChromium::createRenderSurface()

Modified: trunk/Source/WebKit/chromium/ChangeLog (102394 => 102395)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-12-09 00:22:08 UTC (rev 102394)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-12-09 00:37:47 UTC (rev 102395)
@@ -1,3 +1,16 @@
+2011-12-08  Sami Kyostila  <[email protected]>
+
+        [chromium] Layer contents scale change should trigger invalidation
+
+        https://bugs.webkit.org/show_bug.cgi?id=74086
+
+        When the contents scale of a layer is changed, the entire contents of
+        the layer should be marked dirty.
+
+        Reviewed by James Robinson.
+
+        * tests/LayerChromiumTest.cpp:
+
 2011-12-08  Dana Jansens  <[email protected]>
 
         [chromium] Set opaque() for VideoLayerChromium

Modified: trunk/Source/WebKit/chromium/tests/LayerChromiumTest.cpp (102394 => 102395)


--- trunk/Source/WebKit/chromium/tests/LayerChromiumTest.cpp	2011-12-09 00:22:08 UTC (rev 102394)
+++ trunk/Source/WebKit/chromium/tests/LayerChromiumTest.cpp	2011-12-09 00:37:47 UTC (rev 102395)
@@ -700,4 +700,37 @@
     nonCompositedContentHost->setViewport(IntSize(30, 30), IntSize(20, 20), IntPoint(10, 10), 1);
 }
 
+class LayerChromiumWithContentScaling : public LayerChromium {
+public:
+    explicit LayerChromiumWithContentScaling(CCLayerDelegate* delegate)
+        : LayerChromium(delegate)
+    {
+    }
+
+    virtual bool needsContentsScale() const
+    {
+        return true;
+    }
+
+    void resetNeedsDisplay()
+    {
+        m_needsDisplay = false;
+    }
+};
+
+TEST_F(LayerChromiumTest, checkContentsScaleChangeTriggersNeedsDisplay)
+{
+    MockLayerDelegate mockDelegate;
+    RefPtr<LayerChromiumWithContentScaling> testLayer = adoptRef(new LayerChromiumWithContentScaling(&mockDelegate));
+
+    IntSize testBounds = IntSize(320, 240);
+    EXECUTE_AND_VERIFY_NOTIFY_SYNC_BEHAVIOR(mockDelegate, 1, testLayer->setBounds(testBounds));
+
+    testLayer->resetNeedsDisplay();
+    EXPECT_FALSE(testLayer->needsDisplay());
+
+    EXECUTE_AND_VERIFY_NOTIFY_SYNC_BEHAVIOR(mockDelegate, 1, testLayer->setContentsScale(testLayer->contentsScale() + 1.f));
+    EXPECT_TRUE(testLayer->needsDisplay());
+}
+
 } // namespace
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to