| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/renderer_host/render_widget_host_view_views.h" | 5 #include "chrome/browser/renderer_host/render_widget_host_view_views.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 break; | 710 break; |
| 711 } | 711 } |
| 712 | 712 |
| 713 if (!point) | 713 if (!point) |
| 714 return TOUCH_STATUS_UNKNOWN; | 714 return TOUCH_STATUS_UNKNOWN; |
| 715 | 715 |
| 716 if (status != TOUCH_STATUS_START) | 716 if (status != TOUCH_STATUS_START) |
| 717 status = TOUCH_STATUS_CONTINUE; | 717 status = TOUCH_STATUS_CONTINUE; |
| 718 | 718 |
| 719 // Update the location and state of the point. | 719 // Update the location and state of the point. |
| 720 point->state = TouchPointStateFromEvent(&e); |
| 721 if (point->state == WebKit::WebTouchPoint::StateMoved) { |
| 722 // It is possible for badly written touch drivers to emit Move events even |
| 723 // when the touch location hasn't changed. In such cases, consume the event |
| 724 // and pretend nothing happened. |
| 725 if (point->position.x == e.x() && point->position.y == e.y()) { |
| 726 return status; |
| 727 } |
| 728 } |
| 720 UpdateTouchPointPosition(&e, GetPosition(), point); | 729 UpdateTouchPointPosition(&e, GetPosition(), point); |
| 721 point->state = TouchPointStateFromEvent(&e); | |
| 722 | 730 |
| 723 // Mark the rest of the points as stationary. | 731 // Mark the rest of the points as stationary. |
| 724 for (int i = 0; i < touch_event_.touchPointsLength; ++i) { | 732 for (int i = 0; i < touch_event_.touchPointsLength; ++i) { |
| 725 WebKit::WebTouchPoint* iter = touch_event_.touchPoints + i; | 733 WebKit::WebTouchPoint* iter = touch_event_.touchPoints + i; |
| 726 if (iter != point) { | 734 if (iter != point) { |
| 727 iter->state = WebKit::WebTouchPoint::StateStationary; | 735 iter->state = WebKit::WebTouchPoint::StateStationary; |
| 728 } | 736 } |
| 729 } | 737 } |
| 730 | 738 |
| 731 // Update the type of the touch event. | 739 // Update the type of the touch event. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 753 } | 761 } |
| 754 | 762 |
| 755 // static | 763 // static |
| 756 RenderWidgetHostView* | 764 RenderWidgetHostView* |
| 757 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( | 765 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( |
| 758 gfx::NativeView widget) { | 766 gfx::NativeView widget) { |
| 759 gpointer user_data = g_object_get_data(G_OBJECT(widget), | 767 gpointer user_data = g_object_get_data(G_OBJECT(widget), |
| 760 kRenderWidgetHostViewKey); | 768 kRenderWidgetHostViewKey); |
| 761 return reinterpret_cast<RenderWidgetHostView*>(user_data); | 769 return reinterpret_cast<RenderWidgetHostView*>(user_data); |
| 762 } | 770 } |
| OLD | NEW |