| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/renderer/gpu/render_widget_compositor.h" | 5 #include "content/renderer/gpu/render_widget_compositor.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 "EventListener and WebEventListener enums must match"); | 822 "EventListener and WebEventListener enums must match"); |
| 823 | 823 |
| 824 void RenderWidgetCompositor::setEventListenerProperties( | 824 void RenderWidgetCompositor::setEventListenerProperties( |
| 825 blink::WebEventListenerClass eventClass, | 825 blink::WebEventListenerClass eventClass, |
| 826 blink::WebEventListenerProperties properties) { | 826 blink::WebEventListenerProperties properties) { |
| 827 layer_tree_host_->SetEventListenerProperties( | 827 layer_tree_host_->SetEventListenerProperties( |
| 828 static_cast<cc::EventListenerClass>(eventClass), | 828 static_cast<cc::EventListenerClass>(eventClass), |
| 829 static_cast<cc::EventListenerProperties>(properties)); | 829 static_cast<cc::EventListenerProperties>(properties)); |
| 830 } | 830 } |
| 831 | 831 |
| 832 void RenderWidgetCompositor::updateTouchRectsForSubframeIfNecessary() { | 832 void RenderWidgetCompositor::updateEventRectsForSubframeIfNecessary() { |
| 833 if (!is_for_oopif_) | 833 if (!is_for_oopif_) |
| 834 return; | 834 return; |
| 835 | 835 |
| 836 // If this is an oopif sub-frame compositor, we won't be getting TouchRects | 836 // If this is an oopif sub-frame compositor, we won't be getting TouchRects |
| 837 // from ScrollingCoordinator, so to make sure touch events are handled | 837 // from ScrollingCoordinator, so to make sure touch events are handled |
| 838 // properly, mark the entire root layer as a TouchRect. | 838 // properly, mark the entire root layer as a TouchRect. |
| 839 // TODO(wjmaclean): remove this when ScrollingCoordinator is made per-frame, | 839 // TODO(wjmaclean): remove this when ScrollingCoordinator is made per-frame, |
| 840 // as opposed to per-page. | 840 // as opposed to per-page. |
| 841 using blink::WebEventListenerProperties; | 841 using blink::WebEventListenerProperties; |
| 842 using blink::WebEventListenerClass; | 842 using blink::WebEventListenerClass; |
| 843 | 843 |
| 844 blink::WebEventListenerProperties touch_start_properties = | 844 WebEventListenerProperties touch_start_properties = |
| 845 eventListenerProperties(WebEventListenerClass::TouchStartOrMove); | 845 eventListenerProperties(WebEventListenerClass::TouchStartOrMove); |
| 846 blink::WebEventListenerProperties touch_end_cancel_properties = | 846 WebEventListenerProperties touch_end_cancel_properties = |
| 847 eventListenerProperties(WebEventListenerClass::TouchEndOrCancel); | 847 eventListenerProperties(WebEventListenerClass::TouchEndOrCancel); |
| 848 bool has_touch_handlers = | 848 bool has_touch_handlers = |
| 849 touch_start_properties == WebEventListenerProperties::Blocking || | 849 touch_start_properties == WebEventListenerProperties::Blocking || |
| 850 touch_start_properties == | 850 touch_start_properties == |
| 851 WebEventListenerProperties::BlockingAndPassive || | 851 WebEventListenerProperties::BlockingAndPassive || |
| 852 touch_end_cancel_properties == WebEventListenerProperties::Blocking || | 852 touch_end_cancel_properties == WebEventListenerProperties::Blocking || |
| 853 touch_end_cancel_properties == | 853 touch_end_cancel_properties == |
| 854 WebEventListenerProperties::BlockingAndPassive; | 854 WebEventListenerProperties::BlockingAndPassive; |
| 855 | 855 |
| 856 WebEventListenerProperties wheel_event_properties = |
| 857 eventListenerProperties(WebEventListenerClass::MouseWheel); |
| 858 bool has_wheel_handlers = |
| 859 wheel_event_properties == WebEventListenerProperties::Blocking || |
| 860 wheel_event_properties == WebEventListenerProperties::BlockingAndPassive; |
| 861 |
| 856 cc::Layer* root_layer = layer_tree_host_->root_layer(); | 862 cc::Layer* root_layer = layer_tree_host_->root_layer(); |
| 857 cc::Region touch_handler_region; | 863 cc::Region touch_handler_region; |
| 858 if (has_touch_handlers) | 864 if (has_touch_handlers) |
| 859 touch_handler_region = gfx::Rect(gfx::Point(), root_layer->bounds()); | 865 touch_handler_region = gfx::Rect(gfx::Point(), root_layer->bounds()); |
| 860 root_layer->SetTouchEventHandlerRegion(touch_handler_region); | 866 root_layer->SetTouchEventHandlerRegion(touch_handler_region); |
| 867 |
| 868 cc::Region wheel_handler_region; |
| 869 if (has_wheel_handlers) |
| 870 wheel_handler_region = gfx::Rect(gfx::Point(), root_layer->bounds()); |
| 871 root_layer->SetNonFastScrollableRegion(wheel_handler_region); |
| 861 } | 872 } |
| 862 | 873 |
| 863 blink::WebEventListenerProperties | 874 blink::WebEventListenerProperties |
| 864 RenderWidgetCompositor::eventListenerProperties( | 875 RenderWidgetCompositor::eventListenerProperties( |
| 865 blink::WebEventListenerClass event_class) const { | 876 blink::WebEventListenerClass event_class) const { |
| 866 return static_cast<blink::WebEventListenerProperties>( | 877 return static_cast<blink::WebEventListenerProperties>( |
| 867 layer_tree_host_->event_listener_properties( | 878 layer_tree_host_->event_listener_properties( |
| 868 static_cast<cc::EventListenerClass>(event_class))); | 879 static_cast<cc::EventListenerClass>(event_class))); |
| 869 } | 880 } |
| 870 | 881 |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1124 void RenderWidgetCompositor::SetDeviceColorSpace( | 1135 void RenderWidgetCompositor::SetDeviceColorSpace( |
| 1125 const gfx::ColorSpace& color_space) { | 1136 const gfx::ColorSpace& color_space) { |
| 1126 layer_tree_host_->SetDeviceColorSpace(color_space); | 1137 layer_tree_host_->SetDeviceColorSpace(color_space); |
| 1127 } | 1138 } |
| 1128 | 1139 |
| 1129 void RenderWidgetCompositor::SetIsForOopif(bool is_for_oopif) { | 1140 void RenderWidgetCompositor::SetIsForOopif(bool is_for_oopif) { |
| 1130 is_for_oopif_ = is_for_oopif; | 1141 is_for_oopif_ = is_for_oopif; |
| 1131 } | 1142 } |
| 1132 | 1143 |
| 1133 } // namespace content | 1144 } // namespace content |
| OLD | NEW |