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

Side by Side Diff: content/renderer/gpu/render_widget_compositor.cc

Issue 2740133002: Mark sub-frame root layer non-fast scrollable when wheel handlers present. (Closed)
Patch Set: Add mainframe version of test for verification. Created 3 years, 9 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 unified diff | Download patch
OLDNEW
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
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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 void RenderWidgetCompositor::SetContentSourceId(uint32_t id) { 1144 void RenderWidgetCompositor::SetContentSourceId(uint32_t id) {
1134 layer_tree_host_->SetContentSourceId(id); 1145 layer_tree_host_->SetContentSourceId(id);
1135 } 1146 }
1136 1147
1137 } // namespace content 1148 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/gpu/render_widget_compositor.h ('k') | content/test/data/page_with_scrollable_div.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698