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

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: Merge remote-tracking branch 'origin/master' into fix-636438 Created 4 years, 2 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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 has_valid_compositor_frame_sink_(false), 243 has_valid_compositor_frame_sink_(false),
244 mutator_(nullptr) { 244 mutator_(nullptr),
245 captured_scrollbar_layer_id_(Layer::INVALID_ID) {
245 DCHECK(animation_host_); 246 DCHECK(animation_host_);
246 animation_host_->SetMutatorHostClient(this); 247 animation_host_->SetMutatorHostClient(this);
247 248
248 DCHECK(task_runner_provider_->IsImplThread()); 249 DCHECK(task_runner_provider_->IsImplThread());
249 DidVisibilityChange(this, visible_); 250 DidVisibilityChange(this, visible_);
250 251
251 SetDebugState(settings.initial_debug_state); 252 SetDebugState(settings.initial_debug_state);
252 253
253 // LTHI always has an active tree. 254 // LTHI always has an active tree.
254 active_tree_ = base::MakeUnique<LayerTreeImpl>( 255 active_tree_ = base::MakeUnique<LayerTreeImpl>(
(...skipping 2966 matching lines...) Expand 10 before | Expand all | Expand 10 after
3221 3222
3222 gfx::Rect layer_impl_bounds(layer_impl->bounds()); 3223 gfx::Rect layer_impl_bounds(layer_impl->bounds());
3223 3224
3224 gfx::RectF device_viewport_layer_impl_bounds = MathUtil::MapClippedRect( 3225 gfx::RectF device_viewport_layer_impl_bounds = MathUtil::MapClippedRect(
3225 layer_impl->ScreenSpaceTransform(), gfx::RectF(layer_impl_bounds)); 3226 layer_impl->ScreenSpaceTransform(), gfx::RectF(layer_impl_bounds));
3226 3227
3227 return device_viewport_layer_impl_bounds.ManhattanDistanceToPoint( 3228 return device_viewport_layer_impl_bounds.ManhattanDistanceToPoint(
3228 device_viewport_point); 3229 device_viewport_point);
3229 } 3230 }
3230 3231
3232 void LayerTreeHostImpl::MouseDownAt(const gfx::Point& viewport_point) {
3233 if (scroll_layer_id_when_mouse_over_scrollbar_ == Layer::INVALID_ID)
3234 return;
3235
3236 captured_scrollbar_layer_id_ = scroll_layer_id_when_mouse_over_scrollbar_;
3237 ScrollbarAnimationController* animation_controller =
3238 ScrollbarAnimationControllerForId(captured_scrollbar_layer_id_);
3239 if (animation_controller)
3240 animation_controller->DidCaptureScrollbarBegin();
3241 }
3242
3243 void LayerTreeHostImpl::MouseUp() {
3244 if (captured_scrollbar_layer_id_ == Layer::INVALID_ID)
3245 return;
3246
3247 ScrollbarAnimationController* animation_controller =
3248 ScrollbarAnimationControllerForId(captured_scrollbar_layer_id_);
3249 if (animation_controller)
3250 animation_controller->DidCaptureScrollbarEnd();
3251 captured_scrollbar_layer_id_ = Layer::INVALID_ID;
3252 }
3253
3231 void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { 3254 void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) {
3232 gfx::PointF device_viewport_point = gfx::ScalePoint( 3255 gfx::PointF device_viewport_point = gfx::ScalePoint(
3233 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); 3256 gfx::PointF(viewport_point), active_tree_->device_scale_factor());
3234 LayerImpl* layer_impl = 3257 LayerImpl* layer_impl =
3235 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); 3258 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point);
3236 HandleMouseOverScrollbar(layer_impl); 3259 HandleMouseOverScrollbar(layer_impl);
3237 if (scroll_layer_id_when_mouse_over_scrollbar_ != Layer::INVALID_ID) 3260 if (scroll_layer_id_when_mouse_over_scrollbar_ != Layer::INVALID_ID)
3238 return; 3261 return;
3239 3262
3240 bool scroll_on_main_thread = false; 3263 bool scroll_on_main_thread = false;
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after
4160 if (is_visible) { 4183 if (is_visible) {
4161 worker_context_visibility_ = 4184 worker_context_visibility_ =
4162 worker_context->CacheController()->ClientBecameVisible(); 4185 worker_context->CacheController()->ClientBecameVisible();
4163 } else { 4186 } else {
4164 worker_context->CacheController()->ClientBecameNotVisible( 4187 worker_context->CacheController()->ClientBecameNotVisible(
4165 std::move(worker_context_visibility_)); 4188 std::move(worker_context_visibility_));
4166 } 4189 }
4167 } 4190 }
4168 4191
4169 } // namespace cc 4192 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698