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 #include <limits> | 8 #include <limits> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 cmd->HasSwitch(cc::switches::kEnableMainFrameBeforeActivation) && | 250 cmd->HasSwitch(cc::switches::kEnableMainFrameBeforeActivation) && |
251 !cmd->HasSwitch(cc::switches::kDisableMainFrameBeforeActivation); | 251 !cmd->HasSwitch(cc::switches::kDisableMainFrameBeforeActivation); |
252 settings.accelerated_animation_enabled = | 252 settings.accelerated_animation_enabled = |
253 compositor_deps_->IsThreadedAnimationEnabled(); | 253 compositor_deps_->IsThreadedAnimationEnabled(); |
254 | 254 |
255 settings.use_compositor_animation_timelines = | 255 settings.use_compositor_animation_timelines = |
256 !cmd->HasSwitch(switches::kDisableCompositorAnimationTimelines); | 256 !cmd->HasSwitch(switches::kDisableCompositorAnimationTimelines); |
257 blink::WebRuntimeFeatures::enableCompositorAnimationTimelines( | 257 blink::WebRuntimeFeatures::enableCompositorAnimationTimelines( |
258 settings.use_compositor_animation_timelines); | 258 settings.use_compositor_animation_timelines); |
259 | 259 |
| 260 settings.use_mouse_wheel_gestures = |
| 261 cmd->HasSwitch(switches::kEnableWheelGestures); |
| 262 |
260 settings.default_tile_size = CalculateDefaultTileSize(device_scale_factor); | 263 settings.default_tile_size = CalculateDefaultTileSize(device_scale_factor); |
261 if (cmd->HasSwitch(switches::kDefaultTileWidth)) { | 264 if (cmd->HasSwitch(switches::kDefaultTileWidth)) { |
262 int tile_width = 0; | 265 int tile_width = 0; |
263 GetSwitchValueAsInt(*cmd, | 266 GetSwitchValueAsInt(*cmd, |
264 switches::kDefaultTileWidth, | 267 switches::kDefaultTileWidth, |
265 1, | 268 1, |
266 std::numeric_limits<int>::max(), | 269 std::numeric_limits<int>::max(), |
267 &tile_width); | 270 &tile_width); |
268 settings.default_tile_size.set_width(tile_width); | 271 settings.default_tile_size.set_width(tile_width); |
269 } | 272 } |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 void RenderWidgetCompositor::registerSelection( | 739 void RenderWidgetCompositor::registerSelection( |
737 const blink::WebSelection& selection) { | 740 const blink::WebSelection& selection) { |
738 layer_tree_host_->RegisterSelection(ConvertWebSelection(selection)); | 741 layer_tree_host_->RegisterSelection(ConvertWebSelection(selection)); |
739 } | 742 } |
740 | 743 |
741 void RenderWidgetCompositor::clearSelection() { | 744 void RenderWidgetCompositor::clearSelection() { |
742 cc::LayerSelection empty_selection; | 745 cc::LayerSelection empty_selection; |
743 layer_tree_host_->RegisterSelection(empty_selection); | 746 layer_tree_host_->RegisterSelection(empty_selection); |
744 } | 747 } |
745 | 748 |
746 void RenderWidgetCompositor::setHaveWheelEventHandlers(bool value) { | 749 static_assert( |
747 layer_tree_host_->SetHaveWheelEventHandlers(value); | 750 static_cast<cc::EventListenerClass>(blink::WebEventListenerClass::Touch) == |
| 751 cc::EventListenerClass::kTouch, |
| 752 "EventListenerClass and WebEventListenerClass enums must match"); |
| 753 static_assert(static_cast<cc::EventListenerClass>( |
| 754 blink::WebEventListenerClass::MouseWheel) == |
| 755 cc::EventListenerClass::kMouseWheel, |
| 756 "EventListenerClass and WebEventListenerClass enums must match"); |
| 757 |
| 758 static_assert(static_cast<cc::EventListenerProperties>( |
| 759 blink::WebEventListenerProperties::Nothing) == |
| 760 cc::EventListenerProperties::kNone, |
| 761 "EventListener and WebEventListener enums must match"); |
| 762 static_assert(static_cast<cc::EventListenerProperties>( |
| 763 blink::WebEventListenerProperties::Passive) == |
| 764 cc::EventListenerProperties::kPassive, |
| 765 "EventListener and WebEventListener enums must match"); |
| 766 static_assert(static_cast<cc::EventListenerProperties>( |
| 767 blink::WebEventListenerProperties::Blocking) == |
| 768 cc::EventListenerProperties::kBlocking, |
| 769 "EventListener and WebEventListener enums must match"); |
| 770 |
| 771 void RenderWidgetCompositor::setEventListenerProperties( |
| 772 blink::WebEventListenerClass eventClass, |
| 773 blink::WebEventListenerProperties properties) { |
| 774 layer_tree_host_->SetEventListenerProperties( |
| 775 static_cast<cc::EventListenerClass>(eventClass), |
| 776 static_cast<cc::EventListenerProperties>(properties)); |
748 } | 777 } |
749 | 778 |
750 bool RenderWidgetCompositor::haveWheelEventHandlers() const { | 779 blink::WebEventListenerProperties |
751 return layer_tree_host_->have_wheel_event_handlers(); | 780 RenderWidgetCompositor::eventListenerProperties( |
| 781 blink::WebEventListenerClass event_class) const { |
| 782 return static_cast<blink::WebEventListenerProperties>( |
| 783 layer_tree_host_->event_listener_properties( |
| 784 static_cast<cc::EventListenerClass>(event_class))); |
752 } | 785 } |
753 | 786 |
754 void RenderWidgetCompositor::setHaveScrollEventHandlers(bool has_handlers) { | 787 void RenderWidgetCompositor::setHaveScrollEventHandlers(bool has_handlers) { |
755 layer_tree_host_->SetHaveScrollEventHandlers(has_handlers); | 788 layer_tree_host_->SetHaveScrollEventHandlers(has_handlers); |
756 } | 789 } |
757 | 790 |
758 bool RenderWidgetCompositor::haveScrollEventHandlers() const { | 791 bool RenderWidgetCompositor::haveScrollEventHandlers() const { |
759 return layer_tree_host_->have_scroll_event_handlers(); | 792 return layer_tree_host_->have_scroll_event_handlers(); |
760 } | 793 } |
761 | 794 |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1114 #endif | 1147 #endif |
1115 return actual; | 1148 return actual; |
1116 } | 1149 } |
1117 | 1150 |
1118 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( | 1151 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( |
1119 float device_scale) { | 1152 float device_scale) { |
1120 layer_tree_host_->SetPaintedDeviceScaleFactor(device_scale); | 1153 layer_tree_host_->SetPaintedDeviceScaleFactor(device_scale); |
1121 } | 1154 } |
1122 | 1155 |
1123 } // namespace content | 1156 } // namespace content |
OLD | NEW |