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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 256303006: Make LayerScrollOffsetDelegate updates consistent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 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/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_impl_unittest.cc
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index a5ec7d09b0d188485a2df0251a0aeca0203eb351..1f1e2d0a62a0de49fa3af0594d100582b7987b89 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -3018,34 +3018,28 @@ class TestScrollOffsetDelegate : public LayerScrollOffsetDelegate {
virtual ~TestScrollOffsetDelegate() {}
- virtual void SetMaxScrollOffset(
- const gfx::Vector2dF& max_scroll_offset) OVERRIDE {
- max_scroll_offset_ = max_scroll_offset;
- }
-
- virtual void SetTotalScrollOffset(const gfx::Vector2dF& new_value) OVERRIDE {
- last_set_scroll_offset_ = new_value;
- }
-
virtual gfx::Vector2dF GetTotalScrollOffset() OVERRIDE {
return getter_return_value_;
}
virtual bool IsExternalFlingActive() const OVERRIDE { return false; }
- virtual void SetTotalPageScaleFactorAndLimits(
- float page_scale_factor,
- float min_page_scale_factor,
- float max_page_scale_factor) OVERRIDE {
+ virtual void UpdateRootLayerState(const gfx::Vector2dF& total_scroll_offset,
+ const gfx::Vector2dF& max_scroll_offset,
+ const gfx::SizeF& scrollable_size,
+ float page_scale_factor,
+ float min_page_scale_factor,
+ float max_page_scale_factor) OVERRIDE {
+ DCHECK(total_scroll_offset.x() <= max_scroll_offset.x());
+ DCHECK(total_scroll_offset.y() <= max_scroll_offset.y());
+ last_set_scroll_offset_ = total_scroll_offset;
+ max_scroll_offset_ = max_scroll_offset;
+ scrollable_size_ = scrollable_size;
page_scale_factor_ = page_scale_factor;
min_page_scale_factor_ = min_page_scale_factor;
max_page_scale_factor_ = max_page_scale_factor;
}
- virtual void SetScrollableSize(const gfx::SizeF& scrollable_size) OVERRIDE {
- scrollable_size_ = scrollable_size;
- }
-
gfx::Vector2dF last_set_scroll_offset() {
return last_set_scroll_offset_;
}
@@ -3122,6 +3116,16 @@ TEST_F(LayerTreeHostImplTest, RootLayerScrollOffsetDelegation) {
EXPECT_EQ(0.5f, scroll_delegate.min_page_scale_factor());
EXPECT_EQ(4.f, scroll_delegate.max_page_scale_factor());
+ // The pinch gesture doesn't put the delegate into a state where the scroll
+ // offset is outside of the scroll range. (this is verified by DCHECKs in the
+ // delegate).
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture);
+ host_impl_->PinchGestureBegin();
+ host_impl_->PinchGestureUpdate(2.f, gfx::Point());
+ host_impl_->PinchGestureUpdate(.5f, gfx::Point());
+ host_impl_->PinchGestureEnd();
+ host_impl_->ScrollEnd();
+
// Scrolling should be relative to the offset as returned by the delegate.
gfx::Vector2dF scroll_delta(0.f, 10.f);
gfx::Vector2dF current_offset(7.f, 8.f);
@@ -3140,6 +3144,7 @@ TEST_F(LayerTreeHostImplTest, RootLayerScrollOffsetDelegation) {
EXPECT_EQ(current_offset + scroll_delta,
scroll_delegate.last_set_scroll_offset());
host_impl_->ScrollEnd();
+ scroll_delegate.set_getter_return_value(gfx::Vector2dF());
// Forces a full tree synchronization and ensures that the scroll delegate
// sees the correct size of the new tree.
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698