[chromium] Layer chromium should need a redraw after getting its first non-empty...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Jun 2012 18:42:29 +0000 (18:42 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Jun 2012 18:42:29 +0000 (18:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=89784

Patch by Ian Vollick <vollick@chromium.org> on 2012-06-26
Reviewed by James Robinson.

Previously, we'd only set needs redraw if the old bounds were zero,
and the new bounds were non-zero, but we should actually have
checked that the old bounds were non-empty.

Source/WebCore:

Unit test: LayerChromiumTestWithoutFixture.setBoundsTriggersSetNeedsRedrawAfterGettingNonEmptyBounds

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

Source/WebKit/chromium:

* tests/LayerChromiumTest.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121273 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/chromium/LayerChromium.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/tests/LayerChromiumTest.cpp

index 41c288a..88d5404 100755 (executable)
@@ -1,3 +1,19 @@
+2012-06-26  Ian Vollick  <vollick@chromium.org>
+
+        [chromium] Layer chromium should need a redraw after getting its first non-empty bounds.
+        https://bugs.webkit.org/show_bug.cgi?id=89784
+
+        Reviewed by James Robinson.
+
+        Previously, we'd only set needs redraw if the old bounds were zero,
+        and the new bounds were non-zero, but we should actually have 
+        checked that the old bounds were non-empty.
+
+        Unit test: LayerChromiumTestWithoutFixture.setBoundsTriggersSetNeedsRedrawAfterGettingNonEmptyBounds
+
+        * platform/graphics/chromium/LayerChromium.cpp:
+        (WebCore::LayerChromium::setBounds):
+
 2012-06-26  Jia Pu  <jpu@apple.com>
 
         On Mac, autocorrection sometimes fails to take place in Safari.
index 5aed1c7..1a4038a 100644 (file)
@@ -228,7 +228,7 @@ void LayerChromium::setBounds(const IntSize& size)
     if (bounds() == size)
         return;
 
-    bool firstResize = !bounds().width() && !bounds().height() && size.width() && size.height();
+    bool firstResize = bounds().isEmpty() && !size.isEmpty();
 
     m_bounds = size;
 
index 329ad09..0250304 100644 (file)
@@ -1,3 +1,16 @@
+2012-06-26  Ian Vollick  <vollick@chromium.org>
+
+        [chromium] Layer chromium should need a redraw after getting its first non-empty bounds.
+        https://bugs.webkit.org/show_bug.cgi?id=89784
+
+        Reviewed by James Robinson.
+
+        Previously, we'd only set needs redraw if the old bounds were zero,
+        and the new bounds were non-zero, but we should actually have 
+        checked that the old bounds were non-empty.
+
+        * tests/LayerChromiumTest.cpp:
+
 2012-06-26  James Robinson  <jamesr@chromium.org>
 
         [chromium] Remove dead compositor-related API from GraphicsContext3DPrivate / Extensions3DChromium
index cd4fcc3..4a92b15 100644 (file)
@@ -813,4 +813,20 @@ TEST(LayerChromiumLayerTreeHostTest, replaceMaskAndReplicaLayer)
     WebKit::WebCompositor::shutdown();
 }
 
+class MockLayerChromium : public LayerChromium {
+public:
+    bool needsDisplay() const { return m_needsDisplay; }
+};
+
+TEST(LayerChromiumTestWithoutFixture, setBoundsTriggersSetNeedsRedrawAfterGettingNonEmptyBounds)
+{
+    RefPtr<MockLayerChromium> layer(adoptRef(new MockLayerChromium));
+    EXPECT_FALSE(layer->needsDisplay());
+    layer->setBounds(IntSize(0, 10));
+    EXPECT_FALSE(layer->needsDisplay());
+    layer->setBounds(IntSize(10, 10));
+    EXPECT_TRUE(layer->needsDisplay());
+}
+
+
 } // namespace