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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 void RenderWidgetCompositor::registerSelection( | 741 void RenderWidgetCompositor::registerSelection( |
739 const blink::WebSelection& selection) { | 742 const blink::WebSelection& selection) { |
740 layer_tree_host_->RegisterSelection(ConvertWebSelection(selection)); | 743 layer_tree_host_->RegisterSelection(ConvertWebSelection(selection)); |
741 } | 744 } |
742 | 745 |
743 void RenderWidgetCompositor::clearSelection() { | 746 void RenderWidgetCompositor::clearSelection() { |
744 cc::LayerSelection empty_selection; | 747 cc::LayerSelection empty_selection; |
745 layer_tree_host_->RegisterSelection(empty_selection); | 748 layer_tree_host_->RegisterSelection(empty_selection); |
746 } | 749 } |
747 | 750 |
748 void RenderWidgetCompositor::setHaveWheelEventHandlers(bool value) { | 751 static_assert( |
749 layer_tree_host_->SetHaveWheelEventHandlers(value); | 752 static_cast<cc::EventListenerClass>(blink::WebEventListenerClass::Touch) == |
| 753 cc::EventListenerClass::kTouch, |
| 754 "EventListenerClass and WebEventListenerClass enums must match"); |
| 755 static_assert(static_cast<cc::EventListenerClass>( |
| 756 blink::WebEventListenerClass::MouseWheel) == |
| 757 cc::EventListenerClass::kMouseWheel, |
| 758 "EventListenerClass and WebEventListenerClass enums must match"); |
| 759 |
| 760 static_assert( |
| 761 static_cast<uint32_t>(blink::WebEventListenerProperties::Nothing) == |
| 762 cc::EventListenerProperties::kNone, |
| 763 "EventListener and WebEventListener enums must match"); |
| 764 static_assert( |
| 765 static_cast<uint32_t>(blink::WebEventListenerProperties::Passive) == |
| 766 cc::EventListenerProperties::kPassive, |
| 767 "EventListener and WebEventListener enums must match"); |
| 768 static_assert( |
| 769 static_cast<uint32_t>(blink::WebEventListenerProperties::Blocking) == |
| 770 cc::EventListenerProperties::kBlocking, |
| 771 "EventListener and WebEventListener enums must match"); |
| 772 |
| 773 void RenderWidgetCompositor::setEventListenerProperties( |
| 774 blink::WebEventListenerClass eventClass, |
| 775 blink::WebEventListenerProperties properties) { |
| 776 layer_tree_host_->SetEventListenerProperties( |
| 777 static_cast<cc::EventListenerClass>(eventClass), |
| 778 static_cast<uint32_t>(properties)); |
750 } | 779 } |
751 | 780 |
752 bool RenderWidgetCompositor::haveWheelEventHandlers() const { | 781 blink::WebEventListenerProperties |
753 return layer_tree_host_->have_wheel_event_handlers(); | 782 RenderWidgetCompositor::eventListenerProperties( |
| 783 blink::WebEventListenerClass event_class) const { |
| 784 return static_cast<blink::WebEventListenerProperties>( |
| 785 layer_tree_host_->event_listener_properties( |
| 786 static_cast<cc::EventListenerClass>(event_class))); |
754 } | 787 } |
755 | 788 |
756 void RenderWidgetCompositor::setHaveScrollEventHandlers(bool has_handlers) { | 789 void RenderWidgetCompositor::setHaveScrollEventHandlers(bool has_handlers) { |
757 layer_tree_host_->SetHaveScrollEventHandlers(has_handlers); | 790 layer_tree_host_->SetHaveScrollEventHandlers(has_handlers); |
758 } | 791 } |
759 | 792 |
760 bool RenderWidgetCompositor::haveScrollEventHandlers() const { | 793 bool RenderWidgetCompositor::haveScrollEventHandlers() const { |
761 return layer_tree_host_->have_scroll_event_handlers(); | 794 return layer_tree_host_->have_scroll_event_handlers(); |
762 } | 795 } |
763 | 796 |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1116 #endif | 1149 #endif |
1117 return actual; | 1150 return actual; |
1118 } | 1151 } |
1119 | 1152 |
1120 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( | 1153 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( |
1121 float device_scale) { | 1154 float device_scale) { |
1122 layer_tree_host_->SetPaintedDeviceScaleFactor(device_scale); | 1155 layer_tree_host_->SetPaintedDeviceScaleFactor(device_scale); |
1123 } | 1156 } |
1124 | 1157 |
1125 } // namespace content | 1158 } // namespace content |
OLD | NEW |