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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 2554913002: Prevent overlay scrollbars expand or hover together (Closed)
Patch Set: for weiliangc's nit Created 3 years, 11 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 b7778b41aa861dfd7cf618bce0136ed52cb30e91..0417ad3ccdc3322f4ec96b0be18afb0da8a6bd24 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -3248,7 +3248,6 @@ void LayerTreeHostImpl::MouseUp() {
}
void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) {
- float distance_to_scrollbar = std::numeric_limits<float>::max();
gfx::PointF device_viewport_point = gfx::ScalePoint(
gfx::PointF(viewport_point), active_tree_->device_scale_factor());
LayerImpl* layer_impl =
@@ -3261,10 +3260,7 @@ void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) {
int new_id = Layer::INVALID_ID;
if (layer_impl && layer_impl->ToScrollbarLayer())
new_id = layer_impl->ToScrollbarLayer()->ScrollLayerId();
- if (new_id != Layer::INVALID_ID) {
- // Mouse over a scrollbar.
- distance_to_scrollbar = 0;
- } else {
+ if (new_id == Layer::INVALID_ID) {
bool scroll_on_main_thread = false;
uint32_t main_thread_scrolling_reasons;
LayerImpl* scroll_layer_impl = FindScrollLayerForDeviceViewportPoint(
@@ -3293,12 +3289,12 @@ void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) {
if (!new_animation_controller)
return;
- for (ScrollbarLayerImplBase* scrollbar : ScrollbarsFor(new_id))
- distance_to_scrollbar =
- std::min(distance_to_scrollbar,
- DeviceSpaceDistanceToLayer(device_viewport_point, scrollbar));
- new_animation_controller->DidMouseMoveNear(
- distance_to_scrollbar / active_tree_->device_scale_factor());
+ for (ScrollbarLayerImplBase* scrollbar : ScrollbarsFor(new_id)) {
+ new_animation_controller->DidMouseMoveNear(
+ scrollbar->orientation(),
+ DeviceSpaceDistanceToLayer(device_viewport_point, scrollbar) /
+ active_tree_->device_scale_factor());
+ }
}
void LayerTreeHostImpl::MouseLeave() {
« no previous file with comments | « cc/input/single_scrollbar_animation_controller_thinning_unittest.cc ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698