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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 2384053002: cancel overlay-scrollbar hover state when moving pointer out of window for ChromeOS (Closed)
Patch Set: add DCHECK 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | ui/events/blink/input_handler_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4aa0886dfb80d80425acf157f5d0e7d8daf1e872..d16fecde30c28f5605c5209ce26aacefed2a2854 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -209,6 +209,7 @@ LayerTreeHostImpl::LayerTreeHostImpl(
wheel_scrolling_(false),
scroll_affects_scroll_handler_(false),
scroll_layer_id_when_mouse_over_scrollbar_(Layer::INVALID_ID),
+ scroll_layer_id_when_mouse_near_scrollbar_(Layer::INVALID_ID),
captured_scrollbar_layer_id_(Layer::INVALID_ID),
tile_priorities_dirty_(false),
settings_(settings),
@@ -3232,6 +3233,7 @@ void LayerTreeHostImpl::MouseUp() {
}
void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) {
+ scroll_layer_id_when_mouse_near_scrollbar_ = Layer::INVALID_ID;
gfx::PointF device_viewport_point = gfx::ScalePoint(
gfx::PointF(viewport_point), active_tree_->device_scale_factor());
LayerImpl* layer_impl =
@@ -3255,6 +3257,8 @@ void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) {
if (!animation_controller)
return;
+ scroll_layer_id_when_mouse_near_scrollbar_ = scroll_layer_impl->id();
+
float distance_to_scrollbar = std::numeric_limits<float>::max();
for (ScrollbarLayerImplBase* scrollbar :
ScrollbarsFor(scroll_layer_impl->id()))
@@ -3266,6 +3270,24 @@ void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) {
active_tree_->device_scale_factor());
}
+void LayerTreeHostImpl::MouseLeave() {
+ // scroll_layer_id_when_mouse_near_scrollbar_ and
+ // scroll_layer_id_when_mouse_over_scrollbar_ should not be both true
+ DCHECK(!(scroll_layer_id_when_mouse_near_scrollbar_ != Layer::INVALID_ID &&
bokan 2016/10/05 14:00:09 This is more clearly expressed as: mouse_near_scr
+ scroll_layer_id_when_mouse_over_scrollbar_ != Layer::INVALID_ID));
+
+ int scroll_layer_id =
+ scroll_layer_id_when_mouse_near_scrollbar_ != Layer::INVALID_ID
+ ? scroll_layer_id_when_mouse_near_scrollbar_
+ : scroll_layer_id_when_mouse_over_scrollbar_;
+
+ ScrollbarAnimationController* animation_controller =
+ ScrollbarAnimationControllerForId(scroll_layer_id);
+
+ if (animation_controller)
+ animation_controller->DidMouseLeave();
+}
+
void LayerTreeHostImpl::HandleMouseOverScrollbar(LayerImpl* layer_impl) {
int new_id = Layer::INVALID_ID;
if (layer_impl && layer_impl->ToScrollbarLayer())
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | ui/events/blink/input_handler_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698