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

Side by Side Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 2931703002: Don't fade in overlay scrollbar when user interacting the content under scrollbar. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 3052 matching lines...) Expand 10 before | Expand all | Expand 10 after
3063 host_impl_->active_tree()->LayerById(400); 3063 host_impl_->active_tree()->LayerById(400);
3064 3064
3065 EffectNode* active_tree_node = 3065 EffectNode* active_tree_node =
3066 host_impl_->active_tree()->property_trees()->effect_tree.Node( 3066 host_impl_->active_tree()->property_trees()->effect_tree.Node(
3067 active_scrollbar_layer->effect_tree_index()); 3067 active_scrollbar_layer->effect_tree_index());
3068 EXPECT_FLOAT_EQ(active_scrollbar_layer->Opacity(), 3068 EXPECT_FLOAT_EQ(active_scrollbar_layer->Opacity(),
3069 active_tree_node->opacity); 3069 active_tree_node->opacity);
3070 3070
3071 if (expecting_animations) { 3071 if (expecting_animations) {
3072 host_impl_->ScrollbarAnimationControllerForElementId(scroll->element_id()) 3072 host_impl_->ScrollbarAnimationControllerForElementId(scroll->element_id())
3073 ->DidMouseMove(gfx::PointF(0, 90)); 3073 ->DidMouseMove(gfx::PointF(0, 90), false);
3074 } else { 3074 } else {
3075 EXPECT_EQ(nullptr, host_impl_->ScrollbarAnimationControllerForElementId( 3075 EXPECT_EQ(nullptr, host_impl_->ScrollbarAnimationControllerForElementId(
3076 scroll->element_id())); 3076 scroll->element_id()));
3077 } 3077 }
3078 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), 3078 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
3079 InputHandler::WHEEL); 3079 InputHandler::WHEEL);
3080 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2dF(0, 5)).get()); 3080 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2dF(0, 5)).get());
3081 host_impl_->ScrollEnd(EndState().get()); 3081 host_impl_->ScrollEnd(EndState().get());
3082 host_impl_->CreatePendingTree(); 3082 host_impl_->CreatePendingTree();
3083 // To test the case where the effect tree index of scrollbar layer changes, 3083 // To test the case where the effect tree index of scrollbar layer changes,
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
3168 fake_now += settings.scrollbar_fade_delay; 3168 fake_now += settings.scrollbar_fade_delay;
3169 scrollbar_controller->Animate(fake_now); 3169 scrollbar_controller->Animate(fake_now);
3170 3170
3171 ASSERT_TRUE(scrollbar_controller->ScrollbarsHidden()); 3171 ASSERT_TRUE(scrollbar_controller->ScrollbarsHidden());
3172 } 3172 }
3173 3173
3174 // Move the mouse over the scrollbar region. This should post a delayed fade 3174 // Move the mouse over the scrollbar region. This should post a delayed fade
3175 // in task. Execute it to fade in the scrollbars. 3175 // in task. Execute it to fade in the scrollbars.
3176 { 3176 {
3177 animation_task_ = base::Closure(); 3177 animation_task_ = base::Closure();
3178 scrollbar_controller->DidMouseMove(gfx::PointF(90, 0)); 3178 scrollbar_controller->DidMouseMove(gfx::PointF(90, 0), false);
3179 ASSERT_FALSE(animation_task_.Equals(base::Closure())); 3179 ASSERT_FALSE(animation_task_.Equals(base::Closure()));
3180 ASSERT_FALSE(animation_task_.IsCancelled()); 3180 ASSERT_FALSE(animation_task_.IsCancelled());
3181 } 3181 }
3182 3182
3183 // The fade in task should cause the scrollbars to show. Ensure that we 3183 // The fade in task should cause the scrollbars to show. Ensure that we
3184 // requested a redraw and a commit. 3184 // requested a redraw and a commit.
3185 { 3185 {
3186 did_request_redraw_ = false; 3186 did_request_redraw_ = false;
3187 did_request_commit_ = false; 3187 did_request_commit_ = false;
3188 ASSERT_TRUE(scrollbar_controller->ScrollbarsHidden()); 3188 ASSERT_TRUE(scrollbar_controller->ScrollbarsHidden());
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
3416 host_impl_->ScrollbarAnimationControllerForElementId( 3416 host_impl_->ScrollbarAnimationControllerForElementId(
3417 root_scroll->element_id()); 3417 root_scroll->element_id());
3418 3418
3419 const float kMouseMoveDistanceToTriggerFadeIn = 3419 const float kMouseMoveDistanceToTriggerFadeIn =
3420 ScrollbarAnimationController::kMouseMoveDistanceToTriggerFadeIn; 3420 ScrollbarAnimationController::kMouseMoveDistanceToTriggerFadeIn;
3421 3421
3422 const float kMouseMoveDistanceToTriggerExpand = 3422 const float kMouseMoveDistanceToTriggerExpand =
3423 SingleScrollbarAnimationControllerThinning:: 3423 SingleScrollbarAnimationControllerThinning::
3424 kMouseMoveDistanceToTriggerExpand; 3424 kMouseMoveDistanceToTriggerExpand;
3425 3425
3426 host_impl_->MouseMoveAt( 3426 host_impl_->MouseMoveAt(gfx::Point(15 + kMouseMoveDistanceToTriggerFadeIn, 1),
3427 gfx::Point(15 + kMouseMoveDistanceToTriggerFadeIn, 1)); 3427 false);
3428 EXPECT_FALSE(scrollbar_animation_controller->MouseIsNearScrollbar(VERTICAL)); 3428 EXPECT_FALSE(scrollbar_animation_controller->MouseIsNearScrollbar(VERTICAL));
3429 EXPECT_FALSE( 3429 EXPECT_FALSE(
3430 scrollbar_animation_controller->MouseIsNearScrollbarThumb(VERTICAL)); 3430 scrollbar_animation_controller->MouseIsNearScrollbarThumb(VERTICAL));
3431 3431
3432 host_impl_->MouseMoveAt( 3432 host_impl_->MouseMoveAt(
3433 gfx::Point(15 + kMouseMoveDistanceToTriggerExpand - 1, 10)); 3433 gfx::Point(15 + kMouseMoveDistanceToTriggerExpand - 1, 10), false);
3434 EXPECT_TRUE(scrollbar_animation_controller->MouseIsNearScrollbar(VERTICAL)); 3434 EXPECT_TRUE(scrollbar_animation_controller->MouseIsNearScrollbar(VERTICAL));
3435 EXPECT_TRUE( 3435 EXPECT_TRUE(
3436 scrollbar_animation_controller->MouseIsNearScrollbarThumb(VERTICAL)); 3436 scrollbar_animation_controller->MouseIsNearScrollbarThumb(VERTICAL));
3437 3437
3438 host_impl_->MouseMoveAt( 3438 host_impl_->MouseMoveAt(
3439 gfx::Point(15 + kMouseMoveDistanceToTriggerFadeIn, 100)); 3439 gfx::Point(15 + kMouseMoveDistanceToTriggerFadeIn, 100), false);
3440 EXPECT_FALSE(scrollbar_animation_controller->MouseIsNearScrollbar(VERTICAL)); 3440 EXPECT_FALSE(scrollbar_animation_controller->MouseIsNearScrollbar(VERTICAL));
3441 EXPECT_FALSE( 3441 EXPECT_FALSE(
3442 scrollbar_animation_controller->MouseIsNearScrollbarThumb(VERTICAL)); 3442 scrollbar_animation_controller->MouseIsNearScrollbarThumb(VERTICAL));
3443 3443
3444 did_request_redraw_ = false; 3444 did_request_redraw_ = false;
3445 EXPECT_FALSE( 3445 EXPECT_FALSE(
3446 scrollbar_animation_controller->MouseIsOverScrollbarThumb(VERTICAL)); 3446 scrollbar_animation_controller->MouseIsOverScrollbarThumb(VERTICAL));
3447 host_impl_->MouseMoveAt(gfx::Point(10, 10)); 3447 host_impl_->MouseMoveAt(gfx::Point(10, 10), false);
3448 EXPECT_TRUE( 3448 EXPECT_TRUE(
3449 scrollbar_animation_controller->MouseIsOverScrollbarThumb(VERTICAL)); 3449 scrollbar_animation_controller->MouseIsOverScrollbarThumb(VERTICAL));
3450 host_impl_->MouseMoveAt(gfx::Point(10, 0)); 3450 host_impl_->MouseMoveAt(gfx::Point(10, 0), false);
3451 EXPECT_TRUE( 3451 EXPECT_TRUE(
3452 scrollbar_animation_controller->MouseIsOverScrollbarThumb(VERTICAL)); 3452 scrollbar_animation_controller->MouseIsOverScrollbarThumb(VERTICAL));
3453 host_impl_->MouseMoveAt(gfx::Point(150, 120)); 3453 host_impl_->MouseMoveAt(gfx::Point(150, 120), false);
3454 EXPECT_FALSE( 3454 EXPECT_FALSE(
3455 scrollbar_animation_controller->MouseIsOverScrollbarThumb(VERTICAL)); 3455 scrollbar_animation_controller->MouseIsOverScrollbarThumb(VERTICAL));
3456 } 3456 }
3457 3457
3458 TEST_F(LayerTreeHostImplTest, MouseMoveAtWithDeviceScaleOf1) { 3458 TEST_F(LayerTreeHostImplTest, MouseMoveAtWithDeviceScaleOf1) {
3459 SetupMouseMoveAtWithDeviceScale(1.f); 3459 SetupMouseMoveAtWithDeviceScale(1.f);
3460 } 3460 }
3461 3461
3462 TEST_F(LayerTreeHostImplTest, MouseMoveAtWithDeviceScaleOf2) { 3462 TEST_F(LayerTreeHostImplTest, MouseMoveAtWithDeviceScaleOf2) {
3463 SetupMouseMoveAtWithDeviceScale(2.f); 3463 SetupMouseMoveAtWithDeviceScale(2.f);
(...skipping 8792 matching lines...) Expand 10 before | Expand all | Expand 10 after
12256 12256
12257 const float kMouseMoveDistanceToTriggerFadeIn = 12257 const float kMouseMoveDistanceToTriggerFadeIn =
12258 ScrollbarAnimationController::kMouseMoveDistanceToTriggerFadeIn; 12258 ScrollbarAnimationController::kMouseMoveDistanceToTriggerFadeIn;
12259 12259
12260 const float kMouseMoveDistanceToTriggerExpand = 12260 const float kMouseMoveDistanceToTriggerExpand =
12261 SingleScrollbarAnimationControllerThinning:: 12261 SingleScrollbarAnimationControllerThinning::
12262 kMouseMoveDistanceToTriggerExpand; 12262 kMouseMoveDistanceToTriggerExpand;
12263 12263
12264 // Mouse moves close to the scrollbar, goes over the scrollbar, and 12264 // Mouse moves close to the scrollbar, goes over the scrollbar, and
12265 // moves back to where it was. 12265 // moves back to where it was.
12266 host_impl_->MouseMoveAt( 12266 host_impl_->MouseMoveAt(gfx::Point(15 + kMouseMoveDistanceToTriggerFadeIn, 0),
12267 gfx::Point(15 + kMouseMoveDistanceToTriggerFadeIn, 0)); 12267 false);
12268 EXPECT_FALSE( 12268 EXPECT_FALSE(
12269 scrollbar_1_animation_controller->MouseIsNearScrollbar(VERTICAL)); 12269 scrollbar_1_animation_controller->MouseIsNearScrollbar(VERTICAL));
12270 EXPECT_FALSE( 12270 EXPECT_FALSE(
12271 scrollbar_1_animation_controller->MouseIsNearScrollbarThumb(VERTICAL)); 12271 scrollbar_1_animation_controller->MouseIsNearScrollbarThumb(VERTICAL));
12272 EXPECT_FALSE( 12272 EXPECT_FALSE(
12273 scrollbar_1_animation_controller->MouseIsOverScrollbarThumb(VERTICAL)); 12273 scrollbar_1_animation_controller->MouseIsOverScrollbarThumb(VERTICAL));
12274 12274
12275 host_impl_->MouseMoveAt( 12275 host_impl_->MouseMoveAt(gfx::Point(15 + kMouseMoveDistanceToTriggerExpand, 0),
12276 gfx::Point(15 + kMouseMoveDistanceToTriggerExpand, 0)); 12276 false);
12277 EXPECT_TRUE(scrollbar_1_animation_controller->MouseIsNearScrollbar(VERTICAL)); 12277 EXPECT_TRUE(scrollbar_1_animation_controller->MouseIsNearScrollbar(VERTICAL));
12278 EXPECT_FALSE( 12278 EXPECT_FALSE(
12279 scrollbar_1_animation_controller->MouseIsNearScrollbarThumb(VERTICAL)); 12279 scrollbar_1_animation_controller->MouseIsNearScrollbarThumb(VERTICAL));
12280 EXPECT_FALSE( 12280 EXPECT_FALSE(
12281 scrollbar_1_animation_controller->MouseIsOverScrollbarThumb(VERTICAL)); 12281 scrollbar_1_animation_controller->MouseIsOverScrollbarThumb(VERTICAL));
12282 12282
12283 host_impl_->MouseMoveAt( 12283 host_impl_->MouseMoveAt(gfx::Point(14 + kMouseMoveDistanceToTriggerExpand, 0),
12284 gfx::Point(14 + kMouseMoveDistanceToTriggerExpand, 0)); 12284 false);
12285 EXPECT_TRUE(scrollbar_1_animation_controller->MouseIsNearScrollbar(VERTICAL)); 12285 EXPECT_TRUE(scrollbar_1_animation_controller->MouseIsNearScrollbar(VERTICAL));
12286 EXPECT_TRUE( 12286 EXPECT_TRUE(
12287 scrollbar_1_animation_controller->MouseIsNearScrollbarThumb(VERTICAL)); 12287 scrollbar_1_animation_controller->MouseIsNearScrollbarThumb(VERTICAL));
12288 EXPECT_FALSE( 12288 EXPECT_FALSE(
12289 scrollbar_1_animation_controller->MouseIsOverScrollbarThumb(VERTICAL)); 12289 scrollbar_1_animation_controller->MouseIsOverScrollbarThumb(VERTICAL));
12290 12290
12291 host_impl_->MouseMoveAt(gfx::Point(10, 0)); 12291 host_impl_->MouseMoveAt(gfx::Point(10, 0), false);
12292 EXPECT_TRUE(scrollbar_1_animation_controller->MouseIsNearScrollbar(VERTICAL)); 12292 EXPECT_TRUE(scrollbar_1_animation_controller->MouseIsNearScrollbar(VERTICAL));
12293 EXPECT_TRUE( 12293 EXPECT_TRUE(
12294 scrollbar_1_animation_controller->MouseIsNearScrollbarThumb(VERTICAL)); 12294 scrollbar_1_animation_controller->MouseIsNearScrollbarThumb(VERTICAL));
12295 EXPECT_TRUE( 12295 EXPECT_TRUE(
12296 scrollbar_1_animation_controller->MouseIsOverScrollbarThumb(VERTICAL)); 12296 scrollbar_1_animation_controller->MouseIsOverScrollbarThumb(VERTICAL));
12297 12297
12298 host_impl_->MouseMoveAt( 12298 host_impl_->MouseMoveAt(gfx::Point(14 + kMouseMoveDistanceToTriggerExpand, 0),
12299 gfx::Point(14 + kMouseMoveDistanceToTriggerExpand, 0)); 12299 false);
12300 EXPECT_TRUE(scrollbar_1_animation_controller->MouseIsNearScrollbar(VERTICAL)); 12300 EXPECT_TRUE(scrollbar_1_animation_controller->MouseIsNearScrollbar(VERTICAL));
12301 EXPECT_TRUE( 12301 EXPECT_TRUE(
12302 scrollbar_1_animation_controller->MouseIsNearScrollbarThumb(VERTICAL)); 12302 scrollbar_1_animation_controller->MouseIsNearScrollbarThumb(VERTICAL));
12303 EXPECT_FALSE( 12303 EXPECT_FALSE(
12304 scrollbar_1_animation_controller->MouseIsOverScrollbarThumb(VERTICAL)); 12304 scrollbar_1_animation_controller->MouseIsOverScrollbarThumb(VERTICAL));
12305 12305
12306 host_impl_->MouseMoveAt( 12306 host_impl_->MouseMoveAt(gfx::Point(15 + kMouseMoveDistanceToTriggerExpand, 0),
12307 gfx::Point(15 + kMouseMoveDistanceToTriggerExpand, 0)); 12307 false);
12308 EXPECT_TRUE(scrollbar_1_animation_controller->MouseIsNearScrollbar(VERTICAL)); 12308 EXPECT_TRUE(scrollbar_1_animation_controller->MouseIsNearScrollbar(VERTICAL));
12309 EXPECT_FALSE( 12309 EXPECT_FALSE(
12310 scrollbar_1_animation_controller->MouseIsNearScrollbarThumb(VERTICAL)); 12310 scrollbar_1_animation_controller->MouseIsNearScrollbarThumb(VERTICAL));
12311 EXPECT_FALSE( 12311 EXPECT_FALSE(
12312 scrollbar_1_animation_controller->MouseIsOverScrollbarThumb(VERTICAL)); 12312 scrollbar_1_animation_controller->MouseIsOverScrollbarThumb(VERTICAL));
12313 12313
12314 host_impl_->MouseMoveAt( 12314 host_impl_->MouseMoveAt(gfx::Point(15 + kMouseMoveDistanceToTriggerFadeIn, 0),
12315 gfx::Point(15 + kMouseMoveDistanceToTriggerFadeIn, 0)); 12315 false);
12316 EXPECT_FALSE( 12316 EXPECT_FALSE(
12317 scrollbar_1_animation_controller->MouseIsNearScrollbar(VERTICAL)); 12317 scrollbar_1_animation_controller->MouseIsNearScrollbar(VERTICAL));
12318 EXPECT_FALSE( 12318 EXPECT_FALSE(
12319 scrollbar_1_animation_controller->MouseIsNearScrollbarThumb(VERTICAL)); 12319 scrollbar_1_animation_controller->MouseIsNearScrollbarThumb(VERTICAL));
12320 EXPECT_FALSE( 12320 EXPECT_FALSE(
12321 scrollbar_1_animation_controller->MouseIsOverScrollbarThumb(VERTICAL)); 12321 scrollbar_1_animation_controller->MouseIsOverScrollbarThumb(VERTICAL));
12322 12322
12323 // scrollbar_2 on child. 12323 // scrollbar_2 on child.
12324 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar_2 = 12324 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar_2 =
12325 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), 12325 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(),
(...skipping 28 matching lines...) Expand all
12354 host_impl_->active_tree()->BuildPropertyTreesForTesting(); 12354 host_impl_->active_tree()->BuildPropertyTreesForTesting();
12355 host_impl_->active_tree()->UpdateScrollbarGeometries(); 12355 host_impl_->active_tree()->UpdateScrollbarGeometries();
12356 host_impl_->active_tree()->DidBecomeActive(); 12356 host_impl_->active_tree()->DidBecomeActive();
12357 12357
12358 ScrollbarAnimationController* scrollbar_2_animation_controller = 12358 ScrollbarAnimationController* scrollbar_2_animation_controller =
12359 host_impl_->ScrollbarAnimationControllerForElementId(child_element_id); 12359 host_impl_->ScrollbarAnimationControllerForElementId(child_element_id);
12360 EXPECT_TRUE(scrollbar_2_animation_controller); 12360 EXPECT_TRUE(scrollbar_2_animation_controller);
12361 12361
12362 // Mouse goes over scrollbar_2, moves close to scrollbar_2, moves close to 12362 // Mouse goes over scrollbar_2, moves close to scrollbar_2, moves close to
12363 // scrollbar_1, goes over scrollbar_1. 12363 // scrollbar_1, goes over scrollbar_1.
12364 host_impl_->MouseMoveAt(gfx::Point(60, 60)); 12364 host_impl_->MouseMoveAt(gfx::Point(60, 60), false);
12365 EXPECT_FALSE( 12365 EXPECT_FALSE(
12366 scrollbar_1_animation_controller->MouseIsNearScrollbar(VERTICAL)); 12366 scrollbar_1_animation_controller->MouseIsNearScrollbar(VERTICAL));
12367 EXPECT_FALSE( 12367 EXPECT_FALSE(
12368 scrollbar_1_animation_controller->MouseIsNearScrollbarThumb(VERTICAL)); 12368 scrollbar_1_animation_controller->MouseIsNearScrollbarThumb(VERTICAL));
12369 EXPECT_FALSE( 12369 EXPECT_FALSE(
12370 scrollbar_1_animation_controller->MouseIsOverScrollbarThumb(VERTICAL)); 12370 scrollbar_1_animation_controller->MouseIsOverScrollbarThumb(VERTICAL));
12371 EXPECT_TRUE(scrollbar_2_animation_controller->MouseIsNearScrollbar(VERTICAL)); 12371 EXPECT_TRUE(scrollbar_2_animation_controller->MouseIsNearScrollbar(VERTICAL));
12372 EXPECT_TRUE( 12372 EXPECT_TRUE(
12373 scrollbar_2_animation_controller->MouseIsNearScrollbarThumb(VERTICAL)); 12373 scrollbar_2_animation_controller->MouseIsNearScrollbarThumb(VERTICAL));
12374 EXPECT_TRUE( 12374 EXPECT_TRUE(
12375 scrollbar_2_animation_controller->MouseIsOverScrollbarThumb(VERTICAL)); 12375 scrollbar_2_animation_controller->MouseIsOverScrollbarThumb(VERTICAL));
12376 12376
12377 host_impl_->MouseMoveAt( 12377 host_impl_->MouseMoveAt(
12378 gfx::Point(64 + kMouseMoveDistanceToTriggerExpand, 50)); 12378 gfx::Point(64 + kMouseMoveDistanceToTriggerExpand, 50), false);
12379 EXPECT_FALSE( 12379 EXPECT_FALSE(
12380 scrollbar_1_animation_controller->MouseIsNearScrollbar(VERTICAL)); 12380 scrollbar_1_animation_controller->MouseIsNearScrollbar(VERTICAL));
12381 EXPECT_FALSE( 12381 EXPECT_FALSE(
12382 scrollbar_1_animation_controller->MouseIsNearScrollbarThumb(VERTICAL)); 12382 scrollbar_1_animation_controller->MouseIsNearScrollbarThumb(VERTICAL));
12383 EXPECT_FALSE( 12383 EXPECT_FALSE(
12384 scrollbar_1_animation_controller->MouseIsOverScrollbarThumb(VERTICAL)); 12384 scrollbar_1_animation_controller->MouseIsOverScrollbarThumb(VERTICAL));
12385 EXPECT_TRUE(scrollbar_2_animation_controller->MouseIsNearScrollbar(VERTICAL)); 12385 EXPECT_TRUE(scrollbar_2_animation_controller->MouseIsNearScrollbar(VERTICAL));
12386 EXPECT_TRUE( 12386 EXPECT_TRUE(
12387 scrollbar_2_animation_controller->MouseIsNearScrollbarThumb(VERTICAL)); 12387 scrollbar_2_animation_controller->MouseIsNearScrollbarThumb(VERTICAL));
12388 EXPECT_FALSE( 12388 EXPECT_FALSE(
12389 scrollbar_2_animation_controller->MouseIsOverScrollbarThumb(VERTICAL)); 12389 scrollbar_2_animation_controller->MouseIsOverScrollbarThumb(VERTICAL));
12390 host_impl_->MouseMoveAt( 12390 host_impl_->MouseMoveAt(gfx::Point(14 + kMouseMoveDistanceToTriggerExpand, 0),
12391 gfx::Point(14 + kMouseMoveDistanceToTriggerExpand, 0)); 12391 false);
12392 EXPECT_TRUE(scrollbar_1_animation_controller->MouseIsNearScrollbar(VERTICAL)); 12392 EXPECT_TRUE(scrollbar_1_animation_controller->MouseIsNearScrollbar(VERTICAL));
12393 EXPECT_TRUE( 12393 EXPECT_TRUE(
12394 scrollbar_1_animation_controller->MouseIsNearScrollbarThumb(VERTICAL)); 12394 scrollbar_1_animation_controller->MouseIsNearScrollbarThumb(VERTICAL));
12395 EXPECT_FALSE( 12395 EXPECT_FALSE(
12396 scrollbar_1_animation_controller->MouseIsOverScrollbarThumb(VERTICAL)); 12396 scrollbar_1_animation_controller->MouseIsOverScrollbarThumb(VERTICAL));
12397 EXPECT_FALSE( 12397 EXPECT_FALSE(
12398 scrollbar_2_animation_controller->MouseIsNearScrollbar(VERTICAL)); 12398 scrollbar_2_animation_controller->MouseIsNearScrollbar(VERTICAL));
12399 EXPECT_FALSE( 12399 EXPECT_FALSE(
12400 scrollbar_2_animation_controller->MouseIsNearScrollbarThumb(VERTICAL)); 12400 scrollbar_2_animation_controller->MouseIsNearScrollbarThumb(VERTICAL));
12401 EXPECT_FALSE( 12401 EXPECT_FALSE(
12402 scrollbar_2_animation_controller->MouseIsOverScrollbarThumb(VERTICAL)); 12402 scrollbar_2_animation_controller->MouseIsOverScrollbarThumb(VERTICAL));
12403 host_impl_->MouseMoveAt(gfx::Point(10, 0)); 12403 host_impl_->MouseMoveAt(gfx::Point(10, 0), false);
12404 EXPECT_TRUE(scrollbar_1_animation_controller->MouseIsNearScrollbar(VERTICAL)); 12404 EXPECT_TRUE(scrollbar_1_animation_controller->MouseIsNearScrollbar(VERTICAL));
12405 EXPECT_TRUE( 12405 EXPECT_TRUE(
12406 scrollbar_1_animation_controller->MouseIsNearScrollbarThumb(VERTICAL)); 12406 scrollbar_1_animation_controller->MouseIsNearScrollbarThumb(VERTICAL));
12407 EXPECT_TRUE( 12407 EXPECT_TRUE(
12408 scrollbar_1_animation_controller->MouseIsOverScrollbarThumb(VERTICAL)); 12408 scrollbar_1_animation_controller->MouseIsOverScrollbarThumb(VERTICAL));
12409 EXPECT_FALSE( 12409 EXPECT_FALSE(
12410 scrollbar_2_animation_controller->MouseIsNearScrollbar(VERTICAL)); 12410 scrollbar_2_animation_controller->MouseIsNearScrollbar(VERTICAL));
12411 EXPECT_FALSE( 12411 EXPECT_FALSE(
12412 scrollbar_2_animation_controller->MouseIsNearScrollbarThumb(VERTICAL)); 12412 scrollbar_2_animation_controller->MouseIsNearScrollbarThumb(VERTICAL));
12413 EXPECT_FALSE( 12413 EXPECT_FALSE(
12414 scrollbar_2_animation_controller->MouseIsOverScrollbarThumb(VERTICAL)); 12414 scrollbar_2_animation_controller->MouseIsOverScrollbarThumb(VERTICAL));
12415 12415
12416 // Capture scrollbar_1, then move mouse to scrollbar_2's layer, should post an 12416 // Capture scrollbar_1, then move mouse to scrollbar_2's layer, should post an
12417 // event to fade out scrollbar_1. 12417 // event to fade out scrollbar_1.
12418 scrollbar_1_animation_controller->DidScrollUpdate(); 12418 scrollbar_1_animation_controller->DidScrollUpdate();
12419 animation_task_ = base::Closure(); 12419 animation_task_ = base::Closure();
12420 12420
12421 host_impl_->MouseDown(); 12421 host_impl_->MouseDown();
12422 host_impl_->MouseMoveAt(gfx::Point(60, 50)); 12422 host_impl_->MouseMoveAt(gfx::Point(60, 50), false);
12423 host_impl_->MouseUp(); 12423 host_impl_->MouseUp();
12424 12424
12425 EXPECT_FALSE(animation_task_.Equals(base::Closure())); 12425 EXPECT_FALSE(animation_task_.Equals(base::Closure()));
12426 12426
12427 // Near scrollbar_1, then mouse down and up, should not post an event to fade 12427 // Near scrollbar_1, then mouse down and up, should not post an event to fade
12428 // out scrollbar_1. 12428 // out scrollbar_1.
12429 host_impl_->MouseMoveAt(gfx::Point(40, 150)); 12429 host_impl_->MouseMoveAt(gfx::Point(40, 150), false);
12430 animation_task_ = base::Closure(); 12430 animation_task_ = base::Closure();
12431 12431
12432 host_impl_->MouseDown(); 12432 host_impl_->MouseDown();
12433 host_impl_->MouseUp(); 12433 host_impl_->MouseUp();
12434 EXPECT_TRUE(animation_task_.Equals(base::Closure())); 12434 EXPECT_TRUE(animation_task_.Equals(base::Closure()));
12435 12435
12436 // Near scrollbar_1, then mouse down and unregister 12436 // Near scrollbar_1, then mouse down and unregister
12437 // scrollbar_2_animation_controller, then mouse up should not cause crash. 12437 // scrollbar_2_animation_controller, then mouse up should not cause crash.
12438 host_impl_->MouseMoveAt(gfx::Point(40, 150)); 12438 host_impl_->MouseMoveAt(gfx::Point(40, 150), false);
12439 host_impl_->MouseDown(); 12439 host_impl_->MouseDown();
12440 host_impl_->UnregisterScrollbarAnimationController(root_scroll->element_id()); 12440 host_impl_->UnregisterScrollbarAnimationController(root_scroll->element_id());
12441 host_impl_->MouseUp(); 12441 host_impl_->MouseUp();
12442 } 12442 }
12443 12443
12444 TEST_F(LayerTreeHostImplTest, 12444 TEST_F(LayerTreeHostImplTest,
12445 LayerTreeHostImplTestScrollbarStatesInMainThreadScrolling) { 12445 LayerTreeHostImplTestScrollbarStatesInMainThreadScrolling) {
12446 SetupMouseMoveAtTestScrollbarStates(true); 12446 SetupMouseMoveAtTestScrollbarStates(true);
12447 } 12447 }
12448 12448
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
12665 // layer should be prioritized over the hidden layer. 12665 // layer should be prioritized over the hidden layer.
12666 hidden_layer->set_contributes_to_drawn_render_surface(false); 12666 hidden_layer->set_contributes_to_drawn_render_surface(false);
12667 hidden_layer->set_raster_even_if_not_drawn(true); 12667 hidden_layer->set_raster_even_if_not_drawn(true);
12668 queue = host_impl_->BuildRasterQueue(TreePriority::SMOOTHNESS_TAKES_PRIORITY, 12668 queue = host_impl_->BuildRasterQueue(TreePriority::SMOOTHNESS_TAKES_PRIORITY,
12669 RasterTilePriorityQueue::Type::ALL); 12669 RasterTilePriorityQueue::Type::ALL);
12670 EXPECT_EQ(queue->Top().tile()->layer_id(), 3); 12670 EXPECT_EQ(queue->Top().tile()->layer_id(), 3);
12671 } 12671 }
12672 12672
12673 } // namespace 12673 } // namespace
12674 } // namespace cc 12674 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698