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

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

Issue 2358323003: Keep expanded if mouse moves off of scrollbar while dragging (Closed)
Patch Set: fix style and check left button Created 4 years, 3 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 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 resourceless_software_draw_(false), 233 resourceless_software_draw_(false),
234 animation_host_(std::move(animation_host)), 234 animation_host_(std::move(animation_host)),
235 rendering_stats_instrumentation_(rendering_stats_instrumentation), 235 rendering_stats_instrumentation_(rendering_stats_instrumentation),
236 micro_benchmark_controller_(this), 236 micro_benchmark_controller_(this),
237 shared_bitmap_manager_(shared_bitmap_manager), 237 shared_bitmap_manager_(shared_bitmap_manager),
238 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), 238 gpu_memory_buffer_manager_(gpu_memory_buffer_manager),
239 task_graph_runner_(task_graph_runner), 239 task_graph_runner_(task_graph_runner),
240 id_(id), 240 id_(id),
241 requires_high_res_to_draw_(false), 241 requires_high_res_to_draw_(false),
242 is_likely_to_require_a_draw_(false), 242 is_likely_to_require_a_draw_(false),
243 mutator_(nullptr) { 243 mutator_(nullptr),
244 captured_scrollbar_layer_id_(Layer::INVALID_ID) {
244 DCHECK(animation_host_); 245 DCHECK(animation_host_);
245 animation_host_->SetMutatorHostClient(this); 246 animation_host_->SetMutatorHostClient(this);
246 247
247 DCHECK(task_runner_provider_->IsImplThread()); 248 DCHECK(task_runner_provider_->IsImplThread());
248 DidVisibilityChange(this, visible_); 249 DidVisibilityChange(this, visible_);
249 250
250 SetDebugState(settings.initial_debug_state); 251 SetDebugState(settings.initial_debug_state);
251 252
252 // LTHI always has an active tree. 253 // LTHI always has an active tree.
253 active_tree_ = base::MakeUnique<LayerTreeImpl>( 254 active_tree_ = base::MakeUnique<LayerTreeImpl>(
(...skipping 3008 matching lines...) Expand 10 before | Expand all | Expand 10 after
3262 3263
3263 gfx::Rect layer_impl_bounds(layer_impl->bounds()); 3264 gfx::Rect layer_impl_bounds(layer_impl->bounds());
3264 3265
3265 gfx::RectF device_viewport_layer_impl_bounds = MathUtil::MapClippedRect( 3266 gfx::RectF device_viewport_layer_impl_bounds = MathUtil::MapClippedRect(
3266 layer_impl->ScreenSpaceTransform(), gfx::RectF(layer_impl_bounds)); 3267 layer_impl->ScreenSpaceTransform(), gfx::RectF(layer_impl_bounds));
3267 3268
3268 return device_viewport_layer_impl_bounds.ManhattanDistanceToPoint( 3269 return device_viewport_layer_impl_bounds.ManhattanDistanceToPoint(
3269 device_viewport_point); 3270 device_viewport_point);
3270 } 3271 }
3271 3272
3273 void LayerTreeHostImpl::MouseDownAt(const gfx::Point& viewport_point) {
3274 if (scroll_layer_id_when_mouse_over_scrollbar_ != Layer::INVALID_ID) {
bokan 2016/09/23 00:39:12 Nit: Negate the condition and early return instead
3275 captured_scrollbar_layer_id_ = scroll_layer_id_when_mouse_over_scrollbar_;
3276 ScrollbarAnimationController* animation_controller =
3277 ScrollbarAnimationControllerForId(captured_scrollbar_layer_id_);
3278 if (animation_controller)
3279 animation_controller->DidCaptureScrollbarBegin();
3280 }
3281 }
3282
3283 void LayerTreeHostImpl::MouseUp() {
3284 if (captured_scrollbar_layer_id_ != Layer::INVALID_ID) {
bokan 2016/09/23 00:39:12 Ditto here
3285 ScrollbarAnimationController* animation_controller =
3286 ScrollbarAnimationControllerForId(captured_scrollbar_layer_id_);
3287 if (animation_controller)
3288 animation_controller->DidCaptureScrollbarEnd();
3289
3290 captured_scrollbar_layer_id_ = Layer::INVALID_ID;
3291 }
3292 }
3293
3272 void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { 3294 void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) {
3273 gfx::PointF device_viewport_point = gfx::ScalePoint( 3295 gfx::PointF device_viewport_point = gfx::ScalePoint(
3274 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); 3296 gfx::PointF(viewport_point), active_tree_->device_scale_factor());
3275 LayerImpl* layer_impl = 3297 LayerImpl* layer_impl =
3276 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); 3298 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point);
3277 HandleMouseOverScrollbar(layer_impl); 3299 HandleMouseOverScrollbar(layer_impl);
3278 if (scroll_layer_id_when_mouse_over_scrollbar_ != Layer::INVALID_ID) 3300 if (scroll_layer_id_when_mouse_over_scrollbar_ != Layer::INVALID_ID)
3279 return; 3301 return;
3280 3302
3281 bool scroll_on_main_thread = false; 3303 bool scroll_on_main_thread = false;
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
4197 if (is_visible) { 4219 if (is_visible) {
4198 worker_context_visibility_ = 4220 worker_context_visibility_ =
4199 worker_context->CacheController()->ClientBecameVisible(); 4221 worker_context->CacheController()->ClientBecameVisible();
4200 } else { 4222 } else {
4201 worker_context->CacheController()->ClientBecameNotVisible( 4223 worker_context->CacheController()->ClientBecameNotVisible(
4202 std::move(worker_context_visibility_)); 4224 std::move(worker_context_visibility_));
4203 } 4225 }
4204 } 4226 }
4205 4227
4206 } // namespace cc 4228 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698