Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4402)

Unified Diff: cc/trees/layer_tree_host_unittest_scroll.cc

Issue 18139004: cc: Create a LayerScrollClient interface and an adapter class in compositor_bindings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/layer.cc ('k') | webkit/renderer/compositor_bindings/web_layer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_unittest_scroll.cc
diff --git a/cc/trees/layer_tree_host_unittest_scroll.cc b/cc/trees/layer_tree_host_unittest_scroll.cc
index 8582d8f55a42a4bab09fee2324ec8da816b696ff..040fece714a6f3920a241b7afcd3caf959929f52 100644
--- a/cc/trees/layer_tree_host_unittest_scroll.cc
+++ b/cc/trees/layer_tree_host_unittest_scroll.cc
@@ -13,7 +13,6 @@
#include "cc/test/geometry_test_utils.h"
#include "cc/test/layer_tree_test.h"
#include "cc/trees/layer_tree_impl.h"
-#include "third_party/WebKit/public/platform/WebLayerScrollClient.h"
#include "ui/gfx/point_conversions.h"
#include "ui/gfx/size_conversions.h"
#include "ui/gfx/vector2d_conversions.h"
@@ -222,9 +221,7 @@ class LayerTreeHostScrollTestFractionalScroll : public LayerTreeHostScrollTest {
MULTI_THREAD_TEST_F(LayerTreeHostScrollTestFractionalScroll);
-class LayerTreeHostScrollTestCaseWithChild
- : public LayerTreeHostScrollTest,
- public WebKit::WebLayerScrollClient {
+class LayerTreeHostScrollTestCaseWithChild : public LayerTreeHostScrollTest {
public:
LayerTreeHostScrollTestCaseWithChild()
: initial_offset_(10, 20),
@@ -250,7 +247,9 @@ class LayerTreeHostScrollTestCaseWithChild
root_layer->AddChild(root_scroll_layer_);
child_layer_ = ContentLayer::Create(&fake_content_layer_client_);
- child_layer_->set_layer_scroll_client(this);
+ child_layer_->set_did_scroll_callback(
+ base::Bind(&LayerTreeHostScrollTestCaseWithChild::DidScroll,
+ base::Unretained(this)));
child_layer_->SetBounds(gfx::Size(110, 110));
// Scrolls on the child layer will happen at 5, 5. If they are treated
@@ -280,7 +279,7 @@ class LayerTreeHostScrollTestCaseWithChild
virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
- virtual void didScroll() OVERRIDE {
+ void DidScroll() {
final_scroll_offset_ = expected_scroll_layer_->scroll_offset();
}
@@ -800,16 +799,16 @@ class LayerTreeHostScrollTestLayerStructureChange
}
protected:
- class FakeWebLayerScrollClient : public WebKit::WebLayerScrollClient {
+ class FakeLayerScrollClient {
danakj 2013/06/28 16:06:54 Can this class just go away here, and we set the c
tfarina 2013/06/28 16:13:33 I'll try this when I get back to home later tonigh
danakj 2013/06/28 16:46:43 Oh, that's true. LGTM
public:
- virtual void didScroll() OVERRIDE {
+ void DidScroll() {
owner_->DidScroll(layer_);
}
LayerTreeHostScrollTestLayerStructureChange* owner_;
Layer* layer_;
};
- Layer* CreateScrollLayer(Layer* parent, FakeWebLayerScrollClient* client) {
+ Layer* CreateScrollLayer(Layer* parent, FakeLayerScrollClient* client) {
scoped_refptr<Layer> scroll_layer =
ContentLayer::Create(&fake_content_layer_client_);
scroll_layer->SetBounds(gfx::Size(110, 110));
@@ -818,16 +817,17 @@ class LayerTreeHostScrollTestLayerStructureChange
scroll_layer->SetIsDrawable(true);
scroll_layer->SetScrollable(true);
scroll_layer->SetMaxScrollOffset(gfx::Vector2d(100, 100));
- scroll_layer->set_layer_scroll_client(client);
+ scroll_layer->set_did_scroll_callback(base::Bind(
+ &FakeLayerScrollClient::DidScroll, base::Unretained(client)));
client->owner_ = this;
client->layer_ = scroll_layer.get();
parent->AddChild(scroll_layer);
return scroll_layer.get();
}
- FakeWebLayerScrollClient root_scroll_layer_client_;
- FakeWebLayerScrollClient sibling_scroll_layer_client_;
- FakeWebLayerScrollClient child_scroll_layer_client_;
+ FakeLayerScrollClient root_scroll_layer_client_;
+ FakeLayerScrollClient sibling_scroll_layer_client_;
+ FakeLayerScrollClient child_scroll_layer_client_;
FakeContentLayerClient fake_content_layer_client_;
« no previous file with comments | « cc/layers/layer.cc ('k') | webkit/renderer/compositor_bindings/web_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698