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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: cc/trees/layer_tree_host_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index fce0b7982d0207ca0f0cdc3b77e978f7f6b8be96..baaba9dfdaab1fb14836d46ad5d6be239f133f28 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -240,7 +240,8 @@ LayerTreeHostImpl::LayerTreeHostImpl(
id_(id),
requires_high_res_to_draw_(false),
is_likely_to_require_a_draw_(false),
- mutator_(nullptr) {
+ mutator_(nullptr),
+ captured_scrollbar_layer_id_(Layer::INVALID_ID) {
DCHECK(animation_host_);
animation_host_->SetMutatorHostClient(this);
@@ -3269,6 +3270,27 @@ float LayerTreeHostImpl::DeviceSpaceDistanceToLayer(
device_viewport_point);
}
+void LayerTreeHostImpl::MouseDownAt(const gfx::Point& viewport_point) {
+ 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
+ captured_scrollbar_layer_id_ = scroll_layer_id_when_mouse_over_scrollbar_;
+ ScrollbarAnimationController* animation_controller =
+ ScrollbarAnimationControllerForId(captured_scrollbar_layer_id_);
+ if (animation_controller)
+ animation_controller->DidCaptureScrollbarBegin();
+ }
+}
+
+void LayerTreeHostImpl::MouseUp() {
+ if (captured_scrollbar_layer_id_ != Layer::INVALID_ID) {
bokan 2016/09/23 00:39:12 Ditto here
+ ScrollbarAnimationController* animation_controller =
+ ScrollbarAnimationControllerForId(captured_scrollbar_layer_id_);
+ if (animation_controller)
+ animation_controller->DidCaptureScrollbarEnd();
+
+ captured_scrollbar_layer_id_ = Layer::INVALID_ID;
+ }
+}
+
void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) {
gfx::PointF device_viewport_point = gfx::ScalePoint(
gfx::PointF(viewport_point), active_tree_->device_scale_factor());

Powered by Google App Engine
This is Rietveld 408576698