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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 206153002: Avoid unnecessary gloweffect calls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changes made for complier warnings Created 6 years, 9 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') | no next file » | 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 37f2cd551c368aeed47343097219b9e62fc28553..59d819b29ade4c96e8078fd3336472ca2a79718a 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -3162,6 +3162,42 @@ TEST_F(LayerTreeHostImplTest, OverscrollAlways) {
EXPECT_EQ(gfx::Vector2dF(), host_impl_->current_fling_velocity());
}
+TEST_F(LayerTreeHostImplTest, UnnecessaryGlowEffectCallsWhileScrollingUp) {
+ // Edge glow effect should be applicable only upon reaching Edges
+ // of the content. unnecessary glow effect calls shouldn't be
+ // called while scrolling up without reaching the edge of the content.
+ gfx::Size surface_size(100, 100);
+ gfx::Size content_size(200, 200);
+ scoped_ptr<LayerImpl> root_clip =
+ LayerImpl::Create(host_impl_->active_tree(), 3);
+ scoped_ptr<LayerImpl> root =
+ CreateScrollableLayer(1, content_size, root_clip.get());
+ root->SetIsContainerForFixedPositionLayers(true);
+ scoped_ptr<LayerImpl> child =
+ CreateScrollableLayer(2, content_size, root_clip.get());
+
+ child->SetScrollClipLayer(Layer::INVALID_ID);
+ root->AddChild(child.Pass());
+ root_clip->AddChild(root.Pass());
+
+ host_impl_->SetViewportSize(surface_size);
+ host_impl_->active_tree()->SetRootLayer(root_clip.Pass());
+ host_impl_->active_tree()->SetViewportLayersFromIds(3, 1, Layer::INVALID_ID);
+ host_impl_->active_tree()->DidBecomeActive();
+ DrawFrame();
+ {
+ EXPECT_EQ(InputHandler::ScrollStarted,
+ host_impl_->ScrollBegin(gfx::Point(0, 0), InputHandler::Wheel));
+ host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, 100));
+ EXPECT_EQ(gfx::Vector2dF().ToString(),
+ host_impl_->accumulated_root_overscroll().ToString());
+ host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, -2.30f));
+ EXPECT_EQ(gfx::Vector2dF().ToString(),
+ host_impl_->accumulated_root_overscroll().ToString());
+ host_impl_->ScrollEnd();
+ }
+}
+
class BlendStateCheckLayer : public LayerImpl {
public:
static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl,
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698