Title: [111803] trunk/Source
Revision
111803
Author
wjmacl...@chromium.org
Date
2012-03-22 18:42:35 -0700 (Thu, 22 Mar 2012)

Log Message

[chromium] Force update of nonFastScrollableRegion if target CCLayerImpl has been freshly created.
https://bugs.webkit.org/show_bug.cgi?id=81968

Reviewed by Adrienne Walker.

Source/WebCore:

Added unit test to existing tests for TreeSynchronizer.

When creating a new CCLayerImpl during tree synchronization, make sure we transfer the nonFastScrollableRegion as
the new CCLayerImpl will default to an empty region.

* platform/graphics/chromium/LayerChromium.h:
(WebCore::LayerChromium::nonFastScrollableRegion):
(WebCore::LayerChromium::setNonFastScrollableRegionChanged):
* platform/graphics/chromium/TreeSynchronizer.cpp:
(WebCore::TreeSynchronizer::reuseOrCreateCCLayerImpl):

Source/WebKit/chromium:

* tests/TreeSynchronizerTest.cpp:
(WebKitTests::expectTreesAreIdentical):
(WebKitTests::TEST):
(WebKitTests):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (111802 => 111803)


--- trunk/Source/WebCore/ChangeLog	2012-03-23 01:25:10 UTC (rev 111802)
+++ trunk/Source/WebCore/ChangeLog	2012-03-23 01:42:35 UTC (rev 111803)
@@ -1,3 +1,21 @@
+2012-03-22  W. James MacLean  <wjmacl...@chromium.org>
+
+        [chromium] Force update of nonFastScrollableRegion if target CCLayerImpl has been freshly created.
+        https://bugs.webkit.org/show_bug.cgi?id=81968
+
+        Reviewed by Adrienne Walker.
+
+        Added unit test to existing tests for TreeSynchronizer.
+
+        When creating a new CCLayerImpl during tree synchronization, make sure we transfer the nonFastScrollableRegion as
+        the new CCLayerImpl will default to an empty region.
+
+        * platform/graphics/chromium/LayerChromium.h:
+        (WebCore::LayerChromium::nonFastScrollableRegion):
+        (WebCore::LayerChromium::setNonFastScrollableRegionChanged):
+        * platform/graphics/chromium/TreeSynchronizer.cpp:
+        (WebCore::TreeSynchronizer::reuseOrCreateCCLayerImpl):
+
 2012-03-22  Raphael Kubo da Costa  <rak...@freebsd.org>
 
         [CMake] Unreviewed build fix after r111778.

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h (111802 => 111803)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h	2012-03-23 01:25:10 UTC (rev 111802)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h	2012-03-23 01:42:35 UTC (rev 111803)
@@ -142,7 +142,9 @@
     void setScrollable(bool);
     void setShouldScrollOnMainThread(bool);
     void setHaveWheelEventHandlers(bool);
+    const Region& nonFastScrollableRegion() { return m_nonFastScrollableRegion; }
     void setNonFastScrollableRegion(const Region&);
+    void setNonFastScrollableRegionChanged() { m_nonFastScrollableRegionChanged = true; }
 
     IntSize scrollDelta() const { return IntSize(); }
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/TreeSynchronizer.cpp (111802 => 111803)


--- trunk/Source/WebCore/platform/graphics/chromium/TreeSynchronizer.cpp	2012-03-23 01:25:10 UTC (rev 111802)
+++ trunk/Source/WebCore/platform/graphics/chromium/TreeSynchronizer.cpp	2012-03-23 01:42:35 UTC (rev 111803)
@@ -71,8 +71,10 @@
 {
     OwnPtr<CCLayerImpl> ccLayerImpl = oldLayers.take(layer->id());
 
-    if (!ccLayerImpl)
+    if (!ccLayerImpl) {
         ccLayerImpl = layer->createCCLayerImpl();
+        layer->setNonFastScrollableRegionChanged(); // We just created a fresh CCLayerImpl, so make sure we transfer the nonFastScrollableRegion.
+    }
 
     newLayers.set(layer->id(), ccLayerImpl.get());
     return ccLayerImpl.release();

Modified: trunk/Source/WebKit/chromium/ChangeLog (111802 => 111803)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-03-23 01:25:10 UTC (rev 111802)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-03-23 01:42:35 UTC (rev 111803)
@@ -1,3 +1,15 @@
+2012-03-22  W. James MacLean  <wjmacl...@chromium.org>
+
+        [chromium] Force update of nonFastScrollableRegion if target CCLayerImpl has been freshly created.
+        https://bugs.webkit.org/show_bug.cgi?id=81968
+
+        Reviewed by Adrienne Walker.
+
+        * tests/TreeSynchronizerTest.cpp:
+        (WebKitTests::expectTreesAreIdentical):
+        (WebKitTests::TEST):
+        (WebKitTests):
+
 2012-03-22  Michal Mocny  <mmo...@google.com>
 
         [chromium] LayerRendererChromium should use GpuMemoryAllocationChanged callback to explicitly manage framebuffer.

Modified: trunk/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp (111802 => 111803)


--- trunk/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp	2012-03-23 01:25:10 UTC (rev 111802)
+++ trunk/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp	2012-03-23 01:42:35 UTC (rev 111803)
@@ -28,6 +28,7 @@
 
 #include "CCAnimationTestCommon.h"
 #include "LayerChromium.h"
+#include "Region.h"
 #include "cc/CCLayerAnimationController.h"
 #include "cc/CCLayerImpl.h"
 #include "cc/CCProxy.h"
@@ -126,6 +127,8 @@
 
     EXPECT_EQ(layer->id(), ccLayer->id());
 
+    EXPECT_EQ(layer->nonFastScrollableRegion(), ccLayer->nonFastScrollableRegion());
+
     ASSERT_EQ(!!layer->maskLayer(), !!ccLayer->maskLayer());
     if (layer->maskLayer())
         expectTreesAreIdentical(layer->maskLayer(), ccLayer->maskLayer());
@@ -194,6 +197,29 @@
     EXPECT_EQ(secondCCLayerId, ccLayerDestructionList[0]);
 }
 
+TEST(TreeSynchronizerTest, syncSimpleTreeWithNonFastScrollableRegionAndFreshLayer)
+{
+    DebugScopedSetImplThread impl;
+    Vector<int> ccLayerDestructionList;
+    Region testRegion(IntRect(0, 0, 1, 1));
+
+    RefPtr<LayerChromium> layerTreeRoot = MockLayerChromium::create(&ccLayerDestructionList);
+    layerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList));
+    layerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList));
+
+    // Create non-empty nonFastScrollableRegion in one of the children.
+    layerTreeRoot->children()[0]->setNonFastScrollableRegion(testRegion);
+
+    OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr);
+    expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get());
+
+    ccLayerTreeRoot->removeAllChildren(); // Force these to be re-created on next sync.
+
+    // Synchronize again. After the sync the trees should be equivalent and we should have re-created one CCLayerImpl that has a non-empty nonFastScrollableRegion.
+    ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release());
+    expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get());
+}
+
 TEST(TreeSynchronizerTest, syncSimpleTreeAndProperties)
 {
     DebugScopedSetImplThread impl;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to